repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Capitains/MyCapytain | MyCapytain/resources/prototypes/metadata.py | Collection.parents | def parents(self) -> List["Collection"]:
""" Iterator to find parents of current collection, from closest to furthest
:rtype: Generator[:class:`Collection`]
"""
p = self.parent
parents = []
while p is not None:
parents.append(p)
p = p.parent
... | python | def parents(self) -> List["Collection"]:
""" Iterator to find parents of current collection, from closest to furthest
:rtype: Generator[:class:`Collection`]
"""
p = self.parent
parents = []
while p is not None:
parents.append(p)
p = p.parent
... | [
"def",
"parents",
"(",
"self",
")",
"->",
"List",
"[",
"\"Collection\"",
"]",
":",
"p",
"=",
"self",
".",
"parent",
"parents",
"=",
"[",
"]",
"while",
"p",
"is",
"not",
"None",
":",
"parents",
".",
"append",
"(",
"p",
")",
"p",
"=",
"p",
".",
"... | Iterator to find parents of current collection, from closest to furthest
:rtype: Generator[:class:`Collection`] | [
"Iterator",
"to",
"find",
"parents",
"of",
"current",
"collection",
"from",
"closest",
"to",
"furthest"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/metadata.py#L162-L172 | train | Iterator to find parents of current collection. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/metadata.py | Collection.parent | def parent(self, parent):
""" Parents
:param parent: Parent to set for the object
:type parent: Collection
:return:
"""
self._parent = parent
self.graph.add(
(self.asNode(), RDF_NAMESPACES.CAPITAINS.parent, parent.asNode())
)
parent._a... | python | def parent(self, parent):
""" Parents
:param parent: Parent to set for the object
:type parent: Collection
:return:
"""
self._parent = parent
self.graph.add(
(self.asNode(), RDF_NAMESPACES.CAPITAINS.parent, parent.asNode())
)
parent._a... | [
"def",
"parent",
"(",
"self",
",",
"parent",
")",
":",
"self",
".",
"_parent",
"=",
"parent",
"self",
".",
"graph",
".",
"add",
"(",
"(",
"self",
".",
"asNode",
"(",
")",
",",
"RDF_NAMESPACES",
".",
"CAPITAINS",
".",
"parent",
",",
"parent",
".",
"... | Parents
:param parent: Parent to set for the object
:type parent: Collection
:return: | [
"Parents"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/metadata.py#L183-L194 | train | Sets the parent of the object. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/metadata.py | Collection._add_member | def _add_member(self, member):
""" Does not add member if it already knows it.
.. warning:: It should not be called !
:param member: Collection to add to members
"""
if member.id in self.children:
return None
else:
self.children[member.id] = memb... | python | def _add_member(self, member):
""" Does not add member if it already knows it.
.. warning:: It should not be called !
:param member: Collection to add to members
"""
if member.id in self.children:
return None
else:
self.children[member.id] = memb... | [
"def",
"_add_member",
"(",
"self",
",",
"member",
")",
":",
"if",
"member",
".",
"id",
"in",
"self",
".",
"children",
":",
"return",
"None",
"else",
":",
"self",
".",
"children",
"[",
"member",
".",
"id",
"]",
"=",
"member"
] | Does not add member if it already knows it.
.. warning:: It should not be called !
:param member: Collection to add to members | [
"Does",
"not",
"add",
"member",
"if",
"it",
"already",
"knows",
"it",
"."
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/metadata.py#L196-L206 | train | Adds a member to the children of the current object. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/metadata.py | Collection.descendants | def descendants(self):
""" Any descendant (no max level) of the collection's item
:rtype: [Collection]
"""
return self.members + \
[submember for member in self.members for submember in member.descendants] | python | def descendants(self):
""" Any descendant (no max level) of the collection's item
:rtype: [Collection]
"""
return self.members + \
[submember for member in self.members for submember in member.descendants] | [
"def",
"descendants",
"(",
"self",
")",
":",
"return",
"self",
".",
"members",
"+",
"[",
"submember",
"for",
"member",
"in",
"self",
".",
"members",
"for",
"submember",
"in",
"member",
".",
"descendants",
"]"
] | Any descendant (no max level) of the collection's item
:rtype: [Collection] | [
"Any",
"descendant",
"(",
"no",
"max",
"level",
")",
"of",
"the",
"collection",
"s",
"item"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/metadata.py#L266-L272 | train | Returns the list of all descendant items of the item. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/metadata.py | Collection.export_base_dts | def export_base_dts(cls, graph, obj, nsm):
""" Export the base DTS information in a simple reusable way
:param graph: Current graph where the information lie
:param obj: Object for which we build info
:param nsm: Namespace manager
:return: Dict
"""
o = {
... | python | def export_base_dts(cls, graph, obj, nsm):
""" Export the base DTS information in a simple reusable way
:param graph: Current graph where the information lie
:param obj: Object for which we build info
:param nsm: Namespace manager
:return: Dict
"""
o = {
... | [
"def",
"export_base_dts",
"(",
"cls",
",",
"graph",
",",
"obj",
",",
"nsm",
")",
":",
"o",
"=",
"{",
"\"@id\"",
":",
"str",
"(",
"obj",
".",
"asNode",
"(",
")",
")",
",",
"\"@type\"",
":",
"nsm",
".",
"qname",
"(",
"obj",
".",
"type",
")",
",",... | Export the base DTS information in a simple reusable way
:param graph: Current graph where the information lie
:param obj: Object for which we build info
:param nsm: Namespace manager
:return: Dict | [
"Export",
"the",
"base",
"DTS",
"information",
"in",
"a",
"simple",
"reusable",
"way"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/metadata.py#L306-L325 | train | Export the base DTS information in a simple reusable way |
Capitains/MyCapytain | MyCapytain/resources/prototypes/metadata.py | ResourceCollection.get_creator | def get_creator(self, lang=None):
""" Get the DC Creator literal value
:param lang: Language to retrieve
:return: Creator string representation
:rtype: Literal
"""
return self.metadata.get_single(key=DC.creator, lang=lang) | python | def get_creator(self, lang=None):
""" Get the DC Creator literal value
:param lang: Language to retrieve
:return: Creator string representation
:rtype: Literal
"""
return self.metadata.get_single(key=DC.creator, lang=lang) | [
"def",
"get_creator",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"return",
"self",
".",
"metadata",
".",
"get_single",
"(",
"key",
"=",
"DC",
".",
"creator",
",",
"lang",
"=",
"lang",
")"
] | Get the DC Creator literal value
:param lang: Language to retrieve
:return: Creator string representation
:rtype: Literal | [
"Get",
"the",
"DC",
"Creator",
"literal",
"value"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/metadata.py#L461-L468 | train | Get the DC Creator literal value |
Capitains/MyCapytain | MyCapytain/resources/prototypes/metadata.py | ResourceCollection.get_title | def get_title(self, lang=None):
""" Get the title of the object
:param lang: Lang to retrieve
:return: Title string representation
:rtype: Literal
"""
return self.metadata.get_single(key=DC.title, lang=lang) | python | def get_title(self, lang=None):
""" Get the title of the object
:param lang: Lang to retrieve
:return: Title string representation
:rtype: Literal
"""
return self.metadata.get_single(key=DC.title, lang=lang) | [
"def",
"get_title",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"return",
"self",
".",
"metadata",
".",
"get_single",
"(",
"key",
"=",
"DC",
".",
"title",
",",
"lang",
"=",
"lang",
")"
] | Get the title of the object
:param lang: Lang to retrieve
:return: Title string representation
:rtype: Literal | [
"Get",
"the",
"title",
"of",
"the",
"object"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/metadata.py#L470-L477 | train | Get the title of the object
|
Capitains/MyCapytain | MyCapytain/resources/prototypes/metadata.py | ResourceCollection.get_subject | def get_subject(self, lang=None):
""" Get the subject of the object
:param lang: Lang to retrieve
:return: Subject string representation
:rtype: Literal
"""
return self.metadata.get_single(key=DC.subject, lang=lang) | python | def get_subject(self, lang=None):
""" Get the subject of the object
:param lang: Lang to retrieve
:return: Subject string representation
:rtype: Literal
"""
return self.metadata.get_single(key=DC.subject, lang=lang) | [
"def",
"get_subject",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"return",
"self",
".",
"metadata",
".",
"get_single",
"(",
"key",
"=",
"DC",
".",
"subject",
",",
"lang",
"=",
"lang",
")"
] | Get the subject of the object
:param lang: Lang to retrieve
:return: Subject string representation
:rtype: Literal | [
"Get",
"the",
"subject",
"of",
"the",
"object"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/metadata.py#L488-L495 | train | Get the subject of the object
|
madisona/django-contact-form | contact_form/forms.py | BaseEmailFormMixin.get_context | def get_context(self):
"""
Context sent to templates for rendering include the form's cleaned
data and also the current Request object.
"""
if not self.is_valid():
raise ValueError("Cannot generate Context when form is invalid.")
return dict(request=self.reque... | python | def get_context(self):
"""
Context sent to templates for rendering include the form's cleaned
data and also the current Request object.
"""
if not self.is_valid():
raise ValueError("Cannot generate Context when form is invalid.")
return dict(request=self.reque... | [
"def",
"get_context",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_valid",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Cannot generate Context when form is invalid.\"",
")",
"return",
"dict",
"(",
"request",
"=",
"self",
".",
"request",
",",
"*",
"... | Context sent to templates for rendering include the form's cleaned
data and also the current Request object. | [
"Context",
"sent",
"to",
"templates",
"for",
"rendering",
"include",
"the",
"form",
"s",
"cleaned",
"data",
"and",
"also",
"the",
"current",
"Request",
"object",
"."
] | 0800034a7231f35a3d5b5cd73968e6115b9ce01c | https://github.com/madisona/django-contact-form/blob/0800034a7231f35a3d5b5cd73968e6115b9ce01c/contact_form/forms.py#L24-L31 | train | Return a dict containing the current context of the current object. |
SHDShim/pytheos | pytheos/eqn_anharmonic.py | zharkov_panh | def zharkov_panh(v, temp, v0, a0, m, n, z, t_ref=300.,
three_r=3. * constants.R):
"""
calculate pressure from anharmonicity for Zharkov equation
the equation is from Dorogokupets 2015
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in... | python | def zharkov_panh(v, temp, v0, a0, m, n, z, t_ref=300.,
three_r=3. * constants.R):
"""
calculate pressure from anharmonicity for Zharkov equation
the equation is from Dorogokupets 2015
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in... | [
"def",
"zharkov_panh",
"(",
"v",
",",
"temp",
",",
"v0",
",",
"a0",
",",
"m",
",",
"n",
",",
"z",
",",
"t_ref",
"=",
"300.",
",",
"three_r",
"=",
"3.",
"*",
"constants",
".",
"R",
")",
":",
"v_mol",
"=",
"vol_uc2mol",
"(",
"v",
",",
"z",
")",... | calculate pressure from anharmonicity for Zharkov equation
the equation is from Dorogokupets 2015
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in A^3 at 1 bar
:param a0: parameter in K-1 for the Zharkov equation
:param m: parameter for the Zharkov ... | [
"calculate",
"pressure",
"from",
"anharmonicity",
"for",
"Zharkov",
"equation",
"the",
"equation",
"is",
"from",
"Dorogokupets",
"2015"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_anharmonic.py#L6-L29 | train | calculate pressure from anharmonicity for Zharkov equation |
lyda/misspell-check | misspellings_lib.py | split_words | def split_words(line):
"""Return the list of words contained in a line."""
# Normalize any camel cased words first
line = _NORM_REGEX.sub(r'\1 \2', line)
return [normalize(w) for w in _WORD_REGEX.split(line)] | python | def split_words(line):
"""Return the list of words contained in a line."""
# Normalize any camel cased words first
line = _NORM_REGEX.sub(r'\1 \2', line)
return [normalize(w) for w in _WORD_REGEX.split(line)] | [
"def",
"split_words",
"(",
"line",
")",
":",
"# Normalize any camel cased words first",
"line",
"=",
"_NORM_REGEX",
".",
"sub",
"(",
"r'\\1 \\2'",
",",
"line",
")",
"return",
"[",
"normalize",
"(",
"w",
")",
"for",
"w",
"in",
"_WORD_REGEX",
".",
"split",
"("... | Return the list of words contained in a line. | [
"Return",
"the",
"list",
"of",
"words",
"contained",
"in",
"a",
"line",
"."
] | f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa | https://github.com/lyda/misspell-check/blob/f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa/misspellings_lib.py#L26-L30 | train | Return the list of words contained in a line. |
lyda/misspell-check | misspellings_lib.py | Misspellings.add | def add(self, files):
"""Adds files to check.
Args:
files: List of files to check.
"""
if files.__class__.__name__ == 'str':
self._files.append(files)
else:
self._files.extend(files) | python | def add(self, files):
"""Adds files to check.
Args:
files: List of files to check.
"""
if files.__class__.__name__ == 'str':
self._files.append(files)
else:
self._files.extend(files) | [
"def",
"add",
"(",
"self",
",",
"files",
")",
":",
"if",
"files",
".",
"__class__",
".",
"__name__",
"==",
"'str'",
":",
"self",
".",
"_files",
".",
"append",
"(",
"files",
")",
"else",
":",
"self",
".",
"_files",
".",
"extend",
"(",
"files",
")"
] | Adds files to check.
Args:
files: List of files to check. | [
"Adds",
"files",
"to",
"check",
"."
] | f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa | https://github.com/lyda/misspell-check/blob/f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa/misspellings_lib.py#L67-L76 | train | Adds files to check.
|
lyda/misspell-check | misspellings_lib.py | Misspellings.check | def check(self):
"""Checks the files for misspellings.
Returns:
(errors, results)
errors: List of system errors, usually file access errors.
results: List of spelling errors - each tuple is filename,
line number and misspelled word.
"""
errors = []
results = []
... | python | def check(self):
"""Checks the files for misspellings.
Returns:
(errors, results)
errors: List of system errors, usually file access errors.
results: List of spelling errors - each tuple is filename,
line number and misspelled word.
"""
errors = []
results = []
... | [
"def",
"check",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"results",
"=",
"[",
"]",
"for",
"fn",
"in",
"self",
".",
"_files",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"fn",
")",
":",
"try",
":",
"with",
"open",
"(",
"fn",... | Checks the files for misspellings.
Returns:
(errors, results)
errors: List of system errors, usually file access errors.
results: List of spelling errors - each tuple is filename,
line number and misspelled word. | [
"Checks",
"the",
"files",
"for",
"misspellings",
"."
] | f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa | https://github.com/lyda/misspell-check/blob/f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa/misspellings_lib.py#L78-L104 | train | Checks the files for misspellings. |
lyda/misspell-check | misspellings_lib.py | Misspellings.suggestions | def suggestions(self, word):
"""Returns a list of suggestions for a misspelled word.
Args:
word: The word to check.
Returns:
List of zero or more suggested replacements for word.
"""
suggestions = set(self._misspelling_dict.get(word, [])).union(
set(self._misspelling_dict.get(w... | python | def suggestions(self, word):
"""Returns a list of suggestions for a misspelled word.
Args:
word: The word to check.
Returns:
List of zero or more suggested replacements for word.
"""
suggestions = set(self._misspelling_dict.get(word, [])).union(
set(self._misspelling_dict.get(w... | [
"def",
"suggestions",
"(",
"self",
",",
"word",
")",
":",
"suggestions",
"=",
"set",
"(",
"self",
".",
"_misspelling_dict",
".",
"get",
"(",
"word",
",",
"[",
"]",
")",
")",
".",
"union",
"(",
"set",
"(",
"self",
".",
"_misspelling_dict",
".",
"get",... | Returns a list of suggestions for a misspelled word.
Args:
word: The word to check.
Returns:
List of zero or more suggested replacements for word. | [
"Returns",
"a",
"list",
"of",
"suggestions",
"for",
"a",
"misspelled",
"word",
"."
] | f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa | https://github.com/lyda/misspell-check/blob/f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa/misspellings_lib.py#L106-L118 | train | Returns a list of suggestions for a misspelled word. |
lyda/misspell-check | misspellings_lib.py | Misspellings.dump_misspelling_list | def dump_misspelling_list(self):
"""Returns a list of misspelled words and corrections."""
results = []
for bad_word in sorted(self._misspelling_dict.keys()):
for correction in self._misspelling_dict[bad_word]:
results.append([bad_word, correction])
return results | python | def dump_misspelling_list(self):
"""Returns a list of misspelled words and corrections."""
results = []
for bad_word in sorted(self._misspelling_dict.keys()):
for correction in self._misspelling_dict[bad_word]:
results.append([bad_word, correction])
return results | [
"def",
"dump_misspelling_list",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"for",
"bad_word",
"in",
"sorted",
"(",
"self",
".",
"_misspelling_dict",
".",
"keys",
"(",
")",
")",
":",
"for",
"correction",
"in",
"self",
".",
"_misspelling_dict",
"[",
... | Returns a list of misspelled words and corrections. | [
"Returns",
"a",
"list",
"of",
"misspelled",
"words",
"and",
"corrections",
"."
] | f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa | https://github.com/lyda/misspell-check/blob/f8c5d67a5ffaeb0a7101efd5a4ace81c73955efa/misspellings_lib.py#L120-L126 | train | Returns a list of misspelled words and corrections. |
hawkular/hawkular-client-python | hawkular/alerts/common.py | HawkularAlertsClient.status | def status(self):
"""
Get the status of Alerting Service
:return: Status object
"""
orig_dict = self._get(self._service_url('status'))
orig_dict['implementation_version'] = orig_dict.pop('Implementation-Version')
orig_dict['built_from_git_sha1'] = orig_dict.pop('... | python | def status(self):
"""
Get the status of Alerting Service
:return: Status object
"""
orig_dict = self._get(self._service_url('status'))
orig_dict['implementation_version'] = orig_dict.pop('Implementation-Version')
orig_dict['built_from_git_sha1'] = orig_dict.pop('... | [
"def",
"status",
"(",
"self",
")",
":",
"orig_dict",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_service_url",
"(",
"'status'",
")",
")",
"orig_dict",
"[",
"'implementation_version'",
"]",
"=",
"orig_dict",
".",
"pop",
"(",
"'Implementation-Version'",
")",... | Get the status of Alerting Service
:return: Status object | [
"Get",
"the",
"status",
"of",
"Alerting",
"Service"
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/common.py#L81-L90 | train | Get the status of Alerting Service
|
ChrisBeaumont/smother | smother/cli.py | cli | def cli(ctx, report, semantic, rcfile):
"""
Query or manipulate smother reports
"""
ctx.obj = {
'report': report,
'semantic': semantic,
'rcfile': rcfile,
} | python | def cli(ctx, report, semantic, rcfile):
"""
Query or manipulate smother reports
"""
ctx.obj = {
'report': report,
'semantic': semantic,
'rcfile': rcfile,
} | [
"def",
"cli",
"(",
"ctx",
",",
"report",
",",
"semantic",
",",
"rcfile",
")",
":",
"ctx",
".",
"obj",
"=",
"{",
"'report'",
":",
"report",
",",
"'semantic'",
":",
"semantic",
",",
"'rcfile'",
":",
"rcfile",
",",
"}"
] | Query or manipulate smother reports | [
"Query",
"or",
"manipulate",
"smother",
"reports"
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/cli.py#L27-L35 | train | Query or manipulate smother reports
|
ChrisBeaumont/smother | smother/cli.py | lookup | def lookup(ctx, path):
"""
Determine which tests intersect a source interval.
"""
regions = parse_intervals(path, as_context=ctx.obj['semantic'])
_report_from_regions(regions, ctx.obj) | python | def lookup(ctx, path):
"""
Determine which tests intersect a source interval.
"""
regions = parse_intervals(path, as_context=ctx.obj['semantic'])
_report_from_regions(regions, ctx.obj) | [
"def",
"lookup",
"(",
"ctx",
",",
"path",
")",
":",
"regions",
"=",
"parse_intervals",
"(",
"path",
",",
"as_context",
"=",
"ctx",
".",
"obj",
"[",
"'semantic'",
"]",
")",
"_report_from_regions",
"(",
"regions",
",",
"ctx",
".",
"obj",
")"
] | Determine which tests intersect a source interval. | [
"Determine",
"which",
"tests",
"intersect",
"a",
"source",
"interval",
"."
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/cli.py#L48-L53 | train | Lookup test set for a source interval. |
ChrisBeaumont/smother | smother/cli.py | diff | def diff(ctx, branch):
"""
Determine which tests intersect a git diff.
"""
diff = GitDiffReporter(branch)
regions = diff.changed_intervals()
_report_from_regions(regions, ctx.obj, file_factory=diff.old_file) | python | def diff(ctx, branch):
"""
Determine which tests intersect a git diff.
"""
diff = GitDiffReporter(branch)
regions = diff.changed_intervals()
_report_from_regions(regions, ctx.obj, file_factory=diff.old_file) | [
"def",
"diff",
"(",
"ctx",
",",
"branch",
")",
":",
"diff",
"=",
"GitDiffReporter",
"(",
"branch",
")",
"regions",
"=",
"diff",
".",
"changed_intervals",
"(",
")",
"_report_from_regions",
"(",
"regions",
",",
"ctx",
".",
"obj",
",",
"file_factory",
"=",
... | Determine which tests intersect a git diff. | [
"Determine",
"which",
"tests",
"intersect",
"a",
"git",
"diff",
"."
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/cli.py#L59-L65 | train | Determine which tests intersect a git diff. |
ChrisBeaumont/smother | smother/cli.py | combine | def combine(ctx, src, dst):
"""
Combine several smother reports.
"""
c = coverage.Coverage(config_file=ctx.obj['rcfile'])
result = Smother(c)
for infile in src:
result |= Smother.load(infile)
result.write(dst) | python | def combine(ctx, src, dst):
"""
Combine several smother reports.
"""
c = coverage.Coverage(config_file=ctx.obj['rcfile'])
result = Smother(c)
for infile in src:
result |= Smother.load(infile)
result.write(dst) | [
"def",
"combine",
"(",
"ctx",
",",
"src",
",",
"dst",
")",
":",
"c",
"=",
"coverage",
".",
"Coverage",
"(",
"config_file",
"=",
"ctx",
".",
"obj",
"[",
"'rcfile'",
"]",
")",
"result",
"=",
"Smother",
"(",
"c",
")",
"for",
"infile",
"in",
"src",
"... | Combine several smother reports. | [
"Combine",
"several",
"smother",
"reports",
"."
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/cli.py#L72-L82 | train | Combine several smother reports. |
ChrisBeaumont/smother | smother/cli.py | convert_to_relative_paths | def convert_to_relative_paths(src, dst):
"""
Converts all file paths in a smother report to relative paths, relative
to the current directory.
"""
result = Smother.convert_to_relative_paths(Smother.load(src))
result.write(dst) | python | def convert_to_relative_paths(src, dst):
"""
Converts all file paths in a smother report to relative paths, relative
to the current directory.
"""
result = Smother.convert_to_relative_paths(Smother.load(src))
result.write(dst) | [
"def",
"convert_to_relative_paths",
"(",
"src",
",",
"dst",
")",
":",
"result",
"=",
"Smother",
".",
"convert_to_relative_paths",
"(",
"Smother",
".",
"load",
"(",
"src",
")",
")",
"result",
".",
"write",
"(",
"dst",
")"
] | Converts all file paths in a smother report to relative paths, relative
to the current directory. | [
"Converts",
"all",
"file",
"paths",
"in",
"a",
"smother",
"report",
"to",
"relative",
"paths",
"relative",
"to",
"the",
"current",
"directory",
"."
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/cli.py#L88-L94 | train | Converts all file paths in a smother report to relative paths relative
to the current directory. |
ChrisBeaumont/smother | smother/cli.py | csv | def csv(ctx, dst):
"""
Flatten a coverage file into a CSV
of source_context, testname
"""
sm = Smother.load(ctx.obj['report'])
semantic = ctx.obj['semantic']
writer = _csv.writer(dst, lineterminator='\n')
dst.write("source_context, test_context\n")
writer.writerows(sm.iter_records(se... | python | def csv(ctx, dst):
"""
Flatten a coverage file into a CSV
of source_context, testname
"""
sm = Smother.load(ctx.obj['report'])
semantic = ctx.obj['semantic']
writer = _csv.writer(dst, lineterminator='\n')
dst.write("source_context, test_context\n")
writer.writerows(sm.iter_records(se... | [
"def",
"csv",
"(",
"ctx",
",",
"dst",
")",
":",
"sm",
"=",
"Smother",
".",
"load",
"(",
"ctx",
".",
"obj",
"[",
"'report'",
"]",
")",
"semantic",
"=",
"ctx",
".",
"obj",
"[",
"'semantic'",
"]",
"writer",
"=",
"_csv",
".",
"writer",
"(",
"dst",
... | Flatten a coverage file into a CSV
of source_context, testname | [
"Flatten",
"a",
"coverage",
"file",
"into",
"a",
"CSV",
"of",
"source_context",
"testname"
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/cli.py#L100-L109 | train | Flatten a coverage file into a CSV file containing source_context testname |
ChrisBeaumont/smother | smother/cli.py | erase | def erase(ctx):
"""
Erase the existing smother report.
"""
if os.path.exists(ctx.obj['report']):
os.remove(ctx.obj['report']) | python | def erase(ctx):
"""
Erase the existing smother report.
"""
if os.path.exists(ctx.obj['report']):
os.remove(ctx.obj['report']) | [
"def",
"erase",
"(",
"ctx",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"ctx",
".",
"obj",
"[",
"'report'",
"]",
")",
":",
"os",
".",
"remove",
"(",
"ctx",
".",
"obj",
"[",
"'report'",
"]",
")"
] | Erase the existing smother report. | [
"Erase",
"the",
"existing",
"smother",
"report",
"."
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/cli.py#L114-L119 | train | Erase the existing smother report. |
ChrisBeaumont/smother | smother/cli.py | to_coverage | def to_coverage(ctx):
"""
Produce a .coverage file from a smother file
"""
sm = Smother.load(ctx.obj['report'])
sm.coverage = coverage.coverage()
sm.write_coverage() | python | def to_coverage(ctx):
"""
Produce a .coverage file from a smother file
"""
sm = Smother.load(ctx.obj['report'])
sm.coverage = coverage.coverage()
sm.write_coverage() | [
"def",
"to_coverage",
"(",
"ctx",
")",
":",
"sm",
"=",
"Smother",
".",
"load",
"(",
"ctx",
".",
"obj",
"[",
"'report'",
"]",
")",
"sm",
".",
"coverage",
"=",
"coverage",
".",
"coverage",
"(",
")",
"sm",
".",
"write_coverage",
"(",
")"
] | Produce a .coverage file from a smother file | [
"Produce",
"a",
".",
"coverage",
"file",
"from",
"a",
"smother",
"file"
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/cli.py#L124-L130 | train | Produce a. coverage file from a smother file |
chaoss/grimoirelab-cereslib | cereslib/dfutils/format.py | Format.fill_missing_fields | def fill_missing_fields(self, data, columns):
""" This method fills with 0's missing fields
:param data: original Pandas dataframe
:param columns: list of columns to be filled in the DataFrame
:type data: pandas.DataFrame
:type columns: list of strings
:returns: Pandas... | python | def fill_missing_fields(self, data, columns):
""" This method fills with 0's missing fields
:param data: original Pandas dataframe
:param columns: list of columns to be filled in the DataFrame
:type data: pandas.DataFrame
:type columns: list of strings
:returns: Pandas... | [
"def",
"fill_missing_fields",
"(",
"self",
",",
"data",
",",
"columns",
")",
":",
"for",
"column",
"in",
"columns",
":",
"if",
"column",
"not",
"in",
"data",
".",
"columns",
":",
"data",
"[",
"column",
"]",
"=",
"scipy",
".",
"zeros",
"(",
"len",
"("... | This method fills with 0's missing fields
:param data: original Pandas dataframe
:param columns: list of columns to be filled in the DataFrame
:type data: pandas.DataFrame
:type columns: list of strings
:returns: Pandas dataframe with missing fields filled with 0's
:rt... | [
"This",
"method",
"fills",
"with",
"0",
"s",
"missing",
"fields"
] | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/dfutils/format.py#L43-L59 | train | This method fills with 0 s missing fields in the DataFrame with 0 s missing fields |
chaoss/grimoirelab-cereslib | cereslib/dfutils/format.py | Format.update_field_names | def update_field_names(self, data, matching):
""" This method updates the names of the fields according to matching
:param data: original Pandas dataframe
:param matching: dictionary of matchings between old and new values
:type data: pandas.DataFrame
:type matching: dictionary
... | python | def update_field_names(self, data, matching):
""" This method updates the names of the fields according to matching
:param data: original Pandas dataframe
:param matching: dictionary of matchings between old and new values
:type data: pandas.DataFrame
:type matching: dictionary
... | [
"def",
"update_field_names",
"(",
"self",
",",
"data",
",",
"matching",
")",
":",
"for",
"key",
"in",
"matching",
".",
"keys",
"(",
")",
":",
"if",
"key",
"in",
"data",
".",
"columns",
":",
"data",
".",
"rename",
"(",
"columns",
"=",
"{",
"key",
":... | This method updates the names of the fields according to matching
:param data: original Pandas dataframe
:param matching: dictionary of matchings between old and new values
:type data: pandas.DataFrame
:type matching: dictionary
:returns: Pandas dataframe with updated names
... | [
"This",
"method",
"updates",
"the",
"names",
"of",
"the",
"fields",
"according",
"to",
"matching"
] | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/dfutils/format.py#L61-L77 | train | This method updates the names of the fields according to the given dictionary of matching values. |
chaoss/grimoirelab-cereslib | cereslib/dfutils/format.py | Format.format_dates | def format_dates(self, data, columns):
""" This method translates columns values into datetime objects
:param data: original Pandas dataframe
:param columns: list of columns to cast the date to a datetime object
:type data: pandas.DataFrame
:type columns: list of strings
... | python | def format_dates(self, data, columns):
""" This method translates columns values into datetime objects
:param data: original Pandas dataframe
:param columns: list of columns to cast the date to a datetime object
:type data: pandas.DataFrame
:type columns: list of strings
... | [
"def",
"format_dates",
"(",
"self",
",",
"data",
",",
"columns",
")",
":",
"for",
"column",
"in",
"columns",
":",
"if",
"column",
"in",
"data",
".",
"columns",
":",
"data",
"[",
"column",
"]",
"=",
"pandas",
".",
"to_datetime",
"(",
"data",
"[",
"col... | This method translates columns values into datetime objects
:param data: original Pandas dataframe
:param columns: list of columns to cast the date to a datetime object
:type data: pandas.DataFrame
:type columns: list of strings
:returns: Pandas dataframe with updated 'columns'... | [
"This",
"method",
"translates",
"columns",
"values",
"into",
"datetime",
"objects"
] | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/dfutils/format.py#L80-L96 | train | This method translates columns values into datetime objects |
chaoss/grimoirelab-cereslib | cereslib/dfutils/format.py | Format.remove_columns | def remove_columns(self, data, columns):
""" This method removes columns in data
:param data: original Pandas dataframe
:param columns: list of columns to remove
:type data: pandas.DataFrame
:type columns: list of strings
:returns: Pandas dataframe with removed columns
... | python | def remove_columns(self, data, columns):
""" This method removes columns in data
:param data: original Pandas dataframe
:param columns: list of columns to remove
:type data: pandas.DataFrame
:type columns: list of strings
:returns: Pandas dataframe with removed columns
... | [
"def",
"remove_columns",
"(",
"self",
",",
"data",
",",
"columns",
")",
":",
"for",
"column",
"in",
"columns",
":",
"if",
"column",
"in",
"data",
".",
"columns",
":",
"data",
"=",
"data",
".",
"drop",
"(",
"column",
",",
"axis",
"=",
"1",
")",
"ret... | This method removes columns in data
:param data: original Pandas dataframe
:param columns: list of columns to remove
:type data: pandas.DataFrame
:type columns: list of strings
:returns: Pandas dataframe with removed columns
:rtype: pandas.DataFrame | [
"This",
"method",
"removes",
"columns",
"in",
"data"
] | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/dfutils/format.py#L98-L114 | train | This method removes columns from a pandas dataframe. |
iktakahiro/slackpy | slackpy/slackpy.py | SlackLogger.__send_notification | def __send_notification(self, message, title, title_link='', color='good',
fields='', log_level=LogLv.INFO):
"""Send a message to a channel.
Args:
title: Message title.
title_link: Link of the message title.
message: Message body.
... | python | def __send_notification(self, message, title, title_link='', color='good',
fields='', log_level=LogLv.INFO):
"""Send a message to a channel.
Args:
title: Message title.
title_link: Link of the message title.
message: Message body.
... | [
"def",
"__send_notification",
"(",
"self",
",",
"message",
",",
"title",
",",
"title_link",
"=",
"''",
",",
"color",
"=",
"'good'",
",",
"fields",
"=",
"''",
",",
"log_level",
"=",
"LogLv",
".",
"INFO",
")",
":",
"if",
"log_level",
"<",
"self",
".",
... | Send a message to a channel.
Args:
title: Message title.
title_link: Link of the message title.
message: Message body.
color: Message line color on Slack. This parameter should be one of the following values: 'good', 'warning',
'danger' or any hex col... | [
"Send",
"a",
"message",
"to",
"a",
"channel",
".",
"Args",
":",
"title",
":",
"Message",
"title",
".",
"title_link",
":",
"Link",
"of",
"the",
"message",
"title",
".",
"message",
":",
"Message",
"body",
".",
"color",
":",
"Message",
"line",
"color",
"o... | 23c0a2a33e408d0e8d24bc704d7021e85d6ae39a | https://github.com/iktakahiro/slackpy/blob/23c0a2a33e408d0e8d24bc704d7021e85d6ae39a/slackpy/slackpy.py#L90-L117 | train | Send a message to a channel. |
SHDShim/pytheos | pytheos/eqn_therm_Tange.py | tange_grun | def tange_grun(v, v0, gamma0, a, b):
"""
calculate Gruneisen parameter for the Tange equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param a: volume-independent adjustable parameters
:param b: volume-indepen... | python | def tange_grun(v, v0, gamma0, a, b):
"""
calculate Gruneisen parameter for the Tange equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param a: volume-independent adjustable parameters
:param b: volume-indepen... | [
"def",
"tange_grun",
"(",
"v",
",",
"v0",
",",
"gamma0",
",",
"a",
",",
"b",
")",
":",
"x",
"=",
"v",
"/",
"v0",
"return",
"gamma0",
"*",
"(",
"1.",
"+",
"a",
"*",
"(",
"np",
".",
"power",
"(",
"x",
",",
"b",
")",
"-",
"1.",
")",
")"
] | calculate Gruneisen parameter for the Tange equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param a: volume-independent adjustable parameters
:param b: volume-independent adjustable parameters
:return: Gruneisen... | [
"calculate",
"Gruneisen",
"parameter",
"for",
"the",
"Tange",
"equation"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_therm_Tange.py#L13-L25 | train | calculate Gruneisen parameter for the Tange equation |
SHDShim/pytheos | pytheos/eqn_therm_Tange.py | tange_debyetemp | def tange_debyetemp(v, v0, gamma0, a, b, theta0):
"""
calculate Debye temperature for the Tange equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param a: volume-independent adjustable parameters
:param b: vol... | python | def tange_debyetemp(v, v0, gamma0, a, b, theta0):
"""
calculate Debye temperature for the Tange equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param a: volume-independent adjustable parameters
:param b: vol... | [
"def",
"tange_debyetemp",
"(",
"v",
",",
"v0",
",",
"gamma0",
",",
"a",
",",
"b",
",",
"theta0",
")",
":",
"x",
"=",
"v",
"/",
"v0",
"gamma",
"=",
"tange_grun",
"(",
"v",
",",
"v0",
",",
"gamma0",
",",
"a",
",",
"b",
")",
"if",
"isuncertainties... | calculate Debye temperature for the Tange equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param a: volume-independent adjustable parameters
:param b: volume-independent adjustable parameters
:param theta0: Debye... | [
"calculate",
"Debye",
"temperature",
"for",
"the",
"Tange",
"equation"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_therm_Tange.py#L28-L48 | train | calculate Debye temperature for the Tange equation |
SHDShim/pytheos | pytheos/eqn_therm_Tange.py | tange_pth | def tange_pth(v, temp, v0, gamma0, a, b, theta0, n, z,
t_ref=300., three_r=3. * constants.R):
"""
calculate thermal pressure for the Tange equation
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen ... | python | def tange_pth(v, temp, v0, gamma0, a, b, theta0, n, z,
t_ref=300., three_r=3. * constants.R):
"""
calculate thermal pressure for the Tange equation
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen ... | [
"def",
"tange_pth",
"(",
"v",
",",
"temp",
",",
"v0",
",",
"gamma0",
",",
"a",
",",
"b",
",",
"theta0",
",",
"n",
",",
"z",
",",
"t_ref",
"=",
"300.",
",",
"three_r",
"=",
"3.",
"*",
"constants",
".",
"R",
")",
":",
"v_mol",
"=",
"vol_uc2mol",
... | calculate thermal pressure for the Tange equation
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param a: volume-independent adjustable parameters
:param b: volume-independent adjustable pa... | [
"calculate",
"thermal",
"pressure",
"for",
"the",
"Tange",
"equation"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_therm_Tange.py#L51-L83 | train | calculate thermal pressure for a Tange formula |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _make_passage_kwargs | def _make_passage_kwargs(urn, reference):
""" Little helper used by CapitainsCtsPassage here to comply with parents args
:param urn: URN String
:param reference: Reference String
:return: Dictionary of arguments with URN based on identifier and reference
"""
kwargs = {}
if urn is not None:
... | python | def _make_passage_kwargs(urn, reference):
""" Little helper used by CapitainsCtsPassage here to comply with parents args
:param urn: URN String
:param reference: Reference String
:return: Dictionary of arguments with URN based on identifier and reference
"""
kwargs = {}
if urn is not None:
... | [
"def",
"_make_passage_kwargs",
"(",
"urn",
",",
"reference",
")",
":",
"kwargs",
"=",
"{",
"}",
"if",
"urn",
"is",
"not",
"None",
":",
"if",
"reference",
"is",
"not",
"None",
":",
"kwargs",
"[",
"\"urn\"",
"]",
"=",
"URN",
"(",
"\"{}:{}\"",
".",
"for... | Little helper used by CapitainsCtsPassage here to comply with parents args
:param urn: URN String
:param reference: Reference String
:return: Dictionary of arguments with URN based on identifier and reference | [
"Little",
"helper",
"used",
"by",
"CapitainsCtsPassage",
"here",
"to",
"comply",
"with",
"parents",
"args"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L33-L46 | train | Helper function to create keyword arguments for passage based on identifier and reference |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SharedMethods.getTextualNode | def getTextualNode(self, subreference=None, simple=False):
""" Finds a passage in the current text
:param subreference: Identifier of the subreference / passages
:type subreference: Union[list, CtsReference]
:param simple: If set to true, retrieves nodes up to the given one, cleaning no... | python | def getTextualNode(self, subreference=None, simple=False):
""" Finds a passage in the current text
:param subreference: Identifier of the subreference / passages
:type subreference: Union[list, CtsReference]
:param simple: If set to true, retrieves nodes up to the given one, cleaning no... | [
"def",
"getTextualNode",
"(",
"self",
",",
"subreference",
"=",
"None",
",",
"simple",
"=",
"False",
")",
":",
"if",
"subreference",
"is",
"None",
":",
"return",
"self",
".",
"_getSimplePassage",
"(",
")",
"if",
"not",
"isinstance",
"(",
"subreference",
",... | Finds a passage in the current text
:param subreference: Identifier of the subreference / passages
:type subreference: Union[list, CtsReference]
:param simple: If set to true, retrieves nodes up to the given one, cleaning non required siblings.
:type simple: boolean
:rtype: Capi... | [
"Finds",
"a",
"passage",
"in",
"the",
"current",
"text"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L53-L109 | train | Finds a passage in the current text object. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SharedMethods._getSimplePassage | def _getSimplePassage(self, reference=None):
""" Retrieve a single node representing the passage.
.. warning:: Range support is awkward.
:param reference: Identifier of the subreference / passages
:type reference: list, reference
:returns: Asked passage
:rtype: Capitain... | python | def _getSimplePassage(self, reference=None):
""" Retrieve a single node representing the passage.
.. warning:: Range support is awkward.
:param reference: Identifier of the subreference / passages
:type reference: list, reference
:returns: Asked passage
:rtype: Capitain... | [
"def",
"_getSimplePassage",
"(",
"self",
",",
"reference",
"=",
"None",
")",
":",
"if",
"reference",
"is",
"None",
":",
"return",
"_SimplePassage",
"(",
"resource",
"=",
"self",
".",
"resource",
",",
"reference",
"=",
"None",
",",
"urn",
"=",
"self",
"."... | Retrieve a single node representing the passage.
.. warning:: Range support is awkward.
:param reference: Identifier of the subreference / passages
:type reference: list, reference
:returns: Asked passage
:rtype: CapitainsCtsPassage | [
"Retrieve",
"a",
"single",
"node",
"representing",
"the",
"passage",
"."
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L111-L145 | train | Retrieve a single node representing the passage. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SharedMethods.getReffs | def getReffs(self, level: int=1, subreference: CtsReference=None) -> CtsReferenceSet:
""" CtsReference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:param subreference: Subreference (optional)
:returns: List of le... | python | def getReffs(self, level: int=1, subreference: CtsReference=None) -> CtsReferenceSet:
""" CtsReference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:param subreference: Subreference (optional)
:returns: List of le... | [
"def",
"getReffs",
"(",
"self",
",",
"level",
":",
"int",
"=",
"1",
",",
"subreference",
":",
"CtsReference",
"=",
"None",
")",
"->",
"CtsReferenceSet",
":",
"if",
"not",
"subreference",
"and",
"hasattr",
"(",
"self",
",",
"\"reference\"",
")",
":",
"sub... | CtsReference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:param subreference: Subreference (optional)
:returns: List of levels | [
"CtsReference",
"available",
"at",
"a",
"given",
"level"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L159-L172 | train | Returns a list of valid reffs at a given level. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SharedMethods.getValidReff | def getValidReff(self, level: int=1, reference: CtsReference=None, _debug: bool=False) -> CtsReferenceSet:
""" Retrieve valid passages directly
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: int
:param reference: CapitainsCtsPass... | python | def getValidReff(self, level: int=1, reference: CtsReference=None, _debug: bool=False) -> CtsReferenceSet:
""" Retrieve valid passages directly
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: int
:param reference: CapitainsCtsPass... | [
"def",
"getValidReff",
"(",
"self",
",",
"level",
":",
"int",
"=",
"1",
",",
"reference",
":",
"CtsReference",
"=",
"None",
",",
"_debug",
":",
"bool",
"=",
"False",
")",
"->",
"CtsReferenceSet",
":",
"depth",
"=",
"0",
"xml",
"=",
"self",
".",
"text... | Retrieve valid passages directly
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: int
:param reference: CapitainsCtsPassage Reference
:type reference: CtsReference
:param _debug: Check on passages duplicates
:type _... | [
"Retrieve",
"valid",
"passages",
"directly"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L174-L283 | train | Retrieve the valid passages for the given level and reference. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SharedMethods.xpath | def xpath(self, *args, **kwargs):
""" Perform XPath on the passage XML
:param args: Ordered arguments for etree._Element().xpath()
:param kwargs: Named arguments
:return: Result list
:rtype: list(etree._Element)
"""
if "smart_strings" not in kwargs:
k... | python | def xpath(self, *args, **kwargs):
""" Perform XPath on the passage XML
:param args: Ordered arguments for etree._Element().xpath()
:param kwargs: Named arguments
:return: Result list
:rtype: list(etree._Element)
"""
if "smart_strings" not in kwargs:
k... | [
"def",
"xpath",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"smart_strings\"",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"\"smart_strings\"",
"]",
"=",
"False",
"return",
"self",
".",
"resource",
".",
"xpath",
"(",
"*",
... | Perform XPath on the passage XML
:param args: Ordered arguments for etree._Element().xpath()
:param kwargs: Named arguments
:return: Result list
:rtype: list(etree._Element) | [
"Perform",
"XPath",
"on",
"the",
"passage",
"XML"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L285-L295 | train | Perform XPath on the passage XML
|
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SharedMethods.tostring | def tostring(self, *args, **kwargs):
""" Transform the CapitainsCtsPassage in XML string
:param args: Ordered arguments for etree.tostring() (except the first one)
:param kwargs: Named arguments
:return:
"""
return etree.tostring(self.resource, *args, **kwargs) | python | def tostring(self, *args, **kwargs):
""" Transform the CapitainsCtsPassage in XML string
:param args: Ordered arguments for etree.tostring() (except the first one)
:param kwargs: Named arguments
:return:
"""
return etree.tostring(self.resource, *args, **kwargs) | [
"def",
"tostring",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"etree",
".",
"tostring",
"(",
"self",
".",
"resource",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Transform the CapitainsCtsPassage in XML string
:param args: Ordered arguments for etree.tostring() (except the first one)
:param kwargs: Named arguments
:return: | [
"Transform",
"the",
"CapitainsCtsPassage",
"in",
"XML",
"string"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L297-L304 | train | Transform the CapitainsCtsPassage in XML string |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SimplePassage.childIds | def childIds(self):
""" Children of the passage
:rtype: None, CtsReference
:returns: Dictionary of chidren, where key are subreferences
"""
if self.depth >= len(self.citation.root):
return []
elif self._children is not None:
return self._children
... | python | def childIds(self):
""" Children of the passage
:rtype: None, CtsReference
:returns: Dictionary of chidren, where key are subreferences
"""
if self.depth >= len(self.citation.root):
return []
elif self._children is not None:
return self._children
... | [
"def",
"childIds",
"(",
"self",
")",
":",
"if",
"self",
".",
"depth",
">=",
"len",
"(",
"self",
".",
"citation",
".",
"root",
")",
":",
"return",
"[",
"]",
"elif",
"self",
".",
"_children",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_childre... | Children of the passage
:rtype: None, CtsReference
:returns: Dictionary of chidren, where key are subreferences | [
"Children",
"of",
"the",
"passage"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L349-L361 | train | Returns a dictionary of chidren where key is the child of the passage. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SimplePassage.getReffs | def getReffs(self, level=1, subreference=None) -> CtsReferenceSet:
""" Reference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based). 0 retrieves inside
a range
:param subreference: Subreference (optional)
:r... | python | def getReffs(self, level=1, subreference=None) -> CtsReferenceSet:
""" Reference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based). 0 retrieves inside
a range
:param subreference: Subreference (optional)
:r... | [
"def",
"getReffs",
"(",
"self",
",",
"level",
"=",
"1",
",",
"subreference",
"=",
"None",
")",
"->",
"CtsReferenceSet",
":",
"level",
"+=",
"self",
".",
"depth",
"if",
"not",
"subreference",
":",
"subreference",
"=",
"self",
".",
"reference",
"return",
"... | Reference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based). 0 retrieves inside
a range
:param subreference: Subreference (optional)
:returns: List of levels | [
"Reference",
"available",
"at",
"a",
"given",
"level"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L363-L374 | train | Returns a list of valid CtsReferenceSet for the given level and subreference. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SimplePassage.getTextualNode | def getTextualNode(self, subreference: CtsReference=None):
""" Special GetPassage implementation for SimplePassage (Simple is True by default)
:param subreference:
:return:
"""
if not isinstance(subreference, CtsReference):
subreference = CtsReference(subreference)
... | python | def getTextualNode(self, subreference: CtsReference=None):
""" Special GetPassage implementation for SimplePassage (Simple is True by default)
:param subreference:
:return:
"""
if not isinstance(subreference, CtsReference):
subreference = CtsReference(subreference)
... | [
"def",
"getTextualNode",
"(",
"self",
",",
"subreference",
":",
"CtsReference",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"subreference",
",",
"CtsReference",
")",
":",
"subreference",
"=",
"CtsReference",
"(",
"subreference",
")",
"return",
"self... | Special GetPassage implementation for SimplePassage (Simple is True by default)
:param subreference:
:return: | [
"Special",
"GetPassage",
"implementation",
"for",
"SimplePassage",
"(",
"Simple",
"is",
"True",
"by",
"default",
")"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L376-L384 | train | Special GetPassage implementation for SimplePassage. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | _SimplePassage.siblingsId | def siblingsId(self) -> Tuple[CtsReference, CtsReference]:
""" Siblings Identifiers of the passage
:rtype: (str, str)
"""
if not self._text:
raise MissingAttribute("CapitainsCtsPassage was iniated without CtsTextMetadata object")
if self._prev_next is not None:
... | python | def siblingsId(self) -> Tuple[CtsReference, CtsReference]:
""" Siblings Identifiers of the passage
:rtype: (str, str)
"""
if not self._text:
raise MissingAttribute("CapitainsCtsPassage was iniated without CtsTextMetadata object")
if self._prev_next is not None:
... | [
"def",
"siblingsId",
"(",
"self",
")",
"->",
"Tuple",
"[",
"CtsReference",
",",
"CtsReference",
"]",
":",
"if",
"not",
"self",
".",
"_text",
":",
"raise",
"MissingAttribute",
"(",
"\"CapitainsCtsPassage was iniated without CtsTextMetadata object\"",
")",
"if",
"self... | Siblings Identifiers of the passage
:rtype: (str, str) | [
"Siblings",
"Identifiers",
"of",
"the",
"passage"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L405-L441 | train | Returns the Siblings Identifiers of the passage. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | CapitainsCtsText._findCRefPattern | def _findCRefPattern(self, xml):
""" Find CRefPattern in the text and set object.citation
:param xml: Xml Resource
:type xml: lxml.etree._Element
:return: None
"""
if not self.citation.is_set():
citation = xml.xpath("//tei:refsDecl[@n='CTS']", namespaces=XPATH... | python | def _findCRefPattern(self, xml):
""" Find CRefPattern in the text and set object.citation
:param xml: Xml Resource
:type xml: lxml.etree._Element
:return: None
"""
if not self.citation.is_set():
citation = xml.xpath("//tei:refsDecl[@n='CTS']", namespaces=XPATH... | [
"def",
"_findCRefPattern",
"(",
"self",
",",
"xml",
")",
":",
"if",
"not",
"self",
".",
"citation",
".",
"is_set",
"(",
")",
":",
"citation",
"=",
"xml",
".",
"xpath",
"(",
"\"//tei:refsDecl[@n='CTS']\"",
",",
"namespaces",
"=",
"XPATH_NAMESPACES",
")",
"i... | Find CRefPattern in the text and set object.citation
:param xml: Xml Resource
:type xml: lxml.etree._Element
:return: None | [
"Find",
"CRefPattern",
"in",
"the",
"text",
"and",
"set",
"object",
".",
"citation",
":",
"param",
"xml",
":",
"Xml",
"Resource",
":",
"type",
"xml",
":",
"lxml",
".",
"etree",
".",
"_Element",
":",
"return",
":",
"None"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L472-L483 | train | Find CRefPattern in the text and set object. citation
|
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | CapitainsCtsPassage.siblingsId | def siblingsId(self) -> Tuple[CtsReference, CtsReference]:
""" Siblings Identifiers of the passage
:rtype: (str, str)
"""
self._raise_depth()
if not self._text:
raise MissingAttribute("CapitainsCtsPassage was initiated without CtsTextMetadata object")
if sel... | python | def siblingsId(self) -> Tuple[CtsReference, CtsReference]:
""" Siblings Identifiers of the passage
:rtype: (str, str)
"""
self._raise_depth()
if not self._text:
raise MissingAttribute("CapitainsCtsPassage was initiated without CtsTextMetadata object")
if sel... | [
"def",
"siblingsId",
"(",
"self",
")",
"->",
"Tuple",
"[",
"CtsReference",
",",
"CtsReference",
"]",
":",
"self",
".",
"_raise_depth",
"(",
")",
"if",
"not",
"self",
".",
"_text",
":",
"raise",
"MissingAttribute",
"(",
"\"CapitainsCtsPassage was initiated withou... | Siblings Identifiers of the passage
:rtype: (str, str) | [
"Siblings",
"Identifiers",
"of",
"the",
"passage"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L616-L669 | train | Returns the Siblings Identifiers of the passage. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | CapitainsCtsPassage.next | def next(self):
""" Next CapitainsCtsPassage (Interactive CapitainsCtsPassage)
"""
if self.nextId is not None:
return super(CapitainsCtsPassage, self).getTextualNode(subreference=self.nextId) | python | def next(self):
""" Next CapitainsCtsPassage (Interactive CapitainsCtsPassage)
"""
if self.nextId is not None:
return super(CapitainsCtsPassage, self).getTextualNode(subreference=self.nextId) | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"self",
".",
"nextId",
"is",
"not",
"None",
":",
"return",
"super",
"(",
"CapitainsCtsPassage",
",",
"self",
")",
".",
"getTextualNode",
"(",
"subreference",
"=",
"self",
".",
"nextId",
")"
] | Next CapitainsCtsPassage (Interactive CapitainsCtsPassage) | [
"Next",
"CapitainsCtsPassage",
"(",
"Interactive",
"CapitainsCtsPassage",
")"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L672-L676 | train | Returns the next CapitainsCtsPassage in the textual tree. |
Capitains/MyCapytain | MyCapytain/resources/texts/local/capitains/cts.py | CapitainsCtsPassage.prev | def prev(self):
""" Previous CapitainsCtsPassage (Interactive CapitainsCtsPassage)
"""
if self.prevId is not None:
return super(CapitainsCtsPassage, self).getTextualNode(subreference=self.prevId) | python | def prev(self):
""" Previous CapitainsCtsPassage (Interactive CapitainsCtsPassage)
"""
if self.prevId is not None:
return super(CapitainsCtsPassage, self).getTextualNode(subreference=self.prevId) | [
"def",
"prev",
"(",
"self",
")",
":",
"if",
"self",
".",
"prevId",
"is",
"not",
"None",
":",
"return",
"super",
"(",
"CapitainsCtsPassage",
",",
"self",
")",
".",
"getTextualNode",
"(",
"subreference",
"=",
"self",
".",
"prevId",
")"
] | Previous CapitainsCtsPassage (Interactive CapitainsCtsPassage) | [
"Previous",
"CapitainsCtsPassage",
"(",
"Interactive",
"CapitainsCtsPassage",
")"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L679-L683 | train | Get the previous CapitainsCtsPassage. |
rosshamish/hexgrid | hexgrid.py | location | def location(hexgrid_type, coord):
"""
Returns a formatted string representing the coordinate. The format depends on the
coordinate type.
Tiles look like: 1, 12
Nodes look like: (1 NW), (12 S)
Edges look like: (1 NW), (12 SE)
:param hexgrid_type: hexgrid.TILE, hexgrid.NODE, hexgrid.EDGE
... | python | def location(hexgrid_type, coord):
"""
Returns a formatted string representing the coordinate. The format depends on the
coordinate type.
Tiles look like: 1, 12
Nodes look like: (1 NW), (12 S)
Edges look like: (1 NW), (12 SE)
:param hexgrid_type: hexgrid.TILE, hexgrid.NODE, hexgrid.EDGE
... | [
"def",
"location",
"(",
"hexgrid_type",
",",
"coord",
")",
":",
"if",
"hexgrid_type",
"==",
"TILE",
":",
"return",
"str",
"(",
"coord",
")",
"elif",
"hexgrid_type",
"==",
"NODE",
":",
"tile_id",
"=",
"nearest_tile_to_node",
"(",
"coord",
")",
"dirn",
"=",
... | Returns a formatted string representing the coordinate. The format depends on the
coordinate type.
Tiles look like: 1, 12
Nodes look like: (1 NW), (12 S)
Edges look like: (1 NW), (12 SE)
:param hexgrid_type: hexgrid.TILE, hexgrid.NODE, hexgrid.EDGE
:param coord: integer coordinate in this modu... | [
"Returns",
"a",
"formatted",
"string",
"representing",
"the",
"coordinate",
".",
"The",
"format",
"depends",
"on",
"the",
"coordinate",
"type",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L72-L97 | train | Returns a formatted string representing the coordinate in this module s hexadecimal coordinate system. |
rosshamish/hexgrid | hexgrid.py | coastal_coords | def coastal_coords():
"""
A coastal coord is a 2-tuple: (tile id, direction).
An edge is coastal if it is on the grid's border.
:return: list( (tile_id, direction) )
"""
coast = list()
for tile_id in coastal_tile_ids():
tile_coord = tile_id_to_coord(tile_id)
for edge_coord ... | python | def coastal_coords():
"""
A coastal coord is a 2-tuple: (tile id, direction).
An edge is coastal if it is on the grid's border.
:return: list( (tile_id, direction) )
"""
coast = list()
for tile_id in coastal_tile_ids():
tile_coord = tile_id_to_coord(tile_id)
for edge_coord ... | [
"def",
"coastal_coords",
"(",
")",
":",
"coast",
"=",
"list",
"(",
")",
"for",
"tile_id",
"in",
"coastal_tile_ids",
"(",
")",
":",
"tile_coord",
"=",
"tile_id_to_coord",
"(",
"tile_id",
")",
"for",
"edge_coord",
"in",
"coastal_edges",
"(",
"tile_id",
")",
... | A coastal coord is a 2-tuple: (tile id, direction).
An edge is coastal if it is on the grid's border.
:return: list( (tile_id, direction) ) | [
"A",
"coastal",
"coord",
"is",
"a",
"2",
"-",
"tuple",
":",
"(",
"tile",
"id",
"direction",
")",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L128-L144 | train | Return a list of tuples that represent the coastal edges of the grid. |
rosshamish/hexgrid | hexgrid.py | coastal_edges | def coastal_edges(tile_id):
"""
Returns a list of coastal edge coordinate.
An edge is coastal if it is on the grid's border.
:return: list(int)
"""
edges = list()
tile_coord = tile_id_to_coord(tile_id)
for edge_coord in edges_touching_tile(tile_id):
dirn = tile_edge_offset_to_di... | python | def coastal_edges(tile_id):
"""
Returns a list of coastal edge coordinate.
An edge is coastal if it is on the grid's border.
:return: list(int)
"""
edges = list()
tile_coord = tile_id_to_coord(tile_id)
for edge_coord in edges_touching_tile(tile_id):
dirn = tile_edge_offset_to_di... | [
"def",
"coastal_edges",
"(",
"tile_id",
")",
":",
"edges",
"=",
"list",
"(",
")",
"tile_coord",
"=",
"tile_id_to_coord",
"(",
"tile_id",
")",
"for",
"edge_coord",
"in",
"edges_touching_tile",
"(",
"tile_id",
")",
":",
"dirn",
"=",
"tile_edge_offset_to_direction"... | Returns a list of coastal edge coordinate.
An edge is coastal if it is on the grid's border.
:return: list(int) | [
"Returns",
"a",
"list",
"of",
"coastal",
"edge",
"coordinate",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L147-L160 | train | Returns a list of coastal edge coordinate. |
rosshamish/hexgrid | hexgrid.py | tile_id_in_direction | def tile_id_in_direction(from_tile_id, direction):
"""
Variant on direction_to_tile. Returns None if there's no tile there.
:param from_tile_id: tile identifier, int
:param direction: str
:return: tile identifier, int or None
"""
coord_from = tile_id_to_coord(from_tile_id)
for offset, d... | python | def tile_id_in_direction(from_tile_id, direction):
"""
Variant on direction_to_tile. Returns None if there's no tile there.
:param from_tile_id: tile identifier, int
:param direction: str
:return: tile identifier, int or None
"""
coord_from = tile_id_to_coord(from_tile_id)
for offset, d... | [
"def",
"tile_id_in_direction",
"(",
"from_tile_id",
",",
"direction",
")",
":",
"coord_from",
"=",
"tile_id_to_coord",
"(",
"from_tile_id",
")",
"for",
"offset",
",",
"dirn",
"in",
"_tile_tile_offsets",
".",
"items",
"(",
")",
":",
"if",
"dirn",
"==",
"directi... | Variant on direction_to_tile. Returns None if there's no tile there.
:param from_tile_id: tile identifier, int
:param direction: str
:return: tile identifier, int or None | [
"Variant",
"on",
"direction_to_tile",
".",
"Returns",
"None",
"if",
"there",
"s",
"no",
"tile",
"there",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L163-L177 | train | Returns the ID of the first valid tile in the given direction. |
rosshamish/hexgrid | hexgrid.py | direction_to_tile | def direction_to_tile(from_tile_id, to_tile_id):
"""
Convenience method wrapping tile_tile_offset_to_direction. Used to get the direction
of the offset between two tiles. The tiles must be adjacent.
:param from_tile_id: tile identifier, int
:param to_tile_id: tile identifier, int
:return: direc... | python | def direction_to_tile(from_tile_id, to_tile_id):
"""
Convenience method wrapping tile_tile_offset_to_direction. Used to get the direction
of the offset between two tiles. The tiles must be adjacent.
:param from_tile_id: tile identifier, int
:param to_tile_id: tile identifier, int
:return: direc... | [
"def",
"direction_to_tile",
"(",
"from_tile_id",
",",
"to_tile_id",
")",
":",
"coord_from",
"=",
"tile_id_to_coord",
"(",
"from_tile_id",
")",
"coord_to",
"=",
"tile_id_to_coord",
"(",
"to_tile_id",
")",
"direction",
"=",
"tile_tile_offset_to_direction",
"(",
"coord_t... | Convenience method wrapping tile_tile_offset_to_direction. Used to get the direction
of the offset between two tiles. The tiles must be adjacent.
:param from_tile_id: tile identifier, int
:param to_tile_id: tile identifier, int
:return: direction from from_tile to to_tile, str | [
"Convenience",
"method",
"wrapping",
"tile_tile_offset_to_direction",
".",
"Used",
"to",
"get",
"the",
"direction",
"of",
"the",
"offset",
"between",
"two",
"tiles",
".",
"The",
"tiles",
"must",
"be",
"adjacent",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L180-L197 | train | This method returns the direction from from_tile to to_tile. |
rosshamish/hexgrid | hexgrid.py | edge_coord_in_direction | def edge_coord_in_direction(tile_id, direction):
"""
Returns the edge coordinate in the given direction at the given tile identifier.
:param tile_id: tile identifier, int
:param direction: direction, str
:return: edge coord, int
"""
tile_coord = tile_id_to_coord(tile_id)
for edge_coord ... | python | def edge_coord_in_direction(tile_id, direction):
"""
Returns the edge coordinate in the given direction at the given tile identifier.
:param tile_id: tile identifier, int
:param direction: direction, str
:return: edge coord, int
"""
tile_coord = tile_id_to_coord(tile_id)
for edge_coord ... | [
"def",
"edge_coord_in_direction",
"(",
"tile_id",
",",
"direction",
")",
":",
"tile_coord",
"=",
"tile_id_to_coord",
"(",
"tile_id",
")",
"for",
"edge_coord",
"in",
"edges_touching_tile",
"(",
"tile_id",
")",
":",
"if",
"tile_edge_offset_to_direction",
"(",
"edge_co... | Returns the edge coordinate in the given direction at the given tile identifier.
:param tile_id: tile identifier, int
:param direction: direction, str
:return: edge coord, int | [
"Returns",
"the",
"edge",
"coordinate",
"in",
"the",
"given",
"direction",
"at",
"the",
"given",
"tile",
"identifier",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L242-L257 | train | Returns the edge coordinate in the given direction at the given tile identifier. |
rosshamish/hexgrid | hexgrid.py | node_coord_in_direction | def node_coord_in_direction(tile_id, direction):
"""
Returns the node coordinate in the given direction at the given tile identifier.
:param tile_id: tile identifier, int
:param direction: direction, str
:return: node coord, int
"""
tile_coord = tile_id_to_coord(tile_id)
for node_coord ... | python | def node_coord_in_direction(tile_id, direction):
"""
Returns the node coordinate in the given direction at the given tile identifier.
:param tile_id: tile identifier, int
:param direction: direction, str
:return: node coord, int
"""
tile_coord = tile_id_to_coord(tile_id)
for node_coord ... | [
"def",
"node_coord_in_direction",
"(",
"tile_id",
",",
"direction",
")",
":",
"tile_coord",
"=",
"tile_id_to_coord",
"(",
"tile_id",
")",
"for",
"node_coord",
"in",
"nodes_touching_tile",
"(",
"tile_id",
")",
":",
"if",
"tile_node_offset_to_direction",
"(",
"node_co... | Returns the node coordinate in the given direction at the given tile identifier.
:param tile_id: tile identifier, int
:param direction: direction, str
:return: node coord, int | [
"Returns",
"the",
"node",
"coordinate",
"in",
"the",
"given",
"direction",
"at",
"the",
"given",
"tile",
"identifier",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L260-L275 | train | Returns the node coordinate in the given direction at the given tile identifier. |
rosshamish/hexgrid | hexgrid.py | tile_id_from_coord | def tile_id_from_coord(coord):
"""
Convert a tile coordinate to its corresponding tile identifier.
:param coord: coordinate of the tile, int
:return: tile identifier, Tile.tile_id
"""
for i, c in _tile_id_to_coord.items():
if c == coord:
return i
raise Exception('Tile id... | python | def tile_id_from_coord(coord):
"""
Convert a tile coordinate to its corresponding tile identifier.
:param coord: coordinate of the tile, int
:return: tile identifier, Tile.tile_id
"""
for i, c in _tile_id_to_coord.items():
if c == coord:
return i
raise Exception('Tile id... | [
"def",
"tile_id_from_coord",
"(",
"coord",
")",
":",
"for",
"i",
",",
"c",
"in",
"_tile_id_to_coord",
".",
"items",
"(",
")",
":",
"if",
"c",
"==",
"coord",
":",
"return",
"i",
"raise",
"Exception",
"(",
"'Tile id lookup failed, coord={} not found in map'",
".... | Convert a tile coordinate to its corresponding tile identifier.
:param coord: coordinate of the tile, int
:return: tile identifier, Tile.tile_id | [
"Convert",
"a",
"tile",
"coordinate",
"to",
"its",
"corresponding",
"tile",
"identifier",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L293-L303 | train | Convert a tile coordinate to its corresponding tile identifier. |
rosshamish/hexgrid | hexgrid.py | nearest_tile_to_edge_using_tiles | def nearest_tile_to_edge_using_tiles(tile_ids, edge_coord):
"""
Get the first tile found adjacent to the given edge. Returns a tile identifier.
:param tile_ids: tiles to look at for adjacency, list(Tile.tile_id)
:param edge_coord: edge coordinate to find an adjacent tile to, int
:return: tile ident... | python | def nearest_tile_to_edge_using_tiles(tile_ids, edge_coord):
"""
Get the first tile found adjacent to the given edge. Returns a tile identifier.
:param tile_ids: tiles to look at for adjacency, list(Tile.tile_id)
:param edge_coord: edge coordinate to find an adjacent tile to, int
:return: tile ident... | [
"def",
"nearest_tile_to_edge_using_tiles",
"(",
"tile_ids",
",",
"edge_coord",
")",
":",
"for",
"tile_id",
"in",
"tile_ids",
":",
"if",
"edge_coord",
"-",
"tile_id_to_coord",
"(",
"tile_id",
")",
"in",
"_tile_edge_offsets",
".",
"keys",
"(",
")",
":",
"return",
... | Get the first tile found adjacent to the given edge. Returns a tile identifier.
:param tile_ids: tiles to look at for adjacency, list(Tile.tile_id)
:param edge_coord: edge coordinate to find an adjacent tile to, int
:return: tile identifier of an adjacent tile, Tile.tile_id | [
"Get",
"the",
"first",
"tile",
"found",
"adjacent",
"to",
"the",
"given",
"edge",
".",
"Returns",
"a",
"tile",
"identifier",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L317-L328 | train | Find the first tile found adjacent to the given edge. Returns a tile identifier. |
rosshamish/hexgrid | hexgrid.py | nearest_tile_to_node_using_tiles | def nearest_tile_to_node_using_tiles(tile_ids, node_coord):
"""
Get the first tile found adjacent to the given node. Returns a tile identifier.
:param tile_ids: tiles to look at for adjacency, list(Tile.tile_id)
:param node_coord: node coordinate to find an adjacent tile to, int
:return: tile ident... | python | def nearest_tile_to_node_using_tiles(tile_ids, node_coord):
"""
Get the first tile found adjacent to the given node. Returns a tile identifier.
:param tile_ids: tiles to look at for adjacency, list(Tile.tile_id)
:param node_coord: node coordinate to find an adjacent tile to, int
:return: tile ident... | [
"def",
"nearest_tile_to_node_using_tiles",
"(",
"tile_ids",
",",
"node_coord",
")",
":",
"for",
"tile_id",
"in",
"tile_ids",
":",
"if",
"node_coord",
"-",
"tile_id_to_coord",
"(",
"tile_id",
")",
"in",
"_tile_node_offsets",
".",
"keys",
"(",
")",
":",
"return",
... | Get the first tile found adjacent to the given node. Returns a tile identifier.
:param tile_ids: tiles to look at for adjacency, list(Tile.tile_id)
:param node_coord: node coordinate to find an adjacent tile to, int
:return: tile identifier of an adjacent tile, Tile.tile_id | [
"Get",
"the",
"first",
"tile",
"found",
"adjacent",
"to",
"the",
"given",
"node",
".",
"Returns",
"a",
"tile",
"identifier",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L342-L353 | train | Get the first tile found adjacent to the given node. Returns a tile identifier. |
rosshamish/hexgrid | hexgrid.py | edges_touching_tile | def edges_touching_tile(tile_id):
"""
Get a list of edge coordinates touching the given tile.
:param tile_id: tile identifier, Tile.tile_id
:return: list of edge coordinates touching the given tile, list(int)
"""
coord = tile_id_to_coord(tile_id)
edges = []
for offset in _tile_edge_offs... | python | def edges_touching_tile(tile_id):
"""
Get a list of edge coordinates touching the given tile.
:param tile_id: tile identifier, Tile.tile_id
:return: list of edge coordinates touching the given tile, list(int)
"""
coord = tile_id_to_coord(tile_id)
edges = []
for offset in _tile_edge_offs... | [
"def",
"edges_touching_tile",
"(",
"tile_id",
")",
":",
"coord",
"=",
"tile_id_to_coord",
"(",
"tile_id",
")",
"edges",
"=",
"[",
"]",
"for",
"offset",
"in",
"_tile_edge_offsets",
".",
"keys",
"(",
")",
":",
"edges",
".",
"append",
"(",
"coord",
"+",
"of... | Get a list of edge coordinates touching the given tile.
:param tile_id: tile identifier, Tile.tile_id
:return: list of edge coordinates touching the given tile, list(int) | [
"Get",
"a",
"list",
"of",
"edge",
"coordinates",
"touching",
"the",
"given",
"tile",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L356-L368 | train | Get a list of edge coordinates touching a given tile. |
rosshamish/hexgrid | hexgrid.py | nodes_touching_tile | def nodes_touching_tile(tile_id):
"""
Get a list of node coordinates touching the given tile.
:param tile_id: tile identifier, Tile.tile_id
:return: list of node coordinates touching the given tile, list(int)
"""
coord = tile_id_to_coord(tile_id)
nodes = []
for offset in _tile_node_offs... | python | def nodes_touching_tile(tile_id):
"""
Get a list of node coordinates touching the given tile.
:param tile_id: tile identifier, Tile.tile_id
:return: list of node coordinates touching the given tile, list(int)
"""
coord = tile_id_to_coord(tile_id)
nodes = []
for offset in _tile_node_offs... | [
"def",
"nodes_touching_tile",
"(",
"tile_id",
")",
":",
"coord",
"=",
"tile_id_to_coord",
"(",
"tile_id",
")",
"nodes",
"=",
"[",
"]",
"for",
"offset",
"in",
"_tile_node_offsets",
".",
"keys",
"(",
")",
":",
"nodes",
".",
"append",
"(",
"coord",
"+",
"of... | Get a list of node coordinates touching the given tile.
:param tile_id: tile identifier, Tile.tile_id
:return: list of node coordinates touching the given tile, list(int) | [
"Get",
"a",
"list",
"of",
"node",
"coordinates",
"touching",
"the",
"given",
"tile",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L371-L383 | train | Get a list of node coordinates touching a given tile. |
rosshamish/hexgrid | hexgrid.py | nodes_touching_edge | def nodes_touching_edge(edge_coord):
"""
Returns the two node coordinates which are on the given edge coordinate.
:return: list of 2 node coordinates which are on the given edge coordinate, list(int)
"""
a, b = hex_digit(edge_coord, 1), hex_digit(edge_coord, 2)
if a % 2 == 0 and b % 2 == 0:
... | python | def nodes_touching_edge(edge_coord):
"""
Returns the two node coordinates which are on the given edge coordinate.
:return: list of 2 node coordinates which are on the given edge coordinate, list(int)
"""
a, b = hex_digit(edge_coord, 1), hex_digit(edge_coord, 2)
if a % 2 == 0 and b % 2 == 0:
... | [
"def",
"nodes_touching_edge",
"(",
"edge_coord",
")",
":",
"a",
",",
"b",
"=",
"hex_digit",
"(",
"edge_coord",
",",
"1",
")",
",",
"hex_digit",
"(",
"edge_coord",
",",
"2",
")",
"if",
"a",
"%",
"2",
"==",
"0",
"and",
"b",
"%",
"2",
"==",
"0",
":"... | Returns the two node coordinates which are on the given edge coordinate.
:return: list of 2 node coordinates which are on the given edge coordinate, list(int) | [
"Returns",
"the",
"two",
"node",
"coordinates",
"which",
"are",
"on",
"the",
"given",
"edge",
"coordinate",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L386-L398 | train | Returns the two node coordinates which are on the given edge coordinate. |
rosshamish/hexgrid | hexgrid.py | legal_edge_coords | def legal_edge_coords():
"""
Return all legal edge coordinates on the grid.
"""
edges = set()
for tile_id in legal_tile_ids():
for edge in edges_touching_tile(tile_id):
edges.add(edge)
logging.debug('Legal edge coords({})={}'.format(len(edges), edges))
return edges | python | def legal_edge_coords():
"""
Return all legal edge coordinates on the grid.
"""
edges = set()
for tile_id in legal_tile_ids():
for edge in edges_touching_tile(tile_id):
edges.add(edge)
logging.debug('Legal edge coords({})={}'.format(len(edges), edges))
return edges | [
"def",
"legal_edge_coords",
"(",
")",
":",
"edges",
"=",
"set",
"(",
")",
"for",
"tile_id",
"in",
"legal_tile_ids",
"(",
")",
":",
"for",
"edge",
"in",
"edges_touching_tile",
"(",
"tile_id",
")",
":",
"edges",
".",
"add",
"(",
"edge",
")",
"logging",
"... | Return all legal edge coordinates on the grid. | [
"Return",
"all",
"legal",
"edge",
"coordinates",
"on",
"the",
"grid",
"."
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L401-L410 | train | Return all legal edge coordinates on the grid. |
rosshamish/hexgrid | hexgrid.py | legal_node_coords | def legal_node_coords():
"""
Return all legal node coordinates on the grid
"""
nodes = set()
for tile_id in legal_tile_ids():
for node in nodes_touching_tile(tile_id):
nodes.add(node)
logging.debug('Legal node coords({})={}'.format(len(nodes), nodes))
return nodes | python | def legal_node_coords():
"""
Return all legal node coordinates on the grid
"""
nodes = set()
for tile_id in legal_tile_ids():
for node in nodes_touching_tile(tile_id):
nodes.add(node)
logging.debug('Legal node coords({})={}'.format(len(nodes), nodes))
return nodes | [
"def",
"legal_node_coords",
"(",
")",
":",
"nodes",
"=",
"set",
"(",
")",
"for",
"tile_id",
"in",
"legal_tile_ids",
"(",
")",
":",
"for",
"node",
"in",
"nodes_touching_tile",
"(",
"tile_id",
")",
":",
"nodes",
".",
"add",
"(",
"node",
")",
"logging",
"... | Return all legal node coordinates on the grid | [
"Return",
"all",
"legal",
"node",
"coordinates",
"on",
"the",
"grid"
] | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L413-L422 | train | Return all legal node coordinates on the grid |
rosshamish/hexgrid | hexgrid.py | hex_digit | def hex_digit(coord, digit=1):
"""
Returns either the first or second digit of the hexadecimal representation of the given coordinate.
:param coord: hexadecimal coordinate, int
:param digit: 1 or 2, meaning either the first or second digit of the hexadecimal
:return: int, either the first or second ... | python | def hex_digit(coord, digit=1):
"""
Returns either the first or second digit of the hexadecimal representation of the given coordinate.
:param coord: hexadecimal coordinate, int
:param digit: 1 or 2, meaning either the first or second digit of the hexadecimal
:return: int, either the first or second ... | [
"def",
"hex_digit",
"(",
"coord",
",",
"digit",
"=",
"1",
")",
":",
"if",
"digit",
"not",
"in",
"[",
"1",
",",
"2",
"]",
":",
"raise",
"ValueError",
"(",
"'hex_digit can only get the first or second digit of a hex number, was passed digit={}'",
".",
"format",
"(",... | Returns either the first or second digit of the hexadecimal representation of the given coordinate.
:param coord: hexadecimal coordinate, int
:param digit: 1 or 2, meaning either the first or second digit of the hexadecimal
:return: int, either the first or second digit | [
"Returns",
"either",
"the",
"first",
"or",
"second",
"digit",
"of",
"the",
"hexadecimal",
"representation",
"of",
"the",
"given",
"coordinate",
".",
":",
"param",
"coord",
":",
"hexadecimal",
"coordinate",
"int",
":",
"param",
"digit",
":",
"1",
"or",
"2",
... | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L439-L450 | train | Returns either the first or second digit of the hexadecimal representation of the given coordinate. |
rosshamish/hexgrid | hexgrid.py | rotate_direction | def rotate_direction(hexgrid_type, direction, ccw=True):
"""
Takes a direction string associated with a type of hexgrid element, and rotates it one tick in the given direction.
:param direction: string, eg 'NW', 'N', 'SE'
:param ccw: if True, rotates counter clockwise. Otherwise, rotates clockwise.
... | python | def rotate_direction(hexgrid_type, direction, ccw=True):
"""
Takes a direction string associated with a type of hexgrid element, and rotates it one tick in the given direction.
:param direction: string, eg 'NW', 'N', 'SE'
:param ccw: if True, rotates counter clockwise. Otherwise, rotates clockwise.
... | [
"def",
"rotate_direction",
"(",
"hexgrid_type",
",",
"direction",
",",
"ccw",
"=",
"True",
")",
":",
"if",
"hexgrid_type",
"in",
"[",
"TILE",
",",
"EDGE",
"]",
":",
"directions",
"=",
"[",
"'NW'",
",",
"'W'",
",",
"'SW'",
",",
"'SE'",
",",
"'E'",
","... | Takes a direction string associated with a type of hexgrid element, and rotates it one tick in the given direction.
:param direction: string, eg 'NW', 'N', 'SE'
:param ccw: if True, rotates counter clockwise. Otherwise, rotates clockwise.
:return: the rotated direction string, eg 'SW', 'NW', 'S' | [
"Takes",
"a",
"direction",
"string",
"associated",
"with",
"a",
"type",
"of",
"hexgrid",
"element",
"and",
"rotates",
"it",
"one",
"tick",
"in",
"the",
"given",
"direction",
".",
":",
"param",
"direction",
":",
"string",
"eg",
"NW",
"N",
"SE",
":",
"para... | 16abb1822dc2789cb355f54fb06c7774eea1d9f2 | https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L469-L485 | train | Rotates a given hexgrid element in one tick in the given direction. |
lbryio/aioupnp | aioupnp/commands.py | SOAPCommands.AddPortMapping | async def AddPortMapping(NewRemoteHost: str, NewExternalPort: int, NewProtocol: str, NewInternalPort: int,
NewInternalClient: str, NewEnabled: int, NewPortMappingDescription: str,
NewLeaseDuration: str) -> None:
"""Returns None"""
raise NotImplementedError() | python | async def AddPortMapping(NewRemoteHost: str, NewExternalPort: int, NewProtocol: str, NewInternalPort: int,
NewInternalClient: str, NewEnabled: int, NewPortMappingDescription: str,
NewLeaseDuration: str) -> None:
"""Returns None"""
raise NotImplementedError() | [
"async",
"def",
"AddPortMapping",
"(",
"NewRemoteHost",
":",
"str",
",",
"NewExternalPort",
":",
"int",
",",
"NewProtocol",
":",
"str",
",",
"NewInternalPort",
":",
"int",
",",
"NewInternalClient",
":",
"str",
",",
"NewEnabled",
":",
"int",
",",
"NewPortMappin... | Returns None | [
"Returns",
"None"
] | a404269d91cff5358bcffb8067b0fd1d9c6842d3 | https://github.com/lbryio/aioupnp/blob/a404269d91cff5358bcffb8067b0fd1d9c6842d3/aioupnp/commands.py#L134-L138 | train | Add a new port mapping to the cluster. |
lbryio/aioupnp | aioupnp/commands.py | SOAPCommands.GetGenericPortMappingEntry | async def GetGenericPortMappingEntry(NewPortMappingIndex: int) -> Tuple[str, int, str, int, str,
bool, str, int]:
"""
Returns (NewRemoteHost, NewExternalPort, NewProtocol, NewInternalPort, NewInternalClient, NewEnabled,
... | python | async def GetGenericPortMappingEntry(NewPortMappingIndex: int) -> Tuple[str, int, str, int, str,
bool, str, int]:
"""
Returns (NewRemoteHost, NewExternalPort, NewProtocol, NewInternalPort, NewInternalClient, NewEnabled,
... | [
"async",
"def",
"GetGenericPortMappingEntry",
"(",
"NewPortMappingIndex",
":",
"int",
")",
"->",
"Tuple",
"[",
"str",
",",
"int",
",",
"str",
",",
"int",
",",
"str",
",",
"bool",
",",
"str",
",",
"int",
"]",
":",
"raise",
"NotImplementedError",
"(",
")"
... | Returns (NewRemoteHost, NewExternalPort, NewProtocol, NewInternalPort, NewInternalClient, NewEnabled,
NewPortMappingDescription, NewLeaseDuration) | [
"Returns",
"(",
"NewRemoteHost",
"NewExternalPort",
"NewProtocol",
"NewInternalPort",
"NewInternalClient",
"NewEnabled",
"NewPortMappingDescription",
"NewLeaseDuration",
")"
] | a404269d91cff5358bcffb8067b0fd1d9c6842d3 | https://github.com/lbryio/aioupnp/blob/a404269d91cff5358bcffb8067b0fd1d9c6842d3/aioupnp/commands.py#L146-L152 | train | Get Generic Port Mapping Entry. |
lbryio/aioupnp | aioupnp/commands.py | SOAPCommands.GetSpecificPortMappingEntry | async def GetSpecificPortMappingEntry(NewRemoteHost: str, NewExternalPort: int,
NewProtocol: str) -> Tuple[int, str, bool, str, int]:
"""Returns (NewInternalPort, NewInternalClient, NewEnabled, NewPortMappingDescription, NewLeaseDuration)"""
raise NotImplemented... | python | async def GetSpecificPortMappingEntry(NewRemoteHost: str, NewExternalPort: int,
NewProtocol: str) -> Tuple[int, str, bool, str, int]:
"""Returns (NewInternalPort, NewInternalClient, NewEnabled, NewPortMappingDescription, NewLeaseDuration)"""
raise NotImplemented... | [
"async",
"def",
"GetSpecificPortMappingEntry",
"(",
"NewRemoteHost",
":",
"str",
",",
"NewExternalPort",
":",
"int",
",",
"NewProtocol",
":",
"str",
")",
"->",
"Tuple",
"[",
"int",
",",
"str",
",",
"bool",
",",
"str",
",",
"int",
"]",
":",
"raise",
"NotI... | Returns (NewInternalPort, NewInternalClient, NewEnabled, NewPortMappingDescription, NewLeaseDuration) | [
"Returns",
"(",
"NewInternalPort",
"NewInternalClient",
"NewEnabled",
"NewPortMappingDescription",
"NewLeaseDuration",
")"
] | a404269d91cff5358bcffb8067b0fd1d9c6842d3 | https://github.com/lbryio/aioupnp/blob/a404269d91cff5358bcffb8067b0fd1d9c6842d3/aioupnp/commands.py#L155-L158 | train | Get specific port mapping entry. |
jiasir/playback | playback/cli/manila.py | make | def make(parser):
"""provison Manila with HA"""
s = parser.add_subparsers(
title='commands',
metavar='COMMAND',
help='description',
)
def create_manila_db_f(args):
create_manila_db(args)
create_manila_db_parser = create_manila_db_subparser(s)
create_manila_db... | python | def make(parser):
"""provison Manila with HA"""
s = parser.add_subparsers(
title='commands',
metavar='COMMAND',
help='description',
)
def create_manila_db_f(args):
create_manila_db(args)
create_manila_db_parser = create_manila_db_subparser(s)
create_manila_db... | [
"def",
"make",
"(",
"parser",
")",
":",
"s",
"=",
"parser",
".",
"add_subparsers",
"(",
"title",
"=",
"'commands'",
",",
"metavar",
"=",
"'COMMAND'",
",",
"help",
"=",
"'description'",
",",
")",
"def",
"create_manila_db_f",
"(",
"args",
")",
":",
"create... | provison Manila with HA | [
"provison",
"Manila",
"with",
"HA"
] | 58b2a5d669dcfaa8cad50c544a4b068dcacf9b69 | https://github.com/jiasir/playback/blob/58b2a5d669dcfaa8cad50c544a4b068dcacf9b69/playback/cli/manila.py#L163-L184 | train | provison Manila with HA |
zhemao/funktown | funktown/lookuptree.py | LookupTree.assoc | def assoc(self, index, value):
'''Return a new tree with value associated at index.'''
newnode = LookupTreeNode(index, value)
newtree = LookupTree()
newtree.root = _assoc_down(self.root, newnode, 0)
return newtree | python | def assoc(self, index, value):
'''Return a new tree with value associated at index.'''
newnode = LookupTreeNode(index, value)
newtree = LookupTree()
newtree.root = _assoc_down(self.root, newnode, 0)
return newtree | [
"def",
"assoc",
"(",
"self",
",",
"index",
",",
"value",
")",
":",
"newnode",
"=",
"LookupTreeNode",
"(",
"index",
",",
"value",
")",
"newtree",
"=",
"LookupTree",
"(",
")",
"newtree",
".",
"root",
"=",
"_assoc_down",
"(",
"self",
".",
"root",
",",
"... | Return a new tree with value associated at index. | [
"Return",
"a",
"new",
"tree",
"with",
"value",
"associated",
"at",
"index",
"."
] | 8d5c5a8bdad2b85b33b4cea3febd820c2657c375 | https://github.com/zhemao/funktown/blob/8d5c5a8bdad2b85b33b4cea3febd820c2657c375/funktown/lookuptree.py#L73-L78 | train | Return a new tree with value associated at index. |
zhemao/funktown | funktown/lookuptree.py | LookupTree.multi_assoc | def multi_assoc(self, values):
'''Return a new tree with multiple values associated. The parameter
values can either be a dictionary mapping indices to values, or a list
of (index,value) tuples'''
if isinstance(values, dict):
nndict = dict([(i, LookupTreeNode(i, values[i])) f... | python | def multi_assoc(self, values):
'''Return a new tree with multiple values associated. The parameter
values can either be a dictionary mapping indices to values, or a list
of (index,value) tuples'''
if isinstance(values, dict):
nndict = dict([(i, LookupTreeNode(i, values[i])) f... | [
"def",
"multi_assoc",
"(",
"self",
",",
"values",
")",
":",
"if",
"isinstance",
"(",
"values",
",",
"dict",
")",
":",
"nndict",
"=",
"dict",
"(",
"[",
"(",
"i",
",",
"LookupTreeNode",
"(",
"i",
",",
"values",
"[",
"i",
"]",
")",
")",
"for",
"i",
... | Return a new tree with multiple values associated. The parameter
values can either be a dictionary mapping indices to values, or a list
of (index,value) tuples | [
"Return",
"a",
"new",
"tree",
"with",
"multiple",
"values",
"associated",
".",
"The",
"parameter",
"values",
"can",
"either",
"be",
"a",
"dictionary",
"mapping",
"indices",
"to",
"values",
"or",
"a",
"list",
"of",
"(",
"index",
"value",
")",
"tuples"
] | 8d5c5a8bdad2b85b33b4cea3febd820c2657c375 | https://github.com/zhemao/funktown/blob/8d5c5a8bdad2b85b33b4cea3febd820c2657c375/funktown/lookuptree.py#L80-L90 | train | Return a new tree with multiple values associated. The parameter
values can either be a dictionary mapping indices to values or a list of tuples of values. |
zhemao/funktown | funktown/lookuptree.py | LookupTree.remove | def remove(self, index):
'''Return new tree with index removed.'''
newtree = LookupTree()
newtree.root = _remove_down(self.root, index, 0)
return newtree | python | def remove(self, index):
'''Return new tree with index removed.'''
newtree = LookupTree()
newtree.root = _remove_down(self.root, index, 0)
return newtree | [
"def",
"remove",
"(",
"self",
",",
"index",
")",
":",
"newtree",
"=",
"LookupTree",
"(",
")",
"newtree",
".",
"root",
"=",
"_remove_down",
"(",
"self",
".",
"root",
",",
"index",
",",
"0",
")",
"return",
"newtree"
] | Return new tree with index removed. | [
"Return",
"new",
"tree",
"with",
"index",
"removed",
"."
] | 8d5c5a8bdad2b85b33b4cea3febd820c2657c375 | https://github.com/zhemao/funktown/blob/8d5c5a8bdad2b85b33b4cea3febd820c2657c375/funktown/lookuptree.py#L92-L96 | train | Return new tree with index removed. |
zhemao/funktown | funktown/lookuptree.py | LookupTree.insert | def insert(self, index, value):
'''Insert a node in-place. It is highly suggested that you do not
use this method. Use assoc instead'''
newnode = LookupTreeNode(index, value)
level = 0
node = self.root
while True:
ind = _getbits(newnode.index, level)
... | python | def insert(self, index, value):
'''Insert a node in-place. It is highly suggested that you do not
use this method. Use assoc instead'''
newnode = LookupTreeNode(index, value)
level = 0
node = self.root
while True:
ind = _getbits(newnode.index, level)
... | [
"def",
"insert",
"(",
"self",
",",
"index",
",",
"value",
")",
":",
"newnode",
"=",
"LookupTreeNode",
"(",
"index",
",",
"value",
")",
"level",
"=",
"0",
"node",
"=",
"self",
".",
"root",
"while",
"True",
":",
"ind",
"=",
"_getbits",
"(",
"newnode",
... | Insert a node in-place. It is highly suggested that you do not
use this method. Use assoc instead | [
"Insert",
"a",
"node",
"in",
"-",
"place",
".",
"It",
"is",
"highly",
"suggested",
"that",
"you",
"do",
"not",
"use",
"this",
"method",
".",
"Use",
"assoc",
"instead"
] | 8d5c5a8bdad2b85b33b4cea3febd820c2657c375 | https://github.com/zhemao/funktown/blob/8d5c5a8bdad2b85b33b4cea3febd820c2657c375/funktown/lookuptree.py#L98-L130 | train | Insert a node in - place. It is highly suggested that you do not have a value in - place. Use assoc instead. |
ivilata/pymultihash | multihash/codecs.py | CodecReg.reset | def reset(cls):
"""Reset the registry to the standard codecs."""
cls._codecs = {}
c = cls._codec
for (name, encode, decode) in cls._common_codec_data:
cls._codecs[name] = c(encode, decode) | python | def reset(cls):
"""Reset the registry to the standard codecs."""
cls._codecs = {}
c = cls._codec
for (name, encode, decode) in cls._common_codec_data:
cls._codecs[name] = c(encode, decode) | [
"def",
"reset",
"(",
"cls",
")",
":",
"cls",
".",
"_codecs",
"=",
"{",
"}",
"c",
"=",
"cls",
".",
"_codec",
"for",
"(",
"name",
",",
"encode",
",",
"decode",
")",
"in",
"cls",
".",
"_common_codec_data",
":",
"cls",
".",
"_codecs",
"[",
"name",
"]... | Reset the registry to the standard codecs. | [
"Reset",
"the",
"registry",
"to",
"the",
"standard",
"codecs",
"."
] | 093365f20f6d8627c1fae13e0f4e0b35e9b39ad2 | https://github.com/ivilata/pymultihash/blob/093365f20f6d8627c1fae13e0f4e0b35e9b39ad2/multihash/codecs.py#L57-L62 | train | Reset the registry to the standard codecs. |
ivilata/pymultihash | multihash/codecs.py | CodecReg.register | def register(cls, name, encode, decode):
"""Add a codec to the registry.
Registers a codec with the given `name` (a string) to be used with the
given `encode` and `decode` functions, which take a `bytes` object and
return another one. An existing codec is replaced.
>>> import ... | python | def register(cls, name, encode, decode):
"""Add a codec to the registry.
Registers a codec with the given `name` (a string) to be used with the
given `encode` and `decode` functions, which take a `bytes` object and
return another one. An existing codec is replaced.
>>> import ... | [
"def",
"register",
"(",
"cls",
",",
"name",
",",
"encode",
",",
"decode",
")",
":",
"cls",
".",
"_codecs",
"[",
"name",
"]",
"=",
"cls",
".",
"_codec",
"(",
"encode",
",",
"decode",
")"
] | Add a codec to the registry.
Registers a codec with the given `name` (a string) to be used with the
given `encode` and `decode` functions, which take a `bytes` object and
return another one. An existing codec is replaced.
>>> import binascii
>>> CodecReg.register('uu', binasci... | [
"Add",
"a",
"codec",
"to",
"the",
"registry",
"."
] | 093365f20f6d8627c1fae13e0f4e0b35e9b39ad2 | https://github.com/ivilata/pymultihash/blob/093365f20f6d8627c1fae13e0f4e0b35e9b39ad2/multihash/codecs.py#L65-L80 | train | Add a codec to the registry. |
klen/muffin-admin | muffin_admin/formatters.py | default_formatter | def default_formatter(handler, item, value):
"""Default formatter. Convert value to string."""
if hasattr(value, '__unicode__'):
value = value.__unicode__()
return escape(str(value)) | python | def default_formatter(handler, item, value):
"""Default formatter. Convert value to string."""
if hasattr(value, '__unicode__'):
value = value.__unicode__()
return escape(str(value)) | [
"def",
"default_formatter",
"(",
"handler",
",",
"item",
",",
"value",
")",
":",
"if",
"hasattr",
"(",
"value",
",",
"'__unicode__'",
")",
":",
"value",
"=",
"value",
".",
"__unicode__",
"(",
")",
"return",
"escape",
"(",
"str",
"(",
"value",
")",
")"
... | Default formatter. Convert value to string. | [
"Default",
"formatter",
".",
"Convert",
"value",
"to",
"string",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/formatters.py#L7-L12 | train | Default formatter. Convert value to string. |
klen/muffin-admin | muffin_admin/formatters.py | list_formatter | def list_formatter(handler, item, value):
"""Format list."""
return u', '.join(str(v) for v in value) | python | def list_formatter(handler, item, value):
"""Format list."""
return u', '.join(str(v) for v in value) | [
"def",
"list_formatter",
"(",
"handler",
",",
"item",
",",
"value",
")",
":",
"return",
"u', '",
".",
"join",
"(",
"str",
"(",
"v",
")",
"for",
"v",
"in",
"value",
")"
] | Format list. | [
"Format",
"list",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/formatters.py#L21-L23 | train | Format list. |
klen/muffin-admin | muffin_admin/formatters.py | format_value | def format_value(handler, item, column):
"""Format value."""
value = getattr(item, column, None)
formatter = FORMATTERS.get(type(value), default_formatter)
return formatter(handler, item, value) | python | def format_value(handler, item, column):
"""Format value."""
value = getattr(item, column, None)
formatter = FORMATTERS.get(type(value), default_formatter)
return formatter(handler, item, value) | [
"def",
"format_value",
"(",
"handler",
",",
"item",
",",
"column",
")",
":",
"value",
"=",
"getattr",
"(",
"item",
",",
"column",
",",
"None",
")",
"formatter",
"=",
"FORMATTERS",
".",
"get",
"(",
"type",
"(",
"value",
")",
",",
"default_formatter",
")... | Format value. | [
"Format",
"value",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/formatters.py#L49-L53 | train | Format value. |
xflr6/features | features/parsers.py | make_regex | def make_regex(string):
"""Regex string for optionally signed binary or privative feature.
>>> [make_regex(s) for s in '+spam -spam spam'.split()]
['([+]?spam)', '(-spam)', '(spam)']
>>> make_regex('+eggs-spam')
Traceback (most recent call last):
...
ValueError: inappropriate feature n... | python | def make_regex(string):
"""Regex string for optionally signed binary or privative feature.
>>> [make_regex(s) for s in '+spam -spam spam'.split()]
['([+]?spam)', '(-spam)', '(spam)']
>>> make_regex('+eggs-spam')
Traceback (most recent call last):
...
ValueError: inappropriate feature n... | [
"def",
"make_regex",
"(",
"string",
")",
":",
"if",
"string",
"and",
"string",
"[",
"0",
"]",
"in",
"'+-'",
":",
"sign",
",",
"name",
"=",
"string",
"[",
"0",
"]",
",",
"string",
"[",
"1",
":",
"]",
"if",
"not",
"name",
"or",
"'+'",
"in",
"name... | Regex string for optionally signed binary or privative feature.
>>> [make_regex(s) for s in '+spam -spam spam'.split()]
['([+]?spam)', '(-spam)', '(spam)']
>>> make_regex('+eggs-spam')
Traceback (most recent call last):
...
ValueError: inappropriate feature name: '+eggs-spam'
>>> make... | [
"Regex",
"string",
"for",
"optionally",
"signed",
"binary",
"or",
"privative",
"feature",
"."
] | f985304dd642da6ecdc66d85167d00daa4efe5f4 | https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/parsers.py#L18-L45 | train | Return a regular expression string for optionally signed binary or privative feature. |
xflr6/features | features/parsers.py | substring_names | def substring_names(features):
"""Yield all feature name pairs in substring relation.
>>> list(substring_names(['+spam', '-ham', '+pam']))
[('pam', 'spam')]
"""
names = tools.uniqued(map(remove_sign, features))
for l, r in permutations(names, 2):
if l in r:
yield (l, r) | python | def substring_names(features):
"""Yield all feature name pairs in substring relation.
>>> list(substring_names(['+spam', '-ham', '+pam']))
[('pam', 'spam')]
"""
names = tools.uniqued(map(remove_sign, features))
for l, r in permutations(names, 2):
if l in r:
yield (l, r) | [
"def",
"substring_names",
"(",
"features",
")",
":",
"names",
"=",
"tools",
".",
"uniqued",
"(",
"map",
"(",
"remove_sign",
",",
"features",
")",
")",
"for",
"l",
",",
"r",
"in",
"permutations",
"(",
"names",
",",
"2",
")",
":",
"if",
"l",
"in",
"r... | Yield all feature name pairs in substring relation.
>>> list(substring_names(['+spam', '-ham', '+pam']))
[('pam', 'spam')] | [
"Yield",
"all",
"feature",
"name",
"pairs",
"in",
"substring",
"relation",
"."
] | f985304dd642da6ecdc66d85167d00daa4efe5f4 | https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/parsers.py#L48-L57 | train | Yield all feature name pairs in substring relation. |
xflr6/features | features/systems.py | FeatureSystem.join | def join(self, featuresets):
"""Return the nearest featureset that subsumes all given ones."""
concepts = (f.concept for f in featuresets)
join = self.lattice.join(concepts)
return self._featuresets[join.index] | python | def join(self, featuresets):
"""Return the nearest featureset that subsumes all given ones."""
concepts = (f.concept for f in featuresets)
join = self.lattice.join(concepts)
return self._featuresets[join.index] | [
"def",
"join",
"(",
"self",
",",
"featuresets",
")",
":",
"concepts",
"=",
"(",
"f",
".",
"concept",
"for",
"f",
"in",
"featuresets",
")",
"join",
"=",
"self",
".",
"lattice",
".",
"join",
"(",
"concepts",
")",
"return",
"self",
".",
"_featuresets",
... | Return the nearest featureset that subsumes all given ones. | [
"Return",
"the",
"nearest",
"featureset",
"that",
"subsumes",
"all",
"given",
"ones",
"."
] | f985304dd642da6ecdc66d85167d00daa4efe5f4 | https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/systems.py#L180-L184 | train | Return the nearest featureset that subsumes all given ones. |
xflr6/features | features/systems.py | FeatureSystem.meet | def meet(self, featuresets):
"""Return the nearest featureset that implies all given ones."""
concepts = (f.concept for f in featuresets)
meet = self.lattice.meet(concepts)
return self._featuresets[meet.index] | python | def meet(self, featuresets):
"""Return the nearest featureset that implies all given ones."""
concepts = (f.concept for f in featuresets)
meet = self.lattice.meet(concepts)
return self._featuresets[meet.index] | [
"def",
"meet",
"(",
"self",
",",
"featuresets",
")",
":",
"concepts",
"=",
"(",
"f",
".",
"concept",
"for",
"f",
"in",
"featuresets",
")",
"meet",
"=",
"self",
".",
"lattice",
".",
"meet",
"(",
"concepts",
")",
"return",
"self",
".",
"_featuresets",
... | Return the nearest featureset that implies all given ones. | [
"Return",
"the",
"nearest",
"featureset",
"that",
"implies",
"all",
"given",
"ones",
"."
] | f985304dd642da6ecdc66d85167d00daa4efe5f4 | https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/systems.py#L186-L190 | train | Return the nearest featureset that implies all given ones. |
xflr6/features | features/systems.py | FeatureSystem.upset_union | def upset_union(self, featuresets):
"""Yield all featuresets that subsume any of the given ones."""
concepts = (f.concept for f in featuresets)
indexes = (c.index for c in self.lattice.upset_union(concepts))
return map(self._featuresets.__getitem__, indexes) | python | def upset_union(self, featuresets):
"""Yield all featuresets that subsume any of the given ones."""
concepts = (f.concept for f in featuresets)
indexes = (c.index for c in self.lattice.upset_union(concepts))
return map(self._featuresets.__getitem__, indexes) | [
"def",
"upset_union",
"(",
"self",
",",
"featuresets",
")",
":",
"concepts",
"=",
"(",
"f",
".",
"concept",
"for",
"f",
"in",
"featuresets",
")",
"indexes",
"=",
"(",
"c",
".",
"index",
"for",
"c",
"in",
"self",
".",
"lattice",
".",
"upset_union",
"(... | Yield all featuresets that subsume any of the given ones. | [
"Yield",
"all",
"featuresets",
"that",
"subsume",
"any",
"of",
"the",
"given",
"ones",
"."
] | f985304dd642da6ecdc66d85167d00daa4efe5f4 | https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/systems.py#L192-L196 | train | Yield all featuresets that subsume any of the given ones. |
xflr6/features | features/systems.py | FeatureSystem.graphviz | def graphviz(self, highlight=None, maximal_label=None, topdown=None,
filename=None, directory=None, render=False, view=False):
"""Return the system lattice visualization as graphviz source."""
return visualize.featuresystem(self, highlight, maximal_label,
topdown, filename, direc... | python | def graphviz(self, highlight=None, maximal_label=None, topdown=None,
filename=None, directory=None, render=False, view=False):
"""Return the system lattice visualization as graphviz source."""
return visualize.featuresystem(self, highlight, maximal_label,
topdown, filename, direc... | [
"def",
"graphviz",
"(",
"self",
",",
"highlight",
"=",
"None",
",",
"maximal_label",
"=",
"None",
",",
"topdown",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"directory",
"=",
"None",
",",
"render",
"=",
"False",
",",
"view",
"=",
"False",
")",
"... | Return the system lattice visualization as graphviz source. | [
"Return",
"the",
"system",
"lattice",
"visualization",
"as",
"graphviz",
"source",
"."
] | f985304dd642da6ecdc66d85167d00daa4efe5f4 | https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/systems.py#L204-L208 | train | Return the system lattice visualization as graphviz source. |
dingusdk/PythonIhcSdk | ihcsdk/ihcconnection.py | IHCConnection.soap_action | def soap_action(self, service, action, payloadbody):
"""Do a soap request."""
payload = self.soapenvelope.format(body=payloadbody).encode('utf-8')
headers = {"Host": self.url,
"Content-Type": "text/xml; charset=UTF-8",
"Cache-Control": "no-cache",
... | python | def soap_action(self, service, action, payloadbody):
"""Do a soap request."""
payload = self.soapenvelope.format(body=payloadbody).encode('utf-8')
headers = {"Host": self.url,
"Content-Type": "text/xml; charset=UTF-8",
"Cache-Control": "no-cache",
... | [
"def",
"soap_action",
"(",
"self",
",",
"service",
",",
"action",
",",
"payloadbody",
")",
":",
"payload",
"=",
"self",
".",
"soapenvelope",
".",
"format",
"(",
"body",
"=",
"payloadbody",
")",
".",
"encode",
"(",
"'utf-8'",
")",
"headers",
"=",
"{",
"... | Do a soap request. | [
"Do",
"a",
"soap",
"request",
"."
] | 7e2067e009fe7600b49f30bff1cf91dc72fc891e | https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcconnection.py#L24-L49 | train | Do a soap request. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.getValidReff | def getValidReff(self, level=1, reference=None):
""" Given a resource, CtsText will compute valid reffs
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: Int
:param reference: CapitainsCtsPassage reference
:type reference: C... | python | def getValidReff(self, level=1, reference=None):
""" Given a resource, CtsText will compute valid reffs
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: Int
:param reference: CapitainsCtsPassage reference
:type reference: C... | [
"def",
"getValidReff",
"(",
"self",
",",
"level",
"=",
"1",
",",
"reference",
"=",
"None",
")",
":",
"if",
"reference",
":",
"urn",
"=",
"\"{0}:{1}\"",
".",
"format",
"(",
"self",
".",
"urn",
",",
"reference",
")",
"else",
":",
"urn",
"=",
"str",
"... | Given a resource, CtsText will compute valid reffs
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: Int
:param reference: CapitainsCtsPassage reference
:type reference: CtsReference
:rtype: list(str)
:returns: List ... | [
"Given",
"a",
"resource",
"CtsText",
"will",
"compute",
"valid",
"reffs"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L63-L88 | train | Given a resource and a reference returns a list of valid reffs. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.getTextualNode | def getTextualNode(self, subreference=None):
""" Retrieve a passage and store it in the object
:param subreference: CtsReference of the passage (Note : if given a list, this should be a list of string that \
compose the reference)
:type subreference: Union[CtsReference, URN, str, list]
... | python | def getTextualNode(self, subreference=None):
""" Retrieve a passage and store it in the object
:param subreference: CtsReference of the passage (Note : if given a list, this should be a list of string that \
compose the reference)
:type subreference: Union[CtsReference, URN, str, list]
... | [
"def",
"getTextualNode",
"(",
"self",
",",
"subreference",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"subreference",
",",
"URN",
")",
":",
"urn",
"=",
"str",
"(",
"subreference",
")",
"elif",
"isinstance",
"(",
"subreference",
",",
"CtsReference",
")... | Retrieve a passage and store it in the object
:param subreference: CtsReference of the passage (Note : if given a list, this should be a list of string that \
compose the reference)
:type subreference: Union[CtsReference, URN, str, list]
:rtype: CtsPassage
:returns: Object repre... | [
"Retrieve",
"a",
"passage",
"and",
"store",
"it",
"in",
"the",
"object"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L90-L117 | train | Retrieve a passage and store it in the object
|
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.getReffs | def getReffs(self, level=1, subreference=None):
""" Reference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: Int
:param subreference: Subreference (optional)
:type subreference: CtsReference
... | python | def getReffs(self, level=1, subreference=None):
""" Reference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: Int
:param subreference: Subreference (optional)
:type subreference: CtsReference
... | [
"def",
"getReffs",
"(",
"self",
",",
"level",
"=",
"1",
",",
"subreference",
"=",
"None",
")",
":",
"if",
"self",
".",
"depth",
"is",
"not",
"None",
":",
"level",
"+=",
"self",
".",
"depth",
"return",
"self",
".",
"getValidReff",
"(",
"level",
",",
... | Reference available at a given level
:param level: Depth required. If not set, should retrieve first encountered level (1 based)
:type level: Int
:param subreference: Subreference (optional)
:type subreference: CtsReference
:rtype: [text_type]
:returns: List of levels | [
"Reference",
"available",
"at",
"a",
"given",
"level"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L119-L132 | train | Returns a list of valid reference levels at a given level. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.getPassagePlus | def getPassagePlus(self, reference=None):
""" Retrieve a passage and informations around it and store it in the object
:param reference: Reference of the passage
:type reference: CtsReference or List of text_type
:rtype: CtsPassage
:returns: Object representing the passage
... | python | def getPassagePlus(self, reference=None):
""" Retrieve a passage and informations around it and store it in the object
:param reference: Reference of the passage
:type reference: CtsReference or List of text_type
:rtype: CtsPassage
:returns: Object representing the passage
... | [
"def",
"getPassagePlus",
"(",
"self",
",",
"reference",
"=",
"None",
")",
":",
"if",
"reference",
":",
"urn",
"=",
"\"{0}:{1}\"",
".",
"format",
"(",
"self",
".",
"urn",
",",
"reference",
")",
"else",
":",
"urn",
"=",
"str",
"(",
"self",
".",
"urn",
... | Retrieve a passage and informations around it and store it in the object
:param reference: Reference of the passage
:type reference: CtsReference or List of text_type
:rtype: CtsPassage
:returns: Object representing the passage
:raises: *TypeError* when reference is not a list o... | [
"Retrieve",
"a",
"passage",
"and",
"informations",
"around",
"it",
"and",
"store",
"it",
"in",
"the",
"object"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L134-L153 | train | Retrieve a passage and informations around it and store it in the object
|
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod._parse_request | def _parse_request(self, xml):
""" Parse a request with metadata information
:param xml: LXML Object
:type xml: Union[lxml.etree._Element]
"""
for node in xml.xpath(".//ti:groupname", namespaces=XPATH_NAMESPACES):
lang = node.get("xml:lang") or CtsText.DEFAULT_LANG
... | python | def _parse_request(self, xml):
""" Parse a request with metadata information
:param xml: LXML Object
:type xml: Union[lxml.etree._Element]
"""
for node in xml.xpath(".//ti:groupname", namespaces=XPATH_NAMESPACES):
lang = node.get("xml:lang") or CtsText.DEFAULT_LANG
... | [
"def",
"_parse_request",
"(",
"self",
",",
"xml",
")",
":",
"for",
"node",
"in",
"xml",
".",
"xpath",
"(",
"\".//ti:groupname\"",
",",
"namespaces",
"=",
"XPATH_NAMESPACES",
")",
":",
"lang",
"=",
"node",
".",
"get",
"(",
"\"xml:lang\"",
")",
"or",
"CtsT... | Parse a request with metadata information
:param xml: LXML Object
:type xml: Union[lxml.etree._Element] | [
"Parse",
"a",
"request",
"with",
"metadata",
"information"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L155-L186 | train | Parses a request with metadata information and sets the object properties. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.getLabel | def getLabel(self):
""" Retrieve metadata about the text
:rtype: Metadata
:returns: Dictionary with label informations
"""
response = xmlparser(
self.retriever.getLabel(urn=str(self.urn))
)
self._parse_request(
response.xpath("//ti:reply/... | python | def getLabel(self):
""" Retrieve metadata about the text
:rtype: Metadata
:returns: Dictionary with label informations
"""
response = xmlparser(
self.retriever.getLabel(urn=str(self.urn))
)
self._parse_request(
response.xpath("//ti:reply/... | [
"def",
"getLabel",
"(",
"self",
")",
":",
"response",
"=",
"xmlparser",
"(",
"self",
".",
"retriever",
".",
"getLabel",
"(",
"urn",
"=",
"str",
"(",
"self",
".",
"urn",
")",
")",
")",
"self",
".",
"_parse_request",
"(",
"response",
".",
"xpath",
"(",... | Retrieve metadata about the text
:rtype: Metadata
:returns: Dictionary with label informations | [
"Retrieve",
"metadata",
"about",
"the",
"text"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L188-L202 | train | Retrieve metadata about the text
|
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.getPrevNextUrn | def getPrevNextUrn(self, reference):
""" Get the previous URN of a reference of the text
:param reference: CtsReference from which to find siblings
:type reference: Union[CtsReference, str]
:return: (Previous CapitainsCtsPassage CtsReference,Next CapitainsCtsPassage CtsReference)
... | python | def getPrevNextUrn(self, reference):
""" Get the previous URN of a reference of the text
:param reference: CtsReference from which to find siblings
:type reference: Union[CtsReference, str]
:return: (Previous CapitainsCtsPassage CtsReference,Next CapitainsCtsPassage CtsReference)
... | [
"def",
"getPrevNextUrn",
"(",
"self",
",",
"reference",
")",
":",
"_prev",
",",
"_next",
"=",
"_SharedMethod",
".",
"prevnext",
"(",
"self",
".",
"retriever",
".",
"getPrevNextUrn",
"(",
"urn",
"=",
"\"{}:{}\"",
".",
"format",
"(",
"str",
"(",
"URN",
"("... | Get the previous URN of a reference of the text
:param reference: CtsReference from which to find siblings
:type reference: Union[CtsReference, str]
:return: (Previous CapitainsCtsPassage CtsReference,Next CapitainsCtsPassage CtsReference) | [
"Get",
"the",
"previous",
"URN",
"of",
"a",
"reference",
"of",
"the",
"text"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L204-L222 | train | Get the previous URN of a reference of the text
SetException |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.getFirstUrn | def getFirstUrn(self, reference=None):
""" Get the first children URN for a given resource
:param reference: CtsReference from which to find child (If None, find first reference)
:type reference: CtsReference, str
:return: Children URN
:rtype: URN
"""
if referenc... | python | def getFirstUrn(self, reference=None):
""" Get the first children URN for a given resource
:param reference: CtsReference from which to find child (If None, find first reference)
:type reference: CtsReference, str
:return: Children URN
:rtype: URN
"""
if referenc... | [
"def",
"getFirstUrn",
"(",
"self",
",",
"reference",
"=",
"None",
")",
":",
"if",
"reference",
"is",
"not",
"None",
":",
"if",
"\":\"",
"in",
"reference",
":",
"urn",
"=",
"reference",
"else",
":",
"urn",
"=",
"\"{}:{}\"",
".",
"format",
"(",
"str",
... | Get the first children URN for a given resource
:param reference: CtsReference from which to find child (If None, find first reference)
:type reference: CtsReference, str
:return: Children URN
:rtype: URN | [
"Get",
"the",
"first",
"children",
"URN",
"for",
"a",
"given",
"resource"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L224-L247 | train | Get the first children URN for a given resource. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.firstId | def firstId(self):
""" Children passage
:rtype: str
:returns: First children of the graph. Shortcut to self.graph.children[0]
"""
if self._first is False:
# Request the next urn
self._first = self.getFirstUrn()
return self._first | python | def firstId(self):
""" Children passage
:rtype: str
:returns: First children of the graph. Shortcut to self.graph.children[0]
"""
if self._first is False:
# Request the next urn
self._first = self.getFirstUrn()
return self._first | [
"def",
"firstId",
"(",
"self",
")",
":",
"if",
"self",
".",
"_first",
"is",
"False",
":",
"# Request the next urn",
"self",
".",
"_first",
"=",
"self",
".",
"getFirstUrn",
"(",
")",
"return",
"self",
".",
"_first"
] | Children passage
:rtype: str
:returns: First children of the graph. Shortcut to self.graph.children[0] | [
"Children",
"passage"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L250-L259 | train | Returns the first urn of the children of the passage. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.lastId | def lastId(self):
""" Children passage
:rtype: str
:returns: First children of the graph. Shortcut to self.graph.children[0]
"""
if self._last is False:
# Request the next urn
self._last = self.childIds[-1]
return self._last | python | def lastId(self):
""" Children passage
:rtype: str
:returns: First children of the graph. Shortcut to self.graph.children[0]
"""
if self._last is False:
# Request the next urn
self._last = self.childIds[-1]
return self._last | [
"def",
"lastId",
"(",
"self",
")",
":",
"if",
"self",
".",
"_last",
"is",
"False",
":",
"# Request the next urn",
"self",
".",
"_last",
"=",
"self",
".",
"childIds",
"[",
"-",
"1",
"]",
"return",
"self",
".",
"_last"
] | Children passage
:rtype: str
:returns: First children of the graph. Shortcut to self.graph.children[0] | [
"Children",
"passage"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L262-L271 | train | Returns the last urn of the children of the graph. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.firstUrn | def firstUrn(resource):
""" Parse a resource to get the first URN
:param resource: XML Resource
:type resource: etree._Element
:return: Tuple representing previous and next urn
:rtype: str
"""
resource = xmlparser(resource)
urn = resource.xpath("//ti:repl... | python | def firstUrn(resource):
""" Parse a resource to get the first URN
:param resource: XML Resource
:type resource: etree._Element
:return: Tuple representing previous and next urn
:rtype: str
"""
resource = xmlparser(resource)
urn = resource.xpath("//ti:repl... | [
"def",
"firstUrn",
"(",
"resource",
")",
":",
"resource",
"=",
"xmlparser",
"(",
"resource",
")",
"urn",
"=",
"resource",
".",
"xpath",
"(",
"\"//ti:reply/ti:urn/text()\"",
",",
"namespaces",
"=",
"XPATH_NAMESPACES",
",",
"magic_string",
"=",
"True",
")",
"if"... | Parse a resource to get the first URN
:param resource: XML Resource
:type resource: etree._Element
:return: Tuple representing previous and next urn
:rtype: str | [
"Parse",
"a",
"resource",
"to",
"get",
"the",
"first",
"URN"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L274-L287 | train | Parse a resource to get the first URN |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | _SharedMethod.prevnext | def prevnext(resource):
""" Parse a resource to get the prev and next urn
:param resource: XML Resource
:type resource: etree._Element
:return: Tuple representing previous and next urn
:rtype: (str, str)
"""
_prev, _next = False, False
resource = xmlparse... | python | def prevnext(resource):
""" Parse a resource to get the prev and next urn
:param resource: XML Resource
:type resource: etree._Element
:return: Tuple representing previous and next urn
:rtype: (str, str)
"""
_prev, _next = False, False
resource = xmlparse... | [
"def",
"prevnext",
"(",
"resource",
")",
":",
"_prev",
",",
"_next",
"=",
"False",
",",
"False",
"resource",
"=",
"xmlparser",
"(",
"resource",
")",
"prevnext",
"=",
"resource",
".",
"xpath",
"(",
"\"//ti:prevnext\"",
",",
"namespaces",
"=",
"XPATH_NAMESPACE... | Parse a resource to get the prev and next urn
:param resource: XML Resource
:type resource: etree._Element
:return: Tuple representing previous and next urn
:rtype: (str, str) | [
"Parse",
"a",
"resource",
"to",
"get",
"the",
"prev",
"and",
"next",
"urn"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L290-L314 | train | Parse a resource to get the prev and next urn
|
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | CtsText.reffs | def reffs(self):
""" Get all valid reffs for every part of the CtsText
:rtype: MyCapytain.resources.texts.tei.XmlCtsCitation
"""
if not self.citation.is_set():
self.getLabel()
return [
reff for reffs in [self.getValidReff(level=i) for i in range(1, len(se... | python | def reffs(self):
""" Get all valid reffs for every part of the CtsText
:rtype: MyCapytain.resources.texts.tei.XmlCtsCitation
"""
if not self.citation.is_set():
self.getLabel()
return [
reff for reffs in [self.getValidReff(level=i) for i in range(1, len(se... | [
"def",
"reffs",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"citation",
".",
"is_set",
"(",
")",
":",
"self",
".",
"getLabel",
"(",
")",
"return",
"[",
"reff",
"for",
"reffs",
"in",
"[",
"self",
".",
"getValidReff",
"(",
"level",
"=",
"i",
"... | Get all valid reffs for every part of the CtsText
:rtype: MyCapytain.resources.texts.tei.XmlCtsCitation | [
"Get",
"all",
"valid",
"reffs",
"for",
"every",
"part",
"of",
"the",
"CtsText"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L337-L346 | train | Get all valid reffs for every part of the CtsText
|
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | CtsText.export | def export(self, output=Mimetypes.PLAINTEXT, exclude=None, **kwargs):
""" Export the collection item in the Mimetype required.
..note:: If current implementation does not have special mimetypes, reuses default_export method
:param output: Mimetype to export to (Uses Mimetypes)
:type ou... | python | def export(self, output=Mimetypes.PLAINTEXT, exclude=None, **kwargs):
""" Export the collection item in the Mimetype required.
..note:: If current implementation does not have special mimetypes, reuses default_export method
:param output: Mimetype to export to (Uses Mimetypes)
:type ou... | [
"def",
"export",
"(",
"self",
",",
"output",
"=",
"Mimetypes",
".",
"PLAINTEXT",
",",
"exclude",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"getTextualNode",
"(",
")",
".",
"export",
"(",
"output",
",",
"exclude",
")"
] | Export the collection item in the Mimetype required.
..note:: If current implementation does not have special mimetypes, reuses default_export method
:param output: Mimetype to export to (Uses Mimetypes)
:type output: str
:param exclude: Informations to exclude. Specific to implementat... | [
"Export",
"the",
"collection",
"item",
"in",
"the",
"Mimetype",
"required",
"."
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L368-L379 | train | Exports the collection item in the Mimetype required. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | CtsPassage.prevId | def prevId(self):
""" Previous passage Identifier
:rtype: CtsPassage
:returns: Previous passage at same level
"""
if self._prev_id is False:
# Request the next urn
self._prev_id, self._next_id = self.getPrevNextUrn(reference=self.urn.reference)
re... | python | def prevId(self):
""" Previous passage Identifier
:rtype: CtsPassage
:returns: Previous passage at same level
"""
if self._prev_id is False:
# Request the next urn
self._prev_id, self._next_id = self.getPrevNextUrn(reference=self.urn.reference)
re... | [
"def",
"prevId",
"(",
"self",
")",
":",
"if",
"self",
".",
"_prev_id",
"is",
"False",
":",
"# Request the next urn",
"self",
".",
"_prev_id",
",",
"self",
".",
"_next_id",
"=",
"self",
".",
"getPrevNextUrn",
"(",
"reference",
"=",
"self",
".",
"urn",
"."... | Previous passage Identifier
:rtype: CtsPassage
:returns: Previous passage at same level | [
"Previous",
"passage",
"Identifier"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L410-L419 | train | Returns the previous passage identifier at same level as the current passage. |
Capitains/MyCapytain | MyCapytain/resources/texts/remote/cts.py | CtsPassage.nextId | def nextId(self):
""" Shortcut for getting the following passage identifier
:rtype: CtsReference
:returns: Following passage reference
"""
if self._next_id is False:
# Request the next urn
self._prev_id, self._next_id = self.getPrevNextUrn(reference=self.... | python | def nextId(self):
""" Shortcut for getting the following passage identifier
:rtype: CtsReference
:returns: Following passage reference
"""
if self._next_id is False:
# Request the next urn
self._prev_id, self._next_id = self.getPrevNextUrn(reference=self.... | [
"def",
"nextId",
"(",
"self",
")",
":",
"if",
"self",
".",
"_next_id",
"is",
"False",
":",
"# Request the next urn",
"self",
".",
"_prev_id",
",",
"self",
".",
"_next_id",
"=",
"self",
".",
"getPrevNextUrn",
"(",
"reference",
"=",
"self",
".",
"urn",
"."... | Shortcut for getting the following passage identifier
:rtype: CtsReference
:returns: Following passage reference | [
"Shortcut",
"for",
"getting",
"the",
"following",
"passage",
"identifier"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L431-L440 | train | Get the next passage identifier for this object |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.