Skip to content

Commit

Permalink
Remove 'shadowing' warnings by renanming 'tuple' function parameters …
Browse files Browse the repository at this point in the history
…to 'tpl'
  • Loading branch information
anschweitzer committed May 5, 2024
1 parent 7b07dfe commit df96c15
Show file tree
Hide file tree
Showing 34 changed files with 84 additions and 84 deletions.
18 changes: 9 additions & 9 deletions src/gwproto/gs/gs_dispatch_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ class GsDispatch_Maker:
type_name = "d"

def __init__(self, relay_state):
tuple = GsDispatch(RelayState=relay_state)
tuple.check_for_errors()
self.tuple = tuple
tpl = GsDispatch(RelayState=relay_state)
tpl.check_for_errors()
self.tuple = tpl

@classmethod
def tuple_to_type(cls, tuple: GsDispatch) -> bytes:
tuple.check_for_errors()
return tuple.as_type()
def tuple_to_type(cls, tpl: GsDispatch) -> bytes:
tpl.check_for_errors()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, b: bytes) -> GsDispatch:
(relay_state,) = struct.unpack("<h", b)
tuple = GsDispatch(RelayState=relay_state)
tuple.check_for_errors
return tuple
tpl = GsDispatch(RelayState=relay_state)
tpl.check_for_errors()
return tpl
18 changes: 9 additions & 9 deletions src/gwproto/gs/gs_pwr_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ class GsPwr_Maker:
type_name = "p"

def __init__(self, power):
tuple = GsPwr(Power=power)
tuple.check_for_errors()
self.tuple = tuple
tpl = GsPwr(Power=power)
tpl.check_for_errors()
self.tuple = tpl

@classmethod
def tuple_to_type(cls, tuple: GsPwr) -> bytes:
tuple.check_for_errors()
return tuple.as_type()
def tuple_to_type(cls, tpl: GsPwr) -> bytes:
tpl.check_for_errors()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, b: bytes) -> GsPwr:
(power,) = struct.unpack("<h", b)
tuple = GsPwr(Power=power)
tuple.check_for_errors
return tuple
tpl = GsPwr(Power=power)
tpl.check_for_errors()
return tpl
6 changes: 3 additions & 3 deletions src/gwproto/types/data_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: DataChannel) -> bytes:
def tuple_to_type(cls, tpl: DataChannel) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> DataChannel:
Expand Down Expand Up @@ -223,7 +223,7 @@ def check_is_spaceheat_name(v: str) -> None:
or a hyphen, and the first word starts with an alphabet character.
Args:
candidate (str): The string to be validated.
v (str): The string to be validated.
Raises:
ValueError: If the provided string is not in SpaceheatName format.
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/egauge_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: EgaugeIo) -> bytes:
def tuple_to_type(cls, tpl: EgaugeIo) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> EgaugeIo:
Expand Down
6 changes: 3 additions & 3 deletions src/gwproto/types/egauge_register_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __init__(
address: int,
name: str,
description: str,
type: str,
type: str, # noqa
denominator: int,
unit: str,
):
Expand All @@ -145,11 +145,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: EgaugeRegisterConfig) -> bytes:
def tuple_to_type(cls, tpl: EgaugeRegisterConfig) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> EgaugeRegisterConfig:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/electric_meter_cac_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: ElectricMeterCacGt) -> bytes:
def tuple_to_type(cls, tpl: ElectricMeterCacGt) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> ElectricMeterCacGt:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/electric_meter_component_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: ElectricMeterComponentGt) -> bytes:
def tuple_to_type(cls, tpl: ElectricMeterComponentGt) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> ElectricMeterComponentGt:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_dispatch_boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtDispatchBoolean) -> bytes:
def tuple_to_type(cls, tpl: GtDispatchBoolean) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtDispatchBoolean:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_dispatch_boolean_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtDispatchBooleanLocal) -> bytes:
def tuple_to_type(cls, tpl: GtDispatchBooleanLocal) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtDispatchBooleanLocal:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_driver_booleanactuator_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtDriverBooleanactuatorCmd) -> bytes:
def tuple_to_type(cls, tpl: GtDriverBooleanactuatorCmd) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtDriverBooleanactuatorCmd:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_sh_booleanactuator_cmd_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtShBooleanactuatorCmdStatus) -> bytes:
def tuple_to_type(cls, tpl: GtShBooleanactuatorCmdStatus) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtShBooleanactuatorCmdStatus:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_sh_cli_atn_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtShCliAtnCmd) -> bytes:
def tuple_to_type(cls, tpl: GtShCliAtnCmd) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtShCliAtnCmd:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_sh_multipurpose_telemetry_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtShMultipurposeTelemetryStatus) -> bytes:
def tuple_to_type(cls, tpl: GtShMultipurposeTelemetryStatus) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtShMultipurposeTelemetryStatus:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_sh_simple_telemetry_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtShSimpleTelemetryStatus) -> bytes:
def tuple_to_type(cls, tpl: GtShSimpleTelemetryStatus) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtShSimpleTelemetryStatus:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_sh_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtShStatus) -> bytes:
def tuple_to_type(cls, tpl: GtShStatus) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtShStatus:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_sh_telemetry_from_multipurpose_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtShTelemetryFromMultipurposeSensor) -> bytes:
def tuple_to_type(cls, tpl: GtShTelemetryFromMultipurposeSensor) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtShTelemetryFromMultipurposeSensor:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/gt_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: GtTelemetry) -> bytes:
def tuple_to_type(cls, tpl: GtTelemetry) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> GtTelemetry:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/heartbeat_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: HeartbeatB) -> bytes:
def tuple_to_type(cls, tpl: HeartbeatB) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> HeartbeatB:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/multipurpose_sensor_cac_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: MultipurposeSensorCacGt) -> bytes:
def tuple_to_type(cls, tpl: MultipurposeSensorCacGt) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> MultipurposeSensorCacGt:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/multipurpose_sensor_component_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: MultipurposeSensorComponentGt) -> bytes:
def tuple_to_type(cls, tpl: MultipurposeSensorComponentGt) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> MultipurposeSensorComponentGt:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/pipe_flow_sensor_cac_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: PipeFlowSensorCacGt) -> bytes:
def tuple_to_type(cls, tpl: PipeFlowSensorCacGt) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> PipeFlowSensorCacGt:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/pipe_flow_sensor_component_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: PipeFlowSensorComponentGt) -> bytes:
def tuple_to_type(cls, tpl: PipeFlowSensorComponentGt) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> PipeFlowSensorComponentGt:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/power_watts.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: PowerWatts) -> bytes:
def tuple_to_type(cls, tpl: PowerWatts) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> PowerWatts:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/relay_cac_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: RelayCacGt) -> bytes:
def tuple_to_type(cls, tpl: RelayCacGt) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> RelayCacGt:
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/types/relay_component_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ def __init__(
)

@classmethod
def tuple_to_type(cls, tuple: RelayComponentGt) -> bytes:
def tuple_to_type(cls, tpl: RelayComponentGt) -> bytes:
"""
Given a Python class object, returns the serialized JSON type object.
"""
return tuple.as_type()
return tpl.as_type()

@classmethod
def type_to_tuple(cls, t: bytes) -> RelayComponentGt:
Expand Down

0 comments on commit df96c15

Please sign in to comment.