Skip to content

Commit

Permalink
remove assertions
Browse files Browse the repository at this point in the history
Signed-off-by: pawel.hulek <[email protected]>
  • Loading branch information
pawelhulek committed Jan 31, 2024
1 parent 0b67ef8 commit e9ebfa2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions custom_components/pgnig_gas_sensor/PgnigApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@
'Accept': 'application/json',
}


class PgnigApi:

def __init__(self, username, password) -> None:
self.username = username
self.password = password

def meterList(self) -> PpgList:
dictionary = requests.get(devices_list_url, headers={
return ppg_list_from_dict(requests.get(devices_list_url, headers={
'Content-Type': 'application/json',
'Accept': 'application/json',
'AuthToken': self.login()
}).json()

return ppg_list_from_dict(dictionary)
}).json())

def readingForMeter(self, meter_id) -> PpgReadingForMeter:
return ppg_reading_for_meter_from_dict(requests.get(readings_url + meter_id, headers={
Expand Down
2 changes: 0 additions & 2 deletions custom_components/pgnig_gas_sensor/PgpList.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def from_bool(x: Any) -> bool:


def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
assert isinstance(x, list)
return [f(y) for y in x]


Expand Down Expand Up @@ -115,7 +114,6 @@ class PpgList:

@staticmethod
def from_dict(obj: Any) -> 'PpgList':
assert isinstance(obj, dict)
ppg_list = from_list(PpgListElement.from_dict, obj.get("PpgList"))
code = from_int(obj.get("Code"))
message = from_none(obj.get("Message"))
Expand Down

0 comments on commit e9ebfa2

Please sign in to comment.