Hydro-Quebec-API-Wrapper 4.2.0__tar.gz → 4.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/.pre-commit-config.yaml +1 -1
  2. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/Hydro_Quebec_API_Wrapper.egg-info/PKG-INFO +1 -1
  3. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/PKG-INFO +1 -1
  4. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/contract_dpc.py +24 -10
  5. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/consump.py +6 -2
  6. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/dpc.py +6 -2
  7. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/dt.py +6 -2
  8. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/test_requirements.txt +3 -3
  9. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/.coveragerc +0 -0
  10. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/.devcontainer/Dockerfile +0 -0
  11. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/.devcontainer/devcontainer.json +0 -0
  12. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/.flake8 +0 -0
  13. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/.gitignore +0 -0
  14. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/.gitlab-ci.yml +0 -0
  15. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/.pylintrc +0 -0
  16. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/Hydro_Quebec_API_Wrapper.egg-info/SOURCES.txt +0 -0
  17. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/Hydro_Quebec_API_Wrapper.egg-info/dependency_links.txt +0 -0
  18. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/Hydro_Quebec_API_Wrapper.egg-info/entry_points.txt +0 -0
  19. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/Hydro_Quebec_API_Wrapper.egg-info/requires.txt +0 -0
  20. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/Hydro_Quebec_API_Wrapper.egg-info/top_level.txt +0 -0
  21. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/LICENSE +0 -0
  22. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/MANIFEST.in +0 -0
  23. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/README.md +0 -0
  24. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/config.default.yaml +0 -0
  25. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/conflict_test_requirements.txt +0 -0
  26. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/Makefile +0 -0
  27. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/make.bat +0 -0
  28. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/_static/custom.css +0 -0
  29. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/_static/hydroqc-logo-128.png +0 -0
  30. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/_static/hydroqc-logo.svg +0 -0
  31. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/conf.py +0 -0
  32. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/external/description-des-codes-interruption.pdf +0 -0
  33. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/index.rst +0 -0
  34. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/reference/hydroqc.contract.rst +0 -0
  35. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/reference/hydroqc.hydro_api.rst +0 -0
  36. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/reference/hydroqc.peak.cpc.rst +0 -0
  37. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/reference/hydroqc.peak.dpc.rst +0 -0
  38. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/reference/hydroqc.peak.rst +0 -0
  39. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/reference/hydroqc.rst +0 -0
  40. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/reference/hydroqc.types.rst +0 -0
  41. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/reference/modules.rst +0 -0
  42. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/docs/source/todo.rst +0 -0
  43. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/examples/hydro.py +0 -0
  44. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/__init__.py +0 -0
  45. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/account.py +0 -0
  46. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/consts.py +0 -0
  47. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/__init__.py +0 -0
  48. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/common.py +0 -0
  49. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/contract_d.py +0 -0
  50. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/contract_d_cpc.py +0 -0
  51. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/contract_dt.py +0 -0
  52. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/contract_m.py +0 -0
  53. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/contract_m_gdp.py +0 -0
  54. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/contract_residential.py +0 -0
  55. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/contract/outage.py +0 -0
  56. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/customer.py +0 -0
  57. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/diagnostic.py +0 -0
  58. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/error.py +0 -0
  59. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/hydro_api/__init__.py +0 -0
  60. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/hydro_api/cache.py +0 -0
  61. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/hydro_api/client.py +0 -0
  62. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/hydro_api/consts.py +0 -0
  63. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/logger.py +0 -0
  64. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/__init__.py +0 -0
  65. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/basepeak.py +0 -0
  66. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/basepeakhandler.py +0 -0
  67. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/consts.py +0 -0
  68. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/cpc/__init__.py +0 -0
  69. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/cpc/consts.py +0 -0
  70. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/cpc/handler.py +0 -0
  71. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/cpc/peak.py +0 -0
  72. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/dpc/__init__.py +0 -0
  73. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/dpc/consts.py +0 -0
  74. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/dpc/handler.py +0 -0
  75. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/peak/dpc/peak.py +0 -0
  76. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/public_client.py +0 -0
  77. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/py.typed +0 -0
  78. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/timerange.py +0 -0
  79. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/__init__.py +0 -0
  80. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/account.py +0 -0
  81. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/common.py +0 -0
  82. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/contract.py +0 -0
  83. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/cpc.py +0 -0
  84. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/types/outage.py +0 -0
  85. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/utils.py +0 -0
  86. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/hydroqc/webuser.py +0 -0
  87. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/logo/hydroqc-logo-128.png +0 -0
  88. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/logo/hydroqc-logo.svg +0 -0
  89. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/pyproject.toml +0 -0
  90. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/renovate.json5 +0 -0
  91. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/setup.cfg +0 -0
  92. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/__init__.py +0 -0
  93. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/conftest.py +0 -0
  94. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/subtest_common.py +0 -0
  95. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/subtest_contract_d.py +0 -0
  96. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/subtest_contract_d_cpc.py +0 -0
  97. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/subtest_contract_dpc.py +0 -0
  98. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/subtest_contract_dt.py +0 -0
  99. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/subtest_contract_m.py +0 -0
  100. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/subtest_contract_m_gdp.py +0 -0
  101. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/test_basic.py +0 -0
  102. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/test_timerange.py +0 -0
  103. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tests/tools.py +0 -0
  104. {hydro_quebec_api_wrapper-4.2.0 → hydro_quebec_api_wrapper-4.2.1}/tox.ini +0 -0
@@ -47,7 +47,7 @@ repos:
47
47
  additional_dependencies:
48
48
  - "types-pytz==2025.2.0.20251108"
49
49
  - "types-PyYAML==6.0.12.20250915"
50
- - "types-python-dateutil==2.9.0.20251108"
50
+ - "types-python-dateutil==2.9.0.20251115"
51
51
  - "pytest-stub==1.1.0"
52
52
  - "aiohttp==3.13.2"
53
53
  - "aiocache==0.12.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Hydro-Quebec-API-Wrapper
3
- Version: 4.2.0
3
+ Version: 4.2.1
4
4
  Summary: A wrapper library to access hydro quebec API and more
5
5
  Home-page: https://hydroqc.ca
6
6
  Author-email: Hydroqc Team <info@hydroqc.ca>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Hydro-Quebec-API-Wrapper
3
- Version: 4.2.0
3
+ Version: 4.2.1
4
4
  Summary: A wrapper library to access hydro quebec API and more
5
5
  Home-page: https://hydroqc.ca
6
6
  Author-email: Hydroqc Team <info@hydroqc.ca>
@@ -19,11 +19,13 @@ class WinterState(str, Enum):
19
19
 
20
20
 
21
21
  def check_dpc_data_present(
22
- method: Callable[..., None | str | bool | float | date],
23
- ) -> Callable[..., None | str | bool | float | date]:
22
+ method: Callable[..., None | str | bool | float | int | date | WinterState],
23
+ ) -> Callable[..., None | str | bool | float | int | date | WinterState]:
24
24
  """Check if contractDPC's data are present."""
25
25
 
26
- def wrapper(contract: "ContractDPC") -> None | str | bool | float | date:
26
+ def wrapper(
27
+ contract: "ContractDPC",
28
+ ) -> None | str | bool | float | int | date | WinterState:
27
29
  if not hasattr(contract, "_dpc_data"):
28
30
  contract._logger.warning("You need to call get_dpc_data method first")
29
31
  return None
@@ -109,11 +111,17 @@ class ContractDPC(ContractResidential):
109
111
  return self._dpc_data
110
112
 
111
113
  def _get_dpc_field(self, field_name: str) -> str | float | int:
112
- """Get DPC field from periodesHiver data."""
114
+ """Get DPC field from periodesHiver data.
115
+
116
+ Raises:
117
+ KeyError: If the required field is not present in the API response.
118
+ """
113
119
  winter_period = self._dpc_data["periodesHiver"][0]
114
- if field_name in winter_period:
115
- return winter_period[field_name] # type: ignore
116
- raise KeyError(f"Field {field_name} not found in DPC data")
120
+ if field_name not in winter_period:
121
+ raise KeyError(
122
+ f"Required field '{field_name}' not found in DPC periodesHiver data"
123
+ )
124
+ return winter_period[field_name] # type: ignore
117
125
 
118
126
  @property
119
127
  @check_period_data_present
@@ -160,9 +168,15 @@ class ContractDPC(ContractResidential):
160
168
 
161
169
  @property
162
170
  @check_dpc_data_present
163
- def amount_saved_vs_base_rate(self) -> float:
164
- """Amount saved or not versus the base rate."""
165
- return float(self._get_dpc_field("montantEconPerteVSTarifBase"))
171
+ def amount_saved_vs_base_rate(self) -> float | None:
172
+ """Amount saved or not versus the base rate.
173
+
174
+ Returns None if comparison data is not yet available (e.g., first year on Flex D).
175
+ """
176
+ try:
177
+ return float(self._get_dpc_field("montantEconPerteVSTarifBase"))
178
+ except KeyError:
179
+ return None
166
180
 
167
181
  @property
168
182
  @check_dpc_data_present
@@ -155,8 +155,12 @@ class ConsumpAnnualTyping(TypedDict, total=True):
155
155
  results: list[ConsumpAnnualResultsTyping]
156
156
 
157
157
 
158
- class DPCDataResultsTyping(TypedDict, total=True):
159
- """FlexD data json sub output format."""
158
+ class DPCDataResultsTyping(TypedDict, total=False):
159
+ """FlexD data json sub output format.
160
+
161
+ Note: montantEconPerteVSTarifBase may not be available in the first year of Flex D
162
+ as it requires comparison data from previous Rate D billing.
163
+ """
160
164
 
161
165
  dateDebut: str
162
166
  dateFin: str
@@ -4,8 +4,12 @@
4
4
  from typing import TypedDict
5
5
 
6
6
 
7
- class DPCPeriodeHiverTyping(TypedDict, total=True):
8
- """FlexD winter period data (API v3_0 format)."""
7
+ class DPCPeriodeHiverTyping(TypedDict, total=False):
8
+ """FlexD winter period data (API v3_0 format).
9
+
10
+ Note: montantEconPerteVSTarifBase may not be available in the first year of Flex D
11
+ as it requires comparison data from previous Rate D billing.
12
+ """
9
13
 
10
14
  dateDebut: str
11
15
  dateFin: str
@@ -4,8 +4,12 @@
4
4
  from typing import TypedDict
5
5
 
6
6
 
7
- class DTDataResultsTyping(TypedDict, total=True):
8
- """DT winter period data (legacy format)."""
7
+ class DTDataResultsTyping(TypedDict, total=False):
8
+ """DT winter period data (legacy format).
9
+
10
+ Note: montantEconPerteVSTarifBase may not be available when comparison
11
+ data from previous billing is unavailable.
12
+ """
9
13
 
10
14
  dateDebut: str
11
15
  dateFin: str
@@ -1,14 +1,14 @@
1
1
  flake8==7.3.0
2
2
  pydocstyle==6.3.0
3
3
  parameterized==0.9.0
4
- pylint==4.0.2
5
- pytest==8.4.2
4
+ pylint==4.0.3
5
+ pytest==9.0.1
6
6
  pytest-cov==7.0.0
7
7
  pytest-asyncio==1.3.0
8
8
  black==25.11.0
9
9
  mypy==1.18.2
10
10
  types-pytz==2025.2.0.20251108
11
11
  types-PyYAML==6.0.12.20250915
12
- types-python-dateutil==2.9.0.20251108
12
+ types-python-dateutil==2.9.0.20251115
13
13
  pyright==1.1.407
14
14
  lxml==6.0.2