Skip to content

Commit e93e842

Browse files
committed
Polishing
1 parent 496adbf commit e93e842

File tree

12 files changed

+1135
-621
lines changed

12 files changed

+1135
-621
lines changed

poetry.lock

Lines changed: 245 additions & 568 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 34 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.poetry]
2-
name = "python-melcloud"
2+
name = "python-melcloud-redux"
33
version = "0.1.0"
44
authors = ["Erwin Douna <[email protected]>"]
55
classifiers = [
@@ -18,7 +18,7 @@ license = "MIT"
1818
maintainers = ["Erwin Douna <[email protected]>"]
1919
packages = [{ include = "pymelcloud", from = "src" }]
2020
readme = "README.md"
21-
repository = "https://github.com/erwindouna/python-melcloud"
21+
repository = "https://github.com/erwindouna/python-tado"
2222

2323
[tool.poetry.dependencies]
2424
aiohttp = ">=3.0.0"
@@ -29,27 +29,27 @@ yarl = ">=1.6.0"
2929
aioresponses = "^0.7.6"
3030

3131
[tool.poetry.urls]
32-
"Bug Tracker" = "https://github.com/erwindouna/python-melcloud/issues"
33-
Changelog = "https://github.com/erwindouna/python-melcloud/releases"
32+
"Bug Tracker" = "https://github.com/erwindouna/python-tado/issues"
33+
Changelog = "https://github.com/erwindouna/python-tado/releases"
3434

3535
[tool.poetry.group.dev.dependencies]
3636
aresponses = "3.0.0"
37-
codespell = "2.4.1"
37+
codespell = "2.2.6"
3838
covdefaults = "2.3.0"
39-
coverage = { version = "7.7.1", extras = ["toml"] }
40-
mypy = "1.15.0"
41-
pre-commit = "4.2.0"
42-
pre-commit-hooks = "5.0.0"
43-
pylint = "3.3.6"
44-
pytest = "8.3.5"
45-
pytest-asyncio = "0.26.0"
46-
pytest-cov = "6.0.0"
47-
ruff = "0.11.2"
48-
safety = "3.3.1"
49-
yamllint = "1.37.0"
50-
syrupy = "4.9.1"
51-
deptry = "0.23.0"
52-
asynctest = "^0.13.0" # Consider removing if unused
39+
coverage = { version = "7.4.3", extras = ["toml"] }
40+
mypy = "1.9.0"
41+
pre-commit = "3.6.0"
42+
pre-commit-hooks = "4.5.0"
43+
pylint = "3.0.3"
44+
pytest = "8.1.1"
45+
pytest-asyncio = "^0.23.5.post1"
46+
pytest-cov = "4.1.0"
47+
ruff = "0.1.13"
48+
safety = "3.0.1"
49+
yamllint = "1.33.0"
50+
syrupy = "4.6.1"
51+
deptry = "^0.19.1"
52+
asynctest = "^0.13.0"
5353

5454
[tool.coverage.report]
5555
show_missing = true
@@ -107,36 +107,21 @@ ignore-imports = true
107107
max-line-length = 88
108108

109109
[tool.pytest.ini_options]
110-
addopts = "--cov --cov-fail-under=55" # Fice for now, since this is how the project was inherited
110+
addopts = "--cov"
111111
asyncio_mode = "auto"
112+
asyncio_default_fixture_loop_scope = "function"
112113

113-
[tool.ruff]
114-
ignore = [
115-
"ANN401", # Opinionated warning on disallowing dynamically typed expressions
116-
"D203", # Conflicts with other rules
117-
"ARG002", # Conflicts with other rules
118-
"D213", # Conflicts with other rules
119-
"D417", # False positives in some occasions
120-
"PLR2004", # Just annoying, not really useful
121-
"SLOT000", # Has a bug with enums: https://github.com/astral-sh/ruff/issues/5748
122-
"TRY003", # Avoid specifying long messages outside the exception class
123-
"EM101", # Exception must not use a string literal, assign to variable first
124-
"EM102", # Exception must not use an f-string literal, assign to variable first
125-
"PLR0913", # Too many arguments in function definition
126-
"N815", # Scope should not be mixedCase
127-
"PLR0912", # Too many branches
128-
"PLR0915", # Too many statements
129-
"C901", # Too complex
130-
131-
# Conflicts with the Ruff formatter
132-
"COM812",
133-
"ISC001",
134-
]
114+
[lint]
115+
ignore = ["tests"]
135116
select = ["ALL"]
117+
flake8-pytest-style.fixture-parentheses = false
118+
flake8-pytest-style.mark-parentheses = false
119+
isort.known-first-party = ["tado"]
120+
mccabe.max-complexity = 25
136121

137-
[tool.ruff.lint]
122+
[tool.ruff]
138123
ignore = [
139-
"ANN401", # Opinionated warning on disallowing dynamically typed expressions
124+
"ANN401", # Opinioated warning on disallowing dynamically typed expressions
140125
"D203", # Conflicts with other rules
141126
"ARG002", # Conflicts with other rules
142127
"D213", # Conflicts with other rules
@@ -156,16 +141,13 @@ ignore = [
156141
"COM812",
157142
"ISC001",
158143
]
159-
select = ["ALL"]
160-
161-
[tool.ruff.lint.flake8-pytest-style]
162-
fixture-parentheses = false
163-
mark-parentheses = false
164144

165-
[tool.ruff.lint.isort]
166-
known-first-party = ["pymelcloud"]
145+
[tool.ruff.lint.flake8-type-checking]
146+
runtime-evaluated-base-classes = [
147+
"mashumaro.mixins.orjson.DataClassORJSONMixin",
148+
]
167149

168-
[tool.ruff.lint.mccabe]
150+
[tool.ruff.mccabe]
169151
max-complexity = 25
170152

171153
[build-system]

tests/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
"""pymelcloud tests."""
1+
"""Tests for pymelcloud."""
2+
3+
from pathlib import Path
4+
5+
6+
def load_fixture(filename: str, folder: str = "") -> str:
7+
"""Load a fixture."""
8+
if folder:
9+
path = Path(__package__) / "fixtures" / folder / filename
10+
else:
11+
path = Path(__package__) / "fixtures" / filename
12+
return path.read_text(encoding="utf-8")
Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
# serializer version: 1
2+
# name: test_login_success
3+
Client(
4+
account=None,
5+
device_confs=list([
6+
]),
7+
token='0-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
8+
)
9+
# ---
10+
# name: test_update_confs
11+
list([
12+
dict({
13+
'AccessLevel': 3,
14+
'AdaptorType': 3,
15+
'AreaID': None,
16+
'AreaName': None,
17+
'BuildingCountry': None,
18+
'BuildingID': 1,
19+
'BuildingName': None,
20+
'Device': dict({
21+
'ActualFanSpeed': 0,
22+
'AdaptorType': 3,
23+
'AirDirectionFunction': True,
24+
'AutoEnergyConsumedRate1': 0,
25+
'AutoEnergyConsumedRate2': 0,
26+
'AutomaticFanSpeed': False,
27+
'CanAuto': False,
28+
'CanCool': True,
29+
'CanDry': True,
30+
'CanHeat': True,
31+
'ConfiguredDemandPercentage': None,
32+
'ConsecutiveUploadErrors': 0,
33+
'CoolingDisabled': False,
34+
'CoolingEnergyConsumedRate1': 0,
35+
'CoolingEnergyConsumedRate2': 0,
36+
'CurrentEnergyConsumed': 0,
37+
'CurrentEnergyMode': 7,
38+
'DefaultCoolingSetTemperature': 10.0,
39+
'DefaultHeatingSetTemperature': None,
40+
'DemandPercentage': 100,
41+
'DetectedCountry': None,
42+
'DeviceID': 1,
43+
'DeviceType': 0,
44+
'DiagnosticEndDate': None,
45+
'DiagnosticMode': 0,
46+
'DoNotRespondAfter': None,
47+
'DryEnergyConsumedRate1': 0,
48+
'DryEnergyConsumedRate2': 0,
49+
'EffectiveFlags': 0,
50+
'EffectivePCycle': 1,
51+
'EnergyCorrectionActive': False,
52+
'EnergyCorrectionModel': None,
53+
'ErrorCode': 8000,
54+
'ErrorMessages': '',
55+
'EstimateAtaEnergyProduction': False,
56+
'EstimateAtaEnergyProductionOptIn': False,
57+
'EstimateAtaEnergyProductionOptInTimestamp': None,
58+
'ExceptionCount': None,
59+
'ExceptionDate': None,
60+
'ExceptionHash': None,
61+
'ExpectedCommand': 1,
62+
'FanEnergyConsumedRate1': 0,
63+
'FanEnergyConsumedRate2': 0,
64+
'FanSpeed': 1,
65+
'FirmwareAppVersion': 0,
66+
'FirmwareDeployment': None,
67+
'FirmwareUpdateAborted': False,
68+
'FirmwareWebVersion': 0,
69+
'FirmwareWlanVersion': 0,
70+
'FlashWrites': 9,
71+
'HasAutomaticFanSpeed': True,
72+
'HasDemandSideControl': False,
73+
'HasEnergyConsumedMeter': True,
74+
'HasError': False,
75+
'HasErrorMessages': False,
76+
'HasHalfDegreeIncrements': True,
77+
'HasOutdoorTemperature': True,
78+
'HasZone2': False,
79+
'HeatingEnergyConsumedRate1': 0,
80+
'HeatingEnergyConsumedRate2': 0,
81+
'HideEnergyReport': False,
82+
'InStandbyMode': False,
83+
'IsSplitSystem': False,
84+
'LastEffectiveFlags': 0,
85+
'LastReset': '2024-04-22T19:00:19.229',
86+
'LastTimeStamp': '2025-04-08T23:09:00',
87+
'LegacyDevice': False,
88+
'LinkToMELCloudHome': False,
89+
'LinkedByUserFromMELCloudHome': '00000000-0000-0000-0000-000000000000',
90+
'LinkedDevice': None,
91+
'MacAddress': '00:00:00:00:00:00',
92+
'MaxIndoorUnits': 255,
93+
'MaxOutdoorUnits': 255,
94+
'MaxPcycle': 1,
95+
'MaxTempAutomatic': 10.0,
96+
'MaxTempCoolDry': 10.0,
97+
'MaxTempHeat': 10.0,
98+
'MaxTemperatureControlUnits': 0,
99+
'MinPcycle': 1,
100+
'MinTempAutomatic': 16.0,
101+
'MinTempCoolDry': 16.0,
102+
'MinTempHeat': 10.0,
103+
'ModelCode': '0000',
104+
'ModelDisableEnergyReport': False,
105+
'ModelIsAirCurtain': False,
106+
'ModelSupportsAuto': True,
107+
'ModelSupportsDry': True,
108+
'ModelSupportsEnergyReporting': False,
109+
'ModelSupportsFanSpeed': True,
110+
'ModelSupportsHeat': True,
111+
'ModelSupportsStandbyMode': True,
112+
'ModelSupportsVaneHorizontal': True,
113+
'ModelSupportsVaneVertical': True,
114+
'ModelSupportsWideVane': False,
115+
'MqttFlags': 0,
116+
'NumberOfFanSpeeds': 4,
117+
'Offline': False,
118+
'OperationMode': 7,
119+
'OtherEnergyConsumedRate1': 0,
120+
'OtherEnergyConsumedRate2': 0,
121+
'OutdoorTemperature': None,
122+
'Owner': 1,
123+
'OwnerCountry': 1,
124+
'OwnerRoleAccessLevel': 1,
125+
'PCycle': 10,
126+
'PCycleActual': 0,
127+
'PCycleConfigured': None,
128+
'Passcode': None,
129+
'Position': 'Unknown',
130+
'Power': False,
131+
'ProhibitOperationMode': False,
132+
'ProhibitPower': False,
133+
'ProhibitSetTemperature': False,
134+
'ProtocolVersion': 0,
135+
'Rate1StartTime': None,
136+
'Rate2StartTime': None,
137+
'RecordNumMax': 0,
138+
'RoomTemperature': 15.5,
139+
'RoomTemperatureLabel': 0,
140+
'SPTimeout': 1,
141+
'SSLExpirationDate': '2037-12-31T00:00:00',
142+
'Scene': None,
143+
'SerialNumber': '0000000000',
144+
'ServerCommunicationDisabled': False,
145+
'SetTemperature': 16.0,
146+
'SupportsHourlyEnergyReport': True,
147+
'SwingFunction': True,
148+
'TemperatureIncrement': 0.5,
149+
'TemperatureIncrementOverride': 0,
150+
'TimeZoneID': 1,
151+
'UnitSupportsStandbyMode': True,
152+
'UnitVersion': 0,
153+
'Units': list([
154+
dict({
155+
'Device': 0,
156+
'ID': 1,
157+
'IsIndoor': True,
158+
'Model': '1',
159+
'ModelNumber': None,
160+
'SerialNumber': None,
161+
'UnitType': 1,
162+
}),
163+
]),
164+
'UseTemperatureA': True,
165+
'VaneHorizontalDirection': 3,
166+
'VaneHorizontalSwing': False,
167+
'VaneVerticalDirection': 1,
168+
'VaneVerticalSwing': False,
169+
'WeatherForecast': list([
170+
]),
171+
'WifiAdapterStatus': 'NORMAL',
172+
'WifiSignalStrength': -39,
173+
}),
174+
'DeviceID': 1,
175+
'DeviceName': 'Device1',
176+
'DirectAccess': False,
177+
'EndDate': '2500-01-01T00:00:00',
178+
'EstimateAtaEnergyProduction': False,
179+
'EstimateAtaEnergyProductionOptIn': False,
180+
'FloorID': None,
181+
'FloorName': None,
182+
'HideDryModeControl': False,
183+
'HideOutdoorTemperature': False,
184+
'HideRoomTemperature': False,
185+
'HideSupplyTemperature': False,
186+
'HideVaneControls': False,
187+
'ImageID': -1,
188+
'InstallationDate': '2023-09-30T00:00:00',
189+
'LastServiceDate': '2023-09-30T00:00:00',
190+
'LinkedDevice': None,
191+
'MacAddress': '00:00:00:00:00:00',
192+
'MaxTemperature': 10,
193+
'MinTemperature': 10,
194+
'OwnerCountry': None,
195+
'OwnerEmail': None,
196+
'OwnerID': 1,
197+
'OwnerName': None,
198+
'Presets': list([
199+
]),
200+
'SerialNumber': '0000000000',
201+
'Type': 0,
202+
'Zone1Name': None,
203+
'Zone2Name': None,
204+
}),
205+
])
206+
# ---
207+
# name: test_update_confs.1
208+
dict({
209+
'Address1': None,
210+
'Address2': None,
211+
'AlternateEmailAddress': None,
212+
'City': None,
213+
'CountryID': 1,
214+
'CountryName': 'Country',
215+
'DatePasswordResetRequested': None,
216+
'DateVerificationSent': '2023-10-19T15:45:56.55',
217+
'DateVerified': '2023-10-19T15:46:14.483',
218+
'DefaultMaximumDevices': 10,
219+
'EmailAddress': '[email protected]',
220+
'EmailCommsErrors': 0,
221+
'EmailOnCommsError': False,
222+
'EmailOnUnitError': False,
223+
'EmailUnitErrors': 0,
224+
'Enabled': True,
225+
'FirstName': 'John',
226+
'HidePresetPanel': False,
227+
'Honorific': 'Mr.',
228+
'ID': 1,
229+
'LanguageID': 0,
230+
'LanguageName': 'English',
231+
'LastAnnouncement': 0,
232+
'LastLogin': None,
233+
'LastName': 'Doe',
234+
'MapLatitude': 0.0,
235+
'MapLongitude': 0.0,
236+
'MapZoom': 0,
237+
'MaximumDevices': 0,
238+
'MobilePhone': None,
239+
'PendingEmailAddress': None,
240+
'Phone': None,
241+
'PostCode': None,
242+
'RoleID': 0,
243+
'RoleName': 'Ordinary User',
244+
'SendMarketingMessages': False,
245+
'Sex': 'M',
246+
'SkipFrostProtectionPage1': False,
247+
'SkipHolidayModePage1': False,
248+
'SkipTimerPage1': False,
249+
'TelephoneQuestion': 'Confidential',
250+
'Terms': 1292,
251+
'Throttle': True,
252+
'TimeZoneCity': 1,
253+
'UseFahrenheit': False,
254+
})
255+
# ---

0 commit comments

Comments
 (0)