repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
last-partizan/pytils | pytils/numeral.py | _sum_string_fn | def _sum_string_fn(into, tmp_val, gender, items=None):
"""
Make in-words representation of single order
@param into: in-words representation of lower orders
@type into: C{unicode}
@param tmp_val: temporary value without lower orders
@type tmp_val: C{integer types}
@param gender: gender (M... | python | def _sum_string_fn(into, tmp_val, gender, items=None):
"""
Make in-words representation of single order
@param into: in-words representation of lower orders
@type into: C{unicode}
@param tmp_val: temporary value without lower orders
@type tmp_val: C{integer types}
@param gender: gender (M... | [
"def",
"_sum_string_fn",
"(",
"into",
",",
"tmp_val",
",",
"gender",
",",
"items",
"=",
"None",
")",
":",
"if",
"items",
"is",
"None",
":",
"items",
"=",
"(",
"u\"\"",
",",
"u\"\"",
",",
"u\"\"",
")",
"one_item",
",",
"two_items",
",",
"five_items",
... | Make in-words representation of single order
@param into: in-words representation of lower orders
@type into: C{unicode}
@param tmp_val: temporary value without lower orders
@type tmp_val: C{integer types}
@param gender: gender (MALE, FEMALE or NEUTER)
@type gender: C{int}
@param items: ... | [
"Make",
"in",
"-",
"words",
"representation",
"of",
"single",
"order"
] | 1c570a32b15e564bc68587b8207e32d464e61d08 | https://github.com/last-partizan/pytils/blob/1c570a32b15e564bc68587b8207e32d464e61d08/pytils/numeral.py#L388-L455 | train |
last-partizan/pytils | pytils/utils.py | check_length | def check_length(value, length):
"""
Checks length of value
@param value: value to check
@type value: C{str}
@param length: length checking for
@type length: C{int}
@return: None when check successful
@raise ValueError: check failed
"""
_length = len(value)
if _length != ... | python | def check_length(value, length):
"""
Checks length of value
@param value: value to check
@type value: C{str}
@param length: length checking for
@type length: C{int}
@return: None when check successful
@raise ValueError: check failed
"""
_length = len(value)
if _length != ... | [
"def",
"check_length",
"(",
"value",
",",
"length",
")",
":",
"_length",
"=",
"len",
"(",
"value",
")",
"if",
"_length",
"!=",
"length",
":",
"raise",
"ValueError",
"(",
"\"length must be %d, not %d\"",
"%",
"(",
"length",
",",
"_length",
")",
")"
] | Checks length of value
@param value: value to check
@type value: C{str}
@param length: length checking for
@type length: C{int}
@return: None when check successful
@raise ValueError: check failed | [
"Checks",
"length",
"of",
"value"
] | 1c570a32b15e564bc68587b8207e32d464e61d08 | https://github.com/last-partizan/pytils/blob/1c570a32b15e564bc68587b8207e32d464e61d08/pytils/utils.py#L10-L27 | train |
last-partizan/pytils | pytils/utils.py | check_positive | def check_positive(value, strict=False):
"""
Checks if variable is positive
@param value: value to check
@type value: C{integer types}, C{float} or C{Decimal}
@return: None when check successful
@raise ValueError: check failed
"""
if not strict and value < 0:
raise ValueError(... | python | def check_positive(value, strict=False):
"""
Checks if variable is positive
@param value: value to check
@type value: C{integer types}, C{float} or C{Decimal}
@return: None when check successful
@raise ValueError: check failed
"""
if not strict and value < 0:
raise ValueError(... | [
"def",
"check_positive",
"(",
"value",
",",
"strict",
"=",
"False",
")",
":",
"if",
"not",
"strict",
"and",
"value",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"Value must be positive or zero, not %s\"",
"%",
"str",
"(",
"value",
")",
")",
"if",
"strict",
... | Checks if variable is positive
@param value: value to check
@type value: C{integer types}, C{float} or C{Decimal}
@return: None when check successful
@raise ValueError: check failed | [
"Checks",
"if",
"variable",
"is",
"positive"
] | 1c570a32b15e564bc68587b8207e32d464e61d08 | https://github.com/last-partizan/pytils/blob/1c570a32b15e564bc68587b8207e32d464e61d08/pytils/utils.py#L30-L44 | train |
last-partizan/pytils | pytils/templatetags/pytils_translit.py | detranslify | def detranslify(text):
"""Detranslify russian text"""
try:
res = translit.detranslify(text)
except Exception as err:
# because filter must die silently
res = default_value % {'error': err, 'value': text}
return res | python | def detranslify(text):
"""Detranslify russian text"""
try:
res = translit.detranslify(text)
except Exception as err:
# because filter must die silently
res = default_value % {'error': err, 'value': text}
return res | [
"def",
"detranslify",
"(",
"text",
")",
":",
"try",
":",
"res",
"=",
"translit",
".",
"detranslify",
"(",
"text",
")",
"except",
"Exception",
"as",
"err",
":",
"res",
"=",
"default_value",
"%",
"{",
"'error'",
":",
"err",
",",
"'value'",
":",
"text",
... | Detranslify russian text | [
"Detranslify",
"russian",
"text"
] | 1c570a32b15e564bc68587b8207e32d464e61d08 | https://github.com/last-partizan/pytils/blob/1c570a32b15e564bc68587b8207e32d464e61d08/pytils/templatetags/pytils_translit.py#L36-L43 | train |
larsyencken/csvdiff | csvdiff/patch.py | apply | def apply(diff, recs, strict=True):
"""
Transform the records with the patch. May fail if the records do not
match those expected in the patch.
"""
index_columns = diff['_index']
indexed = records.index(copy.deepcopy(list(recs)), index_columns)
_add_records(indexed, diff['added'], index_colu... | python | def apply(diff, recs, strict=True):
"""
Transform the records with the patch. May fail if the records do not
match those expected in the patch.
"""
index_columns = diff['_index']
indexed = records.index(copy.deepcopy(list(recs)), index_columns)
_add_records(indexed, diff['added'], index_colu... | [
"def",
"apply",
"(",
"diff",
",",
"recs",
",",
"strict",
"=",
"True",
")",
":",
"index_columns",
"=",
"diff",
"[",
"'_index'",
"]",
"indexed",
"=",
"records",
".",
"index",
"(",
"copy",
".",
"deepcopy",
"(",
"list",
"(",
"recs",
")",
")",
",",
"ind... | Transform the records with the patch. May fail if the records do not
match those expected in the patch. | [
"Transform",
"the",
"records",
"with",
"the",
"patch",
".",
"May",
"fail",
"if",
"the",
"records",
"do",
"not",
"match",
"those",
"expected",
"in",
"the",
"patch",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/patch.py#L106-L116 | train |
larsyencken/csvdiff | csvdiff/patch.py | load | def load(istream, strict=True):
"Deserialize a patch object."
try:
diff = json.load(istream)
if strict:
jsonschema.validate(diff, SCHEMA)
except ValueError:
raise InvalidPatchError('patch is not valid JSON')
except jsonschema.exceptions.ValidationError as e:
... | python | def load(istream, strict=True):
"Deserialize a patch object."
try:
diff = json.load(istream)
if strict:
jsonschema.validate(diff, SCHEMA)
except ValueError:
raise InvalidPatchError('patch is not valid JSON')
except jsonschema.exceptions.ValidationError as e:
... | [
"def",
"load",
"(",
"istream",
",",
"strict",
"=",
"True",
")",
":",
"\"Deserialize a patch object.\"",
"try",
":",
"diff",
"=",
"json",
".",
"load",
"(",
"istream",
")",
"if",
"strict",
":",
"jsonschema",
".",
"validate",
"(",
"diff",
",",
"SCHEMA",
")"... | Deserialize a patch object. | [
"Deserialize",
"a",
"patch",
"object",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/patch.py#L175-L187 | train |
larsyencken/csvdiff | csvdiff/patch.py | save | def save(diff, stream=sys.stdout, compact=False):
"Serialize a patch object."
flags = {'sort_keys': True}
if not compact:
flags['indent'] = 2
json.dump(diff, stream, **flags) | python | def save(diff, stream=sys.stdout, compact=False):
"Serialize a patch object."
flags = {'sort_keys': True}
if not compact:
flags['indent'] = 2
json.dump(diff, stream, **flags) | [
"def",
"save",
"(",
"diff",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"compact",
"=",
"False",
")",
":",
"\"Serialize a patch object.\"",
"flags",
"=",
"{",
"'sort_keys'",
":",
"True",
"}",
"if",
"not",
"compact",
":",
"flags",
"[",
"'indent'",
"]",... | Serialize a patch object. | [
"Serialize",
"a",
"patch",
"object",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/patch.py#L190-L196 | train |
larsyencken/csvdiff | csvdiff/patch.py | create | def create(from_records, to_records, index_columns, ignore_columns=None):
"""
Diff two sets of records, using the index columns as the primary key for
both datasets.
"""
from_indexed = records.index(from_records, index_columns)
to_indexed = records.index(to_records, index_columns)
if ignore... | python | def create(from_records, to_records, index_columns, ignore_columns=None):
"""
Diff two sets of records, using the index columns as the primary key for
both datasets.
"""
from_indexed = records.index(from_records, index_columns)
to_indexed = records.index(to_records, index_columns)
if ignore... | [
"def",
"create",
"(",
"from_records",
",",
"to_records",
",",
"index_columns",
",",
"ignore_columns",
"=",
"None",
")",
":",
"from_indexed",
"=",
"records",
".",
"index",
"(",
"from_records",
",",
"index_columns",
")",
"to_indexed",
"=",
"records",
".",
"index... | Diff two sets of records, using the index columns as the primary key for
both datasets. | [
"Diff",
"two",
"sets",
"of",
"records",
"using",
"the",
"index",
"columns",
"as",
"the",
"primary",
"key",
"for",
"both",
"datasets",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/patch.py#L199-L211 | train |
larsyencken/csvdiff | csvdiff/patch.py | _compare_rows | def _compare_rows(from_recs, to_recs, keys):
"Return the set of keys which have changed."
return set(
k for k in keys
if sorted(from_recs[k].items()) != sorted(to_recs[k].items())
) | python | def _compare_rows(from_recs, to_recs, keys):
"Return the set of keys which have changed."
return set(
k for k in keys
if sorted(from_recs[k].items()) != sorted(to_recs[k].items())
) | [
"def",
"_compare_rows",
"(",
"from_recs",
",",
"to_recs",
",",
"keys",
")",
":",
"\"Return the set of keys which have changed.\"",
"return",
"set",
"(",
"k",
"for",
"k",
"in",
"keys",
"if",
"sorted",
"(",
"from_recs",
"[",
"k",
"]",
".",
"items",
"(",
")",
... | Return the set of keys which have changed. | [
"Return",
"the",
"set",
"of",
"keys",
"which",
"have",
"changed",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/patch.py#L236-L241 | train |
larsyencken/csvdiff | csvdiff/patch.py | record_diff | def record_diff(lhs, rhs):
"Diff an individual row."
delta = {}
for k in set(lhs).union(rhs):
from_ = lhs[k]
to_ = rhs[k]
if from_ != to_:
delta[k] = {'from': from_, 'to': to_}
return delta | python | def record_diff(lhs, rhs):
"Diff an individual row."
delta = {}
for k in set(lhs).union(rhs):
from_ = lhs[k]
to_ = rhs[k]
if from_ != to_:
delta[k] = {'from': from_, 'to': to_}
return delta | [
"def",
"record_diff",
"(",
"lhs",
",",
"rhs",
")",
":",
"\"Diff an individual row.\"",
"delta",
"=",
"{",
"}",
"for",
"k",
"in",
"set",
"(",
"lhs",
")",
".",
"union",
"(",
"rhs",
")",
":",
"from_",
"=",
"lhs",
"[",
"k",
"]",
"to_",
"=",
"rhs",
"[... | Diff an individual row. | [
"Diff",
"an",
"individual",
"row",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/patch.py#L260-L269 | train |
larsyencken/csvdiff | csvdiff/patch.py | filter_significance | def filter_significance(diff, significance):
"""
Prune any changes in the patch which are due to numeric changes less than this level of
significance.
"""
changed = diff['changed']
# remove individual field changes that are significant
reduced = [{'key': delta['key'],
'field... | python | def filter_significance(diff, significance):
"""
Prune any changes in the patch which are due to numeric changes less than this level of
significance.
"""
changed = diff['changed']
# remove individual field changes that are significant
reduced = [{'key': delta['key'],
'field... | [
"def",
"filter_significance",
"(",
"diff",
",",
"significance",
")",
":",
"changed",
"=",
"diff",
"[",
"'changed'",
"]",
"reduced",
"=",
"[",
"{",
"'key'",
":",
"delta",
"[",
"'key'",
"]",
",",
"'fields'",
":",
"{",
"k",
":",
"v",
"for",
"k",
",",
... | Prune any changes in the patch which are due to numeric changes less than this level of
significance. | [
"Prune",
"any",
"changes",
"in",
"the",
"patch",
"which",
"are",
"due",
"to",
"numeric",
"changes",
"less",
"than",
"this",
"level",
"of",
"significance",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/patch.py#L304-L323 | train |
larsyencken/csvdiff | csvdiff/patch.py | _is_significant | def _is_significant(change, significance):
"""
Return True if a change is genuinely significant given our tolerance.
"""
try:
a = float(change['from'])
b = float(change['to'])
except ValueError:
return True
return abs(a - b) > 10 ** (-significance) | python | def _is_significant(change, significance):
"""
Return True if a change is genuinely significant given our tolerance.
"""
try:
a = float(change['from'])
b = float(change['to'])
except ValueError:
return True
return abs(a - b) > 10 ** (-significance) | [
"def",
"_is_significant",
"(",
"change",
",",
"significance",
")",
":",
"try",
":",
"a",
"=",
"float",
"(",
"change",
"[",
"'from'",
"]",
")",
"b",
"=",
"float",
"(",
"change",
"[",
"'to'",
"]",
")",
"except",
"ValueError",
":",
"return",
"True",
"re... | Return True if a change is genuinely significant given our tolerance. | [
"Return",
"True",
"if",
"a",
"change",
"is",
"genuinely",
"significant",
"given",
"our",
"tolerance",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/patch.py#L326-L337 | train |
larsyencken/csvdiff | csvdiff/__init__.py | diff_files | def diff_files(from_file, to_file, index_columns, sep=',', ignored_columns=None):
"""
Diff two CSV files, returning the patch which transforms one into the
other.
"""
with open(from_file) as from_stream:
with open(to_file) as to_stream:
from_records = records.load(from_stream, se... | python | def diff_files(from_file, to_file, index_columns, sep=',', ignored_columns=None):
"""
Diff two CSV files, returning the patch which transforms one into the
other.
"""
with open(from_file) as from_stream:
with open(to_file) as to_stream:
from_records = records.load(from_stream, se... | [
"def",
"diff_files",
"(",
"from_file",
",",
"to_file",
",",
"index_columns",
",",
"sep",
"=",
"','",
",",
"ignored_columns",
"=",
"None",
")",
":",
"with",
"open",
"(",
"from_file",
")",
"as",
"from_stream",
":",
"with",
"open",
"(",
"to_file",
")",
"as"... | Diff two CSV files, returning the patch which transforms one into the
other. | [
"Diff",
"two",
"CSV",
"files",
"returning",
"the",
"patch",
"which",
"transforms",
"one",
"into",
"the",
"other",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/__init__.py#L28-L38 | train |
larsyencken/csvdiff | csvdiff/__init__.py | patch_file | def patch_file(patch_stream: TextIO, fromcsv_stream: TextIO, tocsv_stream: TextIO,
strict: bool = True, sep: str = ','):
"""
Apply the patch to the source CSV file, and save the result to the target
file.
"""
diff = patch.load(patch_stream)
from_records = records.load(fromcsv_str... | python | def patch_file(patch_stream: TextIO, fromcsv_stream: TextIO, tocsv_stream: TextIO,
strict: bool = True, sep: str = ','):
"""
Apply the patch to the source CSV file, and save the result to the target
file.
"""
diff = patch.load(patch_stream)
from_records = records.load(fromcsv_str... | [
"def",
"patch_file",
"(",
"patch_stream",
":",
"TextIO",
",",
"fromcsv_stream",
":",
"TextIO",
",",
"tocsv_stream",
":",
"TextIO",
",",
"strict",
":",
"bool",
"=",
"True",
",",
"sep",
":",
"str",
"=",
"','",
")",
":",
"diff",
"=",
"patch",
".",
"load",... | Apply the patch to the source CSV file, and save the result to the target
file. | [
"Apply",
"the",
"patch",
"to",
"the",
"source",
"CSV",
"file",
"and",
"save",
"the",
"result",
"to",
"the",
"target",
"file",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/__init__.py#L49-L70 | train |
larsyencken/csvdiff | csvdiff/__init__.py | patch_records | def patch_records(diff, from_records, strict=True):
"""
Apply the patch to the sequence of records, returning the transformed
records.
"""
return patch.apply(diff, from_records, strict=strict) | python | def patch_records(diff, from_records, strict=True):
"""
Apply the patch to the sequence of records, returning the transformed
records.
"""
return patch.apply(diff, from_records, strict=strict) | [
"def",
"patch_records",
"(",
"diff",
",",
"from_records",
",",
"strict",
"=",
"True",
")",
":",
"return",
"patch",
".",
"apply",
"(",
"diff",
",",
"from_records",
",",
"strict",
"=",
"strict",
")"
] | Apply the patch to the sequence of records, returning the transformed
records. | [
"Apply",
"the",
"patch",
"to",
"the",
"sequence",
"of",
"records",
"returning",
"the",
"transformed",
"records",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/__init__.py#L73-L78 | train |
larsyencken/csvdiff | csvdiff/__init__.py | _nice_fieldnames | def _nice_fieldnames(all_columns, index_columns):
"Indexes on the left, other fields in alphabetical order on the right."
non_index_columns = set(all_columns).difference(index_columns)
return index_columns + sorted(non_index_columns) | python | def _nice_fieldnames(all_columns, index_columns):
"Indexes on the left, other fields in alphabetical order on the right."
non_index_columns = set(all_columns).difference(index_columns)
return index_columns + sorted(non_index_columns) | [
"def",
"_nice_fieldnames",
"(",
"all_columns",
",",
"index_columns",
")",
":",
"\"Indexes on the left, other fields in alphabetical order on the right.\"",
"non_index_columns",
"=",
"set",
"(",
"all_columns",
")",
".",
"difference",
"(",
"index_columns",
")",
"return",
"ind... | Indexes on the left, other fields in alphabetical order on the right. | [
"Indexes",
"on",
"the",
"left",
"other",
"fields",
"in",
"alphabetical",
"order",
"on",
"the",
"right",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/__init__.py#L81-L84 | train |
larsyencken/csvdiff | csvdiff/__init__.py | csvdiff_cmd | def csvdiff_cmd(index_columns, from_csv, to_csv, style=None, output=None,
sep=',', quiet=False, ignore_columns=None, significance=None):
"""
Compare two csv files to see what rows differ between them. The files
are each expected to have a header row, and for each row to be uniquely
ident... | python | def csvdiff_cmd(index_columns, from_csv, to_csv, style=None, output=None,
sep=',', quiet=False, ignore_columns=None, significance=None):
"""
Compare two csv files to see what rows differ between them. The files
are each expected to have a header row, and for each row to be uniquely
ident... | [
"def",
"csvdiff_cmd",
"(",
"index_columns",
",",
"from_csv",
",",
"to_csv",
",",
"style",
"=",
"None",
",",
"output",
"=",
"None",
",",
"sep",
"=",
"','",
",",
"quiet",
"=",
"False",
",",
"ignore_columns",
"=",
"None",
",",
"significance",
"=",
"None",
... | Compare two csv files to see what rows differ between them. The files
are each expected to have a header row, and for each row to be uniquely
identified by one or more indexing columns. | [
"Compare",
"two",
"csv",
"files",
"to",
"see",
"what",
"rows",
"differ",
"between",
"them",
".",
"The",
"files",
"are",
"each",
"expected",
"to",
"have",
"a",
"header",
"row",
"and",
"for",
"each",
"row",
"to",
"be",
"uniquely",
"identified",
"by",
"one"... | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/__init__.py#L128-L160 | train |
larsyencken/csvdiff | csvdiff/__init__.py | _diff_and_summarize | def _diff_and_summarize(from_csv, to_csv, index_columns, stream=sys.stdout,
sep=',', ignored_columns=None, significance=None):
"""
Print a summary of the difference between the two files.
"""
from_records = list(records.load(from_csv, sep=sep))
to_records = records.load(to_cs... | python | def _diff_and_summarize(from_csv, to_csv, index_columns, stream=sys.stdout,
sep=',', ignored_columns=None, significance=None):
"""
Print a summary of the difference between the two files.
"""
from_records = list(records.load(from_csv, sep=sep))
to_records = records.load(to_cs... | [
"def",
"_diff_and_summarize",
"(",
"from_csv",
",",
"to_csv",
",",
"index_columns",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"sep",
"=",
"','",
",",
"ignored_columns",
"=",
"None",
",",
"significance",
"=",
"None",
")",
":",
"from_records",
"=",
"lis... | Print a summary of the difference between the two files. | [
"Print",
"a",
"summary",
"of",
"the",
"difference",
"between",
"the",
"two",
"files",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/__init__.py#L178-L194 | train |
larsyencken/csvdiff | csvdiff/__init__.py | csvpatch_cmd | def csvpatch_cmd(input_csv, input=None, output=None, strict=True):
"""
Apply the changes from a csvdiff patch to an existing CSV file.
"""
patch_stream = (sys.stdin
if input is None
else open(input))
tocsv_stream = (sys.stdout
if output is ... | python | def csvpatch_cmd(input_csv, input=None, output=None, strict=True):
"""
Apply the changes from a csvdiff patch to an existing CSV file.
"""
patch_stream = (sys.stdin
if input is None
else open(input))
tocsv_stream = (sys.stdout
if output is ... | [
"def",
"csvpatch_cmd",
"(",
"input_csv",
",",
"input",
"=",
"None",
",",
"output",
"=",
"None",
",",
"strict",
"=",
"True",
")",
":",
"patch_stream",
"=",
"(",
"sys",
".",
"stdin",
"if",
"input",
"is",
"None",
"else",
"open",
"(",
"input",
")",
")",
... | Apply the changes from a csvdiff patch to an existing CSV file. | [
"Apply",
"the",
"changes",
"from",
"a",
"csvdiff",
"patch",
"to",
"an",
"existing",
"CSV",
"file",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/__init__.py#L229-L250 | train |
larsyencken/csvdiff | csvdiff/records.py | sort | def sort(records: Sequence[Record]) -> List[Record]:
"Sort records into a canonical order, suitable for comparison."
return sorted(records, key=_record_key) | python | def sort(records: Sequence[Record]) -> List[Record]:
"Sort records into a canonical order, suitable for comparison."
return sorted(records, key=_record_key) | [
"def",
"sort",
"(",
"records",
":",
"Sequence",
"[",
"Record",
"]",
")",
"->",
"List",
"[",
"Record",
"]",
":",
"\"Sort records into a canonical order, suitable for comparison.\"",
"return",
"sorted",
"(",
"records",
",",
"key",
"=",
"_record_key",
")"
] | Sort records into a canonical order, suitable for comparison. | [
"Sort",
"records",
"into",
"a",
"canonical",
"order",
"suitable",
"for",
"comparison",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/records.py#L86-L88 | train |
larsyencken/csvdiff | csvdiff/records.py | _record_key | def _record_key(record: Record) -> List[Tuple[Column, str]]:
"An orderable representation of this record."
return sorted(record.items()) | python | def _record_key(record: Record) -> List[Tuple[Column, str]]:
"An orderable representation of this record."
return sorted(record.items()) | [
"def",
"_record_key",
"(",
"record",
":",
"Record",
")",
"->",
"List",
"[",
"Tuple",
"[",
"Column",
",",
"str",
"]",
"]",
":",
"\"An orderable representation of this record.\"",
"return",
"sorted",
"(",
"record",
".",
"items",
"(",
")",
")"
] | An orderable representation of this record. | [
"An",
"orderable",
"representation",
"of",
"this",
"record",
"."
] | 163dd9da676a8e5f926a935803726340261f03ae | https://github.com/larsyencken/csvdiff/blob/163dd9da676a8e5f926a935803726340261f03ae/csvdiff/records.py#L91-L93 | train |
Stewori/pytypes | pytypes/util.py | getargspecs | def getargspecs(func):
"""Bridges inspect.getargspec and inspect.getfullargspec.
Automatically selects the proper one depending of current Python version.
Automatically bypasses wrappers from typechecked- and override-decorators.
"""
if func is None:
raise TypeError('None is not a Python fun... | python | def getargspecs(func):
"""Bridges inspect.getargspec and inspect.getfullargspec.
Automatically selects the proper one depending of current Python version.
Automatically bypasses wrappers from typechecked- and override-decorators.
"""
if func is None:
raise TypeError('None is not a Python fun... | [
"def",
"getargspecs",
"(",
"func",
")",
":",
"if",
"func",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'None is not a Python function'",
")",
"if",
"hasattr",
"(",
"func",
",",
"'ch_func'",
")",
":",
"return",
"getargspecs",
"(",
"func",
".",
"ch_func",
... | Bridges inspect.getargspec and inspect.getfullargspec.
Automatically selects the proper one depending of current Python version.
Automatically bypasses wrappers from typechecked- and override-decorators. | [
"Bridges",
"inspect",
".",
"getargspec",
"and",
"inspect",
".",
"getfullargspec",
".",
"Automatically",
"selects",
"the",
"proper",
"one",
"depending",
"of",
"current",
"Python",
"version",
".",
"Automatically",
"bypasses",
"wrappers",
"from",
"typechecked",
"-",
... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L94-L108 | train |
Stewori/pytypes | pytypes/util.py | get_required_kwonly_args | def get_required_kwonly_args(argspecs):
"""Determines whether given argspecs implies required keywords-only args
and returns them as a list. Returns empty list if no such args exist.
"""
try:
kwonly = argspecs.kwonlyargs
if argspecs.kwonlydefaults is None:
return kwonly
... | python | def get_required_kwonly_args(argspecs):
"""Determines whether given argspecs implies required keywords-only args
and returns them as a list. Returns empty list if no such args exist.
"""
try:
kwonly = argspecs.kwonlyargs
if argspecs.kwonlydefaults is None:
return kwonly
... | [
"def",
"get_required_kwonly_args",
"(",
"argspecs",
")",
":",
"try",
":",
"kwonly",
"=",
"argspecs",
".",
"kwonlyargs",
"if",
"argspecs",
".",
"kwonlydefaults",
"is",
"None",
":",
"return",
"kwonly",
"res",
"=",
"[",
"]",
"for",
"name",
"in",
"kwonly",
":"... | Determines whether given argspecs implies required keywords-only args
and returns them as a list. Returns empty list if no such args exist. | [
"Determines",
"whether",
"given",
"argspecs",
"implies",
"required",
"keywords",
"-",
"only",
"args",
"and",
"returns",
"them",
"as",
"a",
"list",
".",
"Returns",
"empty",
"list",
"if",
"no",
"such",
"args",
"exist",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L111-L125 | train |
Stewori/pytypes | pytypes/util.py | getargnames | def getargnames(argspecs, with_unbox=False):
"""Resembles list of arg-names as would be seen in a function signature, including
var-args, var-keywords and keyword-only args.
"""
# todo: We can maybe make use of inspect.formatargspec
args = argspecs.args
vargs = argspecs.varargs
try:
... | python | def getargnames(argspecs, with_unbox=False):
"""Resembles list of arg-names as would be seen in a function signature, including
var-args, var-keywords and keyword-only args.
"""
# todo: We can maybe make use of inspect.formatargspec
args = argspecs.args
vargs = argspecs.varargs
try:
... | [
"def",
"getargnames",
"(",
"argspecs",
",",
"with_unbox",
"=",
"False",
")",
":",
"args",
"=",
"argspecs",
".",
"args",
"vargs",
"=",
"argspecs",
".",
"varargs",
"try",
":",
"kw",
"=",
"argspecs",
".",
"keywords",
"except",
"AttributeError",
":",
"kw",
"... | Resembles list of arg-names as would be seen in a function signature, including
var-args, var-keywords and keyword-only args. | [
"Resembles",
"list",
"of",
"arg",
"-",
"names",
"as",
"would",
"be",
"seen",
"in",
"a",
"function",
"signature",
"including",
"var",
"-",
"args",
"var",
"-",
"keywords",
"and",
"keyword",
"-",
"only",
"args",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L128-L152 | train |
Stewori/pytypes | pytypes/util.py | get_class_that_defined_method | def get_class_that_defined_method(meth):
"""Determines the class owning the given method.
"""
if is_classmethod(meth):
return meth.__self__
if hasattr(meth, 'im_class'):
return meth.im_class
elif hasattr(meth, '__qualname__'):
# Python 3
try:
cls_names = m... | python | def get_class_that_defined_method(meth):
"""Determines the class owning the given method.
"""
if is_classmethod(meth):
return meth.__self__
if hasattr(meth, 'im_class'):
return meth.im_class
elif hasattr(meth, '__qualname__'):
# Python 3
try:
cls_names = m... | [
"def",
"get_class_that_defined_method",
"(",
"meth",
")",
":",
"if",
"is_classmethod",
"(",
"meth",
")",
":",
"return",
"meth",
".",
"__self__",
"if",
"hasattr",
"(",
"meth",
",",
"'im_class'",
")",
":",
"return",
"meth",
".",
"im_class",
"elif",
"hasattr",
... | Determines the class owning the given method. | [
"Determines",
"the",
"class",
"owning",
"the",
"given",
"method",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L415-L437 | train |
Stewori/pytypes | pytypes/util.py | is_classmethod | def is_classmethod(meth):
"""Detects if the given callable is a classmethod.
"""
if inspect.ismethoddescriptor(meth):
return isinstance(meth, classmethod)
if not inspect.ismethod(meth):
return False
if not inspect.isclass(meth.__self__):
return False
if not hasattr(meth._... | python | def is_classmethod(meth):
"""Detects if the given callable is a classmethod.
"""
if inspect.ismethoddescriptor(meth):
return isinstance(meth, classmethod)
if not inspect.ismethod(meth):
return False
if not inspect.isclass(meth.__self__):
return False
if not hasattr(meth._... | [
"def",
"is_classmethod",
"(",
"meth",
")",
":",
"if",
"inspect",
".",
"ismethoddescriptor",
"(",
"meth",
")",
":",
"return",
"isinstance",
"(",
"meth",
",",
"classmethod",
")",
"if",
"not",
"inspect",
".",
"ismethod",
"(",
"meth",
")",
":",
"return",
"Fa... | Detects if the given callable is a classmethod. | [
"Detects",
"if",
"the",
"given",
"callable",
"is",
"a",
"classmethod",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L463-L474 | train |
Stewori/pytypes | pytypes/util.py | get_current_args | def get_current_args(caller_level = 0, func = None, argNames = None):
"""Determines the args of current function call.
Use caller_level > 0 to get args of even earlier function calls in current stack.
"""
if argNames is None:
argNames = getargnames(getargspecs(func))
if func is None:
... | python | def get_current_args(caller_level = 0, func = None, argNames = None):
"""Determines the args of current function call.
Use caller_level > 0 to get args of even earlier function calls in current stack.
"""
if argNames is None:
argNames = getargnames(getargspecs(func))
if func is None:
... | [
"def",
"get_current_args",
"(",
"caller_level",
"=",
"0",
",",
"func",
"=",
"None",
",",
"argNames",
"=",
"None",
")",
":",
"if",
"argNames",
"is",
"None",
":",
"argNames",
"=",
"getargnames",
"(",
"getargspecs",
"(",
"func",
")",
")",
"if",
"func",
"i... | Determines the args of current function call.
Use caller_level > 0 to get args of even earlier function calls in current stack. | [
"Determines",
"the",
"args",
"of",
"current",
"function",
"call",
".",
"Use",
"caller_level",
">",
"0",
"to",
"get",
"args",
"of",
"even",
"earlier",
"function",
"calls",
"in",
"current",
"stack",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L531-L543 | train |
Stewori/pytypes | pytypes/util.py | getmodule | def getmodule(code):
"""More robust variant of inspect.getmodule.
E.g. has less issues on Jython.
"""
try:
md = inspect.getmodule(code, code.co_filename)
except AttributeError:
return inspect.getmodule(code)
if md is None:
# Jython-specific:
# This is currently ju... | python | def getmodule(code):
"""More robust variant of inspect.getmodule.
E.g. has less issues on Jython.
"""
try:
md = inspect.getmodule(code, code.co_filename)
except AttributeError:
return inspect.getmodule(code)
if md is None:
# Jython-specific:
# This is currently ju... | [
"def",
"getmodule",
"(",
"code",
")",
":",
"try",
":",
"md",
"=",
"inspect",
".",
"getmodule",
"(",
"code",
",",
"code",
".",
"co_filename",
")",
"except",
"AttributeError",
":",
"return",
"inspect",
".",
"getmodule",
"(",
"code",
")",
"if",
"md",
"is"... | More robust variant of inspect.getmodule.
E.g. has less issues on Jython. | [
"More",
"robust",
"variant",
"of",
"inspect",
".",
"getmodule",
".",
"E",
".",
"g",
".",
"has",
"less",
"issues",
"on",
"Jython",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L551-L568 | train |
Stewori/pytypes | pytypes/util.py | _calc_traceback_limit | def _calc_traceback_limit(tb):
"""Calculates limit-parameter to strip away pytypes' internals when used
with API from traceback module.
"""
limit = 1
tb2 = tb
while not tb2.tb_next is None:
try:
maybe_pytypes = tb2.tb_next.tb_frame.f_code.co_filename.split(os.sep)[-2]
... | python | def _calc_traceback_limit(tb):
"""Calculates limit-parameter to strip away pytypes' internals when used
with API from traceback module.
"""
limit = 1
tb2 = tb
while not tb2.tb_next is None:
try:
maybe_pytypes = tb2.tb_next.tb_frame.f_code.co_filename.split(os.sep)[-2]
... | [
"def",
"_calc_traceback_limit",
"(",
"tb",
")",
":",
"limit",
"=",
"1",
"tb2",
"=",
"tb",
"while",
"not",
"tb2",
".",
"tb_next",
"is",
"None",
":",
"try",
":",
"maybe_pytypes",
"=",
"tb2",
".",
"tb_next",
".",
"tb_frame",
".",
"f_code",
".",
"co_filena... | Calculates limit-parameter to strip away pytypes' internals when used
with API from traceback module. | [
"Calculates",
"limit",
"-",
"parameter",
"to",
"strip",
"away",
"pytypes",
"internals",
"when",
"used",
"with",
"API",
"from",
"traceback",
"module",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L758-L775 | train |
Stewori/pytypes | pytypes/util.py | _pytypes_excepthook | def _pytypes_excepthook(exctype, value, tb):
""""An excepthook suitable for use as sys.excepthook, that strips away
the part of the traceback belonging to pytypes' internals.
Can be switched on and off via pytypes.clean_traceback
or pytypes.set_clean_traceback.
The latter automatically installs this... | python | def _pytypes_excepthook(exctype, value, tb):
""""An excepthook suitable for use as sys.excepthook, that strips away
the part of the traceback belonging to pytypes' internals.
Can be switched on and off via pytypes.clean_traceback
or pytypes.set_clean_traceback.
The latter automatically installs this... | [
"def",
"_pytypes_excepthook",
"(",
"exctype",
",",
"value",
",",
"tb",
")",
":",
"if",
"pytypes",
".",
"clean_traceback",
"and",
"issubclass",
"(",
"exctype",
",",
"TypeError",
")",
":",
"traceback",
".",
"print_exception",
"(",
"exctype",
",",
"value",
",",... | An excepthook suitable for use as sys.excepthook, that strips away
the part of the traceback belonging to pytypes' internals.
Can be switched on and off via pytypes.clean_traceback
or pytypes.set_clean_traceback.
The latter automatically installs this hook in sys.excepthook. | [
"An",
"excepthook",
"suitable",
"for",
"use",
"as",
"sys",
".",
"excepthook",
"that",
"strips",
"away",
"the",
"part",
"of",
"the",
"traceback",
"belonging",
"to",
"pytypes",
"internals",
".",
"Can",
"be",
"switched",
"on",
"and",
"off",
"via",
"pytypes",
... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L817-L830 | train |
Stewori/pytypes | pytypes/type_util.py | get_generator_type | def get_generator_type(genr):
"""Obtains PEP 484 style type of a generator object, i.e. returns a
typing.Generator object.
"""
if genr in _checked_generator_types:
return _checked_generator_types[genr]
if not genr.gi_frame is None and 'gen_type' in genr.gi_frame.f_locals:
return genr... | python | def get_generator_type(genr):
"""Obtains PEP 484 style type of a generator object, i.e. returns a
typing.Generator object.
"""
if genr in _checked_generator_types:
return _checked_generator_types[genr]
if not genr.gi_frame is None and 'gen_type' in genr.gi_frame.f_locals:
return genr... | [
"def",
"get_generator_type",
"(",
"genr",
")",
":",
"if",
"genr",
"in",
"_checked_generator_types",
":",
"return",
"_checked_generator_types",
"[",
"genr",
"]",
"if",
"not",
"genr",
".",
"gi_frame",
"is",
"None",
"and",
"'gen_type'",
"in",
"genr",
".",
"gi_fra... | Obtains PEP 484 style type of a generator object, i.e. returns a
typing.Generator object. | [
"Obtains",
"PEP",
"484",
"style",
"type",
"of",
"a",
"generator",
"object",
"i",
".",
"e",
".",
"returns",
"a",
"typing",
".",
"Generator",
"object",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L109-L122 | train |
Stewori/pytypes | pytypes/type_util.py | get_Generic_parameters | def get_Generic_parameters(tp, generic_supertype):
"""tp must be a subclass of generic_supertype.
Retrieves the type values from tp that correspond to parameters
defined by generic_supertype.
E.g. get_Generic_parameters(tp, typing.Mapping) is equivalent
to get_Mapping_key_value(tp) except for the e... | python | def get_Generic_parameters(tp, generic_supertype):
"""tp must be a subclass of generic_supertype.
Retrieves the type values from tp that correspond to parameters
defined by generic_supertype.
E.g. get_Generic_parameters(tp, typing.Mapping) is equivalent
to get_Mapping_key_value(tp) except for the e... | [
"def",
"get_Generic_parameters",
"(",
"tp",
",",
"generic_supertype",
")",
":",
"try",
":",
"res",
"=",
"_select_Generic_superclass_parameters",
"(",
"tp",
",",
"generic_supertype",
")",
"except",
"TypeError",
":",
"res",
"=",
"None",
"if",
"res",
"is",
"None",
... | tp must be a subclass of generic_supertype.
Retrieves the type values from tp that correspond to parameters
defined by generic_supertype.
E.g. get_Generic_parameters(tp, typing.Mapping) is equivalent
to get_Mapping_key_value(tp) except for the error message.
Note that get_Generic_itemtype(tp) is n... | [
"tp",
"must",
"be",
"a",
"subclass",
"of",
"generic_supertype",
".",
"Retrieves",
"the",
"type",
"values",
"from",
"tp",
"that",
"correspond",
"to",
"parameters",
"defined",
"by",
"generic_supertype",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L218-L238 | train |
Stewori/pytypes | pytypes/type_util.py | get_Tuple_params | def get_Tuple_params(tpl):
"""Python version independent function to obtain the parameters
of a typing.Tuple object.
Omits the ellipsis argument if present. Use is_Tuple_ellipsis for that.
Tested with CPython 2.7, 3.5, 3.6 and Jython 2.7.1.
"""
try:
return tpl.__tuple_params__
except... | python | def get_Tuple_params(tpl):
"""Python version independent function to obtain the parameters
of a typing.Tuple object.
Omits the ellipsis argument if present. Use is_Tuple_ellipsis for that.
Tested with CPython 2.7, 3.5, 3.6 and Jython 2.7.1.
"""
try:
return tpl.__tuple_params__
except... | [
"def",
"get_Tuple_params",
"(",
"tpl",
")",
":",
"try",
":",
"return",
"tpl",
".",
"__tuple_params__",
"except",
"AttributeError",
":",
"try",
":",
"if",
"tpl",
".",
"__args__",
"is",
"None",
":",
"return",
"None",
"if",
"tpl",
".",
"__args__",
"[",
"0",... | Python version independent function to obtain the parameters
of a typing.Tuple object.
Omits the ellipsis argument if present. Use is_Tuple_ellipsis for that.
Tested with CPython 2.7, 3.5, 3.6 and Jython 2.7.1. | [
"Python",
"version",
"independent",
"function",
"to",
"obtain",
"the",
"parameters",
"of",
"a",
"typing",
".",
"Tuple",
"object",
".",
"Omits",
"the",
"ellipsis",
"argument",
"if",
"present",
".",
"Use",
"is_Tuple_ellipsis",
"for",
"that",
".",
"Tested",
"with... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L241-L262 | train |
Stewori/pytypes | pytypes/type_util.py | is_Tuple_ellipsis | def is_Tuple_ellipsis(tpl):
"""Python version independent function to check if a typing.Tuple object
contains an ellipsis."""
try:
return tpl.__tuple_use_ellipsis__
except AttributeError:
try:
if tpl.__args__ is None:
return False
# Python 3.6
... | python | def is_Tuple_ellipsis(tpl):
"""Python version independent function to check if a typing.Tuple object
contains an ellipsis."""
try:
return tpl.__tuple_use_ellipsis__
except AttributeError:
try:
if tpl.__args__ is None:
return False
# Python 3.6
... | [
"def",
"is_Tuple_ellipsis",
"(",
"tpl",
")",
":",
"try",
":",
"return",
"tpl",
".",
"__tuple_use_ellipsis__",
"except",
"AttributeError",
":",
"try",
":",
"if",
"tpl",
".",
"__args__",
"is",
"None",
":",
"return",
"False",
"if",
"tpl",
".",
"__args__",
"["... | Python version independent function to check if a typing.Tuple object
contains an ellipsis. | [
"Python",
"version",
"independent",
"function",
"to",
"check",
"if",
"a",
"typing",
".",
"Tuple",
"object",
"contains",
"an",
"ellipsis",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L265-L279 | train |
Stewori/pytypes | pytypes/type_util.py | is_Union | def is_Union(tp):
"""Python version independent check if a type is typing.Union.
Tested with CPython 2.7, 3.5, 3.6 and Jython 2.7.1.
"""
if tp is Union:
return True
try:
# Python 3.6
return tp.__origin__ is Union
except AttributeError:
try:
return isin... | python | def is_Union(tp):
"""Python version independent check if a type is typing.Union.
Tested with CPython 2.7, 3.5, 3.6 and Jython 2.7.1.
"""
if tp is Union:
return True
try:
# Python 3.6
return tp.__origin__ is Union
except AttributeError:
try:
return isin... | [
"def",
"is_Union",
"(",
"tp",
")",
":",
"if",
"tp",
"is",
"Union",
":",
"return",
"True",
"try",
":",
"return",
"tp",
".",
"__origin__",
"is",
"Union",
"except",
"AttributeError",
":",
"try",
":",
"return",
"isinstance",
"(",
"tp",
",",
"typing",
".",
... | Python version independent check if a type is typing.Union.
Tested with CPython 2.7, 3.5, 3.6 and Jython 2.7.1. | [
"Python",
"version",
"independent",
"check",
"if",
"a",
"type",
"is",
"typing",
".",
"Union",
".",
"Tested",
"with",
"CPython",
"2",
".",
"7",
"3",
".",
"5",
"3",
".",
"6",
"and",
"Jython",
"2",
".",
"7",
".",
"1",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L336-L349 | train |
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__) | [
"def",
"is_builtin_type",
"(",
"tp",
")",
":",
"return",
"hasattr",
"(",
"__builtins__",
",",
"tp",
".",
"__name__",
")",
"and",
"tp",
"is",
"getattr",
"(",
"__builtins__",
",",
"tp",
".",
"__name__",
")"
] | Checks if the given type is a builtin one. | [
"Checks",
"if",
"the",
"given",
"type",
"is",
"a",
"builtin",
"one",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L533-L536 | train |
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)) | [
"def",
"get_types",
"(",
"func",
")",
":",
"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. | [
"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",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L780-L784 | train |
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... | [
"def",
"get_member_types",
"(",
"obj",
",",
"member_name",
",",
"prop_getter",
"=",
"False",
")",
":",
"cls",
"=",
"obj",
".",
"__class__",
"member",
"=",
"getattr",
"(",
"cls",
",",
"member_name",
")",
"slf",
"=",
"not",
"(",
"isinstance",
"(",
"member"... | Still experimental, incomplete and hardly tested.
Works like get_types, but is also applicable to descriptors. | [
"Still",
"experimental",
"incomplete",
"and",
"hardly",
"tested",
".",
"Works",
"like",
"get_types",
"but",
"is",
"also",
"applicable",
"to",
"descriptors",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L787-L795 | train |
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:
... | [
"def",
"_get_types",
"(",
"func",
",",
"clsm",
",",
"slf",
",",
"clss",
"=",
"None",
",",
"prop_getter",
"=",
"False",
",",
"unspecified_type",
"=",
"Any",
",",
"infer_defaults",
"=",
"None",
")",
":",
"func0",
"=",
"util",
".",
"_actualfunc",
"(",
"fu... | Helper for get_types and get_member_types. | [
"Helper",
"for",
"get_types",
"and",
"get_member_types",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L798-L820 | train |
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_... | [
"def",
"_get_type_hints",
"(",
"func",
",",
"args",
"=",
"None",
",",
"res",
"=",
"None",
",",
"infer_defaults",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
"or",
"res",
"is",
"None",
":",
"args2",
",",
"res2",
"=",
"_get_types",
"(",
"func",
... | Helper for get_type_hints. | [
"Helper",
"for",
"get_type_hints",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L836-L856 | train |
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):
... | [
"def",
"_issubclass_Mapping_covariant",
"(",
"subclass",
",",
"superclass",
",",
"bound_Generic",
",",
"bound_typevars",
",",
"bound_typevars_readonly",
",",
"follow_fwd_refs",
",",
"_recursion_check",
")",
":",
"if",
"is_Generic",
"(",
"subclass",
")",
":",
"if",
"... | Helper for _issubclass, a.k.a pytypes.issubtype.
This subclass-check treats Mapping-values as covariant. | [
"Helper",
"for",
"_issubclass",
"a",
".",
"k",
".",
"a",
"pytypes",
".",
"issubtype",
".",
"This",
"subclass",
"-",
"check",
"treats",
"Mapping",
"-",
"values",
"as",
"covariant",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1104-L1145 | train |
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... | [
"def",
"_issubclass_Union_rec",
"(",
"subclass",
",",
"superclass",
",",
"bound_Generic",
",",
"bound_typevars",
",",
"bound_typevars_readonly",
",",
"follow_fwd_refs",
",",
"_recursion_check",
")",
":",
"super_args",
"=",
"get_Union_params",
"(",
"superclass",
")",
"... | Helper for _issubclass_Union. | [
"Helper",
"for",
"_issubclass_Union",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1532-L1558 | train |
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... | [
"def",
"_isinstance",
"(",
"obj",
",",
"cls",
",",
"bound_Generic",
"=",
"None",
",",
"bound_typevars",
"=",
"None",
",",
"bound_typevars_readonly",
"=",
"False",
",",
"follow_fwd_refs",
"=",
"True",
",",
"_recursion_check",
"=",
"None",
")",
":",
"if",
"bou... | 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... | [
"Access",
"this",
"via",
"pytypes",
".",
"is_of_type",
".",
"Works",
"like",
"isinstance",
"but",
"supports",
"PEP",
"484",
"style",
"types",
"from",
"typing",
"module",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1847-L1909 | train |
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... | [
"def",
"generator_checker_py3",
"(",
"gen",
",",
"gen_type",
",",
"bound_Generic",
",",
"bound_typevars",
",",
"bound_typevars_readonly",
",",
"follow_fwd_refs",
",",
"_recursion_check",
")",
":",
"initialized",
"=",
"False",
"sn",
"=",
"None",
"try",
":",
"while"... | Builds a typechecking wrapper around a Python 3 style generator object. | [
"Builds",
"a",
"typechecking",
"wrapper",
"around",
"a",
"Python",
"3",
"style",
"generator",
"object",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1919-L1962 | train |
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... | [
"def",
"generator_checker_py2",
"(",
"gen",
",",
"gen_type",
",",
"bound_Generic",
",",
"bound_typevars",
",",
"bound_typevars_readonly",
",",
"follow_fwd_refs",
",",
"_recursion_check",
")",
":",
"initialized",
"=",
"False",
"sn",
"=",
"None",
"while",
"True",
":... | Builds a typechecking wrapper around a Python 2 style generator object. | [
"Builds",
"a",
"typechecking",
"wrapper",
"around",
"a",
"Python",
"2",
"style",
"generator",
"object",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1965-L1991 | train |
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)
... | [
"def",
"annotations_func",
"(",
"func",
")",
":",
"if",
"not",
"has_type_hints",
"(",
"func",
")",
":",
"func",
".",
"__annotations__",
"=",
"{",
"}",
"func",
".",
"__annotations__",
"=",
"_get_type_hints",
"(",
"func",
",",
"infer_defaults",
"=",
"False",
... | Works like annotations, but is only applicable to functions,
methods and properties. | [
"Works",
"like",
"annotations",
"but",
"is",
"only",
"applicable",
"to",
"functions",
"methods",
"and",
"properties",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2006-L2015 | train |
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... | [
"def",
"annotations_class",
"(",
"cls",
")",
":",
"assert",
"(",
"isclass",
"(",
"cls",
")",
")",
"keys",
"=",
"[",
"key",
"for",
"key",
"in",
"cls",
".",
"__dict__",
"]",
"for",
"key",
"in",
"keys",
":",
"memb",
"=",
"cls",
".",
"__dict__",
"[",
... | Works like annotations, but is only applicable to classes. | [
"Works",
"like",
"annotations",
"but",
"is",
"only",
"applicable",
"to",
"classes",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L2018-L2033 | train |
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... | [
"def",
"dump_cache",
"(",
"path",
"=",
"None",
",",
"python2",
"=",
"False",
",",
"suffix",
"=",
"None",
")",
":",
"typelogging_enabled_tmp",
"=",
"pytypes",
".",
"typelogging_enabled",
"pytypes",
".",
"typelogging_enabled",
"=",
"False",
"if",
"suffix",
"is",... | 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. | [
"Writes",
"cached",
"observations",
"by"
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L325-L350 | train |
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(... | [
"def",
"get_indentation",
"(",
"func",
")",
":",
"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. | [
"Extracts",
"a",
"function",
"s",
"indentation",
"as",
"a",
"string",
"In",
"contrast",
"to",
"an",
"inspect",
".",
"indentsize",
"based",
"implementation",
"this",
"function",
"preserves",
"tabs",
"if",
"present",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L498-L507 | train |
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'):
... | [
"def",
"typelogged_func",
"(",
"func",
")",
":",
"if",
"not",
"pytypes",
".",
"typelogging_enabled",
":",
"return",
"func",
"if",
"hasattr",
"(",
"func",
",",
"'do_logging'",
")",
":",
"func",
".",
"do_logging",
"=",
"True",
"return",
"func",
"elif",
"hasa... | Works like typelogged, but is only applicable to functions,
methods and properties. | [
"Works",
"like",
"typelogged",
"but",
"is",
"only",
"applicable",
"to",
"functions",
"methods",
"and",
"properties",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L837-L850 | train |
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... | [
"def",
"typelogged_class",
"(",
"cls",
")",
":",
"if",
"not",
"pytypes",
".",
"typelogging_enabled",
":",
"return",
"cls",
"assert",
"(",
"isclass",
"(",
"cls",
")",
")",
"keys",
"=",
"[",
"key",
"for",
"key",
"in",
"cls",
".",
"__dict__",
"]",
"for",
... | Works like typelogged, but is only applicable to classes. | [
"Works",
"like",
"typelogged",
"but",
"is",
"only",
"applicable",
"to",
"classes",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L853-L870 | train |
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... | [
"def",
"typelogged_module",
"(",
"md",
")",
":",
"if",
"not",
"pytypes",
".",
"typelogging_enabled",
":",
"return",
"md",
"if",
"isinstance",
"(",
"md",
",",
"str",
")",
":",
"if",
"md",
"in",
"sys",
".",
"modules",
":",
"md",
"=",
"sys",
".",
"modul... | 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. | [
"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",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typelogger.py#L873-L911 | train |
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 ... | [
"def",
"enable_global_typechecked_decorator",
"(",
"flag",
"=",
"True",
",",
"retrospective",
"=",
"True",
")",
":",
"global",
"global_typechecked_decorator",
"global_typechecked_decorator",
"=",
"flag",
"if",
"import_hook_enabled",
":",
"_install_import_hook",
"(",
")",
... | 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... | [
"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",... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L390-L406 | train |
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 ... | [
"def",
"enable_global_auto_override_decorator",
"(",
"flag",
"=",
"True",
",",
"retrospective",
"=",
"True",
")",
":",
"global",
"global_auto_override_decorator",
"global_auto_override_decorator",
"=",
"flag",
"if",
"import_hook_enabled",
":",
"_install_import_hook",
"(",
... | 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. | [
"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",
"optio... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L409-L422 | train |
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... | [
"def",
"enable_global_annotations_decorator",
"(",
"flag",
"=",
"True",
",",
"retrospective",
"=",
"True",
")",
":",
"global",
"global_annotations_decorator",
"global_annotations_decorator",
"=",
"flag",
"if",
"import_hook_enabled",
":",
"_install_import_hook",
"(",
")",
... | 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. | [
"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",
... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L425-L438 | train |
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
... | [
"def",
"enable_global_typelogged_decorator",
"(",
"flag",
"=",
"True",
",",
"retrospective",
"=",
"True",
")",
":",
"global",
"global_typelogged_decorator",
"global_typelogged_decorator",
"=",
"flag",
"if",
"import_hook_enabled",
":",
"_install_import_hook",
"(",
")",
"... | 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. | [
"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",
"."... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L441-L454 | train |
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... | [
"def",
"enable_global_typechecked_profiler",
"(",
"flag",
"=",
"True",
")",
":",
"global",
"global_typechecked_profiler",
",",
"_global_type_agent",
",",
"global_typelogged_profiler",
"global_typechecked_profiler",
"=",
"flag",
"if",
"flag",
"and",
"checking_enabled",
":",
... | Enables or disables global typechecking mode via a profiler.
See flag global_typechecked_profiler.
Does not work if checking_enabled is false. | [
"Enables",
"or",
"disables",
"global",
"typechecking",
"mode",
"via",
"a",
"profiler",
".",
"See",
"flag",
"global_typechecked_profiler",
".",
"Does",
"not",
"work",
"if",
"checking_enabled",
"is",
"false",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L457-L472 | train |
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... | [
"def",
"enable_global_typelogged_profiler",
"(",
"flag",
"=",
"True",
")",
":",
"global",
"global_typelogged_profiler",
",",
"_global_type_agent",
",",
"global_typechecked_profiler",
"global_typelogged_profiler",
"=",
"flag",
"if",
"flag",
"and",
"typelogging_enabled",
":",... | Enables or disables global typelogging mode via a profiler.
See flag global_typelogged_profiler.
Does not work if typelogging_enabled is false. | [
"Enables",
"or",
"disables",
"global",
"typelogging",
"mode",
"via",
"a",
"profiler",
".",
"See",
"flag",
"global_typelogged_profiler",
".",
"Does",
"not",
"work",
"if",
"typelogging_enabled",
"is",
"false",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/__init__.py#L475-L490 | train |
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... | [
"def",
"typechecked_func",
"(",
"func",
",",
"force",
"=",
"False",
",",
"argType",
"=",
"None",
",",
"resType",
"=",
"None",
",",
"prop_getter",
"=",
"False",
")",
":",
"if",
"not",
"pytypes",
".",
"checking_enabled",
"and",
"not",
"pytypes",
".",
"do_l... | Works like typechecked, but is only applicable to functions, methods and properties. | [
"Works",
"like",
"typechecked",
"but",
"is",
"only",
"applicable",
"to",
"functions",
"methods",
"and",
"properties",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L726-L741 | train |
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) | [
"def",
"typechecked_class",
"(",
"cls",
",",
"force",
"=",
"False",
",",
"force_recursive",
"=",
"False",
")",
":",
"return",
"_typechecked_class",
"(",
"cls",
",",
"set",
"(",
")",
",",
"force",
",",
"force_recursive",
")"
] | Works like typechecked, but is only applicable to classes. | [
"Works",
"like",
"typechecked",
"but",
"is",
"only",
"applicable",
"to",
"classes",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L921-L924 | train |
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... | [
"def",
"auto_override_class",
"(",
"cls",
",",
"force",
"=",
"False",
",",
"force_recursive",
"=",
"False",
")",
":",
"if",
"not",
"pytypes",
".",
"checking_enabled",
":",
"return",
"cls",
"assert",
"(",
"isclass",
"(",
"cls",
")",
")",
"if",
"not",
"for... | Works like auto_override, but is only applicable to classes. | [
"Works",
"like",
"auto_override",
"but",
"is",
"only",
"applicable",
"to",
"classes",
"."
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1025-L1046 | train |
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 | [
"def",
"is_no_type_check",
"(",
"memb",
")",
":",
"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). | [
"Checks",
"if",
"an",
"object",
"was",
"annotated",
"with"
] | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1156-L1164 | train |
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... | [
"def",
"check_argument_types",
"(",
"cllable",
"=",
"None",
",",
"call_args",
"=",
"None",
",",
"clss",
"=",
"None",
",",
"caller_level",
"=",
"0",
")",
":",
"return",
"_check_caller_type",
"(",
"False",
",",
"cllable",
",",
"call_args",
",",
"clss",
",",
... | 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. | [
"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",
".",
"t... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1167-L1172 | train |
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... | [
"def",
"check_return_type",
"(",
"value",
",",
"cllable",
"=",
"None",
",",
"clss",
"=",
"None",
",",
"caller_level",
"=",
"0",
")",
":",
"return",
"_check_caller_type",
"(",
"True",
",",
"cllable",
",",
"value",
",",
"clss",
",",
"caller_level",
"+",
"1... | 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. | [
"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... | b814d38709e84c0e0825caf8b721c20eb5a8ab3b | https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/typechecker.py#L1175-L1180 | train |
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... | [
"def",
"load_diagram_from_csv",
"(",
"filepath",
",",
"bpmn_diagram",
")",
":",
"sequence_flows",
"=",
"bpmn_diagram",
".",
"sequence_flows",
"process_elements_dict",
"=",
"bpmn_diagram",
".",
"process_elements",
"diagram_attributes",
"=",
"bpmn_diagram",
".",
"diagram_at... | 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. | [
"Reads",
"an",
"CSV",
"file",
"from",
"given",
"filepath",
"and",
"maps",
"it",
"into",
"inner",
"representation",
"of",
"BPMN",
"diagram",
".",
"Returns",
"an",
"instance",
"of",
"BPMNDiagramGraph",
"class",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_process_csv_import.py#L583-L603 | train |
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... | [
"def",
"load_diagram_from_xml",
"(",
"filepath",
",",
"bpmn_diagram",
")",
":",
"diagram_graph",
"=",
"bpmn_diagram",
".",
"diagram_graph",
"sequence_flows",
"=",
"bpmn_diagram",
".",
"sequence_flows",
"process_elements_dict",
"=",
"bpmn_diagram",
".",
"process_elements",... | 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. | [
"Reads",
"an",
"XML",
"file",
"from",
"given",
"filepath",
"and",
"maps",
"it",
"into",
"inner",
"representation",
"of",
"BPMN",
"diagram",
".",
"Returns",
"an",
"instance",
"of",
"BPMNDiagramGraph",
"class",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L21-L67 | train |
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,
... | [
"def",
"import_collaboration_element",
"(",
"diagram_graph",
",",
"collaboration_element",
",",
"collaboration_dict",
")",
":",
"collaboration_dict",
"[",
"consts",
".",
"Consts",
".",
"id",
"]",
"=",
"collaboration_element",
".",
"getAttribute",
"(",
"consts",
".",
... | 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.
... | [
"Method",
"that",
"imports",
"information",
"from",
"collaboration",
"element",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L70-L92 | train |
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... | [
"def",
"import_participant_element",
"(",
"diagram_graph",
",",
"participants_dictionary",
",",
"participant_element",
")",
":",
"participant_id",
"=",
"participant_element",
".",
"getAttribute",
"(",
"consts",
".",
"Consts",
".",
"id",
")",
"name",
"=",
"participant_... | 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,
... | [
"Adds",
"participant",
"element",
"to",
"the",
"collaboration",
"dictionary",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L95-L111 | train |
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... | [
"def",
"import_process_elements",
"(",
"document",
",",
"diagram_graph",
",",
"sequence_flows",
",",
"process_elements_dict",
",",
"plane_element",
")",
":",
"for",
"process_element",
"in",
"document",
".",
"getElementsByTagNameNS",
"(",
"\"*\"",
",",
"consts",
".",
... | 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... | [
"Method",
"for",
"importing",
"all",
"process",
"elements",
"in",
"diagram",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L141-L175 | train |
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... | [
"def",
"import_child_lane_set_element",
"(",
"child_lane_set_element",
",",
"plane_element",
")",
":",
"lane_set_id",
"=",
"child_lane_set_element",
".",
"getAttribute",
"(",
"consts",
".",
"Consts",
".",
"id",
")",
"lanes_attr",
"=",
"{",
"}",
"for",
"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. | [
"Method",
"for",
"importing",
"childLaneSet",
"element",
"from",
"diagram",
"file",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L240-L259 | train |
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... | [
"def",
"import_task_to_graph",
"(",
"diagram_graph",
",",
"process_id",
",",
"process_attributes",
",",
"task_element",
")",
":",
"BpmnDiagramGraphImport",
".",
"import_activity_to_graph",
"(",
"diagram_graph",
",",
"process_id",
",",
"process_attributes",
",",
"task_elem... | 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,
... | [
"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"... | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L381-L393 | train |
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... | [
"def",
"import_data_object_to_graph",
"(",
"diagram_graph",
",",
"process_id",
",",
"process_attributes",
",",
"data_object_element",
")",
":",
"BpmnDiagramGraphImport",
".",
"import_flow_node_to_graph",
"(",
"diagram_graph",
",",
"process_id",
",",
"process_attributes",
",... | 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 ... | [
"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",
... | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L433-L449 | train |
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... | [
"def",
"import_parallel_gateway_to_graph",
"(",
"diagram_graph",
",",
"process_id",
",",
"process_attributes",
",",
"element",
")",
":",
"BpmnDiagramGraphImport",
".",
"import_gateway_to_graph",
"(",
"diagram_graph",
",",
"process_id",
",",
"process_attributes",
",",
"ele... | 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... | [
"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",
... | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L550-L561 | train |
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... | [
"def",
"export_task_info",
"(",
"node_params",
",",
"output_element",
")",
":",
"if",
"consts",
".",
"Consts",
".",
"default",
"in",
"node_params",
"and",
"node_params",
"[",
"consts",
".",
"Consts",
".",
"default",
"]",
"is",
"not",
"None",
":",
"output_ele... | 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. | [
"Adds",
"Task",
"node",
"attributes",
"to",
"exported",
"XML",
"element"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L26-L34 | train |
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... | [
"def",
"export_subprocess_info",
"(",
"bpmn_diagram",
",",
"subprocess_params",
",",
"output_element",
")",
":",
"output_element",
".",
"set",
"(",
"consts",
".",
"Consts",
".",
"triggered_by_event",
",",
"subprocess_params",
"[",
"consts",
".",
"Consts",
".",
"tr... | 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. | [
"Adds",
"Subprocess",
"node",
"attributes",
"to",
"exported",
"XML",
"element"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L37-L61 | train |
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... | [
"def",
"export_data_object_info",
"(",
"bpmn_diagram",
",",
"data_object_params",
",",
"output_element",
")",
":",
"output_element",
".",
"set",
"(",
"consts",
".",
"Consts",
".",
"is_collection",
",",
"data_object_params",
"[",
"consts",
".",
"Consts",
".",
"is_c... | 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. | [
"Adds",
"DataObject",
"node",
"attributes",
"to",
"exported",
"XML",
"element"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L64-L72 | train |
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.
"""
... | [
"def",
"export_complex_gateway_info",
"(",
"node_params",
",",
"output_element",
")",
":",
"output_element",
".",
"set",
"(",
"consts",
".",
"Consts",
".",
"gateway_direction",
",",
"node_params",
"[",
"consts",
".",
"Consts",
".",
"gateway_direction",
"]",
")",
... | 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"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L77-L86 | train |
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.... | [
"def",
"export_event_based_gateway_info",
"(",
"node_params",
",",
"output_element",
")",
":",
"output_element",
".",
"set",
"(",
"consts",
".",
"Consts",
".",
"gateway_direction",
",",
"node_params",
"[",
"consts",
".",
"Consts",
".",
"gateway_direction",
"]",
")... | 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"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L89-L98 | train |
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... | [
"def",
"export_inclusive_exclusive_gateway_info",
"(",
"node_params",
",",
"output_element",
")",
":",
"output_element",
".",
"set",
"(",
"consts",
".",
"Consts",
".",
"gateway_direction",
",",
"node_params",
"[",
"consts",
".",
"Consts",
".",
"gateway_direction",
"... | 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. | [
"Adds",
"InclusiveGateway",
"or",
"ExclusiveGateway",
"node",
"attributes",
"to",
"exported",
"XML",
"element"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L101-L110 | train |
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.
... | [
"def",
"export_parallel_gateway_info",
"(",
"node_params",
",",
"output_element",
")",
":",
"output_element",
".",
"set",
"(",
"consts",
".",
"Consts",
".",
"gateway_direction",
",",
"node_params",
"[",
"consts",
".",
"Consts",
".",
"gateway_direction",
"]",
")"
] | 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"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L113-L120 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_start_event_info | def export_start_event_info(node_params, output_element):
"""
Adds StartEvent attributes to exported XML element
:param node_params: dictionary with given intermediate catch event parameters,
:param output_element: object representing BPMN XML 'intermediateCatchEvent' element.
"... | python | def export_start_event_info(node_params, output_element):
"""
Adds StartEvent attributes to exported XML element
:param node_params: dictionary with given intermediate catch event parameters,
:param output_element: object representing BPMN XML 'intermediateCatchEvent' element.
"... | [
"def",
"export_start_event_info",
"(",
"node_params",
",",
"output_element",
")",
":",
"output_element",
".",
"set",
"(",
"consts",
".",
"Consts",
".",
"parallel_multiple",
",",
"node_params",
".",
"get",
"(",
"consts",
".",
"Consts",
".",
"parallel_multiple",
"... | Adds StartEvent attributes to exported XML element
:param node_params: dictionary with given intermediate catch event parameters,
:param output_element: object representing BPMN XML 'intermediateCatchEvent' element. | [
"Adds",
"StartEvent",
"attributes",
"to",
"exported",
"XML",
"element"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L140-L155 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_throw_event_info | def export_throw_event_info(node_params, output_element):
"""
Adds EndEvent or IntermediateThrowingEvent attributes to exported XML element
:param node_params: dictionary with given intermediate throw event parameters,
:param output_element: object representing BPMN XML 'intermediateThr... | python | def export_throw_event_info(node_params, output_element):
"""
Adds EndEvent or IntermediateThrowingEvent attributes to exported XML element
:param node_params: dictionary with given intermediate throw event parameters,
:param output_element: object representing BPMN XML 'intermediateThr... | [
"def",
"export_throw_event_info",
"(",
"node_params",
",",
"output_element",
")",
":",
"definitions",
"=",
"node_params",
"[",
"consts",
".",
"Consts",
".",
"event_definitions",
"]",
"for",
"definition",
"in",
"definitions",
":",
"definition_id",
"=",
"definition",
... | Adds EndEvent or IntermediateThrowingEvent attributes to exported XML element
:param node_params: dictionary with given intermediate throw event parameters,
:param output_element: object representing BPMN XML 'intermediateThrowEvent' element. | [
"Adds",
"EndEvent",
"or",
"IntermediateThrowingEvent",
"attributes",
"to",
"exported",
"XML",
"element"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L158-L171 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_boundary_event_info | def export_boundary_event_info(node_params, output_element):
"""
Adds IntermediateCatchEvent attributes to exported XML element
:param node_params: dictionary with given intermediate catch event parameters,
:param output_element: object representing BPMN XML 'intermediateCatchEvent' ele... | python | def export_boundary_event_info(node_params, output_element):
"""
Adds IntermediateCatchEvent attributes to exported XML element
:param node_params: dictionary with given intermediate catch event parameters,
:param output_element: object representing BPMN XML 'intermediateCatchEvent' ele... | [
"def",
"export_boundary_event_info",
"(",
"node_params",
",",
"output_element",
")",
":",
"output_element",
".",
"set",
"(",
"consts",
".",
"Consts",
".",
"parallel_multiple",
",",
"node_params",
"[",
"consts",
".",
"Consts",
".",
"parallel_multiple",
"]",
")",
... | Adds IntermediateCatchEvent attributes to exported XML element
:param node_params: dictionary with given intermediate catch event parameters,
:param output_element: object representing BPMN XML 'intermediateCatchEvent' element. | [
"Adds",
"IntermediateCatchEvent",
"attributes",
"to",
"exported",
"XML",
"element"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L174-L190 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_process_element | def export_process_element(definitions, process_id, process_attributes_dictionary):
"""
Creates process element for exported BPMN XML file.
:param process_id: string object. ID of exported process element,
:param definitions: an XML element ('definitions'), root element of BPMN 2.0 docu... | python | def export_process_element(definitions, process_id, process_attributes_dictionary):
"""
Creates process element for exported BPMN XML file.
:param process_id: string object. ID of exported process element,
:param definitions: an XML element ('definitions'), root element of BPMN 2.0 docu... | [
"def",
"export_process_element",
"(",
"definitions",
",",
"process_id",
",",
"process_attributes_dictionary",
")",
":",
"process",
"=",
"eTree",
".",
"SubElement",
"(",
"definitions",
",",
"consts",
".",
"Consts",
".",
"process",
")",
"process",
".",
"set",
"(",... | Creates process element for exported BPMN XML file.
:param process_id: string object. ID of exported process element,
:param definitions: an XML element ('definitions'), root element of BPMN 2.0 document
:param process_attributes_dictionary: dictionary that holds attribute values of 'process' e... | [
"Creates",
"process",
"element",
"for",
"exported",
"BPMN",
"XML",
"file",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L213-L228 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_lane_set | def export_lane_set(process, lane_set, plane_element):
"""
Creates 'laneSet' element for exported BPMN XML file.
:param process: an XML element ('process'), from exported BPMN 2.0 document,
:param lane_set: dictionary with exported 'laneSet' element attributes and child elements,
... | python | def export_lane_set(process, lane_set, plane_element):
"""
Creates 'laneSet' element for exported BPMN XML file.
:param process: an XML element ('process'), from exported BPMN 2.0 document,
:param lane_set: dictionary with exported 'laneSet' element attributes and child elements,
... | [
"def",
"export_lane_set",
"(",
"process",
",",
"lane_set",
",",
"plane_element",
")",
":",
"lane_set_xml",
"=",
"eTree",
".",
"SubElement",
"(",
"process",
",",
"consts",
".",
"Consts",
".",
"lane_set",
")",
"for",
"key",
",",
"value",
"in",
"lane_set",
"[... | Creates 'laneSet' element for exported BPMN XML file.
:param process: an XML element ('process'), from exported BPMN 2.0 document,
:param lane_set: dictionary with exported 'laneSet' element attributes and child elements,
:param plane_element: XML object, representing 'plane' element of exporte... | [
"Creates",
"laneSet",
"element",
"for",
"exported",
"BPMN",
"XML",
"file",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L231-L241 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_child_lane_set | def export_child_lane_set(parent_xml_element, child_lane_set, plane_element):
"""
Creates 'childLaneSet' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'childLaneSet' element,
:param child_lane_set: dictionary with exported 'childLaneSe... | python | def export_child_lane_set(parent_xml_element, child_lane_set, plane_element):
"""
Creates 'childLaneSet' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'childLaneSet' element,
:param child_lane_set: dictionary with exported 'childLaneSe... | [
"def",
"export_child_lane_set",
"(",
"parent_xml_element",
",",
"child_lane_set",
",",
"plane_element",
")",
":",
"lane_set_xml",
"=",
"eTree",
".",
"SubElement",
"(",
"parent_xml_element",
",",
"consts",
".",
"Consts",
".",
"lane_set",
")",
"for",
"key",
",",
"... | Creates 'childLaneSet' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'childLaneSet' element,
:param child_lane_set: dictionary with exported 'childLaneSet' element attributes and child elements,
:param plane_element: XML object, representing '... | [
"Creates",
"childLaneSet",
"element",
"for",
"exported",
"BPMN",
"XML",
"file",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L244-L254 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_lane | def export_lane(parent_xml_element, lane_id, lane_attr, plane_element):
"""
Creates 'lane' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'lane' element,
:param lane_id: string object. ID of exported lane element,
:param lane_at... | python | def export_lane(parent_xml_element, lane_id, lane_attr, plane_element):
"""
Creates 'lane' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'lane' element,
:param lane_id: string object. ID of exported lane element,
:param lane_at... | [
"def",
"export_lane",
"(",
"parent_xml_element",
",",
"lane_id",
",",
"lane_attr",
",",
"plane_element",
")",
":",
"lane_xml",
"=",
"eTree",
".",
"SubElement",
"(",
"parent_xml_element",
",",
"consts",
".",
"Consts",
".",
"lane",
")",
"lane_xml",
".",
"set",
... | Creates 'lane' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'lane' element,
:param lane_id: string object. ID of exported lane element,
:param lane_attr: dictionary with lane element attributes,
:param plane_element: XML object, repre... | [
"Creates",
"lane",
"element",
"for",
"exported",
"BPMN",
"XML",
"file",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L257-L287 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_node_di_data | def export_node_di_data(node_id, params, plane):
"""
Creates a new BPMNShape XML element for given node parameters and adds it to 'plane' element.
:param node_id: string representing ID of given flow node,
:param params: dictionary with node parameters,
:param plane: object of E... | python | def export_node_di_data(node_id, params, plane):
"""
Creates a new BPMNShape XML element for given node parameters and adds it to 'plane' element.
:param node_id: string representing ID of given flow node,
:param params: dictionary with node parameters,
:param plane: object of E... | [
"def",
"export_node_di_data",
"(",
"node_id",
",",
"params",
",",
"plane",
")",
":",
"output_element_di",
"=",
"eTree",
".",
"SubElement",
"(",
"plane",
",",
"BpmnDiagramGraphExport",
".",
"bpmndi_namespace",
"+",
"consts",
".",
"Consts",
".",
"bpmn_shape",
")",... | Creates a new BPMNShape XML element for given node parameters and adds it to 'plane' element.
:param node_id: string representing ID of given flow node,
:param params: dictionary with node parameters,
:param plane: object of Element class, representing BPMN XML 'BPMNPlane' element (root for nod... | [
"Creates",
"a",
"new",
"BPMNShape",
"XML",
"element",
"for",
"given",
"node",
"parameters",
"and",
"adds",
"it",
"to",
"plane",
"element",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L358-L376 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_flow_process_data | def export_flow_process_data(params, process):
"""
Creates a new SequenceFlow XML element for given edge parameters and adds it to 'process' element.
:param params: dictionary with edge parameters,
:param process: object of Element class, representing BPMN XML 'process' element (root fo... | python | def export_flow_process_data(params, process):
"""
Creates a new SequenceFlow XML element for given edge parameters and adds it to 'process' element.
:param params: dictionary with edge parameters,
:param process: object of Element class, representing BPMN XML 'process' element (root fo... | [
"def",
"export_flow_process_data",
"(",
"params",
",",
"process",
")",
":",
"output_flow",
"=",
"eTree",
".",
"SubElement",
"(",
"process",
",",
"consts",
".",
"Consts",
".",
"sequence_flow",
")",
"output_flow",
".",
"set",
"(",
"consts",
".",
"Consts",
".",... | Creates a new SequenceFlow XML element for given edge parameters and adds it to 'process' element.
:param params: dictionary with edge parameters,
:param process: object of Element class, representing BPMN XML 'process' element (root for sequence flows) | [
"Creates",
"a",
"new",
"SequenceFlow",
"XML",
"element",
"for",
"given",
"edge",
"parameters",
"and",
"adds",
"it",
"to",
"process",
"element",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L379-L397 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.export_flow_di_data | def export_flow_di_data(params, plane):
"""
Creates a new BPMNEdge XML element for given edge parameters and adds it to 'plane' element.
:param params: dictionary with edge parameters,
:param plane: object of Element class, representing BPMN XML 'BPMNPlane' element (root for edge DI dat... | python | def export_flow_di_data(params, plane):
"""
Creates a new BPMNEdge XML element for given edge parameters and adds it to 'plane' element.
:param params: dictionary with edge parameters,
:param plane: object of Element class, representing BPMN XML 'BPMNPlane' element (root for edge DI dat... | [
"def",
"export_flow_di_data",
"(",
"params",
",",
"plane",
")",
":",
"output_flow",
"=",
"eTree",
".",
"SubElement",
"(",
"plane",
",",
"BpmnDiagramGraphExport",
".",
"bpmndi_namespace",
"+",
"consts",
".",
"Consts",
".",
"bpmn_edge",
")",
"output_flow",
".",
... | Creates a new BPMNEdge XML element for given edge parameters and adds it to 'plane' element.
:param params: dictionary with edge parameters,
:param plane: object of Element class, representing BPMN XML 'BPMNPlane' element (root for edge DI data). | [
"Creates",
"a",
"new",
"BPMNEdge",
"XML",
"element",
"for",
"given",
"edge",
"parameters",
"and",
"adds",
"it",
"to",
"plane",
"element",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L400-L414 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_export.py | BpmnDiagramGraphExport.indent | def indent(elem, level=0):
"""
Helper function, adds indentation to XML output.
:param elem: object of Element class, representing element to which method adds intendation,
:param level: current level of intendation.
"""
i = "\n" + level * " "
j = "\n" + (level ... | python | def indent(elem, level=0):
"""
Helper function, adds indentation to XML output.
:param elem: object of Element class, representing element to which method adds intendation,
:param level: current level of intendation.
"""
i = "\n" + level * " "
j = "\n" + (level ... | [
"def",
"indent",
"(",
"elem",
",",
"level",
"=",
"0",
")",
":",
"i",
"=",
"\"\\n\"",
"+",
"level",
"*",
"\" \"",
"j",
"=",
"\"\\n\"",
"+",
"(",
"level",
"-",
"1",
")",
"*",
"\" \"",
"if",
"len",
"(",
"elem",
")",
":",
"if",
"not",
"elem",
"... | Helper function, adds indentation to XML output.
:param elem: object of Element class, representing element to which method adds intendation,
:param level: current level of intendation. | [
"Helper",
"function",
"adds",
"indentation",
"to",
"XML",
"output",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L557-L578 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_import_utils.py | BpmnImportUtils.generate_nodes_clasification | def generate_nodes_clasification(bpmn_diagram):
"""
Diagram elements classification. Implementation based on article "A Simple Algorithm for Automatic Layout of
BPMN Processes".
Assigns a classification to the diagram element according to specific element parameters.
- Element - ... | python | def generate_nodes_clasification(bpmn_diagram):
"""
Diagram elements classification. Implementation based on article "A Simple Algorithm for Automatic Layout of
BPMN Processes".
Assigns a classification to the diagram element according to specific element parameters.
- Element - ... | [
"def",
"generate_nodes_clasification",
"(",
"bpmn_diagram",
")",
":",
"nodes_classification",
"=",
"{",
"}",
"classification_element",
"=",
"\"Element\"",
"classification_start_event",
"=",
"\"Start Event\"",
"classification_end_event",
"=",
"\"End Event\"",
"task_list",
"=",... | Diagram elements classification. Implementation based on article "A Simple Algorithm for Automatic Layout of
BPMN Processes".
Assigns a classification to the diagram element according to specific element parameters.
- Element - every element of the process which is not an edge,
- Start E... | [
"Diagram",
"elements",
"classification",
".",
"Implementation",
"based",
"on",
"article",
"A",
"Simple",
"Algorithm",
"for",
"Automatic",
"Layout",
"of",
"BPMN",
"Processes",
".",
"Assigns",
"a",
"classification",
"to",
"the",
"diagram",
"element",
"according",
"t... | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_import_utils.py#L39-L114 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_import_utils.py | BpmnImportUtils.split_join_classification | def split_join_classification(element, classification_labels, nodes_classification):
"""
Add the "Split", "Join" classification, if the element qualifies for.
:param element: an element from BPMN diagram,
:param classification_labels: list of labels attached to the element,
:par... | python | def split_join_classification(element, classification_labels, nodes_classification):
"""
Add the "Split", "Join" classification, if the element qualifies for.
:param element: an element from BPMN diagram,
:param classification_labels: list of labels attached to the element,
:par... | [
"def",
"split_join_classification",
"(",
"element",
",",
"classification_labels",
",",
"nodes_classification",
")",
":",
"classification_join",
"=",
"\"Join\"",
"classification_split",
"=",
"\"Split\"",
"if",
"len",
"(",
"element",
"[",
"1",
"]",
"[",
"consts",
".",... | Add the "Split", "Join" classification, if the element qualifies for.
:param element: an element from BPMN diagram,
:param classification_labels: list of labels attached to the element,
:param nodes_classification: dictionary of classification labels. Key - node id. Value - a list of labels. | [
"Add",
"the",
"Split",
"Join",
"classification",
"if",
"the",
"element",
"qualifies",
"for",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_import_utils.py#L117-L131 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_metrics.py | get_all_gateways | def get_all_gateways(bpmn_graph):
"""
Returns a list with all gateways in diagram
:param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.
:return: a list with all gateways in diagram
"""
gateways = filter(lambda node: node[1]['type'] in GATEWAY_TYPES, bpmn_graph.get_nodes())... | python | def get_all_gateways(bpmn_graph):
"""
Returns a list with all gateways in diagram
:param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.
:return: a list with all gateways in diagram
"""
gateways = filter(lambda node: node[1]['type'] in GATEWAY_TYPES, bpmn_graph.get_nodes())... | [
"def",
"get_all_gateways",
"(",
"bpmn_graph",
")",
":",
"gateways",
"=",
"filter",
"(",
"lambda",
"node",
":",
"node",
"[",
"1",
"]",
"[",
"'type'",
"]",
"in",
"GATEWAY_TYPES",
",",
"bpmn_graph",
".",
"get_nodes",
"(",
")",
")",
"return",
"gateways"
] | Returns a list with all gateways in diagram
:param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.
:return: a list with all gateways in diagram | [
"Returns",
"a",
"list",
"with",
"all",
"gateways",
"in",
"diagram"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_metrics.py#L29-L38 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_diagram_metrics.py | all_control_flow_elements_count | def all_control_flow_elements_count(bpmn_graph):
"""
Returns the total count of all control flow elements
in the BPMNDiagramGraph instance.
:param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.
:return: total count of the control flow elements in the BPMNDiagramGraph inst... | python | def all_control_flow_elements_count(bpmn_graph):
"""
Returns the total count of all control flow elements
in the BPMNDiagramGraph instance.
:param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.
:return: total count of the control flow elements in the BPMNDiagramGraph inst... | [
"def",
"all_control_flow_elements_count",
"(",
"bpmn_graph",
")",
":",
"gateway_counts",
"=",
"get_gateway_counts",
"(",
"bpmn_graph",
")",
"events_counts",
"=",
"get_events_counts",
"(",
"bpmn_graph",
")",
"control_flow_elements_counts",
"=",
"gateway_counts",
".",
"copy... | Returns the total count of all control flow elements
in the BPMNDiagramGraph instance.
:param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.
:return: total count of the control flow elements in the BPMNDiagramGraph instance | [
"Returns",
"the",
"total",
"count",
"of",
"all",
"control",
"flow",
"elements",
"in",
"the",
"BPMNDiagramGraph",
"instance",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_metrics.py#L111-L128 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_process_csv_export.py | BpmnDiagramGraphCsvExport.export_process_to_csv | def export_process_to_csv(bpmn_diagram, directory, filename):
"""
Root method of CSV export functionality.
:param bpmn_diagram: an instance of BpmnDiagramGraph class,
:param directory: a string object, which is a path of output directory,
:param filename: a string object, which ... | python | def export_process_to_csv(bpmn_diagram, directory, filename):
"""
Root method of CSV export functionality.
:param bpmn_diagram: an instance of BpmnDiagramGraph class,
:param directory: a string object, which is a path of output directory,
:param filename: a string object, which ... | [
"def",
"export_process_to_csv",
"(",
"bpmn_diagram",
",",
"directory",
",",
"filename",
")",
":",
"nodes",
"=",
"copy",
".",
"deepcopy",
"(",
"bpmn_diagram",
".",
"get_nodes",
"(",
")",
")",
"start_nodes",
"=",
"[",
"]",
"export_elements",
"=",
"[",
"]",
"... | Root method of CSV export functionality.
:param bpmn_diagram: an instance of BpmnDiagramGraph class,
:param directory: a string object, which is a path of output directory,
:param filename: a string object, which is a name of output file. | [
"Root",
"method",
"of",
"CSV",
"export",
"functionality",
"."
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_process_csv_export.py#L44-L75 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_process_csv_export.py | BpmnDiagramGraphCsvExport.export_node | def export_node(bpmn_graph, export_elements, node, nodes_classification, order=0, prefix="", condition="", who="",
add_join=False):
"""
General method for node exporting
:param bpmn_graph: an instance of BpmnDiagramGraph class,
:param export_elements: a dictionary ob... | python | def export_node(bpmn_graph, export_elements, node, nodes_classification, order=0, prefix="", condition="", who="",
add_join=False):
"""
General method for node exporting
:param bpmn_graph: an instance of BpmnDiagramGraph class,
:param export_elements: a dictionary ob... | [
"def",
"export_node",
"(",
"bpmn_graph",
",",
"export_elements",
",",
"node",
",",
"nodes_classification",
",",
"order",
"=",
"0",
",",
"prefix",
"=",
"\"\"",
",",
"condition",
"=",
"\"\"",
",",
"who",
"=",
"\"\"",
",",
"add_join",
"=",
"False",
")",
":"... | General method for node exporting
:param bpmn_graph: an instance of BpmnDiagramGraph class,
:param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that
will be used in exported CSV document,
:param node: networkx.Node object,
... | [
"General",
"method",
"for",
"node",
"exporting"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_process_csv_export.py#L78-L107 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_process_csv_export.py | BpmnDiagramGraphCsvExport.export_start_event | def export_start_event(bpmn_graph, export_elements, node, nodes_classification, order=0, prefix="", condition="",
who=""):
"""
Start event export
:param bpmn_graph: an instance of BpmnDiagramGraph class,
:param export_elements: a dictionary object. The key is ... | python | def export_start_event(bpmn_graph, export_elements, node, nodes_classification, order=0, prefix="", condition="",
who=""):
"""
Start event export
:param bpmn_graph: an instance of BpmnDiagramGraph class,
:param export_elements: a dictionary object. The key is ... | [
"def",
"export_start_event",
"(",
"bpmn_graph",
",",
"export_elements",
",",
"node",
",",
"nodes_classification",
",",
"order",
"=",
"0",
",",
"prefix",
"=",
"\"\"",
",",
"condition",
"=",
"\"\"",
",",
"who",
"=",
"\"\"",
")",
":",
"event_definitions",
"=",
... | Start event export
:param bpmn_graph: an instance of BpmnDiagramGraph class,
:param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that
will be used in exported CSV document,
:param node: networkx.Node object,
:param order:... | [
"Start",
"event",
"export"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_process_csv_export.py#L208-L249 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_process_csv_export.py | BpmnDiagramGraphCsvExport.export_end_event | def export_end_event(export_elements, node, order=0, prefix="", condition="", who=""):
"""
End event export
:param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that
will be used in exported CSV document,
:param node: netw... | python | def export_end_event(export_elements, node, order=0, prefix="", condition="", who=""):
"""
End event export
:param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that
will be used in exported CSV document,
:param node: netw... | [
"def",
"export_end_event",
"(",
"export_elements",
",",
"node",
",",
"order",
"=",
"0",
",",
"prefix",
"=",
"\"\"",
",",
"condition",
"=",
"\"\"",
",",
"who",
"=",
"\"\"",
")",
":",
"event_definitions",
"=",
"node",
"[",
"1",
"]",
".",
"get",
"(",
"c... | End event export
:param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that
will be used in exported CSV document,
:param node: networkx.Node object,
:param order: the order param of exported node,
:param prefix: the prefix... | [
"End",
"event",
"export"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_process_csv_export.py#L252-L284 | train |
KrzyHonk/bpmn-python | bpmn_python/bpmn_process_csv_export.py | BpmnDiagramGraphCsvExport.write_export_node_to_file | def write_export_node_to_file(file_object, export_elements):
"""
Exporting process to CSV file
:param file_object: object of File class,
:param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that
will be used in exported CS... | python | def write_export_node_to_file(file_object, export_elements):
"""
Exporting process to CSV file
:param file_object: object of File class,
:param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that
will be used in exported CS... | [
"def",
"write_export_node_to_file",
"(",
"file_object",
",",
"export_elements",
")",
":",
"for",
"export_element",
"in",
"export_elements",
":",
"file_object",
".",
"write",
"(",
"export_element",
"[",
"\"Order\"",
"]",
"+",
"\",\"",
"+",
"export_element",
"[",
"\... | Exporting process to CSV file
:param file_object: object of File class,
:param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that
will be used in exported CSV document. | [
"Exporting",
"process",
"to",
"CSV",
"file"
] | 6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629 | https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_process_csv_export.py#L287-L299 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.