Coverage for sources/accretive/__/imports.py: 100%
17 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-01 20:09 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-01 20:09 +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''' Common imports and type aliases used throughout the package. '''
23# pylint: disable=unused-import
24# ruff: noqa: F401
27from __future__ import annotations
29import abc
30import collections.abc as cabc
31import dataclasses as dcls
32import types
34import typing_extensions as typx
35# --- BEGIN: Injected by Copier ---
37# --- END: Injected by Copier ---
40from absence import AbsentSingleton, Absential, absent, is_absent
43C = typx.TypeVar( 'C' ) # Class
44H = typx.TypeVar( 'H', bound = cabc.Hashable ) # Hash Key
45V = typx.TypeVar( 'V' ) # Value
48ClassDecorators: typx.TypeAlias = (
49 cabc.Iterable[ cabc.Callable[ [ type ], type ] ] )
50ComparisonResult: typx.TypeAlias = bool | types.NotImplementedType
51DictionaryNominativeArgument: typx.TypeAlias = typx.Annotated[
52 V,
53 typx.Doc(
54 'Zero or more keyword arguments from which to initialize '
55 'dictionary data.' ),
56]
57DictionaryPositionalArgument: typx.TypeAlias = typx.Annotated[
58 cabc.Mapping[ H, V ] | cabc.Iterable[ tuple[ H, V ] ],
59 typx.Doc(
60 'Zero or more iterables from which to initialize dictionary data. '
61 'Each iterable must be dictionary or sequence of key-value pairs. '
62 'Duplicate keys will result in an error.' ),
63]
64DictionaryProducer: typx.TypeAlias = typx.Annotated[
65 cabc.Callable[ [ ], V ],
66 typx.Doc(
67 'Callable which produces values for absent dictionary entries.' ),
68]
69DictionaryValidator: typx.TypeAlias = typx.Annotated[
70 cabc.Callable[ [ H, V ], bool ],
71 typx.Doc(
72 'Callable which validates entries before addition to dictionary.' ),
73]
74ModuleReclassifier: typx.TypeAlias = cabc.Callable[
75 [ cabc.Mapping[ str, typx.Any ] ], None ]