File: constants.py

package info (click to toggle)
dataclass-wizard 0.39.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,112 kB
  • sloc: python: 19,560; makefile: 126; javascript: 23
file content (60 lines) | stat: -rw-r--r-- 1,981 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import sys


# Package name
PACKAGE_NAME = 'dataclass_wizard'

# _SPECIALIZED_FROM_DICT = f'__{PACKAGE_NAME}_specialized_from_dict__'
# _SPECIALIZED_TO_DICT   = f'__{PACKAGE_NAME}_specialized_to_dict__'

# Library Log Level
LOG_LEVEL = os.getenv('WIZARD_LOG_LEVEL', 'ERROR').upper()

# Current system Python version
_PY_VERSION = sys.version_info[:2]

# Check if currently running Python 3.10 or higher
PY310_OR_ABOVE = _PY_VERSION >= (3, 10)

# Check if currently running Python 3.11 or higher
PY311_OR_ABOVE = _PY_VERSION >= (3, 11)

# Check if currently running Python 3.12 or higher
PY312_OR_ABOVE = _PY_VERSION >= (3, 12)

# Check if currently running Python 3.13 or higher
PY313_OR_ABOVE = _PY_VERSION >= (3, 13)

# Check if currently running Python 3.14 or higher
PY314_OR_ABOVE = _PY_VERSION >= (3, 14)

# The name of the dictionary object that contains `load` hooks for each
# object type. Also used to check if a class is a :class:`BaseLoadHook`
_LOAD_HOOKS = '__LOAD_HOOKS__'

# The name of the dictionary object that contains `dump` hooks for each
# object type. Also used to check if a class is a :class:`BaseDumpHook`
_DUMP_HOOKS = '__DUMP_HOOKS__'

# Attribute name that will be defined for single-arg alias functions and
# methods; mainly for internal use.
SINGLE_ARG_ALIAS = '__SINGLE_ARG_ALIAS__'

# Attribute name that will be defined for identity functions and methods;
# mainly for internal use.
IDENTITY = '__IDENTITY__'

# The dictionary key that identifies the tag field for a class. This is only
# set when the `tag` field or the `auto_assign_tags` flag is enabled in the
# `Meta` config for a dataclass.
#
# Note that this key can also be customized in the `Meta` config for a class,
# via the :attr:`tag_key` field.
TAG = '__tag__'


# INTERNAL USE ONLY: The dictionary key that the library
# sets/uses to identify a "catch all" field, which captures
# JSON key/values that don't map to any known dataclass fields.
CATCH_ALL = '<-|CatchAll|->'