Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/nameparser/config/__init__.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

7 statements  

1"""v1 import-path preservation (mechanisms.md#CONFIG-SHIM-SNAPSHOT): 

2the Constants shim 

3lives in nameparser._config_shim. 

4 

5Two unrelated things share this package. The names re-exported below -- 

6``Constants``, ``CONSTANTS``, ``SetManager``, ``TupleManager``, 

7``RegexTupleManager`` -- are v1 compatibility surface, and go with the 

8rest of the facade in 3.0. The vocabulary data modules beside them 

9(:mod:`~nameparser.config.titles`, :mod:`~nameparser.config.particles`, 

10...) are not compatibility surface at all: they are the word lists the 

112.0 :class:`~nameparser.Lexicon` is built from, they are named for its 

12fields since 2.2 (#293), and its documentation cross-references them. 

13 

14``RegexTupleManager`` is re-exported unchanged from the shim purely for 

15pickle compatibility: a v1.4 ``Constants`` blob's ``regexes`` field was 

16pickled as ``nameparser.config.RegexTupleManager(...)``, and unpickling 

17resolves and reconstructs that nested object before 

18``Constants.__setstate__`` ever runs. Without this name, loading such a 

19blob raises ``AttributeError`` looking up the class, not a clean 

20compatibility failure. 

21""" 

22# Maintainer note, deliberately outside the docstring: the docstring 

23# above no longer says "this package is deleted in 3.0". The 3.0 

24# removal schedule names "nameparser.config in its entirety" while 

25# actually enumerating only the five shim exports re-exported below; 

26# that gap is recorded in docs/design/decisions.md#3-0-reevaluations 

27# rather than left to a section number of an uncommitted document. 

28# Whether the DATA modules keep this package as their 

29# home in 3.0 or move under the core is an open decision, not something 

30# to settle in a published docstring -- and it now has a consequence, 

31# since Lexicon's public field docs cross-reference 

32# nameparser.config.particles et al. Resolve it when 3.0 is planned; 

33# until then this docstring claims only what is settled, which is that 

34# the re-exports below go. 

35from nameparser._config_shim import CONSTANTS as CONSTANTS 

36from nameparser._config_shim import Constants as Constants 

37from nameparser._config_shim import RegexTupleManager as RegexTupleManager 

38from nameparser._config_shim import SetManager as SetManager 

39from nameparser._config_shim import TupleManager as TupleManager 

40 

41__all__ = ["CONSTANTS", "Constants", "RegexTupleManager", "SetManager", "TupleManager"]