Coverage for sources/classcore/standard/__init__.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-09-25 13:22 +0000

1# vim: set filetype=python fileencoding=utf-8: 

2# -*- coding: utf-8 -*- 

3 

4#============================================================================# 

5# # 

6# Licensed under the Apache License, Version 2.0 (the "License"); # 

7# you may not use this file except in compliance with the License. # 

8# You may obtain a copy of the License at # 

9# # 

10# http://www.apache.org/licenses/LICENSE-2.0 # 

11# # 

12# Unless required by applicable law or agreed to in writing, software # 

13# distributed under the License is distributed on an "AS IS" BASIS, # 

14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 

15# See the License for the specific language governing permissions and # 

16# limitations under the License. # 

17# # 

18#============================================================================# 

19 

20 

21''' Decorators and class factories providing concealment and immutability. 

22 

23 Concealment restricts the visibility of attributes on classes and their 

24 instances. By default, only public attributes (ones which do not start with 

25 ``_``) are revealed for :py:func:`dir` calls. This behavior can be 

26 overriden by supplying visibility verifiers as a decorator factory 

27 argument or metaclass argument. These can be a sequence of attribute 

28 names, regular expression :py:class:`re.Pattern` objects which match 

29 attribute names, or predicate functions which match attribute names. Or, 

30 total visibility (per the Python default) can be achieved by supplying 

31 ``visibles = '*'`` instead of a sequence of verifiers. 

32 

33 Immutability prevents assignment (including reassignment) or deletion of 

34 attrubtes on classes and their instances after they have been completely 

35 initialized. In addition to any standard Python class, this can be applied 

36 to dataclasses, allowing them to use ``__post_init__`` to set attributes, 

37 which ``dataclasses.dataclass( frozen = True )`` prevents. The 

38 immutability behavior can be overridden by supplying mutability verifiers 

39 as a decorator factory argument or metaclass argument. These behave 

40 similarly to the visibility verifiers described above. 

41 

42 Hooks to modify the concealment and immutability behaviors are also 

43 available. 

44''' 

45 

46 

47from . import dynadoc 

48from . import nomina 

49 

50from .classes import * 

51from .decorators import * 

52from .modules import *