mms-client 1.10.0__py3-none-any.whl → 1.11.1__py3-none-any.whl

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.
@@ -0,0 +1,187 @@
1
+ """Contains objects for surplus capacity information."""
2
+
3
+ from enum import Enum
4
+ from typing import Optional
5
+
6
+ from pendulum import Timezone
7
+ from pydantic import field_serializer
8
+ from pydantic import field_validator
9
+ from pydantic_extra_types.pendulum_dt import DateTime
10
+ from pydantic_xml import attr
11
+
12
+ from mms_client.types.base import Payload
13
+ from mms_client.types.enums import AreaCode
14
+ from mms_client.types.fields import company_short_name
15
+ from mms_client.types.fields import participant
16
+ from mms_client.types.fields import power_positive
17
+ from mms_client.types.fields import resource_name
18
+ from mms_client.types.fields import resource_short_name
19
+ from mms_client.types.fields import system_code
20
+
21
+
22
+ class RejectCategory(Enum):
23
+ """Represents the category of the reason for rejecting a surplus capacity request."""
24
+
25
+ FUEL_RESTRICTION = "1"
26
+ RIVER_FLOW_RESTRICTION = "2"
27
+ WORK_RELATED = "3"
28
+ OTHER = "9"
29
+
30
+
31
+ class OperationalRejectCategory(Enum):
32
+ """Represents the category of the reason for rejecting an operational request.
33
+
34
+ This include voltage adjustment, black start, over-power, peak mode or system security pump request.
35
+ """
36
+
37
+ EQUIPMENT_FAILURE = "1"
38
+ NOT_SUPPORTED = "2"
39
+ OTHER = "9"
40
+
41
+
42
+ class SurplusCapacitySubmit(Payload, tag="RemainingReserveData"):
43
+ """Represents the base fields for a surplus capacity response."""
44
+
45
+ # The name of the resource for which the surplus capacity is being submitted
46
+ resource_code: str = resource_name("ResourceName")
47
+
48
+ # The DR pattern number for which the surplus capacity is being submitted
49
+ pattern_number: int = attr(name="DrPatternNumber", ge=1, le=20)
50
+
51
+ # The start block from when the surplus capacity should apply
52
+ start: DateTime = attr(name="StartTime")
53
+
54
+ # The end block until when the surplus capacity should apply
55
+ end: DateTime = attr(name="EndTime")
56
+
57
+ # The available surplus capacity that can be increased or dispatched when needed, such as in response to grid
58
+ # demand fluctuations. This should not be submitted for standalone generators.
59
+ upward_capacity: Optional[int] = power_positive("RemainingReserveUp", True)
60
+
61
+ # In the case where excess surplus capacity is rejected, this field will indicate the category of the reason.
62
+ upward_capacity_rejected: Optional[RejectCategory] = attr(default=None, name="RemainingReserveUpRejectFlag")
63
+
64
+ # If the upward dispatch is rejected, this field will indicate a specific reason.
65
+ upward_capacity_rejection_reason: Optional[str] = attr(
66
+ default=None, name="RemainingReserveUpRejectReason", min_length=1, max_length=50
67
+ )
68
+
69
+ # The available surplus capacity that can be decreased when needed, such as in response to grid demand fluctuations.
70
+ # This should not be submitted for standalone generators.
71
+ downward_capacity: Optional[int] = power_positive("RemainingReserveDown", True)
72
+
73
+ # In the case where excess surplus capacity is rejected, this field will indicate the category of the reason.
74
+ downward_capacity_rejected: Optional[RejectCategory] = attr(default=None, name="RemainingReserveDownRejectFlag")
75
+
76
+ # If the downward dispatch is rejected, this field will indicate a specific reason.
77
+ downward_capacity_rejection_reason: Optional[str] = attr(
78
+ default=None, name="RemainingReserveDownRejectReason", min_length=1, max_length=50
79
+ )
80
+
81
+ # If voltage adjustment is rejected, this field will indicate the category of the reason.
82
+ voltage_adjustment_rejected: Optional[OperationalRejectCategory] = attr(
83
+ default=None, name="VoltageAdjustmentRejectFlag"
84
+ )
85
+
86
+ # If voltage adjustment is rejected, this field will indicate a specific reason.
87
+ voltage_adjustment_rejection_reason: Optional[str] = attr(
88
+ default=None, name="VoltageAdjustmentRejectReason", min_length=1, max_length=50
89
+ )
90
+
91
+ # If black start is rejected, this field will indicate the category of the reason.
92
+ black_start_rejected: Optional[OperationalRejectCategory] = attr(default=None, name="BlackStartRejectFlag")
93
+
94
+ # If black start is rejected, this field will indicate a specific reason.
95
+ black_start_rejection_reason: Optional[str] = attr(
96
+ default=None, name="BlackStartRejectReason", min_length=1, max_length=50
97
+ )
98
+
99
+ # The additional reserve capacity that can be utilized in cases of excessive or "overpower" conditions, such as
100
+ # when demand exceeds usual levels.
101
+ over_power_capacity: Optional[int] = power_positive("OverPowerRemainingReserveUp", True)
102
+
103
+ # In the case where over-power capacity is rejected, this field will indicate the category of the reason.
104
+ over_power_rejected: Optional[OperationalRejectCategory] = attr(default=None, name="OverPowerRejectFlag")
105
+
106
+ # If over-power capacity is rejected, this field will indicate a specific reason.
107
+ over_power_rejection_reason: Optional[str] = attr(
108
+ default=None, name="OverPowerRejectReason", min_length=1, max_length=50
109
+ )
110
+
111
+ # The available surplus capacity that can be increased specifically during peak demand periods
112
+ peak_mode_capacity: Optional[int] = power_positive("PeakModeRemainingReserveUp", True)
113
+
114
+ # In the case where peak mode capacity is rejected, this field will indicate the category of the reason.
115
+ peak_mode_rejected: Optional[OperationalRejectCategory] = attr(default=None, name="PeakModeRejectFlag")
116
+
117
+ # If peak mode capacity is rejected, this field will indicate a specific reason.
118
+ peak_mode_rejection_reason: Optional[str] = attr(
119
+ default=None, name="PeakModeRejectReason", min_length=1, max_length=50
120
+ )
121
+
122
+ # Indicates whether the operation of a pumped-storage hydroelectric pump is restricted or disallowed for system
123
+ # security reasons.
124
+ system_security_pump_rejected: Optional[OperationalRejectCategory] = attr(
125
+ default=None, name="SystemSecurityPumpRejectFlag"
126
+ )
127
+
128
+ # If the operation of a pumped-storage hydroelectric pump is restricted or disallowed for system security reasons,
129
+ # this field will indicate a specific reason.
130
+ system_security_pump_rejection_reason: Optional[str] = attr(
131
+ default=None, name="SystemSecurityPumpRejectReason", min_length=1, max_length=50
132
+ )
133
+
134
+ @field_serializer("start", "end")
135
+ def encode_datetime(self, value: DateTime) -> str:
136
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
137
+ return value.replace(tzinfo=None).isoformat() if value else ""
138
+
139
+ @field_validator("start", "end")
140
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
141
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
142
+ return value.replace(tzinfo=Timezone("Asia/Tokyo"))
143
+
144
+
145
+ class SurplusCapacityData(SurplusCapacitySubmit, tag="RemainingReserveData"):
146
+ """Represents the base fields for a surplus capacity response."""
147
+
148
+ # The region in which the resource for which surplus capacity is being submitted is located
149
+ area: Optional[AreaCode] = attr(default=None, name="Area")
150
+
151
+ # The name of the BSP participant submitting the surplus capacity
152
+ participant: Optional[str] = participant("ParticipantName", True)
153
+
154
+ # The abbreviated name of the company submitting the surplus capacity
155
+ company: Optional[str] = company_short_name("CompanyShortName", True)
156
+
157
+ # The MMS code of the business entity to which the registration applies
158
+ system_code: Optional[str] = system_code("SystemCode", True)
159
+
160
+ # The abbreviated name of the resource being traded
161
+ resource_name: Optional[str] = resource_short_name("ResourceShortName", True)
162
+
163
+
164
+ class SurplusCapacityQuery(Payload, tag="RemainingReserveDataQuery"):
165
+ """Represents the base fields for a surplus capacity query."""
166
+
167
+ # The name of the resource for which the surplus capacity is being submitted
168
+ resource_code: Optional[str] = resource_name("ResourceName", True)
169
+
170
+ # The DR pattern number for which the surplus capacity is being submitted
171
+ pattern_number: Optional[int] = attr(default=None, name="DrPatternNumber", ge=1, le=20)
172
+
173
+ # The start block from when the surplus capacity should apply
174
+ start: DateTime = attr(name="StartTime")
175
+
176
+ # The end block until when the surplus capacity should apply
177
+ end: DateTime = attr(name="EndTime")
178
+
179
+ @field_serializer("start", "end")
180
+ def encode_datetime(self, value: DateTime) -> str:
181
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
182
+ return value.replace(tzinfo=None).isoformat() if value else ""
183
+
184
+ @field_validator("start", "end")
185
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
186
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
187
+ return value.replace(tzinfo=Timezone("Asia/Tokyo"))
@@ -161,7 +161,8 @@ class Serializer:
161
161
  """
162
162
  # First, convert the payload to a raw XML string
163
163
  raw: bytes = payload.to_xml(
164
- skip_empty=True,
164
+ exclude_none=True,
165
+ exclude_unset=True,
165
166
  encoding="utf-8",
166
167
  xml_declaration=False,
167
168
  ) # type: ignore[assignment]
@@ -312,7 +313,9 @@ class Serializer:
312
313
  ValueError: If the expected data type is not found in the response.
313
314
  """
314
315
  data_tags = set(node.tag for node in raw)
315
- if not data_tags.issubset([data_type.__name__, data_type.__xml_tag__, "ProcessingStatistics", "Messages"]):
316
+ if not data_tags.issubset(
317
+ [data_type.__name__, data_type.__xml_tag__, "ProcessingStatistics", "Messages", "StandingData"]
318
+ ):
316
319
  raise DataNodeNotFoundError(method, data_type)
317
320
 
318
321
  def _from_tree_data(self, raw: Optional[Element], data_type: Type[P]) -> Optional[ResponseData[P]]:
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mms-client
3
- Version: 1.10.0
3
+ Version: 1.11.1
4
4
  Summary: API client for accessing the MMS
5
5
  Home-page: https://github.com/ElectroRoute-Japan/mms-client
6
6
  Author: Ryan Wood
7
7
  Author-email: ryan.wood@electroroute.co.jp
8
- Requires-Python: >=3.11,<4.0
8
+ Requires-Python: >=3.12,<4.0
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Framework :: Pydantic :: 2
11
11
  Classifier: Framework :: Pytest
@@ -14,8 +14,8 @@ Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
14
14
  Classifier: Natural Language :: English
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
20
  Classifier: Typing :: Typed
21
21
  Requires-Dist: backoff (>=2.2.1,<3.0.0)
@@ -221,12 +221,17 @@ This client is not complete. Currently, it supports the following endpoints:
221
221
  - MarketQuery_OfferQuery
222
222
  - MarketCancel_OfferCancel
223
223
  - MarketQuery_AwardResultsQuery
224
+ - MarketQuery_SettlementResultsFileListQuery
225
+ - MarketSubmit_BupSubmit
226
+ - MarketQuery_BupQuery
224
227
  - RegistrationSubmit_Resource
225
228
  - RegistrationQuery_Resource
226
229
  - ReportCreateRequest
227
230
  - ReportListRequest
228
231
  - ReportDownloadRequestTrnID
229
232
  - BSP_ResourceList
233
+ - MarketSubmit_RemainingReserveData
234
+ - MarketQuery_RemainingReserveDataQuery
230
235
 
231
236
  We can add support for additional endpoints as time goes on, and independent contribution is, of course, welcome. However, support for attachments is currently limited because none of the endpoints we support currently require them. We have implemented attachment support up to the client level, but we haven't developed an architecture for submitting them through an endpoint yet.
232
237
 
@@ -1,41 +1,45 @@
1
1
  mms_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  mms_client/client.py,sha256=qkLdhC8jXEvtXWKb-GsWJOCYoEjTtHp9x8q8eofkh78,676
3
3
  mms_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- mms_client/schemas/wsdl/mi-web-service-jbms.wsdl,sha256=4qSn52d-DF6COeI-53P85sSODQy-C4_yp30yYCjeI84,10702
5
- mms_client/schemas/wsdl/omi-web-service.wsdl,sha256=pIEKcUWzyChzPJnQ6IpnZYyJJ0_0j3yt8M-1l_su5Q8,9894
6
- mms_client/schemas/xsd/mi-market.xsd,sha256=YyA-84Ha95BfvbACLaALs7m5U-idV-5yQ8GZfmZS_M8,109679
7
- mms_client/schemas/xsd/mi-outbnd-reports.xsd,sha256=xdQ_9jekOnqs9YPx0Dg8wsZjoxEp-HLO_ZXhzZl2Qk0,76166
8
- mms_client/schemas/xsd/mi-report.xsd,sha256=XEHhHCGgK4aeYsmObIrlzkvV8UhbirgoysAEOglvUW8,13276
9
- mms_client/schemas/xsd/mpr.xsd,sha256=QcnuKFm1WkyZfT_56cINHldZkR-3pU4nHSbFKHkIQS0,69149
10
- mms_client/schemas/xsd/omi.xsd,sha256=benkYeno_HF6BOIv7gAT79dWz00JccS3XilPLBCKVIU,31524
4
+ mms_client/schemas/wsdl/mi-web-service-jbms.wsdl,sha256=4Rt54HUrWmLz5NKLzs0E1j1J4yFw5Q2Fz7MhI6hqps8,10978
5
+ mms_client/schemas/wsdl/omi-web-service.wsdl,sha256=GjUquf1uYrQrZgW5K3l8OfU_LkvLhyBf1oW1fZTxQvA,10156
6
+ mms_client/schemas/xsd/mi-market.xsd,sha256=o3XWk_RU9qI2JescgcPBTPXmM_t9mfrMjnqQrFqwgIQ,113065
7
+ mms_client/schemas/xsd/mi-outbnd-reports.xsd,sha256=f6t5OV9va4TLPFUZWowmJJP-4pNRjNIDfnGJqJdWn20,80990
8
+ mms_client/schemas/xsd/mi-report.xsd,sha256=3IHEnjVcijPcnRBVsIzfaGwFGCjiw_iYmdte_ThUiXE,13655
9
+ mms_client/schemas/xsd/mpr.xsd,sha256=qjHOb9bPd4hWIeTlZ8oFBfgos-6yWGumYJ659c9QAx8,72480
10
+ mms_client/schemas/xsd/omi.xsd,sha256=XOVQVcAbU_rArGZ12bJLf3nWwyG5tvu1uOActqQy0xE,37799
11
11
  mms_client/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  mms_client/security/certs.py,sha256=Gy-CuSsdLPFeoPH_sEYhY67dI5sy6yJ8iTwlysRKT1s,3018
13
13
  mms_client/security/crypto.py,sha256=u9Z6nkAW6LbBqUzjIEbZ-CcqdkMJ9fqvdX7IXTTh1EI,2345
14
14
  mms_client/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- mms_client/services/base.py,sha256=1CJ528X2TJgG3uKa1_txjRHuTOQGQxsm43iFWfrvXBs,31643
16
- mms_client/services/market.py,sha256=qzTQWPgXcI2uvDxC0SnYL9pyWJ4TolFGhbkgb4jS8gA,9549
17
- mms_client/services/omi.py,sha256=UG1zYkFz0sFsEbhE6P0CLoAOZZOyEshkZ_b7D_e3CjQ,626
15
+ mms_client/services/base.py,sha256=jEgyjmOdqVkuD9jYthlj_Dv_bJyK2J4lkLrl7wfMy6I,31649
16
+ mms_client/services/market.py,sha256=yMgZ2pQQU5iO41G8Aey2bQ0EjmZjuB3kX5nywiL2hyE,14984
17
+ mms_client/services/omi.py,sha256=WIeOkvc967gBvYlIx9oHnn2sANDVms-hM5uptvWZF5U,4908
18
18
  mms_client/services/registration.py,sha256=XkXBgPK9PXFyNxo3ways_hUJ3E_vKTUlgCPgQQbDgWM,3839
19
19
  mms_client/services/report.py,sha256=hgRvjVxy8Hvbj5hQb0GMyDW0-1kMW2XFS5iKfO90YZY,6258
20
20
  mms_client/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- mms_client/types/award.py,sha256=1-CHIE3x5zFWA8WccUkGwQFBpLdsm4VQ7rk8uOoyKVc,15771
21
+ mms_client/types/award.py,sha256=qfJ107o5deuto9SEmst9cCQwd3PSJLaVzCMeuDgK8c8,16096
22
22
  mms_client/types/base.py,sha256=Y0CZEWPQgkPXZWz_WXOpW2J8mRryCRNU7oAZEdWkqvQ,11405
23
+ mms_client/types/bup.py,sha256=wv9ZyQ7pr9sfkoexcx_vLv5ItdRdPqAM-JApo0KlXdE,8415
23
24
  mms_client/types/enums.py,sha256=hALMuqRChLUJ1Eglll5R5mkYLpcO-ZIaEBps3MjkTg0,2534
24
25
  mms_client/types/fields.py,sha256=kPHN_5TT5sSarkic56Tvr2k-fTvf8oFj53DXGwRfrPg,14785
25
- mms_client/types/market.py,sha256=D5tZB97ewHfwG9gVC35bHfdlGthi5GBeMaGBk5393wY,2577
26
- mms_client/types/offer.py,sha256=Dtx7ftLgaJONVEetalXaXmJM4bJ65NBMFFNTGwgLF90,7960
26
+ mms_client/types/market.py,sha256=sO4WX8Vjh6PALScCjqXUXtb5lER3wfdBy-vYAPpi_Uk,3125
27
+ mms_client/types/offer.py,sha256=fYrmhq7_wVFLdOjLu_--ZSV23i5i8It3vUoW6Q-EqPM,8305
28
+ mms_client/types/omi.py,sha256=lwU91nne4TDo1xQclulyxAHzyhWB2srhJBYmnoJAKYs,1058
27
29
  mms_client/types/registration.py,sha256=bPA_FQwLVIwb5CRqK8F3YqeV0dEeN04j1wMsClrV5Wc,1252
28
30
  mms_client/types/report.py,sha256=7ENst_h1V2DG342UwL9ZltdRK2TaI-P1QW26qwjb6ao,23687
29
31
  mms_client/types/reserve.py,sha256=nsFJ0oSEuoCf82CtZEFa_-1UKAj-5Ssf1gEoWTlYiCI,3296
30
32
  mms_client/types/resource.py,sha256=4WhrSKOAXGrkg04r9f8f5kC3r0XDIKLarOFtBd2f7NI,65384
33
+ mms_client/types/settlement.py,sha256=BrbVpoiOeSQk4nJ2uKCQGVMSmjQ0xoAgteUl8pn33BI,3181
34
+ mms_client/types/surplus_capcity.py,sha256=4ng5OtAdAUFyV-YATe8KiuG6HcfTlWZAyf2rEHOX1Gk,8771
31
35
  mms_client/types/transport.py,sha256=4iEYod4DbqBBRXMH_VBqK9ORwR2q7MxSwwfWQAeHcT4,4442
32
36
  mms_client/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
37
  mms_client/utils/errors.py,sha256=aDpAqI3Y4D3DtgsCtaaLmla_iOoIZ0SjpoYjzymCGMI,4736
34
38
  mms_client/utils/multipart_transport.py,sha256=GJvjdlmXituiT78f5XuhpPkcHdDHFtVELa-F3eqUvbk,9981
35
39
  mms_client/utils/plugin.py,sha256=_Jymcny5ta9uV4CMLGDX7O5xSQIhuu76rb-A6uhtFSY,2013
36
- mms_client/utils/serialization.py,sha256=xF-C8Owp5HE6xfdcT00HFZXZnF-9vljIxoWNyjPHK5U,34512
40
+ mms_client/utils/serialization.py,sha256=ZW4NXrfzL3Sq01uzZhGqy-AFg4GuzvC6fJ2uJi3UcXY,34584
37
41
  mms_client/utils/web.py,sha256=Qk8azZpxAIEtI9suOikxBNtFQFNuWh-92DaUBU1qX8s,10927
38
- mms_client-1.10.0.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
39
- mms_client-1.10.0.dist-info/METADATA,sha256=Z8-YF70jaXeZLzbiNcGifOYnW0aSnJqnT3I1tNkAbDU,16849
40
- mms_client-1.10.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
41
- mms_client-1.10.0.dist-info/RECORD,,
42
+ mms_client-1.11.1.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
43
+ mms_client-1.11.1.dist-info/METADATA,sha256=I6faf2Es8GbMJ7tZ7fT-F3vEfGC_lk46I37OCJ2D2pk,17018
44
+ mms_client-1.11.1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
45
+ mms_client-1.11.1.dist-info/RECORD,,