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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
linuxerwang/rkflashkit | c6b422afa372bf1d498fcddb6a6b95360021d2a6 | src/rkflashkit/usb1.py | python | USBDevice.iterConfigurations | (self) | [] | def iterConfigurations(self):
for config in self.__configuration_descriptor_list:
yield USBConfiguration(config) | [
"def",
"iterConfigurations",
"(",
"self",
")",
":",
"for",
"config",
"in",
"self",
".",
"__configuration_descriptor_list",
":",
"yield",
"USBConfiguration",
"(",
"config",
")"
] | https://github.com/linuxerwang/rkflashkit/blob/c6b422afa372bf1d498fcddb6a6b95360021d2a6/src/rkflashkit/usb1.py#L1455-L1457 | ||||
Unidata/MetPy | 1153590f397ae23adfea66c4adb0a206872fa0ad | src/metpy/interpolate/tools.py | python | remove_repeat_coordinates | (x, y, z) | return x_, y_, z_ | r"""Remove all x, y, and z where (x,y) is repeated and keep the first occurrence only.
Will not destroy original values.
Parameters
----------
x: array_like
x coordinate
y: array_like
y coordinate
z: array_like
observation value
Returns
-------
x, y, z
... | r"""Remove all x, y, and z where (x,y) is repeated and keep the first occurrence only. | [
"r",
"Remove",
"all",
"x",
"y",
"and",
"z",
"where",
"(",
"x",
"y",
")",
"is",
"repeated",
"and",
"keep",
"the",
"first",
"occurrence",
"only",
"."
] | def remove_repeat_coordinates(x, y, z):
r"""Remove all x, y, and z where (x,y) is repeated and keep the first occurrence only.
Will not destroy original values.
Parameters
----------
x: array_like
x coordinate
y: array_like
y coordinate
z: array_like
observation val... | [
"def",
"remove_repeat_coordinates",
"(",
"x",
",",
"y",
",",
"z",
")",
":",
"coords",
"=",
"[",
"]",
"variable",
"=",
"[",
"]",
"for",
"(",
"x_",
",",
"y_",
",",
"t_",
")",
"in",
"zip",
"(",
"x",
",",
"y",
",",
"z",
")",
":",
"if",
"(",
"x_... | https://github.com/Unidata/MetPy/blob/1153590f397ae23adfea66c4adb0a206872fa0ad/src/metpy/interpolate/tools.py#L112-L148 | |
dragondjf/QMarkdowner | fc79c85ca2949fa9ce3b317606ad7bbcd1299960 | Cheetah/Compiler.py | python | GenUtils.genCacheInfo | (self, cacheTokenParts) | return cacheInfo | Decipher a placeholder cachetoken | Decipher a placeholder cachetoken | [
"Decipher",
"a",
"placeholder",
"cachetoken"
] | def genCacheInfo(self, cacheTokenParts):
"""Decipher a placeholder cachetoken
"""
cacheInfo = {}
if cacheTokenParts['REFRESH_CACHE']:
cacheInfo['type'] = REFRESH_CACHE
cacheInfo['interval'] = self.genTimeInterval(cacheTokenParts['interval'])
elif cacheToke... | [
"def",
"genCacheInfo",
"(",
"self",
",",
"cacheTokenParts",
")",
":",
"cacheInfo",
"=",
"{",
"}",
"if",
"cacheTokenParts",
"[",
"'REFRESH_CACHE'",
"]",
":",
"cacheInfo",
"[",
"'type'",
"]",
"=",
"REFRESH_CACHE",
"cacheInfo",
"[",
"'interval'",
"]",
"=",
"sel... | https://github.com/dragondjf/QMarkdowner/blob/fc79c85ca2949fa9ce3b317606ad7bbcd1299960/Cheetah/Compiler.py#L131-L140 | |
AndreasMadsen/stable-nalu | b3296ace137ffa4854edeef3759f1578b7650210 | stable_nalu/reader/tensorboard_metric_reader.py | python | TensorboardMetricReader.__init__ | (self, dirname,
metric_matcher=_everything_default_matcher,
step_start=0,
recursive_weight=False,
processes=None,
progress_bar=True) | [] | def __init__(self, dirname,
metric_matcher=_everything_default_matcher,
step_start=0,
recursive_weight=False,
processes=None,
progress_bar=True):
self.dirname = dirname
self.metric_matcher = metric_matcher
self.... | [
"def",
"__init__",
"(",
"self",
",",
"dirname",
",",
"metric_matcher",
"=",
"_everything_default_matcher",
",",
"step_start",
"=",
"0",
",",
"recursive_weight",
"=",
"False",
",",
"processes",
"=",
"None",
",",
"progress_bar",
"=",
"True",
")",
":",
"self",
... | https://github.com/AndreasMadsen/stable-nalu/blob/b3296ace137ffa4854edeef3759f1578b7650210/stable_nalu/reader/tensorboard_metric_reader.py#L36-L48 | ||||
gleeda/memtriage | c24f4859995cccb9d88ccc0118d90693019cc1d5 | volatility/volatility/conf.py | python | ConfObject.update | (self, key, value) | This can be used by scripts to force a value of an option | This can be used by scripts to force a value of an option | [
"This",
"can",
"be",
"used",
"by",
"scripts",
"to",
"force",
"a",
"value",
"of",
"an",
"option"
] | def update(self, key, value):
""" This can be used by scripts to force a value of an option """
self.readonly[key.lower()] = value | [
"def",
"update",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"readonly",
"[",
"key",
".",
"lower",
"(",
")",
"]",
"=",
"value"
] | https://github.com/gleeda/memtriage/blob/c24f4859995cccb9d88ccc0118d90693019cc1d5/volatility/volatility/conf.py#L376-L378 | ||
nvaccess/nvda | 20d5a25dced4da34338197f0ef6546270ebca5d0 | source/appModuleHandler.py | python | AppModule.dumpOnCrash | (self) | Request that this process writes a minidump when it crashes for debugging.
This should only be called if instructed by a developer. | Request that this process writes a minidump when it crashes for debugging.
This should only be called if instructed by a developer. | [
"Request",
"that",
"this",
"process",
"writes",
"a",
"minidump",
"when",
"it",
"crashes",
"for",
"debugging",
".",
"This",
"should",
"only",
"be",
"called",
"if",
"instructed",
"by",
"a",
"developer",
"."
] | def dumpOnCrash(self):
"""Request that this process writes a minidump when it crashes for debugging.
This should only be called if instructed by a developer.
"""
path = os.path.join(tempfile.gettempdir(),
"nvda_crash_%s_%d.dmp" % (self.appName, self.processID))
NVDAHelper.localLib.nvdaInProcUtils_dumpOnCra... | [
"def",
"dumpOnCrash",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempfile",
".",
"gettempdir",
"(",
")",
",",
"\"nvda_crash_%s_%d.dmp\"",
"%",
"(",
"self",
".",
"appName",
",",
"self",
".",
"processID",
")",
")",
"NVDAHel... | https://github.com/nvaccess/nvda/blob/20d5a25dced4da34338197f0ef6546270ebca5d0/source/appModuleHandler.py#L589-L597 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/decimal.py | python | Decimal.shift | (self, other, context=None) | return _dec_from_triple(self._sign,
shifted.lstrip('0') or '0', self._exp) | Returns a shifted copy of self, value-of-other times. | Returns a shifted copy of self, value-of-other times. | [
"Returns",
"a",
"shifted",
"copy",
"of",
"self",
"value",
"-",
"of",
"-",
"other",
"times",
"."
] | def shift(self, other, context=None):
"""Returns a shifted copy of self, value-of-other times."""
if context is None:
context = getcontext()
other = _convert_other(other, raiseit=True)
ans = self._check_nans(other, context)
if ans:
return ans
if... | [
"def",
"shift",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"other",
"=",
"_convert_other",
"(",
"other",
",",
"raiseit",
"=",
"True",
")",
"ans",
"=",
... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/decimal.py#L3588-L3624 | |
hakril/PythonForWindows | 61e027a678d5b87aa64fcf8a37a6661a86236589 | windows/winproxy/apis/kernel32.py | python | EnumResourceTypesW | (hModule, lpEnumFunc, lParam) | return EnumResourceTypesW.ctypes_function(hModule, lpEnumFunc, lParam) | [] | def EnumResourceTypesW(hModule, lpEnumFunc, lParam):
return EnumResourceTypesW.ctypes_function(hModule, lpEnumFunc, lParam) | [
"def",
"EnumResourceTypesW",
"(",
"hModule",
",",
"lpEnumFunc",
",",
"lParam",
")",
":",
"return",
"EnumResourceTypesW",
".",
"ctypes_function",
"(",
"hModule",
",",
"lpEnumFunc",
",",
"lParam",
")"
] | https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winproxy/apis/kernel32.py#L904-L905 | |||
artefactual/archivematica | 4f4605453d5a8796f6a739fa9664921bdb3418f2 | src/dashboard/src/main/models.py | python | UnitVariableManager.update_active_agent | (self, unit_type, unit_id, user_id) | return self.update_variable(unit_type, unit_id, "activeAgent", agent_id) | Persist active agent given the user ID. | Persist active agent given the user ID. | [
"Persist",
"active",
"agent",
"given",
"the",
"user",
"ID",
"."
] | def update_active_agent(self, unit_type, unit_id, user_id):
"""Persist active agent given the user ID."""
agent_id = (
User.objects.select_related("userprofile")
.get(id=user_id)
.userprofile.agent_id
)
return self.update_variable(unit_type, unit_id, "... | [
"def",
"update_active_agent",
"(",
"self",
",",
"unit_type",
",",
"unit_id",
",",
"user_id",
")",
":",
"agent_id",
"=",
"(",
"User",
".",
"objects",
".",
"select_related",
"(",
"\"userprofile\"",
")",
".",
"get",
"(",
"id",
"=",
"user_id",
")",
".",
"use... | https://github.com/artefactual/archivematica/blob/4f4605453d5a8796f6a739fa9664921bdb3418f2/src/dashboard/src/main/models.py#L1591-L1598 | |
SUSE/DeepSea | 9c7fad93915ba1250c40d50c855011e9fe41ed21 | srv/salt/_modules/osd.py | python | rescinded | () | return _ids | Return the array of ids that are no longer mounted. | Return the array of ids that are no longer mounted. | [
"Return",
"the",
"array",
"of",
"ids",
"that",
"are",
"no",
"longer",
"mounted",
"."
] | def rescinded():
"""
Return the array of ids that are no longer mounted.
"""
mounted = [int(path.split('-')[1][:-5])
for path in glob.glob("/var/lib/ceph/osd/*/fsid") if '-' in path]
log.info("mounted osds {}".format(mounted))
# ids = __grains__['ceph'].keys() if 'ceph' in __grain... | [
"def",
"rescinded",
"(",
")",
":",
"mounted",
"=",
"[",
"int",
"(",
"path",
".",
"split",
"(",
"'-'",
")",
"[",
"1",
"]",
"[",
":",
"-",
"5",
"]",
")",
"for",
"path",
"in",
"glob",
".",
"glob",
"(",
"\"/var/lib/ceph/osd/*/fsid\"",
")",
"if",
"'-'... | https://github.com/SUSE/DeepSea/blob/9c7fad93915ba1250c40d50c855011e9fe41ed21/srv/salt/_modules/osd.py#L161-L175 | |
appu1232/Discord-Selfbot | 2305be70cdd8499c4ddb8b79101c70ac2f3fbb0d | cogs/mod.py | python | Mod.unmute | (self, ctx, *, user: str) | Unmutes a user (if you have the permission). | Unmutes a user (if you have the permission). | [
"Unmutes",
"a",
"user",
"(",
"if",
"you",
"have",
"the",
"permission",
")",
"."
] | async def unmute(self, ctx, *, user: str):
"""Unmutes a user (if you have the permission)."""
if ctx.invoked_subcommand is None:
user = get_user(ctx.message, user)
if user:
failed = []
channel_length = 0
for channel in ctx.message.g... | [
"async",
"def",
"unmute",
"(",
"self",
",",
"ctx",
",",
"*",
",",
"user",
":",
"str",
")",
":",
"if",
"ctx",
".",
"invoked_subcommand",
"is",
"None",
":",
"user",
"=",
"get_user",
"(",
"ctx",
".",
"message",
",",
"user",
")",
"if",
"user",
":",
"... | https://github.com/appu1232/Discord-Selfbot/blob/2305be70cdd8499c4ddb8b79101c70ac2f3fbb0d/cogs/mod.py#L137-L166 | ||
brython-dev/brython | 9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3 | www/src/Lib/_frozen_importlib.py | python | FrozenImporter.get_source | (cls, fullname) | return None | Return None as frozen modules do not have source code. | Return None as frozen modules do not have source code. | [
"Return",
"None",
"as",
"frozen",
"modules",
"do",
"not",
"have",
"source",
"code",
"."
] | def get_source(cls, fullname):
"""Return None as frozen modules do not have source code."""
return None | [
"def",
"get_source",
"(",
"cls",
",",
"fullname",
")",
":",
"return",
"None"
] | https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/_frozen_importlib.py#L843-L845 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/operator.py | python | is_ | (a, b) | return a is b | Same as a is b. | Same as a is b. | [
"Same",
"as",
"a",
"is",
"b",
"."
] | def is_(a, b):
"Same as a is b."
return a is b | [
"def",
"is_",
"(",
"a",
",",
"b",
")",
":",
"return",
"a",
"is",
"b"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/operator.py#L61-L63 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pip/_vendor/html5lib/_tokenizer.py | python | HTMLTokenizer.doctypeSystemIdentifierSingleQuotedState | (self) | return True | [] | def doctypeSystemIdentifierSingleQuotedState(self):
data = self.stream.char()
if data == "'":
self.state = self.afterDoctypeSystemIdentifierState
elif data == "\u0000":
self.tokenQueue.append({"type": tokenTypes["ParseError"],
"data": "... | [
"def",
"doctypeSystemIdentifierSingleQuotedState",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"stream",
".",
"char",
"(",
")",
"if",
"data",
"==",
"\"'\"",
":",
"self",
".",
"state",
"=",
"self",
".",
"afterDoctypeSystemIdentifierState",
"elif",
"data",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/html5lib/_tokenizer.py#L1636-L1658 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/db/migrations/questioner.py | python | MigrationQuestioner.ask_rename | (self, model_name, old_name, new_name, field_instance) | return self.defaults.get("ask_rename", False) | Was this field really renamed? | Was this field really renamed? | [
"Was",
"this",
"field",
"really",
"renamed?"
] | def ask_rename(self, model_name, old_name, new_name, field_instance):
"Was this field really renamed?"
return self.defaults.get("ask_rename", False) | [
"def",
"ask_rename",
"(",
"self",
",",
"model_name",
",",
"old_name",
",",
"new_name",
",",
"field_instance",
")",
":",
"return",
"self",
".",
"defaults",
".",
"get",
"(",
"\"ask_rename\"",
",",
"False",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/db/migrations/questioner.py#L67-L69 | |
vilcans/screenplain | b3b4ab5716470449ad4845a34b959e0ef2301359 | screenplain/export/html.py | python | Formatter.format_section | (self, section) | [] | def format_section(self, section):
with self._tag('h%d' % section.level):
self.out.write(to_html(section.text))
if section.synopsis:
with self._tag('span', classes=['h%d-synopsis' % section.level]):
self.out.write(to_html(plain(section.synopsis))) | [
"def",
"format_section",
"(",
"self",
",",
"section",
")",
":",
"with",
"self",
".",
"_tag",
"(",
"'h%d'",
"%",
"section",
".",
"level",
")",
":",
"self",
".",
"out",
".",
"write",
"(",
"to_html",
"(",
"section",
".",
"text",
")",
")",
"if",
"secti... | https://github.com/vilcans/screenplain/blob/b3b4ab5716470449ad4845a34b959e0ef2301359/screenplain/export/html.py#L137-L142 | ||||
securityclippy/elasticintel | aa08d3e9f5ab1c000128e95161139ce97ff0e334 | ingest_feed_lambda/requests/models.py | python | Response.links | (self) | return l | Returns the parsed header links of the response, if any. | Returns the parsed header links of the response, if any. | [
"Returns",
"the",
"parsed",
"header",
"links",
"of",
"the",
"response",
"if",
"any",
"."
] | def links(self):
"""Returns the parsed header links of the response, if any."""
header = self.headers.get('link')
# l = MultiDict()
l = {}
if header:
links = parse_header_links(header)
for link in links:
key = link.get('rel') or link.ge... | [
"def",
"links",
"(",
"self",
")",
":",
"header",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"'link'",
")",
"# l = MultiDict()",
"l",
"=",
"{",
"}",
"if",
"header",
":",
"links",
"=",
"parse_header_links",
"(",
"header",
")",
"for",
"link",
"in",
"... | https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/requests/models.py#L811-L826 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/cryptography/hazmat/primitives/asymmetric/rsa.py | python | RSAPublicNumbers.__ne__ | (self, other) | return not self == other | [] | def __ne__(self, other):
return not self == other | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"self",
"==",
"other"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/cryptography/hazmat/primitives/asymmetric/rsa.py#L364-L365 | |||
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/forms/fields.py | python | MultiValueField.clean | (self, value) | return out | Validate every value in the given list. A value is validated against
the corresponding Field in self.fields.
For example, if this MultiValueField was instantiated with
fields=(DateField(), TimeField()), clean() would call
DateField.clean(value[0]) and TimeField.clean(value[1]). | Validate every value in the given list. A value is validated against
the corresponding Field in self.fields. | [
"Validate",
"every",
"value",
"in",
"the",
"given",
"list",
".",
"A",
"value",
"is",
"validated",
"against",
"the",
"corresponding",
"Field",
"in",
"self",
".",
"fields",
"."
] | def clean(self, value):
"""
Validate every value in the given list. A value is validated against
the corresponding Field in self.fields.
For example, if this MultiValueField was instantiated with
fields=(DateField(), TimeField()), clean() would call
DateField.clean(value... | [
"def",
"clean",
"(",
"self",
",",
"value",
")",
":",
"clean_data",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"if",
"self",
".",
"disabled",
"and",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"self",
".",
"widget",
".",
"... | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/forms/fields.py#L995-L1047 | |
autotest/autotest | 4614ae5f550cc888267b9a419e4b90deb54f8fae | frontend/afe/rpc_interface.py | python | modify_label | (id, **data) | Modify (update) label.
:param id: Label identification.
:param data: Fields to modify.
:return: None. | Modify (update) label. | [
"Modify",
"(",
"update",
")",
"label",
"."
] | def modify_label(id, **data):
"""
Modify (update) label.
:param id: Label identification.
:param data: Fields to modify.
:return: None.
"""
models.Label.smart_get(id).update_object(data) | [
"def",
"modify_label",
"(",
"id",
",",
"*",
"*",
"data",
")",
":",
"models",
".",
"Label",
".",
"smart_get",
"(",
"id",
")",
".",
"update_object",
"(",
"data",
")"
] | https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/frontend/afe/rpc_interface.py#L73-L81 | ||
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/future/src/future/backports/http/cookiejar.py | python | deepvalues | (mapping) | Iterates over nested mapping, depth-first, in sorted order by key. | Iterates over nested mapping, depth-first, in sorted order by key. | [
"Iterates",
"over",
"nested",
"mapping",
"depth",
"-",
"first",
"in",
"sorted",
"order",
"by",
"key",
"."
] | def deepvalues(mapping):
"""Iterates over nested mapping, depth-first, in sorted order by key."""
values = vals_sorted_by_key(mapping)
for obj in values:
mapping = False
try:
obj.items
except AttributeError:
pass
else:
mapping = True
... | [
"def",
"deepvalues",
"(",
"mapping",
")",
":",
"values",
"=",
"vals_sorted_by_key",
"(",
"mapping",
")",
"for",
"obj",
"in",
"values",
":",
"mapping",
"=",
"False",
"try",
":",
"obj",
".",
"items",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"m... | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/future/src/future/backports/http/cookiejar.py#L1202-L1216 | ||
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/pydoc.py | python | splitdoc | (doc) | return '', join(lines, '\n') | Split a doc string into a synopsis line (if any) and the rest. | Split a doc string into a synopsis line (if any) and the rest. | [
"Split",
"a",
"doc",
"string",
"into",
"a",
"synopsis",
"line",
"(",
"if",
"any",
")",
"and",
"the",
"rest",
"."
] | def splitdoc(doc):
"""Split a doc string into a synopsis line (if any) and the rest."""
lines = split(strip(doc), '\n')
if len(lines) == 1:
return lines[0], ''
elif len(lines) >= 2 and not rstrip(lines[1]):
return lines[0], join(lines[2:], '\n')
return '', join(lines, '\n') | [
"def",
"splitdoc",
"(",
"doc",
")",
":",
"lines",
"=",
"split",
"(",
"strip",
"(",
"doc",
")",
",",
"'\\n'",
")",
"if",
"len",
"(",
"lines",
")",
"==",
"1",
":",
"return",
"lines",
"[",
"0",
"]",
",",
"''",
"elif",
"len",
"(",
"lines",
")",
"... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/pydoc.py#L86-L93 | |
Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks | 40c985b9a9ff1189ddf278462440b120cf96b196 | libs/scapy/data.py | python | ManufDA.reverse_lookup | (self, name, case_sensitive=False) | return {k: v for k, v in six.iteritems(self.__dict__)
if filtr(name, v)} | Find all MACs registered to a OUI
:param name: the OUI name
:param case_sensitive: default to False
:returns: a dict of mac:tuples (Name, Extended Name) | Find all MACs registered to a OUI | [
"Find",
"all",
"MACs",
"registered",
"to",
"a",
"OUI"
] | def reverse_lookup(self, name, case_sensitive=False):
"""
Find all MACs registered to a OUI
:param name: the OUI name
:param case_sensitive: default to False
:returns: a dict of mac:tuples (Name, Extended Name)
"""
if case_sensitive:
filtr = lambda x,... | [
"def",
"reverse_lookup",
"(",
"self",
",",
"name",
",",
"case_sensitive",
"=",
"False",
")",
":",
"if",
"case_sensitive",
":",
"filtr",
"=",
"lambda",
"x",
",",
"l",
":",
"any",
"(",
"x",
"==",
"z",
"for",
"z",
"in",
"l",
")",
"else",
":",
"name",
... | https://github.com/Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks/blob/40c985b9a9ff1189ddf278462440b120cf96b196/libs/scapy/data.py#L382-L396 | |
trustedsec/social-engineer-toolkit | 02ed2e8f11635546d8d176daf736508bee9d742e | src/payloads/set_payloads/set_http_server.py | python | GetHandler.do_GET | (self) | return | [] | def do_GET(self):
# this will be our shell command
message = input("shell> ")
# if we specify quit, then sys arg out of the shell
if message == "quit" or message == "exit":
print ("\nExiting the SET RevShell Listener... ")
time.sleep(2)
sys.exit()
... | [
"def",
"do_GET",
"(",
"self",
")",
":",
"# this will be our shell command",
"message",
"=",
"input",
"(",
"\"shell> \"",
")",
"# if we specify quit, then sys arg out of the shell",
"if",
"message",
"==",
"\"quit\"",
"or",
"message",
"==",
"\"exit\"",
":",
"print",
"("... | https://github.com/trustedsec/social-engineer-toolkit/blob/02ed2e8f11635546d8d176daf736508bee9d742e/src/payloads/set_payloads/set_http_server.py#L60-L80 | |||
crossbario/autobahn-python | fa9f2da0c5005574e63456a3a04f00e405744014 | autobahn/xbr/_interfaces.py | python | IMarketMaker.status | (self, details) | :param details:
:return: | [] | def status(self, details):
"""
:param details:
:return:
""" | [
"def",
"status",
"(",
"self",
",",
"details",
")",
":"
] | https://github.com/crossbario/autobahn-python/blob/fa9f2da0c5005574e63456a3a04f00e405744014/autobahn/xbr/_interfaces.py#L36-L41 | |||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_certificate_signing_request_spec.py | python | V1CertificateSigningRequestSpec.groups | (self, groups) | Sets the groups of this V1CertificateSigningRequestSpec.
groups contains group membership of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable. # noqa: E501
:param groups: The groups of this V1CertificateSigningRequestSpec. # noqa: E501
... | Sets the groups of this V1CertificateSigningRequestSpec. | [
"Sets",
"the",
"groups",
"of",
"this",
"V1CertificateSigningRequestSpec",
"."
] | def groups(self, groups):
"""Sets the groups of this V1CertificateSigningRequestSpec.
groups contains group membership of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable. # noqa: E501
:param groups: The groups of this V1CertificateSig... | [
"def",
"groups",
"(",
"self",
",",
"groups",
")",
":",
"self",
".",
"_groups",
"=",
"groups"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_certificate_signing_request_spec.py#L146-L155 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/codegen/validators.py | python | write_validator_py | (outdir, node: PlotlyNode) | Build validator source code and write to a file
Parameters
----------
outdir : str
Root outdir in which the validators package should reside
node : PlotlyNode
The datatype node (node.is_datatype must evaluate to true) for which
to build a validator class
Returns
-------
... | Build validator source code and write to a file | [
"Build",
"validator",
"source",
"code",
"and",
"write",
"to",
"a",
"file"
] | def write_validator_py(outdir, node: PlotlyNode):
"""
Build validator source code and write to a file
Parameters
----------
outdir : str
Root outdir in which the validators package should reside
node : PlotlyNode
The datatype node (node.is_datatype must evaluate to true) for whi... | [
"def",
"write_validator_py",
"(",
"outdir",
",",
"node",
":",
"PlotlyNode",
")",
":",
"if",
"node",
".",
"is_mapped",
":",
"# No validator written for mapped nodes",
"# e.g. no validator for layout.titlefont since ths is mapped to",
"# layout.title.font",
"return",
"# Generate ... | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/codegen/validators.py#L83-L115 | ||
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/s3transfer/bandwidth.py | python | ConsumptionScheduler.process_scheduled_consumption | (self, token) | Processes a scheduled consumption request that has completed
:type token: RequestToken
:param token: The token associated to the consumption
request that is used to identify the request. | Processes a scheduled consumption request that has completed | [
"Processes",
"a",
"scheduled",
"consumption",
"request",
"that",
"has",
"completed"
] | def process_scheduled_consumption(self, token):
"""Processes a scheduled consumption request that has completed
:type token: RequestToken
:param token: The token associated to the consumption
request that is used to identify the request.
"""
scheduled_retry = self._t... | [
"def",
"process_scheduled_consumption",
"(",
"self",
",",
"token",
")",
":",
"scheduled_retry",
"=",
"self",
".",
"_tokens_to_scheduled_consumption",
".",
"pop",
"(",
"token",
")",
"self",
".",
"_total_wait",
"=",
"max",
"(",
"self",
".",
"_total_wait",
"-",
"... | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/s3transfer/bandwidth.py#L329-L338 | ||
erikdubois/Aureola | 005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef | gambodekdue/dropbox.py | python | throttle | (args) | u"""set bandwidth limits for Dropbox
dropbox throttle DOWNLOAD UPLOAD
Set bandwidth limits for file sync.
DOWNLOAD - either "unlimited" or a manual limit in KB/s
UPLOAD - one of "unlimited", "auto", or a manual limit in KB/s | u"""set bandwidth limits for Dropbox
dropbox throttle DOWNLOAD UPLOAD | [
"u",
"set",
"bandwidth",
"limits",
"for",
"Dropbox",
"dropbox",
"throttle",
"DOWNLOAD",
"UPLOAD"
] | def throttle(args):
u"""set bandwidth limits for Dropbox
dropbox throttle DOWNLOAD UPLOAD
Set bandwidth limits for file sync.
DOWNLOAD - either "unlimited" or a manual limit in KB/s
UPLOAD - one of "unlimited", "auto", or a manual limit in KB/s
"""
if len(args) != 2:
console_print(throttle.__doc__, li... | [
"def",
"throttle",
"(",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"2",
":",
"console_print",
"(",
"throttle",
".",
"__doc__",
",",
"linebreak",
"=",
"False",
")",
"return",
"downlimit",
"=",
"args",
"[",
"0",
"]",
".",
"decode",
"(",
"... | https://github.com/erikdubois/Aureola/blob/005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef/gambodekdue/dropbox.py#L1104-L1165 | ||
hyperledger/indy-plenum | 7566f960f86d8ce74a26fa6ccbd534b942fc4223 | common/version.py | python | PEP440VersionFallback.cmp | (cls, v1: 'PEP440VersionFallback',
v2: 'PEP440VersionFallback') | Compares two instances. | Compares two instances. | [
"Compares",
"two",
"instances",
"."
] | def cmp(cls, v1: 'PEP440VersionFallback',
v2: 'PEP440VersionFallback') -> int:
""" Compares two instances. """
raise NotImplementedError("Please, install 'packaging' package") | [
"def",
"cmp",
"(",
"cls",
",",
"v1",
":",
"'PEP440VersionFallback'",
",",
"v2",
":",
"'PEP440VersionFallback'",
")",
"->",
"int",
":",
"raise",
"NotImplementedError",
"(",
"\"Please, install 'packaging' package\"",
")"
] | https://github.com/hyperledger/indy-plenum/blob/7566f960f86d8ce74a26fa6ccbd534b942fc4223/common/version.py#L152-L155 | ||
mikecrittenden/zen-coding-gedit | 49966219b1e9b7a1d0d8b4def6a32b6c386b8041 | zencoding/zen_core.py | python | ZenNode.has_tags_in_content | (self) | return self.content and re_tag.search(self.content) | This function tests if current tags' content contains xHTML tags.
This function is mostly used for output formatting | This function tests if current tags' content contains xHTML tags.
This function is mostly used for output formatting | [
"This",
"function",
"tests",
"if",
"current",
"tags",
"content",
"contains",
"xHTML",
"tags",
".",
"This",
"function",
"is",
"mostly",
"used",
"for",
"output",
"formatting"
] | def has_tags_in_content(self):
"""
This function tests if current tags' content contains xHTML tags.
This function is mostly used for output formatting
"""
return self.content and re_tag.search(self.content) | [
"def",
"has_tags_in_content",
"(",
"self",
")",
":",
"return",
"self",
".",
"content",
"and",
"re_tag",
".",
"search",
"(",
"self",
".",
"content",
")"
] | https://github.com/mikecrittenden/zen-coding-gedit/blob/49966219b1e9b7a1d0d8b4def6a32b6c386b8041/zencoding/zen_core.py#L1220-L1225 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/_pyio.py | python | IOBase._checkWritable | (self, msg=None) | Internal: raise an IOError if file is not writable | Internal: raise an IOError if file is not writable | [
"Internal",
":",
"raise",
"an",
"IOError",
"if",
"file",
"is",
"not",
"writable"
] | def _checkWritable(self, msg=None):
"""Internal: raise an IOError if file is not writable
"""
if not self.writable():
raise IOError("File or stream is not writable."
if msg is None else msg) | [
"def",
"_checkWritable",
"(",
"self",
",",
"msg",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"writable",
"(",
")",
":",
"raise",
"IOError",
"(",
"\"File or stream is not writable.\"",
"if",
"msg",
"is",
"None",
"else",
"msg",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/_pyio.py#L396-L401 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/dna/generators/Dna_Generator.py | python | Dna_Generator.setBasesPerTurn | (self, basesPerTurn) | Sets the number of base pairs per turn
@param basesPerTurn: Number of bases per turn
@type basesPerTurn: int | Sets the number of base pairs per turn | [
"Sets",
"the",
"number",
"of",
"base",
"pairs",
"per",
"turn"
] | def setBasesPerTurn(self, basesPerTurn):
"""
Sets the number of base pairs per turn
@param basesPerTurn: Number of bases per turn
@type basesPerTurn: int
"""
self.basesPerTurn = basesPerTurn | [
"def",
"setBasesPerTurn",
"(",
"self",
",",
"basesPerTurn",
")",
":",
"self",
".",
"basesPerTurn",
"=",
"basesPerTurn"
] | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/dna/generators/Dna_Generator.py#L1404-L1410 | ||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventDetails.get_binder_rename_section_details | (self) | return self._value | Only call this if :meth:`is_binder_rename_section_details` is true.
:rtype: BinderRenameSectionDetails | Only call this if :meth:`is_binder_rename_section_details` is true. | [
"Only",
"call",
"this",
"if",
":",
"meth",
":",
"is_binder_rename_section_details",
"is",
"true",
"."
] | def get_binder_rename_section_details(self):
"""
Only call this if :meth:`is_binder_rename_section_details` is true.
:rtype: BinderRenameSectionDetails
"""
if not self.is_binder_rename_section_details():
raise AttributeError("tag 'binder_rename_section_details' not s... | [
"def",
"get_binder_rename_section_details",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_binder_rename_section_details",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"\"tag 'binder_rename_section_details' not set\"",
")",
"return",
"self",
".",
"_value"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L18809-L18817 | |
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/Renderers/libs/python3/docutils/utils/math/math2html.py | python | main | () | Main function, called if invoked from elyxer.the command line | Main function, called if invoked from elyxer.the command line | [
"Main",
"function",
"called",
"if",
"invoked",
"from",
"elyxer",
".",
"the",
"command",
"line"
] | def main():
"Main function, called if invoked from elyxer.the command line"
args = sys.argv
Options().parseoptions(args)
if len(args) != 1:
Trace.error('Usage: math2html.py escaped_string')
exit()
result = math2html(args[0])
Trace.message(result) | [
"def",
"main",
"(",
")",
":",
"args",
"=",
"sys",
".",
"argv",
"Options",
"(",
")",
".",
"parseoptions",
"(",
"args",
")",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
":",
"Trace",
".",
"error",
"(",
"'Usage: math2html.py escaped_string'",
")",
"exit",
... | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python3/docutils/utils/math/math2html.py#L5237-L5245 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/autopilot/v1/assistant/field_type/__init__.py | python | FieldTypeInstance.assistant_sid | (self) | return self._properties['assistant_sid'] | :returns: The SID of the Assistant that is the parent of the resource
:rtype: unicode | :returns: The SID of the Assistant that is the parent of the resource
:rtype: unicode | [
":",
"returns",
":",
"The",
"SID",
"of",
"the",
"Assistant",
"that",
"is",
"the",
"parent",
"of",
"the",
"resource",
":",
"rtype",
":",
"unicode"
] | def assistant_sid(self):
"""
:returns: The SID of the Assistant that is the parent of the resource
:rtype: unicode
"""
return self._properties['assistant_sid'] | [
"def",
"assistant_sid",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'assistant_sid'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/autopilot/v1/assistant/field_type/__init__.py#L393-L398 | |
IntelAI/nauta | bbedb114a755cf1f43b834a58fc15fb6e3a4b291 | applications/cli/commands/experiment/view.py | python | view | (ctx: click.Context, experiment_name: str, tensorboard: bool,
username: str, accepted_run_kinds=(RunKinds.TRAINING.value, RunKinds.JUPYTER.value)) | Displays details of an experiment. | Displays details of an experiment. | [
"Displays",
"details",
"of",
"an",
"experiment",
"."
] | def view(ctx: click.Context, experiment_name: str, tensorboard: bool,
username: str, accepted_run_kinds=(RunKinds.TRAINING.value, RunKinds.JUPYTER.value)):
"""
Displays details of an experiment.
"""
try:
if username:
namespace = username
else:
namespace =... | [
"def",
"view",
"(",
"ctx",
":",
"click",
".",
"Context",
",",
"experiment_name",
":",
"str",
",",
"tensorboard",
":",
"bool",
",",
"username",
":",
"str",
",",
"accepted_run_kinds",
"=",
"(",
"RunKinds",
".",
"TRAINING",
".",
"value",
",",
"RunKinds",
".... | https://github.com/IntelAI/nauta/blob/bbedb114a755cf1f43b834a58fc15fb6e3a4b291/applications/cli/commands/experiment/view.py#L152-L348 | ||
ZJULearning/pixel_link | 00cb9aacc80583a8aba77d6834748ab4cca03254 | preprocessing/preprocessing_factory.py | python | get_preprocessing | (is_training=False) | return preprocessing_fn | Returns preprocessing_fn(image, height, width, **kwargs).
Args:
name: The name of the preprocessing function.
is_training: `True` if the model is being used for training.
Returns:
preprocessing_fn: A function that preprocessing a single image (pre-batch).
It has the following signatu... | Returns preprocessing_fn(image, height, width, **kwargs). | [
"Returns",
"preprocessing_fn",
"(",
"image",
"height",
"width",
"**",
"kwargs",
")",
"."
] | def get_preprocessing(is_training=False):
"""Returns preprocessing_fn(image, height, width, **kwargs).
Args:
name: The name of the preprocessing function.
is_training: `True` if the model is being used for training.
Returns:
preprocessing_fn: A function that preprocessing a single image ... | [
"def",
"get_preprocessing",
"(",
"is_training",
"=",
"False",
")",
":",
"def",
"preprocessing_fn",
"(",
"image",
",",
"labels",
",",
"bboxes",
",",
"xs",
",",
"ys",
",",
"out_shape",
",",
"data_format",
"=",
"'NHWC'",
",",
"*",
"*",
"kwargs",
")",
":",
... | https://github.com/ZJULearning/pixel_link/blob/00cb9aacc80583a8aba77d6834748ab4cca03254/preprocessing/preprocessing_factory.py#L28-L50 | |
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xl/player/engine.py | python | ExaileEngine.pause | (self) | Pauses the playback, does not toggle it | Pauses the playback, does not toggle it | [
"Pauses",
"the",
"playback",
"does",
"not",
"toggle",
"it"
] | def pause(self):
"""
Pauses the playback, does not toggle it
"""
raise NotImplementedError | [
"def",
"pause",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xl/player/engine.py#L125-L129 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/xml/dom/expatbuilder.py | python | InternalSubsetExtractor.parseString | (self, string) | [] | def parseString(self, string):
try:
ExpatBuilder.parseString(self, string)
except ParseEscape:
pass | [
"def",
"parseString",
"(",
"self",
",",
"string",
")",
":",
"try",
":",
"ExpatBuilder",
".",
"parseString",
"(",
"self",
",",
"string",
")",
"except",
"ParseEscape",
":",
"pass"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xml/dom/expatbuilder.py#L870-L874 | ||||
Kismuz/btgym | 7fb3316e67f1d7a17c620630fb62fb29428b2cec | btgym/research/model_based/strategy.py | python | PairSpreadStrategy_0.get_order_sizes | (self) | return self.current_order_sizes | Estimates current order sizes for assets in trade, updates attribute.
Returns:
array-like of floats | Estimates current order sizes for assets in trade, updates attribute. | [
"Estimates",
"current",
"order",
"sizes",
"for",
"assets",
"in",
"trade",
"updates",
"attribute",
"."
] | def get_order_sizes(self):
"""
Estimates current order sizes for assets in trade, updates attribute.
Returns:
array-like of floats
"""
s = self.norm_stat_tracker_2.get_state()
self.current_order_sizes = np.asarray(
self.spread_sizer.get_sizing(sel... | [
"def",
"get_order_sizes",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"norm_stat_tracker_2",
".",
"get_state",
"(",
")",
"self",
".",
"current_order_sizes",
"=",
"np",
".",
"asarray",
"(",
"self",
".",
"spread_sizer",
".",
"get_sizing",
"(",
"self",
".",... | https://github.com/Kismuz/btgym/blob/7fb3316e67f1d7a17c620630fb62fb29428b2cec/btgym/research/model_based/strategy.py#L333-L345 | |
p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch | 135d3e2e06bbde2868047d738e3fc2d73fd8cc93 | utilities/data_structures/Max_Heap.py | python | Max_Heap.give_max_key | (self) | return self.heap[1].key | Returns the maximum td error currently in the heap. Because it is a max heap this is the top element of the heap | Returns the maximum td error currently in the heap. Because it is a max heap this is the top element of the heap | [
"Returns",
"the",
"maximum",
"td",
"error",
"currently",
"in",
"the",
"heap",
".",
"Because",
"it",
"is",
"a",
"max",
"heap",
"this",
"is",
"the",
"top",
"element",
"of",
"the",
"heap"
] | def give_max_key(self):
"""Returns the maximum td error currently in the heap. Because it is a max heap this is the top element of the heap"""
return self.heap[1].key | [
"def",
"give_max_key",
"(",
"self",
")",
":",
"return",
"self",
".",
"heap",
"[",
"1",
"]",
".",
"key"
] | https://github.com/p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch/blob/135d3e2e06bbde2868047d738e3fc2d73fd8cc93/utilities/data_structures/Max_Heap.py#L61-L63 | |
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/image_list.py | python | to_image_list | (tensors, size_divisible=0) | tensors can be an ImageList, a torch.Tensor or
an iterable of Tensors. It can't be a numpy array.
When tensors is an iterable of Tensors, it pads
the Tensors with zeros so that they have the same
shape | tensors can be an ImageList, a torch.Tensor or
an iterable of Tensors. It can't be a numpy array.
When tensors is an iterable of Tensors, it pads
the Tensors with zeros so that they have the same
shape | [
"tensors",
"can",
"be",
"an",
"ImageList",
"a",
"torch",
".",
"Tensor",
"or",
"an",
"iterable",
"of",
"Tensors",
".",
"It",
"can",
"t",
"be",
"a",
"numpy",
"array",
".",
"When",
"tensors",
"is",
"an",
"iterable",
"of",
"Tensors",
"it",
"pads",
"the",
... | def to_image_list(tensors, size_divisible=0):
"""
tensors can be an ImageList, a torch.Tensor or
an iterable of Tensors. It can't be a numpy array.
When tensors is an iterable of Tensors, it pads
the Tensors with zeros so that they have the same
shape
"""
if isinstance(tensors, torch.Ten... | [
"def",
"to_image_list",
"(",
"tensors",
",",
"size_divisible",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"tensors",
",",
"torch",
".",
"Tensor",
")",
"and",
"size_divisible",
">",
"0",
":",
"tensors",
"=",
"[",
"tensors",
"]",
"if",
"isinstance",
"(",... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/image_list.py#L29-L70 | ||
NVIDIA/NeMo | 5b0c0b4dec12d87d3cd960846de4105309ce938e | nemo/collections/asr/parts/utils/vad_utils.py | python | get_vad_stream_status | (data) | return status | Generate a list of status for each snippet in manifest. A snippet should be in single, start, next or end status.
Used for concatenate to full audio file.
Args:
data (list): list of filepath of audio snippet
Returns:
status (list): list of status of each snippet. | Generate a list of status for each snippet in manifest. A snippet should be in single, start, next or end status.
Used for concatenate to full audio file.
Args:
data (list): list of filepath of audio snippet
Returns:
status (list): list of status of each snippet. | [
"Generate",
"a",
"list",
"of",
"status",
"for",
"each",
"snippet",
"in",
"manifest",
".",
"A",
"snippet",
"should",
"be",
"in",
"single",
"start",
"next",
"or",
"end",
"status",
".",
"Used",
"for",
"concatenate",
"to",
"full",
"audio",
"file",
".",
"Args... | def get_vad_stream_status(data):
"""
Generate a list of status for each snippet in manifest. A snippet should be in single, start, next or end status.
Used for concatenate to full audio file.
Args:
data (list): list of filepath of audio snippet
Returns:
status (list): list of status... | [
"def",
"get_vad_stream_status",
"(",
"data",
")",
":",
"if",
"len",
"(",
"data",
")",
"==",
"1",
":",
"return",
"[",
"'single'",
"]",
"status",
"=",
"[",
"None",
"]",
"*",
"len",
"(",
"data",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"data... | https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/asr/parts/utils/vad_utils.py#L146-L173 | |
bentoml/BentoML | af9c68ea2a0c3acdb3deab529b36575533225b5d | bentoml/yatai/proto/yatai_service_pb2_grpc.py | python | YataiServicer.GetYataiServiceVersion | (self, request, context) | Return current service version information | Return current service version information | [
"Return",
"current",
"service",
"version",
"information"
] | def GetYataiServiceVersion(self, request, context):
"""Return current service version information
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | [
"def",
"GetYataiServiceVersion",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"context",
".",
"set_code",
"(",
"grpc",
".",
"StatusCode",
".",
"UNIMPLEMENTED",
")",
"context",
".",
"set_details",
"(",
"'Method not implemented!'",
")",
"raise",
"NotImpl... | https://github.com/bentoml/BentoML/blob/af9c68ea2a0c3acdb3deab529b36575533225b5d/bentoml/yatai/proto/yatai_service_pb2_grpc.py#L129-L134 | ||
apenwarr/redo | 7f00abc36be15f398fa3ecf9f4e5283509c34a00 | redo/builder.py | python | _BuildJob._start_self | (self) | Run jobserver.start() to build this object's target file. | Run jobserver.start() to build this object's target file. | [
"Run",
"jobserver",
".",
"start",
"()",
"to",
"build",
"this",
"object",
"s",
"target",
"file",
"."
] | def _start_self(self):
"""Run jobserver.start() to build this object's target file."""
assert self.lock.owned
t = self.t
sf = self.sf
newstamp = sf.read_stamp()
if (sf.is_generated and
newstamp != state.STAMP_MISSING and
(sf.is_override or ... | [
"def",
"_start_self",
"(",
"self",
")",
":",
"assert",
"self",
".",
"lock",
".",
"owned",
"t",
"=",
"self",
".",
"t",
"sf",
"=",
"self",
".",
"sf",
"newstamp",
"=",
"sf",
".",
"read_stamp",
"(",
")",
"if",
"(",
"sf",
".",
"is_generated",
"and",
"... | https://github.com/apenwarr/redo/blob/7f00abc36be15f398fa3ecf9f4e5283509c34a00/redo/builder.py#L156-L268 | ||
dragonfly/dragonfly | a579b5eadf452e23b07d4caf27b402703b0012b7 | dragonfly/utils/general_utils.py | python | reorder_list_or_array | (M, ordering) | Reorders a list or array like object. | Reorders a list or array like object. | [
"Reorders",
"a",
"list",
"or",
"array",
"like",
"object",
"."
] | def reorder_list_or_array(M, ordering):
""" Reorders a list or array like object. """
if isinstance(M, list):
return [M[i] for i in ordering]
else:
return M[ordering] | [
"def",
"reorder_list_or_array",
"(",
"M",
",",
"ordering",
")",
":",
"if",
"isinstance",
"(",
"M",
",",
"list",
")",
":",
"return",
"[",
"M",
"[",
"i",
"]",
"for",
"i",
"in",
"ordering",
"]",
"else",
":",
"return",
"M",
"[",
"ordering",
"]"
] | https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/utils/general_utils.py#L268-L273 | ||
twisted/twisted | dee676b040dd38b847ea6fb112a712cb5e119490 | src/twisted/conch/ssh/userauth.py | python | SSHUserAuthClient._cbSignData | (self, privateKey, signData) | return privateKey.sign(signData) | Called back when the private key is returned. Sign the data and
return the signature.
@param privateKey: the private key object
@type privateKey: L{keys.Key}
@param signData: the data to be signed by the private key.
@type signData: L{bytes}
@return: the signature
... | Called back when the private key is returned. Sign the data and
return the signature. | [
"Called",
"back",
"when",
"the",
"private",
"key",
"is",
"returned",
".",
"Sign",
"the",
"data",
"and",
"return",
"the",
"signature",
"."
] | def _cbSignData(self, privateKey, signData):
"""
Called back when the private key is returned. Sign the data and
return the signature.
@param privateKey: the private key object
@type privateKey: L{keys.Key}
@param signData: the data to be signed by the private key.
... | [
"def",
"_cbSignData",
"(",
"self",
",",
"privateKey",
",",
"signData",
")",
":",
"return",
"privateKey",
".",
"sign",
"(",
"signData",
")"
] | https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/conch/ssh/userauth.py#L685-L697 | |
rmax/scrapy-redis | 022b1a16f18e396e42c5f483db2e2fae6794eb2e | src/scrapy_redis/stats.py | python | RedisStatsCollector.get_value | (self, key, default=None, spider=None) | Return the value of hash stats | Return the value of hash stats | [
"Return",
"the",
"value",
"of",
"hash",
"stats"
] | def get_value(self, key, default=None, spider=None):
"""Return the value of hash stats"""
if self.server.hexists(self._get_key(spider), key):
return int(self.server.hget(self._get_key(spider), key))
else:
return default | [
"def",
"get_value",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
",",
"spider",
"=",
"None",
")",
":",
"if",
"self",
".",
"server",
".",
"hexists",
"(",
"self",
".",
"_get_key",
"(",
"spider",
")",
",",
"key",
")",
":",
"return",
"int",
... | https://github.com/rmax/scrapy-redis/blob/022b1a16f18e396e42c5f483db2e2fae6794eb2e/src/scrapy_redis/stats.py#L37-L42 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/sqli/thirdparty/gprof2dot/gprof2dot.py | python | Event.__eq__ | (self, other) | return self is other | [] | def __eq__(self, other):
return self is other | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
"is",
"other"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/thirdparty/gprof2dot/gprof2dot.py#L100-L101 | |||
volatilityfoundation/volatility | a438e768194a9e05eb4d9ee9338b881c0fa25937 | volatility/plugins/malware/psxview.py | python | PsXview.check_psscan | (self) | return dict((PsXview.get_file_offset(p), p)
for p in filescan.PSScan(self._config).calculate()) | Enumerate processes with pool tag scanning | Enumerate processes with pool tag scanning | [
"Enumerate",
"processes",
"with",
"pool",
"tag",
"scanning"
] | def check_psscan(self):
"""Enumerate processes with pool tag scanning"""
return dict((PsXview.get_file_offset(p), p)
for p in filescan.PSScan(self._config).calculate()) | [
"def",
"check_psscan",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"(",
"PsXview",
".",
"get_file_offset",
"(",
"p",
")",
",",
"p",
")",
"for",
"p",
"in",
"filescan",
".",
"PSScan",
"(",
"self",
".",
"_config",
")",
".",
"calculate",
"(",
")",
")... | https://github.com/volatilityfoundation/volatility/blob/a438e768194a9e05eb4d9ee9338b881c0fa25937/volatility/plugins/malware/psxview.py#L125-L128 | |
HuobiRDCenter/huobi_Python | c75a7fa8b31e99ffc1c173d74dcfcad83682e943 | huobi/service/account/post_futures_and_pro_transfer.py | python | PostTransferBetweenFuturesAndProService.__init__ | (self, params) | [] | def __init__(self, params):
self.params = params | [
"def",
"__init__",
"(",
"self",
",",
"params",
")",
":",
"self",
".",
"params",
"=",
"params"
] | https://github.com/HuobiRDCenter/huobi_Python/blob/c75a7fa8b31e99ffc1c173d74dcfcad83682e943/huobi/service/account/post_futures_and_pro_transfer.py#L8-L9 | ||||
jsocol/django-adminplus | 6d2744b9e6ac30288cbcf8336248fc7f0a9ada4b | adminplus/sites.py | python | AdminPlusMixin.register_view | (self, path, name=None, urlname=None, visible=True,
view=None) | return decorator | Add a custom admin view. Can be used as a function or a decorator.
* `path` is the path in the admin where the view will live, e.g.
http://example.com/admin/somepath
* `name` is an optional pretty name for the list of custom views. If
empty, we'll guess based on view.__name__.
... | Add a custom admin view. Can be used as a function or a decorator. | [
"Add",
"a",
"custom",
"admin",
"view",
".",
"Can",
"be",
"used",
"as",
"a",
"function",
"or",
"a",
"decorator",
"."
] | def register_view(self, path, name=None, urlname=None, visible=True,
view=None):
"""Add a custom admin view. Can be used as a function or a decorator.
* `path` is the path in the admin where the view will live, e.g.
http://example.com/admin/somepath
* `name` is... | [
"def",
"register_view",
"(",
"self",
",",
"path",
",",
"name",
"=",
"None",
",",
"urlname",
"=",
"None",
",",
"visible",
"=",
"True",
",",
"view",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"fn",
")",
":",
"if",
"is_class_based_view",
"(",
"fn",... | https://github.com/jsocol/django-adminplus/blob/6d2744b9e6ac30288cbcf8336248fc7f0a9ada4b/adminplus/sites.py#L20-L42 | |
scrtlabs/catalyst | 2e8029780f2381da7a0729f7b52505e5db5f535b | catalyst/exchange/utils/exchange_utils.py | python | get_exchange_symbols | (exchange_name, is_local=False) | The de-serialized content of the exchange's symbols.json.
Parameters
----------
exchange_name: str
is_local: bool
environ:
Returns
-------
Object | The de-serialized content of the exchange's symbols.json. | [
"The",
"de",
"-",
"serialized",
"content",
"of",
"the",
"exchange",
"s",
"symbols",
".",
"json",
"."
] | def get_exchange_symbols(exchange_name, is_local=False):
"""
The de-serialized content of the exchange's symbols.json.
Parameters
----------
exchange_name: str
is_local: bool
environ:
Returns
-------
Object
"""
filename = get_exchange_symbols_filename(exchange_name, is... | [
"def",
"get_exchange_symbols",
"(",
"exchange_name",
",",
"is_local",
"=",
"False",
")",
":",
"filename",
"=",
"get_exchange_symbols_filename",
"(",
"exchange_name",
",",
"is_local",
")",
"if",
"not",
"is_local",
"and",
"(",
"not",
"os",
".",
"path",
".",
"isf... | https://github.com/scrtlabs/catalyst/blob/2e8029780f2381da7a0729f7b52505e5db5f535b/catalyst/exchange/utils/exchange_utils.py#L132-L169 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/form_processor/backends/sql/processor.py | python | FormProcessorSQL.is_duplicate | (cls, xform_id, domain=None) | return FormAccessorSQL.form_exists(xform_id, domain=domain) | [] | def is_duplicate(cls, xform_id, domain=None):
return FormAccessorSQL.form_exists(xform_id, domain=domain) | [
"def",
"is_duplicate",
"(",
"cls",
",",
"xform_id",
",",
"domain",
"=",
"None",
")",
":",
"return",
"FormAccessorSQL",
".",
"form_exists",
"(",
"xform_id",
",",
"domain",
"=",
"domain",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/form_processor/backends/sql/processor.py#L61-L62 | |||
qiucheng025/zao- | 3a5edf3607b3a523f95746bc69b688090c76d89a | tools/sort.py | python | Sort.get_avg_score_hist | (img1, references) | return sum(scores) / len(scores) | Return the average histogram score between a face and
reference image | Return the average histogram score between a face and
reference image | [
"Return",
"the",
"average",
"histogram",
"score",
"between",
"a",
"face",
"and",
"reference",
"image"
] | def get_avg_score_hist(img1, references):
""" Return the average histogram score between a face and
reference image """
scores = []
for img2 in references:
score = cv2.compareHist(img1, img2, cv2.HISTCMP_BHATTACHARYYA)
scores.append(score)
return sum(s... | [
"def",
"get_avg_score_hist",
"(",
"img1",
",",
"references",
")",
":",
"scores",
"=",
"[",
"]",
"for",
"img2",
"in",
"references",
":",
"score",
"=",
"cv2",
".",
"compareHist",
"(",
"img1",
",",
"img2",
",",
"cv2",
".",
"HISTCMP_BHATTACHARYYA",
")",
"sco... | https://github.com/qiucheng025/zao-/blob/3a5edf3607b3a523f95746bc69b688090c76d89a/tools/sort.py#L752-L759 | |
researchmm/tasn | 5dba8ccc096cedc63913730eeea14a9647911129 | tasn-mxnet/python/mxnet/image/detection.py | python | ImageDetIter.draw_next | (self, color=None, thickness=2, mean=None, std=None, clip=True,
waitKey=None, window_name='draw_next', id2labels=None) | Display next image with bounding boxes drawn.
Parameters
----------
color : tuple
Bounding box color in RGB, use None for random color
thickness : int
Bounding box border thickness
mean : True or numpy.ndarray
Compensate for the mean to have b... | Display next image with bounding boxes drawn. | [
"Display",
"next",
"image",
"with",
"bounding",
"boxes",
"drawn",
"."
] | def draw_next(self, color=None, thickness=2, mean=None, std=None, clip=True,
waitKey=None, window_name='draw_next', id2labels=None):
"""Display next image with bounding boxes drawn.
Parameters
----------
color : tuple
Bounding box color in RGB, use None for... | [
"def",
"draw_next",
"(",
"self",
",",
"color",
"=",
"None",
",",
"thickness",
"=",
"2",
",",
"mean",
"=",
"None",
",",
"std",
"=",
"None",
",",
"clip",
"=",
"True",
",",
"waitKey",
"=",
"None",
",",
"window_name",
"=",
"'draw_next'",
",",
"id2labels"... | https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/python/mxnet/image/detection.py#L805-L911 | ||
tensorflow/federated | 5a60a032360087b8f4c7fcfd97ed1c0131c3eac3 | tensorflow_federated/python/simulation/models/mnist.py | python | keras_dataset_from_emnist | (dataset) | return dataset.map(map_fn) | Converts `dataset` for use with the output of `create_simple_keras_model`.
Args:
dataset: An instance of `tf.data.Dataset` to read from.
Returns:
An instance of `tf.data.Dataset` after conversion. | Converts `dataset` for use with the output of `create_simple_keras_model`. | [
"Converts",
"dataset",
"for",
"use",
"with",
"the",
"output",
"of",
"create_simple_keras_model",
"."
] | def keras_dataset_from_emnist(dataset):
"""Converts `dataset` for use with the output of `create_simple_keras_model`.
Args:
dataset: An instance of `tf.data.Dataset` to read from.
Returns:
An instance of `tf.data.Dataset` after conversion.
"""
def map_fn(example):
return collections.OrderedDict... | [
"def",
"keras_dataset_from_emnist",
"(",
"dataset",
")",
":",
"def",
"map_fn",
"(",
"example",
")",
":",
"return",
"collections",
".",
"OrderedDict",
"(",
"[",
"(",
"'x'",
",",
"tf",
".",
"reshape",
"(",
"example",
"[",
"'pixels'",
"]",
",",
"[",
"-",
... | https://github.com/tensorflow/federated/blob/5a60a032360087b8f4c7fcfd97ed1c0131c3eac3/tensorflow_federated/python/simulation/models/mnist.py#L55-L71 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py | python | ParserElement.addCondition | (self, *fns, **kwargs) | return self | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition.
Optional keyword arguments:
... | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition. | [
"Add",
"a",
"boolean",
"predicate",
"function",
"to",
"expression",
"s",
"list",
"of",
"parse",
"actions",
".",
"See",
"L",
"{",
"I",
"{",
"setParseAction",
"}",
"<setParseAction",
">",
"}",
"for",
"function",
"call",
"signatures",
".",
"Unlike",
"C",
"{",... | def addCondition(self, *fns, **kwargs):
"""Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the con... | [
"def",
"addCondition",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"kwargs",
".",
"get",
"(",
"\"message\"",
",",
"\"failed user-defined condition\"",
")",
"exc_type",
"=",
"ParseFatalException",
"if",
"kwargs",
".",
"get",
... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py#L1298-L1323 | |
nephila/django-meta | 329a466f50dc74038c23cbb93fbe1566a3f3ef31 | meta/compat.py | python | addtoblock | (parser, token) | return StubNode() | This is just a sekizai addtoblock stub, for compatibility reasons | This is just a sekizai addtoblock stub, for compatibility reasons | [
"This",
"is",
"just",
"a",
"sekizai",
"addtoblock",
"stub",
"for",
"compatibility",
"reasons"
] | def addtoblock(parser, token):
"""
This is just a sekizai addtoblock stub, for compatibility reasons
"""
parser.parse(("endaddtoblock",))
parser.delete_first_token()
return StubNode() | [
"def",
"addtoblock",
"(",
"parser",
",",
"token",
")",
":",
"parser",
".",
"parse",
"(",
"(",
"\"endaddtoblock\"",
",",
")",
")",
"parser",
".",
"delete_first_token",
"(",
")",
"return",
"StubNode",
"(",
")"
] | https://github.com/nephila/django-meta/blob/329a466f50dc74038c23cbb93fbe1566a3f3ef31/meta/compat.py#L4-L10 | |
cool-RR/python_toolbox | cb9ef64b48f1d03275484d707dc5079b6701ad0c | python_toolbox/misc_tools/misc_tools.py | python | general_product | (things, start=None) | Multiply a bunch of objects by each other, not necessarily numbers. | Multiply a bunch of objects by each other, not necessarily numbers. | [
"Multiply",
"a",
"bunch",
"of",
"objects",
"by",
"each",
"other",
"not",
"necessarily",
"numbers",
"."
] | def general_product(things, start=None):
'''
Multiply a bunch of objects by each other, not necessarily numbers.
'''
if start is None:
return functools.reduce(operator.mul, things)
else:
return functools.reduce(operator.mul, things, start) | [
"def",
"general_product",
"(",
"things",
",",
"start",
"=",
"None",
")",
":",
"if",
"start",
"is",
"None",
":",
"return",
"functools",
".",
"reduce",
"(",
"operator",
".",
"mul",
",",
"things",
")",
"else",
":",
"return",
"functools",
".",
"reduce",
"(... | https://github.com/cool-RR/python_toolbox/blob/cb9ef64b48f1d03275484d707dc5079b6701ad0c/python_toolbox/misc_tools/misc_tools.py#L238-L245 | ||
pwndbg/pwndbg | 136b3b6a80d94f494dcb00a614af1c24ca706700 | pwndbg/commands/__init__.py | python | Command.split_args | (self, argument) | return gdb.string_to_argv(argument), {} | Split a command-line string from the user into arguments.
Returns:
A ``(tuple, dict)``, in the form of ``*args, **kwargs``.
The contents of the tuple/dict are undefined. | Split a command-line string from the user into arguments. | [
"Split",
"a",
"command",
"-",
"line",
"string",
"from",
"the",
"user",
"into",
"arguments",
"."
] | def split_args(self, argument):
"""Split a command-line string from the user into arguments.
Returns:
A ``(tuple, dict)``, in the form of ``*args, **kwargs``.
The contents of the tuple/dict are undefined.
"""
return gdb.string_to_argv(argument), {} | [
"def",
"split_args",
"(",
"self",
",",
"argument",
")",
":",
"return",
"gdb",
".",
"string_to_argv",
"(",
"argument",
")",
",",
"{",
"}"
] | https://github.com/pwndbg/pwndbg/blob/136b3b6a80d94f494dcb00a614af1c24ca706700/pwndbg/commands/__init__.py#L66-L73 | |
onnx/keras-onnx | 3b6da290c21bbbbf418577f3e2c528986a2965c5 | keras2onnx/ke2onnx/simplernn.py | python | build_sequence_lengths | (scope, operator, container) | return sequence_lengths[0] | Uses the masking layer to calculate the sequence lengths. If there is no
masking layer, then it returns an empty input for the sequence lengths. | Uses the masking layer to calculate the sequence lengths. If there is no
masking layer, then it returns an empty input for the sequence lengths. | [
"Uses",
"the",
"masking",
"layer",
"to",
"calculate",
"the",
"sequence",
"lengths",
".",
"If",
"there",
"is",
"no",
"masking",
"layer",
"then",
"it",
"returns",
"an",
"empty",
"input",
"for",
"the",
"sequence",
"lengths",
"."
] | def build_sequence_lengths(scope, operator, container):
"""Uses the masking layer to calculate the sequence lengths. If there is no
masking layer, then it returns an empty input for the sequence lengths.
"""
# Masking input must be present
if len(operator.input_masks) != 1:
return ''
oo... | [
"def",
"build_sequence_lengths",
"(",
"scope",
",",
"operator",
",",
"container",
")",
":",
"# Masking input must be present",
"if",
"len",
"(",
"operator",
".",
"input_masks",
")",
"!=",
"1",
":",
"return",
"''",
"oopb",
"=",
"OnnxOperatorBuilder",
"(",
"contai... | https://github.com/onnx/keras-onnx/blob/3b6da290c21bbbbf418577f3e2c528986a2965c5/keras2onnx/ke2onnx/simplernn.py#L150-L165 | |
mwaskom/seaborn | 77e3b6b03763d24cc99a8134ee9a6f43b32b8e7b | seaborn/categorical.py | python | _CategoricalPlotterNew.cat_axis | (self) | return {"v": "x", "h": "y"}[self.orient] | [] | def cat_axis(self):
return {"v": "x", "h": "y"}[self.orient] | [
"def",
"cat_axis",
"(",
"self",
")",
":",
"return",
"{",
"\"v\"",
":",
"\"x\"",
",",
"\"h\"",
":",
"\"y\"",
"}",
"[",
"self",
".",
"orient",
"]"
] | https://github.com/mwaskom/seaborn/blob/77e3b6b03763d24cc99a8134ee9a6f43b32b8e7b/seaborn/categorical.py#L155-L156 | |||
gitpython-developers/gitdb | 2913a6454c9dfc803679dc5f75315e2d821ee977 | gitdb/db/base.py | python | ObjectDBW.ostream | (self) | return self._ostream | Return the output stream
:return: overridden output stream this instance will write to, or None
if it will write to the default stream | Return the output stream | [
"Return",
"the",
"output",
"stream"
] | def ostream(self):
"""
Return the output stream
:return: overridden output stream this instance will write to, or None
if it will write to the default stream"""
return self._ostream | [
"def",
"ostream",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ostream"
] | https://github.com/gitpython-developers/gitdb/blob/2913a6454c9dfc803679dc5f75315e2d821ee977/gitdb/db/base.py#L86-L92 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/ecm/v20190719/models.py | python | Province.__init__ | (self) | r"""
:param ProvinceId: 省份Id
:type ProvinceId: str
:param ProvinceName: 省份名称
:type ProvinceName: str | r"""
:param ProvinceId: 省份Id
:type ProvinceId: str
:param ProvinceName: 省份名称
:type ProvinceName: str | [
"r",
":",
"param",
"ProvinceId",
":",
"省份Id",
":",
"type",
"ProvinceId",
":",
"str",
":",
"param",
"ProvinceName",
":",
"省份名称",
":",
"type",
"ProvinceName",
":",
"str"
] | def __init__(self):
r"""
:param ProvinceId: 省份Id
:type ProvinceId: str
:param ProvinceName: 省份名称
:type ProvinceName: str
"""
self.ProvinceId = None
self.ProvinceName = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ProvinceId",
"=",
"None",
"self",
".",
"ProvinceName",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ecm/v20190719/models.py#L9905-L9913 | ||
ninja-ide/ninja-ide | 87d91131bd19fdc3dcfd91eb97ad1e41c49c60c0 | ninja_ide/gui/editor/_editor.py | python | Editor.jump_to_line | (self, lineno=None) | Jump to a specific line number or ask to the user for the line | Jump to a specific line number or ask to the user for the line | [
"Jump",
"to",
"a",
"specific",
"line",
"number",
"or",
"ask",
"to",
"the",
"user",
"for",
"the",
"line"
] | def jump_to_line(self, lineno=None):
"""
Jump to a specific line number or ask to the user for the line
"""
if lineno is not None:
self.emit(SIGNAL("addBackItemNavigation()"))
self._cursor_line = self._cursor_index = -1
self.go_to_line(lineno)
... | [
"def",
"jump_to_line",
"(",
"self",
",",
"lineno",
"=",
"None",
")",
":",
"if",
"lineno",
"is",
"not",
"None",
":",
"self",
".",
"emit",
"(",
"SIGNAL",
"(",
"\"addBackItemNavigation()\"",
")",
")",
"self",
".",
"_cursor_line",
"=",
"self",
".",
"_cursor_... | https://github.com/ninja-ide/ninja-ide/blob/87d91131bd19fdc3dcfd91eb97ad1e41c49c60c0/ninja_ide/gui/editor/_editor.py#L596-L611 | ||
Amulet-Team/Amulet-Core | a57aeaa4216806401ff35a2dba38782a35abc42e | amulet/api/chunk/chunk.py | python | Chunk.pickle | (self) | return pickle.dumps(chunk_data) | Serialise the data in the chunk using pickle and return the resulting bytes.
:return: Pickled output. | Serialise the data in the chunk using pickle and return the resulting bytes. | [
"Serialise",
"the",
"data",
"in",
"the",
"chunk",
"using",
"pickle",
"and",
"return",
"the",
"resulting",
"bytes",
"."
] | def pickle(self) -> bytes:
"""
Serialise the data in the chunk using pickle and return the resulting bytes.
:return: Pickled output.
"""
chunk_data = (
self._cx,
self._cz,
self._changed_time,
{sy: self.blocks.get_sub_chunk(sy) for ... | [
"def",
"pickle",
"(",
"self",
")",
"->",
"bytes",
":",
"chunk_data",
"=",
"(",
"self",
".",
"_cx",
",",
"self",
".",
"_cz",
",",
"self",
".",
"_changed_time",
",",
"{",
"sy",
":",
"self",
".",
"blocks",
".",
"get_sub_chunk",
"(",
"sy",
")",
"for",
... | https://github.com/Amulet-Team/Amulet-Core/blob/a57aeaa4216806401ff35a2dba38782a35abc42e/amulet/api/chunk/chunk.py#L52-L69 | |
openstack/ironic | b392dc19bcd29cef5a69ec00d2f18a7a19a679e5 | ironic/db/api.py | python | Connection.get_ports_by_node_id | (self, node_id, limit=None, marker=None,
sort_key=None, sort_dir=None) | List all the ports for a given node.
:param node_id: The integer node ID.
:param limit: Maximum number of ports to return.
:param marker: the last item of the previous page; we return the next
result set.
:param sort_key: Attribute by which results should be sorte... | List all the ports for a given node. | [
"List",
"all",
"the",
"ports",
"for",
"a",
"given",
"node",
"."
] | def get_ports_by_node_id(self, node_id, limit=None, marker=None,
sort_key=None, sort_dir=None):
"""List all the ports for a given node.
:param node_id: The integer node ID.
:param limit: Maximum number of ports to return.
:param marker: the last item of the ... | [
"def",
"get_ports_by_node_id",
"(",
"self",
",",
"node_id",
",",
"limit",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"sort_key",
"=",
"None",
",",
"sort_dir",
"=",
"None",
")",
":"
] | https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/db/api.py#L298-L310 | ||
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/models/filesystem.py | python | RenameCmdResponse.__init__ | (self, status) | Class constructor. Instantiates a new :class:`.RenameCmdResponse`
object with the provided parameters.
Args:
status (:class:`.FSCommandStatus` or Integer): Status of the file
system command execution.
.. seealso::
| :class:`.FSCmd` | Class constructor. Instantiates a new :class:`.RenameCmdResponse`
object with the provided parameters. | [
"Class",
"constructor",
".",
"Instantiates",
"a",
"new",
":",
"class",
":",
".",
"RenameCmdResponse",
"object",
"with",
"the",
"provided",
"parameters",
"."
] | def __init__(self, status):
"""
Class constructor. Instantiates a new :class:`.RenameCmdResponse`
object with the provided parameters.
Args:
status (:class:`.FSCommandStatus` or Integer): Status of the file
system command execution.
.. seealso::
... | [
"def",
"__init__",
"(",
"self",
",",
"status",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"FSCmdType",
".",
"RENAME",
",",
"direction",
"=",
"self",
".",
"RESPONSE",
",",
"status",
"=",
"status",
")"
] | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/models/filesystem.py#L2682-L2695 | ||
pypa/flit | a4524758604107bde8c77b5816612edb76a604aa | flit_core/flit_core/vendor/tomli/_parser.py | python | suffixed_err | (src: str, pos: Pos, msg: str) | return TOMLDecodeError(f"{msg} (at {coord_repr(src, pos)})") | Return a `TOMLDecodeError` where error message is suffixed with
coordinates in source. | Return a `TOMLDecodeError` where error message is suffixed with
coordinates in source. | [
"Return",
"a",
"TOMLDecodeError",
"where",
"error",
"message",
"is",
"suffixed",
"with",
"coordinates",
"in",
"source",
"."
] | def suffixed_err(src: str, pos: Pos, msg: str) -> TOMLDecodeError:
"""Return a `TOMLDecodeError` where error message is suffixed with
coordinates in source."""
def coord_repr(src: str, pos: Pos) -> str:
if pos >= len(src):
return "end of document"
line = src.count("\n", 0, pos) ... | [
"def",
"suffixed_err",
"(",
"src",
":",
"str",
",",
"pos",
":",
"Pos",
",",
"msg",
":",
"str",
")",
"->",
"TOMLDecodeError",
":",
"def",
"coord_repr",
"(",
"src",
":",
"str",
",",
"pos",
":",
"Pos",
")",
"->",
"str",
":",
"if",
"pos",
">=",
"len"... | https://github.com/pypa/flit/blob/a4524758604107bde8c77b5816612edb76a604aa/flit_core/flit_core/vendor/tomli/_parser.py#L645-L659 | |
quay/quay | b7d325ed42827db9eda2d9f341cb5a6cdfd155a6 | data/model/team.py | python | get_federated_team_member_mapping | (team, login_service_name) | return dict(query.tuples()) | Returns a dict of all federated IDs for all team members in the team whose users are bound to
the login service within the given name.
The dictionary is from federated service identifier (username) to their Quay User table ID. | Returns a dict of all federated IDs for all team members in the team whose users are bound to
the login service within the given name. | [
"Returns",
"a",
"dict",
"of",
"all",
"federated",
"IDs",
"for",
"all",
"team",
"members",
"in",
"the",
"team",
"whose",
"users",
"are",
"bound",
"to",
"the",
"login",
"service",
"within",
"the",
"given",
"name",
"."
] | def get_federated_team_member_mapping(team, login_service_name):
"""
Returns a dict of all federated IDs for all team members in the team whose users are bound to
the login service within the given name.
The dictionary is from federated service identifier (username) to their Quay User table ID.
"""... | [
"def",
"get_federated_team_member_mapping",
"(",
"team",
",",
"login_service_name",
")",
":",
"login_service",
"=",
"LoginService",
".",
"get",
"(",
"name",
"=",
"login_service_name",
")",
"query",
"=",
"(",
"FederatedLogin",
".",
"select",
"(",
"FederatedLogin",
... | https://github.com/quay/quay/blob/b7d325ed42827db9eda2d9f341cb5a6cdfd155a6/data/model/team.py#L445-L461 | |
grigorig/stcgal | 2d3c24fc3a8ccdbf34e0ab28820d55bd22cbc3ca | stcgal/protocols.py | python | Stc15Protocol.program_flash | (self, data) | Program the MCU's flash memory. | Program the MCU's flash memory. | [
"Program",
"the",
"MCU",
"s",
"flash",
"memory",
"."
] | def program_flash(self, data):
"""Program the MCU's flash memory."""
for i in range(0, len(data), self.PROGRAM_BLOCKSIZE):
packet = bytes([0x22]) if i == 0 else bytes([0x02])
packet += struct.pack(">H", i)
if self.bsl_version >= 0x72:
packet += bytes(... | [
"def",
"program_flash",
"(",
"self",
",",
"data",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"data",
")",
",",
"self",
".",
"PROGRAM_BLOCKSIZE",
")",
":",
"packet",
"=",
"bytes",
"(",
"[",
"0x22",
"]",
")",
"if",
"i",
"==",
... | https://github.com/grigorig/stcgal/blob/2d3c24fc3a8ccdbf34e0ab28820d55bd22cbc3ca/stcgal/protocols.py#L1494-L1520 | ||
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | get_sig_filename | (*args) | return _idaapi.get_sig_filename(*args) | get_sig_filename(signame) -> char * | get_sig_filename(signame) -> char * | [
"get_sig_filename",
"(",
"signame",
")",
"-",
">",
"char",
"*"
] | def get_sig_filename(*args):
"""
get_sig_filename(signame) -> char *
"""
return _idaapi.get_sig_filename(*args) | [
"def",
"get_sig_filename",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"get_sig_filename",
"(",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L28187-L28191 | |
NiryoRobotics/niryo_one_ros | e8a218cbafd03111298c7752f9b272e3b0b623bd | niryo_one_camera/src/niryo_one_camera/objects/CalibrationObject.py | python | CalibrationObject.get_camera_info | (self) | return self.__mtx, self.__dist | Return value for ROS CameraInfo message | Return value for ROS CameraInfo message | [
"Return",
"value",
"for",
"ROS",
"CameraInfo",
"message"
] | def get_camera_info(self):
"""
Return value for ROS CameraInfo message
"""
return self.__mtx, self.__dist | [
"def",
"get_camera_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"__mtx",
",",
"self",
".",
"__dist"
] | https://github.com/NiryoRobotics/niryo_one_ros/blob/e8a218cbafd03111298c7752f9b272e3b0b623bd/niryo_one_camera/src/niryo_one_camera/objects/CalibrationObject.py#L72-L76 | |
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/fuzzbunch/command.py | python | FbCmd.register_shortcut | (self, shortcutChar, expansion) | Register a new shortcut key expansion. If a shortcut key is reused
the old command will be deleted. | Register a new shortcut key expansion. If a shortcut key is reused
the old command will be deleted. | [
"Register",
"a",
"new",
"shortcut",
"key",
"expansion",
".",
"If",
"a",
"shortcut",
"key",
"is",
"reused",
"the",
"old",
"command",
"will",
"be",
"deleted",
"."
] | def register_shortcut(self, shortcutChar, expansion):
"""Register a new shortcut key expansion. If a shortcut key is reused
the old command will be deleted.
"""
if shortcutChar in self.shortcutKeys:
del self.shortcutKeys[shortcutChar]
self.shortcutKeys[short... | [
"def",
"register_shortcut",
"(",
"self",
",",
"shortcutChar",
",",
"expansion",
")",
":",
"if",
"shortcutChar",
"in",
"self",
".",
"shortcutKeys",
":",
"del",
"self",
".",
"shortcutKeys",
"[",
"shortcutChar",
"]",
"self",
".",
"shortcutKeys",
"[",
"shortcutCha... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/fuzzbunch/command.py#L209-L216 | ||
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/config/injector.py | python | Injector.inject | (
self,
base_cls: Type[InjectType],
settings: Mapping[str, object] = None,
) | return result | Get the provided instance of a given class identifier.
Args:
cls: The base class to retrieve an instance of
params: An optional dict providing configuration to the provider
Returns:
An instance of the base class, or None | Get the provided instance of a given class identifier. | [
"Get",
"the",
"provided",
"instance",
"of",
"a",
"given",
"class",
"identifier",
"."
] | def inject(
self,
base_cls: Type[InjectType],
settings: Mapping[str, object] = None,
) -> InjectType:
"""
Get the provided instance of a given class identifier.
Args:
cls: The base class to retrieve an instance of
params: An optional dict prov... | [
"def",
"inject",
"(",
"self",
",",
"base_cls",
":",
"Type",
"[",
"InjectType",
"]",
",",
"settings",
":",
"Mapping",
"[",
"str",
",",
"object",
"]",
"=",
"None",
",",
")",
"->",
"InjectType",
":",
"result",
"=",
"self",
".",
"inject_or",
"(",
"base_c... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/config/injector.py#L93-L114 | |
wonderworks-software/PyFlow | 57e2c858933bf63890d769d985396dfad0fca0f0 | PyFlow/UI/Widgets/QtSliders.py | python | pyf_Slider.hideLabel | (self) | Hides Name label | Hides Name label | [
"Hides",
"Name",
"label"
] | def hideLabel(self):
"""Hides Name label
"""
if self.label:
self.label.hide() | [
"def",
"hideLabel",
"(",
"self",
")",
":",
"if",
"self",
".",
"label",
":",
"self",
".",
"label",
".",
"hide",
"(",
")"
] | https://github.com/wonderworks-software/PyFlow/blob/57e2c858933bf63890d769d985396dfad0fca0f0/PyFlow/UI/Widgets/QtSliders.py#L567-L571 | ||
pgq/skytools-legacy | 8b7e6c118572a605d28b7a3403c96aeecfd0d272 | python/londiste/repair.py | python | Repairer.cmp_data | (self, src_row, dst_row) | return 0 | Compare data field-by-field. | Compare data field-by-field. | [
"Compare",
"data",
"field",
"-",
"by",
"-",
"field",
"."
] | def cmp_data(self, src_row, dst_row):
"""Compare data field-by-field."""
for k in self.common_fields:
v1 = src_row[k]
v2 = dst_row[k]
if self.cmp_value(v1, v2) != 0:
return -1
return 0 | [
"def",
"cmp_data",
"(",
"self",
",",
"src_row",
",",
"dst_row",
")",
":",
"for",
"k",
"in",
"self",
".",
"common_fields",
":",
"v1",
"=",
"src_row",
"[",
"k",
"]",
"v2",
"=",
"dst_row",
"[",
"k",
"]",
"if",
"self",
".",
"cmp_value",
"(",
"v1",
",... | https://github.com/pgq/skytools-legacy/blob/8b7e6c118572a605d28b7a3403c96aeecfd0d272/python/londiste/repair.py#L278-L285 | |
pyjs/pyjs | 6c4a3d3a67300cd5df7f95a67ca9dcdc06950523 | pyjs/lib/ipaddr.py | python | _BaseNet._prefix_from_ip_int | (self, ip_int, mask=32) | return mask | Return prefix length from the decimal netmask.
Args:
ip_int: An integer, the IP address.
mask: The netmask. Defaults to 32.
Returns:
An integer, the prefix length. | Return prefix length from the decimal netmask. | [
"Return",
"prefix",
"length",
"from",
"the",
"decimal",
"netmask",
"."
] | def _prefix_from_ip_int(self, ip_int, mask=32):
"""Return prefix length from the decimal netmask.
Args:
ip_int: An integer, the IP address.
mask: The netmask. Defaults to 32.
Returns:
An integer, the prefix length.
"""
while mask:
... | [
"def",
"_prefix_from_ip_int",
"(",
"self",
",",
"ip_int",
",",
"mask",
"=",
"32",
")",
":",
"while",
"mask",
":",
"if",
"ip_int",
"&",
"1",
"==",
"1",
":",
"break",
"ip_int",
">>=",
"1",
"mask",
"-=",
"1",
"return",
"mask"
] | https://github.com/pyjs/pyjs/blob/6c4a3d3a67300cd5df7f95a67ca9dcdc06950523/pyjs/lib/ipaddr.py#L853-L870 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/networkx/generators/small.py | python | bull_graph | (create_using=None) | return G | Returns the Bull graph. | Returns the Bull graph. | [
"Returns",
"the",
"Bull",
"graph",
"."
] | def bull_graph(create_using=None):
"""Returns the Bull graph. """
description = [
"adjacencylist",
"Bull Graph",
5,
[[2, 3], [1, 3, 4], [1, 2, 5], [2], [3]]
]
G = make_small_undirected_graph(description, create_using)
return G | [
"def",
"bull_graph",
"(",
"create_using",
"=",
"None",
")",
":",
"description",
"=",
"[",
"\"adjacencylist\"",
",",
"\"Bull Graph\"",
",",
"5",
",",
"[",
"[",
"2",
",",
"3",
"]",
",",
"[",
"1",
",",
"3",
",",
"4",
"]",
",",
"[",
"1",
",",
"2",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/networkx/generators/small.py#L179-L188 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/httplib.py | python | HTTP.getreply | (self, buffering=False) | return response.status, response.reason, response.msg | Compat definition since superclass does not define it.
Returns a tuple consisting of:
- server status code (e.g. '200' if all goes well)
- server "reason" corresponding to status code
- any RFC822 headers in the response from the server | Compat definition since superclass does not define it. | [
"Compat",
"definition",
"since",
"superclass",
"does",
"not",
"define",
"it",
"."
] | def getreply(self, buffering=False):
"""Compat definition since superclass does not define it.
Returns a tuple consisting of:
- server status code (e.g. '200' if all goes well)
- server "reason" corresponding to status code
- any RFC822 headers in the response from the server
... | [
"def",
"getreply",
"(",
"self",
",",
"buffering",
"=",
"False",
")",
":",
"try",
":",
"if",
"not",
"buffering",
":",
"response",
"=",
"self",
".",
"_conn",
".",
"getresponse",
"(",
")",
"else",
":",
"#only add this keyword if non-default for compatibility",
"#... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/httplib.py#L1089-L1120 | |
isce-framework/isce2 | 0e5114a8bede3caf1d533d98e44dfe4b983e3f48 | components/mroipac/ampcor/DenseAmpcor.py | python | getThreadCount | () | Return number of threads available. | Return number of threads available. | [
"Return",
"number",
"of",
"threads",
"available",
"."
] | def getThreadCount():
'''
Return number of threads available.
'''
cpus = os.cpu_count()
try:
ompnum = int(os.environ['OMP_NUM_THREADS'])
except KeyError:
ompnum = None
if ompnum is None:
return cpus
else:
return ompnum | [
"def",
"getThreadCount",
"(",
")",
":",
"cpus",
"=",
"os",
".",
"cpu_count",
"(",
")",
"try",
":",
"ompnum",
"=",
"int",
"(",
"os",
".",
"environ",
"[",
"'OMP_NUM_THREADS'",
"]",
")",
"except",
"KeyError",
":",
"ompnum",
"=",
"None",
"if",
"ompnum",
... | https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/mroipac/ampcor/DenseAmpcor.py#L53-L68 | ||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/mailbox.py | python | Mailbox.get_string | (self, key) | return email.message_from_bytes(self.get_bytes(key)).as_string() | Return a string representation or raise a KeyError.
Uses email.message.Message to create a 7bit clean string
representation of the message. | Return a string representation or raise a KeyError. | [
"Return",
"a",
"string",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | def get_string(self, key):
"""Return a string representation or raise a KeyError.
Uses email.message.Message to create a 7bit clean string
representation of the message."""
return email.message_from_bytes(self.get_bytes(key)).as_string() | [
"def",
"get_string",
"(",
"self",
",",
"key",
")",
":",
"return",
"email",
".",
"message_from_bytes",
"(",
"self",
".",
"get_bytes",
"(",
"key",
")",
")",
".",
"as_string",
"(",
")"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/mailbox.py#L82-L87 | |
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | lib/spack/spack/cmd/__init__.py | python | cmd_name | (python_name) | return python_name.replace('_', '-') | Convert module name (with ``_``) to command name (with ``-``). | Convert module name (with ``_``) to command name (with ``-``). | [
"Convert",
"module",
"name",
"(",
"with",
"_",
")",
"to",
"command",
"name",
"(",
"with",
"-",
")",
"."
] | def cmd_name(python_name):
"""Convert module name (with ``_``) to command name (with ``-``)."""
return python_name.replace('_', '-') | [
"def",
"cmd_name",
"(",
"python_name",
")",
":",
"return",
"python_name",
".",
"replace",
"(",
"'_'",
",",
"'-'",
")"
] | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/cmd/__init__.py#L57-L59 | |
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/nqg/model/induction/derivation_utils.py | python | _can_maybe_derive_from | (rule, goal_rule) | return True | Return True if rule can potentially be used to derive goal_rule. | Return True if rule can potentially be used to derive goal_rule. | [
"Return",
"True",
"if",
"rule",
"can",
"potentially",
"be",
"used",
"to",
"derive",
"goal_rule",
"."
] | def _can_maybe_derive_from(rule, goal_rule):
"""Return True if rule can potentially be used to derive goal_rule."""
# Don't allow 'reflexive' derivations.
if rule == goal_rule:
return False
if not rule_utils.rhs_can_maybe_derive(rule.source, goal_rule.source):
return False
if not rule_utils.rhs_can_... | [
"def",
"_can_maybe_derive_from",
"(",
"rule",
",",
"goal_rule",
")",
":",
"# Don't allow 'reflexive' derivations.",
"if",
"rule",
"==",
"goal_rule",
":",
"return",
"False",
"if",
"not",
"rule_utils",
".",
"rhs_can_maybe_derive",
"(",
"rule",
".",
"source",
",",
"g... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/nqg/model/induction/derivation_utils.py#L87-L99 | |
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | dracut/driver_updates.py | python | read_lines | (filename) | return a list containing each line in filename, with newlines removed. | return a list containing each line in filename, with newlines removed. | [
"return",
"a",
"list",
"containing",
"each",
"line",
"in",
"filename",
"with",
"newlines",
"removed",
"."
] | def read_lines(filename):
"""return a list containing each line in filename, with newlines removed."""
try:
return [line.rstrip('\n') for line in open(filename)]
except OSError:
return [] | [
"def",
"read_lines",
"(",
"filename",
")",
":",
"try",
":",
"return",
"[",
"line",
".",
"rstrip",
"(",
"'\\n'",
")",
"for",
"line",
"in",
"open",
"(",
"filename",
")",
"]",
"except",
"OSError",
":",
"return",
"[",
"]"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/dracut/driver_updates.py#L256-L261 | ||
rndusr/stig | 334f03e2e3eda7c1856dd5489f0265a47b9861b6 | stig/commands/cmdmanager.py | python | CommandManager.split_cmdchain | (self, commands) | return cmdchain | Parse and validate chained commands
commands: Command line as string or a valid command chain
A command chain is a sequence of sequences of commands with their
arguments. Sub-sequences must be separated by single operators.
Command operators are characters specified by the variables ... | Parse and validate chained commands | [
"Parse",
"and",
"validate",
"chained",
"commands"
] | def split_cmdchain(self, commands):
"""
Parse and validate chained commands
commands: Command line as string or a valid command chain
A command chain is a sequence of sequences of commands with their
arguments. Sub-sequences must be separated by single operators.
Comm... | [
"def",
"split_cmdchain",
"(",
"self",
",",
"commands",
")",
":",
"if",
"not",
"isinstance",
"(",
"commands",
",",
"abc",
".",
"Sequence",
")",
":",
"raise",
"RuntimeError",
"(",
"'Must be string or sequence, not %r: %r'",
"%",
"(",
"type",
"(",
"commands",
")"... | https://github.com/rndusr/stig/blob/334f03e2e3eda7c1856dd5489f0265a47b9861b6/stig/commands/cmdmanager.py#L278-L337 | |
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/codeintel2/perlcile.py | python | scan_multilang | (tokens, module_elem) | return csl_tokens, tokenizer.has_perl_code() | Build the Perl module CIX element tree.
"tokens" is a generator of UDL tokens for this UDL-based
multi-lang document.
"module_elem" is the <module> element of a CIX element tree on
which the Perl module should be built.
This should return a list of the CSL tokens in the tok... | Build the Perl module CIX element tree. | [
"Build",
"the",
"Perl",
"module",
"CIX",
"element",
"tree",
"."
] | def scan_multilang(tokens, module_elem):
"""Build the Perl module CIX element tree.
"tokens" is a generator of UDL tokens for this UDL-based
multi-lang document.
"module_elem" is the <module> element of a CIX element tree on
which the Perl module should be built.
This s... | [
"def",
"scan_multilang",
"(",
"tokens",
",",
"module_elem",
")",
":",
"tokenizer",
"=",
"perl_lexer",
".",
"PerlMultiLangLexer",
"(",
"tokens",
")",
"# \"PerlHTML\" is about all we need for whichever Perl-based",
"# template language is being used. This could just as easily be a",... | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/perlcile.py#L124-L147 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/versioned_flow_coordinates.py | python | VersionedFlowCoordinates.__eq__ | (self, other) | return self.__dict__ == other.__dict__ | Returns true if both objects are equal | Returns true if both objects are equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"equal"
] | def __eq__(self, other):
"""
Returns true if both objects are equal
"""
if not isinstance(other, VersionedFlowCoordinates):
return False
return self.__dict__ == other.__dict__ | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"VersionedFlowCoordinates",
")",
":",
"return",
"False",
"return",
"self",
".",
"__dict__",
"==",
"other",
".",
"__dict__"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/versioned_flow_coordinates.py#L224-L231 | |
modoboa/modoboa | 9065b7a5679fee149fc6f6f0e1760699c194cf89 | modoboa/lib/api_client.py | python | ModoAPIClient.local_core_version | (self) | return self._local_core_version | Return the version installed locally. | Return the version installed locally. | [
"Return",
"the",
"version",
"installed",
"locally",
"."
] | def local_core_version(self):
"""Return the version installed locally."""
if self._local_core_version is None:
try:
self._local_core_version = pkg_resources.get_distribution(
"modoboa").version
except pkg_resources.DistributionNotFound:
... | [
"def",
"local_core_version",
"(",
"self",
")",
":",
"if",
"self",
".",
"_local_core_version",
"is",
"None",
":",
"try",
":",
"self",
".",
"_local_core_version",
"=",
"pkg_resources",
".",
"get_distribution",
"(",
"\"modoboa\"",
")",
".",
"version",
"except",
"... | https://github.com/modoboa/modoboa/blob/9065b7a5679fee149fc6f6f0e1760699c194cf89/modoboa/lib/api_client.py#L44-L52 | |
jeetsukumaran/DendroPy | 29fd294bf05d890ebf6a8d576c501e471db27ca1 | src/dendropy/calculate/popgenstat.py | python | PopulationPairSummaryStatistics.calc | (self) | Returns a summary of a set of sequences that can be partitioned into
the list of lists of taxa given by ``taxon_groups``. | Returns a summary of a set of sequences that can be partitioned into
the list of lists of taxa given by ``taxon_groups``. | [
"Returns",
"a",
"summary",
"of",
"a",
"set",
"of",
"sequences",
"that",
"can",
"be",
"partitioned",
"into",
"the",
"list",
"of",
"lists",
"of",
"taxa",
"given",
"by",
"taxon_groups",
"."
] | def calc(self):
"""
Returns a summary of a set of sequences that can be partitioned into
the list of lists of taxa given by ``taxon_groups``.
"""
diffs_x, mean_diffs_x, sq_diff_x = _count_differences(self.pop1_seqs, self.state_alphabet, self.ignore_uncertain)
diffs_y, mea... | [
"def",
"calc",
"(",
"self",
")",
":",
"diffs_x",
",",
"mean_diffs_x",
",",
"sq_diff_x",
"=",
"_count_differences",
"(",
"self",
".",
"pop1_seqs",
",",
"self",
".",
"state_alphabet",
",",
"self",
".",
"ignore_uncertain",
")",
"diffs_y",
",",
"mean_diffs_y",
"... | https://github.com/jeetsukumaran/DendroPy/blob/29fd294bf05d890ebf6a8d576c501e471db27ca1/src/dendropy/calculate/popgenstat.py#L240-L288 | ||
getsentry/sentry | 83b1f25aac3e08075e0e2495bc29efaf35aca18a | src/sentry/integrations/github/webhook.py | python | GitHubWebhookBase.get_logging_data | (self) | return None | TODO(mgaeta): Get logger.error() to with with Mapping. | TODO(mgaeta): Get logger.error() to with with Mapping. | [
"TODO",
"(",
"mgaeta",
")",
":",
"Get",
"logger",
".",
"error",
"()",
"to",
"with",
"with",
"Mapping",
"."
] | def get_logging_data(self) -> Dict[str, Any] | None:
"""TODO(mgaeta): Get logger.error() to with with Mapping."""
return None | [
"def",
"get_logging_data",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
":",
"return",
"None"
] | https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/integrations/github/webhook.py#L449-L451 | |
broadinstitute/viral-ngs | e144969e4c57060d53f38a4c3a270e8227feace1 | intrahost.py | python | AlleleFieldParser.__repr__ | (self) | return ':'.join([self._allele] + list(map(str, self._strandCounts)) + sum((list(map(
str, libCount)) for libCount in self._libCounts), []) + ['%.4g' % self._libBiasPval]) | Convert to string representation. | Convert to string representation. | [
"Convert",
"to",
"string",
"representation",
"."
] | def __repr__(self):
"""Convert to string representation."""
return ':'.join([self._allele] + list(map(str, self._strandCounts)) + sum((list(map(
str, libCount)) for libCount in self._libCounts), []) + ['%.4g' % self._libBiasPval]) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"':'",
".",
"join",
"(",
"[",
"self",
".",
"_allele",
"]",
"+",
"list",
"(",
"map",
"(",
"str",
",",
"self",
".",
"_strandCounts",
")",
")",
"+",
"sum",
"(",
"(",
"list",
"(",
"map",
"(",
"str... | https://github.com/broadinstitute/viral-ngs/blob/e144969e4c57060d53f38a4c3a270e8227feace1/intrahost.py#L64-L67 | |
graykode/gpt-2-Pytorch | 401078fde5e85475590dc04c9ed11b79332b8717 | GPT2/encoder.py | python | bytes_to_unicode | () | return dict(zip(bs, cs)) | Returns list of utf-8 byte and a corresponding list of unicode strings.
The reversible bpe codes work on unicode strings.
This means you need a large # of unicode characters in your vocab if you want to avoid UNKs.
When you're at something like a 10B token dataset you end up needing around 5K for decent cov... | Returns list of utf-8 byte and a corresponding list of unicode strings.
The reversible bpe codes work on unicode strings.
This means you need a large # of unicode characters in your vocab if you want to avoid UNKs.
When you're at something like a 10B token dataset you end up needing around 5K for decent cov... | [
"Returns",
"list",
"of",
"utf",
"-",
"8",
"byte",
"and",
"a",
"corresponding",
"list",
"of",
"unicode",
"strings",
".",
"The",
"reversible",
"bpe",
"codes",
"work",
"on",
"unicode",
"strings",
".",
"This",
"means",
"you",
"need",
"a",
"large",
"#",
"of",... | def bytes_to_unicode():
"""
Returns list of utf-8 byte and a corresponding list of unicode strings.
The reversible bpe codes work on unicode strings.
This means you need a large # of unicode characters in your vocab if you want to avoid UNKs.
When you're at something like a 10B token dataset you end... | [
"def",
"bytes_to_unicode",
"(",
")",
":",
"bs",
"=",
"list",
"(",
"range",
"(",
"ord",
"(",
"\"!\"",
")",
",",
"ord",
"(",
"\"~\"",
")",
"+",
"1",
")",
")",
"+",
"list",
"(",
"range",
"(",
"ord",
"(",
"\"¡\")",
",",
" ",
"rd(",
"\"",
"¬\")+",
... | https://github.com/graykode/gpt-2-Pytorch/blob/401078fde5e85475590dc04c9ed11b79332b8717/GPT2/encoder.py#L9-L28 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/quantum/quantum/api/rpc/agentnotifiers/l3_rpc_agent_api.py | python | L3AgentNotifyAPI._notification | (self, context, method, routers, operation, data) | Notify all the agents that are hosting the routers | Notify all the agents that are hosting the routers | [
"Notify",
"all",
"the",
"agents",
"that",
"are",
"hosting",
"the",
"routers"
] | def _notification(self, context, method, routers, operation, data):
"""Notify all the agents that are hosting the routers"""
plugin = manager.QuantumManager.get_plugin()
if utils.is_extension_supported(
plugin, constants.AGENT_SCHEDULER_EXT_ALIAS):
adminContext = (context... | [
"def",
"_notification",
"(",
"self",
",",
"context",
",",
"method",
",",
"routers",
",",
"operation",
",",
"data",
")",
":",
"plugin",
"=",
"manager",
".",
"QuantumManager",
".",
"get_plugin",
"(",
")",
"if",
"utils",
".",
"is_extension_supported",
"(",
"p... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/quantum/quantum/api/rpc/agentnotifiers/l3_rpc_agent_api.py#L71-L85 | ||
LumaPictures/pymel | fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72 | pymel/util/nameparse.py | python | MayaNodePath.isShortName | (self) | return len(self.nodes) == 1 | True if this object node is specified as a short name (without a path) | True if this object node is specified as a short name (without a path) | [
"True",
"if",
"this",
"object",
"node",
"is",
"specified",
"as",
"a",
"short",
"name",
"(",
"without",
"a",
"path",
")"
] | def isShortName(self):
""" True if this object node is specified as a short name (without a path) """
return len(self.nodes) == 1 | [
"def",
"isShortName",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"nodes",
")",
"==",
"1"
] | https://github.com/LumaPictures/pymel/blob/fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72/pymel/util/nameparse.py#L1115-L1117 | |
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | setuptools/config.py | python | ConfigHandler._parse_list | (cls, value, separator=',') | return [chunk.strip() for chunk in value if chunk.strip()] | Represents value as a list.
Value is split either by separator (defaults to comma) or by lines.
:param value:
:param separator: List items separator character.
:rtype: list | Represents value as a list. | [
"Represents",
"value",
"as",
"a",
"list",
"."
] | def _parse_list(cls, value, separator=','):
"""Represents value as a list.
Value is split either by separator (defaults to comma) or by lines.
:param value:
:param separator: List items separator character.
:rtype: list
"""
if isinstance(value, list): # _get_pa... | [
"def",
"_parse_list",
"(",
"cls",
",",
"value",
",",
"separator",
"=",
"','",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"# _get_parser_compound case",
"return",
"value",
"if",
"'\\n'",
"in",
"value",
":",
"value",
"=",
"value",
"... | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/config.py#L241-L258 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/ui/gui/prompt.py | python | PromptView._proc | (self, text) | Process the user input. | Process the user input. | [
"Process",
"the",
"user",
"input",
"."
] | def _proc(self, text):
"""Process the user input."""
result = self.procfunc(text)
if result is not None and isinstance(result, basestring):
iterl = self.textbuffer.get_end_iter()
self.textbuffer.insert(iterl, result + "\n")
self.scroll_to_mark(self.textbuffer.... | [
"def",
"_proc",
"(",
"self",
",",
"text",
")",
":",
"result",
"=",
"self",
".",
"procfunc",
"(",
"text",
")",
"if",
"result",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"result",
",",
"basestring",
")",
":",
"iterl",
"=",
"self",
".",
"textbuffer... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/prompt.py#L230-L238 | ||
wechatpy/wechatpy | 5f693a7e90156786c2540ad3c941d12cdf6d88ef | wechatpy/client/api/menu.py | python | WeChatMenu.try_match | (self, user_id) | return self._post("menu/trymatch", data={"user_id": user_id}) | 测试个性化菜单匹配结果
详情请参考
http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html
:param user_id: 可以是粉丝的OpenID,也可以是粉丝的微信号。
:return: 该接口将返回菜单配置
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appid', 'secret')
res = cl... | 测试个性化菜单匹配结果 | [
"测试个性化菜单匹配结果"
] | def try_match(self, user_id):
"""
测试个性化菜单匹配结果
详情请参考
http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html
:param user_id: 可以是粉丝的OpenID,也可以是粉丝的微信号。
:return: 该接口将返回菜单配置
使用示例::
from wechatpy import WeChatClient
client = We... | [
"def",
"try_match",
"(",
"self",
",",
"user_id",
")",
":",
"return",
"self",
".",
"_post",
"(",
"\"menu/trymatch\"",
",",
"data",
"=",
"{",
"\"user_id\"",
":",
"user_id",
"}",
")"
] | https://github.com/wechatpy/wechatpy/blob/5f693a7e90156786c2540ad3c941d12cdf6d88ef/wechatpy/client/api/menu.py#L252-L271 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.