Coverage for sources/frigid/__/imports.py: 100%
15 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-05 02:47 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-05 02:47 +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
48ComparisonResult: typx.TypeAlias = bool | types.NotImplementedType
49DictionaryNominativeArgument: typx.TypeAlias = typx.Annotated[
50 V,
51 typx.Doc(
52 'Zero or more keyword arguments from which to initialize '
53 'dictionary data.' ),
54]
55DictionaryPositionalArgument: typx.TypeAlias = typx.Annotated[
56 cabc.Mapping[ H, V ] | cabc.Iterable[ tuple[ H, V ] ],
57 typx.Doc(
58 'Zero or more iterables from which to initialize dictionary data. '
59 'Each iterable must be dictionary or sequence of key-value pairs. '
60 'Duplicate keys will result in an error.' ),
61]
62DictionaryValidator: typx.TypeAlias = typx.Annotated[
63 cabc.Callable[ [ H, V ], bool ],
64 typx.Doc(
65 'Callable which validates entries before addition to dictionary.' ),
66]
67ModuleReclassifier: typx.TypeAlias = cabc.Callable[
68 [ cabc.Mapping[ str, typx.Any ] ], None ]