classcore 1.13__tar.gz → 1.15__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 (27) hide show
  1. {classcore-1.13 → classcore-1.15}/PKG-INFO +1 -1
  2. {classcore-1.13 → classcore-1.15}/sources/classcore/__/nomina.py +24 -5
  3. {classcore-1.13 → classcore-1.15}/sources/classcore/__init__.py +1 -1
  4. {classcore-1.13 → classcore-1.15}/sources/classcore/nomina.py +5 -2
  5. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/behaviors.py +11 -6
  6. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/nomina.py +5 -0
  7. {classcore-1.13 → classcore-1.15}/.gitignore +0 -0
  8. {classcore-1.13 → classcore-1.15}/LICENSE.txt +0 -0
  9. {classcore-1.13 → classcore-1.15}/README.rst +0 -0
  10. {classcore-1.13 → classcore-1.15}/pyproject.toml +0 -0
  11. {classcore-1.13 → classcore-1.15}/sources/classcore/README.md +0 -0
  12. {classcore-1.13 → classcore-1.15}/sources/classcore/__/__init__.py +0 -0
  13. {classcore-1.13 → classcore-1.15}/sources/classcore/__/doctab.py +0 -0
  14. {classcore-1.13 → classcore-1.15}/sources/classcore/__/imports.py +0 -0
  15. {classcore-1.13 → classcore-1.15}/sources/classcore/decorators.py +0 -0
  16. {classcore-1.13 → classcore-1.15}/sources/classcore/exceptions.py +0 -0
  17. {classcore-1.13 → classcore-1.15}/sources/classcore/factories.py +0 -0
  18. {classcore-1.13 → classcore-1.15}/sources/classcore/py.typed +0 -0
  19. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/README.md +0 -0
  20. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/__.py +0 -0
  21. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/__init__.py +0 -0
  22. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/classes.py +0 -0
  23. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/decorators.py +0 -0
  24. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/dynadoc.py +0 -0
  25. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/explanations.py +0 -0
  26. {classcore-1.13 → classcore-1.15}/sources/classcore/standard/modules.py +0 -0
  27. {classcore-1.13 → classcore-1.15}/sources/classcore/utilities.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: classcore
3
- Version: 1.13
3
+ Version: 1.15
4
4
  Summary: Foundational class factories and decorators.
5
5
  Project-URL: Homepage, https://github.com/emcd/python-classcore
6
6
  Project-URL: Documentation, https://emcd.github.io/python-classcore
@@ -51,13 +51,32 @@ class AttrnameCalculator:
51
51
 
52
52
  Reference implementation of the attribute namer convention:
53
53
  call instances to produce names, and consult ``is_internal_name``
54
- to detect names this framework generated. Downstream packages
55
- may subclass (or otherwise provide callables exposing the same
56
- optional detector) to contribute their own internal names.
54
+ to detect names this framework generated. The package prefix is
55
+ construction-time configuration (default: this package):
56
+ downstream packages construct with their own prefix rather
57
+ than overriding either method, and it is read-only
58
+ thereafter: assignment raises, so a registered prefix cannot
59
+ drift. Detection consults the reserved
60
+ framework grammar (shape conformance, not proof of
61
+ generation); generation emits the class-level mangling stems
62
+ whose bare forms the detector does not accept. Downstream
63
+ callers writing conformance or drift tests can detect a
64
+ generated name without the private mangled-core vocabulary:
65
+ try the bare form first, then the form with 64 'a'
66
+ characters appended, which covers the two class-level
67
+ mangling stems the bare form never matches.
57
68
  '''
58
69
 
70
+ def __init__( self, package_name: str = package_name ) -> None:
71
+ self._package_name = package_name
72
+
73
+ @property
74
+ def package_name( self ) -> str:
75
+ ''' Package prefix this calculator generates and detects. '''
76
+ return self._package_name
77
+
59
78
  def is_internal_name( self, name: str ) -> bool:
60
- prefix = f"_{package_name}_"
79
+ prefix = f"_{self.package_name}_"
61
80
  if not name.startswith( prefix ):
62
81
  return False
63
82
  body = name[ len( prefix ): ]
@@ -84,7 +103,7 @@ class AttrnameCalculator:
84
103
  return False
85
104
 
86
105
  def __call__( self, level: str, core: str ) -> str:
87
- return f"_{package_name}_{level}_{core}_"
106
+ return f"_{self.package_name}_{level}_{core}_"
88
107
 
89
108
 
90
109
  calculate_attrname = AttrnameCalculator( )
@@ -62,7 +62,7 @@ from .factories import *
62
62
 
63
63
 
64
64
  __version__: __.typx.Annotated[ str, __.ddoc.Visibilities.Reveal ]
65
- __version__ = '1.13'
65
+ __version__ = '1.15'
66
66
 
67
67
 
68
68
  standard.finalize_module(
@@ -29,8 +29,11 @@ AttributesNamer: __.typx.TypeAlias = __.typx.Annotated[
29
29
  __.ddoc.Doc(
30
30
  ''' Names attribute from level and core arguments.
31
31
 
32
- Level will be one of 'class', 'instances', or 'instance'.
33
- Core will be the core of the name as supplied this package.
32
+ Level will be one of 'class', 'classes', 'instance', or
33
+ 'instances'. Core will be one of the framework cores
34
+ named in the attribute-namer grammar (mutables and
35
+ visibles rules, assigner, deleter, and surveyor cores,
36
+ and construction bookkeeping).
34
37
 
35
38
  Can be used by downstream packages to determine names of
36
39
  bookkeeping attributes assigned by this package.
@@ -185,10 +185,15 @@ def render_verifier_text( verifier: __.typx.Any, / ) -> str:
185
185
  qualified name is available. Strings do not reach this
186
186
  function; they are classified as names before rendering. A
187
187
  non-string 'pattern' attribute is not trusted as text; such
188
- verifiers fall through to qualified-name rendering. Hostile
189
- metadata (raising descriptors, custom '__getattribute__')
190
- yields '<unrenderable>' rather than raising, so diagnostic
191
- rendering never disrupts its callers.
188
+ verifiers fall through to qualified-name rendering, where a
189
+ non-string qualified name falls back to '<anonymous>' while
190
+ a non-string module name preserves the qualified name.
191
+ Hostile metadata (raising descriptors, custom
192
+ '__getattribute__') yields '<unrenderable>' rather than
193
+ raising, so diagnostic rendering never disrupts its callers.
194
+ The broad 'except Exception' is deliberate: rendering is
195
+ diagnostics, and diagnostics must never break enforcement
196
+ or survey paths.
192
197
 
193
198
  Note: the inspect utilities were considered and rejected here;
194
199
  they resolve modules to objects and provide no qualified-name
@@ -501,8 +506,8 @@ def _render_verifier_text( verifier: __.typx.Any, / ) -> str:
501
506
  pattern = getattr( verifier, 'pattern', None )
502
507
  if isinstance( pattern, str ): return pattern
503
508
  qualname = getattr( verifier, '__qualname__', None )
504
- if qualname is None: return '<anonymous>'
509
+ if not isinstance( qualname, str ): return '<anonymous>'
505
510
  module = getattr( verifier, '__module__', None )
506
- if module is None or '<locals>' in qualname:
511
+ if not isinstance( module, str ) or '<locals>' in qualname:
507
512
  return qualname
508
513
  return f"{module}.{qualname}"
@@ -29,6 +29,11 @@ concealment_label = 'concealment'
29
29
  immutability_label = 'immutability'
30
30
 
31
31
 
32
+ abc_class_mutables = __.abc_class_mutables
33
+ typing_class_mutables = __.typing_class_mutables
34
+ AttrnameCalculator = __.AttrnameCalculator
35
+
36
+
32
37
  BehaviorExclusionNames: __.typx.TypeAlias = __.cabc.Set[ str ]
33
38
  BehaviorExclusionNamesOmni: __.typx.TypeAlias = (
34
39
  BehaviorExclusionNames | __.typx.Literal[ '*' ] )
File without changes
File without changes
File without changes
File without changes