nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sixty-north/cosmic-ray | cf7fb7c3cc564db1e8d53b8e8848c9f46e61a879 | src/cosmic_ray/tools/filters/filter_app.py | python | FilterApp.main | (self, argv=None) | return ExitCode.OK | The main function for the app.
Args:
argv: Command line argument list of parse. | The main function for the app. | [
"The",
"main",
"function",
"for",
"the",
"app",
"."
] | def main(self, argv=None):
"""The main function for the app.
Args:
argv: Command line argument list of parse.
"""
if argv is None:
argv = sys.argv[1:]
parser = argparse.ArgumentParser(
description=self.description(),
)
parser.... | [
"def",
"main",
"(",
"self",
",",
"argv",
"=",
"None",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"self",
".",
"descripti... | https://github.com/sixty-north/cosmic-ray/blob/cf7fb7c3cc564db1e8d53b8e8848c9f46e61a879/src/cosmic_ray/tools/filters/filter_app.py#L41-L65 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/networkx/generators/lattice.py | python | grid_2d_graph | (m, n, periodic=False, create_using=None) | return G | Returns the two-dimensional grid graph.
The grid graph has each node connected to its four nearest neighbors.
Parameters
----------
m, n : int or iterable container of nodes
If an integer, nodes are from `range(n)`.
If a container, elements become the coordinate of the nodes.
peri... | Returns the two-dimensional grid graph. | [
"Returns",
"the",
"two",
"-",
"dimensional",
"grid",
"graph",
"."
] | def grid_2d_graph(m, n, periodic=False, create_using=None):
"""Returns the two-dimensional grid graph.
The grid graph has each node connected to its four nearest neighbors.
Parameters
----------
m, n : int or iterable container of nodes
If an integer, nodes are from `range(n)`.
If ... | [
"def",
"grid_2d_graph",
"(",
"m",
",",
"n",
",",
"periodic",
"=",
"False",
",",
"create_using",
"=",
"None",
")",
":",
"G",
"=",
"empty_graph",
"(",
"0",
",",
"create_using",
")",
"row_name",
",",
"rows",
"=",
"m",
"col_name",
",",
"cols",
"=",
"n",
... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/networkx/generators/lattice.py#L50-L95 | |
wee-slack/wee-slack | 16ccb4fe4df80061abba94efeda761bc6b3a665b | wee_slack.py | python | typing_bar_item_cb | (data, item, current_window, current_buffer, extra_info) | return typing | Privides a bar item indicating who is typing in the current channel AND
why is typing a DM to you globally. | Privides a bar item indicating who is typing in the current channel AND
why is typing a DM to you globally. | [
"Privides",
"a",
"bar",
"item",
"indicating",
"who",
"is",
"typing",
"in",
"the",
"current",
"channel",
"AND",
"why",
"is",
"typing",
"a",
"DM",
"to",
"you",
"globally",
"."
] | def typing_bar_item_cb(data, item, current_window, current_buffer, extra_info):
"""
Privides a bar item indicating who is typing in the current channel AND
why is typing a DM to you globally.
"""
typers = []
current_channel = EVENTROUTER.weechat_controller.buffers.get(current_buffer)
# firs... | [
"def",
"typing_bar_item_cb",
"(",
"data",
",",
"item",
",",
"current_window",
",",
"current_buffer",
",",
"extra_info",
")",
":",
"typers",
"=",
"[",
"]",
"current_channel",
"=",
"EVENTROUTER",
".",
"weechat_controller",
".",
"buffers",
".",
"get",
"(",
"curre... | https://github.com/wee-slack/wee-slack/blob/16ccb4fe4df80061abba94efeda761bc6b3a665b/wee_slack.py#L1125-L1154 | |
vprusso/youtube_tutorials | a3f2fadfc408aafbf4505bcd5f2f4a41d670b44d | data_structures/linked_list/singularly_linked_list/linked_list_reverse.py | python | LinkedList.print_helper | (self, node, name) | [] | def print_helper(self, node, name):
if node is None:
print(name + ": None")
else:
print(name + ":" + node.data) | [
"def",
"print_helper",
"(",
"self",
",",
"node",
",",
"name",
")",
":",
"if",
"node",
"is",
"None",
":",
"print",
"(",
"name",
"+",
"\": None\"",
")",
"else",
":",
"print",
"(",
"name",
"+",
"\":\"",
"+",
"node",
".",
"data",
")"
] | https://github.com/vprusso/youtube_tutorials/blob/a3f2fadfc408aafbf4505bcd5f2f4a41d670b44d/data_structures/linked_list/singularly_linked_list/linked_list_reverse.py#L136-L140 | ||||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/lib-tk/turtle.py | python | RawTurtle.reset | (self) | Delete the turtle's drawings and restore its default values.
No argument.
,
Delete the turtle's drawings from the screen, re-center the turtle
and set variables to the default values.
Example (for a Turtle instance named turtle):
>>> turtle.position()
(0.00,-22.00)
... | Delete the turtle's drawings and restore its default values. | [
"Delete",
"the",
"turtle",
"s",
"drawings",
"and",
"restore",
"its",
"default",
"values",
"."
] | def reset(self):
"""Delete the turtle's drawings and restore its default values.
No argument.
,
Delete the turtle's drawings from the screen, re-center the turtle
and set variables to the default values.
Example (for a Turtle instance named turtle):
>>> turtle.position(... | [
"def",
"reset",
"(",
"self",
")",
":",
"TNavigator",
".",
"reset",
"(",
"self",
")",
"TPen",
".",
"_reset",
"(",
"self",
")",
"self",
".",
"_clear",
"(",
")",
"self",
".",
"_drawturtle",
"(",
")",
"self",
".",
"_update",
"(",
")"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/lib-tk/turtle.py#L2464-L2487 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/geometry/polyhedron/backend_normaliz.py | python | Polyhedron_normaliz._nmz_result | (self, normaliz_cone, property) | return NmzResult(normaliz_cone, property,
RationalHandler=rational_handler,
NumberfieldElementHandler=nfelem_handler) | Call PyNormaliz's NmzResult function with appropriate conversion between number format.
TESTS::
sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], rays=[(1,1)], # optional - pynormaliz
....: lines=[], backend='normaliz')
sage: p._nmz_result(p._normaliz_cone... | Call PyNormaliz's NmzResult function with appropriate conversion between number format. | [
"Call",
"PyNormaliz",
"s",
"NmzResult",
"function",
"with",
"appropriate",
"conversion",
"between",
"number",
"format",
"."
] | def _nmz_result(self, normaliz_cone, property):
"""
Call PyNormaliz's NmzResult function with appropriate conversion between number format.
TESTS::
sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], rays=[(1,1)], # optional - pynormaliz
....: lines=[], ... | [
"def",
"_nmz_result",
"(",
"self",
",",
"normaliz_cone",
",",
"property",
")",
":",
"def",
"rational_handler",
"(",
"list",
")",
":",
"return",
"QQ",
"(",
"tuple",
"(",
"list",
")",
")",
"def",
"nfelem_handler",
"(",
"coords",
")",
":",
"# coords might be ... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/polyhedron/backend_normaliz.py#L245-L284 | |
researchmm/tasn | 5dba8ccc096cedc63913730eeea14a9647911129 | tasn-mxnet/python/mxnet/module/bucketing_module.py | python | BucketingModule.install_monitor | (self, mon) | Installs monitor on all executors | Installs monitor on all executors | [
"Installs",
"monitor",
"on",
"all",
"executors"
] | def install_monitor(self, mon):
"""Installs monitor on all executors """
assert self.binded
self._monitor = mon
for mod in self._buckets.values():
mod.install_monitor(mon) | [
"def",
"install_monitor",
"(",
"self",
",",
"mon",
")",
":",
"assert",
"self",
".",
"binded",
"self",
".",
"_monitor",
"=",
"mon",
"for",
"mod",
"in",
"self",
".",
"_buckets",
".",
"values",
"(",
")",
":",
"mod",
".",
"install_monitor",
"(",
"mon",
"... | https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/python/mxnet/module/bucketing_module.py#L538-L543 | ||
viewvc/viewvc | d85819dac65c5f45b563c2c3c02956ae585576b4 | lib/vclib/svn/svn_ra.py | python | RemoteSubversionRepository.get_symlink_target | (self, path_parts, rev) | return pathspec[5:] | Return the target of the symbolic link versioned at PATH_PARTS
in REV, or None if that object is not a symlink. | Return the target of the symbolic link versioned at PATH_PARTS
in REV, or None if that object is not a symlink. | [
"Return",
"the",
"target",
"of",
"the",
"symbolic",
"link",
"versioned",
"at",
"PATH_PARTS",
"in",
"REV",
"or",
"None",
"if",
"that",
"object",
"is",
"not",
"a",
"symlink",
"."
] | def get_symlink_target(self, path_parts, rev):
"""Return the target of the symbolic link versioned at PATH_PARTS
in REV, or None if that object is not a symlink."""
path = self._getpath(path_parts)
path_type = self.itemtype(path_parts, rev) # does auth-check
rev = self._getrev(... | [
"def",
"get_symlink_target",
"(",
"self",
",",
"path_parts",
",",
"rev",
")",
":",
"path",
"=",
"self",
".",
"_getpath",
"(",
"path_parts",
")",
"path_type",
"=",
"self",
".",
"itemtype",
"(",
"path_parts",
",",
"rev",
")",
"# does auth-check",
"rev",
"=",... | https://github.com/viewvc/viewvc/blob/d85819dac65c5f45b563c2c3c02956ae585576b4/lib/vclib/svn/svn_ra.py#L757-L782 | |
exodrifter/unity-python | bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d | Lib/multiprocessing/util.py | python | is_exiting | () | return _exiting or _exiting is None | Returns true if the process is shutting down | Returns true if the process is shutting down | [
"Returns",
"true",
"if",
"the",
"process",
"is",
"shutting",
"down"
] | def is_exiting():
'''
Returns true if the process is shutting down
'''
return _exiting or _exiting is None | [
"def",
"is_exiting",
"(",
")",
":",
"return",
"_exiting",
"or",
"_exiting",
"is",
"None"
] | https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/multiprocessing/util.py#L289-L293 | |
dexy/dexy | 323c1806e51f75435e11d2265703e68f46c8aef3 | dexy/data.py | python | KeyValue.value | (self, key, throwException=True) | [] | def value(self, key, throwException=True):
try:
return self.storage[key]
except Exception:
if throwException:
raise | [
"def",
"value",
"(",
"self",
",",
"key",
",",
"throwException",
"=",
"True",
")",
":",
"try",
":",
"return",
"self",
".",
"storage",
"[",
"key",
"]",
"except",
"Exception",
":",
"if",
"throwException",
":",
"raise"
] | https://github.com/dexy/dexy/blob/323c1806e51f75435e11d2265703e68f46c8aef3/dexy/data.py#L543-L548 | ||||
dagster-io/dagster | b27d569d5fcf1072543533a0c763815d96f90b8f | python_modules/libraries/dagster-dbt/dagster_dbt/cloud/ops.py | python | dbt_cloud_run_op | (context) | Initiates a run for a dbt Cloud job, then polls until the run completes. If the job
fails or is otherwised stopped before succeeding, a `dagster.Failure` exception will be raised,
and this op will fail.
It requires the use of a 'dbt_cloud' resource, which is used to connect to the dbt Cloud API.
**Con... | Initiates a run for a dbt Cloud job, then polls until the run completes. If the job
fails or is otherwised stopped before succeeding, a `dagster.Failure` exception will be raised,
and this op will fail. | [
"Initiates",
"a",
"run",
"for",
"a",
"dbt",
"Cloud",
"job",
"then",
"polls",
"until",
"the",
"run",
"completes",
".",
"If",
"the",
"job",
"fails",
"or",
"is",
"otherwised",
"stopped",
"before",
"succeeding",
"a",
"dagster",
".",
"Failure",
"exception",
"wi... | def dbt_cloud_run_op(context):
"""
Initiates a run for a dbt Cloud job, then polls until the run completes. If the job
fails or is otherwised stopped before succeeding, a `dagster.Failure` exception will be raised,
and this op will fail.
It requires the use of a 'dbt_cloud' resource, which is used ... | [
"def",
"dbt_cloud_run_op",
"(",
"context",
")",
":",
"dbt_output",
"=",
"context",
".",
"resources",
".",
"dbt_cloud",
".",
"run_job_and_poll",
"(",
"context",
".",
"op_config",
"[",
"\"job_id\"",
"]",
",",
"poll_interval",
"=",
"context",
".",
"op_config",
"[... | https://github.com/dagster-io/dagster/blob/b27d569d5fcf1072543533a0c763815d96f90b8f/python_modules/libraries/dagster-dbt/dagster_dbt/cloud/ops.py#L53-L117 | ||
wangzheng0822/algo | b2c1228ff915287ad7ebeae4355fa26854ea1557 | python/09_queue/linked_queue.py | python | LinkedQueue.__init__ | (self) | [] | def __init__(self):
self._head: Optional[Node] = None
self._tail: Optional[Node] = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_head",
":",
"Optional",
"[",
"Node",
"]",
"=",
"None",
"self",
".",
"_tail",
":",
"Optional",
"[",
"Node",
"]",
"=",
"None"
] | https://github.com/wangzheng0822/algo/blob/b2c1228ff915287ad7ebeae4355fa26854ea1557/python/09_queue/linked_queue.py#L17-L19 | ||||
areski/python-nvd3 | 1890ad28e13f9a35d8b338817ef161720576538b | nvd3/NVD3Chart.py | python | NVD3Chart.add_serie | (self, y, x, name=None, extra=None, **kwargs) | add serie - Series are list of data that will be plotted
y {1, 2, 3, 4, 5} / x {1, 2, 3, 4, 5}
**Attributes**:
* ``name`` - set Serie name
* ``x`` - x-axis data
* ``y`` - y-axis data
kwargs:
* ``shape`` - for scatterChart, you can set diffe... | add serie - Series are list of data that will be plotted
y {1, 2, 3, 4, 5} / x {1, 2, 3, 4, 5} | [
"add",
"serie",
"-",
"Series",
"are",
"list",
"of",
"data",
"that",
"will",
"be",
"plotted",
"y",
"{",
"1",
"2",
"3",
"4",
"5",
"}",
"/",
"x",
"{",
"1",
"2",
"3",
"4",
"5",
"}"
] | def add_serie(self, y, x, name=None, extra=None, **kwargs):
"""
add serie - Series are list of data that will be plotted
y {1, 2, 3, 4, 5} / x {1, 2, 3, 4, 5}
**Attributes**:
* ``name`` - set Serie name
* ``x`` - x-axis data
* ``y`` - y-axis data
... | [
"def",
"add_serie",
"(",
"self",
",",
"y",
",",
"x",
",",
"name",
"=",
"None",
",",
"extra",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"\"Serie %d\"",
"%",
"(",
"self",
".",
"serie_no",
")",
"# For sca... | https://github.com/areski/python-nvd3/blob/1890ad28e13f9a35d8b338817ef161720576538b/nvd3/NVD3Chart.py#L198-L297 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/sqlmap/plugins/generic/filesystem.py | python | Filesystem.fileToSqlQueries | (self, fcEncodedList) | return sqlQueries | Called by MySQL and PostgreSQL plugins to write a file on the
back-end DBMS underlying file system | Called by MySQL and PostgreSQL plugins to write a file on the
back-end DBMS underlying file system | [
"Called",
"by",
"MySQL",
"and",
"PostgreSQL",
"plugins",
"to",
"write",
"a",
"file",
"on",
"the",
"back",
"-",
"end",
"DBMS",
"underlying",
"file",
"system"
] | def fileToSqlQueries(self, fcEncodedList):
"""
Called by MySQL and PostgreSQL plugins to write a file on the
back-end DBMS underlying file system
"""
counter = 0
sqlQueries = []
for fcEncodedLine in fcEncodedList:
if counter == 0:
sql... | [
"def",
"fileToSqlQueries",
"(",
"self",
",",
"fcEncodedList",
")",
":",
"counter",
"=",
"0",
"sqlQueries",
"=",
"[",
"]",
"for",
"fcEncodedLine",
"in",
"fcEncodedList",
":",
"if",
"counter",
"==",
"0",
":",
"sqlQueries",
".",
"append",
"(",
"\"INSERT INTO %s... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/plugins/generic/filesystem.py#L87-L105 | |
cloudlinux/kuberdock-platform | 8b3923c19755f3868e4142b62578d9b9857d2704 | kubedock/kapi/node.py | python | Node.increment_free_public_ip_count | (self, delta=1, max_retries=5) | Atomically increases the number of public IP addresses available on a
node. Fetches a K8S node information beforehand
:param max_retries: how many times we try to update the counter if
somebody concurrently updated spec
:param delta: positive or negative number which is added to the
... | Atomically increases the number of public IP addresses available on a
node. Fetches a K8S node information beforehand
:param max_retries: how many times we try to update the counter if
somebody concurrently updated spec
:param delta: positive or negative number which is added to the
... | [
"Atomically",
"increases",
"the",
"number",
"of",
"public",
"IP",
"addresses",
"available",
"on",
"a",
"node",
".",
"Fetches",
"a",
"K8S",
"node",
"information",
"beforehand",
":",
"param",
"max_retries",
":",
"how",
"many",
"times",
"we",
"try",
"to",
"upda... | def increment_free_public_ip_count(self, delta=1, max_retries=5):
"""
Atomically increases the number of public IP addresses available on a
node. Fetches a K8S node information beforehand
:param max_retries: how many times we try to update the counter if
somebody concurrently upd... | [
"def",
"increment_free_public_ip_count",
"(",
"self",
",",
"delta",
"=",
"1",
",",
"max_retries",
"=",
"5",
")",
":",
"lock",
"=",
"ExclusiveLock",
"(",
"'NODE.PUBLIC_IP_INCR_{}'",
".",
"format",
"(",
"self",
".",
"hostname",
")",
")",
"lock",
".",
"lock",
... | https://github.com/cloudlinux/kuberdock-platform/blob/8b3923c19755f3868e4142b62578d9b9857d2704/kubedock/kapi/node.py#L91-L123 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | plexpy/request.py | python | request_content | (url, **kwargs) | Wrapper for `request_response', which will return the raw content. | Wrapper for `request_response', which will return the raw content. | [
"Wrapper",
"for",
"request_response",
"which",
"will",
"return",
"the",
"raw",
"content",
"."
] | def request_content(url, **kwargs):
"""
Wrapper for `request_response', which will return the raw content.
"""
response = request_response(url, **kwargs)
if response is not None:
return response.content | [
"def",
"request_content",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"request_response",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
"if",
"response",
"is",
"not",
"None",
":",
"return",
"response",
".",
"content"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/request.py#L271-L279 | ||
crossbario/autobahn-python | fa9f2da0c5005574e63456a3a04f00e405744014 | autobahn/wamp/message.py | python | Interrupt.parse | (wmsg) | return obj | Verifies and parses an unserialized raw message into an actual WAMP message instance.
:param wmsg: The unserialized raw message.
:type wmsg: list
:returns: An instance of this class. | Verifies and parses an unserialized raw message into an actual WAMP message instance. | [
"Verifies",
"and",
"parses",
"an",
"unserialized",
"raw",
"message",
"into",
"an",
"actual",
"WAMP",
"message",
"instance",
"."
] | def parse(wmsg):
"""
Verifies and parses an unserialized raw message into an actual WAMP message instance.
:param wmsg: The unserialized raw message.
:type wmsg: list
:returns: An instance of this class.
"""
# this should already be verified by WampSerializer.un... | [
"def",
"parse",
"(",
"wmsg",
")",
":",
"# this should already be verified by WampSerializer.unserialize",
"assert",
"(",
"len",
"(",
"wmsg",
")",
">",
"0",
"and",
"wmsg",
"[",
"0",
"]",
"==",
"Interrupt",
".",
"MESSAGE_TYPE",
")",
"if",
"len",
"(",
"wmsg",
"... | https://github.com/crossbario/autobahn-python/blob/fa9f2da0c5005574e63456a3a04f00e405744014/autobahn/wamp/message.py#L5570-L5628 | |
zacharyvoase/markdoc | 694914ccb198d74e37321fc601061fe7f725b1ce | distribute_setup.py | python | _patch_egg_dir | (path) | return True | [] | def _patch_egg_dir(path):
# let's check if it's already patched
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
if os.path.exists(pkg_info):
if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):
log.warn('%s already patched.', pkg_info)
return False
_rename_path(path)
... | [
"def",
"_patch_egg_dir",
"(",
"path",
")",
":",
"# let's check if it's already patched",
"pkg_info",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'EGG-INFO'",
",",
"'PKG-INFO'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"pkg_info",
")",
... | https://github.com/zacharyvoase/markdoc/blob/694914ccb198d74e37321fc601061fe7f725b1ce/distribute_setup.py#L322-L338 | |||
owid/covid-19-data | 936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92 | scripts/src/cowidev/vax/incremental/equatorial_guinea.py | python | EquatorialGuinea.parse_date | (self, soup) | return extract_clean_date(
text=soup.text,
regex=r"Datos: a (\d+ \w+ de 20\d{2})",
date_format="%d %B de %Y",
lang="es",
unicode_norm=True,
) | [] | def parse_date(self, soup):
return extract_clean_date(
text=soup.text,
regex=r"Datos: a (\d+ \w+ de 20\d{2})",
date_format="%d %B de %Y",
lang="es",
unicode_norm=True,
) | [
"def",
"parse_date",
"(",
"self",
",",
"soup",
")",
":",
"return",
"extract_clean_date",
"(",
"text",
"=",
"soup",
".",
"text",
",",
"regex",
"=",
"r\"Datos: a (\\d+ \\w+ de 20\\d{2})\"",
",",
"date_format",
"=",
"\"%d %B de %Y\"",
",",
"lang",
"=",
"\"es\"",
... | https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/incremental/equatorial_guinea.py#L36-L43 | |||
mrkipling/maraschino | c6be9286937783ae01df2d6d8cebfc8b2734a7d7 | lib/werkzeug/datastructures.py | python | MultiDict.iterlistvalues | (self) | return dict.itervalues(self) | Like :meth:`listvalues` but returns an iterator. | Like :meth:`listvalues` but returns an iterator. | [
"Like",
":",
"meth",
":",
"listvalues",
"but",
"returns",
"an",
"iterator",
"."
] | def iterlistvalues(self):
"""Like :meth:`listvalues` but returns an iterator."""
return dict.itervalues(self) | [
"def",
"iterlistvalues",
"(",
"self",
")",
":",
"return",
"dict",
".",
"itervalues",
"(",
"self",
")"
] | https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/werkzeug/datastructures.py#L513-L515 | |
hhyo/Archery | c9b057d37e47894ca8531e5cd10afdb064cd0122 | sql/views.py | python | dbdiagnostic | (request) | return render(request, 'dbdiagnostic.html') | 会话管理页面 | 会话管理页面 | [
"会话管理页面"
] | def dbdiagnostic(request):
"""会话管理页面"""
return render(request, 'dbdiagnostic.html') | [
"def",
"dbdiagnostic",
"(",
"request",
")",
":",
"return",
"render",
"(",
"request",
",",
"'dbdiagnostic.html'",
")"
] | https://github.com/hhyo/Archery/blob/c9b057d37e47894ca8531e5cd10afdb064cd0122/sql/views.py#L306-L308 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/opsworks/layer1.py | python | OpsWorksConnection.register_volume | (self, stack_id, ec_2_volume_id=None) | return self.make_request(action='RegisterVolume',
body=json.dumps(params)) | Registers an Amazon EBS volume with a specified stack. A
volume can be registered with only one stack at a time. If the
volume is already registered, you must first deregister it by
calling DeregisterVolume. For more information, see `Resource
Management`_.
**Required Permission... | Registers an Amazon EBS volume with a specified stack. A
volume can be registered with only one stack at a time. If the
volume is already registered, you must first deregister it by
calling DeregisterVolume. For more information, see `Resource
Management`_. | [
"Registers",
"an",
"Amazon",
"EBS",
"volume",
"with",
"a",
"specified",
"stack",
".",
"A",
"volume",
"can",
"be",
"registered",
"with",
"only",
"one",
"stack",
"at",
"a",
"time",
".",
"If",
"the",
"volume",
"is",
"already",
"registered",
"you",
"must",
"... | def register_volume(self, stack_id, ec_2_volume_id=None):
"""
Registers an Amazon EBS volume with a specified stack. A
volume can be registered with only one stack at a time. If the
volume is already registered, you must first deregister it by
calling DeregisterVolume. For more i... | [
"def",
"register_volume",
"(",
"self",
",",
"stack_id",
",",
"ec_2_volume_id",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'StackId'",
":",
"stack_id",
",",
"}",
"if",
"ec_2_volume_id",
"is",
"not",
"None",
":",
"params",
"[",
"'Ec2VolumeId'",
"]",
"=",
... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/opsworks/layer1.py#L2142-L2167 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/idlelib/search.py | python | _setup | (text) | return engine._searchdialog | Return the new or existing singleton SearchDialog instance.
The singleton dialog saves user entries and preferences
across instances.
Args:
text: Text widget containing the text to be searched. | Return the new or existing singleton SearchDialog instance. | [
"Return",
"the",
"new",
"or",
"existing",
"singleton",
"SearchDialog",
"instance",
"."
] | def _setup(text):
"""Return the new or existing singleton SearchDialog instance.
The singleton dialog saves user entries and preferences
across instances.
Args:
text: Text widget containing the text to be searched.
"""
root = text._root()
engine = searchengine.get(root)
if not ... | [
"def",
"_setup",
"(",
"text",
")",
":",
"root",
"=",
"text",
".",
"_root",
"(",
")",
"engine",
"=",
"searchengine",
".",
"get",
"(",
"root",
")",
"if",
"not",
"hasattr",
"(",
"engine",
",",
"\"_searchdialog\"",
")",
":",
"engine",
".",
"_searchdialog",... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/idlelib/search.py#L12-L25 | |
pgmpy/pgmpy | 24279929a28082ea994c52f3d165ca63fc56b02b | pgmpy/models/MarkovNetwork.py | python | MarkovNetwork.get_factors | (self, node=None) | Returns all the factors containing the node. If node is not specified
returns all the factors that have been added till now to the graph.
Parameters
----------
node: any hashable python object (optional)
The node whose factor we want. If node is not specified
Example... | Returns all the factors containing the node. If node is not specified
returns all the factors that have been added till now to the graph. | [
"Returns",
"all",
"the",
"factors",
"containing",
"the",
"node",
".",
"If",
"node",
"is",
"not",
"specified",
"returns",
"all",
"the",
"factors",
"that",
"have",
"been",
"added",
"till",
"now",
"to",
"the",
"graph",
"."
] | def get_factors(self, node=None):
"""
Returns all the factors containing the node. If node is not specified
returns all the factors that have been added till now to the graph.
Parameters
----------
node: any hashable python object (optional)
The node whose fac... | [
"def",
"get_factors",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
":",
"if",
"node",
"not",
"in",
"self",
".",
"nodes",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Node not present in the Undirected Graph\"",
")",
"node_factors",
"=",
... | https://github.com/pgmpy/pgmpy/blob/24279929a28082ea994c52f3d165ca63fc56b02b/pgmpy/models/MarkovNetwork.py#L141-L176 | ||
smallcorgi/Faster-RCNN_TF | d9adb24c8ffdbae3b56eb55fc629d719fee3d741 | lib/rpn_msr/proposal_layer.py | python | ProposalLayer.backward | (self, top, propagate_down, bottom) | This layer does not propagate gradients. | This layer does not propagate gradients. | [
"This",
"layer",
"does",
"not",
"propagate",
"gradients",
"."
] | def backward(self, top, propagate_down, bottom):
"""This layer does not propagate gradients."""
pass | [
"def",
"backward",
"(",
"self",
",",
"top",
",",
"propagate_down",
",",
"bottom",
")",
":",
"pass"
] | https://github.com/smallcorgi/Faster-RCNN_TF/blob/d9adb24c8ffdbae3b56eb55fc629d719fee3d741/lib/rpn_msr/proposal_layer.py#L163-L165 | ||
certbot/certbot | 30b066f08260b73fc26256b5484a180468b9d0a6 | certbot-nginx/certbot_nginx/_internal/configurator.py | python | NginxConfigurator.revert_challenge_config | (self) | Used to cleanup challenge configurations.
:raises .errors.PluginError: If unable to revert the challenge config. | Used to cleanup challenge configurations. | [
"Used",
"to",
"cleanup",
"challenge",
"configurations",
"."
] | def revert_challenge_config(self):
"""Used to cleanup challenge configurations.
:raises .errors.PluginError: If unable to revert the challenge config.
"""
self.revert_temporary_config()
self.new_vhost = None
self.parser.load() | [
"def",
"revert_challenge_config",
"(",
"self",
")",
":",
"self",
".",
"revert_temporary_config",
"(",
")",
"self",
".",
"new_vhost",
"=",
"None",
"self",
".",
"parser",
".",
"load",
"(",
")"
] | https://github.com/certbot/certbot/blob/30b066f08260b73fc26256b5484a180468b9d0a6/certbot-nginx/certbot_nginx/_internal/configurator.py#L1126-L1134 | ||
wummel/linkchecker | c2ce810c3fb00b895a841a7be6b2e78c64e7b042 | third_party/dnspython/dns/wiredata.py | python | maybe_wrap | (wire) | [] | def maybe_wrap(wire):
if not isinstance(wire, WireData):
return WireData(wire)
else:
return wire | [
"def",
"maybe_wrap",
"(",
"wire",
")",
":",
"if",
"not",
"isinstance",
"(",
"wire",
",",
"WireData",
")",
":",
"return",
"WireData",
"(",
"wire",
")",
"else",
":",
"return",
"wire"
] | https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/wiredata.py#L55-L59 | ||||
fkie/multimaster_fkie | 3d23df29d25d71a75c66bbd3cc6e9cbb255724d8 | fkie_master_discovery/src/fkie_master_discovery/master_info.py | python | MasterInfo.listedState | (self, filter_interface=None) | return (stamp, stamp_local, self.masteruri, self.mastername, publishers, subscribers, services, topicTypes, nodes, serviceProvider) | Returns a extended ROS Master State.
:param filter_interface: The filter used to filter the nodes, topics or serivces out.
:type filter_interface: FilterInterface
:return: complete ROS Master State as
``(stamp, stamp_local, masteruri, name, publishers, subscribers, services,... | Returns a extended ROS Master State. | [
"Returns",
"a",
"extended",
"ROS",
"Master",
"State",
"."
] | def listedState(self, filter_interface=None):
'''
Returns a extended ROS Master State.
:param filter_interface: The filter used to filter the nodes, topics or serivces out.
:type filter_interface: FilterInterface
:return: complete ROS Master State as
``(stamp... | [
"def",
"listedState",
"(",
"self",
",",
"filter_interface",
"=",
"None",
")",
":",
"iffilter",
"=",
"filter_interface",
"if",
"iffilter",
"is",
"None",
":",
"iffilter",
"=",
"FilterInterface",
".",
"from_list",
"(",
")",
"stamp",
"=",
"'%.9f'",
"%",
"self",
... | https://github.com/fkie/multimaster_fkie/blob/3d23df29d25d71a75c66bbd3cc6e9cbb255724d8/fkie_master_discovery/src/fkie_master_discovery/master_info.py#L1099-L1196 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | examples/research_projects/visual_bert/utils.py | python | img_tensorize | (im, input_format="RGB") | return img | [] | def img_tensorize(im, input_format="RGB"):
assert isinstance(im, str)
if os.path.isfile(im):
img = cv2.imread(im)
else:
img = get_image_from_url(im)
assert img is not None, f"could not connect to: {im}"
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
if input_format == "RGB":
... | [
"def",
"img_tensorize",
"(",
"im",
",",
"input_format",
"=",
"\"RGB\"",
")",
":",
"assert",
"isinstance",
"(",
"im",
",",
"str",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"im",
")",
":",
"img",
"=",
"cv2",
".",
"imread",
"(",
"im",
")",
"... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/visual_bert/utils.py#L545-L555 | |||
Calysto/calysto_scheme | 15bf81987870bcae1264e5a0a06feb9a8ee12b8b | calysto_scheme/scheme.py | python | load_file | () | [] | def load_file():
if (False if ((member(filename_reg, load_stack)) is False) else True):
printf("skipping recursive load of ~a~%", filename_reg)
GLOBALS['value2_reg'] = fail_reg
GLOBALS['value1_reg'] = void_value
GLOBALS['pc'] = apply_cont2
else:
if (False if ((not(string_... | [
"def",
"load_file",
"(",
")",
":",
"if",
"(",
"False",
"if",
"(",
"(",
"member",
"(",
"filename_reg",
",",
"load_stack",
")",
")",
"is",
"False",
")",
"else",
"True",
")",
":",
"printf",
"(",
"\"skipping recursive load of ~a~%\"",
",",
"filename_reg",
")",... | https://github.com/Calysto/calysto_scheme/blob/15bf81987870bcae1264e5a0a06feb9a8ee12b8b/calysto_scheme/scheme.py#L8257-L8276 | ||||
DigitalSlideArchive/HistomicsTK | db2ceb4831bec0efa557cf5b18078ae790253de5 | histomicstk/utils/compute_tile_foreground_fraction.py | python | compute_tile_foreground_fraction | (slide_path, im_fgnd_mask_lres,
fgnd_seg_scale, it_kwargs,
tile_position=None) | return tile_fgnd_frac | Computes the fraction of foreground of a single tile or
all tiles in a whole slide image given the binary foreground
mask computed from a low resolution version of the slide.
Parameters
----------
slide_path : str
path to an image or slide
im_fgnd_mask_lres : array_like
A binary... | Computes the fraction of foreground of a single tile or
all tiles in a whole slide image given the binary foreground
mask computed from a low resolution version of the slide. | [
"Computes",
"the",
"fraction",
"of",
"foreground",
"of",
"a",
"single",
"tile",
"or",
"all",
"tiles",
"in",
"a",
"whole",
"slide",
"image",
"given",
"the",
"binary",
"foreground",
"mask",
"computed",
"from",
"a",
"low",
"resolution",
"version",
"of",
"the",
... | def compute_tile_foreground_fraction(slide_path, im_fgnd_mask_lres,
fgnd_seg_scale, it_kwargs,
tile_position=None):
"""
Computes the fraction of foreground of a single tile or
all tiles in a whole slide image given the binary foregrou... | [
"def",
"compute_tile_foreground_fraction",
"(",
"slide_path",
",",
"im_fgnd_mask_lres",
",",
"fgnd_seg_scale",
",",
"it_kwargs",
",",
"tile_position",
"=",
"None",
")",
":",
"if",
"tile_position",
"is",
"None",
":",
"# get slide tile source",
"ts",
"=",
"large_image",... | https://github.com/DigitalSlideArchive/HistomicsTK/blob/db2ceb4831bec0efa557cf5b18078ae790253de5/histomicstk/utils/compute_tile_foreground_fraction.py#L8-L87 | |
Blazemeter/taurus | 6e36b20397cf3e730e181cfebde0c8f19eb31fed | bzt/jmx/tools.py | python | LoadSettingsProcessor._divide_concurrency | (self, concurrency_list) | calculate target concurrency for every thread group | calculate target concurrency for every thread group | [
"calculate",
"target",
"concurrency",
"for",
"every",
"thread",
"group"
] | def _divide_concurrency(self, concurrency_list):
"""
calculate target concurrency for every thread group
"""
total_old_concurrency = sum(concurrency_list)
for idx, concurrency in enumerate(concurrency_list):
if total_old_concurrency and concurrency_list[idx] != 0:
... | [
"def",
"_divide_concurrency",
"(",
"self",
",",
"concurrency_list",
")",
":",
"total_old_concurrency",
"=",
"sum",
"(",
"concurrency_list",
")",
"for",
"idx",
",",
"concurrency",
"in",
"enumerate",
"(",
"concurrency_list",
")",
":",
"if",
"total_old_concurrency",
... | https://github.com/Blazemeter/taurus/blob/6e36b20397cf3e730e181cfebde0c8f19eb31fed/bzt/jmx/tools.py#L155-L177 | ||
roam-qgis/Roam | 6bfa836a2735f611b7f26de18ae4a4581f7e83ef | ext_libs/pdoc/__init__.py | python | Function.params | (self) | return params | Returns a list where each element is a nicely formatted
parameter of this function. This includes argument lists,
keyword arguments and default values. | Returns a list where each element is a nicely formatted
parameter of this function. This includes argument lists,
keyword arguments and default values. | [
"Returns",
"a",
"list",
"where",
"each",
"element",
"is",
"a",
"nicely",
"formatted",
"parameter",
"of",
"this",
"function",
".",
"This",
"includes",
"argument",
"lists",
"keyword",
"arguments",
"and",
"default",
"values",
"."
] | def params(self):
"""
Returns a list where each element is a nicely formatted
parameter of this function. This includes argument lists,
keyword arguments and default values.
"""
def fmt_param(el):
if isinstance(el, str) or isinstance(el, unicode):
... | [
"def",
"params",
"(",
"self",
")",
":",
"def",
"fmt_param",
"(",
"el",
")",
":",
"if",
"isinstance",
"(",
"el",
",",
"str",
")",
"or",
"isinstance",
"(",
"el",
",",
"unicode",
")",
":",
"return",
"el",
"else",
":",
"return",
"'(%s)'",
"%",
"(",
"... | https://github.com/roam-qgis/Roam/blob/6bfa836a2735f611b7f26de18ae4a4581f7e83ef/ext_libs/pdoc/__init__.py#L1090-L1123 | |
SecurityInnovation/PGPy | 955d1669472b7b182571f686ee312435f93033e4 | pgpy/packet/fields.py | python | ECPoint.to_mpibytes | (self) | return MPI(MPIs.bytes_to_int(b)).to_mpibytes() | Returns MPI encoded point as it should be written in packet | Returns MPI encoded point as it should be written in packet | [
"Returns",
"MPI",
"encoded",
"point",
"as",
"it",
"should",
"be",
"written",
"in",
"packet"
] | def to_mpibytes(self):
""" Returns MPI encoded point as it should be written in packet """
b = bytearray()
b.append(self.format)
if self.format == ECPointFormat.Standard:
b += MPIs.int_to_bytes(self.x, self.bytelen)
b += MPIs.int_to_bytes(self.y, self.bytelen)
... | [
"def",
"to_mpibytes",
"(",
"self",
")",
":",
"b",
"=",
"bytearray",
"(",
")",
"b",
".",
"append",
"(",
"self",
".",
"format",
")",
"if",
"self",
".",
"format",
"==",
"ECPointFormat",
".",
"Standard",
":",
"b",
"+=",
"MPIs",
".",
"int_to_bytes",
"(",
... | https://github.com/SecurityInnovation/PGPy/blob/955d1669472b7b182571f686ee312435f93033e4/pgpy/packet/fields.py#L527-L538 | |
bchretien/vim-profiler | d4fda79830528ffb6cce895448ac10b502f9f756 | vim-profiler.py | python | StartupData.__del__ | (self) | Destructor taking care of clean up. | Destructor taking care of clean up. | [
"Destructor",
"taking",
"care",
"of",
"clean",
"up",
"."
] | def __del__(self):
"""
Destructor taking care of clean up.
"""
self.__clean_log() | [
"def",
"__del__",
"(",
"self",
")",
":",
"self",
".",
"__clean_log",
"(",
")"
] | https://github.com/bchretien/vim-profiler/blob/d4fda79830528ffb6cce895448ac10b502f9f756/vim-profiler.py#L188-L192 | ||
simpeg/simpeg | d93145d768b5512621cdd75566b4a8175fee9ed3 | SimPEG/optimization.py | python | ProjectedGradient._doEndIteration_ProjectedGradient | (self, xt) | _doEndIteration_ProjectedGradient(xt) | _doEndIteration_ProjectedGradient(xt) | [
"_doEndIteration_ProjectedGradient",
"(",
"xt",
")"
] | def _doEndIteration_ProjectedGradient(self, xt):
"""_doEndIteration_ProjectedGradient(xt)"""
aSet = self.activeSet(xt)
bSet = self.bindingSet(xt)
self.explorePG = not np.all(aSet == self.aSet_prev) # explore proximal gradient
self.exploreCG = np.all(aSet == bSet) # explore con... | [
"def",
"_doEndIteration_ProjectedGradient",
"(",
"self",
",",
"xt",
")",
":",
"aSet",
"=",
"self",
".",
"activeSet",
"(",
"xt",
")",
"bSet",
"=",
"self",
".",
"bindingSet",
"(",
"xt",
")",
"self",
".",
"explorePG",
"=",
"not",
"np",
".",
"all",
"(",
... | https://github.com/simpeg/simpeg/blob/d93145d768b5512621cdd75566b4a8175fee9ed3/SimPEG/optimization.py#L902-L932 | ||
pyjs/pyjs | 6c4a3d3a67300cd5df7f95a67ca9dcdc06950523 | examples/deprecated/gears/__main__.py | python | setup | (targets) | Setup example for translation, MUST call util.setup(targets). | Setup example for translation, MUST call util.setup(targets). | [
"Setup",
"example",
"for",
"translation",
"MUST",
"call",
"util",
".",
"setup",
"(",
"targets",
")",
"."
] | def setup(targets):
'''Setup example for translation, MUST call util.setup(targets).'''
util.setup(targets) | [
"def",
"setup",
"(",
"targets",
")",
":",
"util",
".",
"setup",
"(",
"targets",
")"
] | https://github.com/pyjs/pyjs/blob/6c4a3d3a67300cd5df7f95a67ca9dcdc06950523/examples/deprecated/gears/__main__.py#L16-L18 | ||
rochacbruno/dynaconf | 88adc159d5f5c8ba0d314915f8c9f001e849e2d5 | dynaconf/base.py | python | Settings.path_for | (self, *args) | return os.path.join(self._root_path or os.getcwd(), *args) | Path containing _root_path | Path containing _root_path | [
"Path",
"containing",
"_root_path"
] | def path_for(self, *args):
"""Path containing _root_path"""
if args and args[0].startswith(os.path.sep):
return os.path.join(*args)
return os.path.join(self._root_path or os.getcwd(), *args) | [
"def",
"path_for",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"args",
"and",
"args",
"[",
"0",
"]",
".",
"startswith",
"(",
"os",
".",
"path",
".",
"sep",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"*",
"args",
")",
"return",
... | https://github.com/rochacbruno/dynaconf/blob/88adc159d5f5c8ba0d314915f8c9f001e849e2d5/dynaconf/base.py#L1095-L1099 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/requests/packages/urllib3/filepost.py | python | iter_fields | (fields) | return ((k, v) for k, v in fields) | .. deprecated:: 1.6
Iterate over fields.
The addition of :class:`~urllib3.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
:class:`~urllib3.fields.RequestField` objects.
Supports list of (k, v) tuples and dicts. | .. deprecated:: 1.6 | [
"..",
"deprecated",
"::",
"1",
".",
"6"
] | def iter_fields(fields):
"""
.. deprecated:: 1.6
Iterate over fields.
The addition of :class:`~urllib3.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
:class:`~urllib3.fields.RequestField` objects.
Supports list of (k, v) tuples an... | [
"def",
"iter_fields",
"(",
"fields",
")",
":",
"if",
"isinstance",
"(",
"fields",
",",
"dict",
")",
":",
"return",
"(",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"fields",
")",
")",
"return",
"(",
"(",
"... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/requests/packages/urllib3/filepost.py#L41-L56 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/core/dtypes/common.py | python | get_dtype | (arr_or_dtype) | return pandas_dtype(arr_or_dtype) | Get the dtype instance associated with an array
or dtype object.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype object whose dtype we want to extract.
Returns
-------
obj_dtype : The extract dtype instance from the
passed in array o... | Get the dtype instance associated with an array
or dtype object. | [
"Get",
"the",
"dtype",
"instance",
"associated",
"with",
"an",
"array",
"or",
"dtype",
"object",
"."
] | def get_dtype(arr_or_dtype) -> DtypeObj:
"""
Get the dtype instance associated with an array
or dtype object.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype object whose dtype we want to extract.
Returns
-------
obj_dtype : The extract dtyp... | [
"def",
"get_dtype",
"(",
"arr_or_dtype",
")",
"->",
"DtypeObj",
":",
"if",
"arr_or_dtype",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"Cannot deduce dtype from null object\"",
")",
"# fastpath",
"elif",
"isinstance",
"(",
"arr_or_dtype",
",",
"np",
".",
"dtyp... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/dtypes/common.py#L1552-L1584 | |
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/gui/common/MessagingMenuNew.py | python | MessagingMenuNew._on_message_read | (self, conv) | This is called when the user read the message. | This is called when the user read the message. | [
"This",
"is",
"called",
"when",
"the",
"user",
"read",
"the",
"message",
"."
] | def _on_message_read(self, conv):
"""
This is called when the user read the message.
"""
self._remove_source(conv=conv) | [
"def",
"_on_message_read",
"(",
"self",
",",
"conv",
")",
":",
"self",
".",
"_remove_source",
"(",
"conv",
"=",
"conv",
")"
] | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/gui/common/MessagingMenuNew.py#L68-L72 | ||
QQuick/Transcrypt | 68b4b71d4ff3e4d58281b24e9e2dcc9fc766e822 | transcrypt/modules/logging/__init__.py | python | Formatter.__init__ | (self, format=None, datefmt=None, style='{') | Initialize the formatter with specified format strings.
Initialize the formatter either with the specified format string, or a
default as described above. Allow for specialized date formatting with
the optional datefmt argument (if omitted, you get the ISO8601 format).
Use a style para... | Initialize the formatter with specified format strings. | [
"Initialize",
"the",
"formatter",
"with",
"specified",
"format",
"strings",
"."
] | def __init__(self, format=None, datefmt=None, style='{'):
"""
Initialize the formatter with specified format strings.
Initialize the formatter either with the specified format string, or a
default as described above. Allow for specialized date formatting with
the optional datefm... | [
"def",
"__init__",
"(",
"self",
",",
"format",
"=",
"None",
",",
"datefmt",
"=",
"None",
",",
"style",
"=",
"'{'",
")",
":",
"# if style not in _STYLES:",
"# raise ValueError('Style must be one of: {}'.format(','.join(_STYLES.keys())))",
"if",
"(",
"style",
"!=",
"'... | https://github.com/QQuick/Transcrypt/blob/68b4b71d4ff3e4d58281b24e9e2dcc9fc766e822/transcrypt/modules/logging/__init__.py#L561-L583 | ||
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/lib2to3/pytree.py | python | Node.set_child | (self, i, child) | Equivalent to 'node.children[i] = child'. This method also sets the
child's parent attribute appropriately. | Equivalent to 'node.children[i] = child'. This method also sets the
child's parent attribute appropriately. | [
"Equivalent",
"to",
"node",
".",
"children",
"[",
"i",
"]",
"=",
"child",
".",
"This",
"method",
"also",
"sets",
"the",
"child",
"s",
"parent",
"attribute",
"appropriately",
"."
] | def set_child(self, i, child):
"""
Equivalent to 'node.children[i] = child'. This method also sets the
child's parent attribute appropriately.
"""
child.parent = self
self.children[i].parent = None
self.children[i] = child
self.changed() | [
"def",
"set_child",
"(",
"self",
",",
"i",
",",
"child",
")",
":",
"child",
".",
"parent",
"=",
"self",
"self",
".",
"children",
"[",
"i",
"]",
".",
"parent",
"=",
"None",
"self",
".",
"children",
"[",
"i",
"]",
"=",
"child",
"self",
".",
"change... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/lib2to3/pytree.py#L322-L330 | ||
benoitc/couchdbkit | 6be148640c00b54ee87a2f2d502e9d67fa5b45a8 | couchdbkit/schema/properties.py | python | LazyList.reverse | (self) | [] | def reverse(self):
self.doc.reverse()
list.reverse(self) | [
"def",
"reverse",
"(",
"self",
")",
":",
"self",
".",
"doc",
".",
"reverse",
"(",
")",
"list",
".",
"reverse",
"(",
"self",
")"
] | https://github.com/benoitc/couchdbkit/blob/6be148640c00b54ee87a2f2d502e9d67fa5b45a8/couchdbkit/schema/properties.py#L737-L739 | ||||
weinbe58/QuSpin | 5bbc3204dbf5c227a87a44f0dacf39509cba580c | quspin/operators/quantum_operator_core.py | python | quantum_operator.ndim | (self) | return self._ndim | int: number of dimensions, always equal to 2. | int: number of dimensions, always equal to 2. | [
"int",
":",
"number",
"of",
"dimensions",
"always",
"equal",
"to",
"2",
"."
] | def ndim(self):
"""int: number of dimensions, always equal to 2. """
return self._ndim | [
"def",
"ndim",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ndim"
] | https://github.com/weinbe58/QuSpin/blob/5bbc3204dbf5c227a87a44f0dacf39509cba580c/quspin/operators/quantum_operator_core.py#L313-L315 | |
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/compilers/c.py | python | ClangCCompiler.__init__ | (self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None,
linker: T.Optional['DynamicLinker'] = None,
defines: T.Optional[T.Dict[str, str]] = None,
ful... | [] | def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None,
linker: T.Optional['DynamicLinker'] = None,
defines: T.Optional[T.Dict[str, str]] = None,
... | [
"def",
"__init__",
"(",
"self",
",",
"exelist",
":",
"T",
".",
"List",
"[",
"str",
"]",
",",
"version",
":",
"str",
",",
"for_machine",
":",
"MachineChoice",
",",
"is_cross",
":",
"bool",
",",
"info",
":",
"'MachineInfo'",
",",
"exe_wrapper",
":",
"T",... | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/compilers/c.py#L144-L155 | ||||
kamalgill/flask-appengine-template | 11760f83faccbb0d0afe416fc58e67ecfb4643c2 | src/lib/wtforms/ext/appengine/ndb.py | python | ModelConverter.convert_IntegerProperty | (self, model, prop, kwargs) | return get_IntegerField(kwargs) | Returns a form field for a ``ndb.IntegerProperty``. | Returns a form field for a ``ndb.IntegerProperty``. | [
"Returns",
"a",
"form",
"field",
"for",
"a",
"ndb",
".",
"IntegerProperty",
"."
] | def convert_IntegerProperty(self, model, prop, kwargs):
"""Returns a form field for a ``ndb.IntegerProperty``."""
if prop._repeated:
return IntegerListPropertyField(**kwargs)
return get_IntegerField(kwargs) | [
"def",
"convert_IntegerProperty",
"(",
"self",
",",
"model",
",",
"prop",
",",
"kwargs",
")",
":",
"if",
"prop",
".",
"_repeated",
":",
"return",
"IntegerListPropertyField",
"(",
"*",
"*",
"kwargs",
")",
"return",
"get_IntegerField",
"(",
"kwargs",
")"
] | https://github.com/kamalgill/flask-appengine-template/blob/11760f83faccbb0d0afe416fc58e67ecfb4643c2/src/lib/wtforms/ext/appengine/ndb.py#L251-L255 | |
JenningsL/PointRCNN | 36b5e3226a230dcc89e7bb6cdd8d31cb7cdf8136 | models/tf_ops/grouping/tf_grouping.py | python | select_top_k | (k, dist) | return grouping_module.selection_sort(dist, k) | Input:
k: int32, number of k SMALLEST elements selected
dist: (b,m,n) float32 array, distance matrix, m query points, n dataset points
Output:
idx: (b,m,n) int32 array, first k in n are indices to the top k
dist_out: (b,m,n) float32 array, first k in n are the top k | Input:
k: int32, number of k SMALLEST elements selected
dist: (b,m,n) float32 array, distance matrix, m query points, n dataset points
Output:
idx: (b,m,n) int32 array, first k in n are indices to the top k
dist_out: (b,m,n) float32 array, first k in n are the top k | [
"Input",
":",
"k",
":",
"int32",
"number",
"of",
"k",
"SMALLEST",
"elements",
"selected",
"dist",
":",
"(",
"b",
"m",
"n",
")",
"float32",
"array",
"distance",
"matrix",
"m",
"query",
"points",
"n",
"dataset",
"points",
"Output",
":",
"idx",
":",
"(",
... | def select_top_k(k, dist):
'''
Input:
k: int32, number of k SMALLEST elements selected
dist: (b,m,n) float32 array, distance matrix, m query points, n dataset points
Output:
idx: (b,m,n) int32 array, first k in n are indices to the top k
dist_out: (b,m,n) float32 array, first... | [
"def",
"select_top_k",
"(",
"k",
",",
"dist",
")",
":",
"return",
"grouping_module",
".",
"selection_sort",
"(",
"dist",
",",
"k",
")"
] | https://github.com/JenningsL/PointRCNN/blob/36b5e3226a230dcc89e7bb6cdd8d31cb7cdf8136/models/tf_ops/grouping/tf_grouping.py#L23-L32 | |
kamalkraj/ALBERT-TF2.0 | 8d0cc211361e81a648bf846d8ec84225273db0e4 | albert.py | python | get_initializer | (initializer_range=0.02) | return tf.keras.initializers.TruncatedNormal(stddev=initializer_range) | Creates a `tf.initializers.truncated_normal` with the given range.
Args:
initializer_range: float, initializer range for stddev.
Returns:
TruncatedNormal initializer with stddev = `initializer_range`. | Creates a `tf.initializers.truncated_normal` with the given range. | [
"Creates",
"a",
"tf",
".",
"initializers",
".",
"truncated_normal",
"with",
"the",
"given",
"range",
"."
] | def get_initializer(initializer_range=0.02):
"""Creates a `tf.initializers.truncated_normal` with the given range.
Args:
initializer_range: float, initializer range for stddev.
Returns:
TruncatedNormal initializer with stddev = `initializer_range`.
"""
return tf.keras.initializers.TruncatedNormal(st... | [
"def",
"get_initializer",
"(",
"initializer_range",
"=",
"0.02",
")",
":",
"return",
"tf",
".",
"keras",
".",
"initializers",
".",
"TruncatedNormal",
"(",
"stddev",
"=",
"initializer_range",
")"
] | https://github.com/kamalkraj/ALBERT-TF2.0/blob/8d0cc211361e81a648bf846d8ec84225273db0e4/albert.py#L918-L927 | |
eirannejad/pyRevit | 49c0b7eb54eb343458ce1365425e6552d0c47d44 | pyrevitlib/pyrevit/preflight/case.py | python | PreflightTestCase.startTest | (self, doc, output) | Hook method for exercising the test. | Hook method for exercising the test. | [
"Hook",
"method",
"for",
"exercising",
"the",
"test",
"."
] | def startTest(self, doc, output):
"""Hook method for exercising the test."""
pass | [
"def",
"startTest",
"(",
"self",
",",
"doc",
",",
"output",
")",
":",
"pass"
] | https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/pyrevitlib/pyrevit/preflight/case.py#L12-L14 | ||
zhaoolee/StarsAndClown | b2d4039cad2f9232b691e5976f787b49a0a2c113 | node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py | python | EscapeCppDefine | (s) | return s.replace('#', r'\#') | Escapes a CPP define so that it will reach the compiler unaltered. | Escapes a CPP define so that it will reach the compiler unaltered. | [
"Escapes",
"a",
"CPP",
"define",
"so",
"that",
"it",
"will",
"reach",
"the",
"compiler",
"unaltered",
"."
] | def EscapeCppDefine(s):
"""Escapes a CPP define so that it will reach the compiler unaltered."""
s = EscapeShellArgument(s)
s = EscapeMakeVariableExpansion(s)
# '#' characters must be escaped even embedded in a string, else Make will
# treat it as the start of a comment.
return s.replace('#', r'\#') | [
"def",
"EscapeCppDefine",
"(",
"s",
")",
":",
"s",
"=",
"EscapeShellArgument",
"(",
"s",
")",
"s",
"=",
"EscapeMakeVariableExpansion",
"(",
"s",
")",
"# '#' characters must be escaped even embedded in a string, else Make will",
"# treat it as the start of a comment.",
"return... | https://github.com/zhaoolee/StarsAndClown/blob/b2d4039cad2f9232b691e5976f787b49a0a2c113/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py#L591-L597 | |
czhu95/ternarynet | 1a67251f7f5a1cdf854f87f90f841655c7c9f11c | tensorpack/dataflow/tf_func.py | python | TFFuncMapper.__init__ | (self, ds,
get_placeholders, symbf, apply_symbf_on_dp, device='/cpu:0') | :param get_placeholders: a function returning the placeholders
:param symbf: a symbolic function taking the placeholders
:param apply_symbf_on_dp: apply the above function to datapoint | :param get_placeholders: a function returning the placeholders
:param symbf: a symbolic function taking the placeholders
:param apply_symbf_on_dp: apply the above function to datapoint | [
":",
"param",
"get_placeholders",
":",
"a",
"function",
"returning",
"the",
"placeholders",
":",
"param",
"symbf",
":",
"a",
"symbolic",
"function",
"taking",
"the",
"placeholders",
":",
"param",
"apply_symbf_on_dp",
":",
"apply",
"the",
"above",
"function",
"to... | def __init__(self, ds,
get_placeholders, symbf, apply_symbf_on_dp, device='/cpu:0'):
"""
:param get_placeholders: a function returning the placeholders
:param symbf: a symbolic function taking the placeholders
:param apply_symbf_on_dp: apply the above function to datapoint
... | [
"def",
"__init__",
"(",
"self",
",",
"ds",
",",
"get_placeholders",
",",
"symbf",
",",
"apply_symbf_on_dp",
",",
"device",
"=",
"'/cpu:0'",
")",
":",
"super",
"(",
"TFFuncMapper",
",",
"self",
")",
".",
"__init__",
"(",
"ds",
")",
"self",
".",
"get_place... | https://github.com/czhu95/ternarynet/blob/1a67251f7f5a1cdf854f87f90f841655c7c9f11c/tensorpack/dataflow/tf_func.py#L18-L29 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_policy_group.py | python | SecurityContextConstraints.find_user | (self, inc_user) | return index | find a user | find a user | [
"find",
"a",
"user"
] | def find_user(self, inc_user):
''' find a user '''
index = None
try:
index = self.users.index(inc_user)
except ValueError as _:
return index
return index | [
"def",
"find_user",
"(",
"self",
",",
"inc_user",
")",
":",
"index",
"=",
"None",
"try",
":",
"index",
"=",
"self",
".",
"users",
".",
"index",
"(",
"inc_user",
")",
"except",
"ValueError",
"as",
"_",
":",
"return",
"index",
"return",
"index"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_policy_group.py#L1950-L1958 | |
scrapy/scrapy | b04cfa48328d5d5749dca6f50fa34e0cfc664c89 | scrapy/commands/shell.py | python | Command.syntax | (self) | return "[url|file]" | [] | def syntax(self):
return "[url|file]" | [
"def",
"syntax",
"(",
"self",
")",
":",
"return",
"\"[url|file]\""
] | https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/commands/shell.py#L24-L25 | |||
david-cortes/contextualbandits | 293b47ce80d8330a238cca0614147256ffea5529 | contextualbandits/online.py | python | LinTS.reset_v_sq | (self, v_sq=1.0) | return self | Set the covariance multiplier to a custom number
Parameters
----------
v_sq : float
Parameter by which to multiply the covariance matrix (more means higher variance).
Returns
-------
self : obj
This object | Set the covariance multiplier to a custom number | [
"Set",
"the",
"covariance",
"multiplier",
"to",
"a",
"custom",
"number"
] | def reset_v_sq(self, v_sq=1.0):
"""
Set the covariance multiplier to a custom number
Parameters
----------
v_sq : float
Parameter by which to multiply the covariance matrix (more means higher variance).
Returns
-------
self : obj
... | [
"def",
"reset_v_sq",
"(",
"self",
",",
"v_sq",
"=",
"1.0",
")",
":",
"if",
"isinstance",
"(",
"v_sq",
",",
"int",
")",
":",
"v_sq",
"=",
"float",
"(",
"v_sq",
")",
"assert",
"isinstance",
"(",
"v_sq",
",",
"float",
")",
"self",
".",
"v_sq",
"=",
... | https://github.com/david-cortes/contextualbandits/blob/293b47ce80d8330a238cca0614147256ffea5529/contextualbandits/online.py#L3181-L3202 | |
Alexander-H-Liu/End-to-end-ASR-Pytorch | 1103d144423e8e692f1d18cd9db27a96cb49fb9d | bin/train_asr.py | python | Solver.exec | (self) | Training End-to-end ASR system | Training End-to-end ASR system | [
"Training",
"End",
"-",
"to",
"-",
"end",
"ASR",
"system"
] | def exec(self):
''' Training End-to-end ASR system '''
self.verbose('Total training steps {}.'.format(
human_format(self.max_step)))
ctc_loss, att_loss, emb_loss = None, None, None
n_epochs = 0
self.timer.set()
while self.step < self.max_step:
# R... | [
"def",
"exec",
"(",
"self",
")",
":",
"self",
".",
"verbose",
"(",
"'Total training steps {}.'",
".",
"format",
"(",
"human_format",
"(",
"self",
".",
"max_step",
")",
")",
")",
"ctc_loss",
",",
"att_loss",
",",
"emb_loss",
"=",
"None",
",",
"None",
",",... | https://github.com/Alexander-H-Liu/End-to-end-ASR-Pytorch/blob/1103d144423e8e692f1d18cd9db27a96cb49fb9d/bin/train_asr.py#L77-L167 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/androguard/core/bytecodes/dvm.py | python | DCode.show | (self) | Display this object | Display this object | [
"Display",
"this",
"object"
] | def show(self) :
"""
Display this object
"""
nb = 0
idx = 0
for i in self.get_instructions() :
print "%-8d(%08x)" % (nb, idx),
i.show(nb)
print
idx += i.get_length()
nb += 1 | [
"def",
"show",
"(",
"self",
")",
":",
"nb",
"=",
"0",
"idx",
"=",
"0",
"for",
"i",
"in",
"self",
".",
"get_instructions",
"(",
")",
":",
"print",
"\"%-8d(%08x)\"",
"%",
"(",
"nb",
",",
"idx",
")",
",",
"i",
".",
"show",
"(",
"nb",
")",
"print",... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/androguard/core/bytecodes/dvm.py#L5905-L5917 | ||
respeaker/respeaker_python_library | 905a5334ccdc2d474ad973caf6a23d05c65bbb25 | respeaker/usb_hid/hidapi_backend.py | python | HidApiUSB.getAllConnectedInterface | () | return boards | returns all the connected devices which matches HidApiUSB.vid/HidApiUSB.pid.
returns an array of HidApiUSB (Interface) objects | returns all the connected devices which matches HidApiUSB.vid/HidApiUSB.pid.
returns an array of HidApiUSB (Interface) objects | [
"returns",
"all",
"the",
"connected",
"devices",
"which",
"matches",
"HidApiUSB",
".",
"vid",
"/",
"HidApiUSB",
".",
"pid",
".",
"returns",
"an",
"array",
"of",
"HidApiUSB",
"(",
"Interface",
")",
"objects"
] | def getAllConnectedInterface():
"""
returns all the connected devices which matches HidApiUSB.vid/HidApiUSB.pid.
returns an array of HidApiUSB (Interface) objects
"""
devices = hid.enumerate()
if not devices:
logging.debug("No Mbed device connected")
... | [
"def",
"getAllConnectedInterface",
"(",
")",
":",
"devices",
"=",
"hid",
".",
"enumerate",
"(",
")",
"if",
"not",
"devices",
":",
"logging",
".",
"debug",
"(",
"\"No Mbed device connected\"",
")",
"return",
"[",
"]",
"boards",
"=",
"[",
"]",
"for",
"device... | https://github.com/respeaker/respeaker_python_library/blob/905a5334ccdc2d474ad973caf6a23d05c65bbb25/respeaker/usb_hid/hidapi_backend.py#L50-L96 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cwp/v20180228/cwp_client.py | python | CwpClient.DescribeScanTaskDetails | (self, request) | DescribeScanTaskDetails 查询扫描任务详情 , 可以查询扫描进度信息/异常;
:param request: Request instance for DescribeScanTaskDetails.
:type request: :class:`tencentcloud.cwp.v20180228.models.DescribeScanTaskDetailsRequest`
:rtype: :class:`tencentcloud.cwp.v20180228.models.DescribeScanTaskDetailsResponse` | DescribeScanTaskDetails 查询扫描任务详情 , 可以查询扫描进度信息/异常; | [
"DescribeScanTaskDetails",
"查询扫描任务详情",
"可以查询扫描进度信息",
"/",
"异常",
";"
] | def DescribeScanTaskDetails(self, request):
"""DescribeScanTaskDetails 查询扫描任务详情 , 可以查询扫描进度信息/异常;
:param request: Request instance for DescribeScanTaskDetails.
:type request: :class:`tencentcloud.cwp.v20180228.models.DescribeScanTaskDetailsRequest`
:rtype: :class:`tencentcloud.cwp.v20180... | [
"def",
"DescribeScanTaskDetails",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"DescribeScanTaskDetails\"",
",",
"params",
")",
"response",
"=",
"json",
"... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cwp/v20180228/cwp_client.py#L3641-L3666 | ||
UniShared/videonotes | 803cdd97b90823fb17f50dd55999aa7d1fec6c3a | lib/gflags.py | python | FlagValues.__RemoveFlagFromDictByModule | (self, flags_by_module_dict, flag_obj) | Removes a flag object from a module -> list of flags dictionary.
Args:
flags_by_module_dict: A dictionary that maps module names to lists of
flags.
flag_obj: A flag object. | Removes a flag object from a module -> list of flags dictionary. | [
"Removes",
"a",
"flag",
"object",
"from",
"a",
"module",
"-",
">",
"list",
"of",
"flags",
"dictionary",
"."
] | def __RemoveFlagFromDictByModule(self, flags_by_module_dict, flag_obj):
"""Removes a flag object from a module -> list of flags dictionary.
Args:
flags_by_module_dict: A dictionary that maps module names to lists of
flags.
flag_obj: A flag object.
"""
for unused_module, flags_in_mod... | [
"def",
"__RemoveFlagFromDictByModule",
"(",
"self",
",",
"flags_by_module_dict",
",",
"flag_obj",
")",
":",
"for",
"unused_module",
",",
"flags_in_module",
"in",
"flags_by_module_dict",
".",
"iteritems",
"(",
")",
":",
"# while (as opposed to if) takes care of multiple occu... | https://github.com/UniShared/videonotes/blob/803cdd97b90823fb17f50dd55999aa7d1fec6c3a/lib/gflags.py#L1158-L1170 | ||
anchore/anchore-engine | bb18b70e0cbcad58beb44cd439d00067d8f7ea8b | anchore_engine/analyzers/syft/__init__.py | python | catalog_image | (
tmp_dir: str, image_oci_dir: str, package_filtering_enabled=True
) | return converted_output, syft_analysis | Catalog the given image with syft, keeping only select artifacts in the returned results
:param tmp_dir: path to directory where the image data resides
:param image_oci_dir: path to the directory for temp file construction
:return: tuple of engine formatted result and raw syft output to allow it to be used... | Catalog the given image with syft, keeping only select artifacts in the returned results | [
"Catalog",
"the",
"given",
"image",
"with",
"syft",
"keeping",
"only",
"select",
"artifacts",
"in",
"the",
"returned",
"results"
] | def catalog_image(
tmp_dir: str, image_oci_dir: str, package_filtering_enabled=True
) -> typing.Tuple[dict, dict]:
"""
Catalog the given image with syft, keeping only select artifacts in the returned results
:param tmp_dir: path to directory where the image data resides
:param image_oci_dir: path t... | [
"def",
"catalog_image",
"(",
"tmp_dir",
":",
"str",
",",
"image_oci_dir",
":",
"str",
",",
"package_filtering_enabled",
"=",
"True",
")",
"->",
"typing",
".",
"Tuple",
"[",
"dict",
",",
"dict",
"]",
":",
"syft_analysis",
"=",
"run_syft",
"(",
"tmp_dir_path",... | https://github.com/anchore/anchore-engine/blob/bb18b70e0cbcad58beb44cd439d00067d8f7ea8b/anchore_engine/analyzers/syft/__init__.py#L11-L24 | |
BMW-InnovationLab/BMW-TensorFlow-Inference-API-CPU | 400ea6a5ca270eba3306aaa7bf58f0593ab1edb7 | src/main/object_detection/core/box_list_ops.py | python | to_normalized_coordinates | (boxlist, height, width,
check_range=True, scope=None) | Converts absolute box coordinates to normalized coordinates in [0, 1].
Usually one uses the dynamic shape of the image or conv-layer tensor:
boxlist = box_list_ops.to_normalized_coordinates(boxlist,
tf.shape(images)[1],
... | Converts absolute box coordinates to normalized coordinates in [0, 1]. | [
"Converts",
"absolute",
"box",
"coordinates",
"to",
"normalized",
"coordinates",
"in",
"[",
"0",
"1",
"]",
"."
] | def to_normalized_coordinates(boxlist, height, width,
check_range=True, scope=None):
"""Converts absolute box coordinates to normalized coordinates in [0, 1].
Usually one uses the dynamic shape of the image or conv-layer tensor:
boxlist = box_list_ops.to_normalized_coordinates(box... | [
"def",
"to_normalized_coordinates",
"(",
"boxlist",
",",
"height",
",",
"width",
",",
"check_range",
"=",
"True",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'ToNormalizedCoordinates'",
")",
":",
"height",
"=",
... | https://github.com/BMW-InnovationLab/BMW-TensorFlow-Inference-API-CPU/blob/400ea6a5ca270eba3306aaa7bf58f0593ab1edb7/src/main/object_detection/core/box_list_ops.py#L740-L774 | ||
tsileo/microblog.pub | a775e272e1560f0a6b1014f4542632295f14b12b | blueprints/api.py | python | api_delete | () | return _user_api_response(activity=delete_id) | API endpoint to delete a Note activity. | API endpoint to delete a Note activity. | [
"API",
"endpoint",
"to",
"delete",
"a",
"Note",
"activity",
"."
] | def api_delete() -> _Response:
"""API endpoint to delete a Note activity."""
note = _user_api_get_note(from_outbox=True)
# Create the delete, same audience as the Create object
delete = ap.Delete(
context=new_context(note),
actor=ID,
object=ap.Tombstone(id=note.id).to_dict(embed... | [
"def",
"api_delete",
"(",
")",
"->",
"_Response",
":",
"note",
"=",
"_user_api_get_note",
"(",
"from_outbox",
"=",
"True",
")",
"# Create the delete, same audience as the Create object",
"delete",
"=",
"ap",
".",
"Delete",
"(",
"context",
"=",
"new_context",
"(",
... | https://github.com/tsileo/microblog.pub/blob/a775e272e1560f0a6b1014f4542632295f14b12b/blueprints/api.py#L149-L165 | |
pseewald/fprettify | cb254022c2034ad3b8f744f4dad1bf5b7438815d | fprettify/__init__.py | python | replace_relational_single_fline | (f_line, cstyle) | return new_line | format a single Fortran line - replaces scalar relational
operators in logical expressions to either Fortran or C-style.
.lt. <--> <
.le. <--> <=
.gt. <--> >
.ge. <--> >=
.eq. <--> ==
.ne. <--> /= | format a single Fortran line - replaces scalar relational
operators in logical expressions to either Fortran or C-style.
.lt. <--> <
.le. <--> <=
.gt. <--> >
.ge. <--> >=
.eq. <--> ==
.ne. <--> /= | [
"format",
"a",
"single",
"Fortran",
"line",
"-",
"replaces",
"scalar",
"relational",
"operators",
"in",
"logical",
"expressions",
"to",
"either",
"Fortran",
"or",
"C",
"-",
"style",
".",
".",
"lt",
".",
"<",
"--",
">",
"<",
".",
"le",
".",
"<",
"--",
... | def replace_relational_single_fline(f_line, cstyle):
"""
format a single Fortran line - replaces scalar relational
operators in logical expressions to either Fortran or C-style.
.lt. <--> <
.le. <--> <=
.gt. <--> >
.ge. <--> >=
.eq. <--> ==
.ne. <--> /=
"""
new_l... | [
"def",
"replace_relational_single_fline",
"(",
"f_line",
",",
"cstyle",
")",
":",
"new_line",
"=",
"f_line",
"# only act on lines that do contain a relation",
"if",
"REL_OP_RE",
".",
"search",
"(",
"f_line",
")",
":",
"# check that relation is not inside quotes, a string, or ... | https://github.com/pseewald/fprettify/blob/cb254022c2034ad3b8f744f4dad1bf5b7438815d/fprettify/__init__.py#L890-L946 | |
ninthDevilHAUNSTER/ArknightsAutoHelper | a27a930502d6e432368d9f62595a1d69a992f4e6 | vendor/penguin_client/penguin_client/api/_deprecated_ap_is_api.py | python | DeprecatedAPIsApi.get_matrix_using_get | (self, **kwargs) | Get matrix # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_matrix_using_get(async_req=True)
>>> result = thread.get()
:param async_req bool
:param bool is_person... | Get matrix # noqa: E501 | [
"Get",
"matrix",
"#",
"noqa",
":",
"E501"
] | def get_matrix_using_get(self, **kwargs): # noqa: E501
"""Get matrix # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_matrix_using_get(async_req=True)
>>> result = thread... | [
"def",
"get_matrix_using_get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'async_req'",
")",
":",
"return",
"self",
".",
"get_matrix_using_get_w... | https://github.com/ninthDevilHAUNSTER/ArknightsAutoHelper/blob/a27a930502d6e432368d9f62595a1d69a992f4e6/vendor/penguin_client/penguin_client/api/_deprecated_ap_is_api.py#L663-L686 | ||
n1nj4sec/pupy | a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39 | pupy/packages/all/winerror.py | python | SCODE_SEVERITY | (sc) | return (((sc) >> 31) & 1) | [] | def SCODE_SEVERITY(sc):
return (((sc) >> 31) & 1) | [
"def",
"SCODE_SEVERITY",
"(",
"sc",
")",
":",
"return",
"(",
"(",
"(",
"sc",
")",
">>",
"31",
")",
"&",
"1",
")"
] | https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/all/winerror.py#L1995-L1996 | |||
pyro-ppl/numpyro | 6a0856b7cda82fc255e23adc797bb79f5b7fc904 | numpyro/infer/mcmc.py | python | MCMC.print_summary | (self, prob=0.9, exclude_deterministic=True) | Print the statistics of posterior samples collected during running this MCMC instance.
:param float prob: the probability mass of samples within the credible interval.
:param bool exclude_deterministic: whether or not print out the statistics
at deterministic sites. | Print the statistics of posterior samples collected during running this MCMC instance. | [
"Print",
"the",
"statistics",
"of",
"posterior",
"samples",
"collected",
"during",
"running",
"this",
"MCMC",
"instance",
"."
] | def print_summary(self, prob=0.9, exclude_deterministic=True):
"""
Print the statistics of posterior samples collected during running this MCMC instance.
:param float prob: the probability mass of samples within the credible interval.
:param bool exclude_deterministic: whether or not pr... | [
"def",
"print_summary",
"(",
"self",
",",
"prob",
"=",
"0.9",
",",
"exclude_deterministic",
"=",
"True",
")",
":",
"# Exclude deterministic sites by default",
"sites",
"=",
"self",
".",
"_states",
"[",
"self",
".",
"_sample_field",
"]",
"if",
"isinstance",
"(",
... | https://github.com/pyro-ppl/numpyro/blob/6a0856b7cda82fc255e23adc797bb79f5b7fc904/numpyro/infer/mcmc.py#L657-L685 | ||
rcorcs/NatI | fdf014f4292afdc95250add7b6658468043228e1 | en/parser/nltk_lite/tag/hmm.py | python | HiddenMarkovModel.entropy | (self, unlabelled_sequence) | return entropy | Returns the entropy over labellings of the given sequence. This is
given by:
H(O) = - sum_S Pr(S | O) log Pr(S | O)
where the summation ranges over all state sequences, S. Let M{Z =
Pr(O) = sum_S Pr(S, O)} where the summation ranges over all state
sequences and O is the observa... | Returns the entropy over labellings of the given sequence. This is
given by: | [
"Returns",
"the",
"entropy",
"over",
"labellings",
"of",
"the",
"given",
"sequence",
".",
"This",
"is",
"given",
"by",
":"
] | def entropy(self, unlabelled_sequence):
"""
Returns the entropy over labellings of the given sequence. This is
given by:
H(O) = - sum_S Pr(S | O) log Pr(S | O)
where the summation ranges over all state sequences, S. Let M{Z =
Pr(O) = sum_S Pr(S, O)} where the summation ... | [
"def",
"entropy",
"(",
"self",
",",
"unlabelled_sequence",
")",
":",
"T",
"=",
"len",
"(",
"unlabelled_sequence",
")",
"N",
"=",
"len",
"(",
"self",
".",
"_states",
")",
"alpha",
"=",
"self",
".",
"_forward_probability",
"(",
"unlabelled_sequence",
")",
"b... | https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/parser/nltk_lite/tag/hmm.py#L289-L353 | |
ceph/teuthology | 6fc2011361437a9dfe4e45b50de224392eed8abc | teuthology/provision/fog.py | python | FOG._wait_for_ready | (self) | Attempt to connect to the machine via SSH | Attempt to connect to the machine via SSH | [
"Attempt",
"to",
"connect",
"to",
"the",
"machine",
"via",
"SSH"
] | def _wait_for_ready(self):
""" Attempt to connect to the machine via SSH """
with safe_while(sleep=6, tries=100) as proceed:
while proceed():
try:
self.remote.connect()
break
except (
socket.error,
... | [
"def",
"_wait_for_ready",
"(",
"self",
")",
":",
"with",
"safe_while",
"(",
"sleep",
"=",
"6",
",",
"tries",
"=",
"100",
")",
"as",
"proceed",
":",
"while",
"proceed",
"(",
")",
":",
"try",
":",
"self",
".",
"remote",
".",
"connect",
"(",
")",
"bre... | https://github.com/ceph/teuthology/blob/6fc2011361437a9dfe4e45b50de224392eed8abc/teuthology/provision/fog.py#L257-L276 | ||
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/contrib/gis/db/backends/postgis/operations.py | python | PostGISOperations.parse_raster | (self, value) | return from_pgraster(value) | Convert a PostGIS HEX String into a dict readable by GDALRaster. | Convert a PostGIS HEX String into a dict readable by GDALRaster. | [
"Convert",
"a",
"PostGIS",
"HEX",
"String",
"into",
"a",
"dict",
"readable",
"by",
"GDALRaster",
"."
] | def parse_raster(self, value):
"""Convert a PostGIS HEX String into a dict readable by GDALRaster."""
return from_pgraster(value) | [
"def",
"parse_raster",
"(",
"self",
",",
"value",
")",
":",
"return",
"from_pgraster",
"(",
"value",
")"
] | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/contrib/gis/db/backends/postgis/operations.py#L367-L369 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/db/models/base.py | python | simple_class_factory | (model, attrs) | return model | Used to unpickle Models without deferred fields.
We need to do this the hard way, rather than just using
the default __reduce__ implementation, because of a
__deepcopy__ problem in Python 2.4 | Used to unpickle Models without deferred fields. | [
"Used",
"to",
"unpickle",
"Models",
"without",
"deferred",
"fields",
"."
] | def simple_class_factory(model, attrs):
"""Used to unpickle Models without deferred fields.
We need to do this the hard way, rather than just using
the default __reduce__ implementation, because of a
__deepcopy__ problem in Python 2.4
"""
return model | [
"def",
"simple_class_factory",
"(",
"model",
",",
"attrs",
")",
":",
"return",
"model"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/db/models/base.py#L979-L986 | |
apple/coremltools | 141a83af482fcbdd5179807c9eaff9a7999c2c49 | deps/protobuf/python/google/protobuf/service.py | python | Service.GetDescriptor | () | Retrieves this service's descriptor. | Retrieves this service's descriptor. | [
"Retrieves",
"this",
"service",
"s",
"descriptor",
"."
] | def GetDescriptor():
"""Retrieves this service's descriptor."""
raise NotImplementedError | [
"def",
"GetDescriptor",
"(",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/deps/protobuf/python/google/protobuf/service.py#L61-L63 | ||
lukelbd/proplot | d0bc9c0857d9295b380b8613ef9aba81d50a067c | proplot/internals/inputs.py | python | _is_numeric | (data) | return len(data) and (
np.issubdtype(array.dtype, np.number)
or np.issubdtype(array.dtype, np.object)
and all(isinstance(_, np.number) for _ in array.flat)
) | Test whether input is numeric array rather than datetime or strings. | Test whether input is numeric array rather than datetime or strings. | [
"Test",
"whether",
"input",
"is",
"numeric",
"array",
"rather",
"than",
"datetime",
"or",
"strings",
"."
] | def _is_numeric(data):
"""
Test whether input is numeric array rather than datetime or strings.
"""
array = _to_numpy_array(data)
return len(data) and (
np.issubdtype(array.dtype, np.number)
or np.issubdtype(array.dtype, np.object)
and all(isinstance(_, np.number) for _ in ar... | [
"def",
"_is_numeric",
"(",
"data",
")",
":",
"array",
"=",
"_to_numpy_array",
"(",
"data",
")",
"return",
"len",
"(",
"data",
")",
"and",
"(",
"np",
".",
"issubdtype",
"(",
"array",
".",
"dtype",
",",
"np",
".",
"number",
")",
"or",
"np",
".",
"iss... | https://github.com/lukelbd/proplot/blob/d0bc9c0857d9295b380b8613ef9aba81d50a067c/proplot/internals/inputs.py#L67-L76 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-35/fabmetheus_utilities/geometry/creation/line.py | python | processXMLElement | (xmlElement) | Process the xml element. | Process the xml element. | [
"Process",
"the",
"xml",
"element",
"."
] | def processXMLElement(xmlElement):
"Process the xml element."
lineation.processXMLElementByGeometry(getGeometryOutput(None, xmlElement), xmlElement) | [
"def",
"processXMLElement",
"(",
"xmlElement",
")",
":",
"lineation",
".",
"processXMLElementByGeometry",
"(",
"getGeometryOutput",
"(",
"None",
",",
"xmlElement",
")",
",",
"xmlElement",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/fabmetheus_utilities/geometry/creation/line.py#L85-L87 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/preview/understand/assistant/__init__.py | python | AssistantPage.__init__ | (self, version, response, solution) | Initialize the AssistantPage
:param Version version: Version that contains the resource
:param Response response: Response from the API
:returns: twilio.rest.preview.understand.assistant.AssistantPage
:rtype: twilio.rest.preview.understand.assistant.AssistantPage | Initialize the AssistantPage | [
"Initialize",
"the",
"AssistantPage"
] | def __init__(self, version, response, solution):
"""
Initialize the AssistantPage
:param Version version: Version that contains the resource
:param Response response: Response from the API
:returns: twilio.rest.preview.understand.assistant.AssistantPage
:rtype: twilio.r... | [
"def",
"__init__",
"(",
"self",
",",
"version",
",",
"response",
",",
"solution",
")",
":",
"super",
"(",
"AssistantPage",
",",
"self",
")",
".",
"__init__",
"(",
"version",
",",
"response",
")",
"# Path Solution",
"self",
".",
"_solution",
"=",
"solution"... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/understand/assistant/__init__.py#L194-L207 | ||
xmengli/H-DenseUNet | 06cc436a43196310fe933d114a353839907cc176 | Keras-2.0.8/keras/backend/theano_backend.py | python | identity | (x) | return x.copy() | Returns a tensor with the same content as the input tensor.
# Arguments
x: The input tensor.
# Returns
A tensor of the same shape, type and content. | Returns a tensor with the same content as the input tensor. | [
"Returns",
"a",
"tensor",
"with",
"the",
"same",
"content",
"as",
"the",
"input",
"tensor",
"."
] | def identity(x):
"""Returns a tensor with the same content as the input tensor.
# Arguments
x: The input tensor.
# Returns
A tensor of the same shape, type and content.
"""
return x.copy() | [
"def",
"identity",
"(",
"x",
")",
":",
"return",
"x",
".",
"copy",
"(",
")"
] | https://github.com/xmengli/H-DenseUNet/blob/06cc436a43196310fe933d114a353839907cc176/Keras-2.0.8/keras/backend/theano_backend.py#L324-L333 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py | python | _EngineDebuggingSignalEvents.after_cursor_execute | (
self, conn, cursor, statement, parameters, context, executemany
) | [] | def after_cursor_execute(
self, conn, cursor, statement, parameters, context, executemany
):
if current_app:
try:
queries = _app_ctx_stack.top.sqlalchemy_queries
except AttributeError:
queries = _app_ctx_stack.top.sqlalchemy_queries = []
... | [
"def",
"after_cursor_execute",
"(",
"self",
",",
"conn",
",",
"cursor",
",",
"statement",
",",
"parameters",
",",
"context",
",",
"executemany",
")",
":",
"if",
"current_app",
":",
"try",
":",
"queries",
"=",
"_app_ctx_stack",
".",
"top",
".",
"sqlalchemy_qu... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py#L254-L266 | ||||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/asn1crypto/core.py | python | _tag_type_to_explicit_implicit | (params) | Converts old-style "tag_type" and "tag" params to "explicit" and "implicit"
:param params:
A dict of parameters to convert from tag_type/tag to explicit/implicit | Converts old-style "tag_type" and "tag" params to "explicit" and "implicit" | [
"Converts",
"old",
"-",
"style",
"tag_type",
"and",
"tag",
"params",
"to",
"explicit",
"and",
"implicit"
] | def _tag_type_to_explicit_implicit(params):
"""
Converts old-style "tag_type" and "tag" params to "explicit" and "implicit"
:param params:
A dict of parameters to convert from tag_type/tag to explicit/implicit
"""
if 'tag_type' in params:
if params['tag_type'] == 'explicit':
... | [
"def",
"_tag_type_to_explicit_implicit",
"(",
"params",
")",
":",
"if",
"'tag_type'",
"in",
"params",
":",
"if",
"params",
"[",
"'tag_type'",
"]",
"==",
"'explicit'",
":",
"params",
"[",
"'explicit'",
"]",
"=",
"(",
"params",
".",
"get",
"(",
"'class'",
",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/asn1crypto/core.py#L4845-L4861 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/mailbox.py | python | Mailbox._dump_message | (self, message, target, mangle_from_=False) | Dump message contents to target file. | Dump message contents to target file. | [
"Dump",
"message",
"contents",
"to",
"target",
"file",
"."
] | def _dump_message(self, message, target, mangle_from_=False):
# Most files are opened in binary mode to allow predictable seeking.
# To get native line endings on disk, the user-friendly \n line endings
# used in strings and by email.Message are translated here.
"""Dump message contents ... | [
"def",
"_dump_message",
"(",
"self",
",",
"message",
",",
"target",
",",
"mangle_from_",
"=",
"False",
")",
":",
"# Most files are opened in binary mode to allow predictable seeking.",
"# To get native line endings on disk, the user-friendly \\n line endings",
"# used in strings and ... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/mailbox.py#L200-L226 | ||
MILVLG/openvqa | f8f9966f202d5edf2a84096e1bc05ebf58ef55e6 | openvqa/datasets/vqa/eval/vqa.py | python | VQA.loadQA | (self, ids=[]) | Load questions and answers with the specified question ids.
:param ids (int array) : integer ids specifying question ids
:return: qa (object array) : loaded qa objects | Load questions and answers with the specified question ids.
:param ids (int array) : integer ids specifying question ids
:return: qa (object array) : loaded qa objects | [
"Load",
"questions",
"and",
"answers",
"with",
"the",
"specified",
"question",
"ids",
".",
":",
"param",
"ids",
"(",
"int",
"array",
")",
":",
"integer",
"ids",
"specifying",
"question",
"ids",
":",
"return",
":",
"qa",
"(",
"object",
"array",
")",
":",
... | def loadQA(self, ids=[]):
"""
Load questions and answers with the specified question ids.
:param ids (int array) : integer ids specifying question ids
:return: qa (object array) : loaded qa objects
"""
if type(ids) == list:
return [self.qa[id] for id in ids]
elif type(ids) == int:
return [se... | [
"def",
"loadQA",
"(",
"self",
",",
"ids",
"=",
"[",
"]",
")",
":",
"if",
"type",
"(",
"ids",
")",
"==",
"list",
":",
"return",
"[",
"self",
".",
"qa",
"[",
"id",
"]",
"for",
"id",
"in",
"ids",
"]",
"elif",
"type",
"(",
"ids",
")",
"==",
"in... | https://github.com/MILVLG/openvqa/blob/f8f9966f202d5edf2a84096e1bc05ebf58ef55e6/openvqa/datasets/vqa/eval/vqa.py#L121-L130 | ||
clips/pattern | d25511f9ca7ed9356b801d8663b8b5168464e68f | pattern/vector/__init__.py | python | Model.vectors | (self) | return [d.vector for d in self.documents] | Yields a list of all document vectors. | Yields a list of all document vectors. | [
"Yields",
"a",
"list",
"of",
"all",
"document",
"vectors",
"."
] | def vectors(self):
""" Yields a list of all document vectors.
"""
return [d.vector for d in self.documents] | [
"def",
"vectors",
"(",
"self",
")",
":",
"return",
"[",
"d",
".",
"vector",
"for",
"d",
"in",
"self",
".",
"documents",
"]"
] | https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/vector/__init__.py#L1295-L1298 | |
GoogleCloudPlatform/getting-started-python | e5dfea6d2583fb9e4b341165728a96c68e01d0c7 | optional-kubernetes-engine/bookshelf/model_cloudsql.py | python | from_sql | (row) | return data | Translates a SQLAlchemy model instance into a dictionary | Translates a SQLAlchemy model instance into a dictionary | [
"Translates",
"a",
"SQLAlchemy",
"model",
"instance",
"into",
"a",
"dictionary"
] | def from_sql(row):
"""Translates a SQLAlchemy model instance into a dictionary"""
data = row.__dict__.copy()
data['id'] = row.id
data.pop('_sa_instance_state')
return data | [
"def",
"from_sql",
"(",
"row",
")",
":",
"data",
"=",
"row",
".",
"__dict__",
".",
"copy",
"(",
")",
"data",
"[",
"'id'",
"]",
"=",
"row",
".",
"id",
"data",
".",
"pop",
"(",
"'_sa_instance_state'",
")",
"return",
"data"
] | https://github.com/GoogleCloudPlatform/getting-started-python/blob/e5dfea6d2583fb9e4b341165728a96c68e01d0c7/optional-kubernetes-engine/bookshelf/model_cloudsql.py#L31-L36 | |
getnikola/nikola | 2da876e9322e42a93f8295f950e336465c6a4ee5 | nikola/utils.py | python | get_parent_theme_name | (theme_name, themes_dirs=None) | Get name of parent theme. | Get name of parent theme. | [
"Get",
"name",
"of",
"parent",
"theme",
"."
] | def get_parent_theme_name(theme_name, themes_dirs=None):
"""Get name of parent theme."""
meta = parse_theme_meta(theme_name)
if meta:
parent = meta.get('Theme', 'parent', fallback=None)
if themes_dirs and parent:
return get_theme_path_real(parent, themes_dirs)
return pare... | [
"def",
"get_parent_theme_name",
"(",
"theme_name",
",",
"themes_dirs",
"=",
"None",
")",
":",
"meta",
"=",
"parse_theme_meta",
"(",
"theme_name",
")",
"if",
"meta",
":",
"parent",
"=",
"meta",
".",
"get",
"(",
"'Theme'",
",",
"'parent'",
",",
"fallback",
"... | https://github.com/getnikola/nikola/blob/2da876e9322e42a93f8295f950e336465c6a4ee5/nikola/utils.py#L627-L644 | ||
YosefLab/scvi-tools | f0a3ba6e11053069fd1857d2381083e5492fa8b8 | scvi/model/_multivi.py | python | MULTIVI.get_normalized_expression | (
self,
adata: Optional[AnnData] = None,
indices: Optional[Sequence[int]] = None,
n_samples_overall: Optional[int] = None,
transform_batch: Optional[Sequence[Union[Number, str]]] = None,
gene_list: Optional[Sequence[str]] = None,
use_z_mean: bool = True,
n... | r"""
Returns the normalized (decoded) gene expression.
This is denoted as :math:`\rho_n` in the scVI paper.
Parameters
----------
adata
AnnData object with equivalent structure to initial AnnData. If `None`, defaults to the
AnnData object used to initial... | r"""
Returns the normalized (decoded) gene expression. | [
"r",
"Returns",
"the",
"normalized",
"(",
"decoded",
")",
"gene",
"expression",
"."
] | def get_normalized_expression(
self,
adata: Optional[AnnData] = None,
indices: Optional[Sequence[int]] = None,
n_samples_overall: Optional[int] = None,
transform_batch: Optional[Sequence[Union[Number, str]]] = None,
gene_list: Optional[Sequence[str]] = None,
use_z... | [
"def",
"get_normalized_expression",
"(",
"self",
",",
"adata",
":",
"Optional",
"[",
"AnnData",
"]",
"=",
"None",
",",
"indices",
":",
"Optional",
"[",
"Sequence",
"[",
"int",
"]",
"]",
"=",
"None",
",",
"n_samples_overall",
":",
"Optional",
"[",
"int",
... | https://github.com/YosefLab/scvi-tools/blob/f0a3ba6e11053069fd1857d2381083e5492fa8b8/scvi/model/_multivi.py#L521-L630 | ||
mtianyan/VueDjangoAntdProBookShop | fd8fa2151c81edde2f8b8e6df8e1ddd799f940c2 | third_party/social_core/backends/saml.py | python | SAMLIdentityProvider.sso_url | (self) | return self.conf['url'] | Get the SSO URL for this IdP | Get the SSO URL for this IdP | [
"Get",
"the",
"SSO",
"URL",
"for",
"this",
"IdP"
] | def sso_url(self):
"""Get the SSO URL for this IdP"""
# Required. e.g.
# "https://idp.testshib.org/idp/profile/SAML2/Redirect/SSO"
return self.conf['url'] | [
"def",
"sso_url",
"(",
"self",
")",
":",
"# Required. e.g.",
"# \"https://idp.testshib.org/idp/profile/SAML2/Redirect/SSO\"",
"return",
"self",
".",
"conf",
"[",
"'url'",
"]"
] | https://github.com/mtianyan/VueDjangoAntdProBookShop/blob/fd8fa2151c81edde2f8b8e6df8e1ddd799f940c2/third_party/social_core/backends/saml.py#L90-L94 | |
microsoft/PointerSQL | 3688dab3ee67b005e858722cd33844c3d0bd6292 | model/pointer_net.py | python | DecoderType.__init__ | (self, ty, mask_name=None, mask_fn=None) | Create a decoder type object, dec_ty defines whether to point or project,
type defines which parts of attention states should be ignored (in decoding phase) | Create a decoder type object, dec_ty defines whether to point or project,
type defines which parts of attention states should be ignored (in decoding phase) | [
"Create",
"a",
"decoder",
"type",
"object",
"dec_ty",
"defines",
"whether",
"to",
"point",
"or",
"project",
"type",
"defines",
"which",
"parts",
"of",
"attention",
"states",
"should",
"be",
"ignored",
"(",
"in",
"decoding",
"phase",
")"
] | def __init__(self, ty, mask_name=None, mask_fn=None):
""" Create a decoder type object, dec_ty defines whether to point or project,
type defines which parts of attention states should be ignored (in decoding phase)"""
self.ty = ty
self.mask_name = mask_name
self.mask_fn = ma... | [
"def",
"__init__",
"(",
"self",
",",
"ty",
",",
"mask_name",
"=",
"None",
",",
"mask_fn",
"=",
"None",
")",
":",
"self",
".",
"ty",
"=",
"ty",
"self",
".",
"mask_name",
"=",
"mask_name",
"self",
".",
"mask_fn",
"=",
"mask_fn"
] | https://github.com/microsoft/PointerSQL/blob/3688dab3ee67b005e858722cd33844c3d0bd6292/model/pointer_net.py#L102-L107 | ||
cosmin/stashy | bc627e6e2889d6df7b35f710a1944699abcf9d5f | stashy/admin/groups.py | python | Groups.delete | (self, group) | return self._client.delete(self.url(), params=dict(name=group)) | Delete a group. | Delete a group. | [
"Delete",
"a",
"group",
"."
] | def delete(self, group):
"""
Delete a group.
"""
return self._client.delete(self.url(), params=dict(name=group)) | [
"def",
"delete",
"(",
"self",
",",
"group",
")",
":",
"return",
"self",
".",
"_client",
".",
"delete",
"(",
"self",
".",
"url",
"(",
")",
",",
"params",
"=",
"dict",
"(",
"name",
"=",
"group",
")",
")"
] | https://github.com/cosmin/stashy/blob/bc627e6e2889d6df7b35f710a1944699abcf9d5f/stashy/admin/groups.py#L14-L18 | |
tensorflow/datasets | 2e496976d7d45550508395fb2f35cf958c8a3414 | tensorflow_datasets/text/c4_utils.py | python | is_valid_length | (el, max_length=1.9e5) | return True | Returns False iff page's text is too long. | Returns False iff page's text is too long. | [
"Returns",
"False",
"iff",
"page",
"s",
"text",
"is",
"too",
"long",
"."
] | def is_valid_length(el, max_length=1.9e5):
"""Returns False iff page's text is too long."""
counter_inc_fn = get_counter_inc_fn("too-long-filter")
_, page = el
if len(page["text"]) > max_length:
counter_inc_fn("filtered")
return False
counter_inc_fn("passed")
return True | [
"def",
"is_valid_length",
"(",
"el",
",",
"max_length",
"=",
"1.9e5",
")",
":",
"counter_inc_fn",
"=",
"get_counter_inc_fn",
"(",
"\"too-long-filter\"",
")",
"_",
",",
"page",
"=",
"el",
"if",
"len",
"(",
"page",
"[",
"\"text\"",
"]",
")",
">",
"max_length... | https://github.com/tensorflow/datasets/blob/2e496976d7d45550508395fb2f35cf958c8a3414/tensorflow_datasets/text/c4_utils.py#L456-L464 | |
pygments/pygments | cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7 | pygments/filters/__init__.py | python | _replace_special | (ttype, value, regex, specialttype,
replacefunc=lambda x: x) | [] | def _replace_special(ttype, value, regex, specialttype,
replacefunc=lambda x: x):
last = 0
for match in regex.finditer(value):
start, end = match.start(), match.end()
if start != last:
yield ttype, value[last:start]
yield specialttype, replacefunc(value[s... | [
"def",
"_replace_special",
"(",
"ttype",
",",
"value",
",",
"regex",
",",
"specialttype",
",",
"replacefunc",
"=",
"lambda",
"x",
":",
"x",
")",
":",
"last",
"=",
"0",
"for",
"match",
"in",
"regex",
".",
"finditer",
"(",
"value",
")",
":",
"start",
"... | https://github.com/pygments/pygments/blob/cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7/pygments/filters/__init__.py#L52-L62 | ||||
freedombox/FreedomBox | 335a7f92cc08f27981f838a7cddfc67740598e54 | plinth/action_utils.py | python | is_disk_image | () | return os.path.exists('/var/lib/freedombox/is-freedombox-disk-image') | Return whether the current machine is from a disk image.
Two primary ways to install FreedomBox are:
- Using FreedomBox image for various hardware platforms.
- Installing packages on a Debian machine using apt. | Return whether the current machine is from a disk image. | [
"Return",
"whether",
"the",
"current",
"machine",
"is",
"from",
"a",
"disk",
"image",
"."
] | def is_disk_image():
"""Return whether the current machine is from a disk image.
Two primary ways to install FreedomBox are:
- Using FreedomBox image for various hardware platforms.
- Installing packages on a Debian machine using apt.
"""
return os.path.exists('/var/lib/freedombox/is-freedombox... | [
"def",
"is_disk_image",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"'/var/lib/freedombox/is-freedombox-disk-image'",
")"
] | https://github.com/freedombox/FreedomBox/blob/335a7f92cc08f27981f838a7cddfc67740598e54/plinth/action_utils.py#L396-L403 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tiw/v20190919/models.py | python | WhiteboardPushBackupParam.__init__ | (self) | r"""
:param PushUserId: 用于白板推流服务进房的用户ID,
该ID必须是一个单独的未在SDK中使用的ID,白板推流服务将使用这个用户ID进入房间进行白板推流,若该ID和SDK中使用的ID重复,会导致SDK和录制服务互踢,影响正常推流。
:type PushUserId: str
:param PushUserSig: 与PushUserId对应的签名
:type PushUserSig: str | r"""
:param PushUserId: 用于白板推流服务进房的用户ID,
该ID必须是一个单独的未在SDK中使用的ID,白板推流服务将使用这个用户ID进入房间进行白板推流,若该ID和SDK中使用的ID重复,会导致SDK和录制服务互踢,影响正常推流。
:type PushUserId: str
:param PushUserSig: 与PushUserId对应的签名
:type PushUserSig: str | [
"r",
":",
"param",
"PushUserId",
":",
"用于白板推流服务进房的用户ID,",
"该ID必须是一个单独的未在SDK中使用的ID,白板推流服务将使用这个用户ID进入房间进行白板推流,若该ID和SDK中使用的ID重复,会导致SDK和录制服务互踢,影响正常推流。",
":",
"type",
"PushUserId",
":",
"str",
":",
"param",
"PushUserSig",
":",
"与PushUserId对应的签名",
":",
"type",
"PushUserSig",
":",
... | def __init__(self):
r"""
:param PushUserId: 用于白板推流服务进房的用户ID,
该ID必须是一个单独的未在SDK中使用的ID,白板推流服务将使用这个用户ID进入房间进行白板推流,若该ID和SDK中使用的ID重复,会导致SDK和录制服务互踢,影响正常推流。
:type PushUserId: str
:param PushUserSig: 与PushUserId对应的签名
:type PushUserSig: str
"""
self.PushUserId = None
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"PushUserId",
"=",
"None",
"self",
".",
"PushUserSig",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tiw/v20190919/models.py#L2620-L2629 | ||
YosefLab/scvi-tools | f0a3ba6e11053069fd1857d2381083e5492fa8b8 | scvi/model/_scanvi.py | python | SCANVI.predict | (
self,
adata: Optional[AnnData] = None,
indices: Optional[Sequence[int]] = None,
soft: bool = False,
batch_size: Optional[int] = None,
) | Return cell label predictions.
Parameters
----------
adata
AnnData object that has been registered via :meth:`~scvi.model.SCANVI.setup_anndata`.
indices
Return probabilities for each class label.
soft
If True, returns per class probabilities
... | Return cell label predictions. | [
"Return",
"cell",
"label",
"predictions",
"."
] | def predict(
self,
adata: Optional[AnnData] = None,
indices: Optional[Sequence[int]] = None,
soft: bool = False,
batch_size: Optional[int] = None,
) -> Union[np.ndarray, pd.DataFrame]:
"""
Return cell label predictions.
Parameters
----------
... | [
"def",
"predict",
"(",
"self",
",",
"adata",
":",
"Optional",
"[",
"AnnData",
"]",
"=",
"None",
",",
"indices",
":",
"Optional",
"[",
"Sequence",
"[",
"int",
"]",
"]",
"=",
"None",
",",
"soft",
":",
"bool",
"=",
"False",
",",
"batch_size",
":",
"Op... | https://github.com/YosefLab/scvi-tools/blob/f0a3ba6e11053069fd1857d2381083e5492fa8b8/scvi/model/_scanvi.py#L254-L308 | ||
softlayer/softlayer-python | cdef7d63c66413197a9a97b0414de9f95887a82a | SoftLayer/CLI/user/vpn_subnet.py | python | cli | (env, user, add, subnet) | Add or remove subnets access for a user. | Add or remove subnets access for a user. | [
"Add",
"or",
"remove",
"subnets",
"access",
"for",
"a",
"user",
"."
] | def cli(env, user, add, subnet):
"""Add or remove subnets access for a user."""
mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolve_id(mgr.resolve_ids, user, 'username')
if add:
result = mgr.vpn_subnet_add(user_id, subnet)
else:
result = mgr.vpn_subnet_remove(user_id, s... | [
"def",
"cli",
"(",
"env",
",",
"user",
",",
"add",
",",
"subnet",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"UserManager",
"(",
"env",
".",
"client",
")",
"user_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"user",
",",
... | https://github.com/softlayer/softlayer-python/blob/cdef7d63c66413197a9a97b0414de9f95887a82a/SoftLayer/CLI/user/vpn_subnet.py#L18-L30 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/requests/models.py | python | PreparedRequest.prepare_hooks | (self, hooks) | Prepares the given hooks. | Prepares the given hooks. | [
"Prepares",
"the",
"given",
"hooks",
"."
] | def prepare_hooks(self, hooks):
"""Prepares the given hooks."""
# hooks can be passed as None to the prepare method and to this
# method. To prevent iterating over None, simply use an empty list
# if hooks is False-y
hooks = hooks or []
for event in hooks:
sel... | [
"def",
"prepare_hooks",
"(",
"self",
",",
"hooks",
")",
":",
"# hooks can be passed as None to the prepare method and to this",
"# method. To prevent iterating over None, simply use an empty list",
"# if hooks is False-y",
"hooks",
"=",
"hooks",
"or",
"[",
"]",
"for",
"event",
... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/requests/models.py#L586-L593 | ||
Azure/batch-shipyard | d6da749f9cd678037bd520bc074e40066ea35b56 | convoy/settings.py | python | set_task_name | (conf, name) | Set task name
:param dict conf: task configuration object
:param str name: task name to set | Set task name
:param dict conf: task configuration object
:param str name: task name to set | [
"Set",
"task",
"name",
":",
"param",
"dict",
"conf",
":",
"task",
"configuration",
"object",
":",
"param",
"str",
"name",
":",
"task",
"name",
"to",
"set"
] | def set_task_name(conf, name):
# type: (dict, str) -> None
"""Set task name
:param dict conf: task configuration object
:param str name: task name to set
"""
conf['name'] = name | [
"def",
"set_task_name",
"(",
"conf",
",",
"name",
")",
":",
"# type: (dict, str) -> None",
"conf",
"[",
"'name'",
"]",
"=",
"name"
] | https://github.com/Azure/batch-shipyard/blob/d6da749f9cd678037bd520bc074e40066ea35b56/convoy/settings.py#L3693-L3699 | ||
StackStorm/st2contrib | 095b021a31ba134728deb7c707240196d016e729 | packs/vsphere/actions/vm_hw_barebones_create.py | python | VMCreateBareBones.run | (self, vm_name, cluster, datastore_cluster,
datastore, resourcepool, cpu_size, ram_size,
guestos, version, description, vsphere=None) | return {'vm_id': task.info.result._moId} | Create barebones VM (CPU/RAM/Graphics)
Args:
- vm_name: Name of Virtual Machine to create
- vsphere: Pre-configured vsphere connection details (config.yaml)
- description: Short Description of VM and it's purpose
- cpu_size: Number of vCPUs to allocate
- ram_size: Ammoun... | Create barebones VM (CPU/RAM/Graphics) | [
"Create",
"barebones",
"VM",
"(",
"CPU",
"/",
"RAM",
"/",
"Graphics",
")"
] | def run(self, vm_name, cluster, datastore_cluster,
datastore, resourcepool, cpu_size, ram_size,
guestos, version, description, vsphere=None):
"""
Create barebones VM (CPU/RAM/Graphics)
Args:
- vm_name: Name of Virtual Machine to create
- vsphere: Pre-conf... | [
"def",
"run",
"(",
"self",
",",
"vm_name",
",",
"cluster",
",",
"datastore_cluster",
",",
"datastore",
",",
"resourcepool",
",",
"cpu_size",
",",
"ram_size",
",",
"guestos",
",",
"version",
",",
"description",
",",
"vsphere",
"=",
"None",
")",
":",
"# Setu... | https://github.com/StackStorm/st2contrib/blob/095b021a31ba134728deb7c707240196d016e729/packs/vsphere/actions/vm_hw_barebones_create.py#L24-L124 | |
Tuxemon/Tuxemon | ee80708090525391c1dfc43849a6348aca636b22 | tuxemon/state.py | python | State.startup | (self, **kwargs: Any) | Called when scene is added to the state stack.
This will be called:
* after state is pushed and before next update
* just once during the life of a state
Important! The state must be ready to be drawn after this is called.
Example uses: loading images, configuration, sounds, ... | Called when scene is added to the state stack. | [
"Called",
"when",
"scene",
"is",
"added",
"to",
"the",
"state",
"stack",
"."
] | def startup(self, **kwargs: Any) -> None:
"""
Called when scene is added to the state stack.
This will be called:
* after state is pushed and before next update
* just once during the life of a state
Important! The state must be ready to be drawn after this is called.
... | [
"def",
"startup",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":"
] | https://github.com/Tuxemon/Tuxemon/blob/ee80708090525391c1dfc43849a6348aca636b22/tuxemon/state.py#L237-L252 | ||
hakril/PythonForWindows | 61e027a678d5b87aa64fcf8a37a6661a86236589 | windows/winproxy/apis/setupapi.py | python | SetupDiEnumDeviceInfo | (DeviceInfoSet, MemberIndex, DeviceInfoData) | return SetupDiEnumDeviceInfo.ctypes_function(DeviceInfoSet, MemberIndex, DeviceInfoData) | Given a device information set, return the info associated with the index
or raise ERROR_NO_MORE_ITEMS if there is none anymore. | Given a device information set, return the info associated with the index
or raise ERROR_NO_MORE_ITEMS if there is none anymore. | [
"Given",
"a",
"device",
"information",
"set",
"return",
"the",
"info",
"associated",
"with",
"the",
"index",
"or",
"raise",
"ERROR_NO_MORE_ITEMS",
"if",
"there",
"is",
"none",
"anymore",
"."
] | def SetupDiEnumDeviceInfo(DeviceInfoSet, MemberIndex, DeviceInfoData):
"""
Given a device information set, return the info associated with the index
or raise ERROR_NO_MORE_ITEMS if there is none anymore.
"""
return SetupDiEnumDeviceInfo.ctypes_function(DeviceInfoSet, MemberIndex, DeviceInfoD... | [
"def",
"SetupDiEnumDeviceInfo",
"(",
"DeviceInfoSet",
",",
"MemberIndex",
",",
"DeviceInfoData",
")",
":",
"return",
"SetupDiEnumDeviceInfo",
".",
"ctypes_function",
"(",
"DeviceInfoSet",
",",
"MemberIndex",
",",
"DeviceInfoData",
")"
] | https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winproxy/apis/setupapi.py#L54-L59 | |
stevearc/pypicloud | 046126f0b2a692b7bd382ae5cd3bf7af2f58103c | doc/extensions/github.py | python | make_node | (rawtext, app, type_, slug, options) | return node | Create a github link | Create a github link | [
"Create",
"a",
"github",
"link"
] | def make_node(rawtext, app, type_, slug, options):
""" Create a github link """
if app.config.github_user is None:
raise ValueError("Configuration value for 'github_user' is not set.")
base_url = "https://github.com/%s/%s/" % (
app.config.github_user,
app.config.project,
)
re... | [
"def",
"make_node",
"(",
"rawtext",
",",
"app",
",",
"type_",
",",
"slug",
",",
"options",
")",
":",
"if",
"app",
".",
"config",
".",
"github_user",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Configuration value for 'github_user' is not set.\"",
")",
"b... | https://github.com/stevearc/pypicloud/blob/046126f0b2a692b7bd382ae5cd3bf7af2f58103c/doc/extensions/github.py#L17-L33 | |
ring04h/dirfuzz | 52373582c465a395769473d14ad6725b1f9e4156 | libs/requests/utils.py | python | get_unicode_from_response | (r) | Returns the requested content back in unicode.
:param r: Response object to get unicode content from.
Tried:
1. charset from content-type
2. fall back and replace all unicode characters | Returns the requested content back in unicode. | [
"Returns",
"the",
"requested",
"content",
"back",
"in",
"unicode",
"."
] | def get_unicode_from_response(r):
"""Returns the requested content back in unicode.
:param r: Response object to get unicode content from.
Tried:
1. charset from content-type
2. fall back and replace all unicode characters
"""
warnings.warn((
'In requests 3.0, get_unicode_from_re... | [
"def",
"get_unicode_from_response",
"(",
"r",
")",
":",
"warnings",
".",
"warn",
"(",
"(",
"'In requests 3.0, get_unicode_from_response will be removed. For '",
"'more information, please see the discussion on issue #2266. (This'",
"' warning should only appear once.)'",
")",
",",
"D... | https://github.com/ring04h/dirfuzz/blob/52373582c465a395769473d14ad6725b1f9e4156/libs/requests/utils.py#L352-L384 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.