mms-client 1.9.0__py3-none-any.whl → 1.9.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.
@@ -1,10 +1,11 @@
1
1
  """Contains the client layer for making market requests to the MMS server."""
2
2
 
3
- from datetime import date as Date
4
3
  from logging import getLogger
5
4
  from typing import List
6
5
  from typing import Optional
7
6
 
7
+ from pydantic_extra_types.pendulum_dt import Date
8
+
8
9
  from mms_client.services.base import ClientProto
9
10
  from mms_client.services.base import ServiceConfiguration
10
11
  from mms_client.services.base import mms_endpoint
@@ -1,10 +1,11 @@
1
1
  """Contains the client layer for making registration requests to the MMS server."""
2
2
 
3
- from datetime import date as Date
4
3
  from logging import getLogger
5
4
  from typing import List
6
5
  from typing import Optional
7
6
 
7
+ from pydantic_extra_types.pendulum_dt import Date
8
+
8
9
  from mms_client.services.base import ClientProto
9
10
  from mms_client.services.base import ServiceConfiguration
10
11
  from mms_client.services.base import mms_endpoint
mms_client/types/award.py CHANGED
@@ -5,6 +5,9 @@ from enum import Enum
5
5
  from typing import List
6
6
  from typing import Optional
7
7
 
8
+ from pendulum import Timezone
9
+ from pydantic import field_serializer
10
+ from pydantic import field_validator
8
11
  from pydantic_core import PydanticUndefined
9
12
  from pydantic_extra_types.pendulum_dt import DateTime
10
13
  from pydantic_xml import attr
@@ -109,6 +112,16 @@ class AwardQuery(Payload, tag="AwardResultsQuery"):
109
112
  # regardless of gate closure.
110
113
  gate_closed: Optional[BooleanFlag] = attr(default=None, name="AfterGC")
111
114
 
115
+ @field_serializer("start", "end")
116
+ def encode_datetime(self, value: DateTime) -> str:
117
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
118
+ return value.replace(tzinfo=None).isoformat()
119
+
120
+ @field_validator("start", "end")
121
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
122
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
123
+ return value.replace(tzinfo=Timezone("Asia/Tokyo"))
124
+
112
125
 
113
126
  class Award(Payload):
114
127
  """Represents the details of a bid award."""
@@ -286,6 +299,16 @@ class Award(Payload):
286
299
  # Whether we are before gate close or after gate close
287
300
  gate_closed: BooleanFlag = attr(name="AfterGC")
288
301
 
302
+ @field_serializer("submission_time")
303
+ def encode_datetime(self, value: DateTime) -> str:
304
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
305
+ return value.replace(tzinfo=None).isoformat() if value else ""
306
+
307
+ @field_validator("submission_time")
308
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
309
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
310
+ return value.replace(tzinfo=Timezone("Asia/Tokyo"))
311
+
289
312
 
290
313
  class AwardResult(Payload, tag="AwardResults"):
291
314
  """Contains a number of bid rewards associated with a block of time and trade direction."""
@@ -302,6 +325,16 @@ class AwardResult(Payload, tag="AwardResults"):
302
325
  # The bid awards associated with these parameters
303
326
  data: List[Award] = element(tag="AwardResultsData", min_length=1)
304
327
 
328
+ @field_serializer("start", "end")
329
+ def encode_datetime(self, value: DateTime) -> str:
330
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
331
+ return value.replace(tzinfo=None).isoformat()
332
+
333
+ @field_validator("start", "end")
334
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
335
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
336
+ return value.replace(tzinfo=Timezone("Asia/Tokyo"))
337
+
305
338
 
306
339
  class AwardResponse(AwardQuery, tag="AwardResultsQuery"):
307
340
  """Contains the results of a bid award query."""
@@ -1,11 +1,9 @@
1
1
  """Contains objects for market information."""
2
2
 
3
- # Have to use this becasue pydantic doesn't like pendulum.Date. I've submitted a PR to address this but it hasn't been
4
- # merged or released yet.
5
- from datetime import date as Date
6
3
  from enum import Enum
7
4
  from typing import Optional
8
5
 
6
+ from pydantic_extra_types.pendulum_dt import Date
9
7
  from pydantic_xml import attr
10
8
 
11
9
  from mms_client.types.base import Envelope
mms_client/types/offer.py CHANGED
@@ -4,6 +4,9 @@ from decimal import Decimal
4
4
  from typing import List
5
5
  from typing import Optional
6
6
 
7
+ from pendulum import Timezone
8
+ from pydantic import field_serializer
9
+ from pydantic import field_validator
7
10
  from pydantic_extra_types.pendulum_dt import DateTime
8
11
  from pydantic_xml import attr
9
12
  from pydantic_xml import element
@@ -115,6 +118,16 @@ class OfferData(Payload):
115
118
  # The date and time when the offer was submitted
116
119
  submission_time: Optional[DateTime] = attr(default=None, name="SubmissionTime")
117
120
 
121
+ @field_serializer("start", "end", "submission_time")
122
+ def encode_datetime(self, value: DateTime) -> str:
123
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
124
+ return value.replace(tzinfo=None).isoformat() if value else ""
125
+
126
+ @field_validator("start", "end", "submission_time")
127
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
128
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
129
+ return value.replace(tzinfo=Timezone("Asia/Tokyo"))
130
+
118
131
 
119
132
  class OfferCancel(Payload):
120
133
  """Describes the data necessary to cancel an offer in the MMS."""
@@ -132,6 +145,16 @@ class OfferCancel(Payload):
132
145
  # The type of market for the offer was submitted on
133
146
  market_type: MarketType = attr(name="MarketType")
134
147
 
148
+ @field_serializer("start", "end")
149
+ def encode_datetime(self, value: DateTime) -> str:
150
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
151
+ return value.replace(tzinfo=None).isoformat()
152
+
153
+ @field_validator("start", "end")
154
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
155
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
156
+ return value.replace(tzinfo=Timezone("Asia/Tokyo"))
157
+
135
158
 
136
159
  class OfferQuery(Payload):
137
160
  """Describes the data necessary to query for offers in the MMS."""
@@ -1,11 +1,9 @@
1
1
  """Contains objects for registrations."""
2
2
 
3
- # Have to use this becasue pydantic doesn't like pendulum.Date. I've submitted a PR to address this but it hasn't been
4
- # merged or released yet.
5
- from datetime import date as Date
6
3
  from enum import Enum
7
4
  from typing import Optional
8
5
 
6
+ from pydantic_extra_types.pendulum_dt import Date
9
7
  from pydantic_xml import attr
10
8
 
11
9
  from mms_client.types.base import Envelope
@@ -1,13 +1,16 @@
1
1
  """Contains objects for report data."""
2
2
 
3
- from datetime import date as Date
4
3
  from decimal import Decimal
5
4
  from enum import StrEnum
6
5
  from typing import Annotated
7
6
  from typing import List
8
7
  from typing import Optional
9
8
 
9
+ from pendulum import Timezone as TZ
10
+ from pydantic import field_serializer
11
+ from pydantic import field_validator
10
12
  from pydantic_core import PydanticUndefined
13
+ from pydantic_extra_types.pendulum_dt import Date
11
14
  from pydantic_extra_types.pendulum_dt import DateTime
12
15
  from pydantic_xml import BaseXmlModel
13
16
  from pydantic_xml import attr
@@ -331,6 +334,16 @@ class OutboundData(Envelope):
331
334
  # The time the report was published
332
335
  publish_time: Optional[DateTime] = attr(default=None, name="PublishTime")
333
336
 
337
+ @field_serializer("publish_time")
338
+ def encode_datetime(self, value: DateTime) -> str:
339
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
340
+ return value.replace(tzinfo=None).isoformat() if value else ""
341
+
342
+ @field_validator("publish_time")
343
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
344
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
345
+ return value.replace(tzinfo=TZ("Asia/Tokyo"))
346
+
334
347
 
335
348
  class ReportLineBase(Payload):
336
349
  """Represents the base fields for a report line item."""
@@ -3,6 +3,9 @@
3
3
  from typing import List
4
4
  from typing import Optional
5
5
 
6
+ from pendulum import Timezone
7
+ from pydantic import field_serializer
8
+ from pydantic import field_validator
6
9
  from pydantic_extra_types.pendulum_dt import DateTime
7
10
  from pydantic_xml import attr
8
11
  from pydantic_xml import element
@@ -50,6 +53,16 @@ class Requirement(Payload):
50
53
  # The minimum reserve of compound primary and tertiary 1 in kW
51
54
  primary_tertiary_1_qty_kw: Optional[int] = power_positive("CompoundPriTer1ReserveQuantityInKw", True)
52
55
 
56
+ @field_serializer("start", "end")
57
+ def encode_datetime(self, value: DateTime) -> str:
58
+ """Encode the datetime to an MMS-compliant ISO 8601 string."""
59
+ return value.replace(tzinfo=None).isoformat()
60
+
61
+ @field_validator("start", "end")
62
+ def decode_datetime(cls, value: DateTime) -> DateTime: # pylint: disable=no-self-argument
63
+ """Decode the datetime from an MMS-compliant ISO 8601 string."""
64
+ return value.replace(tzinfo=Timezone("Asia/Tokyo"))
65
+
53
66
 
54
67
  class ReserveRequirement(Payload):
55
68
  """Represents a set of reserve requirements."""
@@ -2,7 +2,6 @@
2
2
 
3
3
  # pylint: disable=too-many-lines
4
4
 
5
- from datetime import date as Date
6
5
  from decimal import Decimal
7
6
  from enum import Enum
8
7
  from typing import Annotated
@@ -10,6 +9,7 @@ from typing import List
10
9
  from typing import Optional
11
10
 
12
11
  from pydantic_core import PydanticUndefined
12
+ from pydantic_extra_types.pendulum_dt import Date
13
13
  from pydantic_xml import attr
14
14
  from pydantic_xml import element
15
15
  from pydantic_xml import wrapped
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mms-client
3
- Version: 1.9.0
3
+ Version: 1.9.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
@@ -13,21 +13,21 @@ mms_client/security/certs.py,sha256=Gy-CuSsdLPFeoPH_sEYhY67dI5sy6yJ8iTwlysRKT1s,
13
13
  mms_client/security/crypto.py,sha256=u9Z6nkAW6LbBqUzjIEbZ-CcqdkMJ9fqvdX7IXTTh1EI,2345
14
14
  mms_client/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  mms_client/services/base.py,sha256=4r_hsmSDmoutu9A-fVayBKqoe6FOAkm10qzNs47cFUI,30421
16
- mms_client/services/market.py,sha256=DUtnzWRLmTrTgZ4jo93B0S5Pq9K7dEtAGWYWbTbe5rA,9524
16
+ mms_client/services/market.py,sha256=dRarOS-rxilincVEzhfPnSnXlLKYAimwcoTX9qigvog,9541
17
17
  mms_client/services/omi.py,sha256=UG1zYkFz0sFsEbhE6P0CLoAOZZOyEshkZ_b7D_e3CjQ,626
18
- mms_client/services/registration.py,sha256=tPJo-cBYURH5KkpxMQqWvZW6IqelzoBm5x6jzkJy-C0,3822
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=BWE9V_KHXpg_cW1LZsetVrPs2hZDOklvRpNnoZtmR3k,14139
21
+ mms_client/types/award.py,sha256=1Tew43jo0HfaGJy4Uu3zFrB3HBjdwwR9ca-PADhenTI,15722
22
22
  mms_client/types/base.py,sha256=VYXnUkEKcI1ki6Sk0ekklDLKDLkv03xrfbSFzzV_RXk,11240
23
23
  mms_client/types/enums.py,sha256=hALMuqRChLUJ1Eglll5R5mkYLpcO-ZIaEBps3MjkTg0,2534
24
24
  mms_client/types/fields.py,sha256=pa5qvQVwEr8dh44IGHyYqgJYTYyTIeAjBW6CylXrkP0,14785
25
- mms_client/types/market.py,sha256=IbXsH4Q5MJI-CEvGvZlzv2S36mX_Ea02U11Ik-NwSxQ,2706
26
- mms_client/types/offer.py,sha256=KosFiKRMnt7XwlLBUfjHUGHiWzrMJUPPhGQMxgdeepM,6791
27
- mms_client/types/registration.py,sha256=Nir73S3ffpk0O_fnTD2alFaqV1k67_8dcyyduXvPBI4,1381
28
- mms_client/types/report.py,sha256=ogfzIMvQeGBR_21JVHqQo1fqBZY7ExuRlpj6nNcKRcU,23044
29
- mms_client/types/reserve.py,sha256=pLV47w_749EIVhj0tUuJdWdHBBEl0-v10oVioccgxnU,2667
30
- mms_client/types/resource.py,sha256=TNQM51SLxnkjSlyJ2Sh-8Ph1-rNgkz3JKrAgI6qSHEg,65284
25
+ mms_client/types/market.py,sha256=D5tZB97ewHfwG9gVC35bHfdlGthi5GBeMaGBk5393wY,2577
26
+ mms_client/types/offer.py,sha256=K6B8TgolIepJgveHz70I-dpE-ZSalcoFKKgH7C6b7P4,7921
27
+ mms_client/types/registration.py,sha256=bPA_FQwLVIwb5CRqK8F3YqeV0dEeN04j1wMsClrV5Wc,1252
28
+ mms_client/types/report.py,sha256=mIsqkF6pbzUBVpY-ushO_mxhMO1WeBw7jWtAEiD1O50,23667
29
+ mms_client/types/reserve.py,sha256=mTWv1uUHImkucPyrp2SxUSE5zabggcjLT7qBiyEJxrg,3257
30
+ mms_client/types/resource.py,sha256=749SNzqK1UVwzS2Ct_Q-a30PgnVQPp-CUQkoO_LCkao,65300
31
31
  mms_client/types/transport.py,sha256=-hRmhv1VdMiby6zQJjqNRO7TkatRU-ZEqoCdtQMpgdg,4407
32
32
  mms_client/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  mms_client/utils/errors.py,sha256=6k-NOjGZyTbTUISzN7B4JrmU2P8cwjpFFmFC7kJOQFQ,3005
@@ -35,7 +35,7 @@ mms_client/utils/multipart_transport.py,sha256=GJvjdlmXituiT78f5XuhpPkcHdDHFtVEL
35
35
  mms_client/utils/plugin.py,sha256=_Jymcny5ta9uV4CMLGDX7O5xSQIhuu76rb-A6uhtFSY,2013
36
36
  mms_client/utils/serialization.py,sha256=weXZQOqAiQ4ga-vAVz8PQ1JR_iX2iN0lyMimqqC3mio,33783
37
37
  mms_client/utils/web.py,sha256=Qk8azZpxAIEtI9suOikxBNtFQFNuWh-92DaUBU1qX8s,10927
38
- mms_client-1.9.0.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
39
- mms_client-1.9.0.dist-info/METADATA,sha256=sMf-OwVTryynN6TL4f_XykJj-GDpV1u0zPqMp_QKQkE,16578
40
- mms_client-1.9.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
41
- mms_client-1.9.0.dist-info/RECORD,,
38
+ mms_client-1.9.1.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
39
+ mms_client-1.9.1.dist-info/METADATA,sha256=4Ds55FAHJyhg1lCa_KzY8mPZMJOzXjY4Ljc3qu7xBj0,16578
40
+ mms_client-1.9.1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
41
+ mms_client-1.9.1.dist-info/RECORD,,