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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/pages/feeds.py | python | LatestEntriesFeed.items | (self) | return items | [] | def items(self):
items = Page.objects.filter(**PUBLIC_FILTER).filter(syndicate=True).order_by('-create_dt')[:20]
return items | [
"def",
"items",
"(",
"self",
")",
":",
"items",
"=",
"Page",
".",
"objects",
".",
"filter",
"(",
"*",
"*",
"PUBLIC_FILTER",
")",
".",
"filter",
"(",
"syndicate",
"=",
"True",
")",
".",
"order_by",
"(",
"'-create_dt'",
")",
"[",
":",
"20",
"]",
"ret... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/pages/feeds.py#L16-L18 | |||
OpenMDAO/OpenMDAO | f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd | openmdao/surrogate_models/nn_interpolators/nn_base.py | python | NNBase.__init__ | (self, training_points, training_values, num_leaves=2) | Initialize nearest neighbor interpolant by scaling input to the unit hypercube. | Initialize nearest neighbor interpolant by scaling input to the unit hypercube. | [
"Initialize",
"nearest",
"neighbor",
"interpolant",
"by",
"scaling",
"input",
"to",
"the",
"unit",
"hypercube",
"."
] | def __init__(self, training_points, training_values, num_leaves=2):
"""
Initialize nearest neighbor interpolant by scaling input to the unit hypercube.
"""
# training_points and training_values are the known points and their
# respective values which will be interpolated against.... | [
"def",
"__init__",
"(",
"self",
",",
"training_points",
",",
"training_values",
",",
"num_leaves",
"=",
"2",
")",
":",
"# training_points and training_values are the known points and their",
"# respective values which will be interpolated against.",
"# Grab the mins and ranges of eac... | https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/surrogate_models/nn_interpolators/nn_base.py#L54-L84 | ||
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/sandbox/tsa/example_arma.py | python | autocorr | (s, axis=-1) | return sxx/N | Returns the autocorrelation of signal s at all lags. Adheres to the
definition r(k) = E{s(n)s*(n-k)} where E{} is the expectation operator. | Returns the autocorrelation of signal s at all lags. Adheres to the
definition r(k) = E{s(n)s*(n-k)} where E{} is the expectation operator. | [
"Returns",
"the",
"autocorrelation",
"of",
"signal",
"s",
"at",
"all",
"lags",
".",
"Adheres",
"to",
"the",
"definition",
"r",
"(",
"k",
")",
"=",
"E",
"{",
"s",
"(",
"n",
")",
"s",
"*",
"(",
"n",
"-",
"k",
")",
"}",
"where",
"E",
"{}",
"is",
... | def autocorr(s, axis=-1):
"""Returns the autocorrelation of signal s at all lags. Adheres to the
definition r(k) = E{s(n)s*(n-k)} where E{} is the expectation operator.
"""
N = s.shape[axis]
S = np.fft.fft(s, n=2*N-1, axis=axis)
sxx = np.fft.ifft(S*S.conjugate(), axis=axis).real[:N]
return sxx/N | [
"def",
"autocorr",
"(",
"s",
",",
"axis",
"=",
"-",
"1",
")",
":",
"N",
"=",
"s",
".",
"shape",
"[",
"axis",
"]",
"S",
"=",
"np",
".",
"fft",
".",
"fft",
"(",
"s",
",",
"n",
"=",
"2",
"*",
"N",
"-",
"1",
",",
"axis",
"=",
"axis",
")",
... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/sandbox/tsa/example_arma.py#L182-L189 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/urllib3/packages/backports/makefile.py | python | backport_makefile | (self, mode="r", buffering=None, encoding=None,
errors=None, newline=None) | return text | Backport of ``socket.makefile`` from Python 3.5. | Backport of ``socket.makefile`` from Python 3.5. | [
"Backport",
"of",
"socket",
".",
"makefile",
"from",
"Python",
"3",
".",
"5",
"."
] | def backport_makefile(self, mode="r", buffering=None, encoding=None,
errors=None, newline=None):
"""
Backport of ``socket.makefile`` from Python 3.5.
"""
if not set(mode) <= set(["r", "w", "b"]):
raise ValueError(
"invalid mode %r (only r, w, b allowed)" % (mode... | [
"def",
"backport_makefile",
"(",
"self",
",",
"mode",
"=",
"\"r\"",
",",
"buffering",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"None",
",",
"newline",
"=",
"None",
")",
":",
"if",
"not",
"set",
"(",
"mode",
")",
"<=",
"set",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/urllib3/packages/backports/makefile.py#L14-L53 | |
liquidctl/liquidctl | 73962574632f94050c2a75f517e929a29797b5e2 | liquidctl/util.py | python | delta | (profile) | return [(cur[0]-prev[0], cur[1]-prev[1])
for cur, prev in zip(profile[1:], profile[:-1])] | Compute a profile's Δx and Δy. | Compute a profile's Δx and Δy. | [
"Compute",
"a",
"profile",
"s",
"Δx",
"and",
"Δy",
"."
] | def delta(profile):
"""Compute a profile's Δx and Δy."""
return [(cur[0]-prev[0], cur[1]-prev[1])
for cur, prev in zip(profile[1:], profile[:-1])] | [
"def",
"delta",
"(",
"profile",
")",
":",
"return",
"[",
"(",
"cur",
"[",
"0",
"]",
"-",
"prev",
"[",
"0",
"]",
",",
"cur",
"[",
"1",
"]",
"-",
"prev",
"[",
"1",
"]",
")",
"for",
"cur",
",",
"prev",
"in",
"zip",
"(",
"profile",
"[",
"1",
... | https://github.com/liquidctl/liquidctl/blob/73962574632f94050c2a75f517e929a29797b5e2/liquidctl/util.py#L169-L172 | |
saltstack/salt-contrib | 062355938ad1cced273056e9c23dc344c6a2c858 | modules/syslog_ng.py | python | _parse_typed_parameter | (param) | Parses a TypedParameter and fills it with values. | Parses a TypedParameter and fills it with values. | [
"Parses",
"a",
"TypedParameter",
"and",
"fills",
"it",
"with",
"values",
"."
] | def _parse_typed_parameter(param):
'''
Parses a TypedParameter and fills it with values.
'''
global _current_parameter, _current_parameter_value
type, value = _expand_one_key_dictionary(param)
_current_parameter.type = type
if _is_simple_type(value) and value != '':
_current_paramet... | [
"def",
"_parse_typed_parameter",
"(",
"param",
")",
":",
"global",
"_current_parameter",
",",
"_current_parameter_value",
"type",
",",
"value",
"=",
"_expand_one_key_dictionary",
"(",
"param",
")",
"_current_parameter",
".",
"type",
"=",
"type",
"if",
"_is_simple_type... | https://github.com/saltstack/salt-contrib/blob/062355938ad1cced273056e9c23dc344c6a2c858/modules/syslog_ng.py#L427-L446 | ||
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/db/api.py | python | share_group_snapshot_get | (context, share_group_snapshot_id) | return IMPL.share_group_snapshot_get(context, share_group_snapshot_id) | Get a share group snapshot. | Get a share group snapshot. | [
"Get",
"a",
"share",
"group",
"snapshot",
"."
] | def share_group_snapshot_get(context, share_group_snapshot_id):
"""Get a share group snapshot."""
return IMPL.share_group_snapshot_get(context, share_group_snapshot_id) | [
"def",
"share_group_snapshot_get",
"(",
"context",
",",
"share_group_snapshot_id",
")",
":",
"return",
"IMPL",
".",
"share_group_snapshot_get",
"(",
"context",
",",
"share_group_snapshot_id",
")"
] | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/db/api.py#L1310-L1312 | |
Delta-ML/delta | 31dfebc8f20b7cb282b62f291ff25a87e403cc86 | egs/sre16/v1/local/make_sre18_eval.py | python | wait_for_background_commands | () | This waits for all threads to exit. You will often want to
run this at the end of programs that have launched background
threads, so that the program will wait for its child processes
to terminate before it dies. | This waits for all threads to exit. You will often want to
run this at the end of programs that have launched background
threads, so that the program will wait for its child processes
to terminate before it dies. | [
"This",
"waits",
"for",
"all",
"threads",
"to",
"exit",
".",
"You",
"will",
"often",
"want",
"to",
"run",
"this",
"at",
"the",
"end",
"of",
"programs",
"that",
"have",
"launched",
"background",
"threads",
"so",
"that",
"the",
"program",
"will",
"wait",
"... | def wait_for_background_commands():
""" This waits for all threads to exit. You will often want to
run this at the end of programs that have launched background
threads, so that the program will wait for its child processes
to terminate before it dies."""
for t in threading.enumerate():... | [
"def",
"wait_for_background_commands",
"(",
")",
":",
"for",
"t",
"in",
"threading",
".",
"enumerate",
"(",
")",
":",
"if",
"not",
"t",
"==",
"threading",
".",
"current_thread",
"(",
")",
":",
"t",
".",
"join",
"(",
")"
] | https://github.com/Delta-ML/delta/blob/31dfebc8f20b7cb282b62f291ff25a87e403cc86/egs/sre16/v1/local/make_sre18_eval.py#L178-L185 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/commands/Extrude/ExtrudePropertyManager.py | python | ExtrudePropertyManager.show | (self) | Extends superclass method. | Extends superclass method. | [
"Extends",
"superclass",
"method",
"."
] | def show(self):
"""
Extends superclass method.
"""
_superclass.show(self)
self.updateMessage() | [
"def",
"show",
"(",
"self",
")",
":",
"_superclass",
".",
"show",
"(",
"self",
")",
"self",
".",
"updateMessage",
"(",
")"
] | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/commands/Extrude/ExtrudePropertyManager.py#L40-L46 | ||
python-telegram-bot/python-telegram-bot | ade1529986f5b6d394a65372d6a27045a70725b2 | telegram/ext/updater.py | python | Updater.__init__ | (
self: 'Updater[CCT, UD, CD, BD]',
user_sig_handler: Callable = None,
dispatcher: Dispatcher[CCT, UD, CD, BD] = None,
) | [] | def __init__(
self: 'Updater[CCT, UD, CD, BD]',
user_sig_handler: Callable = None,
dispatcher: Dispatcher[CCT, UD, CD, BD] = None,
):
... | [
"def",
"__init__",
"(",
"self",
":",
"'Updater[CCT, UD, CD, BD]'",
",",
"user_sig_handler",
":",
"Callable",
"=",
"None",
",",
"dispatcher",
":",
"Dispatcher",
"[",
"CCT",
",",
"UD",
",",
"CD",
",",
"BD",
"]",
"=",
"None",
",",
")",
":",
"..."
] | https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/ext/updater.py#L195-L200 | ||||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/users/models.py | python | CouchUser.from_django_user | (cls, django_user, strict=False) | return cls.get_by_username(django_user.username, strict=strict) | [] | def from_django_user(cls, django_user, strict=False):
return cls.get_by_username(django_user.username, strict=strict) | [
"def",
"from_django_user",
"(",
"cls",
",",
"django_user",
",",
"strict",
"=",
"False",
")",
":",
"return",
"cls",
".",
"get_by_username",
"(",
"django_user",
".",
"username",
",",
"strict",
"=",
"strict",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/users/models.py#L1391-L1392 | |||
mypaint/mypaint | 90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33 | lib/layer/group.py | python | LayerStack.__setitem__ | (self, index, layer) | Replaces the layer at an index (notifies root) | Replaces the layer at an index (notifies root) | [
"Replaces",
"the",
"layer",
"at",
"an",
"index",
"(",
"notifies",
"root",
")"
] | def __setitem__(self, index, layer):
"""Replaces the layer at an index (notifies root)"""
index = self._normidx(index)
oldlayer = self._layers[index]
self._layers[index] = layer
self._notify_disown(oldlayer, index)
updates = [oldlayer.get_full_redraw_bbox()]
self.... | [
"def",
"__setitem__",
"(",
"self",
",",
"index",
",",
"layer",
")",
":",
"index",
"=",
"self",
".",
"_normidx",
"(",
"index",
")",
"oldlayer",
"=",
"self",
".",
"_layers",
"[",
"index",
"]",
"self",
".",
"_layers",
"[",
"index",
"]",
"=",
"layer",
... | https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/lib/layer/group.py#L349-L358 | ||
angr/claripy | 4c961b4dc664706be8142fe4868f27655bc8da77 | claripy/simplifications.py | python | SimplificationManager.rotate_shift_mask_simplifier | (a, b) | return expr | Handles the following case:
((A << a) | (A >> (_N - a))) & mask, where
A being a BVS,
a being a integer that is less than _N,
_N is either 32 or 64, and
mask can be evaluated to 0xffffffff (64-bit) or 0xffff (32-bit) after reversing the rotate-... | Handles the following case:
((A << a) | (A >> (_N - a))) & mask, where
A being a BVS,
a being a integer that is less than _N,
_N is either 32 or 64, and
mask can be evaluated to 0xffffffff (64-bit) or 0xffff (32-bit) after reversing the rotate-... | [
"Handles",
"the",
"following",
"case",
":",
"((",
"A",
"<<",
"a",
")",
"|",
"(",
"A",
">>",
"(",
"_N",
"-",
"a",
")))",
"&",
"mask",
"where",
"A",
"being",
"a",
"BVS",
"a",
"being",
"a",
"integer",
"that",
"is",
"less",
"than",
"_N",
"_N",
"is"... | def rotate_shift_mask_simplifier(a, b):
"""
Handles the following case:
((A << a) | (A >> (_N - a))) & mask, where
A being a BVS,
a being a integer that is less than _N,
_N is either 32 or 64, and
mask can be evaluated to 0xffff... | [
"def",
"rotate_shift_mask_simplifier",
"(",
"a",
",",
"b",
")",
":",
"# is the second argument a BVV?",
"if",
"b",
".",
"op",
"!=",
"'BVV'",
":",
"return",
"None",
"# is it a rotate-shift?",
"if",
"a",
".",
"op",
"!=",
"'__or__'",
"or",
"len",
"(",
"a",
".",... | https://github.com/angr/claripy/blob/4c961b4dc664706be8142fe4868f27655bc8da77/claripy/simplifications.py#L811-L864 | |
shchur/gnn-benchmark | 1e72912a0810cdf27ae54fd589a3b43358a2b161 | gnnbench/models/gat.py | python | attention_layer | (inputs, output_dim, num_heads, graph_adj, adj_with_self_loops_indices, activation_fn,
use_averaging,
input_dropout_prob, coefficient_dropout_prob,
weight_decay,
name) | [] | def attention_layer(inputs, output_dim, num_heads, graph_adj, adj_with_self_loops_indices, activation_fn,
use_averaging,
input_dropout_prob, coefficient_dropout_prob,
weight_decay,
name):
with tf.name_scope(name):
head_results =... | [
"def",
"attention_layer",
"(",
"inputs",
",",
"output_dim",
",",
"num_heads",
",",
"graph_adj",
",",
"adj_with_self_loops_indices",
",",
"activation_fn",
",",
"use_averaging",
",",
"input_dropout_prob",
",",
"coefficient_dropout_prob",
",",
"weight_decay",
",",
"name",
... | https://github.com/shchur/gnn-benchmark/blob/1e72912a0810cdf27ae54fd589a3b43358a2b161/gnnbench/models/gat.py#L118-L139 | ||||
iwonbigbro/gsync | 03db22fe826f073e56877918b0acb7b4ba908f18 | libgsync/output.py | python | Channel.disable | (self) | Disables the channel. | Disables the channel. | [
"Disables",
"the",
"channel",
"."
] | def disable(self):
"""Disables the channel."""
self._priority = -1 | [
"def",
"disable",
"(",
"self",
")",
":",
"self",
".",
"_priority",
"=",
"-",
"1"
] | https://github.com/iwonbigbro/gsync/blob/03db22fe826f073e56877918b0acb7b4ba908f18/libgsync/output.py#L29-L32 | ||
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | py3.10/multiprocess/resource_tracker.py | python | ResourceTracker.ensure_running | (self) | Make sure that resource tracker process is running.
This can be run from any process. Usually a child process will use
the resource created by its parent. | Make sure that resource tracker process is running. | [
"Make",
"sure",
"that",
"resource",
"tracker",
"process",
"is",
"running",
"."
] | def ensure_running(self):
'''Make sure that resource tracker process is running.
This can be run from any process. Usually a child process will use
the resource created by its parent.'''
with self._lock:
if self._fd is not None:
# resource tracker was launch... | [
"def",
"ensure_running",
"(",
"self",
")",
":",
"with",
"self",
".",
"_lock",
":",
"if",
"self",
".",
"_fd",
"is",
"not",
"None",
":",
"# resource tracker was launched before, is it still running?",
"if",
"self",
".",
"_check_alive",
"(",
")",
":",
"# => still a... | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.10/multiprocess/resource_tracker.py#L81-L143 | ||
Vector35/binaryninja-api | d9661f34eec6855d495a10eaafc2a8e2679756a7 | python/plugin.py | python | PluginCommand.register_for_address | (cls,
name: str,
description: str,
action: Callable[[binaryview.BinaryView, int], None],
is_valid: Optional[Callable[[binaryview.BinaryView, int], bool]] = None
) | r"""
``register_for_address`` Register a plugin to be called with an address argument
:param str name: name of the plugin (use 'Folder\\Name' to have the menu item nested in a folder)
:param str description: description of the plugin
:param callback action: function to call with the :class:`~binaryview.BinaryV... | r"""
``register_for_address`` Register a plugin to be called with an address argument | [
"r",
"register_for_address",
"Register",
"a",
"plugin",
"to",
"be",
"called",
"with",
"an",
"address",
"argument"
] | def register_for_address(cls,
name: str,
description: str,
action: Callable[[binaryview.BinaryView, int], None],
is_valid: Optional[Callable[[binaryview.BinaryView, int], bool]] = None
):
r"""
``register_for_address`` Register a plugin to be called with an address argument
:param str name: name of the p... | [
"def",
"register_for_address",
"(",
"cls",
",",
"name",
":",
"str",
",",
"description",
":",
"str",
",",
"action",
":",
"Callable",
"[",
"[",
"binaryview",
".",
"BinaryView",
",",
"int",
"]",
",",
"None",
"]",
",",
"is_valid",
":",
"Optional",
"[",
"Ca... | https://github.com/Vector35/binaryninja-api/blob/d9661f34eec6855d495a10eaafc2a8e2679756a7/python/plugin.py#L376-L397 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/google-api-python-client/oauth2client/client.py | python | Credentials.to_json | (self) | return self._to_json(Credentials.NON_SERIALIZED_MEMBERS) | Creating a JSON representation of an instance of Credentials.
Returns:
string, a JSON representation of this instance, suitable to pass to
from_json(). | Creating a JSON representation of an instance of Credentials. | [
"Creating",
"a",
"JSON",
"representation",
"of",
"an",
"instance",
"of",
"Credentials",
"."
] | def to_json(self):
"""Creating a JSON representation of an instance of Credentials.
Returns:
string, a JSON representation of this instance, suitable to pass to
from_json().
"""
return self._to_json(Credentials.NON_SERIALIZED_MEMBERS) | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"self",
".",
"_to_json",
"(",
"Credentials",
".",
"NON_SERIALIZED_MEMBERS",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/google-api-python-client/oauth2client/client.py#L134-L141 | |
H4ckForJob/dirmap | d2000165efe01988fe55280175b0f87930f65d33 | thirdlib/IPy/IPy.py | python | IPint.__cmp__ | (self, other) | return 0 | Called by comparison operations.
Should return a negative integer if self < other, zero if self
== other, a positive integer if self > other.
Order is first determined by the address family. IPv4 addresses
are always smaller than IPv6 addresses:
>>> IP('10.0.0.... | Called by comparison operations. | [
"Called",
"by",
"comparison",
"operations",
"."
] | def __cmp__(self, other):
"""Called by comparison operations.
Should return a negative integer if self < other, zero if self
== other, a positive integer if self > other.
Order is first determined by the address family. IPv4 addresses
are always smaller than IPv6 addres... | [
"def",
"__cmp__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"IPint",
")",
":",
"raise",
"TypeError",
"# Lower version -> lower result",
"if",
"self",
".",
"_ipversion",
"!=",
"other",
".",
"_ipversion",
":",
"return",... | https://github.com/H4ckForJob/dirmap/blob/d2000165efe01988fe55280175b0f87930f65d33/thirdlib/IPy/IPy.py#L706-L759 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/collections.py | python | EventCollection.get_linewidth | (self) | return super(EventCollection, self).get_linewidth()[0] | Get the width of the lines used to mark each event. | Get the width of the lines used to mark each event. | [
"Get",
"the",
"width",
"of",
"the",
"lines",
"used",
"to",
"mark",
"each",
"event",
"."
] | def get_linewidth(self):
"""Get the width of the lines used to mark each event."""
return super(EventCollection, self).get_linewidth()[0] | [
"def",
"get_linewidth",
"(",
"self",
")",
":",
"return",
"super",
"(",
"EventCollection",
",",
"self",
")",
".",
"get_linewidth",
"(",
")",
"[",
"0",
"]"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/collections.py#L1530-L1532 | |
sentinel-hub/eo-learn | cf964eaf173668d6a374675dbd7c1d244264c11d | visualization/eolearn/visualization/eoexecutor_visualization.py | python | EOExecutorVisualization._get_task_descriptions | (self) | return descriptions | Prepares a list of task names and their initialization parameters | Prepares a list of task names and their initialization parameters | [
"Prepares",
"a",
"list",
"of",
"task",
"names",
"and",
"their",
"initialization",
"parameters"
] | def _get_task_descriptions(self):
""" Prepares a list of task names and their initialization parameters
"""
descriptions = []
for task_name, task in self.eoexecutor.workflow.get_tasks().items():
descriptions.append({
'name': f"{task_name} ({task.__class__.__n... | [
"def",
"_get_task_descriptions",
"(",
"self",
")",
":",
"descriptions",
"=",
"[",
"]",
"for",
"task_name",
",",
"task",
"in",
"self",
".",
"eoexecutor",
".",
"workflow",
".",
"get_tasks",
"(",
")",
".",
"items",
"(",
")",
":",
"descriptions",
".",
"appen... | https://github.com/sentinel-hub/eo-learn/blob/cf964eaf173668d6a374675dbd7c1d244264c11d/visualization/eolearn/visualization/eoexecutor_visualization.py#L88-L102 | |
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/stats/libqsturng/qsturng_.py | python | _interpolate_v | (p, r, v) | return y | interpolates v based on the values in the A table for the
scalar value of r and th | interpolates v based on the values in the A table for the
scalar value of r and th | [
"interpolates",
"v",
"based",
"on",
"the",
"values",
"in",
"the",
"A",
"table",
"for",
"the",
"scalar",
"value",
"of",
"r",
"and",
"th"
] | def _interpolate_v(p, r, v):
"""
interpolates v based on the values in the A table for the
scalar value of r and th
"""
# interpolate v (p should be in table)
# ordinate: y**2
# abcissa: 1./v
# find the 3 closest v values
# only p >= .9 have table values for 1 degree of freedom.
... | [
"def",
"_interpolate_v",
"(",
"p",
",",
"r",
",",
"v",
")",
":",
"# interpolate v (p should be in table)",
"# ordinate: y**2",
"# abcissa: 1./v",
"# find the 3 closest v values",
"# only p >= .9 have table values for 1 degree of freedom.",
"# The boolean is used to index the tuple and... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/stats/libqsturng/qsturng_.py#L627-L667 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/_pydecimal.py | python | Decimal.__float__ | (self) | return float(s) | Float representation. | Float representation. | [
"Float",
"representation",
"."
] | def __float__(self):
"""Float representation."""
if self._isnan():
if self.is_snan():
raise ValueError("Cannot convert signaling NaN to float")
s = "-nan" if self._sign else "nan"
else:
s = str(self)
return float(s) | [
"def",
"__float__",
"(",
"self",
")",
":",
"if",
"self",
".",
"_isnan",
"(",
")",
":",
"if",
"self",
".",
"is_snan",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Cannot convert signaling NaN to float\"",
")",
"s",
"=",
"\"-nan\"",
"if",
"self",
".",
"_s... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/_pydecimal.py#L1598-L1606 | |
blurstudio/cross3d | 277968d1227de740fc87ef61005c75034420eadf | cross3d/abstract/abstractscenelayer.py | python | AbstractSceneLayer.altMaterialCount | (self) | return len(self._nativeAltMaterials()) | \remarks return the number of alternate materials that this layer is associated with
\return <int> count | \remarks return the number of alternate materials that this layer is associated with | [
"\\",
"remarks",
"return",
"the",
"number",
"of",
"alternate",
"materials",
"that",
"this",
"layer",
"is",
"associated",
"with"
] | def altMaterialCount(self):
"""
\remarks return the number of alternate materials that this layer is associated with
\return <int> count
"""
return len(self._nativeAltMaterials()) | [
"def",
"altMaterialCount",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_nativeAltMaterials",
"(",
")",
")"
] | https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/abstract/abstractscenelayer.py#L155-L161 | |
caktus/django-timepiece | 52515dec027664890efbc535429e1ba1ee152f40 | timepiece/entries/views.py | python | Dashboard.process_progress | (self, entries, assignments) | return project_progress | Returns a list of progress summary data (pk, name, hours worked, and
hours assigned) for each project either worked or assigned.
The list is ordered by project name. | Returns a list of progress summary data (pk, name, hours worked, and
hours assigned) for each project either worked or assigned.
The list is ordered by project name. | [
"Returns",
"a",
"list",
"of",
"progress",
"summary",
"data",
"(",
"pk",
"name",
"hours",
"worked",
"and",
"hours",
"assigned",
")",
"for",
"each",
"project",
"either",
"worked",
"or",
"assigned",
".",
"The",
"list",
"is",
"ordered",
"by",
"project",
"name"... | def process_progress(self, entries, assignments):
"""
Returns a list of progress summary data (pk, name, hours worked, and
hours assigned) for each project either worked or assigned.
The list is ordered by project name.
"""
# Determine all projects either worked or assign... | [
"def",
"process_progress",
"(",
"self",
",",
"entries",
",",
"assignments",
")",
":",
"# Determine all projects either worked or assigned.",
"project_q",
"=",
"Q",
"(",
"id__in",
"=",
"assignments",
".",
"values_list",
"(",
"'project__id'",
",",
"flat",
"=",
"True",... | https://github.com/caktus/django-timepiece/blob/52515dec027664890efbc535429e1ba1ee152f40/timepiece/entries/views.py#L101-L134 | |
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/plugins/obsolete/swing_gui.py | python | leoSwingTree.allocateNodes | (self,where,lines) | Allocate Tk widgets in nodes that will become visible as the result of an upcoming scroll | Allocate Tk widgets in nodes that will become visible as the result of an upcoming scroll | [
"Allocate",
"Tk",
"widgets",
"in",
"nodes",
"that",
"will",
"become",
"visible",
"as",
"the",
"result",
"of",
"an",
"upcoming",
"scroll"
] | def allocateNodes(self,where,lines):
"""Allocate Tk widgets in nodes that will become visible as the result of an upcoming scroll"""
assert(where in ("above","below"))
# print "allocateNodes: %d lines %s visible area" % (lines,where)
# Expand the visible area: a little extra delta is... | [
"def",
"allocateNodes",
"(",
"self",
",",
"where",
",",
"lines",
")",
":",
"assert",
"(",
"where",
"in",
"(",
"\"above\"",
",",
"\"below\"",
")",
")",
"# print \"allocateNodes: %d lines %s visible area\" % (lines,where)",
"# Expand the visible area: a little extra delta is ... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/obsolete/swing_gui.py#L6176-L6198 | ||
mfessenden/SceneGraph | 0fa3429059c77c881d1b58b28e89dcb44c609909 | ui/attributes.py | python | QIntEditor.initializeEditor | (self) | Set the widgets nodes values. | Set the widgets nodes values. | [
"Set",
"the",
"widgets",
"nodes",
"values",
"."
] | def initializeEditor(self):
"""
Set the widgets nodes values.
"""
if not self.nodes or not self.attribute:
return
editor_value = self.default_value
node_values = self.values
if node_values:
if len(node_values) > 1:
pass
... | [
"def",
"initializeEditor",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"nodes",
"or",
"not",
"self",
".",
"attribute",
":",
"return",
"editor_value",
"=",
"self",
".",
"default_value",
"node_values",
"=",
"self",
".",
"values",
"if",
"node_values",
":... | https://github.com/mfessenden/SceneGraph/blob/0fa3429059c77c881d1b58b28e89dcb44c609909/ui/attributes.py#L757-L783 | ||
allenai/allennlp | a3d71254fcc0f3615910e9c3d48874515edf53e0 | allennlp/modules/conditional_random_field.py | python | ConditionalRandomField.forward | (
self, inputs: torch.Tensor, tags: torch.Tensor, mask: torch.BoolTensor = None
) | return torch.sum(log_numerator - log_denominator) | Computes the log likelihood. | Computes the log likelihood. | [
"Computes",
"the",
"log",
"likelihood",
"."
] | def forward(
self, inputs: torch.Tensor, tags: torch.Tensor, mask: torch.BoolTensor = None
) -> torch.Tensor:
"""
Computes the log likelihood.
"""
if mask is None:
mask = torch.ones(*tags.size(), dtype=torch.bool, device=inputs.device)
else:
#... | [
"def",
"forward",
"(",
"self",
",",
"inputs",
":",
"torch",
".",
"Tensor",
",",
"tags",
":",
"torch",
".",
"Tensor",
",",
"mask",
":",
"torch",
".",
"BoolTensor",
"=",
"None",
")",
"->",
"torch",
".",
"Tensor",
":",
"if",
"mask",
"is",
"None",
":",... | https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/modules/conditional_random_field.py#L318-L334 | |
omerbsezer/LSTM_RNN_Tutorials_with_Demo | d3bb6b7dac10159b2e8a0a21fbf27e0078c3321b | SentimentAnalysisProject/emo_utils.py | python | read_glove_vecs | (glove_file) | return words_to_index, index_to_words, word_to_vec_map | [] | def read_glove_vecs(glove_file):
with open(glove_file, 'r', encoding="utf8") as f:
words = set()
word_to_vec_map = {}
for line in f:
line = line.strip().split()
curr_word = line[0]
words.add(curr_word)
word_to_vec_map[curr_word] = np.array(line... | [
"def",
"read_glove_vecs",
"(",
"glove_file",
")",
":",
"with",
"open",
"(",
"glove_file",
",",
"'r'",
",",
"encoding",
"=",
"\"utf8\"",
")",
"as",
"f",
":",
"words",
"=",
"set",
"(",
")",
"word_to_vec_map",
"=",
"{",
"}",
"for",
"line",
"in",
"f",
":... | https://github.com/omerbsezer/LSTM_RNN_Tutorials_with_Demo/blob/d3bb6b7dac10159b2e8a0a21fbf27e0078c3321b/SentimentAnalysisProject/emo_utils.py#L8-L25 | |||
wizyoung/googletranslate.popclipext | a3c465685a5a75213e2ec8517eb98d336984bc50 | src/h2/settings.py | python | Settings.acknowledge | (self) | return changed_settings | The settings have been acknowledged, either by the user (remote
settings) or by the remote peer (local settings).
:returns: A dict of {setting: ChangedSetting} that were applied. | The settings have been acknowledged, either by the user (remote
settings) or by the remote peer (local settings). | [
"The",
"settings",
"have",
"been",
"acknowledged",
"either",
"by",
"the",
"user",
"(",
"remote",
"settings",
")",
"or",
"by",
"the",
"remote",
"peer",
"(",
"local",
"settings",
")",
"."
] | def acknowledge(self):
"""
The settings have been acknowledged, either by the user (remote
settings) or by the remote peer (local settings).
:returns: A dict of {setting: ChangedSetting} that were applied.
"""
changed_settings = {}
# If there is more than one se... | [
"def",
"acknowledge",
"(",
"self",
")",
":",
"changed_settings",
"=",
"{",
"}",
"# If there is more than one setting in the list, we have a setting",
"# value outstanding. Update them.",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_settings",
".",
"items",
"(",
")",
":"... | https://github.com/wizyoung/googletranslate.popclipext/blob/a3c465685a5a75213e2ec8517eb98d336984bc50/src/h2/settings.py#L160-L179 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/asyncio/queues.py | python | Queue.put | (self, item) | return self.put_nowait(item) | Put an item into the queue.
Put an item into the queue. If the queue is full, wait until a free
slot is available before adding item.
This method is a coroutine. | Put an item into the queue. | [
"Put",
"an",
"item",
"into",
"the",
"queue",
"."
] | def put(self, item):
"""Put an item into the queue.
Put an item into the queue. If the queue is full, wait until a free
slot is available before adding item.
This method is a coroutine.
"""
while self.full():
putter = self._loop.create_future()
s... | [
"def",
"put",
"(",
"self",
",",
"item",
")",
":",
"while",
"self",
".",
"full",
"(",
")",
":",
"putter",
"=",
"self",
".",
"_loop",
".",
"create_future",
"(",
")",
"self",
".",
"_putters",
".",
"append",
"(",
"putter",
")",
"try",
":",
"yield",
"... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/asyncio/queues.py#L121-L141 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py | python | SubscribedTrackList.stream | (self, limit=None, page_size=None) | return self._version.stream(page, limits['limit']) | Streams SubscribedTrackInstance records from the API as a generator stream.
This operation lazily loads records as efficiently as possible until the limit
is reached.
The results are returned as a generator, so this operation is memory efficient.
:param int limit: Upper limit for the nu... | Streams SubscribedTrackInstance records from the API as a generator stream.
This operation lazily loads records as efficiently as possible until the limit
is reached.
The results are returned as a generator, so this operation is memory efficient. | [
"Streams",
"SubscribedTrackInstance",
"records",
"from",
"the",
"API",
"as",
"a",
"generator",
"stream",
".",
"This",
"operation",
"lazily",
"loads",
"records",
"as",
"efficiently",
"as",
"possible",
"until",
"the",
"limit",
"is",
"reached",
".",
"The",
"results... | def stream(self, limit=None, page_size=None):
"""
Streams SubscribedTrackInstance records from the API as a generator stream.
This operation lazily loads records as efficiently as possible until the limit
is reached.
The results are returned as a generator, so this operation is m... | [
"def",
"stream",
"(",
"self",
",",
"limit",
"=",
"None",
",",
"page_size",
"=",
"None",
")",
":",
"limits",
"=",
"self",
".",
"_version",
".",
"read_limits",
"(",
"limit",
",",
"page_size",
")",
"page",
"=",
"self",
".",
"page",
"(",
"page_size",
"="... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py#L36-L57 | |
openstack/ironic | b392dc19bcd29cef5a69ec00d2f18a7a19a679e5 | ironic/drivers/modules/image_utils.py | python | ImageHandler.publish_image | (self, image_file, object_name) | return image_url | Make image file downloadable.
Depending on ironic settings, pushes given file into Swift or copies
it over to local HTTP server's document root and returns publicly
accessible URL leading to the given file.
:param image_file: path to file to publish
:param object_name: name of ... | Make image file downloadable. | [
"Make",
"image",
"file",
"downloadable",
"."
] | def publish_image(self, image_file, object_name):
"""Make image file downloadable.
Depending on ironic settings, pushes given file into Swift or copies
it over to local HTTP server's document root and returns publicly
accessible URL leading to the given file.
:param image_file:... | [
"def",
"publish_image",
"(",
"self",
",",
"image_file",
",",
"object_name",
")",
":",
"if",
"self",
".",
"swift_enabled",
":",
"container",
"=",
"self",
".",
"_container",
"timeout",
"=",
"self",
".",
"_timeout",
"object_headers",
"=",
"{",
"'X-Delete-After'",... | https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/drivers/modules/image_utils.py#L172-L226 | |
nottombrown/rl-teacher | b2c2201e9d2457b13185424a19da7209364f23df | agents/pposgd-mpi/pposgd_mpi/common/tf_util.py | python | is_placeholder | (x) | return type(x) is tf.Tensor and len(x.op.inputs) == 0 | [] | def is_placeholder(x):
return type(x) is tf.Tensor and len(x.op.inputs) == 0 | [
"def",
"is_placeholder",
"(",
"x",
")",
":",
"return",
"type",
"(",
"x",
")",
"is",
"tf",
".",
"Tensor",
"and",
"len",
"(",
"x",
".",
"op",
".",
"inputs",
")",
"==",
"0"
] | https://github.com/nottombrown/rl-teacher/blob/b2c2201e9d2457b13185424a19da7209364f23df/agents/pposgd-mpi/pposgd_mpi/common/tf_util.py#L100-L101 | |||
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | external/linux32/lib/python2.6/site-packages/matplotlib/patches.py | python | Rectangle.__init__ | (self, xy, width, height, **kwargs) | *fill* is a boolean indicating whether to fill the rectangle
Valid kwargs are:
%(Patch)s | [] | def __init__(self, xy, width, height, **kwargs):
"""
*fill* is a boolean indicating whether to fill the rectangle
Valid kwargs are:
%(Patch)s
"""
Patch.__init__(self, **kwargs)
self._x = xy[0]
self._y = xy[1]
self._width = width
self._h... | [
"def",
"__init__",
"(",
"self",
",",
"xy",
",",
"width",
",",
"height",
",",
"*",
"*",
"kwargs",
")",
":",
"Patch",
".",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_x",
"=",
"xy",
"[",
"0",
"]",
"self",
".",
"_y",
"=... | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/external/linux32/lib/python2.6/site-packages/matplotlib/patches.py#L424-L440 | |||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/sunau.py | python | Au_write.setparams | (self, params) | [] | def setparams(self, params):
nchannels, sampwidth, framerate, nframes, comptype, compname = params
self.setnchannels(nchannels)
self.setsampwidth(sampwidth)
self.setframerate(framerate)
self.setnframes(nframes)
self.setcomptype(comptype, compname) | [
"def",
"setparams",
"(",
"self",
",",
"params",
")",
":",
"nchannels",
",",
"sampwidth",
",",
"framerate",
",",
"nframes",
",",
"comptype",
",",
"compname",
"=",
"params",
"self",
".",
"setnchannels",
"(",
"nchannels",
")",
"self",
".",
"setsampwidth",
"("... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/sunau.py#L400-L406 | ||||
qutebrowser/qutebrowser | 3a2aaaacbf97f4bf0c72463f3da94ed2822a5442 | qutebrowser/browser/greasemonkey.py | python | GreasemonkeyManager.all_scripts | (self) | return self._run_start + self._run_end + self._run_idle | Return all scripts found in the configured script directory. | Return all scripts found in the configured script directory. | [
"Return",
"all",
"scripts",
"found",
"in",
"the",
"configured",
"script",
"directory",
"."
] | def all_scripts(self):
"""Return all scripts found in the configured script directory."""
return self._run_start + self._run_end + self._run_idle | [
"def",
"all_scripts",
"(",
"self",
")",
":",
"return",
"self",
".",
"_run_start",
"+",
"self",
".",
"_run_end",
"+",
"self",
".",
"_run_idle"
] | https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/browser/greasemonkey.py#L445-L447 | |
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | external/linux32/lib/python2.6/site-packages/matplotlib/delaunay/triangulate.py | python | Triangulation.nn_interpolator | (self, z, default_value=np.nan) | return NNInterpolator(self, z, default_value) | Get an object which can interpolate within the convex hull by
the natural neighbors method.
z -- an array of floats giving the known function values at each point
in the triangulation. | Get an object which can interpolate within the convex hull by
the natural neighbors method. | [
"Get",
"an",
"object",
"which",
"can",
"interpolate",
"within",
"the",
"convex",
"hull",
"by",
"the",
"natural",
"neighbors",
"method",
"."
] | def nn_interpolator(self, z, default_value=np.nan):
"""Get an object which can interpolate within the convex hull by
the natural neighbors method.
z -- an array of floats giving the known function values at each point
in the triangulation.
"""
z = np.asarray(z, dtype=n... | [
"def",
"nn_interpolator",
"(",
"self",
",",
"z",
",",
"default_value",
"=",
"np",
".",
"nan",
")",
":",
"z",
"=",
"np",
".",
"asarray",
"(",
"z",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"if",
"z",
".",
"shape",
"!=",
"self",
".",
"old_shape... | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/external/linux32/lib/python2.6/site-packages/matplotlib/delaunay/triangulate.py#L145-L158 | |
lutris/lutris | 66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a | lutris/util/linux.py | python | LinuxSystem.has_steam | (self) | return bool(system.find_executable("steam")) | Return whether Steam is installed locally | Return whether Steam is installed locally | [
"Return",
"whether",
"Steam",
"is",
"installed",
"locally"
] | def has_steam(self):
"""Return whether Steam is installed locally"""
return bool(system.find_executable("steam")) | [
"def",
"has_steam",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"system",
".",
"find_executable",
"(",
"\"steam\"",
")",
")"
] | https://github.com/lutris/lutris/blob/66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a/lutris/util/linux.py#L219-L221 | |
facebookresearch/pytorch_GAN_zoo | b75dee40918caabb4fe7ec561522717bf096a8cb | models/utils/image_transform.py | python | NumpyFlip.__init__ | (self, p=0.5) | [] | def __init__(self, p=0.5):
self.p = p
random.seed(None) | [
"def",
"__init__",
"(",
"self",
",",
"p",
"=",
"0.5",
")",
":",
"self",
".",
"p",
"=",
"p",
"random",
".",
"seed",
"(",
"None",
")"
] | https://github.com/facebookresearch/pytorch_GAN_zoo/blob/b75dee40918caabb4fe7ec561522717bf096a8cb/models/utils/image_transform.py#L38-L40 | ||||
thinkle/gourmet | 8af29c8ded24528030e5ae2ea3461f61c1e5a575 | gourmet/threadManager.py | python | Terminated.__init__ | (self, value) | [] | def __init__ (self, value):
self.value=value | [
"def",
"__init__",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"value",
"=",
"value"
] | https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/threadManager.py#L55-L56 | ||||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/sms/v20190711/models.py | python | ModifySmsTemplateResponse.__init__ | (self) | r"""
:param ModifyTemplateStatus: 修改模板参数响应
:type ModifyTemplateStatus: :class:`tencentcloud.sms.v20190711.models.ModifyTemplateStatus`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param ModifyTemplateStatus: 修改模板参数响应
:type ModifyTemplateStatus: :class:`tencentcloud.sms.v20190711.models.ModifyTemplateStatus`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"ModifyTemplateStatus",
":",
"修改模板参数响应",
":",
"type",
"ModifyTemplateStatus",
":",
":",
"class",
":",
"tencentcloud",
".",
"sms",
".",
"v20190711",
".",
"models",
".",
"ModifyTemplateStatus",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返... | def __init__(self):
r"""
:param ModifyTemplateStatus: 修改模板参数响应
:type ModifyTemplateStatus: :class:`tencentcloud.sms.v20190711.models.ModifyTemplateStatus`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.ModifyTemplateStat... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ModifyTemplateStatus",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/sms/v20190711/models.py#L897-L905 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/imghdr.py | python | test_xbm | (h, f) | X bitmap (X10 or X11) | X bitmap (X10 or X11) | [
"X",
"bitmap",
"(",
"X10",
"or",
"X11",
")"
] | def test_xbm(h, f):
"""X bitmap (X10 or X11)"""
if h.startswith(b'#define '):
return 'xbm' | [
"def",
"test_xbm",
"(",
"h",
",",
"f",
")",
":",
"if",
"h",
".",
"startswith",
"(",
"b'#define '",
")",
":",
"return",
"'xbm'"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/imghdr.py#L100-L103 | ||
nelson-liu/contextual-repr-analysis | 1550abe0f2cad8586ac891e44dc2c5256d7d0685 | contexteval/data/dataset_readers/conll2003_ner.py | python | _is_divider | (line: str) | [] | def _is_divider(line: str) -> bool:
empty_line = line.strip() == ''
if empty_line:
return True
else:
first_token = line.split()[0]
if first_token == "-DOCSTART-":
return True
else:
return False | [
"def",
"_is_divider",
"(",
"line",
":",
"str",
")",
"->",
"bool",
":",
"empty_line",
"=",
"line",
".",
"strip",
"(",
")",
"==",
"''",
"if",
"empty_line",
":",
"return",
"True",
"else",
":",
"first_token",
"=",
"line",
".",
"split",
"(",
")",
"[",
"... | https://github.com/nelson-liu/contextual-repr-analysis/blob/1550abe0f2cad8586ac891e44dc2c5256d7d0685/contexteval/data/dataset_readers/conll2003_ner.py#L17-L26 | ||||
MycroftAI/mycroft-core | 3d963cee402e232174850f36918313e87313fb13 | mycroft/enclosure/api.py | python | EnclosureAPI.register | (self, skill_name="") | Registers a skill as active. Used for speak() and speak_dialog()
to 'patch' a previous implementation. Somewhat hacky. | Registers a skill as active. Used for speak() and speak_dialog()
to 'patch' a previous implementation. Somewhat hacky. | [
"Registers",
"a",
"skill",
"as",
"active",
".",
"Used",
"for",
"speak",
"()",
"and",
"speak_dialog",
"()",
"to",
"patch",
"a",
"previous",
"implementation",
".",
"Somewhat",
"hacky",
"."
] | def register(self, skill_name=""):
"""Registers a skill as active. Used for speak() and speak_dialog()
to 'patch' a previous implementation. Somewhat hacky.
"""
if self.name != "":
self.display_manager.set_active(self.name)
else:
self.display_manager.set_a... | [
"def",
"register",
"(",
"self",
",",
"skill_name",
"=",
"\"\"",
")",
":",
"if",
"self",
".",
"name",
"!=",
"\"\"",
":",
"self",
".",
"display_manager",
".",
"set_active",
"(",
"self",
".",
"name",
")",
"else",
":",
"self",
".",
"display_manager",
".",
... | https://github.com/MycroftAI/mycroft-core/blob/3d963cee402e232174850f36918313e87313fb13/mycroft/enclosure/api.py#L44-L51 | ||
kivy/python-for-android | 4ecaa5fe01aa25e3bc8cadc52ae481645754f955 | pythonforandroid/logger.py | python | shprint | (command, *args, **kwargs) | return output | Runs the command (which should be an sh.Command instance), while
logging the output. | Runs the command (which should be an sh.Command instance), while
logging the output. | [
"Runs",
"the",
"command",
"(",
"which",
"should",
"be",
"an",
"sh",
".",
"Command",
"instance",
")",
"while",
"logging",
"the",
"output",
"."
] | def shprint(command, *args, **kwargs):
'''Runs the command (which should be an sh.Command instance), while
logging the output.'''
kwargs["_iter"] = True
kwargs["_out_bufsize"] = 1
kwargs["_err_to_out"] = True
kwargs["_bg"] = True
is_critical = kwargs.pop('_critical', False)
tail_n = kwar... | [
"def",
"shprint",
"(",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"\"_iter\"",
"]",
"=",
"True",
"kwargs",
"[",
"\"_out_bufsize\"",
"]",
"=",
"1",
"kwargs",
"[",
"\"_err_to_out\"",
"]",
"=",
"True",
"kwargs",
"[",
... | https://github.com/kivy/python-for-android/blob/4ecaa5fe01aa25e3bc8cadc52ae481645754f955/pythonforandroid/logger.py#L131-L233 | |
DrSleep/tensorflow-deeplab-resnet | 066023c033624e6c8154340e06e8fbad4f702bdf | train_msc.py | python | load | (saver, sess, ckpt_path) | Load trained weights.
Args:
saver: TensorFlow Saver object.
sess: TensorFlow session.
ckpt_path: path to checkpoint file with parameters. | Load trained weights.
Args:
saver: TensorFlow Saver object.
sess: TensorFlow session.
ckpt_path: path to checkpoint file with parameters. | [
"Load",
"trained",
"weights",
".",
"Args",
":",
"saver",
":",
"TensorFlow",
"Saver",
"object",
".",
"sess",
":",
"TensorFlow",
"session",
".",
"ckpt_path",
":",
"path",
"to",
"checkpoint",
"file",
"with",
"parameters",
"."
] | def load(saver, sess, ckpt_path):
'''Load trained weights.
Args:
saver: TensorFlow Saver object.
sess: TensorFlow session.
ckpt_path: path to checkpoint file with parameters.
'''
saver.restore(sess, ckpt_path)
print("Restored model parameters from {}".format(ckpt_path)) | [
"def",
"load",
"(",
"saver",
",",
"sess",
",",
"ckpt_path",
")",
":",
"saver",
".",
"restore",
"(",
"sess",
",",
"ckpt_path",
")",
"print",
"(",
"\"Restored model parameters from {}\"",
".",
"format",
"(",
"ckpt_path",
")",
")"
] | https://github.com/DrSleep/tensorflow-deeplab-resnet/blob/066023c033624e6c8154340e06e8fbad4f702bdf/train_msc.py#L110-L119 | ||
choasup/SIN | 4851efb7b1c64180026e51ab8abcd95265c0602c | lib/rpn_msr/generate.py | python | _vis_proposals | (im, dets, thresh=0.5) | Draw detected bounding boxes. | Draw detected bounding boxes. | [
"Draw",
"detected",
"bounding",
"boxes",
"."
] | def _vis_proposals(im, dets, thresh=0.5):
"""Draw detected bounding boxes."""
inds = np.where(dets[:, -1] >= thresh)[0]
if len(inds) == 0:
return
class_name = 'obj'
im = im[:, :, (2, 1, 0)]
fig, ax = plt.subplots(figsize=(12, 12))
ax.imshow(im, aspect='equal')
for i in inds:
... | [
"def",
"_vis_proposals",
"(",
"im",
",",
"dets",
",",
"thresh",
"=",
"0.5",
")",
":",
"inds",
"=",
"np",
".",
"where",
"(",
"dets",
"[",
":",
",",
"-",
"1",
"]",
">=",
"thresh",
")",
"[",
"0",
"]",
"if",
"len",
"(",
"inds",
")",
"==",
"0",
... | https://github.com/choasup/SIN/blob/4851efb7b1c64180026e51ab8abcd95265c0602c/lib/rpn_msr/generate.py#L14-L45 | ||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/polys/subresultants_qq_zz.py | python | sign_seq | (poly_seq, x) | return [sign(LC(poly_seq[i], x)) for i in range(len(poly_seq))] | Given a sequence of polynomials poly_seq, it returns
the sequence of signs of the leading coefficients of
the polynomials in poly_seq. | Given a sequence of polynomials poly_seq, it returns
the sequence of signs of the leading coefficients of
the polynomials in poly_seq. | [
"Given",
"a",
"sequence",
"of",
"polynomials",
"poly_seq",
"it",
"returns",
"the",
"sequence",
"of",
"signs",
"of",
"the",
"leading",
"coefficients",
"of",
"the",
"polynomials",
"in",
"poly_seq",
"."
] | def sign_seq(poly_seq, x):
"""
Given a sequence of polynomials poly_seq, it returns
the sequence of signs of the leading coefficients of
the polynomials in poly_seq.
"""
return [sign(LC(poly_seq[i], x)) for i in range(len(poly_seq))] | [
"def",
"sign_seq",
"(",
"poly_seq",
",",
"x",
")",
":",
"return",
"[",
"sign",
"(",
"LC",
"(",
"poly_seq",
"[",
"i",
"]",
",",
"x",
")",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"poly_seq",
")",
")",
"]"
] | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/polys/subresultants_qq_zz.py#L611-L618 | |
WZMIAOMIAO/deep-learning-for-image-processing | a4502c284958d4bf78fb77b089a90e7688ddc196 | pytorch_object_detection/faster_rcnn/network_files/rpn_function.py | python | concat_box_prediction_layers | (box_cls, box_regression) | return box_cls, box_regression | 对box_cla和box_regression两个list中的每个预测特征层的预测信息
的tensor排列顺序以及shape进行调整 -> [N, -1, C]
Args:
box_cls: 每个预测特征层上的预测目标概率
box_regression: 每个预测特征层上的预测目标bboxes regression参数
Returns: | 对box_cla和box_regression两个list中的每个预测特征层的预测信息
的tensor排列顺序以及shape进行调整 -> [N, -1, C]
Args:
box_cls: 每个预测特征层上的预测目标概率
box_regression: 每个预测特征层上的预测目标bboxes regression参数 | [
"对box_cla和box_regression两个list中的每个预测特征层的预测信息",
"的tensor排列顺序以及shape进行调整",
"-",
">",
"[",
"N",
"-",
"1",
"C",
"]",
"Args",
":",
"box_cls",
":",
"每个预测特征层上的预测目标概率",
"box_regression",
":",
"每个预测特征层上的预测目标bboxes",
"regression参数"
] | def concat_box_prediction_layers(box_cls, box_regression):
# type: (List[Tensor], List[Tensor]) -> Tuple[Tensor, Tensor]
"""
对box_cla和box_regression两个list中的每个预测特征层的预测信息
的tensor排列顺序以及shape进行调整 -> [N, -1, C]
Args:
box_cls: 每个预测特征层上的预测目标概率
box_regression: 每个预测特征层上的预测目标bboxes regression参... | [
"def",
"concat_box_prediction_layers",
"(",
"box_cls",
",",
"box_regression",
")",
":",
"# type: (List[Tensor], List[Tensor]) -> Tuple[Tensor, Tensor]",
"box_cls_flattened",
"=",
"[",
"]",
"box_regression_flattened",
"=",
"[",
"]",
"# 遍历每个预测特征层",
"for",
"box_cls_per_level",
"... | https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/blob/a4502c284958d4bf78fb77b089a90e7688ddc196/pytorch_object_detection/faster_rcnn/network_files/rpn_function.py#L272-L309 | |
cornellius-gp/gpytorch | 61f643eb8b487aef332c818f661fbcdb1df576ca | gpytorch/likelihoods/multitask_gaussian_likelihood.py | python | _MultitaskGaussianLikelihoodBase.marginal | (self, function_dist, *params, **kwargs) | return function_dist.__class__(mean, covar) | r"""
If `rank` == 0, adds the task noises to the diagonal of the covariance matrix of the supplied
:obj:`gpytorch.distributions.MultivariateNormal` or :obj:`gpytorch.distributions.MultitaskMultivariateNormal`.
Otherwise, adds a rank `rank` covariance matrix to it.
To accomplish this, we... | r"""
If `rank` == 0, adds the task noises to the diagonal of the covariance matrix of the supplied
:obj:`gpytorch.distributions.MultivariateNormal` or :obj:`gpytorch.distributions.MultitaskMultivariateNormal`.
Otherwise, adds a rank `rank` covariance matrix to it. | [
"r",
"If",
"rank",
"==",
"0",
"adds",
"the",
"task",
"noises",
"to",
"the",
"diagonal",
"of",
"the",
"covariance",
"matrix",
"of",
"the",
"supplied",
":",
"obj",
":",
"gpytorch",
".",
"distributions",
".",
"MultivariateNormal",
"or",
":",
"obj",
":",
"gp... | def marginal(self, function_dist, *params, **kwargs):
r"""
If `rank` == 0, adds the task noises to the diagonal of the covariance matrix of the supplied
:obj:`gpytorch.distributions.MultivariateNormal` or :obj:`gpytorch.distributions.MultitaskMultivariateNormal`.
Otherwise, adds a rank `... | [
"def",
"marginal",
"(",
"self",
",",
"function_dist",
",",
"*",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"mean",
",",
"covar",
"=",
"function_dist",
".",
"mean",
",",
"function_dist",
".",
"lazy_covariance_matrix",
"# ensure that sumKroneckerLT is actually cal... | https://github.com/cornellius-gp/gpytorch/blob/61f643eb8b487aef332c818f661fbcdb1df576ca/gpytorch/likelihoods/multitask_gaussian_likelihood.py#L67-L99 | |
square/pylink | a2d9fbd3add62ffd06ba737c5ea82b8491fdc425 | pylink/jlink.py | python | JLink.__exit__ | (self, exc_type, exc_val, exc_tb) | Closes the JLink connection on exit of the context manager.
Stops the SWO if enabled and closes the J-Link connection if one
exists.
Args:
self (JLink): the ``JLink`` instance
exc_type (BaseExceptionType, None): the exception class, if any
raised inside the cont... | Closes the JLink connection on exit of the context manager. | [
"Closes",
"the",
"JLink",
"connection",
"on",
"exit",
"of",
"the",
"context",
"manager",
"."
] | def __exit__(self, exc_type, exc_val, exc_tb):
"""Closes the JLink connection on exit of the context manager.
Stops the SWO if enabled and closes the J-Link connection if one
exists.
Args:
self (JLink): the ``JLink`` instance
exc_type (BaseExceptionType, None): the ... | [
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
",",
"exc_val",
",",
"exc_tb",
")",
":",
"self",
".",
"_finalize",
"(",
")"
] | https://github.com/square/pylink/blob/a2d9fbd3add62ffd06ba737c5ea82b8491fdc425/pylink/jlink.py#L373-L392 | ||
FriedAppleTeam/FRAPL | 89c14d57e0cc77b915fe1e95f60e9e1847699103 | Framework/FridaLink/FridaLink/Core/HookEngine.py | python | HookEngineProtocol.showImportSymbolCPUForIdx | (self, import_idx) | [] | def showImportSymbolCPUForIdx(self, import_idx):
if self.clientSocket is None:
fl_log("FridaLink: Frida not connected\n");
return
importEntry = self.imports[import_idx]
if importEntry.address not in self.importHookMap:
return
address = importEntry.address;
if self.cpuContextViews.hasView(address) ... | [
"def",
"showImportSymbolCPUForIdx",
"(",
"self",
",",
"import_idx",
")",
":",
"if",
"self",
".",
"clientSocket",
"is",
"None",
":",
"fl_log",
"(",
"\"FridaLink: Frida not connected\\n\"",
")",
"return",
"importEntry",
"=",
"self",
".",
"imports",
"[",
"import_idx"... | https://github.com/FriedAppleTeam/FRAPL/blob/89c14d57e0cc77b915fe1e95f60e9e1847699103/Framework/FridaLink/FridaLink/Core/HookEngine.py#L654-L670 | ||||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/google_ads_service/client.py | python | GoogleAdsServiceClient.parse_shopping_performance_view_path | (path: str) | return m.groupdict() if m else {} | Parse a shopping_performance_view path into its component segments. | Parse a shopping_performance_view path into its component segments. | [
"Parse",
"a",
"shopping_performance_view",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_shopping_performance_view_path(path: str) -> Dict[str, str]:
"""Parse a shopping_performance_view path into its component segments."""
m = re.match(
r"^customers/(?P<customer_id>.+?)/shoppingPerformanceView$", path
)
return m.groupdict() if m else {} | [
"def",
"parse_shopping_performance_view_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^customers/(?P<customer_id>.+?)/shoppingPerformanceView$\"",
",",
"path",
")",
"return",
"m",
".",... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/google_ads_service/client.py#L2740-L2745 | |
mithril-global/GoAgentX | 788fbd5e1c824c75cf98a9aef8a6d4ec8df25e95 | GoAgentX.app/Contents/PlugIns/shadowsocks.gxbundle/Contents/Resources/bin/python/M2Crypto/X509.py | python | X509_Store_Context.get_error | (self) | return m2.x509_store_ctx_get_error(self.ctx) | Get error code. | Get error code. | [
"Get",
"error",
"code",
"."
] | def get_error(self):
"""
Get error code.
"""
return m2.x509_store_ctx_get_error(self.ctx) | [
"def",
"get_error",
"(",
"self",
")",
":",
"return",
"m2",
".",
"x509_store_ctx_get_error",
"(",
"self",
".",
"ctx",
")"
] | https://github.com/mithril-global/GoAgentX/blob/788fbd5e1c824c75cf98a9aef8a6d4ec8df25e95/GoAgentX.app/Contents/PlugIns/shadowsocks.gxbundle/Contents/Resources/bin/python/M2Crypto/X509.py#L700-L704 | |
nfvlabs/openmano | b09eabec0a168aeda8adc3ea99f734e45e810205 | openvim/utils/RADclass.py | python | RADclass.set_os | (self,os) | return (True, "") | Sets the operating system.
Returns (True,Warning) in case of success and ('False',<error description>) in case of error | Sets the operating system.
Returns (True,Warning) in case of success and ('False',<error description>) in case of error | [
"Sets",
"the",
"operating",
"system",
".",
"Returns",
"(",
"True",
"Warning",
")",
"in",
"case",
"of",
"success",
"and",
"(",
"False",
"<error",
"description",
">",
")",
"in",
"case",
"of",
"error"
] | def set_os(self,os):
"""Sets the operating system.
Returns (True,Warning) in case of success and ('False',<error description>) in case of error"""
if not isinstance(os,OpSys):
return (False, 'The variable \'os\' must be of class OpSys')
self.os.assign(os)
re... | [
"def",
"set_os",
"(",
"self",
",",
"os",
")",
":",
"if",
"not",
"isinstance",
"(",
"os",
",",
"OpSys",
")",
":",
"return",
"(",
"False",
",",
"'The variable \\'os\\' must be of class OpSys'",
")",
"self",
".",
"os",
".",
"assign",
"(",
"os",
")",
"return... | https://github.com/nfvlabs/openmano/blob/b09eabec0a168aeda8adc3ea99f734e45e810205/openvim/utils/RADclass.py#L300-L307 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/PIL/Image.py | python | effect_mandelbrot | (size, extent, quality) | return Image()._new(core.effect_mandelbrot(size, extent, quality)) | Generate a Mandelbrot set covering the given extent.
:param size: The requested size in pixels, as a 2-tuple:
(width, height).
:param extent: The extent to cover, as a 4-tuple:
(x0, y0, x1, y2).
:param quality: Quality. | Generate a Mandelbrot set covering the given extent. | [
"Generate",
"a",
"Mandelbrot",
"set",
"covering",
"the",
"given",
"extent",
"."
] | def effect_mandelbrot(size, extent, quality):
"""
Generate a Mandelbrot set covering the given extent.
:param size: The requested size in pixels, as a 2-tuple:
(width, height).
:param extent: The extent to cover, as a 4-tuple:
(x0, y0, x1, y2).
:param quality: Quality.
"""
ret... | [
"def",
"effect_mandelbrot",
"(",
"size",
",",
"extent",
",",
"quality",
")",
":",
"return",
"Image",
"(",
")",
".",
"_new",
"(",
"core",
".",
"effect_mandelbrot",
"(",
"size",
",",
"extent",
",",
"quality",
")",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/PIL/Image.py#L2820-L2830 | |
GetStream/stream-python | 142b5b43c0a60a96c36f25b6fc5a224dd2e418cc | setup.py | python | PyTest.finalize_options | (self) | [] | def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True | [
"def",
"finalize_options",
"(",
"self",
")",
":",
"TestCommand",
".",
"finalize_options",
"(",
"self",
")",
"self",
".",
"test_args",
"=",
"[",
"]",
"self",
".",
"test_suite",
"=",
"True"
] | https://github.com/GetStream/stream-python/blob/142b5b43c0a60a96c36f25b6fc5a224dd2e418cc/setup.py#L23-L26 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/schedules.py | python | crontab_parser._parse_part | (self, part) | return self._expand_range((part,)) | [] | def _parse_part(self, part):
for regex, handler in self.pats:
m = regex.match(part)
if m:
return handler(m.groups())
return self._expand_range((part,)) | [
"def",
"_parse_part",
"(",
"self",
",",
"part",
")",
":",
"for",
"regex",
",",
"handler",
"in",
"self",
".",
"pats",
":",
"m",
"=",
"regex",
".",
"match",
"(",
"part",
")",
"if",
"m",
":",
"return",
"handler",
"(",
"m",
".",
"groups",
"(",
")",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/schedules.py#L263-L268 | |||
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/ext/makerbot_driver/GcodeProcessors/EmptyLayerProcessor.py | python | EmptyLayerProcessor.check_for_layer_end | (self, string) | [] | def check_for_layer_end(self, string):
match = re.match(self.MG_layer_end, string)
if match is not None:
return 'mg'
match = re.match(self.SF_layer_end, string)
if match is not None:
return 'sf'
else:
return None | [
"def",
"check_for_layer_end",
"(",
"self",
",",
"string",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"self",
".",
"MG_layer_end",
",",
"string",
")",
"if",
"match",
"is",
"not",
"None",
":",
"return",
"'mg'",
"match",
"=",
"re",
".",
"match",
"... | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/ext/makerbot_driver/GcodeProcessors/EmptyLayerProcessor.py#L133-L141 | ||||
cobbler/cobbler | eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc | cobbler/remote.py | python | CobblerXMLRPCInterface.remove_autoinstall_snippet | (self, file_path: str, token: str) | return True | Remove an automated OS installation snippet file
:param file_path: automated OS installation snippet file path
:param token: Cobbler token, obtained form login()
:return: bool if operation was successful | Remove an automated OS installation snippet file | [
"Remove",
"an",
"automated",
"OS",
"installation",
"snippet",
"file"
] | def remove_autoinstall_snippet(self, file_path: str, token: str):
"""
Remove an automated OS installation snippet file
:param file_path: automated OS installation snippet file path
:param token: Cobbler token, obtained form login()
:return: bool if operation was successful
... | [
"def",
"remove_autoinstall_snippet",
"(",
"self",
",",
"file_path",
":",
"str",
",",
"token",
":",
"str",
")",
":",
"what",
"=",
"\"remove_autoinstall_snippet\"",
"self",
".",
"_log",
"(",
"what",
",",
"name",
"=",
"file_path",
",",
"token",
"=",
"token",
... | https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/remote.py#L3517-L3532 | |
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/mailbox.py | python | MaildirMessage.get_subdir | (self) | return self._subdir | Return 'new' or 'cur'. | Return 'new' or 'cur'. | [
"Return",
"new",
"or",
"cur",
"."
] | def get_subdir(self):
"""Return 'new' or 'cur'."""
return self._subdir | [
"def",
"get_subdir",
"(",
"self",
")",
":",
"return",
"self",
".",
"_subdir"
] | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/mailbox.py#L1491-L1493 | |
nameko/nameko | 17ecee2bcfa90cb0f3a2f3328c5004f48e4e02a3 | nameko/rpc.py | python | MethodProxy.__repr__ | (self) | return '<proxy method: {}.{}>'.format(service_name, method_name) | [] | def __repr__(self):
service_name = self.service_name
method_name = self.method_name
return '<proxy method: {}.{}>'.format(service_name, method_name) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"service_name",
"=",
"self",
".",
"service_name",
"method_name",
"=",
"self",
".",
"method_name",
"return",
"'<proxy method: {}.{}>'",
".",
"format",
"(",
"service_name",
",",
"method_name",
")"
] | https://github.com/nameko/nameko/blob/17ecee2bcfa90cb0f3a2f3328c5004f48e4e02a3/nameko/rpc.py#L463-L466 | |||
nipy/nipy | d16d268938dcd5c15748ca051532c21f57cf8a22 | nipy/externals/configobj.py | python | ConfigObj._handle_value | (self, value) | return (the_list, comment) | Given a value string, unquote, remove comment,
handle lists. (including empty and single member lists) | Given a value string, unquote, remove comment,
handle lists. (including empty and single member lists) | [
"Given",
"a",
"value",
"string",
"unquote",
"remove",
"comment",
"handle",
"lists",
".",
"(",
"including",
"empty",
"and",
"single",
"member",
"lists",
")"
] | def _handle_value(self, value):
"""
Given a value string, unquote, remove comment,
handle lists. (including empty and single member lists)
"""
if self._inspec:
# Parsing a configspec so don't handle comments
return (value, '')
# do we look for list... | [
"def",
"_handle_value",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"_inspec",
":",
"# Parsing a configspec so don't handle comments",
"return",
"(",
"value",
",",
"''",
")",
"# do we look for lists in values ?",
"if",
"not",
"self",
".",
"list_values",
... | https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/externals/configobj.py#L1851-L1897 | |
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/dns/opcode.py | python | is_update | (flags) | return from_flags(flags) == Opcode.UPDATE | Is the opcode in flags UPDATE?
*flags*, an ``int``, the DNS message flags.
Returns a ``bool``. | Is the opcode in flags UPDATE? | [
"Is",
"the",
"opcode",
"in",
"flags",
"UPDATE?"
] | def is_update(flags):
"""Is the opcode in flags UPDATE?
*flags*, an ``int``, the DNS message flags.
Returns a ``bool``.
"""
return from_flags(flags) == Opcode.UPDATE | [
"def",
"is_update",
"(",
"flags",
")",
":",
"return",
"from_flags",
"(",
"flags",
")",
"==",
"Opcode",
".",
"UPDATE"
] | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/dns/opcode.py#L99-L107 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/locale.py | python | _group | (s, monetary=False) | return (
left_spaces + thousands_sep.join(groups) + right_spaces,
len(thousands_sep) * (len(groups) - 1)
) | [] | def _group(s, monetary=False):
conv = localeconv()
thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
grouping = conv[monetary and 'mon_grouping' or 'grouping']
if not grouping:
return (s, 0)
if s[-1] == ' ':
stripped = s.rstrip()
right_spaces = s[len(s... | [
"def",
"_group",
"(",
"s",
",",
"monetary",
"=",
"False",
")",
":",
"conv",
"=",
"localeconv",
"(",
")",
"thousands_sep",
"=",
"conv",
"[",
"monetary",
"and",
"'mon_thousands_sep'",
"or",
"'thousands_sep'",
"]",
"grouping",
"=",
"conv",
"[",
"monetary",
"a... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/locale.py#L138-L166 | |||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | citrix_hypervisor/datadog_checks/citrix_hypervisor/config_models/defaults.py | python | instance_kerberos_force_initiate | (field, value) | return False | [] | def instance_kerberos_force_initiate(field, value):
return False | [
"def",
"instance_kerberos_force_initiate",
"(",
"field",
",",
"value",
")",
":",
"return",
"False"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/citrix_hypervisor/datadog_checks/citrix_hypervisor/config_models/defaults.py#L85-L86 | |||
akfamily/akshare | 590e50eece9ec067da3538c7059fd660b71f1339 | akshare/stock/stock_zh_a_sina.py | python | _get_zh_a_page_count | () | 所有股票的总页数
http://vip.stock.finance.sina.com.cn/mkt/#hs_a
:return: 需要采集的股票总页数
:rtype: int | 所有股票的总页数
http://vip.stock.finance.sina.com.cn/mkt/#hs_a
:return: 需要采集的股票总页数
:rtype: int | [
"所有股票的总页数",
"http",
":",
"//",
"vip",
".",
"stock",
".",
"finance",
".",
"sina",
".",
"com",
".",
"cn",
"/",
"mkt",
"/",
"#hs_a",
":",
"return",
":",
"需要采集的股票总页数",
":",
"rtype",
":",
"int"
] | def _get_zh_a_page_count() -> int:
"""
所有股票的总页数
http://vip.stock.finance.sina.com.cn/mkt/#hs_a
:return: 需要采集的股票总页数
:rtype: int
"""
res = requests.get(zh_sina_a_stock_count_url)
page_count = int(re.findall(re.compile(r"\d+"), res.text)[0]) / 80
if isinstance(page_count, int):
... | [
"def",
"_get_zh_a_page_count",
"(",
")",
"->",
"int",
":",
"res",
"=",
"requests",
".",
"get",
"(",
"zh_sina_a_stock_count_url",
")",
"page_count",
"=",
"int",
"(",
"re",
".",
"findall",
"(",
"re",
".",
"compile",
"(",
"r\"\\d+\"",
")",
",",
"res",
".",
... | https://github.com/akfamily/akshare/blob/590e50eece9ec067da3538c7059fd660b71f1339/akshare/stock/stock_zh_a_sina.py#L29-L41 | ||
dengdan/seglink | cc36732d78a637ac10587c11befe19944ec1c1ea | preprocessing/ssd_vgg_preprocessing.py | python | preprocess_for_eval | (image, labels, bboxes, xs, ys,
out_shape=EVAL_SIZE, data_format='NHWC',
difficults=None, resize=Resize.WARP_RESIZE,
scope='ssd_preprocessing_train') | Preprocess an image for evaluation.
Args:
image: A `Tensor` representing an image of arbitrary size.
out_shape: Output shape after pre-processing (if resize != None)
resize: Resize strategy.
Returns:
A preprocessed image. | Preprocess an image for evaluation. | [
"Preprocess",
"an",
"image",
"for",
"evaluation",
"."
] | def preprocess_for_eval(image, labels, bboxes, xs, ys,
out_shape=EVAL_SIZE, data_format='NHWC',
difficults=None, resize=Resize.WARP_RESIZE,
scope='ssd_preprocessing_train'):
"""Preprocess an image for evaluation.
Args:
image: A `Te... | [
"def",
"preprocess_for_eval",
"(",
"image",
",",
"labels",
",",
"bboxes",
",",
"xs",
",",
"ys",
",",
"out_shape",
"=",
"EVAL_SIZE",
",",
"data_format",
"=",
"'NHWC'",
",",
"difficults",
"=",
"None",
",",
"resize",
"=",
"Resize",
".",
"WARP_RESIZE",
",",
... | https://github.com/dengdan/seglink/blob/cc36732d78a637ac10587c11befe19944ec1c1ea/preprocessing/ssd_vgg_preprocessing.py#L298-L329 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/gdata/src/atom/core.py | python | XmlElement.get_elements | (self, tag=None, namespace=None, version=1) | return matches | Find all sub elements which match the tag and namespace.
To find all elements in this object, call get_elements with the tag and
namespace both set to None (the default). This method searches through
the object's members and the elements stored in _other_elements which
did not match any of the XML pars... | Find all sub elements which match the tag and namespace. | [
"Find",
"all",
"sub",
"elements",
"which",
"match",
"the",
"tag",
"and",
"namespace",
"."
] | def get_elements(self, tag=None, namespace=None, version=1):
"""Find all sub elements which match the tag and namespace.
To find all elements in this object, call get_elements with the tag and
namespace both set to None (the default). This method searches through
the object's members and the elements s... | [
"def",
"get_elements",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"namespace",
"=",
"None",
",",
"version",
"=",
"1",
")",
":",
"matches",
"=",
"[",
"]",
"ignored1",
",",
"elements",
",",
"ignored2",
"=",
"self",
".",
"__class__",
".",
"_get_rules",
... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/atom/core.py#L190-L223 | |
vivisect/vivisect | 37b0b655d8dedfcf322e86b0f144b096e48d547e | cobra/__init__.py | python | SocketBuilder.setSslClientCert | (self, crtfile, keyfile) | Set the cert/key used by this client to negotiate SSL. | Set the cert/key used by this client to negotiate SSL. | [
"Set",
"the",
"cert",
"/",
"key",
"used",
"by",
"this",
"client",
"to",
"negotiate",
"SSL",
"."
] | def setSslClientCert(self, crtfile, keyfile):
'''
Set the cert/key used by this client to negotiate SSL.
'''
self.ssl = True
self.sslcrt = crtfile
self.sslkey = keyfile | [
"def",
"setSslClientCert",
"(",
"self",
",",
"crtfile",
",",
"keyfile",
")",
":",
"self",
".",
"ssl",
"=",
"True",
"self",
".",
"sslcrt",
"=",
"crtfile",
"self",
".",
"sslkey",
"=",
"keyfile"
] | https://github.com/vivisect/vivisect/blob/37b0b655d8dedfcf322e86b0f144b096e48d547e/cobra/__init__.py#L299-L305 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/userreports/models.py | python | ReportConfiguration.save | (self, *args, **kwargs) | [] | def save(self, *args, **kwargs):
self.report_meta.last_modified = datetime.utcnow()
super(ReportConfiguration, self).save(*args, **kwargs) | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"report_meta",
".",
"last_modified",
"=",
"datetime",
".",
"utcnow",
"(",
")",
"super",
"(",
"ReportConfiguration",
",",
"self",
")",
".",
"save",
"(",
"*",... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/userreports/models.py#L744-L746 | ||||
frictionlessdata/datapackage-py | 52416bd5be2e146490ee91f51b80d9b2178e0070 | datapackage/resource.py | python | Resource.schema | (self) | return self.__get_table().schema | Resource's schema
> Only for tabular resources
For tabular resources it returns `Schema` instance to interact with data schema.
Read API documentation - [tableschema.Schema](https://github.com/frictionlessdata/tableschema-py#schema).
# Returns
tableschema.Schema: schema | Resource's schema | [
"Resource",
"s",
"schema"
] | def schema(self):
"""Resource's schema
> Only for tabular resources
For tabular resources it returns `Schema` instance to interact with data schema.
Read API documentation - [tableschema.Schema](https://github.com/frictionlessdata/tableschema-py#schema).
# Returns
... | [
"def",
"schema",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"tabular",
":",
"return",
"None",
"return",
"self",
".",
"__get_table",
"(",
")",
".",
"schema"
] | https://github.com/frictionlessdata/datapackage-py/blob/52416bd5be2e146490ee91f51b80d9b2178e0070/datapackage/resource.py#L252-L266 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/polys/factortools.py | python | dup_zz_irreducible_p | (f, K) | Test irreducibility using Eisenstein's criterion. | Test irreducibility using Eisenstein's criterion. | [
"Test",
"irreducibility",
"using",
"Eisenstein",
"s",
"criterion",
"."
] | def dup_zz_irreducible_p(f, K):
"""Test irreducibility using Eisenstein's criterion. """
lc = dup_LC(f, K)
tc = dup_TC(f, K)
e_fc = dup_content(f[1:], K)
if e_fc:
e_ff = factorint(int(e_fc))
for p in e_ff.keys():
if (lc % p) and (tc % p**2):
return True | [
"def",
"dup_zz_irreducible_p",
"(",
"f",
",",
"K",
")",
":",
"lc",
"=",
"dup_LC",
"(",
"f",
",",
"K",
")",
"tc",
"=",
"dup_TC",
"(",
"f",
",",
"K",
")",
"e_fc",
"=",
"dup_content",
"(",
"f",
"[",
"1",
":",
"]",
",",
"K",
")",
"if",
"e_fc",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/factortools.py#L364-L376 | ||
HCIILAB/DeRPN | 21e6738ee1f7d3f159ee48d435c543e773f8ce99 | caffe/tools/extra/extract_seconds.py | python | extract_seconds | (input_file, output_file) | [] | def extract_seconds(input_file, output_file):
with open(input_file, 'r') as f:
lines = f.readlines()
log_created_year = get_log_created_year(input_file)
start_datetime = get_start_time(lines, log_created_year)
assert start_datetime, 'Start time not found'
out = open(output_file, 'w')
fo... | [
"def",
"extract_seconds",
"(",
"input_file",
",",
"output_file",
")",
":",
"with",
"open",
"(",
"input_file",
",",
"'r'",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"log_created_year",
"=",
"get_log_created_year",
"(",
"input_file",
... | https://github.com/HCIILAB/DeRPN/blob/21e6738ee1f7d3f159ee48d435c543e773f8ce99/caffe/tools/extra/extract_seconds.py#L44-L58 | ||||
hubblestack/hubble | 763142474edcecdec5fd25591dc29c3536e8f969 | hubblestack/modules/file.py | python | user_to_uid | (user) | Convert user name to a uid
user
user name to convert to its uid
CLI Example:
.. code-block:: bash
salt '*' file.user_to_uid root | Convert user name to a uid | [
"Convert",
"user",
"name",
"to",
"a",
"uid"
] | def user_to_uid(user):
"""
Convert user name to a uid
user
user name to convert to its uid
CLI Example:
.. code-block:: bash
salt '*' file.user_to_uid root
"""
if user is None:
user = hubblestack.utils.user.get_user()
try:
if isinstance(user, int):
... | [
"def",
"user_to_uid",
"(",
"user",
")",
":",
"if",
"user",
"is",
"None",
":",
"user",
"=",
"hubblestack",
".",
"utils",
".",
"user",
".",
"get_user",
"(",
")",
"try",
":",
"if",
"isinstance",
"(",
"user",
",",
"int",
")",
":",
"return",
"user",
"re... | https://github.com/hubblestack/hubble/blob/763142474edcecdec5fd25591dc29c3536e8f969/hubblestack/modules/file.py#L60-L80 | ||
DataBiosphere/toil | 2e148eee2114ece8dcc3ec8a83f36333266ece0d | src/toil/fileStores/abstractFileStore.py | python | AbstractFileStore.getLocalTempFile | (self) | return os.path.abspath(tmpFile) | Get a new local temporary file that will persist for the duration of the job.
:return: The absolute path to a local temporary file. This file will exist
for the duration of the job only, and is guaranteed to be deleted
once the job terminates. | Get a new local temporary file that will persist for the duration of the job. | [
"Get",
"a",
"new",
"local",
"temporary",
"file",
"that",
"will",
"persist",
"for",
"the",
"duration",
"of",
"the",
"job",
"."
] | def getLocalTempFile(self) -> str:
"""
Get a new local temporary file that will persist for the duration of the job.
:return: The absolute path to a local temporary file. This file will exist
for the duration of the job only, and is guaranteed to be deleted
onc... | [
"def",
"getLocalTempFile",
"(",
"self",
")",
"->",
"str",
":",
"handle",
",",
"tmpFile",
"=",
"tempfile",
".",
"mkstemp",
"(",
"prefix",
"=",
"\"tmp\"",
",",
"suffix",
"=",
"\".tmp\"",
",",
"dir",
"=",
"self",
".",
"localTempDir",
")",
"os",
".",
"clos... | https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/src/toil/fileStores/abstractFileStore.py#L213-L225 | |
facebookresearch/detectron2 | cb92ae1763cd7d3777c243f07749574cdaec6cb8 | detectron2/export/shared.py | python | _generic_status_identifier | (
predict_net: caffe2_pb2.NetDef,
status_updater: Callable,
known_status: Dict[Tuple[str, int], Any],
) | return _known_status | Statically infer the status of each blob, the status can be such as device type
(CPU/GPU), layout (NCHW/NHWC), data type (float32/int8), etc. "Blob" here
is versioned blob (Tuple[str, int]) in the format compatible with ssa.
Inputs:
predict_net: the caffe2 network
status_updater: a c... | Statically infer the status of each blob, the status can be such as device type
(CPU/GPU), layout (NCHW/NHWC), data type (float32/int8), etc. "Blob" here
is versioned blob (Tuple[str, int]) in the format compatible with ssa.
Inputs:
predict_net: the caffe2 network
status_updater: a c... | [
"Statically",
"infer",
"the",
"status",
"of",
"each",
"blob",
"the",
"status",
"can",
"be",
"such",
"as",
"device",
"type",
"(",
"CPU",
"/",
"GPU",
")",
"layout",
"(",
"NCHW",
"/",
"NHWC",
")",
"data",
"type",
"(",
"float32",
"/",
"int8",
")",
"etc",... | def _generic_status_identifier(
predict_net: caffe2_pb2.NetDef,
status_updater: Callable,
known_status: Dict[Tuple[str, int], Any],
) -> Dict[Tuple[str, int], Any]:
"""
Statically infer the status of each blob, the status can be such as device type
(CPU/GPU), layout (NCHW/NHWC), data type (f... | [
"def",
"_generic_status_identifier",
"(",
"predict_net",
":",
"caffe2_pb2",
".",
"NetDef",
",",
"status_updater",
":",
"Callable",
",",
"known_status",
":",
"Dict",
"[",
"Tuple",
"[",
"str",
",",
"int",
"]",
",",
"Any",
"]",
",",
")",
"->",
"Dict",
"[",
... | https://github.com/facebookresearch/detectron2/blob/cb92ae1763cd7d3777c243f07749574cdaec6cb8/detectron2/export/shared.py#L376-L445 | |
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/cloud_guard/cloud_guard_client_composite_operations.py | python | CloudGuardClientCompositeOperations.update_target_and_wait_for_state | (self, target_id, update_target_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}) | Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_target` and waits for the :py:class:`~oci.cloud_guard.models.Target` acted upon
to enter the given state(s).
:param str target_id: (required)
OCID of target
:param oci.cloud_guard.models.UpdateTargetDetails update_target_deta... | Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_target` and waits for the :py:class:`~oci.cloud_guard.models.Target` acted upon
to enter the given state(s). | [
"Calls",
":",
"py",
":",
"func",
":",
"~oci",
".",
"cloud_guard",
".",
"CloudGuardClient",
".",
"update_target",
"and",
"waits",
"for",
"the",
":",
"py",
":",
"class",
":",
"~oci",
".",
"cloud_guard",
".",
"models",
".",
"Target",
"acted",
"upon",
"to",
... | def update_target_and_wait_for_state(self, target_id, update_target_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_target` and waits for the :py:class:`~oci.cloud_guard.models.Target` acted upon
to enter the given... | [
"def",
"update_target_and_wait_for_state",
"(",
"self",
",",
"target_id",
",",
"update_target_details",
",",
"wait_for_states",
"=",
"[",
"]",
",",
"operation_kwargs",
"=",
"{",
"}",
",",
"waiter_kwargs",
"=",
"{",
"}",
")",
":",
"operation_result",
"=",
"self",... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/cloud_guard/cloud_guard_client_composite_operations.py#L785-L824 | ||
Alexey-T/CudaText | 6a8b9a974c5d5029c6c273bde83198c83b3a5fb9 | app/py/sys/chardet/cli/chardetect.py | python | description_of | (lines, name='stdin') | Return a string describing the probable encoding of a file or
list of strings.
:param lines: The lines to get the encoding of.
:type lines: Iterable of bytes
:param name: Name of file or collection of lines
:type name: str | Return a string describing the probable encoding of a file or
list of strings. | [
"Return",
"a",
"string",
"describing",
"the",
"probable",
"encoding",
"of",
"a",
"file",
"or",
"list",
"of",
"strings",
"."
] | def description_of(lines, name='stdin'):
"""
Return a string describing the probable encoding of a file or
list of strings.
:param lines: The lines to get the encoding of.
:type lines: Iterable of bytes
:param name: Name of file or collection of lines
:type name: str
"""
u = Univers... | [
"def",
"description_of",
"(",
"lines",
",",
"name",
"=",
"'stdin'",
")",
":",
"u",
"=",
"UniversalDetector",
"(",
")",
"for",
"line",
"in",
"lines",
":",
"line",
"=",
"bytearray",
"(",
"line",
")",
"u",
".",
"feed",
"(",
"line",
")",
"# shortcut out of... | https://github.com/Alexey-T/CudaText/blob/6a8b9a974c5d5029c6c273bde83198c83b3a5fb9/app/py/sys/chardet/cli/chardetect.py#L25-L50 | ||
Cue/scales | 0aced26eb050ceb98ee9d5d6cdca8db448666986 | src/greplin/scales/aggregation.py | python | MeterFormat.getCount | (self, data) | return data['count'] | Get the count | Get the count | [
"Get",
"the",
"count"
] | def getCount(self, data):
"""Get the count"""
assert data['type'] == "meter"
return data['count'] | [
"def",
"getCount",
"(",
"self",
",",
"data",
")",
":",
"assert",
"data",
"[",
"'type'",
"]",
"==",
"\"meter\"",
"return",
"data",
"[",
"'count'",
"]"
] | https://github.com/Cue/scales/blob/0aced26eb050ceb98ee9d5d6cdca8db448666986/src/greplin/scales/aggregation.py#L104-L107 | |
ym2011/POC-EXP | 206b22d3a6b2a172359678df33bbc5b2ad04b6c3 | K8/Web-Exp/sqlmap/thirdparty/socks/socks.py | python | wrapmodule | (module) | wrapmodule(module)
Attempts to replace a module's socket library with a SOCKS socket. Must set
a default proxy using setdefaultproxy(...) first.
This will only work on modules that import socket directly into the namespace;
most of the Python Standard Library falls into this category. | wrapmodule(module)
Attempts to replace a module's socket library with a SOCKS socket. Must set
a default proxy using setdefaultproxy(...) first.
This will only work on modules that import socket directly into the namespace;
most of the Python Standard Library falls into this category. | [
"wrapmodule",
"(",
"module",
")",
"Attempts",
"to",
"replace",
"a",
"module",
"s",
"socket",
"library",
"with",
"a",
"SOCKS",
"socket",
".",
"Must",
"set",
"a",
"default",
"proxy",
"using",
"setdefaultproxy",
"(",
"...",
")",
"first",
".",
"This",
"will",
... | def wrapmodule(module):
"""wrapmodule(module)
Attempts to replace a module's socket library with a SOCKS socket. Must set
a default proxy using setdefaultproxy(...) first.
This will only work on modules that import socket directly into the namespace;
most of the Python Standard Library falls into th... | [
"def",
"wrapmodule",
"(",
"module",
")",
":",
"if",
"_defaultproxy",
"!=",
"None",
":",
"module",
".",
"socket",
".",
"socket",
"=",
"socksocket",
"module",
".",
"socket",
".",
"create_connection",
"=",
"create_connection",
"else",
":",
"raise",
"GeneralProxyE... | https://github.com/ym2011/POC-EXP/blob/206b22d3a6b2a172359678df33bbc5b2ad04b6c3/K8/Web-Exp/sqlmap/thirdparty/socks/socks.py#L103-L114 | ||
Azure/azure-cli | 6c1b085a0910c6c2139006fcbd8ade44006eb6dd | src/azure-cli/azure/cli/command_modules/acs/_validators.py | python | validate_linux_host_name | (namespace) | Validates a string as a legal host name component.
This validation will also occur server-side in the ARM API, but that may take
a minute or two before the user sees it. So it's more user-friendly to validate
in the CLI pre-flight. | Validates a string as a legal host name component. | [
"Validates",
"a",
"string",
"as",
"a",
"legal",
"host",
"name",
"component",
"."
] | def validate_linux_host_name(namespace):
"""Validates a string as a legal host name component.
This validation will also occur server-side in the ARM API, but that may take
a minute or two before the user sees it. So it's more user-friendly to validate
in the CLI pre-flight.
"""
# https://stack... | [
"def",
"validate_linux_host_name",
"(",
"namespace",
")",
":",
"# https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address",
"rfc1123_regex",
"=",
"re",
".",
"compile",
"(",
"r'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])(\\.([a-zA-Z0-9... | https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/src/azure-cli/azure/cli/command_modules/acs/_validators.py#L139-L151 | ||
biolab/orange2 | db40a9449cb45b507d63dcd5739b223f9cffb8e6 | distribute_setup.py | python | _patch_file | (path, content) | return True | Will backup the file then patch it | Will backup the file then patch it | [
"Will",
"backup",
"the",
"file",
"then",
"patch",
"it"
] | def _patch_file(path, content):
"""Will backup the file then patch it"""
f = open(path)
existing_content = f.read()
f.close()
if existing_content == content:
# already patched
log.warn('Already patched.')
return False
log.warn('Patching...')
_rename_path(path)
f =... | [
"def",
"_patch_file",
"(",
"path",
",",
"content",
")",
":",
"f",
"=",
"open",
"(",
"path",
")",
"existing_content",
"=",
"f",
".",
"read",
"(",
")",
"f",
".",
"close",
"(",
")",
"if",
"existing_content",
"==",
"content",
":",
"# already patched",
"log... | https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/distribute_setup.py#L250-L266 | |
amymcgovern/pyparrot | bf4775ec1199b282e4edde1e4a8e018dcc8725e0 | pyparrot/utils/vlc.py | python | MediaList.unlock | (self) | return libvlc_media_list_unlock(self) | Release lock on media list items
The L{lock} should be held upon entering this function. | Release lock on media list items
The L{lock} should be held upon entering this function. | [
"Release",
"lock",
"on",
"media",
"list",
"items",
"The",
"L",
"{",
"lock",
"}",
"should",
"be",
"held",
"upon",
"entering",
"this",
"function",
"."
] | def unlock(self):
'''Release lock on media list items
The L{lock} should be held upon entering this function.
'''
return libvlc_media_list_unlock(self) | [
"def",
"unlock",
"(",
"self",
")",
":",
"return",
"libvlc_media_list_unlock",
"(",
"self",
")"
] | https://github.com/amymcgovern/pyparrot/blob/bf4775ec1199b282e4edde1e4a8e018dcc8725e0/pyparrot/utils/vlc.py#L2986-L2990 | |
aliyun/aliyun-oss-python-sdk | 5f2afa0928a58c7c1cc6317ac147f3637481f6fd | oss2/models.py | python | BucketQosInfo.__init__ | (self,
total_upload_bw = None,
intranet_upload_bw = None,
extranet_upload_bw = None,
total_download_bw = None,
intranet_download_bw = None,
extranet_download_bw = None,
total_qps = None,
intranet_qps = None,
extr... | [] | def __init__(self,
total_upload_bw = None,
intranet_upload_bw = None,
extranet_upload_bw = None,
total_download_bw = None,
intranet_download_bw = None,
extranet_download_bw = None,
total_qps = None,
intranet_qps = None,
... | [
"def",
"__init__",
"(",
"self",
",",
"total_upload_bw",
"=",
"None",
",",
"intranet_upload_bw",
"=",
"None",
",",
"extranet_upload_bw",
"=",
"None",
",",
"total_download_bw",
"=",
"None",
",",
"intranet_download_bw",
"=",
"None",
",",
"extranet_download_bw",
"=",
... | https://github.com/aliyun/aliyun-oss-python-sdk/blob/5f2afa0928a58c7c1cc6317ac147f3637481f6fd/oss2/models.py#L1616-L1635 | ||||
nucleic/enaml | 65c2a2a2d765e88f2e1103046680571894bb41ed | enaml/core/code_generator.py | python | CodeGenerator.add_map | (self) | Store the key/value pair on the TOS into the map at 3rd pos. | Store the key/value pair on the TOS into the map at 3rd pos. | [
"Store",
"the",
"key",
"/",
"value",
"pair",
"on",
"the",
"TOS",
"into",
"the",
"map",
"at",
"3rd",
"pos",
"."
] | def add_map(self):
""" Store the key/value pair on the TOS into the map at 3rd pos.
"""
# WARNING in Python 3.8 the order is # TOS -> map -> key -> value
self.code_ops.append( # TOS -> map -> value -> key
bc.Instr("MAP_ADD", 1),
) | [
"def",
"add_map",
"(",
"self",
")",
":",
"# WARNING in Python 3.8 the order is # TOS -> map -> key -> value",
"self",
".",
"code_ops",
".",
"append",
"(",
"# TOS -> map -> value -> key",
"bc",
".",
"Instr",
"(",
"\"MAP_ADD\"",
",",
"1",
")",
",",
")"
] | https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/core/code_generator.py#L286-L293 | ||
openrazer/openrazer | 1615f8516e8014bad7f78c781c91e6529679718f | pylib/openrazer/client/devices/mousemat.py | python | RazerMousemat.trigger_reactive | (self) | return self._dbus_interfaces['device'].triggerReactive() | Trigger a reactive flash | Trigger a reactive flash | [
"Trigger",
"a",
"reactive",
"flash"
] | def trigger_reactive(self) -> bool:
"""
Trigger a reactive flash
"""
return self._dbus_interfaces['device'].triggerReactive() | [
"def",
"trigger_reactive",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_dbus_interfaces",
"[",
"'device'",
"]",
".",
"triggerReactive",
"(",
")"
] | https://github.com/openrazer/openrazer/blob/1615f8516e8014bad7f78c781c91e6529679718f/pylib/openrazer/client/devices/mousemat.py#L5-L9 | |
joshfriend/flask-restful-demo | 4571c5dd3c38c1563894eb9558f44f8c4ddd8c7d | migrations/env.py | python | run_migrations_offline | () | Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output. | Run migrations in 'offline' mode. | [
"Run",
"migrations",
"in",
"offline",
"mode",
"."
] | def run_migrations_offline():
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the g... | [
"def",
"run_migrations_offline",
"(",
")",
":",
"url",
"=",
"config",
".",
"get_main_option",
"(",
"\"sqlalchemy.url\"",
")",
"context",
".",
"configure",
"(",
"url",
"=",
"url",
")",
"with",
"context",
".",
"begin_transaction",
"(",
")",
":",
"context",
"."... | https://github.com/joshfriend/flask-restful-demo/blob/4571c5dd3c38c1563894eb9558f44f8c4ddd8c7d/migrations/env.py#L27-L43 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/sqli/thirdparty/xdot/xdot.py | python | ZoomAction.drag | (self, deltax, deltay) | [] | def drag(self, deltax, deltay):
self.dot_widget.zoom_ratio *= 1.005 ** (deltax + deltay)
self.dot_widget.zoom_to_fit_on_resize = False
self.dot_widget.queue_draw() | [
"def",
"drag",
"(",
"self",
",",
"deltax",
",",
"deltay",
")",
":",
"self",
".",
"dot_widget",
".",
"zoom_ratio",
"*=",
"1.005",
"**",
"(",
"deltax",
"+",
"deltay",
")",
"self",
".",
"dot_widget",
".",
"zoom_to_fit_on_resize",
"=",
"False",
"self",
".",
... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/thirdparty/xdot/xdot.py#L1335-L1338 | ||||
heynemann/motorengine | 5e1fea7cc15060f768a697fe4c3593d20f23c4ed | motorengine/query_builder/field_list.py | python | QueryFieldList.__add__ | (self, f) | return self | [] | def __add__(self, f):
if isinstance(f.value, dict):
for field in f.fields:
self.slice[field] = f.value
if not self.fields:
self.fields = f.fields
elif not self.fields:
self.fields = f.fields
self.value = f.value
... | [
"def",
"__add__",
"(",
"self",
",",
"f",
")",
":",
"if",
"isinstance",
"(",
"f",
".",
"value",
",",
"dict",
")",
":",
"for",
"field",
"in",
"f",
".",
"fields",
":",
"self",
".",
"slice",
"[",
"field",
"]",
"=",
"f",
".",
"value",
"if",
"not",
... | https://github.com/heynemann/motorengine/blob/5e1fea7cc15060f768a697fe4c3593d20f23c4ed/motorengine/query_builder/field_list.py#L30-L75 | |||
danmacnish/cartoonify | 39ea84d96b3e93f0480e6d6158bea506d01278ca | cartoonify/app/object_detection/meta_architectures/faster_rcnn_meta_arch.py | python | FasterRCNNMetaArch._unpad_proposals_and_sample_box_classifier_batch | (
self,
proposal_boxes,
proposal_scores,
num_proposals,
groundtruth_boxlists,
groundtruth_classes_with_background_list) | return (tf.stack(single_image_proposal_box_sample),
tf.stack(single_image_proposal_score_sample),
tf.stack(single_image_num_proposals_sample)) | Unpads proposals and samples a minibatch for second stage.
Args:
proposal_boxes: A float tensor with shape
[batch_size, num_proposals, 4] representing the (potentially zero
padded) proposal boxes for all images in the batch. These boxes are
represented as normalized coordinates.
... | Unpads proposals and samples a minibatch for second stage. | [
"Unpads",
"proposals",
"and",
"samples",
"a",
"minibatch",
"for",
"second",
"stage",
"."
] | def _unpad_proposals_and_sample_box_classifier_batch(
self,
proposal_boxes,
proposal_scores,
num_proposals,
groundtruth_boxlists,
groundtruth_classes_with_background_list):
"""Unpads proposals and samples a minibatch for second stage.
Args:
proposal_boxes: A float tens... | [
"def",
"_unpad_proposals_and_sample_box_classifier_batch",
"(",
"self",
",",
"proposal_boxes",
",",
"proposal_scores",
",",
"num_proposals",
",",
"groundtruth_boxlists",
",",
"groundtruth_classes_with_background_list",
")",
":",
"single_image_proposal_box_sample",
"=",
"[",
"]"... | https://github.com/danmacnish/cartoonify/blob/39ea84d96b3e93f0480e6d6158bea506d01278ca/cartoonify/app/object_detection/meta_architectures/faster_rcnn_meta_arch.py#L941-L1023 | |
ipython/ipython | c0abea7a6dfe52c1f74c9d0387d4accadba7cc14 | IPython/core/interactiveshell.py | python | InteractiveShell.init_history | (self) | Sets up the command history, and starts regular autosaves. | Sets up the command history, and starts regular autosaves. | [
"Sets",
"up",
"the",
"command",
"history",
"and",
"starts",
"regular",
"autosaves",
"."
] | def init_history(self):
"""Sets up the command history, and starts regular autosaves."""
self.history_manager = HistoryManager(shell=self, parent=self)
self.configurables.append(self.history_manager) | [
"def",
"init_history",
"(",
"self",
")",
":",
"self",
".",
"history_manager",
"=",
"HistoryManager",
"(",
"shell",
"=",
"self",
",",
"parent",
"=",
"self",
")",
"self",
".",
"configurables",
".",
"append",
"(",
"self",
".",
"history_manager",
")"
] | https://github.com/ipython/ipython/blob/c0abea7a6dfe52c1f74c9d0387d4accadba7cc14/IPython/core/interactiveshell.py#L1687-L1690 | ||
marionmari/pyGPs | 792f3c6cb91126ade9f23a8e39d9cbcd30cfbc7b | pyGPs/GraphExtensions/nodeKernels.py | python | psInvLapKernel | (A) | return K | Pseudo inverse of the normalized Laplacian.
:param A: adjacency matrix
:return: kernel matrix | Pseudo inverse of the normalized Laplacian. | [
"Pseudo",
"inverse",
"of",
"the",
"normalized",
"Laplacian",
"."
] | def psInvLapKernel(A):
'''
Pseudo inverse of the normalized Laplacian.
:param A: adjacency matrix
:return: kernel matrix
'''
L = normLap(A)
K = np.linalg.pinv(L)
return K | [
"def",
"psInvLapKernel",
"(",
"A",
")",
":",
"L",
"=",
"normLap",
"(",
"A",
")",
"K",
"=",
"np",
".",
"linalg",
".",
"pinv",
"(",
"L",
")",
"return",
"K"
] | https://github.com/marionmari/pyGPs/blob/792f3c6cb91126ade9f23a8e39d9cbcd30cfbc7b/pyGPs/GraphExtensions/nodeKernels.py#L51-L60 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/flaskbb/forum/views.py | python | NewPost.get | (self, topic_id, slug=None, post_id=None) | return render_template(
'forum/new_post.html', topic=topic, form=form
) | [] | def get(self, topic_id, slug=None, post_id=None):
topic = Topic.query.filter_by(id=topic_id).first_or_404()
form = self.form()
if post_id is not None:
post = Post.query.filter_by(id=post_id).first_or_404()
form.content.data = format_quote(post.username, post.content)
... | [
"def",
"get",
"(",
"self",
",",
"topic_id",
",",
"slug",
"=",
"None",
",",
"post_id",
"=",
"None",
")",
":",
"topic",
"=",
"Topic",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"topic_id",
")",
".",
"first_or_404",
"(",
")",
"form",
"=",
"self",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/flaskbb/forum/views.py#L431-L441 | |||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ttypes.py | python | GetPrincipalsInRoleRequest.__repr__ | (self) | return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | [] | def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"L",
"=",
"[",
"'%s=%r'",
"%",
"(",
"key",
",",
"value",
")",
"for",
"key",
",",
"value",
"in",
"self",
".",
"__dict__",
".",
"items",
"(",
")",
"]",
"return",
"'%s(%s)'",
"%",
"(",
"self",
".",
"__class_... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ttypes.py#L1876-L1879 | |||
microsoft/NimbusML | f6be39ce9359786976429bab0ccd837e849b4ba5 | src/python/nimbusml/preprocessing/normalization/lpscaler.py | python | LpScaler._nodes_with_presteps | (self) | return [
TypeConverter(
result_type='R4')._steal_io(self),
self] | Inserts preprocessing before this one. | Inserts preprocessing before this one. | [
"Inserts",
"preprocessing",
"before",
"this",
"one",
"."
] | def _nodes_with_presteps(self):
"""
Inserts preprocessing before this one.
"""
from ..schema import TypeConverter
return [
TypeConverter(
result_type='R4')._steal_io(self),
self] | [
"def",
"_nodes_with_presteps",
"(",
"self",
")",
":",
"from",
".",
".",
"schema",
"import",
"TypeConverter",
"return",
"[",
"TypeConverter",
"(",
"result_type",
"=",
"'R4'",
")",
".",
"_steal_io",
"(",
"self",
")",
",",
"self",
"]"
] | https://github.com/microsoft/NimbusML/blob/f6be39ce9359786976429bab0ccd837e849b4ba5/src/python/nimbusml/preprocessing/normalization/lpscaler.py#L60-L68 | |
timkpaine/tdameritrade | f877088d0c3aca9fef03e92b62074153c66194c1 | tdameritrade/client.py | python | TDClient.instrument | (self, cusip) | return self._request(GET_INSTRUMENT.format(cusip=cusip)).json() | get instrument info from cusip
Args:
cusip (str): the cusip to use, can find it by looking up in search | get instrument info from cusip | [
"get",
"instrument",
"info",
"from",
"cusip"
] | def instrument(self, cusip):
"""get instrument info from cusip
Args:
cusip (str): the cusip to use, can find it by looking up in search
"""
return self._request(GET_INSTRUMENT.format(cusip=cusip)).json() | [
"def",
"instrument",
"(",
"self",
",",
"cusip",
")",
":",
"return",
"self",
".",
"_request",
"(",
"GET_INSTRUMENT",
".",
"format",
"(",
"cusip",
"=",
"cusip",
")",
")",
".",
"json",
"(",
")"
] | https://github.com/timkpaine/tdameritrade/blob/f877088d0c3aca9fef03e92b62074153c66194c1/tdameritrade/client.py#L216-L222 | |
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | set_compiler_id | (*args) | return _idaapi.set_compiler_id(*args) | set_compiler_id(id) -> bool | set_compiler_id(id) -> bool | [
"set_compiler_id",
"(",
"id",
")",
"-",
">",
"bool"
] | def set_compiler_id(*args):
"""
set_compiler_id(id) -> bool
"""
return _idaapi.set_compiler_id(*args) | [
"def",
"set_compiler_id",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"set_compiler_id",
"(",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L29472-L29476 | |
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | archive/fabfile.py | python | celery_reload | () | [] | def celery_reload():
with virtualenv():
run('sudo supervisorctl reload celery')
run('tail logs/newsblur.log') | [
"def",
"celery_reload",
"(",
")",
":",
"with",
"virtualenv",
"(",
")",
":",
"run",
"(",
"'sudo supervisorctl reload celery'",
")",
"run",
"(",
"'tail logs/newsblur.log'",
")"
] | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/archive/fabfile.py#L1880-L1883 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.