pyeml-bindings 1.1.0__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,642 @@
1
+ """This file was generated by xsdata, v23.8, on 2023-10-17 11:34:35
2
+
3
+ Generator: DataclassGenerator
4
+ See: https://xsdata.readthedocs.io/
5
+ """
6
+
7
+ from pyeml_bindings.converters.xml_date_time import FullPrecisionXmlDateTimeConverter
8
+ from pyeml_bindings.emlcore_kiesraad_strict import (
9
+ Accepted,
10
+ Affiliation,
11
+ AffiliationIdentifier,
12
+ AffiliationIdentifierStructure,
13
+ AffiliationStructure,
14
+ Agent,
15
+ AgentIdentifier,
16
+ AgentIdentifierStructure,
17
+ AgentStructure,
18
+ Area,
19
+ AreaStructure,
20
+ AuditInformation,
21
+ AuditInformationStructure,
22
+ AuthorityIdentifier,
23
+ AuthorityIdentifierStructure,
24
+ BallotIdentifier,
25
+ BallotIdentifierRange,
26
+ BallotIdentifierRangeStructure,
27
+ BallotIdentifierStructure,
28
+ BinaryFormat,
29
+ BinaryItemStructure,
30
+ Candidate,
31
+ CandidateIdentifier,
32
+ CandidateIdentifierStructure,
33
+ CandidateStructure,
34
+ Channel,
35
+ ChannelStructure,
36
+ ComplexDateRangeStructure,
37
+ ContactDetails,
38
+ ContactDetailsStructure,
39
+ ContestIdentifier,
40
+ ContestIdentifierStructure,
41
+ CountingAlgorithm,
42
+ CountMetric,
43
+ CountMetricStructure,
44
+ CountQualifier,
45
+ CountQualifierStructure,
46
+ DocumentIdentifier,
47
+ DocumentIdentifierStructure,
48
+ ElectionGroupStructure,
49
+ ElectionIdentifier,
50
+ ElectionIdentifierStructure,
51
+ ElectionStatement,
52
+ EmailStructure,
53
+ Emlstructure,
54
+ Endorsement,
55
+ EventIdentifier,
56
+ EventIdentifierStructure,
57
+ EventQualifier,
58
+ EventQualifierStructure,
59
+ Gender,
60
+ GenderType,
61
+ IncomingGenericCommunicationStructure,
62
+ InternalGenericCommunicationStructure,
63
+ Logo,
64
+ LogoStructure,
65
+ ManagingAuthority,
66
+ ManagingAuthorityStructure,
67
+ MaxVotes,
68
+ MessagesStructure,
69
+ MessageType,
70
+ MinVotes,
71
+ NominatingOfficer,
72
+ NominatingOfficerStructure,
73
+ NumberInSequence,
74
+ NumberOfPositions,
75
+ OutgoingGenericCommunicationStructure,
76
+ Period,
77
+ PeriodStructure,
78
+ PeriodStructurePermanent,
79
+ PollingDistrict,
80
+ PollingDistrictStructure,
81
+ PollingPlace,
82
+ PollingPlaceStructure,
83
+ Position,
84
+ PositionStructure,
85
+ PreviousElectoralAddress,
86
+ ProcessingUnitStructure,
87
+ ProcessingUnitStructureRole,
88
+ Profile,
89
+ Proposal,
90
+ ProposalIdentifier,
91
+ ProposalIdentifierStructure,
92
+ ProposalItem,
93
+ ProposalItemStructure,
94
+ ProposalStructure,
95
+ Proposer,
96
+ ProposerStructure,
97
+ ProposerStructureCategory,
98
+ Proxy,
99
+ ProxyStructure,
100
+ ReferendumOptionIdentifier,
101
+ ReferendumOptionIdentifierStructure,
102
+ ReportingUnitIdentifier,
103
+ ReportingUnitIdentifierStructure,
104
+ ResponsibleOfficer,
105
+ ResponsibleOfficerStructure,
106
+ ResultsReportedStructure,
107
+ ScrutinyRequirement,
108
+ Seal,
109
+ SealStructure,
110
+ SequenceNumber,
111
+ SimpleDateRangeStructure,
112
+ SupporterIdentifier,
113
+ SupporterIdentifierStructure,
114
+ SupporterStructure,
115
+ TelephoneStructure,
116
+ TransactionId,
117
+ VoterIdentificationStructure,
118
+ VoterInformationStructure,
119
+ VoterInformationStructureGender,
120
+ VoterName,
121
+ VotingChannel,
122
+ VotingChannelType,
123
+ VotingMethod,
124
+ VotingMethodType,
125
+ Vtoken,
126
+ VtokenQualified,
127
+ VtokenQualifiedStructure,
128
+ VtokenStructure,
129
+ WriteIn,
130
+ WriteInType,
131
+ YesNoType,
132
+ )
133
+ from pyeml_bindings.emlcore_kiesraad_strict import (
134
+ PersonName as EmlcorePersonName,
135
+ )
136
+ from pyeml_bindings.emlexternals_kiesraad_strict import (
137
+ AuthorityAddressStructure,
138
+ ElectoralAddressStructure,
139
+ MailingAddressStructure,
140
+ OfficialAddressStructure,
141
+ PersonNameStructure,
142
+ PhysicalAddressStructure,
143
+ PostalLocationStructure,
144
+ ProxyAddressStructure,
145
+ QualifyingAddressStructure,
146
+ )
147
+ from pyeml_bindings.kiesraad_eml_extensions import (
148
+ AffiliationType,
149
+ Committee,
150
+ CommitteeCategoryType,
151
+ Contest,
152
+ Contests,
153
+ CreatedByAuthority,
154
+ CreationDateTime,
155
+ DateOfBirthAnnex,
156
+ ElectionCategoryType,
157
+ ElectionDate,
158
+ ElectionDomain,
159
+ ElectionSubcategory,
160
+ ElectionSubcategoryType,
161
+ ElectionTree,
162
+ ListData,
163
+ LivingAddress,
164
+ LivingAddressType,
165
+ NationalIdentificationNumber,
166
+ NominationDate,
167
+ NumberOfSeats,
168
+ PreferenceThreshold,
169
+ PublicationLanguageType,
170
+ Region,
171
+ RegionCategoryType,
172
+ RegionName,
173
+ RegisteredAppellation,
174
+ RegisteredBy,
175
+ RegisteredParties,
176
+ RegisteredParty,
177
+ ReportingUnitInvestigations,
178
+ )
179
+ from pyeml_bindings.kiesraad_eml_restrictions import (
180
+ AddressStructureRestrictedKr,
181
+ AffiliationIdentifierStructureKr,
182
+ AffiliationStructureKr,
183
+ AgentStructureKr,
184
+ AgentStructureKrRole,
185
+ AuthorityIdentifierStructureKr,
186
+ CandidateIdentifierStructureKr,
187
+ CandidateStructureKr,
188
+ ContactDetailsStructureKr,
189
+ ContestIdentifierStructureKr,
190
+ ElectionIdentifierStructureKr,
191
+ EmlstructureKr,
192
+ GenericMailingAddressStructureKr,
193
+ GenericQualifyingAddressStructureKr,
194
+ MailingAddressStructureKr,
195
+ ManagingAuthorityStructureKr,
196
+ MinimalQualifyingAddressStructureKr,
197
+ QualifyingAddressStructureKr,
198
+ ReportingUnitIdentifierStructureKr,
199
+ )
200
+ from pyeml_bindings.mod_110a_electionevent_kiesraad_strict import (
201
+ ContestIdentifierStructure110A,
202
+ ElectionEvent,
203
+ ElectionIdentifierStructure110A,
204
+ Emlstructure110,
205
+ PollingPlaceStructure110,
206
+ PollingPlaceStructure110Channel,
207
+ )
208
+ from pyeml_bindings.mod_110a_electionevent_kiesraad_strict import (
209
+ Eml as Eml110a,
210
+ )
211
+ from pyeml_bindings.mod_210_nomination_kiesraad_strict import (
212
+ AffiliationIdentifierStructure210,
213
+ AffiliationStructure210,
214
+ CandidateIdentifierStructure210,
215
+ CandidateStructure210,
216
+ ContestIdentifierStructure210,
217
+ ElectionIdentifierStructure210,
218
+ Emlstructure210,
219
+ Nomination,
220
+ ProposerStructureKr,
221
+ ProposerStructureRestricted,
222
+ ProposerStructureRestrictedJobTitle,
223
+ )
224
+ from pyeml_bindings.mod_210_nomination_kiesraad_strict import (
225
+ Eml as Eml210,
226
+ )
227
+ from pyeml_bindings.mod_230_candidatelist_kiesraad_strict import (
228
+ CandidateList,
229
+ ElectionIdentifierStructure230,
230
+ Emlstructure230,
231
+ Emlstructure230Id,
232
+ )
233
+ from pyeml_bindings.mod_230_candidatelist_kiesraad_strict import (
234
+ Eml as Eml230,
235
+ )
236
+ from pyeml_bindings.mod_510_count_kiesraad_strict import (
237
+ AffiliationIdentifierStructure510,
238
+ CandidateIdentifierStructure510,
239
+ CandidateStructure510,
240
+ Count,
241
+ ElectionIdentifierStructure510,
242
+ Emlstructure510,
243
+ RejectedVotesReasonCode,
244
+ ReportingUnitVotes,
245
+ UncountedVotesReasonCode,
246
+ )
247
+ from pyeml_bindings.mod_510_count_kiesraad_strict import (
248
+ Eml as Eml510,
249
+ )
250
+ from pyeml_bindings.mod_520_result_kiesraad_strict import (
251
+ AffiliationIdentifierStructure520,
252
+ CandidateIdentifierStructure520,
253
+ CandidateStructure520,
254
+ ElectionIdentifierStructure520,
255
+ Emlstructure520,
256
+ Result,
257
+ SelectionRanking,
258
+ )
259
+ from pyeml_bindings.mod_520_result_kiesraad_strict import (
260
+ Eml as Eml520,
261
+ )
262
+ from pyeml_bindings.x_al_kiesraad_strict import (
263
+ Address,
264
+ AddressDetails,
265
+ AddressLine,
266
+ AddressLinesType,
267
+ AdministrativeArea,
268
+ BuildingNameType,
269
+ BuildingNameTypeTypeOccurrence,
270
+ Country,
271
+ CountryName,
272
+ CountryNameCodeType,
273
+ CountryType,
274
+ Department,
275
+ DependentLocalityNumberNameNumberOccurrence,
276
+ DependentLocalityType,
277
+ FirmType,
278
+ GenericCountryType,
279
+ GenericLocalityType,
280
+ LargeMailUserType,
281
+ Locality,
282
+ LocalityNameType,
283
+ LocalityType,
284
+ LocalityType110,
285
+ LocalityTypeUsageType,
286
+ MailStopType,
287
+ MinimalCountryType,
288
+ MinimalLocalityType,
289
+ PostalCode,
290
+ PostalRouteType,
291
+ PostBox,
292
+ PostOffice,
293
+ PostOfficeNumberIndicatorOccurrence,
294
+ Premise,
295
+ PremiseNameTypeOccurrence,
296
+ PremiseNumber,
297
+ PremiseNumberIndicatorOccurrence,
298
+ PremiseNumberNumberType,
299
+ PremiseNumberNumberTypeOccurrence,
300
+ PremiseNumberPrefix,
301
+ PremiseNumberRangeIndicatorOccurence,
302
+ PremiseNumberRangeNumberRangeOccurence,
303
+ PremiseNumberSuffix,
304
+ SubPremiseNameTypeOccurrence,
305
+ SubPremiseNumberIndicatorOccurrence,
306
+ SubPremiseNumberNumberTypeOccurrence,
307
+ SubPremiseType,
308
+ Thoroughfare,
309
+ ThoroughfareDependentThoroughfares,
310
+ ThoroughfareLeadingTypeType,
311
+ ThoroughfareNameType,
312
+ ThoroughfareNumber,
313
+ ThoroughfareNumberIndicatorOccurrence,
314
+ ThoroughfareNumberNumberOccurrence,
315
+ ThoroughfareNumberNumberType,
316
+ ThoroughfareNumberPrefix,
317
+ ThoroughfareNumberRangeIndicatorOccurrence,
318
+ ThoroughfareNumberRangeNumberRangeOccurrence,
319
+ ThoroughfareNumberRangeRangeType,
320
+ ThoroughfareNumberSuffix,
321
+ ThoroughfarePostDirectionType,
322
+ ThoroughfarePreDirectionType,
323
+ ThoroughfareTrailingTypeType,
324
+ XAl,
325
+ )
326
+ from pyeml_bindings.x_nl_kiesraad_strict import (
327
+ Function,
328
+ JointPersonName,
329
+ NameDetails,
330
+ NameDetails1,
331
+ NameLineType,
332
+ OrganisationNameDetails,
333
+ OrganisationNameDetails1,
334
+ XNl,
335
+ )
336
+ from pyeml_bindings.x_nl_kiesraad_strict import (
337
+ PersonName as XNlPersonName,
338
+ )
339
+
340
+ __all__ = [
341
+ "Accepted",
342
+ "Affiliation",
343
+ "AffiliationIdentifier",
344
+ "AffiliationIdentifierStructure",
345
+ "AffiliationStructure",
346
+ "Agent",
347
+ "AgentIdentifier",
348
+ "AgentIdentifierStructure",
349
+ "AgentStructure",
350
+ "Area",
351
+ "AreaStructure",
352
+ "AuditInformation",
353
+ "AuditInformationStructure",
354
+ "AuthorityIdentifier",
355
+ "AuthorityIdentifierStructure",
356
+ "BallotIdentifier",
357
+ "BallotIdentifierRange",
358
+ "BallotIdentifierRangeStructure",
359
+ "BallotIdentifierStructure",
360
+ "BinaryItemStructure",
361
+ "BinaryFormat",
362
+ "Candidate",
363
+ "CandidateIdentifier",
364
+ "CandidateIdentifierStructure",
365
+ "CandidateStructure",
366
+ "Channel",
367
+ "ChannelStructure",
368
+ "ComplexDateRangeStructure",
369
+ "ContactDetails",
370
+ "ContactDetailsStructure",
371
+ "ContestIdentifier",
372
+ "ContestIdentifierStructure",
373
+ "CountMetric",
374
+ "CountMetricStructure",
375
+ "CountQualifier",
376
+ "CountQualifierStructure",
377
+ "CountingAlgorithm",
378
+ "DocumentIdentifier",
379
+ "DocumentIdentifierStructure",
380
+ "Emlstructure",
381
+ "ElectionGroupStructure",
382
+ "ElectionIdentifier",
383
+ "ElectionIdentifierStructure",
384
+ "ElectionStatement",
385
+ "EmailStructure",
386
+ "Endorsement",
387
+ "EventIdentifier",
388
+ "EventIdentifierStructure",
389
+ "EventQualifier",
390
+ "EventQualifierStructure",
391
+ "Gender",
392
+ "GenderType",
393
+ "IncomingGenericCommunicationStructure",
394
+ "InternalGenericCommunicationStructure",
395
+ "Logo",
396
+ "LogoStructure",
397
+ "ManagingAuthority",
398
+ "ManagingAuthorityStructure",
399
+ "MaxVotes",
400
+ "MessageType",
401
+ "MessagesStructure",
402
+ "MinVotes",
403
+ "NominatingOfficer",
404
+ "NominatingOfficerStructure",
405
+ "NumberInSequence",
406
+ "NumberOfPositions",
407
+ "OutgoingGenericCommunicationStructure",
408
+ "Period",
409
+ "PeriodStructure",
410
+ "PeriodStructurePermanent",
411
+ "EmlcorePersonName",
412
+ "PollingDistrict",
413
+ "PollingDistrictStructure",
414
+ "PollingPlace",
415
+ "PollingPlaceStructure",
416
+ "Position",
417
+ "PositionStructure",
418
+ "PreviousElectoralAddress",
419
+ "ProcessingUnitStructure",
420
+ "ProcessingUnitStructureRole",
421
+ "Profile",
422
+ "Proposal",
423
+ "ProposalIdentifier",
424
+ "ProposalIdentifierStructure",
425
+ "ProposalItem",
426
+ "ProposalItemStructure",
427
+ "ProposalStructure",
428
+ "Proposer",
429
+ "ProposerStructure",
430
+ "ProposerStructureCategory",
431
+ "Proxy",
432
+ "ProxyStructure",
433
+ "ReferendumOptionIdentifier",
434
+ "ReferendumOptionIdentifierStructure",
435
+ "ReportingUnitIdentifier",
436
+ "ReportingUnitIdentifierStructure",
437
+ "ResponsibleOfficer",
438
+ "ResponsibleOfficerStructure",
439
+ "ResultsReportedStructure",
440
+ "ScrutinyRequirement",
441
+ "Seal",
442
+ "SealStructure",
443
+ "SequenceNumber",
444
+ "SimpleDateRangeStructure",
445
+ "SupporterIdentifier",
446
+ "SupporterIdentifierStructure",
447
+ "SupporterStructure",
448
+ "TelephoneStructure",
449
+ "TransactionId",
450
+ "Vtoken",
451
+ "VtokenQualified",
452
+ "VtokenQualifiedStructure",
453
+ "VtokenStructure",
454
+ "VoterIdentificationStructure",
455
+ "VoterInformationStructure",
456
+ "VoterInformationStructureGender",
457
+ "VoterName",
458
+ "VotingChannel",
459
+ "VotingChannelType",
460
+ "VotingMethod",
461
+ "VotingMethodType",
462
+ "WriteIn",
463
+ "WriteInType",
464
+ "YesNoType",
465
+ "AuthorityAddressStructure",
466
+ "ElectoralAddressStructure",
467
+ "MailingAddressStructure",
468
+ "OfficialAddressStructure",
469
+ "PersonNameStructure",
470
+ "PhysicalAddressStructure",
471
+ "PostalLocationStructure",
472
+ "ProxyAddressStructure",
473
+ "QualifyingAddressStructure",
474
+ "AffiliationType",
475
+ "Committee",
476
+ "CommitteeCategoryType",
477
+ "Contest",
478
+ "Contests",
479
+ "CreatedByAuthority",
480
+ "CreationDateTime",
481
+ "DateOfBirthAnnex",
482
+ "ElectionCategoryType",
483
+ "ElectionDate",
484
+ "ElectionDomain",
485
+ "ElectionSubcategory",
486
+ "ElectionSubcategoryType",
487
+ "ElectionTree",
488
+ "ListData",
489
+ "LivingAddress",
490
+ "LivingAddressType",
491
+ "NationalIdentificationNumber",
492
+ "NominationDate",
493
+ "NumberOfSeats",
494
+ "PreferenceThreshold",
495
+ "PublicationLanguageType",
496
+ "Region",
497
+ "RegionCategoryType",
498
+ "RegionName",
499
+ "RegisteredAppellation",
500
+ "RegisteredBy",
501
+ "RegisteredParties",
502
+ "RegisteredParty",
503
+ "AddressStructureRestrictedKr",
504
+ "AffiliationIdentifierStructureKr",
505
+ "AffiliationStructureKr",
506
+ "AgentStructureKr",
507
+ "AgentStructureKrRole",
508
+ "AuthorityIdentifierStructureKr",
509
+ "CandidateIdentifierStructureKr",
510
+ "CandidateStructureKr",
511
+ "ContactDetailsStructureKr",
512
+ "ContestIdentifierStructureKr",
513
+ "EmlstructureKr",
514
+ "ElectionIdentifierStructureKr",
515
+ "GenericMailingAddressStructureKr",
516
+ "GenericQualifyingAddressStructureKr",
517
+ "MailingAddressStructureKr",
518
+ "ManagingAuthorityStructureKr",
519
+ "MinimalQualifyingAddressStructureKr",
520
+ "QualifyingAddressStructureKr",
521
+ "ReportingUnitIdentifierStructureKr",
522
+ "AffiliationIdentifierStructure210",
523
+ "AffiliationStructure210",
524
+ "CandidateIdentifierStructure210",
525
+ "CandidateStructure210",
526
+ "ContestIdentifierStructure210",
527
+ "Emlstructure210",
528
+ "Eml210",
529
+ "ElectionIdentifierStructure210",
530
+ "Nomination",
531
+ "ProposerStructureKr",
532
+ "ProposerStructureRestricted",
533
+ "ProposerStructureRestrictedJobTitle",
534
+ "CandidateList",
535
+ "Emlstructure230",
536
+ "Eml230",
537
+ "Emlstructure230Id",
538
+ "ElectionIdentifierStructure230",
539
+ "AffiliationIdentifierStructure510",
540
+ "CandidateIdentifierStructure510",
541
+ "CandidateStructure510",
542
+ "Count",
543
+ "Emlstructure510",
544
+ "Eml510",
545
+ "ElectionIdentifierStructure510",
546
+ "RejectedVotesReasonCode",
547
+ "ReportingUnitVotes",
548
+ "UncountedVotesReasonCode",
549
+ "AffiliationIdentifierStructure520",
550
+ "CandidateIdentifierStructure520",
551
+ "CandidateStructure520",
552
+ "Emlstructure520",
553
+ "Eml520",
554
+ "ElectionIdentifierStructure520",
555
+ "Result",
556
+ "SelectionRanking",
557
+ "Address",
558
+ "AddressDetails",
559
+ "AddressLine",
560
+ "AddressLinesType",
561
+ "AdministrativeArea",
562
+ "BuildingNameType",
563
+ "BuildingNameTypeTypeOccurrence",
564
+ "Country",
565
+ "CountryName",
566
+ "CountryNameCodeType",
567
+ "CountryType",
568
+ "Department",
569
+ "DependentLocalityNumberNameNumberOccurrence",
570
+ "DependentLocalityType",
571
+ "FirmType",
572
+ "GenericCountryType",
573
+ "GenericLocalityType",
574
+ "LargeMailUserType",
575
+ "Locality",
576
+ "LocalityNameType",
577
+ "LocalityType",
578
+ "LocalityType110",
579
+ "LocalityTypeUsageType",
580
+ "MailStopType",
581
+ "MinimalCountryType",
582
+ "MinimalLocalityType",
583
+ "PostBox",
584
+ "PostOffice",
585
+ "PostOfficeNumberIndicatorOccurrence",
586
+ "PostalCode",
587
+ "PostalRouteType",
588
+ "Premise",
589
+ "PremiseNameTypeOccurrence",
590
+ "PremiseNumber",
591
+ "PremiseNumberPrefix",
592
+ "PremiseNumberRangeIndicatorOccurence",
593
+ "PremiseNumberRangeNumberRangeOccurence",
594
+ "PremiseNumberSuffix",
595
+ "PremiseNumberIndicatorOccurrence",
596
+ "PremiseNumberNumberType",
597
+ "PremiseNumberNumberTypeOccurrence",
598
+ "SubPremiseNameTypeOccurrence",
599
+ "SubPremiseNumberIndicatorOccurrence",
600
+ "SubPremiseNumberNumberTypeOccurrence",
601
+ "SubPremiseType",
602
+ "Thoroughfare",
603
+ "ThoroughfareLeadingTypeType",
604
+ "ThoroughfareNameType",
605
+ "ThoroughfareNumber",
606
+ "ThoroughfareNumberPrefix",
607
+ "ThoroughfareNumberRangeIndicatorOccurrence",
608
+ "ThoroughfareNumberRangeNumberRangeOccurrence",
609
+ "ThoroughfareNumberRangeRangeType",
610
+ "ThoroughfareNumberSuffix",
611
+ "ThoroughfareNumberIndicatorOccurrence",
612
+ "ThoroughfareNumberNumberOccurrence",
613
+ "ThoroughfareNumberNumberType",
614
+ "ThoroughfarePostDirectionType",
615
+ "ThoroughfarePreDirectionType",
616
+ "ThoroughfareTrailingTypeType",
617
+ "ThoroughfareDependentThoroughfares",
618
+ "XAl",
619
+ "Function",
620
+ "JointPersonName",
621
+ "NameDetails",
622
+ "NameDetails1",
623
+ "NameLineType",
624
+ "OrganisationNameDetails",
625
+ "OrganisationNameDetails1",
626
+ "XNlPersonName",
627
+ "XNl",
628
+ "ContestIdentifierStructure110A",
629
+ "Emlstructure110",
630
+ "Eml110a",
631
+ "ElectionEvent",
632
+ "ElectionIdentifierStructure110A",
633
+ "PollingPlaceStructure110",
634
+ "PollingPlaceStructure110Channel",
635
+ "ReportingUnitInvestigations",
636
+ ]
637
+
638
+ # Register custom converters for serialization
639
+ from xsdata.formats.converter import converter
640
+ from xsdata.models.datatype import XmlDateTime
641
+
642
+ converter.register_converter(XmlDateTime, FullPrecisionXmlDateTimeConverter())
@@ -0,0 +1,51 @@
1
+ from typing import Any, Optional
2
+
3
+ from xsdata.formats.converter import Converter
4
+ from xsdata.models.datatype import XmlDateTime
5
+ from xsdata.utils.dates import format_date, format_offset
6
+
7
+
8
+ def custom_format_time(
9
+ hour: int, minute: int, second: int, fractional_second: int
10
+ ) -> str:
11
+ """Serializes a time according to ISO 8601.
12
+
13
+ Args:
14
+ hour (int): The hour to serialize
15
+ minute (int): The minute to serialize
16
+ second (int): The second to serialize
17
+ fractional_second (int): The fractional second to serialize. Can be either nano- micro- or milliseconds.
18
+
19
+ Returns:
20
+ str: The time formatted according to ISO 8601 (example: 14:14:33.000)
21
+ """
22
+ microsecond, nano = divmod(fractional_second, 1000)
23
+ if nano:
24
+ return f"{hour:02d}:{minute:02d}:{second:02d}.{fractional_second:09d}"
25
+
26
+ milli, micro = divmod(microsecond, 1000)
27
+ if micro:
28
+ return f"{hour:02d}:{minute:02d}:{second:02d}.{microsecond:06d}"
29
+
30
+ return f"{hour:02d}:{minute:02d}:{second:02d}.{milli:03d}"
31
+
32
+
33
+ class FullPrecisionXmlDateTimeConverter(Converter):
34
+ """Override the default XmlDateTimeConverter to preserve full precision when serializing datetimes
35
+
36
+ Args:
37
+ Converter (xsdata.formats.converter.Converter): Abstract converter class
38
+ """
39
+
40
+ def deserialize(self, value: Any, **kwargs: Any) -> Any:
41
+ return XmlDateTime.from_string(value)
42
+
43
+ def serialize(self, value: Any, **kwargs: Any) -> Optional[str]:
44
+ if isinstance(value, XmlDateTime):
45
+ return "{}T{}{}".format(
46
+ format_date(value.year, value.month, value.day),
47
+ custom_format_time(
48
+ value.hour, value.minute, value.second, value.fractional_second
49
+ ),
50
+ format_offset(value.offset),
51
+ )