Skip to content

Commit

Permalink
Fix flake8 SIM910 errors and add pin pydantic==^1 (#1793)
Browse files Browse the repository at this point in the history
  • Loading branch information
rytilahti authored Jul 14, 2023
1 parent e15252c commit d4ca76e
Show file tree
Hide file tree
Showing 6 changed files with 1,002 additions and 1,017 deletions.
24 changes: 12 additions & 12 deletions miio/integrations/cgllc/airmonitor/airqualitymonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, data):
@property
def power(self) -> Optional[str]:
"""Current power state."""
return self.data.get("power", None)
return self.data.get("power")

@property
def is_on(self) -> bool:
Expand All @@ -77,12 +77,12 @@ def usb_power(self) -> Optional[bool]:
@property
def aqi(self) -> Optional[int]:
"""Air quality index value (0..600)."""
return self.data.get("aqi", None)
return self.data.get("aqi")

@property
def battery(self) -> Optional[int]:
"""Current battery level (0..100)."""
return self.data.get("battery", None)
return self.data.get("battery")

@property
def display_clock(self) -> Optional[bool]:
Expand All @@ -101,47 +101,47 @@ def night_mode(self) -> Optional[bool]:
@property
def night_time_begin(self) -> Optional[str]:
"""Return the begin of the night time."""
return self.data.get("night_beg_time", None)
return self.data.get("night_beg_time")

@property
def night_time_end(self) -> Optional[str]:
"""Return the end of the night time."""
return self.data.get("night_end_time", None)
return self.data.get("night_end_time")

@property
def sensor_state(self) -> Optional[str]:
"""Sensor state."""
return self.data.get("sensor_state", None)
return self.data.get("sensor_state")

@property
def co2(self) -> Optional[int]:
"""Return co2 value (400...9999ppm)."""
return self.data.get("co2", None)
return self.data.get("co2")

@property
def co2e(self) -> Optional[int]:
"""Return co2e value (400...9999ppm)."""
return self.data.get("co2e", None)
return self.data.get("co2e")

@property
def humidity(self) -> Optional[float]:
"""Return humidity value (0...100%)."""
return self.data.get("humidity", None)
return self.data.get("humidity")

@property
def pm25(self) -> Optional[float]:
"""Return pm2.5 value (0...999μg/m³)."""
return self.data.get("pm25", None)
return self.data.get("pm25")

@property
def temperature(self) -> Optional[float]:
"""Return temperature value (-10...50°C)."""
return self.data.get("temperature", None)
return self.data.get("temperature")

@property
def tvoc(self) -> Optional[int]:
"""Return tvoc value."""
return self.data.get("tvoc", None)
return self.data.get("tvoc")


class AirQualityMonitor(Device):
Expand Down
2 changes: 1 addition & 1 deletion miio/integrations/genericmiot/genericmiot.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def call_action(self, name: str, params=None):
def change_setting(self, name: str, params=None):
"""Change setting value."""
params = params if params is not None else []
setting = self._properties.get(name, None)
setting = self._properties.get(name)
if setting is None:
raise ValueError("No property found for name %s" % name)
if setting.access & AccessFlags.Write == 0:
Expand Down
4 changes: 2 additions & 2 deletions miio/integrations/lumi/gateway/devices/subdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
self.get_prop_exp_dict = {}
for prop in model_info.get("properties", []):
prop_name = prop.get("name", prop["property"])
self._props[prop_name] = prop.get("default", None)
self._props[prop_name] = prop.get("default")
if prop.get("get") == "get_property_exp":
self.get_prop_exp_dict[prop["property"]] = prop

Expand Down Expand Up @@ -313,7 +313,7 @@ async def subscribe_events(self):
extra=self.push_events[action]["extra"],
source_sid=self.sid,
source_model=self.zigbee_model,
event=self.push_events[action].get("event", None),
event=self.push_events[action].get("event"),
command_extra=self.push_events[action].get("command_extra", ""),
trigger_value=self.push_events[action].get("trigger_value"),
)
Expand Down
2 changes: 1 addition & 1 deletion miio/integrations/roborock/vacuum/vacuumcontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def progress(self) -> int:
def sid(self) -> int:
"""Sound ID for the sound being installed."""
# this is missing on install confirmation, so let's use get
return self.data.get("sid_in_progress", None)
return self.data.get("sid_in_progress")

@property
def error(self) -> int:
Expand Down
Loading

0 comments on commit d4ca76e

Please sign in to comment.