Coverage for sources/classcore/standard/classes.py: 100%
27 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-29 22:58 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-29 22:58 +0000
1# vim: set filetype=python fileencoding=utf-8:
2# -*- coding: utf-8 -*-
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#============================================================================#
21''' Standard classes and class factories. '''
22# TODO? ClassMutable and ProtocolClassMutable
23# Need inheritance of omnimutability and omnivisibility.
26from __future__ import annotations
28from . import __
29from . import decorators as _decorators
32@_decorators.decoration_by( *_decorators.class_factory_decorators )
33class Class( type ): pass
36@_decorators.decoration_by( *_decorators.class_factory_decorators )
37@__.typx.dataclass_transform( frozen_default = True, kw_only_default = True )
38class Dataclass( type ): pass
41@_decorators.decoration_by( *_decorators.class_factory_decorators )
42@__.typx.dataclass_transform( kw_only_default = True )
43class DataclassMutable( type ): pass
46@_decorators.decoration_by( *_decorators.class_factory_decorators )
47class ProtocolClass( type( __.typx.Protocol ) ): pass
50@_decorators.decoration_by( *_decorators.class_factory_decorators )
51@__.typx.dataclass_transform( frozen_default = True, kw_only_default = True )
52class ProtocolDataclass( type( __.typx.Protocol ) ): pass
55@_decorators.decoration_by( *_decorators.class_factory_decorators )
56@__.typx.dataclass_transform( kw_only_default = True )
57class ProtocolDataclassMutable( type( __.typx.Protocol ) ): pass
60class Object( metaclass = Class ): pass
63class ObjectMutable( # pyright: ignore[reportGeneralTypeIssues]
64 metaclass = Class,
65 instances_mutables = '*', # pyright: ignore[reportCallIssue]
66): pass
69class DataclassObject( metaclass = Dataclass ): pass
72class DataclassObjectMutable( metaclass = DataclassMutable ): pass
75class Protocol( __.typx.Protocol, metaclass = ProtocolClass ): pass
78class ProtocolMutable( # pyright: ignore[reportGeneralTypeIssues]
79 __.typx.Protocol,
80 metaclass = ProtocolClass,
81 instances_mutables = '*', # pyright: ignore[reportCallIssue]
82): pass
85class DataclassProtocol(
86 __.typx.Protocol, metaclass = ProtocolDataclass,
87): pass
90class DataclassProtocolMutable(
91 __.typx.Protocol, metaclass = ProtocolDataclassMutable,
92): pass