repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
Stewori/pytypes | pytypes/type_util.py | _deep_type | def _deep_type(obj, checked, checked_len, depth = None, max_sample = None, get_type = None):
"""checked_len allows to operate with a fake length for checked.
This is necessary to ensure that each depth level operates based
on the same checked list subset. Otherwise our recursion detection
mechanism can ... | python | def _deep_type(obj, checked, checked_len, depth = None, max_sample = None, get_type = None):
"""checked_len allows to operate with a fake length for checked.
This is necessary to ensure that each depth level operates based
on the same checked list subset. Otherwise our recursion detection
mechanism can ... | checked_len allows to operate with a fake length for checked.
This is necessary to ensure that each depth level operates based
on the same checked list subset. Otherwise our recursion detection
mechanism can fall into false-positives. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L408-L530 |
Stewori/pytypes | pytypes/type_util.py | is_builtin_type | def is_builtin_type(tp):
"""Checks if the given type is a builtin one.
"""
return hasattr(__builtins__, tp.__name__) and tp is getattr(__builtins__, tp.__name__) | python | def is_builtin_type(tp):
"""Checks if the given type is a builtin one.
"""
return hasattr(__builtins__, tp.__name__) and tp is getattr(__builtins__, tp.__name__) | Checks if the given type is a builtin one. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L533-L536 |
Stewori/pytypes | pytypes/type_util.py | _tp_relfq_name | def _tp_relfq_name(tp, tp_name=None, assumed_globals=None, update_assumed_globals=None,
implicit_globals=None):
# _type: (type, Optional[Union[Set[Union[type, types.ModuleType]], Mapping[Union[type, types.ModuleType], str]]], Optional[bool]) -> str
"""Provides the fully qualified name of a type rela... | python | def _tp_relfq_name(tp, tp_name=None, assumed_globals=None, update_assumed_globals=None,
implicit_globals=None):
# _type: (type, Optional[Union[Set[Union[type, types.ModuleType]], Mapping[Union[type, types.ModuleType], str]]], Optional[bool]) -> str
"""Provides the fully qualified name of a type rela... | Provides the fully qualified name of a type relative to a set of
modules and types that is assumed as globally available.
If assumed_globals is None this always returns the fully qualified name.
If update_assumed_globals is True, this will return the plain type name,
but will add the type to assumed_glo... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L583-L661 |
Stewori/pytypes | pytypes/type_util.py | type_str | def type_str(tp, assumed_globals=None, update_assumed_globals=None,
implicit_globals=None, bound_Generic=None, bound_typevars=None):
"""Generates a nicely readable string representation of the given type.
The returned representation is workable as a source code string and would
reconstruct the g... | python | def type_str(tp, assumed_globals=None, update_assumed_globals=None,
implicit_globals=None, bound_Generic=None, bound_typevars=None):
"""Generates a nicely readable string representation of the given type.
The returned representation is workable as a source code string and would
reconstruct the g... | Generates a nicely readable string representation of the given type.
The returned representation is workable as a source code string and would
reconstruct the given type if handed to eval, provided that globals/locals
are configured appropriately (e.g. assumes that various types from typing
have been im... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L664-L777 |
Stewori/pytypes | pytypes/type_util.py | get_types | def get_types(func):
"""Works like get_type_hints, but returns types as a sequence rather than a
dictionary. Types are returned in declaration order of the corresponding arguments.
"""
return _get_types(func, util.is_classmethod(func), util.is_method(func)) | python | def get_types(func):
"""Works like get_type_hints, but returns types as a sequence rather than a
dictionary. Types are returned in declaration order of the corresponding arguments.
"""
return _get_types(func, util.is_classmethod(func), util.is_method(func)) | Works like get_type_hints, but returns types as a sequence rather than a
dictionary. Types are returned in declaration order of the corresponding arguments. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L780-L784 |
Stewori/pytypes | pytypes/type_util.py | get_member_types | def get_member_types(obj, member_name, prop_getter = False):
"""Still experimental, incomplete and hardly tested.
Works like get_types, but is also applicable to descriptors.
"""
cls = obj.__class__
member = getattr(cls, member_name)
slf = not (isinstance(member, staticmethod) or isinstance(memb... | python | def get_member_types(obj, member_name, prop_getter = False):
"""Still experimental, incomplete and hardly tested.
Works like get_types, but is also applicable to descriptors.
"""
cls = obj.__class__
member = getattr(cls, member_name)
slf = not (isinstance(member, staticmethod) or isinstance(memb... | Still experimental, incomplete and hardly tested.
Works like get_types, but is also applicable to descriptors. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L787-L795 |
Stewori/pytypes | pytypes/type_util.py | _get_types | def _get_types(func, clsm, slf, clss = None, prop_getter = False,
unspecified_type = Any, infer_defaults = None):
"""Helper for get_types and get_member_types.
"""
func0 = util._actualfunc(func, prop_getter)
# check consistency regarding special case with 'self'-keyword
if not slf:
... | python | def _get_types(func, clsm, slf, clss = None, prop_getter = False,
unspecified_type = Any, infer_defaults = None):
"""Helper for get_types and get_member_types.
"""
func0 = util._actualfunc(func, prop_getter)
# check consistency regarding special case with 'self'-keyword
if not slf:
... | Helper for get_types and get_member_types. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L798-L820 |
Stewori/pytypes | pytypes/type_util.py | _get_type_hints | def _get_type_hints(func, args = None, res = None, infer_defaults = None):
"""Helper for get_type_hints.
"""
if args is None or res is None:
args2, res2 = _get_types(func, util.is_classmethod(func),
util.is_method(func), unspecified_type = type(NotImplemented),
infer_... | python | def _get_type_hints(func, args = None, res = None, infer_defaults = None):
"""Helper for get_type_hints.
"""
if args is None or res is None:
args2, res2 = _get_types(func, util.is_classmethod(func),
util.is_method(func), unspecified_type = type(NotImplemented),
infer_... | Helper for get_type_hints. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L836-L856 |
Stewori/pytypes | pytypes/type_util.py | resolve_fw_decl | def resolve_fw_decl(in_type, module_name=None, globs=None, level=0,
search_stack_depth=2):
'''Resolves forward references in ``in_type``, see
https://www.python.org/dev/peps/pep-0484/#forward-references.
Note:
``globs`` should be a dictionary containing values for the names
that must be r... | python | def resolve_fw_decl(in_type, module_name=None, globs=None, level=0,
search_stack_depth=2):
'''Resolves forward references in ``in_type``, see
https://www.python.org/dev/peps/pep-0484/#forward-references.
Note:
``globs`` should be a dictionary containing values for the names
that must be r... | Resolves forward references in ``in_type``, see
https://www.python.org/dev/peps/pep-0484/#forward-references.
Note:
``globs`` should be a dictionary containing values for the names
that must be resolved in ``in_type``. If ``globs`` is not provided, it
will be created by ``__globals__`` from the m... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L909-L962 |
Stewori/pytypes | pytypes/type_util.py | _issubclass_Mapping_covariant | def _issubclass_Mapping_covariant(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
This subclass-check treats Mapping-values as covariant.
"""
if is_Generic(subclass):
... | python | def _issubclass_Mapping_covariant(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
This subclass-check treats Mapping-values as covariant.
"""
if is_Generic(subclass):
... | Helper for _issubclass, a.k.a pytypes.issubtype.
This subclass-check treats Mapping-values as covariant. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1104-L1145 |
Stewori/pytypes | pytypes/type_util.py | _find_Generic_super_origin | def _find_Generic_super_origin(subclass, superclass_origin):
"""Helper for _issubclass_Generic.
"""
stack = [subclass]
param_map = {}
while len(stack) > 0:
bs = stack.pop()
if is_Generic(bs):
if not bs.__origin__ is None and len(bs.__origin__.__parameters__) > 0:
... | python | def _find_Generic_super_origin(subclass, superclass_origin):
"""Helper for _issubclass_Generic.
"""
stack = [subclass]
param_map = {}
while len(stack) > 0:
bs = stack.pop()
if is_Generic(bs):
if not bs.__origin__ is None and len(bs.__origin__.__parameters__) > 0:
... | Helper for _issubclass_Generic. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1148-L1179 |
Stewori/pytypes | pytypes/type_util.py | _select_Generic_superclass_parameters | def _select_Generic_superclass_parameters(subclass, superclass_origin):
"""Helper for _issubclass_Generic.
"""
subclass = _find_base_with_origin(subclass, superclass_origin)
if subclass is None:
return None
if subclass.__origin__ is superclass_origin:
return subclass.__args__
prm... | python | def _select_Generic_superclass_parameters(subclass, superclass_origin):
"""Helper for _issubclass_Generic.
"""
subclass = _find_base_with_origin(subclass, superclass_origin)
if subclass is None:
return None
if subclass.__origin__ is superclass_origin:
return subclass.__args__
prm... | Helper for _issubclass_Generic. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1204-L1226 |
Stewori/pytypes | pytypes/type_util.py | _issubclass_Generic | def _issubclass_Generic(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
# this function is partly based on code from typing module 3.5.2.2
if subclass is None:
re... | python | def _issubclass_Generic(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
# this function is partly based on code from typing module 3.5.2.2
if subclass is None:
re... | Helper for _issubclass, a.k.a pytypes.issubtype. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1274-L1422 |
Stewori/pytypes | pytypes/type_util.py | _issubclass_Tuple | def _issubclass_Tuple(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
# this function is partly based on code from typing module 3.5.2.2
if subclass in _extra_dict:
... | python | def _issubclass_Tuple(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
# this function is partly based on code from typing module 3.5.2.2
if subclass in _extra_dict:
... | Helper for _issubclass, a.k.a pytypes.issubtype. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1425-L1513 |
Stewori/pytypes | pytypes/type_util.py | _issubclass_Union | def _issubclass_Union(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
if not follow_fwd_refs:
return _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_... | python | def _issubclass_Union(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
if not follow_fwd_refs:
return _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_... | Helper for _issubclass, a.k.a pytypes.issubtype. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1516-L1529 |
Stewori/pytypes | pytypes/type_util.py | _issubclass_Union_rec | def _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass_Union.
"""
# this function is partly based on code from typing module 3.5.2.2
super_args = get_Union_params(superclass)
if... | python | def _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass_Union.
"""
# this function is partly based on code from typing module 3.5.2.2
super_args = get_Union_params(superclass)
if... | Helper for _issubclass_Union. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1532-L1558 |
Stewori/pytypes | pytypes/type_util.py | _has_base | def _has_base(cls, base):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
if cls is base:
return True
elif cls is None:
return False
try:
for bs in cls.__bases__:
if _has_base(bs, base):
return True
except:
pass
return False | python | def _has_base(cls, base):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
if cls is base:
return True
elif cls is None:
return False
try:
for bs in cls.__bases__:
if _has_base(bs, base):
return True
except:
pass
return False | Helper for _issubclass, a.k.a pytypes.issubtype. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1563-L1576 |
Stewori/pytypes | pytypes/type_util.py | _issubclass | def _issubclass(subclass, superclass, bound_Generic=None, bound_typevars=None,
bound_typevars_readonly=False, follow_fwd_refs=True, _recursion_check=None):
"""Access this via ``pytypes.is_subtype``.
Works like ``issubclass``, but supports PEP 484 style types from ``typing`` module.
subclass : t... | python | def _issubclass(subclass, superclass, bound_Generic=None, bound_typevars=None,
bound_typevars_readonly=False, follow_fwd_refs=True, _recursion_check=None):
"""Access this via ``pytypes.is_subtype``.
Works like ``issubclass``, but supports PEP 484 style types from ``typing`` module.
subclass : t... | Access this via ``pytypes.is_subtype``.
Works like ``issubclass``, but supports PEP 484 style types from ``typing`` module.
subclass : type
The type to check for being a subtype of ``superclass``.
superclass : type
The type to check for being a supertype of ``subclass``.
bound_Generic : Optio... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1579-L1775 |
Stewori/pytypes | pytypes/type_util.py | _issubclass_2 | def _issubclass_2(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
if is_Tuple(superclass):
return _issubclass_Tuple(subclass, superclass, bound_Generic, bound_typevar... | python | def _issubclass_2(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Helper for _issubclass, a.k.a pytypes.issubtype.
"""
if is_Tuple(superclass):
return _issubclass_Tuple(subclass, superclass, bound_Generic, bound_typevar... | Helper for _issubclass, a.k.a pytypes.issubtype. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1778-L1815 |
Stewori/pytypes | pytypes/type_util.py | _isinstance | def _isinstance(obj, cls, bound_Generic=None, bound_typevars=None,
bound_typevars_readonly=False, follow_fwd_refs=True, _recursion_check=None):
"""Access this via ``pytypes.is_of_type``.
Works like ``isinstance``, but supports PEP 484 style types from ``typing`` module.
obj : Any
The object... | python | def _isinstance(obj, cls, bound_Generic=None, bound_typevars=None,
bound_typevars_readonly=False, follow_fwd_refs=True, _recursion_check=None):
"""Access this via ``pytypes.is_of_type``.
Works like ``isinstance``, but supports PEP 484 style types from ``typing`` module.
obj : Any
The object... | Access this via ``pytypes.is_of_type``.
Works like ``isinstance``, but supports PEP 484 style types from ``typing`` module.
obj : Any
The object to check for being an instance of ``cls``.
cls : type
The type to check for ``obj`` being an instance of.
bound_Generic : Optional[Generic]
A ty... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1847-L1909 |
Stewori/pytypes | pytypes/type_util.py | generator_checker_py3 | def generator_checker_py3(gen, gen_type, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Builds a typechecking wrapper around a Python 3 style generator object.
"""
initialized = False
sn = None
try:
while True:
a = gen.s... | python | def generator_checker_py3(gen, gen_type, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Builds a typechecking wrapper around a Python 3 style generator object.
"""
initialized = False
sn = None
try:
while True:
a = gen.s... | Builds a typechecking wrapper around a Python 3 style generator object. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1919-L1962 |
Stewori/pytypes | pytypes/type_util.py | generator_checker_py2 | def generator_checker_py2(gen, gen_type, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Builds a typechecking wrapper around a Python 2 style generator object.
"""
initialized = False
sn = None
while True:
a = gen.send(sn)
i... | python | def generator_checker_py2(gen, gen_type, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
"""Builds a typechecking wrapper around a Python 2 style generator object.
"""
initialized = False
sn = None
while True:
a = gen.send(sn)
i... | Builds a typechecking wrapper around a Python 2 style generator object. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1965-L1991 |
Stewori/pytypes | pytypes/type_util.py | annotations_func | def annotations_func(func):
"""Works like annotations, but is only applicable to functions,
methods and properties.
"""
if not has_type_hints(func):
# What about defaults?
func.__annotations__ = {}
func.__annotations__ = _get_type_hints(func,
infer_defaults = False)
... | python | def annotations_func(func):
"""Works like annotations, but is only applicable to functions,
methods and properties.
"""
if not has_type_hints(func):
# What about defaults?
func.__annotations__ = {}
func.__annotations__ = _get_type_hints(func,
infer_defaults = False)
... | Works like annotations, but is only applicable to functions,
methods and properties. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2006-L2015 |
Stewori/pytypes | pytypes/type_util.py | annotations_class | def annotations_class(cls):
"""Works like annotations, but is only applicable to classes.
"""
assert(isclass(cls))
# To play it safe we avoid to modify the dict while iterating over it,
# so we previously cache keys.
# For this we don't use keys() because of Python 3.
# Todo: Better use insp... | python | def annotations_class(cls):
"""Works like annotations, but is only applicable to classes.
"""
assert(isclass(cls))
# To play it safe we avoid to modify the dict while iterating over it,
# so we previously cache keys.
# For this we don't use keys() because of Python 3.
# Todo: Better use insp... | Works like annotations, but is only applicable to classes. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2018-L2033 |
Stewori/pytypes | pytypes/type_util.py | annotations_module | def annotations_module(md):
"""Works like annotations, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules.
"""
if isinstance(md, str):
if md in sys.modules:
md = sys.modules[md]
if md is None:
... | python | def annotations_module(md):
"""Works like annotations, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules.
"""
if isinstance(md, str):
if md in sys.modules:
md = sys.modules[md]
if md is None:
... | Works like annotations, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2036-L2071 |
Stewori/pytypes | pytypes/type_util.py | annotations | def annotations(memb):
"""Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_annotations_decorator to apply this on all modules.
Methods with ty... | python | def annotations(memb):
"""Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_annotations_decorator to apply this on all modules.
Methods with ty... | Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_annotations_decorator to apply this on all modules.
Methods with type comment will have type hint... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2074-L2096 |
Stewori/pytypes | pytypes/type_util.py | simplify_for_Union | def simplify_for_Union(type_list):
"""Removes types that are subtypes of other elements in the list.
Does not return a copy, but instead modifies the given list.
Intended for preprocessing of types to be combined into a typing.Union.
Subtypecheck is backed by pytypes.is_subtype, so this differs from
... | python | def simplify_for_Union(type_list):
"""Removes types that are subtypes of other elements in the list.
Does not return a copy, but instead modifies the given list.
Intended for preprocessing of types to be combined into a typing.Union.
Subtypecheck is backed by pytypes.is_subtype, so this differs from
... | Removes types that are subtypes of other elements in the list.
Does not return a copy, but instead modifies the given list.
Intended for preprocessing of types to be combined into a typing.Union.
Subtypecheck is backed by pytypes.is_subtype, so this differs from
typing.Union's own simplification efforts... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2110-L2136 |
Stewori/pytypes | pytypes/type_util.py | _preprocess_typecheck | def _preprocess_typecheck(argSig, argspecs, slf_or_clsm = False):
"""From a PEP 484 style type-tuple with types for *varargs and/or **kw
this returns a type-tuple containing Tuple[tp, ...] and Dict[str, kw-tp]
instead.
"""
# todo: Maybe move also slf-logic here
vargs = argspecs.varargs
try:
... | python | def _preprocess_typecheck(argSig, argspecs, slf_or_clsm = False):
"""From a PEP 484 style type-tuple with types for *varargs and/or **kw
this returns a type-tuple containing Tuple[tp, ...] and Dict[str, kw-tp]
instead.
"""
# todo: Maybe move also slf-logic here
vargs = argspecs.varargs
try:
... | From a PEP 484 style type-tuple with types for *varargs and/or **kw
this returns a type-tuple containing Tuple[tp, ...] and Dict[str, kw-tp]
instead. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2139-L2188 |
Stewori/pytypes | pytypes/type_util.py | restore_profiler | def restore_profiler():
"""If a typechecking profiler is active, e.g. created by
pytypes.set_global_typechecked_profiler(), such a profiler
must be restored whenever a TypeCheckError is caught.
The call must stem from the thread that raised the error.
Otherwise the typechecking profiler is implicitl... | python | def restore_profiler():
"""If a typechecking profiler is active, e.g. created by
pytypes.set_global_typechecked_profiler(), such a profiler
must be restored whenever a TypeCheckError is caught.
The call must stem from the thread that raised the error.
Otherwise the typechecking profiler is implicitl... | If a typechecking profiler is active, e.g. created by
pytypes.set_global_typechecked_profiler(), such a profiler
must be restored whenever a TypeCheckError is caught.
The call must stem from the thread that raised the error.
Otherwise the typechecking profiler is implicitly disabled.
Alternatively o... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2313-L2330 |
Stewori/pytypes | pytypes/typelogger.py | log_type | def log_type(args_kw, ret, func, slf=False, prop_getter=False, clss=None, argspecs=None,
args_kw_type=None, ret_type = None):
"""Stores information of a function or method call into a cache, so pytypes can
create a PEP 484 stubfile from this information later on (see dump_cache).
"""
if args... | python | def log_type(args_kw, ret, func, slf=False, prop_getter=False, clss=None, argspecs=None,
args_kw_type=None, ret_type = None):
"""Stores information of a function or method call into a cache, so pytypes can
create a PEP 484 stubfile from this information later on (see dump_cache).
"""
if args... | Stores information of a function or method call into a cache, so pytypes can
create a PEP 484 stubfile from this information later on (see dump_cache). | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L67-L91 |
Stewori/pytypes | pytypes/typelogger.py | combine_argtype | def combine_argtype(observations):
"""Combines a list of Tuple types into one.
Basically these are combined element wise into a Union with some
additional unification effort (e.g. can apply PEP 484 style numeric tower).
"""
assert len(observations) > 0
assert is_Tuple(observations[0])
if len... | python | def combine_argtype(observations):
"""Combines a list of Tuple types into one.
Basically these are combined element wise into a Union with some
additional unification effort (e.g. can apply PEP 484 style numeric tower).
"""
assert len(observations) > 0
assert is_Tuple(observations[0])
if len... | Combines a list of Tuple types into one.
Basically these are combined element wise into a Union with some
additional unification effort (e.g. can apply PEP 484 style numeric tower). | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L143-L170 |
Stewori/pytypes | pytypes/typelogger.py | combine_type | def combine_type(observations):
"""Combines a list of types into one.
Basically these are combined into a Union with some
additional unification effort (e.g. can apply PEP 484 style numeric tower).
"""
assert len(observations) > 0
if len(observations) == 1:
return observations[0]
els... | python | def combine_type(observations):
"""Combines a list of types into one.
Basically these are combined into a Union with some
additional unification effort (e.g. can apply PEP 484 style numeric tower).
"""
assert len(observations) > 0
if len(observations) == 1:
return observations[0]
els... | Combines a list of types into one.
Basically these are combined into a Union with some
additional unification effort (e.g. can apply PEP 484 style numeric tower). | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L173-L184 |
Stewori/pytypes | pytypes/typelogger.py | dump_cache | def dump_cache(path=None, python2=False, suffix=None):
"""Writes cached observations by @typelogged into stubfiles.
Files will be created in the directory provided as 'path'; overwrites
existing files without notice.
Uses 'pyi2' suffix if 'python2' flag is given else 'pyi'. Resulting
files will be P... | python | def dump_cache(path=None, python2=False, suffix=None):
"""Writes cached observations by @typelogged into stubfiles.
Files will be created in the directory provided as 'path'; overwrites
existing files without notice.
Uses 'pyi2' suffix if 'python2' flag is given else 'pyi'. Resulting
files will be P... | Writes cached observations by @typelogged into stubfiles.
Files will be created in the directory provided as 'path'; overwrites
existing files without notice.
Uses 'pyi2' suffix if 'python2' flag is given else 'pyi'. Resulting
files will be Python 2.7 compilant accordingly. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L325-L350 |
Stewori/pytypes | pytypes/typelogger.py | get_indentation | def get_indentation(func):
"""Extracts a function's indentation as a string,
In contrast to an inspect.indentsize based implementation,
this function preserves tabs if present.
"""
src_lines = getsourcelines(func)[0]
for line in src_lines:
if not (line.startswith('@') or line.startswith(... | python | def get_indentation(func):
"""Extracts a function's indentation as a string,
In contrast to an inspect.indentsize based implementation,
this function preserves tabs if present.
"""
src_lines = getsourcelines(func)[0]
for line in src_lines:
if not (line.startswith('@') or line.startswith(... | Extracts a function's indentation as a string,
In contrast to an inspect.indentsize based implementation,
this function preserves tabs if present. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L498-L507 |
Stewori/pytypes | pytypes/typelogger.py | typelogged_func | def typelogged_func(func):
"""Works like typelogged, but is only applicable to functions,
methods and properties.
"""
if not pytypes.typelogging_enabled:
return func
if hasattr(func, 'do_logging'):
func.do_logging = True
return func
elif hasattr(func, 'do_typecheck'):
... | python | def typelogged_func(func):
"""Works like typelogged, but is only applicable to functions,
methods and properties.
"""
if not pytypes.typelogging_enabled:
return func
if hasattr(func, 'do_logging'):
func.do_logging = True
return func
elif hasattr(func, 'do_typecheck'):
... | Works like typelogged, but is only applicable to functions,
methods and properties. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L837-L850 |
Stewori/pytypes | pytypes/typelogger.py | typelogged_class | def typelogged_class(cls):
"""Works like typelogged, but is only applicable to classes.
"""
if not pytypes.typelogging_enabled:
return cls
assert(isclass(cls))
# To play it safe we avoid to modify the dict while iterating over it,
# so we previously cache keys.
# For this we don't us... | python | def typelogged_class(cls):
"""Works like typelogged, but is only applicable to classes.
"""
if not pytypes.typelogging_enabled:
return cls
assert(isclass(cls))
# To play it safe we avoid to modify the dict while iterating over it,
# so we previously cache keys.
# For this we don't us... | Works like typelogged, but is only applicable to classes. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L853-L870 |
Stewori/pytypes | pytypes/typelogger.py | typelogged_module | def typelogged_module(md):
"""Works like typelogged, but is only applicable to modules by explicit call).
md must be a module or a module name contained in sys.modules.
"""
if not pytypes.typelogging_enabled:
return md
if isinstance(md, str):
if md in sys.modules:
md = sy... | python | def typelogged_module(md):
"""Works like typelogged, but is only applicable to modules by explicit call).
md must be a module or a module name contained in sys.modules.
"""
if not pytypes.typelogging_enabled:
return md
if isinstance(md, str):
if md in sys.modules:
md = sy... | Works like typelogged, but is only applicable to modules by explicit call).
md must be a module or a module name contained in sys.modules. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L873-L911 |
Stewori/pytypes | pytypes/typelogger.py | typelogged | def typelogged(memb):
"""Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_typelogged_decorator to apply this on all modules.
Observes function... | python | def typelogged(memb):
"""Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_typelogged_decorator to apply this on all modules.
Observes function... | Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_typelogged_decorator to apply this on all modules.
Observes function and method calls at runtime ... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L914-L933 |
Stewori/pytypes | pytypes/__init__.py | enable_global_typechecked_decorator | def enable_global_typechecked_decorator(flag = True, retrospective = True):
"""Enables or disables global typechecking mode via decorators.
See flag global_typechecked_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will ... | python | def enable_global_typechecked_decorator(flag = True, retrospective = True):
"""Enables or disables global typechecking mode via decorators.
See flag global_typechecked_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will ... | Enables or disables global typechecking mode via decorators.
See flag global_typechecked_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will also
affect already imported modules, not only future imports.
Does not wor... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L390-L406 |
Stewori/pytypes | pytypes/__init__.py | enable_global_auto_override_decorator | def enable_global_auto_override_decorator(flag = True, retrospective = True):
"""Enables or disables global auto_override mode via decorators.
See flag global_auto_override_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this ... | python | def enable_global_auto_override_decorator(flag = True, retrospective = True):
"""Enables or disables global auto_override mode via decorators.
See flag global_auto_override_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this ... | Enables or disables global auto_override mode via decorators.
See flag global_auto_override_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will also
affect already imported modules, not only future imports. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L409-L422 |
Stewori/pytypes | pytypes/__init__.py | enable_global_annotations_decorator | def enable_global_annotations_decorator(flag = True, retrospective = True):
"""Enables or disables global annotation mode via decorators.
See flag global_annotations_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will al... | python | def enable_global_annotations_decorator(flag = True, retrospective = True):
"""Enables or disables global annotation mode via decorators.
See flag global_annotations_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will al... | Enables or disables global annotation mode via decorators.
See flag global_annotations_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will also
affect already imported modules, not only future imports. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L425-L438 |
Stewori/pytypes | pytypes/__init__.py | enable_global_typelogged_decorator | def enable_global_typelogged_decorator(flag = True, retrospective = True):
"""Enables or disables global typelog mode via decorators.
See flag global_typelogged_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will also
... | python | def enable_global_typelogged_decorator(flag = True, retrospective = True):
"""Enables or disables global typelog mode via decorators.
See flag global_typelogged_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will also
... | Enables or disables global typelog mode via decorators.
See flag global_typelogged_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will also
affect already imported modules, not only future imports. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L441-L454 |
Stewori/pytypes | pytypes/__init__.py | enable_global_typechecked_profiler | def enable_global_typechecked_profiler(flag = True):
"""Enables or disables global typechecking mode via a profiler.
See flag global_typechecked_profiler.
Does not work if checking_enabled is false.
"""
global global_typechecked_profiler, _global_type_agent, global_typelogged_profiler
global_typ... | python | def enable_global_typechecked_profiler(flag = True):
"""Enables or disables global typechecking mode via a profiler.
See flag global_typechecked_profiler.
Does not work if checking_enabled is false.
"""
global global_typechecked_profiler, _global_type_agent, global_typelogged_profiler
global_typ... | Enables or disables global typechecking mode via a profiler.
See flag global_typechecked_profiler.
Does not work if checking_enabled is false. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L457-L472 |
Stewori/pytypes | pytypes/__init__.py | enable_global_typelogged_profiler | def enable_global_typelogged_profiler(flag = True):
"""Enables or disables global typelogging mode via a profiler.
See flag global_typelogged_profiler.
Does not work if typelogging_enabled is false.
"""
global global_typelogged_profiler, _global_type_agent, global_typechecked_profiler
global_typ... | python | def enable_global_typelogged_profiler(flag = True):
"""Enables or disables global typelogging mode via a profiler.
See flag global_typelogged_profiler.
Does not work if typelogging_enabled is false.
"""
global global_typelogged_profiler, _global_type_agent, global_typechecked_profiler
global_typ... | Enables or disables global typelogging mode via a profiler.
See flag global_typelogged_profiler.
Does not work if typelogging_enabled is false. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L475-L490 |
Stewori/pytypes | pytypes/__init__.py | _detect_issue351 | def _detect_issue351():
"""Detect if github.com/python/typing/issues/351 applies
to the installed typing-version.
"""
class Tuple(typing.Generic[typing.T]):
pass
res = Tuple[str] == typing.Tuple[str]
del Tuple
return res | python | def _detect_issue351():
"""Detect if github.com/python/typing/issues/351 applies
to the installed typing-version.
"""
class Tuple(typing.Generic[typing.T]):
pass
res = Tuple[str] == typing.Tuple[str]
del Tuple
return res | Detect if github.com/python/typing/issues/351 applies
to the installed typing-version. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L508-L517 |
Stewori/pytypes | pytypes/typechecker.py | _preprocess_override | def _preprocess_override(meth_types, base_types, meth_argspec, base_argspec):
"""This function linearizes type info of ordinary, vararg, kwonly and varkw
arguments, such that override-feasibility can be conveniently checked.
"""
try:
base_kw = base_argspec.keywords
kw = meth_argspec.key... | python | def _preprocess_override(meth_types, base_types, meth_argspec, base_argspec):
"""This function linearizes type info of ordinary, vararg, kwonly and varkw
arguments, such that override-feasibility can be conveniently checked.
"""
try:
base_kw = base_argspec.keywords
kw = meth_argspec.key... | This function linearizes type info of ordinary, vararg, kwonly and varkw
arguments, such that override-feasibility can be conveniently checked. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L162-L236 |
Stewori/pytypes | pytypes/typechecker.py | override | def override(func, auto = False):
"""Decorator applicable to methods only.
For a version applicable also to classes or modules use auto_override.
Asserts that for the decorated method a parent method exists in its mro.
If both the decorated method and its parent method are type annotated,
the decora... | python | def override(func, auto = False):
"""Decorator applicable to methods only.
For a version applicable also to classes or modules use auto_override.
Asserts that for the decorated method a parent method exists in its mro.
If both the decorated method and its parent method are type annotated,
the decora... | Decorator applicable to methods only.
For a version applicable also to classes or modules use auto_override.
Asserts that for the decorated method a parent method exists in its mro.
If both the decorated method and its parent method are type annotated,
the decorator additionally asserts compatibility of... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L373-L549 |
Stewori/pytypes | pytypes/typechecker.py | typechecked_func | def typechecked_func(func, force = False, argType = None, resType = None, prop_getter = False):
"""Works like typechecked, but is only applicable to functions, methods and properties.
"""
if not pytypes.checking_enabled and not pytypes.do_logging_in_typechecked:
return func
assert(_check_as_func... | python | def typechecked_func(func, force = False, argType = None, resType = None, prop_getter = False):
"""Works like typechecked, but is only applicable to functions, methods and properties.
"""
if not pytypes.checking_enabled and not pytypes.do_logging_in_typechecked:
return func
assert(_check_as_func... | Works like typechecked, but is only applicable to functions, methods and properties. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L726-L741 |
Stewori/pytypes | pytypes/typechecker.py | typechecked_class | def typechecked_class(cls, force = False, force_recursive = False):
"""Works like typechecked, but is only applicable to classes.
"""
return _typechecked_class(cls, set(), force, force_recursive) | python | def typechecked_class(cls, force = False, force_recursive = False):
"""Works like typechecked, but is only applicable to classes.
"""
return _typechecked_class(cls, set(), force, force_recursive) | Works like typechecked, but is only applicable to classes. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L921-L924 |
Stewori/pytypes | pytypes/typechecker.py | typechecked_module | def typechecked_module(md, force_recursive = False):
"""Works like typechecked, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules.
"""
if not pytypes.checking_enabled:
return md
if isinstance(md, str):
if md in sys.mod... | python | def typechecked_module(md, force_recursive = False):
"""Works like typechecked, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules.
"""
if not pytypes.checking_enabled:
return md
if isinstance(md, str):
if md in sys.mod... | Works like typechecked, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L960-L999 |
Stewori/pytypes | pytypes/typechecker.py | typechecked | def typechecked(memb):
"""Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_typechecked_decorator to apply this on all modules.
Asserts compati... | python | def typechecked(memb):
"""Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_typechecked_decorator to apply this on all modules.
Asserts compati... | Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_typechecked_decorator to apply this on all modules.
Asserts compatibility of runtime argument and... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1002-L1022 |
Stewori/pytypes | pytypes/typechecker.py | auto_override_class | def auto_override_class(cls, force = False, force_recursive = False):
"""Works like auto_override, but is only applicable to classes.
"""
if not pytypes.checking_enabled:
return cls
assert(isclass(cls))
if not force and is_no_type_check(cls):
return cls
# To play it safe we avoid... | python | def auto_override_class(cls, force = False, force_recursive = False):
"""Works like auto_override, but is only applicable to classes.
"""
if not pytypes.checking_enabled:
return cls
assert(isclass(cls))
if not force and is_no_type_check(cls):
return cls
# To play it safe we avoid... | Works like auto_override, but is only applicable to classes. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1025-L1046 |
Stewori/pytypes | pytypes/typechecker.py | auto_override_module | def auto_override_module(md, force_recursive = False):
"""Works like auto_override, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules.
"""
if not pytypes.checking_enabled:
return md
if isinstance(md, str):
if md in sys... | python | def auto_override_module(md, force_recursive = False):
"""Works like auto_override, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules.
"""
if not pytypes.checking_enabled:
return md
if isinstance(md, str):
if md in sys... | Works like auto_override, but is only applicable to modules (by explicit call).
md must be a module or a module name contained in sys.modules. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1049-L1085 |
Stewori/pytypes | pytypes/typechecker.py | auto_override | def auto_override(memb):
"""Decorator applicable to methods, classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_auto_override_decorator to apply this on all modules.
Works like override decorator on type ... | python | def auto_override(memb):
"""Decorator applicable to methods, classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_auto_override_decorator to apply this on all modules.
Works like override decorator on type ... | Decorator applicable to methods, classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_auto_override_decorator to apply this on all modules.
Works like override decorator on type annotated methods that actually ... | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1088-L1110 |
Stewori/pytypes | pytypes/typechecker.py | no_type_check | def no_type_check(memb):
"""Works like typing.no_type_check, but also supports cases where
typing.no_type_check fails due to AttributeError. This can happen,
because typing.no_type_check wants to access __no_type_check__, which
might fail if e.g. a class is using slots or an object doesn't support
c... | python | def no_type_check(memb):
"""Works like typing.no_type_check, but also supports cases where
typing.no_type_check fails due to AttributeError. This can happen,
because typing.no_type_check wants to access __no_type_check__, which
might fail if e.g. a class is using slots or an object doesn't support
c... | Works like typing.no_type_check, but also supports cases where
typing.no_type_check fails due to AttributeError. This can happen,
because typing.no_type_check wants to access __no_type_check__, which
might fail if e.g. a class is using slots or an object doesn't support
custom attributes. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1142-L1153 |
Stewori/pytypes | pytypes/typechecker.py | is_no_type_check | def is_no_type_check(memb):
"""Checks if an object was annotated with @no_type_check
(from typing or pytypes.typechecker).
"""
try:
return hasattr(memb, '__no_type_check__') and memb.__no_type_check__ or \
memb in _not_type_checked
except TypeError:
return False | python | def is_no_type_check(memb):
"""Checks if an object was annotated with @no_type_check
(from typing or pytypes.typechecker).
"""
try:
return hasattr(memb, '__no_type_check__') and memb.__no_type_check__ or \
memb in _not_type_checked
except TypeError:
return False | Checks if an object was annotated with @no_type_check
(from typing or pytypes.typechecker). | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1156-L1164 |
Stewori/pytypes | pytypes/typechecker.py | check_argument_types | def check_argument_types(cllable = None, call_args = None, clss = None, caller_level = 0):
"""Can be called from within a function or method to apply typechecking to
the arguments that were passed in by the caller. Checking is applied w.r.t.
type hints of the function or method hosting the call to check_arg... | python | def check_argument_types(cllable = None, call_args = None, clss = None, caller_level = 0):
"""Can be called from within a function or method to apply typechecking to
the arguments that were passed in by the caller. Checking is applied w.r.t.
type hints of the function or method hosting the call to check_arg... | Can be called from within a function or method to apply typechecking to
the arguments that were passed in by the caller. Checking is applied w.r.t.
type hints of the function or method hosting the call to check_argument_types. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1167-L1172 |
Stewori/pytypes | pytypes/typechecker.py | check_return_type | def check_return_type(value, cllable = None, clss = None, caller_level = 0):
"""Can be called from within a function or method to apply typechecking to
the value that is going to be returned. Checking is applied w.r.t.
type hints of the function or method hosting the call to check_return_type.
"""
r... | python | def check_return_type(value, cllable = None, clss = None, caller_level = 0):
"""Can be called from within a function or method to apply typechecking to
the value that is going to be returned. Checking is applied w.r.t.
type hints of the function or method hosting the call to check_return_type.
"""
r... | Can be called from within a function or method to apply typechecking to
the value that is going to be returned. Checking is applied w.r.t.
type hints of the function or method hosting the call to check_return_type. | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1175-L1180 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_process_csv_import.py | BpmnDiagramGraphCSVImport.load_diagram_from_csv | def load_diagram_from_csv(filepath, bpmn_diagram):
"""
Reads an CSV file from given filepath and maps it into inner representation of BPMN diagram.
Returns an instance of BPMNDiagramGraph class.
:param filepath: string with output filepath,
:param bpmn_diagram: an instance of Bp... | python | def load_diagram_from_csv(filepath, bpmn_diagram):
"""
Reads an CSV file from given filepath and maps it into inner representation of BPMN diagram.
Returns an instance of BPMNDiagramGraph class.
:param filepath: string with output filepath,
:param bpmn_diagram: an instance of Bp... | Reads an CSV file from given filepath and maps it into inner representation of BPMN diagram.
Returns an instance of BPMNDiagramGraph class.
:param filepath: string with output filepath,
:param bpmn_diagram: an instance of BpmnDiagramGraph class. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_process_csv_import.py#L583-L603 |
KrzyHonk/bpmn-python | bpmn_python/graph/classes/gateways/gateway_type.py | Gateway.set_gateway_direction | def set_gateway_direction(self, value):
"""
Setter for 'gateway_direction' field.
:param value - a new value of 'gateway_direction' field.
"""
if value is None or not isinstance(value, str):
raise TypeError("GatewayDirection must be set to a String")
elif valu... | python | def set_gateway_direction(self, value):
"""
Setter for 'gateway_direction' field.
:param value - a new value of 'gateway_direction' field.
"""
if value is None or not isinstance(value, str):
raise TypeError("GatewayDirection must be set to a String")
elif valu... | Setter for 'gateway_direction' field.
:param value - a new value of 'gateway_direction' field. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/graph/classes/gateways/gateway_type.py#L28-L39 |
KrzyHonk/bpmn-python | bpmn_python/graph/classes/lane_set_type.py | LaneSet.set_name | def set_name(self, value):
"""
Setter for 'name' field.
:param value - a new value of 'name' field. Must be either None (name is optional according to BPMN 2.0 XML
Schema) or String.
"""
if value is None:
self.__name = value
elif not isinstance(value, ... | python | def set_name(self, value):
"""
Setter for 'name' field.
:param value - a new value of 'name' field. Must be either None (name is optional according to BPMN 2.0 XML
Schema) or String.
"""
if value is None:
self.__name = value
elif not isinstance(value, ... | Setter for 'name' field.
:param value - a new value of 'name' field. Must be either None (name is optional according to BPMN 2.0 XML
Schema) or String. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/graph/classes/lane_set_type.py#L32-L43 |
KrzyHonk/bpmn-python | bpmn_python/graph/classes/lane_set_type.py | LaneSet.set_lane_list | def set_lane_list(self, value):
"""
Setter for 'lane_list' field.
:param value - a new value of 'lane_list' field. Must be a list of Lane objects
"""
if value is None or not isinstance(value, list):
raise TypeError("LaneList new value must be a list")
else:
... | python | def set_lane_list(self, value):
"""
Setter for 'lane_list' field.
:param value - a new value of 'lane_list' field. Must be a list of Lane objects
"""
if value is None or not isinstance(value, list):
raise TypeError("LaneList new value must be a list")
else:
... | Setter for 'lane_list' field.
:param value - a new value of 'lane_list' field. Must be a list of Lane objects | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/graph/classes/lane_set_type.py#L52-L63 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.load_diagram_from_xml | def load_diagram_from_xml(filepath, bpmn_diagram):
"""
Reads an XML file from given filepath and maps it into inner representation of BPMN diagram.
Returns an instance of BPMNDiagramGraph class.
:param filepath: string with output filepath,
:param bpmn_diagram: an instance of Bp... | python | def load_diagram_from_xml(filepath, bpmn_diagram):
"""
Reads an XML file from given filepath and maps it into inner representation of BPMN diagram.
Returns an instance of BPMNDiagramGraph class.
:param filepath: string with output filepath,
:param bpmn_diagram: an instance of Bp... | Reads an XML file from given filepath and maps it into inner representation of BPMN diagram.
Returns an instance of BPMNDiagramGraph class.
:param filepath: string with output filepath,
:param bpmn_diagram: an instance of BpmnDiagramGraph class. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L21-L67 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_collaboration_element | def import_collaboration_element(diagram_graph, collaboration_element, collaboration_dict):
"""
Method that imports information from 'collaboration' element.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param collaboration_element: XML doument element,
... | python | def import_collaboration_element(diagram_graph, collaboration_element, collaboration_dict):
"""
Method that imports information from 'collaboration' element.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param collaboration_element: XML doument element,
... | Method that imports information from 'collaboration' element.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param collaboration_element: XML doument element,
:param collaboration_dict: dictionary, that consist all information imported from 'collaboration' element.
... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L70-L92 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_participant_element | def import_participant_element(diagram_graph, participants_dictionary, participant_element):
"""
Adds 'participant' element to the collaboration dictionary.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param participants_dictionary: dictionary with particip... | python | def import_participant_element(diagram_graph, participants_dictionary, participant_element):
"""
Adds 'participant' element to the collaboration dictionary.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param participants_dictionary: dictionary with particip... | Adds 'participant' element to the collaboration dictionary.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param participants_dictionary: dictionary with participant element attributes. Key is participant ID, value
is a dictionary of participant attributes,
... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L95-L111 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_diagram_and_plane_attributes | def import_diagram_and_plane_attributes(diagram_attributes, plane_attributes, diagram_element, plane_element):
"""
Adds attributes of BPMN diagram and plane elements to appropriate
fields diagram_attributes and plane_attributes.
Diagram inner representation contains following diagram ele... | python | def import_diagram_and_plane_attributes(diagram_attributes, plane_attributes, diagram_element, plane_element):
"""
Adds attributes of BPMN diagram and plane elements to appropriate
fields diagram_attributes and plane_attributes.
Diagram inner representation contains following diagram ele... | Adds attributes of BPMN diagram and plane elements to appropriate
fields diagram_attributes and plane_attributes.
Diagram inner representation contains following diagram element attributes:
- id - assumed to be required in XML file, even thought BPMN 2.0 schema doesn't say so,
- name - ... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L114-L138 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_process_elements | def import_process_elements(document, diagram_graph, sequence_flows, process_elements_dict, plane_element):
"""
Method for importing all 'process' elements in diagram.
:param document: XML document,
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param... | python | def import_process_elements(document, diagram_graph, sequence_flows, process_elements_dict, plane_element):
"""
Method for importing all 'process' elements in diagram.
:param document: XML document,
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param... | Method for importing all 'process' elements in diagram.
:param document: XML document,
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param sequence_flows: a list of sequence flows existing in diagram,
:param process_elements_dict: dictionary that holds attri... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L141-L175 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_lane_set_element | def import_lane_set_element(process_attributes, lane_set_element, plane_element):
"""
Method for importing 'laneSet' element from diagram file.
:param process_attributes: dictionary that holds attribute values of 'process' element, which is parent of
imported flow node,
:par... | python | def import_lane_set_element(process_attributes, lane_set_element, plane_element):
"""
Method for importing 'laneSet' element from diagram file.
:param process_attributes: dictionary that holds attribute values of 'process' element, which is parent of
imported flow node,
:par... | Method for importing 'laneSet' element from diagram file.
:param process_attributes: dictionary that holds attribute values of 'process' element, which is parent of
imported flow node,
:param lane_set_element: XML document element,
:param plane_element: object representing a BPMN XM... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L216-L237 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_child_lane_set_element | def import_child_lane_set_element(child_lane_set_element, plane_element):
"""
Method for importing 'childLaneSet' element from diagram file.
:param child_lane_set_element: XML document element,
:param plane_element: object representing a BPMN XML 'plane' element.
"""
lan... | python | def import_child_lane_set_element(child_lane_set_element, plane_element):
"""
Method for importing 'childLaneSet' element from diagram file.
:param child_lane_set_element: XML document element,
:param plane_element: object representing a BPMN XML 'plane' element.
"""
lan... | Method for importing 'childLaneSet' element from diagram file.
:param child_lane_set_element: XML document element,
:param plane_element: object representing a BPMN XML 'plane' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L240-L259 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_lane_element | def import_lane_element(lane_element, plane_element):
"""
Method for importing 'laneSet' element from diagram file.
:param lane_element: XML document element,
:param plane_element: object representing a BPMN XML 'plane' element.
"""
lane_id = lane_element.getAttribute(co... | python | def import_lane_element(lane_element, plane_element):
"""
Method for importing 'laneSet' element from diagram file.
:param lane_element: XML document element,
:param plane_element: object representing a BPMN XML 'plane' element.
"""
lane_id = lane_element.getAttribute(co... | Method for importing 'laneSet' element from diagram file.
:param lane_element: XML document element,
:param plane_element: object representing a BPMN XML 'plane' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L262-L297 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_process_element | def import_process_element(process_elements_dict, process_element):
"""
Adds attributes of BPMN process element to appropriate field process_attributes.
Diagram inner representation contains following process attributes:
- id - assumed to be required in XML file, even thought BPMN 2.0 s... | python | def import_process_element(process_elements_dict, process_element):
"""
Adds attributes of BPMN process element to appropriate field process_attributes.
Diagram inner representation contains following process attributes:
- id - assumed to be required in XML file, even thought BPMN 2.0 s... | Adds attributes of BPMN process element to appropriate field process_attributes.
Diagram inner representation contains following process attributes:
- id - assumed to be required in XML file, even thought BPMN 2.0 schema doesn't say so,
- isClosed - optional parameter, default value 'false',
... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L300-L328 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_flow_node_to_graph | def import_flow_node_to_graph(bpmn_graph, process_id, process_attributes, flow_node_element):
"""
Adds a new node to graph.
Input parameter is object of class xml.dom.Element.
Nodes are identified by ID attribute of Element.
Method adds basic attributes (shared by all BPMN elemen... | python | def import_flow_node_to_graph(bpmn_graph, process_id, process_attributes, flow_node_element):
"""
Adds a new node to graph.
Input parameter is object of class xml.dom.Element.
Nodes are identified by ID attribute of Element.
Method adds basic attributes (shared by all BPMN elemen... | Adds a new node to graph.
Input parameter is object of class xml.dom.Element.
Nodes are identified by ID attribute of Element.
Method adds basic attributes (shared by all BPMN elements) to node. Those elements are:
- id - added as key value, we assume that this is a required value,
... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L331-L378 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_task_to_graph | def import_task_to_graph(diagram_graph, process_id, process_attributes, task_element):
"""
Adds to graph the new element that represents BPMN task.
In our representation tasks have only basic attributes and elements, inherited from Activity type,
so this method only needs to call add_flo... | python | def import_task_to_graph(diagram_graph, process_id, process_attributes, task_element):
"""
Adds to graph the new element that represents BPMN task.
In our representation tasks have only basic attributes and elements, inherited from Activity type,
so this method only needs to call add_flo... | Adds to graph the new element that represents BPMN task.
In our representation tasks have only basic attributes and elements, inherited from Activity type,
so this method only needs to call add_flownode_to_graph.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L381-L393 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_subprocess_to_graph | def import_subprocess_to_graph(diagram_graph, sequence_flows, process_id, process_attributes, subprocess_element):
"""
Adds to graph the new element that represents BPMN subprocess.
In addition to attributes inherited from FlowNode type, SubProcess
has additional attribute tiggeredByEven... | python | def import_subprocess_to_graph(diagram_graph, sequence_flows, process_id, process_attributes, subprocess_element):
"""
Adds to graph the new element that represents BPMN subprocess.
In addition to attributes inherited from FlowNode type, SubProcess
has additional attribute tiggeredByEven... | Adds to graph the new element that represents BPMN subprocess.
In addition to attributes inherited from FlowNode type, SubProcess
has additional attribute tiggeredByEvent (boolean type, default value - false).
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:pa... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L396-L430 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_data_object_to_graph | def import_data_object_to_graph(diagram_graph, process_id, process_attributes, data_object_element):
"""
Adds to graph the new element that represents BPMN data object.
Data object inherits attributes from FlowNode. In addition, an attribute 'isCollection' is added to the node.
:param d... | python | def import_data_object_to_graph(diagram_graph, process_id, process_attributes, data_object_element):
"""
Adds to graph the new element that represents BPMN data object.
Data object inherits attributes from FlowNode. In addition, an attribute 'isCollection' is added to the node.
:param d... | Adds to graph the new element that represents BPMN data object.
Data object inherits attributes from FlowNode. In addition, an attribute 'isCollection' is added to the node.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param process_id: string object, representing ... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L433-L449 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_activity_to_graph | def import_activity_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Method that adds the new element that represents BPMN activity.
Should not be used directly, only as a part of method, that imports an element which extends Activity element
(task, subprocess etc.)
... | python | def import_activity_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Method that adds the new element that represents BPMN activity.
Should not be used directly, only as a part of method, that imports an element which extends Activity element
(task, subprocess etc.)
... | Method that adds the new element that represents BPMN activity.
Should not be used directly, only as a part of method, that imports an element which extends Activity element
(task, subprocess etc.)
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param process_... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L452-L468 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_gateway_to_graph | def import_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN gateway.
In addition to attributes inherited from FlowNode type, Gateway
has additional attribute gatewayDirection (simple type, default value - Uns... | python | def import_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN gateway.
In addition to attributes inherited from FlowNode type, Gateway
has additional attribute gatewayDirection (simple type, default value - Uns... | Adds to graph the new element that represents BPMN gateway.
In addition to attributes inherited from FlowNode type, Gateway
has additional attribute gatewayDirection (simple type, default value - Unspecified).
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:pa... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L471-L487 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_complex_gateway_to_graph | def import_complex_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN complex gateway.
In addition to attributes inherited from Gateway type, complex gateway
has additional attribute default flow (default value... | python | def import_complex_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN complex gateway.
In addition to attributes inherited from Gateway type, complex gateway
has additional attribute default flow (default value... | Adds to graph the new element that represents BPMN complex gateway.
In addition to attributes inherited from Gateway type, complex gateway
has additional attribute default flow (default value - none).
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param proce... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L490-L505 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_event_based_gateway_to_graph | def import_event_based_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN event based gateway.
In addition to attributes inherited from Gateway type, event based gateway has additional
attributes - instantiate ... | python | def import_event_based_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN event based gateway.
In addition to attributes inherited from Gateway type, event based gateway has additional
attributes - instantiate ... | Adds to graph the new element that represents BPMN event based gateway.
In addition to attributes inherited from Gateway type, event based gateway has additional
attributes - instantiate (boolean type, default value - false) and eventGatewayType
(custom type tEventBasedGatewayType, default value... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L510-L529 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_parallel_gateway_to_graph | def import_parallel_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN parallel gateway.
Parallel gateway doesn't have additional attributes. Separate method is used to improve code readability.
:param diagram... | python | def import_parallel_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN parallel gateway.
Parallel gateway doesn't have additional attributes. Separate method is used to improve code readability.
:param diagram... | Adds to graph the new element that represents BPMN parallel gateway.
Parallel gateway doesn't have additional attributes. Separate method is used to improve code readability.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param process_id: string object, representing... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L550-L561 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_event_definition_elements | def import_event_definition_elements(diagram_graph, element, event_definitions):
"""
Helper function, that adds event definition elements (defines special types of events) to corresponding events.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param element: ... | python | def import_event_definition_elements(diagram_graph, element, event_definitions):
"""
Helper function, that adds event definition elements (defines special types of events) to corresponding events.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param element: ... | Helper function, that adds event definition elements (defines special types of events) to corresponding events.
:param diagram_graph: NetworkX graph representing a BPMN process diagram,
:param element: object representing a BPMN XML event element,
:param event_definitions: list of event definit... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L564-L581 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_start_event_to_graph | def import_start_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN start event.
Start event inherits attribute parallelMultiple from CatchEvent type
and sequence of eventDefinitionRef from Event type.
Se... | python | def import_start_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN start event.
Start event inherits attribute parallelMultiple from CatchEvent type
and sequence of eventDefinitionRef from Event type.
Se... | Adds to graph the new element that represents BPMN start event.
Start event inherits attribute parallelMultiple from CatchEvent type
and sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required since each of them has different variants
(Message, E... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L584-L608 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_intermediate_catch_event_to_graph | def import_intermediate_catch_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN intermediate catch event.
Intermediate catch event inherits attribute parallelMultiple from CatchEvent type
and sequence of eventDe... | python | def import_intermediate_catch_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN intermediate catch event.
Intermediate catch event inherits attribute parallelMultiple from CatchEvent type
and sequence of eventDe... | Adds to graph the new element that represents BPMN intermediate catch event.
Intermediate catch event inherits attribute parallelMultiple from CatchEvent type
and sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required since each of them has different va... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L611-L634 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_end_event_to_graph | def import_end_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN end event.
End event inherits sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required since each of them... | python | def import_end_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN end event.
End event inherits sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required since each of them... | Adds to graph the new element that represents BPMN end event.
End event inherits sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required since each of them has different variants
(Message, Error, Signal etc.).
:param diagram_graph: NetworkX grap... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L637-L653 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_intermediate_throw_event_to_graph | def import_intermediate_throw_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN intermediate throw event.
Intermediate throw event inherits sequence of eventDefinitionRef from Event type.
Separate methods for ea... | python | def import_intermediate_throw_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN intermediate throw event.
Intermediate throw event inherits sequence of eventDefinitionRef from Event type.
Separate methods for ea... | Adds to graph the new element that represents BPMN intermediate throw event.
Intermediate throw event inherits sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required since each of them has different variants
(Message, Error, Signal etc.).
:para... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L656-L673 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_boundary_event_to_graph | def import_boundary_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN boundary event.
Boundary event inherits sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required sin... | python | def import_boundary_event_to_graph(diagram_graph, process_id, process_attributes, element):
"""
Adds to graph the new element that represents BPMN boundary event.
Boundary event inherits sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required sin... | Adds to graph the new element that represents BPMN boundary event.
Boundary event inherits sequence of eventDefinitionRef from Event type.
Separate methods for each event type are required since each of them has different variants
(Message, Error, Signal etc.).
:param diagram_graph: Net... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L676-L704 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_sequence_flow_to_graph | def import_sequence_flow_to_graph(diagram_graph, sequence_flows, process_id, flow_element):
"""
Adds a new edge to graph and a record to sequence_flows dictionary.
Input parameter is object of class xml.dom.Element.
Edges are identified by pair of sourceRef and targetRef attributes of BP... | python | def import_sequence_flow_to_graph(diagram_graph, sequence_flows, process_id, flow_element):
"""
Adds a new edge to graph and a record to sequence_flows dictionary.
Input parameter is object of class xml.dom.Element.
Edges are identified by pair of sourceRef and targetRef attributes of BP... | Adds a new edge to graph and a record to sequence_flows dictionary.
Input parameter is object of class xml.dom.Element.
Edges are identified by pair of sourceRef and targetRef attributes of BPMNFlow element. We also
provide a dictionary, that maps sequenceFlow ID attribute with its sourceRef and... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L707-L762 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_message_flow_to_graph | def import_message_flow_to_graph(diagram_graph, message_flows, flow_element):
"""
Adds a new edge to graph and a record to message flows dictionary.
Input parameter is object of class xml.dom.Element.
Edges are identified by pair of sourceRef and targetRef attributes of BPMNFlow element.... | python | def import_message_flow_to_graph(diagram_graph, message_flows, flow_element):
"""
Adds a new edge to graph and a record to message flows dictionary.
Input parameter is object of class xml.dom.Element.
Edges are identified by pair of sourceRef and targetRef attributes of BPMNFlow element.... | Adds a new edge to graph and a record to message flows dictionary.
Input parameter is object of class xml.dom.Element.
Edges are identified by pair of sourceRef and targetRef attributes of BPMNFlow element. We also
provide a dictionary, that maps messageFlow ID attribute with its sourceRef and t... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L765-L810 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_shape_di | def import_shape_di(participants_dict, diagram_graph, shape_element):
"""
Adds Diagram Interchange information (information about rendering a diagram) to appropriate
BPMN diagram element in graph node.
We assume that those attributes are required for each BPMNShape:
- width - wi... | python | def import_shape_di(participants_dict, diagram_graph, shape_element):
"""
Adds Diagram Interchange information (information about rendering a diagram) to appropriate
BPMN diagram element in graph node.
We assume that those attributes are required for each BPMNShape:
- width - wi... | Adds Diagram Interchange information (information about rendering a diagram) to appropriate
BPMN diagram element in graph node.
We assume that those attributes are required for each BPMNShape:
- width - width of BPMNShape,
- height - height of BPMNShape,
- x - first coordinate o... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L813-L848 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_import.py | BpmnDiagramGraphImport.import_flow_di | def import_flow_di(diagram_graph, sequence_flows, message_flows, flow_element):
"""
Adds Diagram Interchange information (information about rendering a diagram) to appropriate
BPMN sequence flow represented as graph edge.
We assume that each BPMNEdge has a list of 'waypoint' elements. BP... | python | def import_flow_di(diagram_graph, sequence_flows, message_flows, flow_element):
"""
Adds Diagram Interchange information (information about rendering a diagram) to appropriate
BPMN sequence flow represented as graph edge.
We assume that each BPMNEdge has a list of 'waypoint' elements. BP... | Adds Diagram Interchange information (information about rendering a diagram) to appropriate
BPMN sequence flow represented as graph edge.
We assume that each BPMNEdge has a list of 'waypoint' elements. BPMN 2.0 XML Schema states,
that each BPMNEdge must have at least two waypoints.
:par... | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L851-L888 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_layouter.py | generate_layout | def generate_layout(bpmn_graph):
"""
:param bpmn_graph: an instance of BPMNDiagramGraph class.
"""
classification = generate_elements_clasification(bpmn_graph)
(sorted_nodes_with_classification, backward_flows) = topological_sort(bpmn_graph, classification[0])
grid = grid_layout(bpmn_graph, sort... | python | def generate_layout(bpmn_graph):
"""
:param bpmn_graph: an instance of BPMNDiagramGraph class.
"""
classification = generate_elements_clasification(bpmn_graph)
(sorted_nodes_with_classification, backward_flows) = topological_sort(bpmn_graph, classification[0])
grid = grid_layout(bpmn_graph, sort... | :param bpmn_graph: an instance of BPMNDiagramGraph class. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_layouter.py#L11-L19 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_layouter.py | generate_elements_clasification | def generate_elements_clasification(bpmn_graph):
"""
:param bpmn_graph:
:return:
"""
nodes_classification = []
node_param_name = "node"
flow_param_name = "flow"
classification_param_name = "classification"
classification_element = "Element"
classification_join = "Join"
class... | python | def generate_elements_clasification(bpmn_graph):
"""
:param bpmn_graph:
:return:
"""
nodes_classification = []
node_param_name = "node"
flow_param_name = "flow"
classification_param_name = "classification"
classification_element = "Element"
classification_join = "Join"
class... | :param bpmn_graph:
:return: | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_layouter.py#L22-L142 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_layouter.py | topological_sort | def topological_sort(bpmn_graph, nodes_with_classification):
"""
:return:
"""
node_param_name = "node"
classification_param_name = "classification"
tmp_nodes_with_classification = copy.deepcopy(nodes_with_classification)
sorted_nodes_with_classification = []
no_incoming_flow_nodes = []
... | python | def topological_sort(bpmn_graph, nodes_with_classification):
"""
:return:
"""
node_param_name = "node"
classification_param_name = "classification"
tmp_nodes_with_classification = copy.deepcopy(nodes_with_classification)
sorted_nodes_with_classification = []
no_incoming_flow_nodes = []
... | :return: | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_layouter.py#L145-L210 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_task_info | def export_task_info(node_params, output_element):
"""
Adds Task node attributes to exported XML element
:param node_params: dictionary with given task parameters,
:param output_element: object representing BPMN XML 'task' element.
"""
if consts.Consts.default in node_pa... | python | def export_task_info(node_params, output_element):
"""
Adds Task node attributes to exported XML element
:param node_params: dictionary with given task parameters,
:param output_element: object representing BPMN XML 'task' element.
"""
if consts.Consts.default in node_pa... | Adds Task node attributes to exported XML element
:param node_params: dictionary with given task parameters,
:param output_element: object representing BPMN XML 'task' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L26-L34 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_subprocess_info | def export_subprocess_info(bpmn_diagram, subprocess_params, output_element):
"""
Adds Subprocess node attributes to exported XML element
:param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,
:param subprocess_params: dictionary with given subprocess... | python | def export_subprocess_info(bpmn_diagram, subprocess_params, output_element):
"""
Adds Subprocess node attributes to exported XML element
:param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,
:param subprocess_params: dictionary with given subprocess... | Adds Subprocess node attributes to exported XML element
:param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,
:param subprocess_params: dictionary with given subprocess parameters,
:param output_element: object representing BPMN XML 'subprocess' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L37-L61 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_data_object_info | def export_data_object_info(bpmn_diagram, data_object_params, output_element):
"""
Adds DataObject node attributes to exported XML element
:param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,
:param data_object_params: dictionary with given subproc... | python | def export_data_object_info(bpmn_diagram, data_object_params, output_element):
"""
Adds DataObject node attributes to exported XML element
:param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,
:param data_object_params: dictionary with given subproc... | Adds DataObject node attributes to exported XML element
:param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,
:param data_object_params: dictionary with given subprocess parameters,
:param output_element: object representing BPMN XML 'subprocess' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L64-L72 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_complex_gateway_info | def export_complex_gateway_info(node_params, output_element):
"""
Adds ComplexGateway node attributes to exported XML element
:param node_params: dictionary with given complex gateway parameters,
:param output_element: object representing BPMN XML 'complexGateway' element.
"""
... | python | def export_complex_gateway_info(node_params, output_element):
"""
Adds ComplexGateway node attributes to exported XML element
:param node_params: dictionary with given complex gateway parameters,
:param output_element: object representing BPMN XML 'complexGateway' element.
"""
... | Adds ComplexGateway node attributes to exported XML element
:param node_params: dictionary with given complex gateway parameters,
:param output_element: object representing BPMN XML 'complexGateway' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L77-L86 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_event_based_gateway_info | def export_event_based_gateway_info(node_params, output_element):
"""
Adds EventBasedGateway node attributes to exported XML element
:param node_params: dictionary with given event based gateway parameters,
:param output_element: object representing BPMN XML 'eventBasedGateway' element.... | python | def export_event_based_gateway_info(node_params, output_element):
"""
Adds EventBasedGateway node attributes to exported XML element
:param node_params: dictionary with given event based gateway parameters,
:param output_element: object representing BPMN XML 'eventBasedGateway' element.... | Adds EventBasedGateway node attributes to exported XML element
:param node_params: dictionary with given event based gateway parameters,
:param output_element: object representing BPMN XML 'eventBasedGateway' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L89-L98 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_inclusive_exclusive_gateway_info | def export_inclusive_exclusive_gateway_info(node_params, output_element):
"""
Adds InclusiveGateway or ExclusiveGateway node attributes to exported XML element
:param node_params: dictionary with given inclusive or exclusive gateway parameters,
:param output_element: object representing... | python | def export_inclusive_exclusive_gateway_info(node_params, output_element):
"""
Adds InclusiveGateway or ExclusiveGateway node attributes to exported XML element
:param node_params: dictionary with given inclusive or exclusive gateway parameters,
:param output_element: object representing... | Adds InclusiveGateway or ExclusiveGateway node attributes to exported XML element
:param node_params: dictionary with given inclusive or exclusive gateway parameters,
:param output_element: object representing BPMN XML 'inclusiveGateway'/'exclusive' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L101-L110 |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_parallel_gateway_info | def export_parallel_gateway_info(node_params, output_element):
"""
Adds parallel gateway node attributes to exported XML element
:param node_params: dictionary with given parallel gateway parameters,
:param output_element: object representing BPMN XML 'parallelGateway' element.
... | python | def export_parallel_gateway_info(node_params, output_element):
"""
Adds parallel gateway node attributes to exported XML element
:param node_params: dictionary with given parallel gateway parameters,
:param output_element: object representing BPMN XML 'parallelGateway' element.
... | Adds parallel gateway node attributes to exported XML element
:param node_params: dictionary with given parallel gateway parameters,
:param output_element: object representing BPMN XML 'parallelGateway' element. | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L113-L120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.