gws.spec.core¶
Core data structures and constants for the specs.
Source code: gws.spec.core
Module Contents¶
- class gws.spec.core.c¶
Type kinds, the values of
Type.c.- ATOM = 'ATOM'¶
Atomic, one of the built-in types.
- CALLABLE = 'CALLABLE'¶
Callable, a callable argument.
- CLASS = 'CLASS'¶
Class, a user-defined type.
- COMMAND = 'COMMAND'¶
Command, a method decorated as
gws.ext.command.
- CONSTANT = 'CONSTANT'¶
Constant type.
- DICT = 'DICT'¶
Generic dictionary type.
- ENUM = 'ENUM'¶
Enum type.
- EXPR = 'EXPR'¶
Compile-time expression type.
- EXT = 'EXT'¶
Extension, a
gws.extalias.
- FUNCTION = 'FUNCTION'¶
Function, a callable type.
- LIST = 'LIST'¶
Generic list type.
- LITERAL = 'LITERAL'¶
Literal type.
- METHOD = 'METHOD'¶
Method, a callable type with a specific signature.
- MODULE = 'MODULE'¶
Module type.
- NONE = 'NONE'¶
None type.
- OPTIONAL = 'OPTIONAL'¶
Optional, a type that can be None.
- PROPERTY = 'PROPERTY'¶
Property, a type that is a property of a class.
- SET = 'SET'¶
Generic set type.
- TUPLE = 'TUPLE'¶
Generic tuple type.
- TYPE = 'TYPE'¶
Type alias.
- UNDEFINED = 'UNDEFINED'¶
Undefined, a type that is not defined.
- UNION = 'UNION'¶
Union, a type that can be one of several types.
- VARIANT = 'VARIANT'¶
Variant, a type that can be one of several types with a tag.
- class gws.spec.core.Chunk¶
Source code chunk, the core packages or a plugin with their source files.
- exception gws.spec.core.Error¶
Bases:
ExceptionBase class for spec errors.
- exception gws.spec.core.LoadError¶
Bases:
ErrorRaised when a class cannot be loaded from its module.
- gws.spec.core.make_type(args: dict)¶
Create a
Typeobject.- Parameters:
args – Attribute values for the type.
- Returns:
A new
Typeobject.
- exception gws.spec.core.ReadError¶
Bases:
ErrorRaised when a value does not match its spec type.
The arguments are the message and the offending value. With verbose errors, a
gws.ConfigErrorInfoobject is added as the third argument.
- class gws.spec.core.SpecData¶
Specs data, produced by the generator and loaded by the runtime.
- meta: dict¶
version,manifestPathandmanifest.- Type:
Build-time metadata
- class gws.spec.core.Type¶
Spec type record, describes a single type, property, method or module.
Which fields are populated depends on the type kind
c.- defaultExpression: Any = None¶
Unevaluated default of a property (a constant or enum reference), evaluated by the normalizer.
- enumDocs: dict¶
For
ENUMtypes, member docstrings keyed by member name.
- enumValues: dict¶
For
ENUMtypes, member values keyed by member name.
- ident: str = ''¶
Source code identifier (class, property or method name), used in the documentation.
- tProperties: dict[str, TypeUid]¶
For
CLASStypes, property type uids keyed by property name, including inherited properties.
- class gws.spec.core.v¶
Constants for the spec generator and runtime.
- APP_DIR = b'.'¶
- APP_NAME = 'gws'¶
Application package name.
- ATOMS = ['any', 'bool', 'bytes', 'float', 'int', 'str']¶
Names of atomic types.
- BUILTIN_TYPES = ['Any', 'Callable', 'ContextManager', 'Dict', 'Enum', 'Iterable', 'Iterator', 'List', 'Literal',...¶
Names from
typingand foreign modules that are treated as built-in.
- BUILTINS = ['any', 'bool', 'bytes', 'float', 'int', 'str', 'type', 'object', 'Exception', 'dict', 'list',...¶
Built-in names, registered as
ATOMtypes.
- CLIENT_NAME = 'gc'¶
Name of the client chunk.
- DEFAULT_EXT_SUPERS¶
Default base classes for synthesized ext config and props classes.
- DEFAULT_VARIANT_TAG = 'default'¶
Variant member used when the tag property is missing.
- EXCLUDE_PATHS = ['___', '/vendor/', 'test', 'core/ext', '__pycache__']¶
Path fragments of source files the generator skips.
- EXT_COMMAND_API_PREFIX = 'gws.ext.command.api.'¶
Prefix of API command names.
- EXT_COMMAND_CLI_PREFIX = 'gws.ext.command.cli.'¶
Prefix of CLI command names.
- EXT_COMMAND_GET_PREFIX = 'gws.ext.command.get.'¶
Prefix of web GET command names.
- EXT_COMMAND_PREFIX = 'gws.ext.command.'¶
Prefix of command names.
- EXT_CONFIG_CLASS = 'Config'¶
Default config class name in a
gws.ext.newdeclaration.
- EXT_CONFIG_PREFIX = 'gws.ext.config.'¶
Prefix of extension config names.
- EXT_DECL_PREFIX = 'gws.ext.new.'¶
Prefix of
gws.ext.newdeclarations in the sources.
- EXT_OBJECT_CLASS = 'Object'¶
Default object class name in a
gws.ext.newdeclaration.
- EXT_OBJECT_PREFIX = 'gws.ext.object.'¶
Prefix of extension object names.
- EXT_PREFIX = 'gws.ext'¶
Prefix of all extension names.
- EXT_PROPS_CLASS = 'Props'¶
Default props class name in a
gws.ext.newdeclaration.
- EXT_PROPS_PREFIX = 'gws.ext.props.'¶
Prefix of extension props names.
- FILE_KINDS = [['.py', 'python'], ['/index.ts', 'ts'], ['/index.tsx', 'ts'], ['/index.css.js', 'css'],...¶
Source file suffixes and the file kinds they map to.
- GLOBAL_MODULES¶
Modules whose names are available directly as
gws.<Name>.
- INLINE_COMMENT_SYMBOL = '#:'¶
- PLUGIN_DIR = '/gws/plugin'¶
Directory of the built-in plugins, relative to the app directory.
- PLUGIN_PREFIX = 'gws.plugin'¶
- SELF_DIR¶
- SYSTEM_CHUNKS¶
Names and source directories of the system chunks.
- VARIANT_TAG = 'type'¶
Name of the property that selects the member of a variant.