gws.spec.core

Source code: gws.spec.core

Module Contents

class gws.spec.core.c

Type kinds.

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.ext alias.

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.

bundleDir: str

Directory to save the compiled chunk bundle.

exclude: list[str]

List of patterns to exclude from the chunk.

name: str

Name of the chunk.

paths: dict[str, list[str]]

Source code paths.

sourceDir: str

Source directory of the chunk.

exception gws.spec.core.Error

Bases: Exception

Common base class for all non-exit exceptions.

exception gws.spec.core.GeneratorError

Bases: Error

Common base class for all non-exit exceptions.

exception gws.spec.core.LoadError

Bases: Error

Common base class for all non-exit exceptions.

gws.spec.core.make_type(args: dict)
exception gws.spec.core.ReadError

Bases: Error

Common base class for all non-exit exceptions.

class gws.spec.core.SpecData

Specs data structure.

chunks: list[Chunk]

List of chunks.

meta: dict

Meta data for the specs.

serverTypes: list[Type]

List of types used by the server (configuration types, request types and commands).

strings: dict

Documentation strings, translated to multiple languages.

class gws.spec.core.Type

Type data structure, repsents a GWS type.

c: TypeKind

Type class, one of the constants in c.

constValue: Any = None

Constant value for a constant type.

defaultExpression: Any = None

Default expression for a property.

defaultValue: Any = None

Default value for a property.

doc: str = ''

Documentation string for the type.

enumDocs: dict

Documentation strings for the enum values.

enumValues: dict

Enum values for the enum type.

extName: str = ''

Name of the extension that defines this, if any.

hasDefault: bool = False

True if the type has a default value.

ident: str = ''

Source code identifier for the, used in the documentation.

literalValues: list = []

Literal values for the c.LITERAL type.

modName: str = ''

Name of the module that defines this type.

modPath: str = ''

Path to the module that defines this type.

name: str = ''

Name of the type.

pos: str = ''

Source code position of the type definition.

tArg: TypeUid = ''

For c.METHOD types, type uid of its last argument.

tArgs: list[TypeUid] = []

For c.METHOD types, type uids of its arguments.

tItem: TypeUid = ''

For c.LIST, c.SET and c.DICT types, type uid of its item.

tItems: list[TypeUid] = []

For c.UNION or c.TUPLE types, type uids of its items.

tKey: TypeUid = ''

For c.DICT types, type uid of its key.

tMembers: dict[str, TypeUid]

For c.VARIANT types, type uids of its members.

tModule: TypeUid = ''

Type uid of the type’s module.

tOwner: TypeUid = ''

For c.PROPERTY types, type uid of the type that owns this property.

tProperties: dict[str, TypeUid]

For c.CLASS types, type uids of its properties.

tReturn: TypeUid = ''

For c.METHOD types, type uid of its return value.

tSupers: list[TypeUid] = []

For c.CLASS types, type uids of its super types.

tTarget: TypeUid = ''

For c.TYPE or c.EXT types, type uid of the target type.

tValue: TypeUid = ''

For c.PROPERTY types, type uid of the constant value.

uid: TypeUid

Type unique identifier, a string that identifies the type.

type gws.spec.core.TypeKind = str

Type kind, one of the constants in c.

type gws.spec.core.TypeUid = str

Type unique identifier, a string that identifies the type.

class gws.spec.core.v

Constants for the Specs generator.

APP_DIR = b'.'
APP_NAME = 'gws'
ATOMS = ['any', 'bool', 'bytes', 'float', 'int', 'str']
BUILTIN_TYPES = ['Any', 'Callable', 'ContextManager', 'Dict', 'Enum', 'Iterable', 'Iterator', 'List', 'Literal',...
BUILTINS = ['any', 'bool', 'bytes', 'float', 'int', 'str', 'type', 'object', 'Exception', 'dict', 'list',...
CLIENT_NAME = 'gc'
DEFAULT_EXT_SUPERS
DEFAULT_VARIANT_TAG = 'default'

Default variant tag.

EXCLUDE_PATHS = ['___', '/vendor/', 'test', 'core/ext', '__pycache__']
EXT_COMMAND_API_PREFIX = 'gws.ext.command.api.'
EXT_COMMAND_CLI_PREFIX = 'gws.ext.command.cli.'
EXT_COMMAND_GET_PREFIX = 'gws.ext.command.get.'
EXT_COMMAND_PREFIX = 'gws.ext.command.'
EXT_CONFIG_CLASS = 'Config'
EXT_CONFIG_PREFIX = 'gws.ext.config.'
EXT_DECL_PREFIX = 'gws.ext.new.'
EXT_OBJECT_CLASS = 'Object'
EXT_OBJECT_PREFIX = 'gws.ext.object.'
EXT_PREFIX = 'gws.ext'
EXT_PROPS_CLASS = 'Props'
EXT_PROPS_PREFIX = 'gws.ext.props.'
FILE_KINDS = [['.py', 'python'], ['/index.ts', 'ts'], ['/index.tsx', 'ts'], ['/index.css.js', 'css'],...
GLOBAL_MODULES
INLINE_COMMENT_SYMBOL = '#:'
PLUGIN_DIR = '/gws/plugin'
PLUGIN_PREFIX = 'gws.plugin'
SELF_DIR
SYSTEM_CHUNKS
VARIANT_TAG = 'type'

Tag property name for Variant types.