Skip to content

Commit

Permalink
more typing
Browse files Browse the repository at this point in the history
  • Loading branch information
austinmroczek committed Dec 24, 2024
1 parent df521a0 commit 60dd1fe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions total_connect_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _send_one_request(self, operation_name, args):
API_APP_ID = "14588"
API_APP_VERSION = "1.0.34"

def request(self, operation_name, args, attempts_remaining=5):
def request(self, operation_name, args, attempts_remaining: int=5):
"""Send a SOAP request. args is a list or tuple defining the
parameters to the operation.
"""
Expand Down Expand Up @@ -313,7 +313,7 @@ def authenticate(self):
LOGGER.info(f"{self.username} authenticated: {len(self._locations)} locations")
self.times["authenticate()"] = time.time() - start_time

def validate_usercode(self, device_id, usercode):
def validate_usercode(self, device_id, usercode:str)-> bool:
"""Return True if the usercode is valid for the device."""
response = self.request(
"ValidateUserCode", (self.token, device_id, str(usercode))
Expand All @@ -328,7 +328,7 @@ def validate_usercode(self, device_id, usercode):
return False
return True

def is_logged_in(self):
def is_logged_in(self)->bool:
"""Return true if the client is logged into the Total Connect service
with valid credentials.
"""
Expand All @@ -344,7 +344,7 @@ def log_out(self):
LOGGER.info("Logout Successful")
self.token = None

def get_number_locations(self):
def get_number_locations(self)->int:
"""Return the number of locations. Home Assistant needs a way
to force the locations to load inside a callable function.
"""
Expand Down
4 changes: 2 additions & 2 deletions total_connect_client/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class TotalConnectDevice:
"""Device class for Total Connect."""

def __init__(self, info):
def __init__(self, info: dict):
"""Initialize device based on DeviceInfoBasic."""
self.deviceid = info.get("DeviceID")
self.name = info.get("DeviceName")
Expand Down Expand Up @@ -61,7 +61,7 @@ def doorbell_info(self, data):
if data:
self._doorbell_info = data

def is_doorbell(self):
def is_doorbell(self) -> bool:
"""Return true if a doorbell."""
if self._doorbell_info and self._doorbell_info["IsExistingDoorBellUser"] == 1:
return True
Expand Down
2 changes: 1 addition & 1 deletion total_connect_client/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _build_partition_list(self, partition_id=None):
)
return {"int": [partition_id]}

def arm(self, arm_type, partition_id=None):
def arm(self, arm_type: int, partition_id=None):
"""Arm the given partition. If no partition is given, arm all partitions."""
# see https://rs.alarmnet.com/TC21api/tc2.asmx?op=ArmSecuritySystemPartitionsV1
assert isinstance(arm_type, ArmType)
Expand Down
4 changes: 2 additions & 2 deletions total_connect_client/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def __str__(self):

return data

def arm(self, arm_type):
def arm(self, arm_type: int):
"""Arm the partition."""
self.parent.arm(arm_type, self.partitionid)

def disarm(self):
"""Disarm the partition."""
self.parent.disarm(self.partitionid)

def _update(self, info):
def _update(self, info: dict):
"""Update partition based on PartitionInfo."""
astate = (info or {}).get("ArmingState")
if astate is None:
Expand Down

0 comments on commit 60dd1fe

Please sign in to comment.