id int32 0 252k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,800 | bintoro/overloading.py | overloading.py | normalize_type | def normalize_type(type_, level=0):
"""
Reduces an arbitrarily complex type declaration into something manageable.
"""
if not typing or not isinstance(type_, typing.TypingMeta) or type_ is AnyType:
return type_
if isinstance(type_, typing.TypeVar):
if type_.__constraints__ or type_._... | python | def normalize_type(type_, level=0):
"""
Reduces an arbitrarily complex type declaration into something manageable.
"""
if not typing or not isinstance(type_, typing.TypingMeta) or type_ is AnyType:
return type_
if isinstance(type_, typing.TypeVar):
if type_.__constraints__ or type_._... | [
"def",
"normalize_type",
"(",
"type_",
",",
"level",
"=",
"0",
")",
":",
"if",
"not",
"typing",
"or",
"not",
"isinstance",
"(",
"type_",
",",
"typing",
".",
"TypingMeta",
")",
"or",
"type_",
"is",
"AnyType",
":",
"return",
"type_",
"if",
"isinstance",
... | Reduces an arbitrarily complex type declaration into something manageable. | [
"Reduces",
"an",
"arbitrarily",
"complex",
"type",
"declaration",
"into",
"something",
"manageable",
"."
] | d7b044d6f7e38043f0fc20f44f134baec84a5b32 | https://github.com/bintoro/overloading.py/blob/d7b044d6f7e38043f0fc20f44f134baec84a5b32/overloading.py#L464-L495 |
47,801 | bintoro/overloading.py | overloading.py | type_complexity | def type_complexity(type_):
"""Computes an indicator for the complexity of `type_`.
If the return value is 0, the supplied type is not parameterizable.
Otherwise, set bits in the return value denote the following features:
- bit 0: The type could be parameterized but is not.
- bit 1: The type repre... | python | def type_complexity(type_):
"""Computes an indicator for the complexity of `type_`.
If the return value is 0, the supplied type is not parameterizable.
Otherwise, set bits in the return value denote the following features:
- bit 0: The type could be parameterized but is not.
- bit 1: The type repre... | [
"def",
"type_complexity",
"(",
"type_",
")",
":",
"if",
"(",
"not",
"typing",
"or",
"not",
"isinstance",
"(",
"type_",
",",
"(",
"typing",
".",
"TypingMeta",
",",
"GenericWrapperMeta",
")",
")",
"or",
"type_",
"is",
"AnyType",
")",
":",
"return",
"0",
... | Computes an indicator for the complexity of `type_`.
If the return value is 0, the supplied type is not parameterizable.
Otherwise, set bits in the return value denote the following features:
- bit 0: The type could be parameterized but is not.
- bit 1: The type represents an iterable container with 1 ... | [
"Computes",
"an",
"indicator",
"for",
"the",
"complexity",
"of",
"type_",
"."
] | d7b044d6f7e38043f0fc20f44f134baec84a5b32 | https://github.com/bintoro/overloading.py/blob/d7b044d6f7e38043f0fc20f44f134baec84a5b32/overloading.py#L586-L620 |
47,802 | bintoro/overloading.py | overloading.py | find_base_generic | def find_base_generic(type_):
"""Locates the underlying generic whose structure and behavior are known.
For example, the base generic of a type that inherits from `typing.Mapping[T, int]`
is `typing.Mapping`.
"""
for t in type_.__mro__:
if t.__module__ == typing.__name__:
return... | python | def find_base_generic(type_):
"""Locates the underlying generic whose structure and behavior are known.
For example, the base generic of a type that inherits from `typing.Mapping[T, int]`
is `typing.Mapping`.
"""
for t in type_.__mro__:
if t.__module__ == typing.__name__:
return... | [
"def",
"find_base_generic",
"(",
"type_",
")",
":",
"for",
"t",
"in",
"type_",
".",
"__mro__",
":",
"if",
"t",
".",
"__module__",
"==",
"typing",
".",
"__name__",
":",
"return",
"first_origin",
"(",
"t",
")"
] | Locates the underlying generic whose structure and behavior are known.
For example, the base generic of a type that inherits from `typing.Mapping[T, int]`
is `typing.Mapping`. | [
"Locates",
"the",
"underlying",
"generic",
"whose",
"structure",
"and",
"behavior",
"are",
"known",
"."
] | d7b044d6f7e38043f0fc20f44f134baec84a5b32 | https://github.com/bintoro/overloading.py/blob/d7b044d6f7e38043f0fc20f44f134baec84a5b32/overloading.py#L629-L637 |
47,803 | bintoro/overloading.py | overloading.py | iter_generic_bases | def iter_generic_bases(type_):
"""Iterates over all generics `type_` derives from, including origins.
This function is only necessary because, in typing 3.5.0, a generic doesn't
get included in the list of bases when it constructs a parameterized version
of itself. This was fixed in aab2c59; now it wou... | python | def iter_generic_bases(type_):
"""Iterates over all generics `type_` derives from, including origins.
This function is only necessary because, in typing 3.5.0, a generic doesn't
get included in the list of bases when it constructs a parameterized version
of itself. This was fixed in aab2c59; now it wou... | [
"def",
"iter_generic_bases",
"(",
"type_",
")",
":",
"for",
"t",
"in",
"type_",
".",
"__mro__",
":",
"if",
"not",
"isinstance",
"(",
"t",
",",
"typing",
".",
"GenericMeta",
")",
":",
"continue",
"yield",
"t",
"t",
"=",
"t",
".",
"__origin__",
"while",
... | Iterates over all generics `type_` derives from, including origins.
This function is only necessary because, in typing 3.5.0, a generic doesn't
get included in the list of bases when it constructs a parameterized version
of itself. This was fixed in aab2c59; now it would be enough to just iterate
over ... | [
"Iterates",
"over",
"all",
"generics",
"type_",
"derives",
"from",
"including",
"origins",
"."
] | d7b044d6f7e38043f0fc20f44f134baec84a5b32 | https://github.com/bintoro/overloading.py/blob/d7b044d6f7e38043f0fc20f44f134baec84a5b32/overloading.py#L640-L655 |
47,804 | bintoro/overloading.py | overloading.py | sig_cmp | def sig_cmp(sig1, sig2):
"""
Compares two normalized type signatures for validation purposes.
"""
types1 = sig1.required
types2 = sig2.required
if len(types1) != len(types2):
return False
dup_pos = []
dup_kw = {}
for t1, t2 in zip(types1, types2):
match = type_cmp(t1,... | python | def sig_cmp(sig1, sig2):
"""
Compares two normalized type signatures for validation purposes.
"""
types1 = sig1.required
types2 = sig2.required
if len(types1) != len(types2):
return False
dup_pos = []
dup_kw = {}
for t1, t2 in zip(types1, types2):
match = type_cmp(t1,... | [
"def",
"sig_cmp",
"(",
"sig1",
",",
"sig2",
")",
":",
"types1",
"=",
"sig1",
".",
"required",
"types2",
"=",
"sig2",
".",
"required",
"if",
"len",
"(",
"types1",
")",
"!=",
"len",
"(",
"types2",
")",
":",
"return",
"False",
"dup_pos",
"=",
"[",
"]"... | Compares two normalized type signatures for validation purposes. | [
"Compares",
"two",
"normalized",
"type",
"signatures",
"for",
"validation",
"purposes",
"."
] | d7b044d6f7e38043f0fc20f44f134baec84a5b32 | https://github.com/bintoro/overloading.py/blob/d7b044d6f7e38043f0fc20f44f134baec84a5b32/overloading.py#L658-L691 |
47,805 | bintoro/overloading.py | overloading.py | is_void | def is_void(func):
"""
Determines if a function is a void function, i.e., one whose body contains
nothing but a docstring or an ellipsis. A void function can be used to introduce
an overloaded function without actually registering an implementation.
"""
try:
source = dedent(inspect.getso... | python | def is_void(func):
"""
Determines if a function is a void function, i.e., one whose body contains
nothing but a docstring or an ellipsis. A void function can be used to introduce
an overloaded function without actually registering an implementation.
"""
try:
source = dedent(inspect.getso... | [
"def",
"is_void",
"(",
"func",
")",
":",
"try",
":",
"source",
"=",
"dedent",
"(",
"inspect",
".",
"getsource",
"(",
"func",
")",
")",
"except",
"(",
"OSError",
",",
"IOError",
")",
":",
"return",
"False",
"fdef",
"=",
"next",
"(",
"ast",
".",
"ite... | Determines if a function is a void function, i.e., one whose body contains
nothing but a docstring or an ellipsis. A void function can be used to introduce
an overloaded function without actually registering an implementation. | [
"Determines",
"if",
"a",
"function",
"is",
"a",
"void",
"function",
"i",
".",
"e",
".",
"one",
"whose",
"body",
"contains",
"nothing",
"but",
"a",
"docstring",
"or",
"an",
"ellipsis",
".",
"A",
"void",
"function",
"can",
"be",
"used",
"to",
"introduce",
... | d7b044d6f7e38043f0fc20f44f134baec84a5b32 | https://github.com/bintoro/overloading.py/blob/d7b044d6f7e38043f0fc20f44f134baec84a5b32/overloading.py#L755-L769 |
47,806 | bintoro/overloading.py | overloading.py | GenericWrapperMeta.derive_configuration | def derive_configuration(cls):
"""
Collect the nearest type variables and effective parameters from the type,
its bases, and their origins as necessary.
"""
base_params = cls.base.__parameters__
if hasattr(cls.type, '__args__'):
# typing as of commit abefbe4
... | python | def derive_configuration(cls):
"""
Collect the nearest type variables and effective parameters from the type,
its bases, and their origins as necessary.
"""
base_params = cls.base.__parameters__
if hasattr(cls.type, '__args__'):
# typing as of commit abefbe4
... | [
"def",
"derive_configuration",
"(",
"cls",
")",
":",
"base_params",
"=",
"cls",
".",
"base",
".",
"__parameters__",
"if",
"hasattr",
"(",
"cls",
".",
"type",
",",
"'__args__'",
")",
":",
"# typing as of commit abefbe4",
"tvars",
"=",
"{",
"p",
":",
"p",
"f... | Collect the nearest type variables and effective parameters from the type,
its bases, and their origins as necessary. | [
"Collect",
"the",
"nearest",
"type",
"variables",
"and",
"effective",
"parameters",
"from",
"the",
"type",
"its",
"bases",
"and",
"their",
"origins",
"as",
"necessary",
"."
] | d7b044d6f7e38043f0fc20f44f134baec84a5b32 | https://github.com/bintoro/overloading.py/blob/d7b044d6f7e38043f0fc20f44f134baec84a5b32/overloading.py#L546-L579 |
47,807 | Oneiroe/PySimpleAutomata | PySimpleAutomata/NFA.py | nfa_intersection | def nfa_intersection(nfa_1: dict, nfa_2: dict) -> dict:
""" Returns a NFA that reads the intersection of the NFAs in
input.
Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ,
S_2,S_2^0,ρ_2,F_2)` be two NFAs.
There is a NFA :math:`A_∧` that runs simultaneously both
:math:`A_1` and :math... | python | def nfa_intersection(nfa_1: dict, nfa_2: dict) -> dict:
""" Returns a NFA that reads the intersection of the NFAs in
input.
Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ,
S_2,S_2^0,ρ_2,F_2)` be two NFAs.
There is a NFA :math:`A_∧` that runs simultaneously both
:math:`A_1` and :math... | [
"def",
"nfa_intersection",
"(",
"nfa_1",
":",
"dict",
",",
"nfa_2",
":",
"dict",
")",
"->",
"dict",
":",
"intersection",
"=",
"{",
"'alphabet'",
":",
"nfa_1",
"[",
"'alphabet'",
"]",
".",
"intersection",
"(",
"nfa_2",
"[",
"'alphabet'",
"]",
")",
",",
... | Returns a NFA that reads the intersection of the NFAs in
input.
Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ,
S_2,S_2^0,ρ_2,F_2)` be two NFAs.
There is a NFA :math:`A_∧` that runs simultaneously both
:math:`A_1` and :math:`A_2` on the input word,
so :math:`L(A_∧) = L(A_1)∩L(A_2)`.... | [
"Returns",
"a",
"NFA",
"that",
"reads",
"the",
"intersection",
"of",
"the",
"NFAs",
"in",
"input",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/NFA.py#L35-L99 |
47,808 | Oneiroe/PySimpleAutomata | PySimpleAutomata/NFA.py | nfa_union | def nfa_union(nfa_1: dict, nfa_2: dict) -> dict:
""" Returns a NFA that reads the union of the NFAs in input.
Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ,
S_2,S_2^0,ρ_2,F_2)` be two NFAs. here is a NFA
:math:`A_∨` that nondeterministically chooses :math:`A_1` or
:math:`A_2` and runs ... | python | def nfa_union(nfa_1: dict, nfa_2: dict) -> dict:
""" Returns a NFA that reads the union of the NFAs in input.
Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ,
S_2,S_2^0,ρ_2,F_2)` be two NFAs. here is a NFA
:math:`A_∨` that nondeterministically chooses :math:`A_1` or
:math:`A_2` and runs ... | [
"def",
"nfa_union",
"(",
"nfa_1",
":",
"dict",
",",
"nfa_2",
":",
"dict",
")",
"->",
"dict",
":",
"union",
"=",
"{",
"'alphabet'",
":",
"nfa_1",
"[",
"'alphabet'",
"]",
".",
"union",
"(",
"nfa_2",
"[",
"'alphabet'",
"]",
")",
",",
"'states'",
":",
... | Returns a NFA that reads the union of the NFAs in input.
Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ,
S_2,S_2^0,ρ_2,F_2)` be two NFAs. here is a NFA
:math:`A_∨` that nondeterministically chooses :math:`A_1` or
:math:`A_2` and runs it on the input word.
It is defined as:
:math:`A... | [
"Returns",
"a",
"NFA",
"that",
"reads",
"the",
"union",
"of",
"the",
"NFAs",
"in",
"input",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/NFA.py#L102-L142 |
47,809 | Oneiroe/PySimpleAutomata | PySimpleAutomata/NFA.py | nfa_determinization | def nfa_determinization(nfa: dict) -> dict:
""" Returns a DFA that reads the same language of the input NFA.
Let A be an NFA, then there exists a DFA :math:`A_d` such
that :math:`L(A_d) = L(A)`. Intuitively, :math:`A_d`
collapses all possible runs of A on a given input word into
one run over a larg... | python | def nfa_determinization(nfa: dict) -> dict:
""" Returns a DFA that reads the same language of the input NFA.
Let A be an NFA, then there exists a DFA :math:`A_d` such
that :math:`L(A_d) = L(A)`. Intuitively, :math:`A_d`
collapses all possible runs of A on a given input word into
one run over a larg... | [
"def",
"nfa_determinization",
"(",
"nfa",
":",
"dict",
")",
"->",
"dict",
":",
"def",
"state_name",
"(",
"s",
")",
":",
"return",
"str",
"(",
"set",
"(",
"sorted",
"(",
"s",
")",
")",
")",
"dfa",
"=",
"{",
"'alphabet'",
":",
"nfa",
"[",
"'alphabet'... | Returns a DFA that reads the same language of the input NFA.
Let A be an NFA, then there exists a DFA :math:`A_d` such
that :math:`L(A_d) = L(A)`. Intuitively, :math:`A_d`
collapses all possible runs of A on a given input word into
one run over a larger state set.
:math:`A_d` is defined as:
:m... | [
"Returns",
"a",
"DFA",
"that",
"reads",
"the",
"same",
"language",
"of",
"the",
"input",
"NFA",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/NFA.py#L146-L211 |
47,810 | Oneiroe/PySimpleAutomata | PySimpleAutomata/NFA.py | nfa_complementation | def nfa_complementation(nfa: dict) -> dict:
""" Returns a DFA reading the complemented language read by
input NFA.
Complement a nondeterministic automaton is possible
complementing the determinization of it.
The construction is effective, but it involves an exponential
blow-up, since determiniz... | python | def nfa_complementation(nfa: dict) -> dict:
""" Returns a DFA reading the complemented language read by
input NFA.
Complement a nondeterministic automaton is possible
complementing the determinization of it.
The construction is effective, but it involves an exponential
blow-up, since determiniz... | [
"def",
"nfa_complementation",
"(",
"nfa",
":",
"dict",
")",
"->",
"dict",
":",
"determinized_nfa",
"=",
"nfa_determinization",
"(",
"nfa",
")",
"return",
"DFA",
".",
"dfa_complementation",
"(",
"determinized_nfa",
")"
] | Returns a DFA reading the complemented language read by
input NFA.
Complement a nondeterministic automaton is possible
complementing the determinization of it.
The construction is effective, but it involves an exponential
blow-up, since determinization involves an unavoidable
exponential blow-u... | [
"Returns",
"a",
"DFA",
"reading",
"the",
"complemented",
"language",
"read",
"by",
"input",
"NFA",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/NFA.py#L214-L229 |
47,811 | Oneiroe/PySimpleAutomata | PySimpleAutomata/NFA.py | nfa_word_acceptance | def nfa_word_acceptance(nfa: dict, word: list) -> bool:
""" Checks if a given word is accepted by a NFA.
The word w is accepted by a NFA if exists at least an
accepting run on w.
:param dict nfa: input NFA;
:param list word: list of symbols ∈ nfa['alphabet'];
:return: *(bool)*, True if the wor... | python | def nfa_word_acceptance(nfa: dict, word: list) -> bool:
""" Checks if a given word is accepted by a NFA.
The word w is accepted by a NFA if exists at least an
accepting run on w.
:param dict nfa: input NFA;
:param list word: list of symbols ∈ nfa['alphabet'];
:return: *(bool)*, True if the wor... | [
"def",
"nfa_word_acceptance",
"(",
"nfa",
":",
"dict",
",",
"word",
":",
"list",
")",
"->",
"bool",
":",
"current_level",
"=",
"set",
"(",
")",
"current_level",
"=",
"current_level",
".",
"union",
"(",
"nfa",
"[",
"'initial_states'",
"]",
")",
"next_level"... | Checks if a given word is accepted by a NFA.
The word w is accepted by a NFA if exists at least an
accepting run on w.
:param dict nfa: input NFA;
:param list word: list of symbols ∈ nfa['alphabet'];
:return: *(bool)*, True if the word is accepted, False otherwise. | [
"Checks",
"if",
"a",
"given",
"word",
"is",
"accepted",
"by",
"a",
"NFA",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/NFA.py#L308-L333 |
47,812 | entrepreneur-interet-general/mkinx | mkinx/utils.py | overwrite_view_source | def overwrite_view_source(project, dir_path):
"""In the project's index.html built file, replace the top "source"
link with a link to the documentation's home, which is mkdoc's home
Args:
project (str): project to update
dir_path (pathlib.Path): this file's path
"""
project_html_lo... | python | def overwrite_view_source(project, dir_path):
"""In the project's index.html built file, replace the top "source"
link with a link to the documentation's home, which is mkdoc's home
Args:
project (str): project to update
dir_path (pathlib.Path): this file's path
"""
project_html_lo... | [
"def",
"overwrite_view_source",
"(",
"project",
",",
"dir_path",
")",
":",
"project_html_location",
"=",
"dir_path",
"/",
"project",
"/",
"HTML_LOCATION",
"if",
"not",
"project_html_location",
".",
"exists",
"(",
")",
":",
"return",
"files_to_overwrite",
"=",
"[",... | In the project's index.html built file, replace the top "source"
link with a link to the documentation's home, which is mkdoc's home
Args:
project (str): project to update
dir_path (pathlib.Path): this file's path | [
"In",
"the",
"project",
"s",
"index",
".",
"html",
"built",
"file",
"replace",
"the",
"top",
"source",
"link",
"with",
"a",
"link",
"to",
"the",
"documentation",
"s",
"home",
"which",
"is",
"mkdoc",
"s",
"home"
] | 70ccf81d3fad974283829ca4ec069a873341461d | https://github.com/entrepreneur-interet-general/mkinx/blob/70ccf81d3fad974283829ca4ec069a873341461d/mkinx/utils.py#L74-L99 |
47,813 | entrepreneur-interet-general/mkinx | mkinx/utils.py | get_listed_projects | def get_listed_projects():
"""Find the projects listed in the Home Documentation's
index.md file
Returns:
set(str): projects' names, with the '/' in their beginings
"""
index_path = Path().resolve() / "docs" / "index.md"
with open(index_path, "r") as index_file:
lines = index_fi... | python | def get_listed_projects():
"""Find the projects listed in the Home Documentation's
index.md file
Returns:
set(str): projects' names, with the '/' in their beginings
"""
index_path = Path().resolve() / "docs" / "index.md"
with open(index_path, "r") as index_file:
lines = index_fi... | [
"def",
"get_listed_projects",
"(",
")",
":",
"index_path",
"=",
"Path",
"(",
")",
".",
"resolve",
"(",
")",
"/",
"\"docs\"",
"/",
"\"index.md\"",
"with",
"open",
"(",
"index_path",
",",
"\"r\"",
")",
"as",
"index_file",
":",
"lines",
"=",
"index_file",
"... | Find the projects listed in the Home Documentation's
index.md file
Returns:
set(str): projects' names, with the '/' in their beginings | [
"Find",
"the",
"projects",
"listed",
"in",
"the",
"Home",
"Documentation",
"s",
"index",
".",
"md",
"file"
] | 70ccf81d3fad974283829ca4ec069a873341461d | https://github.com/entrepreneur-interet-general/mkinx/blob/70ccf81d3fad974283829ca4ec069a873341461d/mkinx/utils.py#L102-L133 |
47,814 | entrepreneur-interet-general/mkinx | mkinx/utils.py | make_offline | def make_offline():
"""Deletes references to the external google fonts in the Home
Documentation's index.html file
"""
dir_path = Path(os.getcwd()).absolute()
css_path = dir_path / "site" / "assets" / "stylesheets"
material_css = css_path / "material-style.css"
if not material_css.exists():... | python | def make_offline():
"""Deletes references to the external google fonts in the Home
Documentation's index.html file
"""
dir_path = Path(os.getcwd()).absolute()
css_path = dir_path / "site" / "assets" / "stylesheets"
material_css = css_path / "material-style.css"
if not material_css.exists():... | [
"def",
"make_offline",
"(",
")",
":",
"dir_path",
"=",
"Path",
"(",
"os",
".",
"getcwd",
"(",
")",
")",
".",
"absolute",
"(",
")",
"css_path",
"=",
"dir_path",
"/",
"\"site\"",
"/",
"\"assets\"",
"/",
"\"stylesheets\"",
"material_css",
"=",
"css_path",
"... | Deletes references to the external google fonts in the Home
Documentation's index.html file | [
"Deletes",
"references",
"to",
"the",
"external",
"google",
"fonts",
"in",
"the",
"Home",
"Documentation",
"s",
"index",
".",
"html",
"file"
] | 70ccf81d3fad974283829ca4ec069a873341461d | https://github.com/entrepreneur-interet-general/mkinx/blob/70ccf81d3fad974283829ca4ec069a873341461d/mkinx/utils.py#L197-L215 |
47,815 | alimanfoo/vcfnp | vcfnp/array.py | _filenames_from_arg | def _filenames_from_arg(filename):
"""Utility function to deal with polymorphic filenames argument."""
if isinstance(filename, string_types):
filenames = [filename]
elif isinstance(filename, (list, tuple)):
filenames = filename
else:
raise Exception('filename argument must be str... | python | def _filenames_from_arg(filename):
"""Utility function to deal with polymorphic filenames argument."""
if isinstance(filename, string_types):
filenames = [filename]
elif isinstance(filename, (list, tuple)):
filenames = filename
else:
raise Exception('filename argument must be str... | [
"def",
"_filenames_from_arg",
"(",
"filename",
")",
":",
"if",
"isinstance",
"(",
"filename",
",",
"string_types",
")",
":",
"filenames",
"=",
"[",
"filename",
"]",
"elif",
"isinstance",
"(",
"filename",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"fi... | Utility function to deal with polymorphic filenames argument. | [
"Utility",
"function",
"to",
"deal",
"with",
"polymorphic",
"filenames",
"argument",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L203-L216 |
47,816 | alimanfoo/vcfnp | vcfnp/array.py | _get_cache | def _get_cache(vcf_fn, array_type, region, cachedir, compress, log):
"""Utility function to obtain a cache file name and determine whether or
not a fresh cache file is available."""
# guard condition
if isinstance(vcf_fn, (list, tuple)):
raise Exception(
'caching only supported when... | python | def _get_cache(vcf_fn, array_type, region, cachedir, compress, log):
"""Utility function to obtain a cache file name and determine whether or
not a fresh cache file is available."""
# guard condition
if isinstance(vcf_fn, (list, tuple)):
raise Exception(
'caching only supported when... | [
"def",
"_get_cache",
"(",
"vcf_fn",
",",
"array_type",
",",
"region",
",",
"cachedir",
",",
"compress",
",",
"log",
")",
":",
"# guard condition",
"if",
"isinstance",
"(",
"vcf_fn",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"raise",
"Exception",
"("... | Utility function to obtain a cache file name and determine whether or
not a fresh cache file is available. | [
"Utility",
"function",
"to",
"obtain",
"a",
"cache",
"file",
"name",
"and",
"determine",
"whether",
"or",
"not",
"a",
"fresh",
"cache",
"file",
"is",
"available",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L285-L311 |
47,817 | alimanfoo/vcfnp | vcfnp/array.py | _variants_fields | def _variants_fields(fields, exclude_fields, info_ids):
"""Utility function to determine which fields to extract when loading
variants."""
if fields is None:
# no fields specified by user
# by default extract all standard and INFO fields
fields = config.STANDARD_VARIANT_FIELDS + info... | python | def _variants_fields(fields, exclude_fields, info_ids):
"""Utility function to determine which fields to extract when loading
variants."""
if fields is None:
# no fields specified by user
# by default extract all standard and INFO fields
fields = config.STANDARD_VARIANT_FIELDS + info... | [
"def",
"_variants_fields",
"(",
"fields",
",",
"exclude_fields",
",",
"info_ids",
")",
":",
"if",
"fields",
"is",
"None",
":",
"# no fields specified by user",
"# by default extract all standard and INFO fields",
"fields",
"=",
"config",
".",
"STANDARD_VARIANT_FIELDS",
"+... | Utility function to determine which fields to extract when loading
variants. | [
"Utility",
"function",
"to",
"determine",
"which",
"fields",
"to",
"extract",
"when",
"loading",
"variants",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L413-L432 |
47,818 | alimanfoo/vcfnp | vcfnp/array.py | _variants_fills | def _variants_fills(fields, fills, info_types):
"""Utility function to determine fill values for variants fields with
missing values."""
if fills is None:
# no fills specified by user
fills = dict()
for f, vcf_type in zip(fields, info_types):
if f == 'FILTER':
fills[f... | python | def _variants_fills(fields, fills, info_types):
"""Utility function to determine fill values for variants fields with
missing values."""
if fills is None:
# no fills specified by user
fills = dict()
for f, vcf_type in zip(fields, info_types):
if f == 'FILTER':
fills[f... | [
"def",
"_variants_fills",
"(",
"fields",
",",
"fills",
",",
"info_types",
")",
":",
"if",
"fills",
"is",
"None",
":",
"# no fills specified by user",
"fills",
"=",
"dict",
"(",
")",
"for",
"f",
",",
"vcf_type",
"in",
"zip",
"(",
"fields",
",",
"info_types"... | Utility function to determine fill values for variants fields with
missing values. | [
"Utility",
"function",
"to",
"determine",
"fill",
"values",
"for",
"variants",
"fields",
"with",
"missing",
"values",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L462-L478 |
47,819 | alimanfoo/vcfnp | vcfnp/array.py | _info_transformers | def _info_transformers(fields, transformers):
"""Utility function to determine transformer functions for variants
fields."""
if transformers is None:
# no transformers specified by user
transformers = dict()
for f in fields:
if f not in transformers:
transformers[f] =... | python | def _info_transformers(fields, transformers):
"""Utility function to determine transformer functions for variants
fields."""
if transformers is None:
# no transformers specified by user
transformers = dict()
for f in fields:
if f not in transformers:
transformers[f] =... | [
"def",
"_info_transformers",
"(",
"fields",
",",
"transformers",
")",
":",
"if",
"transformers",
"is",
"None",
":",
"# no transformers specified by user",
"transformers",
"=",
"dict",
"(",
")",
"for",
"f",
"in",
"fields",
":",
"if",
"f",
"not",
"in",
"transfor... | Utility function to determine transformer functions for variants
fields. | [
"Utility",
"function",
"to",
"determine",
"transformer",
"functions",
"for",
"variants",
"fields",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L481-L490 |
47,820 | alimanfoo/vcfnp | vcfnp/array.py | _variants_dtype | def _variants_dtype(fields, dtypes, arities, filter_ids, flatten_filter,
info_types):
"""Utility function to build a numpy dtype for a variants array,
given user arguments and information available from VCF header."""
dtype = list()
for f, n, vcf_type in zip(fields, arities, info_typ... | python | def _variants_dtype(fields, dtypes, arities, filter_ids, flatten_filter,
info_types):
"""Utility function to build a numpy dtype for a variants array,
given user arguments and information available from VCF header."""
dtype = list()
for f, n, vcf_type in zip(fields, arities, info_typ... | [
"def",
"_variants_dtype",
"(",
"fields",
",",
"dtypes",
",",
"arities",
",",
"filter_ids",
",",
"flatten_filter",
",",
"info_types",
")",
":",
"dtype",
"=",
"list",
"(",
")",
"for",
"f",
",",
"n",
",",
"vcf_type",
"in",
"zip",
"(",
"fields",
",",
"arit... | Utility function to build a numpy dtype for a variants array,
given user arguments and information available from VCF header. | [
"Utility",
"function",
"to",
"build",
"a",
"numpy",
"dtype",
"for",
"a",
"variants",
"array",
"given",
"user",
"arguments",
"and",
"information",
"available",
"from",
"VCF",
"header",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L493-L524 |
47,821 | alimanfoo/vcfnp | vcfnp/array.py | _fromiter | def _fromiter(it, dtype, count, progress, log):
"""Utility function to load an array from an iterator."""
if progress > 0:
it = _iter_withprogress(it, progress, log)
if count is not None:
a = np.fromiter(it, dtype=dtype, count=count)
else:
a = np.fromiter(it, dtype=dtype)
ret... | python | def _fromiter(it, dtype, count, progress, log):
"""Utility function to load an array from an iterator."""
if progress > 0:
it = _iter_withprogress(it, progress, log)
if count is not None:
a = np.fromiter(it, dtype=dtype, count=count)
else:
a = np.fromiter(it, dtype=dtype)
ret... | [
"def",
"_fromiter",
"(",
"it",
",",
"dtype",
",",
"count",
",",
"progress",
",",
"log",
")",
":",
"if",
"progress",
">",
"0",
":",
"it",
"=",
"_iter_withprogress",
"(",
"it",
",",
"progress",
",",
"log",
")",
"if",
"count",
"is",
"not",
"None",
":"... | Utility function to load an array from an iterator. | [
"Utility",
"function",
"to",
"load",
"an",
"array",
"from",
"an",
"iterator",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L527-L535 |
47,822 | alimanfoo/vcfnp | vcfnp/array.py | _iter_withprogress | def _iter_withprogress(iterable, progress, log):
"""Utility function to load an array from an iterator, reporting progress
as we go."""
before_all = time.time()
before = before_all
n = 0
for i, o in enumerate(iterable):
yield o
n = i+1
if n % progress == 0:
af... | python | def _iter_withprogress(iterable, progress, log):
"""Utility function to load an array from an iterator, reporting progress
as we go."""
before_all = time.time()
before = before_all
n = 0
for i, o in enumerate(iterable):
yield o
n = i+1
if n % progress == 0:
af... | [
"def",
"_iter_withprogress",
"(",
"iterable",
",",
"progress",
",",
"log",
")",
":",
"before_all",
"=",
"time",
".",
"time",
"(",
")",
"before",
"=",
"before_all",
"n",
"=",
"0",
"for",
"i",
",",
"o",
"in",
"enumerate",
"(",
"iterable",
")",
":",
"yi... | Utility function to load an array from an iterator, reporting progress
as we go. | [
"Utility",
"function",
"to",
"load",
"an",
"array",
"from",
"an",
"iterator",
"reporting",
"progress",
"as",
"we",
"go",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L538-L554 |
47,823 | alimanfoo/vcfnp | vcfnp/array.py | calldata | def calldata(vcf_fn, region=None, samples=None, ploidy=2, fields=None,
exclude_fields=None, dtypes=None, arities=None, fills=None,
vcf_types=None, count=None, progress=0, logstream=None,
condition=None, slice_args=None, verbose=True, cache=False,
cachedir=None, skip_c... | python | def calldata(vcf_fn, region=None, samples=None, ploidy=2, fields=None,
exclude_fields=None, dtypes=None, arities=None, fills=None,
vcf_types=None, count=None, progress=0, logstream=None,
condition=None, slice_args=None, verbose=True, cache=False,
cachedir=None, skip_c... | [
"def",
"calldata",
"(",
"vcf_fn",
",",
"region",
"=",
"None",
",",
"samples",
"=",
"None",
",",
"ploidy",
"=",
"2",
",",
"fields",
"=",
"None",
",",
"exclude_fields",
"=",
"None",
",",
"dtypes",
"=",
"None",
",",
"arities",
"=",
"None",
",",
"fills",... | Load a numpy 1-dimensional structured array with data from the sample
columns of a VCF file.
Parameters
----------
vcf_fn: string or list
Name of the VCF file or list of file names.
region: string
Region to extract, e.g., 'chr1' or 'chr1:0-100000'.
fields: list or array-like
... | [
"Load",
"a",
"numpy",
"1",
"-",
"dimensional",
"structured",
"array",
"with",
"data",
"from",
"the",
"sample",
"columns",
"of",
"a",
"VCF",
"file",
"."
] | c3f63fb11ada56d4a88076c61c81f99b8ee78b8f | https://github.com/alimanfoo/vcfnp/blob/c3f63fb11ada56d4a88076c61c81f99b8ee78b8f/vcfnp/array.py#L557-L718 |
47,824 | myyang/django-unixtimestampfield | unixtimestampfield/fields.py | TimestampPatchMixin.get_datetimenow | def get_datetimenow(self):
"""
get datetime now according to USE_TZ and default time
"""
value = timezone.datetime.utcnow()
if settings.USE_TZ:
value = timezone.localtime(
timezone.make_aware(value, timezone.utc),
timezone.get_default_t... | python | def get_datetimenow(self):
"""
get datetime now according to USE_TZ and default time
"""
value = timezone.datetime.utcnow()
if settings.USE_TZ:
value = timezone.localtime(
timezone.make_aware(value, timezone.utc),
timezone.get_default_t... | [
"def",
"get_datetimenow",
"(",
"self",
")",
":",
"value",
"=",
"timezone",
".",
"datetime",
".",
"utcnow",
"(",
")",
"if",
"settings",
".",
"USE_TZ",
":",
"value",
"=",
"timezone",
".",
"localtime",
"(",
"timezone",
".",
"make_aware",
"(",
"value",
",",
... | get datetime now according to USE_TZ and default time | [
"get",
"datetime",
"now",
"according",
"to",
"USE_TZ",
"and",
"default",
"time"
] | d647681cd628d1a5cdde8dcbb025bcb9612e9b24 | https://github.com/myyang/django-unixtimestampfield/blob/d647681cd628d1a5cdde8dcbb025bcb9612e9b24/unixtimestampfield/fields.py#L87-L97 |
47,825 | myyang/django-unixtimestampfield | unixtimestampfield/fields.py | TimestampPatchMixin.to_default_timezone_datetime | def to_default_timezone_datetime(self, value):
"""
convert to default timezone datetime
"""
return timezone.localtime(self.to_utc_datetime(value), timezone.get_default_timezone()) | python | def to_default_timezone_datetime(self, value):
"""
convert to default timezone datetime
"""
return timezone.localtime(self.to_utc_datetime(value), timezone.get_default_timezone()) | [
"def",
"to_default_timezone_datetime",
"(",
"self",
",",
"value",
")",
":",
"return",
"timezone",
".",
"localtime",
"(",
"self",
".",
"to_utc_datetime",
"(",
"value",
")",
",",
"timezone",
".",
"get_default_timezone",
"(",
")",
")"
] | convert to default timezone datetime | [
"convert",
"to",
"default",
"timezone",
"datetime"
] | d647681cd628d1a5cdde8dcbb025bcb9612e9b24 | https://github.com/myyang/django-unixtimestampfield/blob/d647681cd628d1a5cdde8dcbb025bcb9612e9b24/unixtimestampfield/fields.py#L165-L169 |
47,826 | Oneiroe/PySimpleAutomata | PySimpleAutomata/automata_IO.py | dfa_json_importer | def dfa_json_importer(input_file: str) -> dict:
""" Imports a DFA from a JSON file.
:param str input_file: path + filename to json file;
:return: *(dict)* representing a DFA.
"""
file = open(input_file)
json_file = json.load(file)
transitions = {} # key [state ∈ states, action ∈ alphabet]... | python | def dfa_json_importer(input_file: str) -> dict:
""" Imports a DFA from a JSON file.
:param str input_file: path + filename to json file;
:return: *(dict)* representing a DFA.
"""
file = open(input_file)
json_file = json.load(file)
transitions = {} # key [state ∈ states, action ∈ alphabet]... | [
"def",
"dfa_json_importer",
"(",
"input_file",
":",
"str",
")",
"->",
"dict",
":",
"file",
"=",
"open",
"(",
"input_file",
")",
"json_file",
"=",
"json",
".",
"load",
"(",
"file",
")",
"transitions",
"=",
"{",
"}",
"# key [state ∈ states, action ∈ alphabet]",
... | Imports a DFA from a JSON file.
:param str input_file: path + filename to json file;
:return: *(dict)* representing a DFA. | [
"Imports",
"a",
"DFA",
"from",
"a",
"JSON",
"file",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/automata_IO.py#L29-L50 |
47,827 | Oneiroe/PySimpleAutomata | PySimpleAutomata/automata_IO.py | dfa_to_json | def dfa_to_json(dfa: dict, name: str, path: str = './'):
""" Exports a DFA to a JSON file.
If *path* do not exists, it will be created.
:param dict dfa: DFA to export;
:param str name: name of the output file;
:param str path: path where to save the JSON file (default:
working... | python | def dfa_to_json(dfa: dict, name: str, path: str = './'):
""" Exports a DFA to a JSON file.
If *path* do not exists, it will be created.
:param dict dfa: DFA to export;
:param str name: name of the output file;
:param str path: path where to save the JSON file (default:
working... | [
"def",
"dfa_to_json",
"(",
"dfa",
":",
"dict",
",",
"name",
":",
"str",
",",
"path",
":",
"str",
"=",
"'./'",
")",
":",
"out",
"=",
"{",
"'alphabet'",
":",
"list",
"(",
"dfa",
"[",
"'alphabet'",
"]",
")",
",",
"'states'",
":",
"list",
"(",
"dfa",... | Exports a DFA to a JSON file.
If *path* do not exists, it will be created.
:param dict dfa: DFA to export;
:param str name: name of the output file;
:param str path: path where to save the JSON file (default:
working directory) | [
"Exports",
"a",
"DFA",
"to",
"a",
"JSON",
"file",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/automata_IO.py#L53-L79 |
47,828 | Oneiroe/PySimpleAutomata | PySimpleAutomata/automata_IO.py | dfa_dot_importer | def dfa_dot_importer(input_file: str) -> dict:
""" Imports a DFA from a DOT file.
Of DOT files are recognized the following attributes:
• nodeX shape=doublecircle -> accepting node;
• nodeX root=true -> initial node;
• edgeX label="a" -> action in alphabet;
• fake [style=invis... | python | def dfa_dot_importer(input_file: str) -> dict:
""" Imports a DFA from a DOT file.
Of DOT files are recognized the following attributes:
• nodeX shape=doublecircle -> accepting node;
• nodeX root=true -> initial node;
• edgeX label="a" -> action in alphabet;
• fake [style=invis... | [
"def",
"dfa_dot_importer",
"(",
"input_file",
":",
"str",
")",
"->",
"dict",
":",
"# pyDot Object",
"g",
"=",
"pydot",
".",
"graph_from_dot_file",
"(",
"input_file",
")",
"[",
"0",
"]",
"states",
"=",
"set",
"(",
")",
"initial_state",
"=",
"None",
"accepti... | Imports a DFA from a DOT file.
Of DOT files are recognized the following attributes:
• nodeX shape=doublecircle -> accepting node;
• nodeX root=true -> initial node;
• edgeX label="a" -> action in alphabet;
• fake [style=invisible] -> dummy invisible node pointing
... | [
"Imports",
"a",
"DFA",
"from",
"a",
"DOT",
"file",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/automata_IO.py#L82-L171 |
47,829 | Oneiroe/PySimpleAutomata | PySimpleAutomata/automata_IO.py | nfa_json_importer | def nfa_json_importer(input_file: str) -> dict:
""" Imports a NFA from a JSON file.
:param str input_file: path+filename to JSON file;
:return: *(dict)* representing a NFA.
"""
file = open(input_file)
json_file = json.load(file)
transitions = {} # key [state in states, action in alphabet]... | python | def nfa_json_importer(input_file: str) -> dict:
""" Imports a NFA from a JSON file.
:param str input_file: path+filename to JSON file;
:return: *(dict)* representing a NFA.
"""
file = open(input_file)
json_file = json.load(file)
transitions = {} # key [state in states, action in alphabet]... | [
"def",
"nfa_json_importer",
"(",
"input_file",
":",
"str",
")",
"->",
"dict",
":",
"file",
"=",
"open",
"(",
"input_file",
")",
"json_file",
"=",
"json",
".",
"load",
"(",
"file",
")",
"transitions",
"=",
"{",
"}",
"# key [state in states, action in alphabet]"... | Imports a NFA from a JSON file.
:param str input_file: path+filename to JSON file;
:return: *(dict)* representing a NFA. | [
"Imports",
"a",
"NFA",
"from",
"a",
"JSON",
"file",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/automata_IO.py#L227-L249 |
47,830 | Oneiroe/PySimpleAutomata | PySimpleAutomata/automata_IO.py | nfa_to_json | def nfa_to_json(nfa: dict, name: str, path: str = './'):
""" Exports a NFA to a JSON file.
:param dict nfa: NFA to export;
:param str name: name of the output file;
:param str path: path where to save the JSON file (default:
working directory).
"""
transitions = list() # k... | python | def nfa_to_json(nfa: dict, name: str, path: str = './'):
""" Exports a NFA to a JSON file.
:param dict nfa: NFA to export;
:param str name: name of the output file;
:param str path: path where to save the JSON file (default:
working directory).
"""
transitions = list() # k... | [
"def",
"nfa_to_json",
"(",
"nfa",
":",
"dict",
",",
"name",
":",
"str",
",",
"path",
":",
"str",
"=",
"'./'",
")",
":",
"transitions",
"=",
"list",
"(",
")",
"# key[state in states, action in alphabet]",
"# value [Set of arriving states in states... | Exports a NFA to a JSON file.
:param dict nfa: NFA to export;
:param str name: name of the output file;
:param str path: path where to save the JSON file (default:
working directory). | [
"Exports",
"a",
"NFA",
"to",
"a",
"JSON",
"file",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/automata_IO.py#L252-L278 |
47,831 | Oneiroe/PySimpleAutomata | PySimpleAutomata/automata_IO.py | nfa_dot_importer | def nfa_dot_importer(input_file: str) -> dict:
""" Imports a NFA from a DOT file.
Of .dot files are recognized the following attributes
• nodeX shape=doublecircle -> accepting node;
• nodeX root=true -> initial node;
• edgeX label="a" -> action in alphabet;
• fakeX style=invisi... | python | def nfa_dot_importer(input_file: str) -> dict:
""" Imports a NFA from a DOT file.
Of .dot files are recognized the following attributes
• nodeX shape=doublecircle -> accepting node;
• nodeX root=true -> initial node;
• edgeX label="a" -> action in alphabet;
• fakeX style=invisi... | [
"def",
"nfa_dot_importer",
"(",
"input_file",
":",
"str",
")",
"->",
"dict",
":",
"# pyDot Object",
"g",
"=",
"pydot",
".",
"graph_from_dot_file",
"(",
"input_file",
")",
"[",
"0",
"]",
"states",
"=",
"set",
"(",
")",
"initial_states",
"=",
"set",
"(",
"... | Imports a NFA from a DOT file.
Of .dot files are recognized the following attributes
• nodeX shape=doublecircle -> accepting node;
• nodeX root=true -> initial node;
• edgeX label="a" -> action in alphabet;
• fakeX style=invisible -> dummy invisible nodes pointing
t... | [
"Imports",
"a",
"NFA",
"from",
"a",
"DOT",
"file",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/automata_IO.py#L281-L378 |
47,832 | Oneiroe/PySimpleAutomata | PySimpleAutomata/automata_IO.py | afw_json_importer | def afw_json_importer(input_file: str) -> dict:
""" Imports a AFW from a JSON file.
:param str input_file: path+filename to input JSON file;
:return: *(dict)* representing a AFW.
"""
file = open(input_file)
json_file = json.load(file)
transitions = {} # key [state in states, action in alp... | python | def afw_json_importer(input_file: str) -> dict:
""" Imports a AFW from a JSON file.
:param str input_file: path+filename to input JSON file;
:return: *(dict)* representing a AFW.
"""
file = open(input_file)
json_file = json.load(file)
transitions = {} # key [state in states, action in alp... | [
"def",
"afw_json_importer",
"(",
"input_file",
":",
"str",
")",
"->",
"dict",
":",
"file",
"=",
"open",
"(",
"input_file",
")",
"json_file",
"=",
"json",
".",
"load",
"(",
"file",
")",
"transitions",
"=",
"{",
"}",
"# key [state in states, action in alphabet]"... | Imports a AFW from a JSON file.
:param str input_file: path+filename to input JSON file;
:return: *(dict)* representing a AFW. | [
"Imports",
"a",
"AFW",
"from",
"a",
"JSON",
"file",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/automata_IO.py#L422-L444 |
47,833 | Oneiroe/PySimpleAutomata | PySimpleAutomata/AFW.py | __recursive_acceptance | def __recursive_acceptance(afw, state, remaining_word):
""" Recursive call for word acceptance.
:param dict afw: input AFW;
:param str state: current state;
:param list remaining_word: list containing the remaining
words.
:return: *(bool)*, True if the word is accepted, fals... | python | def __recursive_acceptance(afw, state, remaining_word):
""" Recursive call for word acceptance.
:param dict afw: input AFW;
:param str state: current state;
:param list remaining_word: list containing the remaining
words.
:return: *(bool)*, True if the word is accepted, fals... | [
"def",
"__recursive_acceptance",
"(",
"afw",
",",
"state",
",",
"remaining_word",
")",
":",
"# the word is accepted only if all the final states are",
"# accepting states",
"if",
"len",
"(",
"remaining_word",
")",
"==",
"0",
":",
"if",
"state",
"in",
"afw",
"[",
"'a... | Recursive call for word acceptance.
:param dict afw: input AFW;
:param str state: current state;
:param list remaining_word: list containing the remaining
words.
:return: *(bool)*, True if the word is accepted, false
otherwise. | [
"Recursive",
"call",
"for",
"word",
"acceptance",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/AFW.py#L39-L103 |
47,834 | Oneiroe/PySimpleAutomata | PySimpleAutomata/AFW.py | afw_completion | def afw_completion(afw):
""" Side effect on input! Complete the afw adding not
present transitions and marking them as False.
:param dict afw: input AFW.
"""
for state in afw['states']:
for a in afw['alphabet']:
if (state, a) not in afw['transitions']:
afw['tran... | python | def afw_completion(afw):
""" Side effect on input! Complete the afw adding not
present transitions and marking them as False.
:param dict afw: input AFW.
"""
for state in afw['states']:
for a in afw['alphabet']:
if (state, a) not in afw['transitions']:
afw['tran... | [
"def",
"afw_completion",
"(",
"afw",
")",
":",
"for",
"state",
"in",
"afw",
"[",
"'states'",
"]",
":",
"for",
"a",
"in",
"afw",
"[",
"'alphabet'",
"]",
":",
"if",
"(",
"state",
",",
"a",
")",
"not",
"in",
"afw",
"[",
"'transitions'",
"]",
":",
"a... | Side effect on input! Complete the afw adding not
present transitions and marking them as False.
:param dict afw: input AFW. | [
"Side",
"effect",
"on",
"input!",
"Complete",
"the",
"afw",
"adding",
"not",
"present",
"transitions",
"and",
"marking",
"them",
"as",
"False",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/AFW.py#L124-L135 |
47,835 | Oneiroe/PySimpleAutomata | PySimpleAutomata/AFW.py | nfa_to_afw_conversion | def nfa_to_afw_conversion(nfa: dict) -> dict:
""" Returns a AFW reading the same language of input NFA.
Let :math:`A = (Σ,S,S^0, ρ,F)` be an nfa. Then we define the
afw AA such that :math:`L(AA) = L(A)` as follows
:math:`AA = (Σ, S ∪ {s_0}, s_0 , ρ_A , F )` where :math:`s_0`
is a new state and :ma... | python | def nfa_to_afw_conversion(nfa: dict) -> dict:
""" Returns a AFW reading the same language of input NFA.
Let :math:`A = (Σ,S,S^0, ρ,F)` be an nfa. Then we define the
afw AA such that :math:`L(AA) = L(A)` as follows
:math:`AA = (Σ, S ∪ {s_0}, s_0 , ρ_A , F )` where :math:`s_0`
is a new state and :ma... | [
"def",
"nfa_to_afw_conversion",
"(",
"nfa",
":",
"dict",
")",
"->",
"dict",
":",
"afw",
"=",
"{",
"'alphabet'",
":",
"nfa",
"[",
"'alphabet'",
"]",
".",
"copy",
"(",
")",
",",
"'states'",
":",
"nfa",
"[",
"'states'",
"]",
".",
"copy",
"(",
")",
","... | Returns a AFW reading the same language of input NFA.
Let :math:`A = (Σ,S,S^0, ρ,F)` be an nfa. Then we define the
afw AA such that :math:`L(AA) = L(A)` as follows
:math:`AA = (Σ, S ∪ {s_0}, s_0 , ρ_A , F )` where :math:`s_0`
is a new state and :math:`ρ_A` is defined as follows:
• :math:`ρ_A(s, ... | [
"Returns",
"a",
"AFW",
"reading",
"the",
"same",
"language",
"of",
"input",
"NFA",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/AFW.py#L138-L187 |
47,836 | Oneiroe/PySimpleAutomata | PySimpleAutomata/AFW.py | afw_to_nfa_conversion | def afw_to_nfa_conversion(afw: dict) -> dict:
""" Returns a NFA reading the same language of input AFW.
Let :math:`A = (Σ, S, s^0 , ρ, F )` be an afw. Then we
define the nfa :math:`A_N` such that :math:`L(A_N) = L(A)`
as follows :math:`AN = (Σ, S_N , S^0_N , ρ_N , F_N )` where:
• :math:`S_N = 2^... | python | def afw_to_nfa_conversion(afw: dict) -> dict:
""" Returns a NFA reading the same language of input AFW.
Let :math:`A = (Σ, S, s^0 , ρ, F )` be an afw. Then we
define the nfa :math:`A_N` such that :math:`L(A_N) = L(A)`
as follows :math:`AN = (Σ, S_N , S^0_N , ρ_N , F_N )` where:
• :math:`S_N = 2^... | [
"def",
"afw_to_nfa_conversion",
"(",
"afw",
":",
"dict",
")",
"->",
"dict",
":",
"nfa",
"=",
"{",
"'alphabet'",
":",
"afw",
"[",
"'alphabet'",
"]",
".",
"copy",
"(",
")",
",",
"'initial_states'",
":",
"{",
"(",
"afw",
"[",
"'initial_state'",
"]",
",",
... | Returns a NFA reading the same language of input AFW.
Let :math:`A = (Σ, S, s^0 , ρ, F )` be an afw. Then we
define the nfa :math:`A_N` such that :math:`L(A_N) = L(A)`
as follows :math:`AN = (Σ, S_N , S^0_N , ρ_N , F_N )` where:
• :math:`S_N = 2^S`
• :math:`S^0_N= \{\{s^0 \}\}`
• :math:`F_... | [
"Returns",
"a",
"NFA",
"reading",
"the",
"same",
"language",
"of",
"input",
"AFW",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/AFW.py#L190-L259 |
47,837 | Oneiroe/PySimpleAutomata | PySimpleAutomata/AFW.py | formula_dual | def formula_dual(input_formula: str) -> str:
""" Returns the dual of the input formula.
The dual operation on formulas in :math:`B^+(X)` is defined as:
the dual :math:`\overline{θ}` of a formula :math:`θ` is obtained from θ by
switching :math:`∧` and :math:`∨`, and
by switching :math:`true` and :ma... | python | def formula_dual(input_formula: str) -> str:
""" Returns the dual of the input formula.
The dual operation on formulas in :math:`B^+(X)` is defined as:
the dual :math:`\overline{θ}` of a formula :math:`θ` is obtained from θ by
switching :math:`∧` and :math:`∨`, and
by switching :math:`true` and :ma... | [
"def",
"formula_dual",
"(",
"input_formula",
":",
"str",
")",
"->",
"str",
":",
"conversion_dictionary",
"=",
"{",
"'and'",
":",
"'or'",
",",
"'or'",
":",
"'and'",
",",
"'True'",
":",
"'False'",
",",
"'False'",
":",
"'True'",
"}",
"return",
"re",
".",
... | Returns the dual of the input formula.
The dual operation on formulas in :math:`B^+(X)` is defined as:
the dual :math:`\overline{θ}` of a formula :math:`θ` is obtained from θ by
switching :math:`∧` and :math:`∨`, and
by switching :math:`true` and :math:`false`.
:param str input_formula: original s... | [
"Returns",
"the",
"dual",
"of",
"the",
"input",
"formula",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/AFW.py#L262-L282 |
47,838 | Oneiroe/PySimpleAutomata | PySimpleAutomata/AFW.py | afw_complementation | def afw_complementation(afw: dict) -> dict:
""" Returns a AFW reading the complemented language read by
input AFW.
Let :math:`A = (Σ, S, s^0 , ρ, F )`. Define :math:`Ā = (Σ, S,
s^0 , \overline{ρ}, S − F )`,
where :math:`\overline{ρ}(s, a) = \overline{ρ(s, a)}` for all
:math:`s ∈ S` and :math:`a... | python | def afw_complementation(afw: dict) -> dict:
""" Returns a AFW reading the complemented language read by
input AFW.
Let :math:`A = (Σ, S, s^0 , ρ, F )`. Define :math:`Ā = (Σ, S,
s^0 , \overline{ρ}, S − F )`,
where :math:`\overline{ρ}(s, a) = \overline{ρ(s, a)}` for all
:math:`s ∈ S` and :math:`a... | [
"def",
"afw_complementation",
"(",
"afw",
":",
"dict",
")",
"->",
"dict",
":",
"completed_input",
"=",
"afw_completion",
"(",
"deepcopy",
"(",
"afw",
")",
")",
"complemented_afw",
"=",
"{",
"'alphabet'",
":",
"completed_input",
"[",
"'alphabet'",
"]",
",",
"... | Returns a AFW reading the complemented language read by
input AFW.
Let :math:`A = (Σ, S, s^0 , ρ, F )`. Define :math:`Ā = (Σ, S,
s^0 , \overline{ρ}, S − F )`,
where :math:`\overline{ρ}(s, a) = \overline{ρ(s, a)}` for all
:math:`s ∈ S` and :math:`a ∈ Σ`.
That is, :math:`\overline{ρ}` is the dual... | [
"Returns",
"a",
"AFW",
"reading",
"the",
"complemented",
"language",
"read",
"by",
"input",
"AFW",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/AFW.py#L285-L316 |
47,839 | Oneiroe/PySimpleAutomata | PySimpleAutomata/AFW.py | afw_union | def afw_union(afw_1: dict, afw_2: dict) -> dict:
""" Returns a AFW that reads the union of the languages read
by input AFWs.
Let :math:`A_1 = (Σ, S_1 , s^0_1, ρ_1 , F_1 )` and :math:`A_2
= (Σ, S_2 , s^0_2, ρ_2 , F_2 )`
be alternating automata accepting the languages :math:`L(
A_1)` and :math:`L... | python | def afw_union(afw_1: dict, afw_2: dict) -> dict:
""" Returns a AFW that reads the union of the languages read
by input AFWs.
Let :math:`A_1 = (Σ, S_1 , s^0_1, ρ_1 , F_1 )` and :math:`A_2
= (Σ, S_2 , s^0_2, ρ_2 , F_2 )`
be alternating automata accepting the languages :math:`L(
A_1)` and :math:`L... | [
"def",
"afw_union",
"(",
"afw_1",
":",
"dict",
",",
"afw_2",
":",
"dict",
")",
"->",
"dict",
":",
"# make sure new root state is unique",
"initial_state",
"=",
"'root'",
"i",
"=",
"0",
"while",
"initial_state",
"in",
"afw_1",
"[",
"'states'",
"]",
"or",
"ini... | Returns a AFW that reads the union of the languages read
by input AFWs.
Let :math:`A_1 = (Σ, S_1 , s^0_1, ρ_1 , F_1 )` and :math:`A_2
= (Σ, S_2 , s^0_2, ρ_2 , F_2 )`
be alternating automata accepting the languages :math:`L(
A_1)` and :math:`L(A_2)`.
Then, :math:`B_∪ = (Σ, S_1 ∪ S_2 ∪ {root}, ρ_... | [
"Returns",
"a",
"AFW",
"that",
"reads",
"the",
"union",
"of",
"the",
"languages",
"read",
"by",
"input",
"AFWs",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/AFW.py#L368-L432 |
47,840 | Oneiroe/PySimpleAutomata | PySimpleAutomata/AFW.py | afw_intersection | def afw_intersection(afw_1: dict, afw_2: dict) -> dict:
""" Returns a AFW that reads the intersection of the
languages read by input AFWs.
Let :math:`A_1 = (Σ, S_1 , s^0_1, ρ_1 , F_1 )` and :math:`A_2
= (Σ, S_2 , s^0_2, ρ_2 , F_2 )`
be alternating automata accepting the languages :math:`L(
A_1)... | python | def afw_intersection(afw_1: dict, afw_2: dict) -> dict:
""" Returns a AFW that reads the intersection of the
languages read by input AFWs.
Let :math:`A_1 = (Σ, S_1 , s^0_1, ρ_1 , F_1 )` and :math:`A_2
= (Σ, S_2 , s^0_2, ρ_2 , F_2 )`
be alternating automata accepting the languages :math:`L(
A_1)... | [
"def",
"afw_intersection",
"(",
"afw_1",
":",
"dict",
",",
"afw_2",
":",
"dict",
")",
"->",
"dict",
":",
"# make sure new root state is unique",
"initial_state",
"=",
"'root'",
"i",
"=",
"0",
"while",
"initial_state",
"in",
"afw_1",
"[",
"'states'",
"]",
"or",... | Returns a AFW that reads the intersection of the
languages read by input AFWs.
Let :math:`A_1 = (Σ, S_1 , s^0_1, ρ_1 , F_1 )` and :math:`A_2
= (Σ, S_2 , s^0_2, ρ_2 , F_2 )`
be alternating automata accepting the languages :math:`L(
A_1)` and :math:`L(A_2)`.
Then, :math:`B_∩ = (Σ, S_1 ∪ S_2 ∪ {ro... | [
"Returns",
"a",
"AFW",
"that",
"reads",
"the",
"intersection",
"of",
"the",
"languages",
"read",
"by",
"input",
"AFWs",
"."
] | 0f9f2705fd8ddd5d8118bc31552a640f5d00c359 | https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/AFW.py#L435-L500 |
47,841 | liamw9534/bt-manager | bt_manager/interface.py | translate_to_dbus_type | def translate_to_dbus_type(typeof, value):
"""
Helper function to map values from their native Python types
to Dbus types.
:param type typeof: Target for type conversion e.g., 'dbus.Dictionary'
:param value: Value to assign using type 'typeof'
:return: 'value' converted to type 'typeof'
:rt... | python | def translate_to_dbus_type(typeof, value):
"""
Helper function to map values from their native Python types
to Dbus types.
:param type typeof: Target for type conversion e.g., 'dbus.Dictionary'
:param value: Value to assign using type 'typeof'
:return: 'value' converted to type 'typeof'
:rt... | [
"def",
"translate_to_dbus_type",
"(",
"typeof",
",",
"value",
")",
":",
"if",
"(",
"(",
"isinstance",
"(",
"value",
",",
"types",
".",
"UnicodeType",
")",
"or",
"isinstance",
"(",
"value",
",",
"str",
")",
")",
"and",
"typeof",
"is",
"not",
"dbus",
"."... | Helper function to map values from their native Python types
to Dbus types.
:param type typeof: Target for type conversion e.g., 'dbus.Dictionary'
:param value: Value to assign using type 'typeof'
:return: 'value' converted to type 'typeof'
:rtype: typeof | [
"Helper",
"function",
"to",
"map",
"values",
"from",
"their",
"native",
"Python",
"types",
"to",
"Dbus",
"types",
"."
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/interface.py#L10-L26 |
47,842 | liamw9534/bt-manager | bt_manager/interface.py | Signal.signal_handler | def signal_handler(self, *args):
"""
Method to call in order to invoke the user callback.
:param args: list of signal-dependent arguments
:return:
"""
self.user_callback(self.signal, self.user_arg, *args) | python | def signal_handler(self, *args):
"""
Method to call in order to invoke the user callback.
:param args: list of signal-dependent arguments
:return:
"""
self.user_callback(self.signal, self.user_arg, *args) | [
"def",
"signal_handler",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"user_callback",
"(",
"self",
".",
"signal",
",",
"self",
".",
"user_arg",
",",
"*",
"args",
")"
] | Method to call in order to invoke the user callback.
:param args: list of signal-dependent arguments
:return: | [
"Method",
"to",
"call",
"in",
"order",
"to",
"invoke",
"the",
"user",
"callback",
"."
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/interface.py#L46-L53 |
47,843 | liamw9534/bt-manager | bt_manager/interface.py | BTInterface.get_property | def get_property(self, name=None):
"""
Helper to get a property value by name or all
properties as a dictionary.
See also :py:meth:`set_property`
:param str name: defaults to None which means all properties
in the object's dictionary are returned as a dict.
... | python | def get_property(self, name=None):
"""
Helper to get a property value by name or all
properties as a dictionary.
See also :py:meth:`set_property`
:param str name: defaults to None which means all properties
in the object's dictionary are returned as a dict.
... | [
"def",
"get_property",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"(",
"name",
")",
":",
"return",
"self",
".",
"_interface",
".",
"GetProperties",
"(",
")",
"[",
"name",
"]",
"else",
":",
"return",
"self",
".",
"_interface",
".",
"GetPro... | Helper to get a property value by name or all
properties as a dictionary.
See also :py:meth:`set_property`
:param str name: defaults to None which means all properties
in the object's dictionary are returned as a dict.
Otherwise, the property name key is used and its va... | [
"Helper",
"to",
"get",
"a",
"property",
"value",
"by",
"name",
"or",
"all",
"properties",
"as",
"a",
"dictionary",
"."
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/interface.py#L170-L191 |
47,844 | liamw9534/bt-manager | bt_manager/interface.py | BTInterface.set_property | def set_property(self, name, value):
"""
Helper to set a property value by name, translating to correct
dbus type
See also :py:meth:`get_property`
:param str name: The property name in the object's dictionary
whose value shall be set.
:param value: Propertie... | python | def set_property(self, name, value):
"""
Helper to set a property value by name, translating to correct
dbus type
See also :py:meth:`get_property`
:param str name: The property name in the object's dictionary
whose value shall be set.
:param value: Propertie... | [
"def",
"set_property",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"typeof",
"=",
"type",
"(",
"self",
".",
"get_property",
"(",
"name",
")",
")",
"self",
".",
"_interface",
".",
"SetProperty",
"(",
"name",
",",
"translate_to_dbus_type",
"(",
"type... | Helper to set a property value by name, translating to correct
dbus type
See also :py:meth:`get_property`
:param str name: The property name in the object's dictionary
whose value shall be set.
:param value: Properties new value to be assigned.
:return:
:rai... | [
"Helper",
"to",
"set",
"a",
"property",
"value",
"by",
"name",
"translating",
"to",
"correct",
"dbus",
"type"
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/interface.py#L193-L211 |
47,845 | pavlov99/jsonapi | jsonapi/serializers.py | DatetimeDecimalEncoder.default | def default(self, o):
""" Encode JSON.
:return str: A JSON encoded string
"""
if isinstance(o, (datetime.datetime, datetime.date, datetime.time)):
return o.isoformat()
if isinstance(o, decimal.Decimal):
return float(o)
return json.JSONEncoder.d... | python | def default(self, o):
""" Encode JSON.
:return str: A JSON encoded string
"""
if isinstance(o, (datetime.datetime, datetime.date, datetime.time)):
return o.isoformat()
if isinstance(o, decimal.Decimal):
return float(o)
return json.JSONEncoder.d... | [
"def",
"default",
"(",
"self",
",",
"o",
")",
":",
"if",
"isinstance",
"(",
"o",
",",
"(",
"datetime",
".",
"datetime",
",",
"datetime",
".",
"date",
",",
"datetime",
".",
"time",
")",
")",
":",
"return",
"o",
".",
"isoformat",
"(",
")",
"if",
"i... | Encode JSON.
:return str: A JSON encoded string | [
"Encode",
"JSON",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/serializers.py#L17-L29 |
47,846 | pavlov99/jsonapi | jsonapi/serializers.py | Serializer.dump_document | def dump_document(cls, instance, fields_own=None, fields_to_many=None):
""" Get document for model_instance.
redefine dump rule for field x: def dump_document_x
:param django.db.models.Model instance: model instance
:param list<Field> or None fields: model_instance field to dump
... | python | def dump_document(cls, instance, fields_own=None, fields_to_many=None):
""" Get document for model_instance.
redefine dump rule for field x: def dump_document_x
:param django.db.models.Model instance: model instance
:param list<Field> or None fields: model_instance field to dump
... | [
"def",
"dump_document",
"(",
"cls",
",",
"instance",
",",
"fields_own",
"=",
"None",
",",
"fields_to_many",
"=",
"None",
")",
":",
"if",
"fields_own",
"is",
"not",
"None",
":",
"fields_own",
"=",
"{",
"f",
".",
"name",
"for",
"f",
"in",
"fields_own",
"... | Get document for model_instance.
redefine dump rule for field x: def dump_document_x
:param django.db.models.Model instance: model instance
:param list<Field> or None fields: model_instance field to dump
:return dict: document
Related documents are not included to current one.... | [
"Get",
"document",
"for",
"model_instance",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/serializers.py#L66-L148 |
47,847 | pavlov99/jsonapi | jsonapi/utils.py | _cached | def _cached(f):
""" Decorator that makes a method cached."""
attr_name = '_cached_' + f.__name__
def wrapper(obj, *args, **kwargs):
if not hasattr(obj, attr_name):
setattr(obj, attr_name, f(obj, *args, **kwargs))
return getattr(obj, attr_name)
return wrapper | python | def _cached(f):
""" Decorator that makes a method cached."""
attr_name = '_cached_' + f.__name__
def wrapper(obj, *args, **kwargs):
if not hasattr(obj, attr_name):
setattr(obj, attr_name, f(obj, *args, **kwargs))
return getattr(obj, attr_name)
return wrapper | [
"def",
"_cached",
"(",
"f",
")",
":",
"attr_name",
"=",
"'_cached_'",
"+",
"f",
".",
"__name__",
"def",
"wrapper",
"(",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"hasattr",
"(",
"obj",
",",
"attr_name",
")",
":",
"s... | Decorator that makes a method cached. | [
"Decorator",
"that",
"makes",
"a",
"method",
"cached",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/utils.py#L21-L30 |
47,848 | pavlov99/jsonapi | jsonapi/model_inspector.py | ModelInspector._filter_child_model_fields | def _filter_child_model_fields(cls, fields):
""" Keep only related model fields.
Example: Inherited models: A -> B -> C
B has one-to-many relationship to BMany.
after inspection BMany would have links to B and C. Keep only B. Parent
model A could not be used (It would not be in ... | python | def _filter_child_model_fields(cls, fields):
""" Keep only related model fields.
Example: Inherited models: A -> B -> C
B has one-to-many relationship to BMany.
after inspection BMany would have links to B and C. Keep only B. Parent
model A could not be used (It would not be in ... | [
"def",
"_filter_child_model_fields",
"(",
"cls",
",",
"fields",
")",
":",
"indexes_to_remove",
"=",
"set",
"(",
"[",
"]",
")",
"for",
"index1",
",",
"field1",
"in",
"enumerate",
"(",
"fields",
")",
":",
"for",
"index2",
",",
"field2",
"in",
"enumerate",
... | Keep only related model fields.
Example: Inherited models: A -> B -> C
B has one-to-many relationship to BMany.
after inspection BMany would have links to B and C. Keep only B. Parent
model A could not be used (It would not be in fields)
:param list fields: model fields.
... | [
"Keep",
"only",
"related",
"model",
"fields",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/model_inspector.py#L113-L139 |
47,849 | python-wink/python-wink | src/pywink/api.py | post_session | def post_session():
"""
This endpoint appears to be required in order to keep pubnub updates flowing for some user.
This just posts a random nonce to the /users/me/session endpoint and returns the result.
"""
url_string = "{}/users/me/session".format(WinkApiInterface.BASE_URL)
nonce = ''.join... | python | def post_session():
"""
This endpoint appears to be required in order to keep pubnub updates flowing for some user.
This just posts a random nonce to the /users/me/session endpoint and returns the result.
"""
url_string = "{}/users/me/session".format(WinkApiInterface.BASE_URL)
nonce = ''.join... | [
"def",
"post_session",
"(",
")",
":",
"url_string",
"=",
"\"{}/users/me/session\"",
".",
"format",
"(",
"WinkApiInterface",
".",
"BASE_URL",
")",
"nonce",
"=",
"''",
".",
"join",
"(",
"[",
"str",
"(",
"random",
".",
"randint",
"(",
"0",
",",
"9",
")",
... | This endpoint appears to be required in order to keep pubnub updates flowing for some user.
This just posts a random nonce to the /users/me/session endpoint and returns the result. | [
"This",
"endpoint",
"appears",
"to",
"be",
"required",
"in",
"order",
"to",
"keep",
"pubnub",
"updates",
"flowing",
"for",
"some",
"user",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/api.py#L464-L483 |
47,850 | python-wink/python-wink | src/pywink/api.py | WinkApiInterface.set_device_state | def set_device_state(self, device, state, id_override=None, type_override=None):
"""
Set device state via online API.
Args:
device (WinkDevice): The device the change is being requested for.
state (Dict): The state being requested.
id_override (String, option... | python | def set_device_state(self, device, state, id_override=None, type_override=None):
"""
Set device state via online API.
Args:
device (WinkDevice): The device the change is being requested for.
state (Dict): The state being requested.
id_override (String, option... | [
"def",
"set_device_state",
"(",
"self",
",",
"device",
",",
"state",
",",
"id_override",
"=",
"None",
",",
"type_override",
"=",
"None",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Setting state via online API\"",
")",
"object_id",
"=",
"id_override",
"or",
"dev... | Set device state via online API.
Args:
device (WinkDevice): The device the change is being requested for.
state (Dict): The state being requested.
id_override (String, optional): A device ID used to override the
passed in device's ID. Used to make changes on ... | [
"Set",
"device",
"state",
"via",
"online",
"API",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/api.py#L40-L84 |
47,851 | python-wink/python-wink | src/pywink/api.py | WinkApiInterface.local_set_state | def local_set_state(self, device, state, id_override=None, type_override=None):
"""
Set device state via local API, and fall back to online API.
Args:
device (WinkDevice): The device the change is being requested for.
state (Dict): The state being requested.
... | python | def local_set_state(self, device, state, id_override=None, type_override=None):
"""
Set device state via local API, and fall back to online API.
Args:
device (WinkDevice): The device the change is being requested for.
state (Dict): The state being requested.
... | [
"def",
"local_set_state",
"(",
"self",
",",
"device",
",",
"state",
",",
"id_override",
"=",
"None",
",",
"type_override",
"=",
"None",
")",
":",
"if",
"ALLOW_LOCAL_CONTROL",
":",
"if",
"device",
".",
"local_id",
"(",
")",
"is",
"not",
"None",
":",
"hub"... | Set device state via local API, and fall back to online API.
Args:
device (WinkDevice): The device the change is being requested for.
state (Dict): The state being requested.
id_override (String, optional): A device ID used to override the
passed in device's ... | [
"Set",
"device",
"state",
"via",
"local",
"API",
"and",
"fall",
"back",
"to",
"online",
"API",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/api.py#L87-L131 |
47,852 | python-wink/python-wink | src/pywink/api.py | WinkApiInterface.get_device_state | def get_device_state(self, device, id_override=None, type_override=None):
"""
Get device state via online API.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override the
passed... | python | def get_device_state(self, device, id_override=None, type_override=None):
"""
Get device state via online API.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override the
passed... | [
"def",
"get_device_state",
"(",
"self",
",",
"device",
",",
"id_override",
"=",
"None",
",",
"type_override",
"=",
"None",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Getting state via online API\"",
")",
"object_id",
"=",
"id_override",
"or",
"device",
".",
"ob... | Get device state via online API.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override the
passed in device's ID. Used to make changes on sub-devices.
i.e. Outlet in a Powerst... | [
"Get",
"device",
"state",
"via",
"online",
"API",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/api.py#L133-L155 |
47,853 | python-wink/python-wink | src/pywink/api.py | WinkApiInterface.local_get_state | def local_get_state(self, device, id_override=None, type_override=None):
"""
Get device state via local API, and fall back to online API.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override... | python | def local_get_state(self, device, id_override=None, type_override=None):
"""
Get device state via local API, and fall back to online API.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override... | [
"def",
"local_get_state",
"(",
"self",
",",
"device",
",",
"id_override",
"=",
"None",
",",
"type_override",
"=",
"None",
")",
":",
"if",
"ALLOW_LOCAL_CONTROL",
":",
"if",
"device",
".",
"local_id",
"(",
")",
"is",
"not",
"None",
":",
"hub",
"=",
"HUBS",... | Get device state via local API, and fall back to online API.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override the
passed in device's ID. Used to make changes on sub-devices.
... | [
"Get",
"device",
"state",
"via",
"local",
"API",
"and",
"fall",
"back",
"to",
"online",
"API",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/api.py#L158-L203 |
47,854 | python-wink/python-wink | src/pywink/api.py | WinkApiInterface.update_firmware | def update_firmware(self, device, id_override=None, type_override=None):
"""
Make a call to the update_firmware endpoint. As far as I know this
is only valid for Wink hubs.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (Stri... | python | def update_firmware(self, device, id_override=None, type_override=None):
"""
Make a call to the update_firmware endpoint. As far as I know this
is only valid for Wink hubs.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (Stri... | [
"def",
"update_firmware",
"(",
"self",
",",
"device",
",",
"id_override",
"=",
"None",
",",
"type_override",
"=",
"None",
")",
":",
"object_id",
"=",
"id_override",
"or",
"device",
".",
"object_id",
"(",
")",
"object_type",
"=",
"type_override",
"or",
"devic... | Make a call to the update_firmware endpoint. As far as I know this
is only valid for Wink hubs.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override the
passed in device's ID. Used t... | [
"Make",
"a",
"call",
"to",
"the",
"update_firmware",
"endpoint",
".",
"As",
"far",
"as",
"I",
"know",
"this",
"is",
"only",
"valid",
"for",
"Wink",
"hubs",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/api.py#L205-L231 |
47,855 | python-wink/python-wink | src/pywink/api.py | WinkApiInterface.remove_device | def remove_device(self, device, id_override=None, type_override=None):
"""
Remove a device.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override the
passed in device's ID. Us... | python | def remove_device(self, device, id_override=None, type_override=None):
"""
Remove a device.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override the
passed in device's ID. Us... | [
"def",
"remove_device",
"(",
"self",
",",
"device",
",",
"id_override",
"=",
"None",
",",
"type_override",
"=",
"None",
")",
":",
"object_id",
"=",
"id_override",
"or",
"device",
".",
"object_id",
"(",
")",
"object_type",
"=",
"type_override",
"or",
"device"... | Remove a device.
Args:
device (WinkDevice): The device the change is being requested for.
id_override (String, optional): A device ID used to override the
passed in device's ID. Used to make changes on sub-devices.
i.e. Outlet in a Powerstrip. The Parent ... | [
"Remove",
"a",
"device",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/api.py#L233-L262 |
47,856 | python-wink/python-wink | src/pywink/api.py | WinkApiInterface.create_lock_key | def create_lock_key(self, device, new_device_json, id_override=None, type_override=None):
"""
Create a new lock key code.
Args:
device (WinkDevice): The device the change is being requested for.
new_device_json (String): The JSON string required to create the device.
... | python | def create_lock_key(self, device, new_device_json, id_override=None, type_override=None):
"""
Create a new lock key code.
Args:
device (WinkDevice): The device the change is being requested for.
new_device_json (String): The JSON string required to create the device.
... | [
"def",
"create_lock_key",
"(",
"self",
",",
"device",
",",
"new_device_json",
",",
"id_override",
"=",
"None",
",",
"type_override",
"=",
"None",
")",
":",
"object_id",
"=",
"id_override",
"or",
"device",
".",
"object_id",
"(",
")",
"object_type",
"=",
"type... | Create a new lock key code.
Args:
device (WinkDevice): The device the change is being requested for.
new_device_json (String): The JSON string required to create the device.
id_override (String, optional): A device ID used to override the
passed in device's I... | [
"Create",
"a",
"new",
"lock",
"key",
"code",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/api.py#L264-L291 |
47,857 | pavlov99/jsonapi | jsonapi/resource.py | get_concrete_model | def get_concrete_model(model):
""" Get model defined in Meta.
:param str or django.db.models.Model model:
:return: model or None
:rtype django.db.models.Model or None:
:raise ValueError: model is not found or abstract
"""
if not(inspect.isclass(model) and issubclass(model, models.Model)):
... | python | def get_concrete_model(model):
""" Get model defined in Meta.
:param str or django.db.models.Model model:
:return: model or None
:rtype django.db.models.Model or None:
:raise ValueError: model is not found or abstract
"""
if not(inspect.isclass(model) and issubclass(model, models.Model)):
... | [
"def",
"get_concrete_model",
"(",
"model",
")",
":",
"if",
"not",
"(",
"inspect",
".",
"isclass",
"(",
"model",
")",
"and",
"issubclass",
"(",
"model",
",",
"models",
".",
"Model",
")",
")",
":",
"model",
"=",
"get_model_by_name",
"(",
"model",
")",
"r... | Get model defined in Meta.
:param str or django.db.models.Model model:
:return: model or None
:rtype django.db.models.Model or None:
:raise ValueError: model is not found or abstract | [
"Get",
"model",
"defined",
"in",
"Meta",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/resource.py#L67-L79 |
47,858 | pavlov99/jsonapi | jsonapi/resource.py | get_resource_name | def get_resource_name(meta):
""" Define resource name based on Meta information.
:param Resource.Meta meta: resource meta information
:return: name of resource
:rtype: str
:raises ValueError:
"""
if meta.name is None and not meta.is_model:
msg = "Either name or model for resource.M... | python | def get_resource_name(meta):
""" Define resource name based on Meta information.
:param Resource.Meta meta: resource meta information
:return: name of resource
:rtype: str
:raises ValueError:
"""
if meta.name is None and not meta.is_model:
msg = "Either name or model for resource.M... | [
"def",
"get_resource_name",
"(",
"meta",
")",
":",
"if",
"meta",
".",
"name",
"is",
"None",
"and",
"not",
"meta",
".",
"is_model",
":",
"msg",
"=",
"\"Either name or model for resource.Meta shoud be provided\"",
"raise",
"ValueError",
"(",
"msg",
")",
"name",
"=... | Define resource name based on Meta information.
:param Resource.Meta meta: resource meta information
:return: name of resource
:rtype: str
:raises ValueError: | [
"Define",
"resource",
"name",
"based",
"on",
"Meta",
"information",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/resource.py#L82-L96 |
47,859 | pavlov99/jsonapi | jsonapi/resource.py | merge_metas | def merge_metas(*metas):
""" Merge meta parameters.
next meta has priority over current, it will overwrite attributes.
:param class or None meta: class with properties.
:return class: merged meta.
"""
metadict = {}
for meta in metas:
metadict.update(meta.__dict__)
metadict = ... | python | def merge_metas(*metas):
""" Merge meta parameters.
next meta has priority over current, it will overwrite attributes.
:param class or None meta: class with properties.
:return class: merged meta.
"""
metadict = {}
for meta in metas:
metadict.update(meta.__dict__)
metadict = ... | [
"def",
"merge_metas",
"(",
"*",
"metas",
")",
":",
"metadict",
"=",
"{",
"}",
"for",
"meta",
"in",
"metas",
":",
"metadict",
".",
"update",
"(",
"meta",
".",
"__dict__",
")",
"metadict",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"metad... | Merge meta parameters.
next meta has priority over current, it will overwrite attributes.
:param class or None meta: class with properties.
:return class: merged meta. | [
"Merge",
"meta",
"parameters",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/resource.py#L99-L113 |
47,860 | python-wink/python-wink | src/pywink/devices/scene.py | WinkScene.activate | def activate(self):
"""
Activate the scene.
"""
response = self.api_interface.set_device_state(self, None)
self._update_state_from_response(response) | python | def activate(self):
"""
Activate the scene.
"""
response = self.api_interface.set_device_state(self, None)
self._update_state_from_response(response) | [
"def",
"activate",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"api_interface",
".",
"set_device_state",
"(",
"self",
",",
"None",
")",
"self",
".",
"_update_state_from_response",
"(",
"response",
")"
] | Activate the scene. | [
"Activate",
"the",
"scene",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/devices/scene.py#L23-L28 |
47,861 | pavlov99/jsonapi | jsonapi/django_utils.py | get_model_by_name | def get_model_by_name(model_name):
""" Get model by its name.
:param str model_name: name of model.
:return django.db.models.Model:
Example:
get_concrete_model_by_name('auth.User')
django.contrib.auth.models.User
"""
if isinstance(model_name, six.string_types) and \
... | python | def get_model_by_name(model_name):
""" Get model by its name.
:param str model_name: name of model.
:return django.db.models.Model:
Example:
get_concrete_model_by_name('auth.User')
django.contrib.auth.models.User
"""
if isinstance(model_name, six.string_types) and \
... | [
"def",
"get_model_by_name",
"(",
"model_name",
")",
":",
"if",
"isinstance",
"(",
"model_name",
",",
"six",
".",
"string_types",
")",
"and",
"len",
"(",
"model_name",
".",
"split",
"(",
"'.'",
")",
")",
"==",
"2",
":",
"app_name",
",",
"model_name",
"=",... | Get model by its name.
:param str model_name: name of model.
:return django.db.models.Model:
Example:
get_concrete_model_by_name('auth.User')
django.contrib.auth.models.User | [
"Get",
"model",
"by",
"its",
"name",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/django_utils.py#L12-L35 |
47,862 | pavlov99/jsonapi | jsonapi/django_utils.py | get_model_name | def get_model_name(model):
""" Get model name for the field.
Django 1.5 uses module_name, does not support model_name
Django 1.6 uses module_name and model_name
DJango 1.7 uses model_name, module_name raises RemovedInDjango18Warning
"""
opts = model._meta
if django.VERSION[:2] < (1, 7):
... | python | def get_model_name(model):
""" Get model name for the field.
Django 1.5 uses module_name, does not support model_name
Django 1.6 uses module_name and model_name
DJango 1.7 uses model_name, module_name raises RemovedInDjango18Warning
"""
opts = model._meta
if django.VERSION[:2] < (1, 7):
... | [
"def",
"get_model_name",
"(",
"model",
")",
":",
"opts",
"=",
"model",
".",
"_meta",
"if",
"django",
".",
"VERSION",
"[",
":",
"2",
"]",
"<",
"(",
"1",
",",
"7",
")",
":",
"model_name",
"=",
"opts",
".",
"module_name",
"else",
":",
"model_name",
"=... | Get model name for the field.
Django 1.5 uses module_name, does not support model_name
Django 1.6 uses module_name and model_name
DJango 1.7 uses model_name, module_name raises RemovedInDjango18Warning | [
"Get",
"model",
"name",
"for",
"the",
"field",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/django_utils.py#L38-L52 |
47,863 | pavlov99/jsonapi | jsonapi/django_utils.py | clear_app_cache | def clear_app_cache(app_name):
""" Clear django cache for models.
:param str ap_name: name of application to clear model cache
"""
loading_cache = django.db.models.loading.cache
if django.VERSION[:2] < (1, 7):
loading_cache.app_models[app_name].clear()
else:
loading_cache.all_... | python | def clear_app_cache(app_name):
""" Clear django cache for models.
:param str ap_name: name of application to clear model cache
"""
loading_cache = django.db.models.loading.cache
if django.VERSION[:2] < (1, 7):
loading_cache.app_models[app_name].clear()
else:
loading_cache.all_... | [
"def",
"clear_app_cache",
"(",
"app_name",
")",
":",
"loading_cache",
"=",
"django",
".",
"db",
".",
"models",
".",
"loading",
".",
"cache",
"if",
"django",
".",
"VERSION",
"[",
":",
"2",
"]",
"<",
"(",
"1",
",",
"7",
")",
":",
"loading_cache",
".",
... | Clear django cache for models.
:param str ap_name: name of application to clear model cache | [
"Clear",
"django",
"cache",
"for",
"models",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/django_utils.py#L55-L66 |
47,864 | liamw9534/bt-manager | bt_manager/codecs.py | SBCCodec._init_sbc_config | def _init_sbc_config(self, config):
"""
Translator from namedtuple config representation to
the sbc_t type.
:param namedtuple config: See :py:class:`.SBCCodecConfig`
:returns:
"""
if (config.channel_mode == SBCChannelMode.CHANNEL_MODE_MONO):
self.conf... | python | def _init_sbc_config(self, config):
"""
Translator from namedtuple config representation to
the sbc_t type.
:param namedtuple config: See :py:class:`.SBCCodecConfig`
:returns:
"""
if (config.channel_mode == SBCChannelMode.CHANNEL_MODE_MONO):
self.conf... | [
"def",
"_init_sbc_config",
"(",
"self",
",",
"config",
")",
":",
"if",
"(",
"config",
".",
"channel_mode",
"==",
"SBCChannelMode",
".",
"CHANNEL_MODE_MONO",
")",
":",
"self",
".",
"config",
".",
"mode",
"=",
"self",
".",
"codec",
".",
"SBC_MODE_MONO",
"eli... | Translator from namedtuple config representation to
the sbc_t type.
:param namedtuple config: See :py:class:`.SBCCodecConfig`
:returns: | [
"Translator",
"from",
"namedtuple",
"config",
"representation",
"to",
"the",
"sbc_t",
"type",
"."
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/codecs.py#L111-L157 |
47,865 | liamw9534/bt-manager | bt_manager/codecs.py | SBCCodec.decode | def decode(self, fd, mtu, max_len=2560):
"""
Read the media transport descriptor, depay
the RTP payload and decode the SBC frames into
a byte array. The maximum number of bytes to
be returned may be passed as an argument and all
available bytes are returned to the caller... | python | def decode(self, fd, mtu, max_len=2560):
"""
Read the media transport descriptor, depay
the RTP payload and decode the SBC frames into
a byte array. The maximum number of bytes to
be returned may be passed as an argument and all
available bytes are returned to the caller... | [
"def",
"decode",
"(",
"self",
",",
"fd",
",",
"mtu",
",",
"max_len",
"=",
"2560",
")",
":",
"output_buffer",
"=",
"ffi",
".",
"new",
"(",
"'char[]'",
",",
"max_len",
")",
"sz",
"=",
"self",
".",
"codec",
".",
"rtp_sbc_decode_from_fd",
"(",
"self",
".... | Read the media transport descriptor, depay
the RTP payload and decode the SBC frames into
a byte array. The maximum number of bytes to
be returned may be passed as an argument and all
available bytes are returned to the caller.
:param int fd: Media transport file descriptor
... | [
"Read",
"the",
"media",
"transport",
"descriptor",
"depay",
"the",
"RTP",
"payload",
"and",
"decode",
"the",
"SBC",
"frames",
"into",
"a",
"byte",
"array",
".",
"The",
"maximum",
"number",
"of",
"bytes",
"to",
"be",
"returned",
"may",
"be",
"passed",
"as",... | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/codecs.py#L183-L205 |
47,866 | liamw9534/bt-manager | bt_manager/audio.py | SBCAudioCodec._transport_ready_handler | def _transport_ready_handler(self, fd, cb_condition):
"""
Wrapper for calling user callback routine to notify
when transport data is ready to read
"""
if(self.user_cb):
self.user_cb(self.user_arg)
return True | python | def _transport_ready_handler(self, fd, cb_condition):
"""
Wrapper for calling user callback routine to notify
when transport data is ready to read
"""
if(self.user_cb):
self.user_cb(self.user_arg)
return True | [
"def",
"_transport_ready_handler",
"(",
"self",
",",
"fd",
",",
"cb_condition",
")",
":",
"if",
"(",
"self",
".",
"user_cb",
")",
":",
"self",
".",
"user_cb",
"(",
"self",
".",
"user_arg",
")",
"return",
"True"
] | Wrapper for calling user callback routine to notify
when transport data is ready to read | [
"Wrapper",
"for",
"calling",
"user",
"callback",
"routine",
"to",
"notify",
"when",
"transport",
"data",
"is",
"ready",
"to",
"read"
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L184-L191 |
47,867 | liamw9534/bt-manager | bt_manager/audio.py | SBCAudioCodec.read_transport | def read_transport(self):
"""
Read data from media transport.
The returned data payload is SBC decoded and has
all RTP encapsulation removed.
:return data: Payload data that has been decoded,
with RTP encapsulation removed.
:rtype: array{byte}
"""
... | python | def read_transport(self):
"""
Read data from media transport.
The returned data payload is SBC decoded and has
all RTP encapsulation removed.
:return data: Payload data that has been decoded,
with RTP encapsulation removed.
:rtype: array{byte}
"""
... | [
"def",
"read_transport",
"(",
"self",
")",
":",
"if",
"(",
"'r'",
"not",
"in",
"self",
".",
"access_type",
")",
":",
"raise",
"BTIncompatibleTransportAccessType",
"return",
"self",
".",
"codec",
".",
"decode",
"(",
"self",
".",
"fd",
",",
"self",
".",
"r... | Read data from media transport.
The returned data payload is SBC decoded and has
all RTP encapsulation removed.
:return data: Payload data that has been decoded,
with RTP encapsulation removed.
:rtype: array{byte} | [
"Read",
"data",
"from",
"media",
"transport",
".",
"The",
"returned",
"data",
"payload",
"is",
"SBC",
"decoded",
"and",
"has",
"all",
"RTP",
"encapsulation",
"removed",
"."
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L238-L250 |
47,868 | liamw9534/bt-manager | bt_manager/audio.py | SBCAudioCodec.write_transport | def write_transport(self, data):
"""
Write data to media transport. The data is
encoded using the SBC codec and RTP encapsulated
before being written to the transport file
descriptor.
:param array{byte} data: Payload data to encode,
encapsulate and send.
... | python | def write_transport(self, data):
"""
Write data to media transport. The data is
encoded using the SBC codec and RTP encapsulated
before being written to the transport file
descriptor.
:param array{byte} data: Payload data to encode,
encapsulate and send.
... | [
"def",
"write_transport",
"(",
"self",
",",
"data",
")",
":",
"if",
"(",
"'w'",
"not",
"in",
"self",
".",
"access_type",
")",
":",
"raise",
"BTIncompatibleTransportAccessType",
"return",
"self",
".",
"codec",
".",
"encode",
"(",
"self",
".",
"fd",
",",
"... | Write data to media transport. The data is
encoded using the SBC codec and RTP encapsulated
before being written to the transport file
descriptor.
:param array{byte} data: Payload data to encode,
encapsulate and send. | [
"Write",
"data",
"to",
"media",
"transport",
".",
"The",
"data",
"is",
"encoded",
"using",
"the",
"SBC",
"codec",
"and",
"RTP",
"encapsulated",
"before",
"being",
"written",
"to",
"the",
"transport",
"file",
"descriptor",
"."
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L252-L264 |
47,869 | liamw9534/bt-manager | bt_manager/audio.py | SBCAudioCodec.close_transport | def close_transport(self):
"""
Forcibly close previously acquired media transport.
.. note:: The user should first make sure any transport
event handlers are unregistered first.
"""
if (self.path):
self._release_media_transport(self.path,
... | python | def close_transport(self):
"""
Forcibly close previously acquired media transport.
.. note:: The user should first make sure any transport
event handlers are unregistered first.
"""
if (self.path):
self._release_media_transport(self.path,
... | [
"def",
"close_transport",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"path",
")",
":",
"self",
".",
"_release_media_transport",
"(",
"self",
".",
"path",
",",
"self",
".",
"access_type",
")",
"self",
".",
"path",
"=",
"None"
] | Forcibly close previously acquired media transport.
.. note:: The user should first make sure any transport
event handlers are unregistered first. | [
"Forcibly",
"close",
"previously",
"acquired",
"media",
"transport",
"."
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L266-L276 |
47,870 | liamw9534/bt-manager | bt_manager/audio.py | SBCAudioCodec._acquire_media_transport | def _acquire_media_transport(self, path, access_type):
"""
Should be called by subclass when it is ready
to acquire the media transport file descriptor
"""
transport = BTMediaTransport(path=path)
(fd, read_mtu, write_mtu) = transport.acquire(access_type)
self.fd =... | python | def _acquire_media_transport(self, path, access_type):
"""
Should be called by subclass when it is ready
to acquire the media transport file descriptor
"""
transport = BTMediaTransport(path=path)
(fd, read_mtu, write_mtu) = transport.acquire(access_type)
self.fd =... | [
"def",
"_acquire_media_transport",
"(",
"self",
",",
"path",
",",
"access_type",
")",
":",
"transport",
"=",
"BTMediaTransport",
"(",
"path",
"=",
"path",
")",
"(",
"fd",
",",
"read_mtu",
",",
"write_mtu",
")",
"=",
"transport",
".",
"acquire",
"(",
"acces... | Should be called by subclass when it is ready
to acquire the media transport file descriptor | [
"Should",
"be",
"called",
"by",
"subclass",
"when",
"it",
"is",
"ready",
"to",
"acquire",
"the",
"media",
"transport",
"file",
"descriptor"
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L285-L297 |
47,871 | liamw9534/bt-manager | bt_manager/audio.py | SBCAudioCodec._release_media_transport | def _release_media_transport(self, path, access_type):
"""
Should be called by subclass when it is finished
with the media transport file descriptor
"""
try:
self._uninstall_transport_ready()
os.close(self.fd) # Clean-up previously taken fd
t... | python | def _release_media_transport(self, path, access_type):
"""
Should be called by subclass when it is finished
with the media transport file descriptor
"""
try:
self._uninstall_transport_ready()
os.close(self.fd) # Clean-up previously taken fd
t... | [
"def",
"_release_media_transport",
"(",
"self",
",",
"path",
",",
"access_type",
")",
":",
"try",
":",
"self",
".",
"_uninstall_transport_ready",
"(",
")",
"os",
".",
"close",
"(",
"self",
".",
"fd",
")",
"# Clean-up previously taken fd",
"transport",
"=",
"BT... | Should be called by subclass when it is finished
with the media transport file descriptor | [
"Should",
"be",
"called",
"by",
"subclass",
"when",
"it",
"is",
"finished",
"with",
"the",
"media",
"transport",
"file",
"descriptor"
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L299-L310 |
47,872 | liamw9534/bt-manager | bt_manager/audio.py | SBCAudioCodec._make_config | def _make_config(config):
"""Helper to turn SBC codec configuration params into a
a2dp_sbc_t structure usable by bluez"""
# The SBC config encoding is taken from a2dp_codecs.h, in particular,
# the a2dp_sbc_t type is converted into a 4-byte array:
# uint8_t channel_mode:4
... | python | def _make_config(config):
"""Helper to turn SBC codec configuration params into a
a2dp_sbc_t structure usable by bluez"""
# The SBC config encoding is taken from a2dp_codecs.h, in particular,
# the a2dp_sbc_t type is converted into a 4-byte array:
# uint8_t channel_mode:4
... | [
"def",
"_make_config",
"(",
"config",
")",
":",
"# The SBC config encoding is taken from a2dp_codecs.h, in particular,",
"# the a2dp_sbc_t type is converted into a 4-byte array:",
"# uint8_t channel_mode:4",
"# uint8_t frequency:4",
"# uint8_t allocation_method:2",
"# uint8_t subbands:... | Helper to turn SBC codec configuration params into a
a2dp_sbc_t structure usable by bluez | [
"Helper",
"to",
"turn",
"SBC",
"codec",
"configuration",
"params",
"into",
"a",
"a2dp_sbc_t",
"structure",
"usable",
"by",
"bluez"
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L353-L371 |
47,873 | liamw9534/bt-manager | bt_manager/audio.py | SBCAudioCodec._parse_config | def _parse_config(config):
"""Helper to turn a2dp_sbc_t structure into a
more usable set of SBC codec configuration params"""
frequency = config[0] >> 4
channel_mode = config[0] & 0xF
allocation_method = config[1] & 0x03
subbands = (config[1] >> 2) & 0x03
block_le... | python | def _parse_config(config):
"""Helper to turn a2dp_sbc_t structure into a
more usable set of SBC codec configuration params"""
frequency = config[0] >> 4
channel_mode = config[0] & 0xF
allocation_method = config[1] & 0x03
subbands = (config[1] >> 2) & 0x03
block_le... | [
"def",
"_parse_config",
"(",
"config",
")",
":",
"frequency",
"=",
"config",
"[",
"0",
"]",
">>",
"4",
"channel_mode",
"=",
"config",
"[",
"0",
"]",
"&",
"0xF",
"allocation_method",
"=",
"config",
"[",
"1",
"]",
"&",
"0x03",
"subbands",
"=",
"(",
"co... | Helper to turn a2dp_sbc_t structure into a
more usable set of SBC codec configuration params | [
"Helper",
"to",
"turn",
"a2dp_sbc_t",
"structure",
"into",
"a",
"more",
"usable",
"set",
"of",
"SBC",
"codec",
"configuration",
"params"
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L374-L385 |
47,874 | python-wink/python-wink | src/pywink/devices/lock.py | WinkLock.add_new_key | def add_new_key(self, code, name):
"""Add a new user key code."""
device_json = {"code": code, "name": name}
return self.api_interface.create_lock_key(self, device_json) | python | def add_new_key(self, code, name):
"""Add a new user key code."""
device_json = {"code": code, "name": name}
return self.api_interface.create_lock_key(self, device_json) | [
"def",
"add_new_key",
"(",
"self",
",",
"code",
",",
"name",
")",
":",
"device_json",
"=",
"{",
"\"code\"",
":",
"code",
",",
"\"name\"",
":",
"name",
"}",
"return",
"self",
".",
"api_interface",
".",
"create_lock_key",
"(",
"self",
",",
"device_json",
"... | Add a new user key code. | [
"Add",
"a",
"new",
"user",
"key",
"code",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/devices/lock.py#L90-L93 |
47,875 | liamw9534/bt-manager | bt_manager/adapter.py | BTAdapter.create_paired_device | def create_paired_device(self, dev_id, agent_path,
capability, cb_notify_device, cb_notify_error):
"""
Creates a new object path for a remote device. This
method will connect to the remote device and retrieve
all SDP records and then initiate the pairing.
... | python | def create_paired_device(self, dev_id, agent_path,
capability, cb_notify_device, cb_notify_error):
"""
Creates a new object path for a remote device. This
method will connect to the remote device and retrieve
all SDP records and then initiate the pairing.
... | [
"def",
"create_paired_device",
"(",
"self",
",",
"dev_id",
",",
"agent_path",
",",
"capability",
",",
"cb_notify_device",
",",
"cb_notify_error",
")",
":",
"return",
"self",
".",
"_interface",
".",
"CreatePairedDevice",
"(",
"dev_id",
",",
"agent_path",
",",
"ca... | Creates a new object path for a remote device. This
method will connect to the remote device and retrieve
all SDP records and then initiate the pairing.
If a previously :py:meth:`create_device` was used
successfully, this method will only initiate the pairing.
Compared to :py:m... | [
"Creates",
"a",
"new",
"object",
"path",
"for",
"a",
"remote",
"device",
".",
"This",
"method",
"will",
"connect",
"to",
"the",
"remote",
"device",
"and",
"retrieve",
"all",
"SDP",
"records",
"and",
"then",
"initiate",
"the",
"pairing",
"."
] | 51be2919394ce8134c698359649bfad09eedf4ec | https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/adapter.py#L185-L226 |
47,876 | xZise/flake8-string-format | flake8_string_format.py | TextVisitor._visit_body | def _visit_body(self, node):
"""
Traverse the body of the node manually.
If the first node is an expression which contains a string or bytes it
marks that as a docstring.
"""
if (node.body and isinstance(node.body[0], ast.Expr) and
self.is_base_string(nod... | python | def _visit_body(self, node):
"""
Traverse the body of the node manually.
If the first node is an expression which contains a string or bytes it
marks that as a docstring.
"""
if (node.body and isinstance(node.body[0], ast.Expr) and
self.is_base_string(nod... | [
"def",
"_visit_body",
"(",
"self",
",",
"node",
")",
":",
"if",
"(",
"node",
".",
"body",
"and",
"isinstance",
"(",
"node",
".",
"body",
"[",
"0",
"]",
",",
"ast",
".",
"Expr",
")",
"and",
"self",
".",
"is_base_string",
"(",
"node",
".",
"body",
... | Traverse the body of the node manually.
If the first node is an expression which contains a string or bytes it
marks that as a docstring. | [
"Traverse",
"the",
"body",
"of",
"the",
"node",
"manually",
"."
] | 5d1538d3c91e3e8e8a7761e1bf8c5725f85c9747 | https://github.com/xZise/flake8-string-format/blob/5d1538d3c91e3e8e8a7761e1bf8c5725f85c9747/flake8_string_format.py#L148-L161 |
47,877 | claymation/python-builtwith | builtwith.py | BuiltWith.lookup | def lookup(self, domain, get_last_full_query=True):
"""
Lookup BuiltWith results for the given domain. If API version 2 is used and the get_last_full_query flag
enabled, it also queries for the date of the last full BuiltWith scan.
"""
last_full_builtwith_scan_date = None
... | python | def lookup(self, domain, get_last_full_query=True):
"""
Lookup BuiltWith results for the given domain. If API version 2 is used and the get_last_full_query flag
enabled, it also queries for the date of the last full BuiltWith scan.
"""
last_full_builtwith_scan_date = None
... | [
"def",
"lookup",
"(",
"self",
",",
"domain",
",",
"get_last_full_query",
"=",
"True",
")",
":",
"last_full_builtwith_scan_date",
"=",
"None",
"if",
"self",
".",
"api_version",
"==",
"7",
"and",
"isinstance",
"(",
"domain",
",",
"list",
")",
":",
"domain",
... | Lookup BuiltWith results for the given domain. If API version 2 is used and the get_last_full_query flag
enabled, it also queries for the date of the last full BuiltWith scan. | [
"Lookup",
"BuiltWith",
"results",
"for",
"the",
"given",
"domain",
".",
"If",
"API",
"version",
"2",
"is",
"used",
"and",
"the",
"get_last_full_query",
"flag",
"enabled",
"it",
"also",
"queries",
"for",
"the",
"date",
"of",
"the",
"last",
"full",
"BuiltWith"... | c7af08dd90586b5c0442c8c1ebce0009361bc91c | https://github.com/claymation/python-builtwith/blob/c7af08dd90586b5c0442c8c1ebce0009361bc91c/builtwith.py#L127-L160 |
47,878 | pavlov99/jsonapi | jsonapi/api.py | API.register | def register(self, resource=None, **kwargs):
""" Register resource for currnet API.
:param resource: Resource to be registered
:type resource: jsonapi.resource.Resource or None
:return: resource
:rtype: jsonapi.resource.Resource
.. versionadded:: 0.4.1
:param kw... | python | def register(self, resource=None, **kwargs):
""" Register resource for currnet API.
:param resource: Resource to be registered
:type resource: jsonapi.resource.Resource or None
:return: resource
:rtype: jsonapi.resource.Resource
.. versionadded:: 0.4.1
:param kw... | [
"def",
"register",
"(",
"self",
",",
"resource",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"resource",
"is",
"None",
":",
"def",
"wrapper",
"(",
"resource",
")",
":",
"return",
"self",
".",
"register",
"(",
"resource",
",",
"*",
"*",
"k... | Register resource for currnet API.
:param resource: Resource to be registered
:type resource: jsonapi.resource.Resource or None
:return: resource
:rtype: jsonapi.resource.Resource
.. versionadded:: 0.4.1
:param kwargs: Extra meta parameters | [
"Register",
"resource",
"for",
"currnet",
"API",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L69-L109 |
47,879 | pavlov99/jsonapi | jsonapi/api.py | API.urls | def urls(self):
""" Get all of the api endpoints.
NOTE: only for django as of now.
NOTE: urlpatterns are deprecated since Django1.8
:return list: urls
"""
from django.conf.urls import url
urls = [
url(r'^$', self.documentation),
url(r'^m... | python | def urls(self):
""" Get all of the api endpoints.
NOTE: only for django as of now.
NOTE: urlpatterns are deprecated since Django1.8
:return list: urls
"""
from django.conf.urls import url
urls = [
url(r'^$', self.documentation),
url(r'^m... | [
"def",
"urls",
"(",
"self",
")",
":",
"from",
"django",
".",
"conf",
".",
"urls",
"import",
"url",
"urls",
"=",
"[",
"url",
"(",
"r'^$'",
",",
"self",
".",
"documentation",
")",
",",
"url",
"(",
"r'^map$'",
",",
"self",
".",
"map_view",
")",
",",
... | Get all of the api endpoints.
NOTE: only for django as of now.
NOTE: urlpatterns are deprecated since Django1.8
:return list: urls | [
"Get",
"all",
"of",
"the",
"api",
"endpoints",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L112-L135 |
47,880 | pavlov99/jsonapi | jsonapi/api.py | API.update_urls | def update_urls(self, request, resource_name=None, ids=None):
""" Update url configuration.
:param request:
:param resource_name:
:type resource_name: str or None
:param ids:
:rtype: None
"""
http_host = request.META.get('HTTP_HOST', None)
if ht... | python | def update_urls(self, request, resource_name=None, ids=None):
""" Update url configuration.
:param request:
:param resource_name:
:type resource_name: str or None
:param ids:
:rtype: None
"""
http_host = request.META.get('HTTP_HOST', None)
if ht... | [
"def",
"update_urls",
"(",
"self",
",",
"request",
",",
"resource_name",
"=",
"None",
",",
"ids",
"=",
"None",
")",
":",
"http_host",
"=",
"request",
".",
"META",
".",
"get",
"(",
"'HTTP_HOST'",
",",
"None",
")",
"if",
"http_host",
"is",
"None",
":",
... | Update url configuration.
:param request:
:param resource_name:
:type resource_name: str or None
:param ids:
:rtype: None | [
"Update",
"url",
"configuration",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L137-L166 |
47,881 | pavlov99/jsonapi | jsonapi/api.py | API.map_view | def map_view(self, request):
""" Show information about available resources.
.. versionadded:: 0.5.7
Content-Type check
:return django.http.HttpResponse
"""
self.update_urls(request)
resource_info = {
"resources": [{
"id": index ... | python | def map_view(self, request):
""" Show information about available resources.
.. versionadded:: 0.5.7
Content-Type check
:return django.http.HttpResponse
"""
self.update_urls(request)
resource_info = {
"resources": [{
"id": index ... | [
"def",
"map_view",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"update_urls",
"(",
"request",
")",
"resource_info",
"=",
"{",
"\"resources\"",
":",
"[",
"{",
"\"id\"",
":",
"index",
"+",
"1",
",",
"\"href\"",
":",
"\"{}/{}\"",
".",
"format",
"(... | Show information about available resources.
.. versionadded:: 0.5.7
Content-Type check
:return django.http.HttpResponse | [
"Show",
"information",
"about",
"available",
"resources",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L168-L189 |
47,882 | pavlov99/jsonapi | jsonapi/api.py | API.documentation | def documentation(self, request):
""" Resource documentation.
.. versionadded:: 0.7.2
Content-Type check
:return django.http.HttpResponse
"""
self.update_urls(request)
context = {
"resources": sorted(self.resource_map.items())
}
... | python | def documentation(self, request):
""" Resource documentation.
.. versionadded:: 0.7.2
Content-Type check
:return django.http.HttpResponse
"""
self.update_urls(request)
context = {
"resources": sorted(self.resource_map.items())
}
... | [
"def",
"documentation",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"update_urls",
"(",
"request",
")",
"context",
"=",
"{",
"\"resources\"",
":",
"sorted",
"(",
"self",
".",
"resource_map",
".",
"items",
"(",
")",
")",
"}",
"return",
"render",
... | Resource documentation.
.. versionadded:: 0.7.2
Content-Type check
:return django.http.HttpResponse | [
"Resource",
"documentation",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L191-L204 |
47,883 | pavlov99/jsonapi | jsonapi/api.py | API.handler_view | def handler_view(self, request, resource_name, ids=None):
""" Handler for resources.
.. versionadded:: 0.5.7
Content-Type check
:return django.http.HttpResponse
"""
signal_request.send(sender=self, request=request)
time_start = time.time()
self.upda... | python | def handler_view(self, request, resource_name, ids=None):
""" Handler for resources.
.. versionadded:: 0.5.7
Content-Type check
:return django.http.HttpResponse
"""
signal_request.send(sender=self, request=request)
time_start = time.time()
self.upda... | [
"def",
"handler_view",
"(",
"self",
",",
"request",
",",
"resource_name",
",",
"ids",
"=",
"None",
")",
":",
"signal_request",
".",
"send",
"(",
"sender",
"=",
"self",
",",
"request",
"=",
"request",
")",
"time_start",
"=",
"time",
".",
"time",
"(",
")... | Handler for resources.
.. versionadded:: 0.5.7
Content-Type check
:return django.http.HttpResponse | [
"Handler",
"for",
"resources",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L258-L312 |
47,884 | RobSpectre/Caesar-Cipher | caesarcipher/caesarcipher.py | CaesarCipher.cipher | def cipher(self):
"""Applies the Caesar shift cipher.
Based on the attributes of the object, applies the Caesar shift cipher
to the message attribute. Accepts positive and negative integers as
offsets.
Required attributes:
message
offset
Returns... | python | def cipher(self):
"""Applies the Caesar shift cipher.
Based on the attributes of the object, applies the Caesar shift cipher
to the message attribute. Accepts positive and negative integers as
offsets.
Required attributes:
message
offset
Returns... | [
"def",
"cipher",
"(",
"self",
")",
":",
"# If no offset is selected, pick random one with sufficient distance",
"# from original.",
"if",
"self",
".",
"offset",
"is",
"False",
":",
"self",
".",
"offset",
"=",
"randrange",
"(",
"5",
",",
"25",
")",
"logging",
".",
... | Applies the Caesar shift cipher.
Based on the attributes of the object, applies the Caesar shift cipher
to the message attribute. Accepts positive and negative integers as
offsets.
Required attributes:
message
offset
Returns:
String with cip... | [
"Applies",
"the",
"Caesar",
"shift",
"cipher",
"."
] | df30071e8170c019b236aa39bb2c2e98be583451 | https://github.com/RobSpectre/Caesar-Cipher/blob/df30071e8170c019b236aa39bb2c2e98be583451/caesarcipher/caesarcipher.py#L102-L145 |
47,885 | RobSpectre/Caesar-Cipher | caesarcipher/caesarcipher.py | CaesarCipher.calculate_entropy | def calculate_entropy(self, entropy_string):
"""Calculates the entropy of a string based on known frequency of
English letters.
Args:
entropy_string: A str representing the string to calculate.
Returns:
A negative float with the total entropy of the string (high... | python | def calculate_entropy(self, entropy_string):
"""Calculates the entropy of a string based on known frequency of
English letters.
Args:
entropy_string: A str representing the string to calculate.
Returns:
A negative float with the total entropy of the string (high... | [
"def",
"calculate_entropy",
"(",
"self",
",",
"entropy_string",
")",
":",
"total",
"=",
"0",
"for",
"char",
"in",
"entropy_string",
":",
"if",
"char",
".",
"isalpha",
"(",
")",
":",
"prob",
"=",
"self",
".",
"frequency",
"[",
"char",
".",
"lower",
"(",... | Calculates the entropy of a string based on known frequency of
English letters.
Args:
entropy_string: A str representing the string to calculate.
Returns:
A negative float with the total entropy of the string (higher
is better). | [
"Calculates",
"the",
"entropy",
"of",
"a",
"string",
"based",
"on",
"known",
"frequency",
"of",
"English",
"letters",
"."
] | df30071e8170c019b236aa39bb2c2e98be583451 | https://github.com/RobSpectre/Caesar-Cipher/blob/df30071e8170c019b236aa39bb2c2e98be583451/caesarcipher/caesarcipher.py#L147-L164 |
47,886 | RobSpectre/Caesar-Cipher | caesarcipher/caesarcipher.py | CaesarCipher.cracked | def cracked(self):
"""Attempts to crack ciphertext using frequency of letters in English.
Returns:
String of most likely message.
"""
logging.info("Cracking message: {0}".format(self.message))
entropy_values = {}
attempt_cache = {}
message = self.mess... | python | def cracked(self):
"""Attempts to crack ciphertext using frequency of letters in English.
Returns:
String of most likely message.
"""
logging.info("Cracking message: {0}".format(self.message))
entropy_values = {}
attempt_cache = {}
message = self.mess... | [
"def",
"cracked",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"\"Cracking message: {0}\"",
".",
"format",
"(",
"self",
".",
"message",
")",
")",
"entropy_values",
"=",
"{",
"}",
"attempt_cache",
"=",
"{",
"}",
"message",
"=",
"self",
".",
"messag... | Attempts to crack ciphertext using frequency of letters in English.
Returns:
String of most likely message. | [
"Attempts",
"to",
"crack",
"ciphertext",
"using",
"frequency",
"of",
"letters",
"in",
"English",
"."
] | df30071e8170c019b236aa39bb2c2e98be583451 | https://github.com/RobSpectre/Caesar-Cipher/blob/df30071e8170c019b236aa39bb2c2e98be583451/caesarcipher/caesarcipher.py#L167-L198 |
47,887 | RobSpectre/Caesar-Cipher | caesarcipher/caesarcipher.py | CaesarCipher.decoded | def decoded(self):
"""Decodes message using Caesar shift cipher
Inverse operation of encoding, applies negative offset to Caesar shift
cipher.
Returns:
String decoded with cipher.
"""
logging.info("Decoding message: {0}".format(self.message))
self.of... | python | def decoded(self):
"""Decodes message using Caesar shift cipher
Inverse operation of encoding, applies negative offset to Caesar shift
cipher.
Returns:
String decoded with cipher.
"""
logging.info("Decoding message: {0}".format(self.message))
self.of... | [
"def",
"decoded",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"\"Decoding message: {0}\"",
".",
"format",
"(",
"self",
".",
"message",
")",
")",
"self",
".",
"offset",
"=",
"self",
".",
"offset",
"*",
"-",
"1",
"return",
"self",
".",
"cipher",
... | Decodes message using Caesar shift cipher
Inverse operation of encoding, applies negative offset to Caesar shift
cipher.
Returns:
String decoded with cipher. | [
"Decodes",
"message",
"using",
"Caesar",
"shift",
"cipher"
] | df30071e8170c019b236aa39bb2c2e98be583451 | https://github.com/RobSpectre/Caesar-Cipher/blob/df30071e8170c019b236aa39bb2c2e98be583451/caesarcipher/caesarcipher.py#L211-L222 |
47,888 | pavlov99/jsonapi | jsonapi/request_parser.py | RequestParser.parse | def parse(cls, querydict):
""" Parse querydict data.
There are expected agruments:
distinct, fields, filter, include, page, sort
Parameters
----------
querydict : django.http.request.QueryDict
MultiValueDict with query arguments.
Returns
... | python | def parse(cls, querydict):
""" Parse querydict data.
There are expected agruments:
distinct, fields, filter, include, page, sort
Parameters
----------
querydict : django.http.request.QueryDict
MultiValueDict with query arguments.
Returns
... | [
"def",
"parse",
"(",
"cls",
",",
"querydict",
")",
":",
"for",
"key",
"in",
"querydict",
".",
"keys",
"(",
")",
":",
"if",
"not",
"any",
"(",
"(",
"key",
"in",
"JSONAPIQueryDict",
".",
"_fields",
",",
"cls",
".",
"RE_FIELDS",
".",
"match",
"(",
"ke... | Parse querydict data.
There are expected agruments:
distinct, fields, filter, include, page, sort
Parameters
----------
querydict : django.http.request.QueryDict
MultiValueDict with query arguments.
Returns
-------
result : dict
... | [
"Parse",
"querydict",
"data",
"."
] | c27943f22f1f1d30d651fe267a99d2b38f69d604 | https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/request_parser.py#L23-L61 |
47,889 | python-wink/python-wink | src/pywink/devices/binary_switch.py | WinkBinarySwitch.binary_state_name | def binary_state_name(self):
"""
Search all of the capabilities of the device and return the supported binary state field.
Default to returning powered.
"""
return_field = "powered"
_capabilities = self.json_state.get('capabilities')
if _capabilities is not... | python | def binary_state_name(self):
"""
Search all of the capabilities of the device and return the supported binary state field.
Default to returning powered.
"""
return_field = "powered"
_capabilities = self.json_state.get('capabilities')
if _capabilities is not... | [
"def",
"binary_state_name",
"(",
"self",
")",
":",
"return_field",
"=",
"\"powered\"",
"_capabilities",
"=",
"self",
".",
"json_state",
".",
"get",
"(",
"'capabilities'",
")",
"if",
"_capabilities",
"is",
"not",
"None",
":",
"_fields",
"=",
"_capabilities",
".... | Search all of the capabilities of the device and return the supported binary state field.
Default to returning powered. | [
"Search",
"all",
"of",
"the",
"capabilities",
"of",
"the",
"device",
"and",
"return",
"the",
"supported",
"binary",
"state",
"field",
".",
"Default",
"to",
"returning",
"powered",
"."
] | cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da | https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/devices/binary_switch.py#L25-L38 |
47,890 | markovmodel/msmtools | msmtools/flux/dense/tpt.py | flux_production | def flux_production(F):
r"""Returns the net flux production for all states
Parameters
----------
F : (n, n) ndarray
Matrix of flux values between pairs of states.
Returns
-------
prod : (n) ndarray
array with flux production (positive) or consumption (negative) at each stat... | python | def flux_production(F):
r"""Returns the net flux production for all states
Parameters
----------
F : (n, n) ndarray
Matrix of flux values between pairs of states.
Returns
-------
prod : (n) ndarray
array with flux production (positive) or consumption (negative) at each stat... | [
"def",
"flux_production",
"(",
"F",
")",
":",
"influxes",
"=",
"np",
".",
"array",
"(",
"np",
".",
"sum",
"(",
"F",
",",
"axis",
"=",
"0",
")",
")",
".",
"flatten",
"(",
")",
"# all that flows in",
"outfluxes",
"=",
"np",
".",
"array",
"(",
"np",
... | r"""Returns the net flux production for all states
Parameters
----------
F : (n, n) ndarray
Matrix of flux values between pairs of states.
Returns
-------
prod : (n) ndarray
array with flux production (positive) or consumption (negative) at each state | [
"r",
"Returns",
"the",
"net",
"flux",
"production",
"for",
"all",
"states"
] | 54dc76dd2113a0e8f3d15d5316abab41402941be | https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/dense/tpt.py#L104-L120 |
47,891 | markovmodel/msmtools | msmtools/flux/dense/tpt.py | total_flux | def total_flux(F, A=None):
r"""Compute the total flux, or turnover flux, that is produced by the
flux sources and consumed by the flux sinks
Parameters
----------
F : (n, n) ndarray
Matrix of flux values between pairs of states.
A : array_like (optional)
List of integer stat... | python | def total_flux(F, A=None):
r"""Compute the total flux, or turnover flux, that is produced by the
flux sources and consumed by the flux sinks
Parameters
----------
F : (n, n) ndarray
Matrix of flux values between pairs of states.
A : array_like (optional)
List of integer stat... | [
"def",
"total_flux",
"(",
"F",
",",
"A",
"=",
"None",
")",
":",
"if",
"A",
"is",
"None",
":",
"prod",
"=",
"flux_production",
"(",
"F",
")",
"zeros",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"prod",
")",
")",
"outflux",
"=",
"np",
".",
"sum",
... | r"""Compute the total flux, or turnover flux, that is produced by the
flux sources and consumed by the flux sinks
Parameters
----------
F : (n, n) ndarray
Matrix of flux values between pairs of states.
A : array_like (optional)
List of integer state labels for set A (reactant)
... | [
"r",
"Compute",
"the",
"total",
"flux",
"or",
"turnover",
"flux",
"that",
"is",
"produced",
"by",
"the",
"flux",
"sources",
"and",
"consumed",
"by",
"the",
"flux",
"sinks"
] | 54dc76dd2113a0e8f3d15d5316abab41402941be | https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/dense/tpt.py#L218-L246 |
47,892 | eirannejad/Revit-Journal-Maker | rjm/__init__.py | JournalMaker._init_journal | def _init_journal(self, permissive=True):
"""Add the initialization lines to the journal.
By default adds JrnObj variable and timestamp to the journal contents.
Args:
permissive (bool): if True most errors in journal will not
cause Revit to stop journ... | python | def _init_journal(self, permissive=True):
"""Add the initialization lines to the journal.
By default adds JrnObj variable and timestamp to the journal contents.
Args:
permissive (bool): if True most errors in journal will not
cause Revit to stop journ... | [
"def",
"_init_journal",
"(",
"self",
",",
"permissive",
"=",
"True",
")",
":",
"nowstamp",
"=",
"datetime",
".",
"now",
"(",
")",
".",
"strftime",
"(",
"\"%d-%b-%Y %H:%M:%S.%f\"",
")",
"[",
":",
"-",
"3",
"]",
"self",
".",
"_add_entry",
"(",
"templates",... | Add the initialization lines to the journal.
By default adds JrnObj variable and timestamp to the journal contents.
Args:
permissive (bool): if True most errors in journal will not
cause Revit to stop journal execution.
Some sti... | [
"Add",
"the",
"initialization",
"lines",
"to",
"the",
"journal",
"."
] | 09a4f27da6d183f63a2c93ed99dca8a8590d5241 | https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L59-L73 |
47,893 | eirannejad/Revit-Journal-Maker | rjm/__init__.py | JournalMaker._new_from_rft | def _new_from_rft(self, base_template, rft_file):
"""Append a new file from .rft entry to the journal.
This instructs Revit to create a new model based on
the provided .rft template.
Args:
base_template (str): new file journal template from rmj.templates
rft_fil... | python | def _new_from_rft(self, base_template, rft_file):
"""Append a new file from .rft entry to the journal.
This instructs Revit to create a new model based on
the provided .rft template.
Args:
base_template (str): new file journal template from rmj.templates
rft_fil... | [
"def",
"_new_from_rft",
"(",
"self",
",",
"base_template",
",",
"rft_file",
")",
":",
"self",
".",
"_add_entry",
"(",
"base_template",
")",
"self",
".",
"_add_entry",
"(",
"templates",
".",
"NEW_FROM_RFT",
".",
"format",
"(",
"rft_file_path",
"=",
"rft_file",
... | Append a new file from .rft entry to the journal.
This instructs Revit to create a new model based on
the provided .rft template.
Args:
base_template (str): new file journal template from rmj.templates
rft_file (str): full path to .rft template to be used | [
"Append",
"a",
"new",
"file",
"from",
".",
"rft",
"entry",
"to",
"the",
"journal",
"."
] | 09a4f27da6d183f63a2c93ed99dca8a8590d5241 | https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L75-L88 |
47,894 | eirannejad/Revit-Journal-Maker | rjm/__init__.py | JournalMaker.new_model | def new_model(self, template_name='<None>'):
"""Append a new model from .rft entry to the journal.
This instructs Revit to create a new model based on the
provided .rft template.
Args:
template_name (str): optional full path to .rft template
... | python | def new_model(self, template_name='<None>'):
"""Append a new model from .rft entry to the journal.
This instructs Revit to create a new model based on the
provided .rft template.
Args:
template_name (str): optional full path to .rft template
... | [
"def",
"new_model",
"(",
"self",
",",
"template_name",
"=",
"'<None>'",
")",
":",
"self",
".",
"_add_entry",
"(",
"templates",
".",
"NEW_MODEL",
".",
"format",
"(",
"template_name",
"=",
"template_name",
")",
")"
] | Append a new model from .rft entry to the journal.
This instructs Revit to create a new model based on the
provided .rft template.
Args:
template_name (str): optional full path to .rft template
to be used. default value is <None> | [
"Append",
"a",
"new",
"model",
"from",
".",
"rft",
"entry",
"to",
"the",
"journal",
"."
] | 09a4f27da6d183f63a2c93ed99dca8a8590d5241 | https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L134-L145 |
47,895 | eirannejad/Revit-Journal-Maker | rjm/__init__.py | JournalMaker.new_template | def new_template(self, template_name='<None>'):
"""Append a new template from .rft entry to the journal.
This instructs Revit to create a new template model based on the
provided .rft template.
Args:
template_name (str): optional full path to .rft template
... | python | def new_template(self, template_name='<None>'):
"""Append a new template from .rft entry to the journal.
This instructs Revit to create a new template model based on the
provided .rft template.
Args:
template_name (str): optional full path to .rft template
... | [
"def",
"new_template",
"(",
"self",
",",
"template_name",
"=",
"'<None>'",
")",
":",
"self",
".",
"_add_entry",
"(",
"templates",
".",
"NEW_MODEL_TEMPLATE",
".",
"format",
"(",
"template_name",
"=",
"template_name",
")",
")"
] | Append a new template from .rft entry to the journal.
This instructs Revit to create a new template model based on the
provided .rft template.
Args:
template_name (str): optional full path to .rft template
to be used. default value is <None> | [
"Append",
"a",
"new",
"template",
"from",
".",
"rft",
"entry",
"to",
"the",
"journal",
"."
] | 09a4f27da6d183f63a2c93ed99dca8a8590d5241 | https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L147-L158 |
47,896 | eirannejad/Revit-Journal-Maker | rjm/__init__.py | JournalMaker.open_workshared_model | def open_workshared_model(self, model_path, central=False,
detached=False, keep_worksets=True, audit=False,
show_workset_config=1):
"""Append a open workshared model entry to the journal.
This instructs Revit to open a workshared model.
... | python | def open_workshared_model(self, model_path, central=False,
detached=False, keep_worksets=True, audit=False,
show_workset_config=1):
"""Append a open workshared model entry to the journal.
This instructs Revit to open a workshared model.
... | [
"def",
"open_workshared_model",
"(",
"self",
",",
"model_path",
",",
"central",
"=",
"False",
",",
"detached",
"=",
"False",
",",
"keep_worksets",
"=",
"True",
",",
"audit",
"=",
"False",
",",
"show_workset_config",
"=",
"1",
")",
":",
"if",
"detached",
":... | Append a open workshared model entry to the journal.
This instructs Revit to open a workshared model.
Args:
model_path (str): full path to workshared model
central (bool): if True opens central model and not local
detached (bool): if True opens a detached model
... | [
"Append",
"a",
"open",
"workshared",
"model",
"entry",
"to",
"the",
"journal",
"."
] | 09a4f27da6d183f63a2c93ed99dca8a8590d5241 | https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L160-L226 |
47,897 | eirannejad/Revit-Journal-Maker | rjm/__init__.py | JournalMaker.open_model | def open_model(self, model_path, audit=False):
"""Append a open non-workshared model entry to the journal.
This instructs Revit to open a non-workshared model.
Args:
model_path (str): full path to non-workshared model
audit (bool): if True audits the model when opening
... | python | def open_model(self, model_path, audit=False):
"""Append a open non-workshared model entry to the journal.
This instructs Revit to open a non-workshared model.
Args:
model_path (str): full path to non-workshared model
audit (bool): if True audits the model when opening
... | [
"def",
"open_model",
"(",
"self",
",",
"model_path",
",",
"audit",
"=",
"False",
")",
":",
"if",
"audit",
":",
"self",
".",
"_add_entry",
"(",
"templates",
".",
"FILE_OPEN_AUDIT",
".",
"format",
"(",
"model_path",
"=",
"model_path",
")",
")",
"else",
":"... | Append a open non-workshared model entry to the journal.
This instructs Revit to open a non-workshared model.
Args:
model_path (str): full path to non-workshared model
audit (bool): if True audits the model when opening | [
"Append",
"a",
"open",
"non",
"-",
"workshared",
"model",
"entry",
"to",
"the",
"journal",
"."
] | 09a4f27da6d183f63a2c93ed99dca8a8590d5241 | https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L228-L242 |
47,898 | eirannejad/Revit-Journal-Maker | rjm/__init__.py | JournalMaker.execute_command | def execute_command(self, tab_name, panel_name,
command_module, command_class, command_data=None):
"""Append an execute external command entry to the journal.
This instructs Revit to execute the provided command from the
provided module, tab, and panel.
Args:
... | python | def execute_command(self, tab_name, panel_name,
command_module, command_class, command_data=None):
"""Append an execute external command entry to the journal.
This instructs Revit to execute the provided command from the
provided module, tab, and panel.
Args:
... | [
"def",
"execute_command",
"(",
"self",
",",
"tab_name",
",",
"panel_name",
",",
"command_module",
",",
"command_class",
",",
"command_data",
"=",
"None",
")",
":",
"# make sure command_data is not empty",
"command_data",
"=",
"{",
"}",
"if",
"command_data",
"is",
... | Append an execute external command entry to the journal.
This instructs Revit to execute the provided command from the
provided module, tab, and panel.
Args:
tab_name (str): name of ribbon tab that contains the command
panel_name (str): name of ribbon panel that contain... | [
"Append",
"an",
"execute",
"external",
"command",
"entry",
"to",
"the",
"journal",
"."
] | 09a4f27da6d183f63a2c93ed99dca8a8590d5241 | https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L251-L297 |
47,899 | eirannejad/Revit-Journal-Maker | rjm/__init__.py | JournalMaker.execute_dynamo_definition | def execute_dynamo_definition(self, definition_path,
show_ui=False, shutdown=True,
automation=False, path_exec=True):
"""Execute a dynamo definition.
Args:
definition_path (str): full path to dynamo definition file
... | python | def execute_dynamo_definition(self, definition_path,
show_ui=False, shutdown=True,
automation=False, path_exec=True):
"""Execute a dynamo definition.
Args:
definition_path (str): full path to dynamo definition file
... | [
"def",
"execute_dynamo_definition",
"(",
"self",
",",
"definition_path",
",",
"show_ui",
"=",
"False",
",",
"shutdown",
"=",
"True",
",",
"automation",
"=",
"False",
",",
"path_exec",
"=",
"True",
")",
":",
"self",
".",
"_add_entry",
"(",
"templates",
".",
... | Execute a dynamo definition.
Args:
definition_path (str): full path to dynamo definition file
show_ui (bool): show dynamo UI at execution
shutdown (bool): shutdown model after execution
automation (bool): activate dynamo automation
path_exec (bool): a... | [
"Execute",
"a",
"dynamo",
"definition",
"."
] | 09a4f27da6d183f63a2c93ed99dca8a8590d5241 | https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L299-L324 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.