structurize 3.5.10__tar.gz → 3.5.11__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.
- {structurize-3.5.10/structurize.egg-info → structurize-3.5.11}/PKG-INFO +1 -1
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/_version.py +3 -3
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretopython.py +64 -7
- {structurize-3.5.10 → structurize-3.5.11/structurize.egg-info}/PKG-INFO +1 -1
- {structurize-3.5.10 → structurize-3.5.11}/.gitignore +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/LICENSE +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/MANIFEST.in +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/README.md +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/__init__.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/__main__.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/asn1toavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotize.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotocpp.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotocsharp.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotocsv.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotodatapackage.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotodb.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotogo.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotographql.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotoiceberg.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotojava.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotojs.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotojsons.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotojstruct.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotokusto.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotomd.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotools.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotoparquet.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotoproto.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotopython.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotorust.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotots.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrototsml.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrotoxsd.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/avrovalidator.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/cddltostructure.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/choice_inference.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/commands.json +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/common.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/constants.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/csvtoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/datapackagetoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/dependencies/cpp/vcpkg/vcpkg.json +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/dependencies/typescript/node22/package.json +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/dependency_resolver.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/dependency_version.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/jsonstoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/jsonstostructure.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/jsontoschema.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/jstructtoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/kstructtoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/kustotoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/kustotojstruct.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/mcp_server.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/openapitostructure.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/parquettoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/proto2parser.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/proto3parser.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/prototoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/schema_inference.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/sqltoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretocddl.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretocpp.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretocsharp.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretocsv.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretodatapackage.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretodb.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretogo.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretographql.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretoiceberg.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretojava.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretojs.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretojsons.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretokusto.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretomd.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretoproto.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretorust.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretots.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretotsml.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/structuretoxsd.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/tmslvalidate.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/validate.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/xmltoschema.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/avrotize/xsdtoavro.py +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/build.ps1 +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/build.sh +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/pyproject.toml +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/setup.cfg +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/structurize.egg-info/SOURCES.txt +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/structurize.egg-info/dependency_links.txt +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/structurize.egg-info/entry_points.txt +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/structurize.egg-info/requires.txt +0 -0
- {structurize-3.5.10 → structurize-3.5.11}/structurize.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structurize
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.11
|
|
4
4
|
Summary: Tools to convert from and to JSON Structure from various other schema languages.
|
|
5
5
|
Author-email: Clemens Vasters <clemensv@microsoft.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '3.5.
|
|
22
|
-
__version_tuple__ = version_tuple = (3, 5,
|
|
21
|
+
__version__ = version = '3.5.11'
|
|
22
|
+
__version_tuple__ = version_tuple = (3, 5, 11)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g9e1128f35'
|
|
@@ -497,17 +497,51 @@ class StructureToPython:
|
|
|
497
497
|
field_docstring = f"{field_name} ({field_type})"
|
|
498
498
|
return field_docstring
|
|
499
499
|
|
|
500
|
+
# Mapping of special characters to descriptive names for enum member
|
|
501
|
+
# identifiers. Applied *before* the catch-all regex so that symbols
|
|
502
|
+
# like "5+" and "5-" produce distinct identifiers instead of both
|
|
503
|
+
# collapsing to "5_".
|
|
504
|
+
_CHAR_NAME_MAP = {
|
|
505
|
+
'+': '_PLUS',
|
|
506
|
+
'-': '_MINUS',
|
|
507
|
+
'*': '_STAR',
|
|
508
|
+
'/': '_SLASH',
|
|
509
|
+
'&': '_AMP',
|
|
510
|
+
'|': '_PIPE',
|
|
511
|
+
'!': '_BANG',
|
|
512
|
+
'?': '_QMARK',
|
|
513
|
+
'#': '_HASH',
|
|
514
|
+
'%': '_PCT',
|
|
515
|
+
'@': '_AT',
|
|
516
|
+
'^': '_CARET',
|
|
517
|
+
'~': '_TILDE',
|
|
518
|
+
'<': '_LT',
|
|
519
|
+
'>': '_GT',
|
|
520
|
+
'=': '_EQ',
|
|
521
|
+
'.': '_DOT',
|
|
522
|
+
',': '_COMMA',
|
|
523
|
+
':': '_COLON',
|
|
524
|
+
';': '_SEMI',
|
|
525
|
+
'(': '_LPAREN',
|
|
526
|
+
')': '_RPAREN',
|
|
527
|
+
'[': '_LBRACK',
|
|
528
|
+
']': '_RBRACK',
|
|
529
|
+
'{': '_LBRACE',
|
|
530
|
+
'}': '_RBRACE',
|
|
531
|
+
}
|
|
532
|
+
|
|
500
533
|
def _python_enum_member_name(self, value) -> str:
|
|
501
534
|
"""Derives a valid Python identifier for an enum member from a JSON
|
|
502
535
|
Structure enum value.
|
|
503
536
|
|
|
504
537
|
Numeric values (including negative integers) are prefixed with
|
|
505
538
|
``VALUE_`` (with negatives spelled ``VALUE_NEG_n``) so the generated
|
|
506
|
-
class body is valid Python.
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
539
|
+
class body is valid Python. String values are sanitized by
|
|
540
|
+
replacing known special characters with descriptive names (e.g.
|
|
541
|
+
``+`` → ``_PLUS``, ``-`` → ``_MINUS``) and then replacing any
|
|
542
|
+
remaining non-identifier characters with underscores. Values that
|
|
543
|
+
start with a digit are prefixed with ``VALUE_``. Reserved words
|
|
544
|
+
get a trailing underscore.
|
|
511
545
|
"""
|
|
512
546
|
if isinstance(value, bool):
|
|
513
547
|
return "TRUE_" if value else "FALSE_"
|
|
@@ -520,7 +554,18 @@ class StructureToPython:
|
|
|
520
554
|
token = str(value)
|
|
521
555
|
return f"VALUE_{token}"
|
|
522
556
|
text = str(value)
|
|
523
|
-
|
|
557
|
+
# Replace known special characters with descriptive names
|
|
558
|
+
parts: list[str] = []
|
|
559
|
+
for ch in text:
|
|
560
|
+
if ch in self._CHAR_NAME_MAP:
|
|
561
|
+
parts.append(self._CHAR_NAME_MAP[ch])
|
|
562
|
+
else:
|
|
563
|
+
parts.append(ch)
|
|
564
|
+
candidate = ''.join(parts)
|
|
565
|
+
# Replace any remaining invalid identifier characters
|
|
566
|
+
candidate = re.sub(r'[^0-9A-Za-z_]', '_', candidate)
|
|
567
|
+
# Collapse runs of underscores and strip leading/trailing underscores
|
|
568
|
+
candidate = re.sub(r'_+', '_', candidate).strip('_')
|
|
524
569
|
if not candidate or not (candidate[0].isalpha() or candidate[0] == '_'):
|
|
525
570
|
candidate = f"VALUE_{candidate}" if candidate else "VALUE_"
|
|
526
571
|
if is_python_reserved_word(candidate):
|
|
@@ -548,10 +593,22 @@ class StructureToPython:
|
|
|
548
593
|
# Build (member_name, repr) pairs. ``repr`` is rendered verbatim into the
|
|
549
594
|
# class body, so for numeric enums we emit the bare numeric literal and
|
|
550
595
|
# for string enums a quoted Python string literal.
|
|
596
|
+
# Names that collide with each other or with generated methods are
|
|
597
|
+
# disambiguated with numeric suffixes.
|
|
551
598
|
members: List[Tuple[str, str]] = []
|
|
552
599
|
symbols: List[str] = []
|
|
600
|
+
# Pre-seed with names that would clash with generated Enum methods or
|
|
601
|
+
# Python Enum internals.
|
|
602
|
+
used_names: set[str] = {'from_ordinal', 'to_ordinal', 'mro', '_ignore_',
|
|
603
|
+
'_generate_next_value_', '_missing_', '_order_'}
|
|
553
604
|
for value in raw_values:
|
|
554
|
-
|
|
605
|
+
base_name = self._python_enum_member_name(value)
|
|
606
|
+
member_name = base_name
|
|
607
|
+
suffix = 2
|
|
608
|
+
while member_name in used_names:
|
|
609
|
+
member_name = f"{base_name}_{suffix}"
|
|
610
|
+
suffix += 1
|
|
611
|
+
used_names.add(member_name)
|
|
555
612
|
if is_numeric:
|
|
556
613
|
value_repr = repr(value)
|
|
557
614
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structurize
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.11
|
|
4
4
|
Summary: Tools to convert from and to JSON Structure from various other schema languages.
|
|
5
5
|
Author-email: Clemens Vasters <clemensv@microsoft.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structurize-3.5.10 → structurize-3.5.11}/avrotize/dependencies/typescript/node22/package.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|