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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
devassistant/devassistant | 2dbfeaa666a64127263664d18969c55d19ecc83e | devassistant/gui/run_window.py | python | RunWindow.open_window | (self, widget, data=None) | Function opens the run window | Function opens the run window | [
"Function",
"opens",
"the",
"run",
"window"
] | def open_window(self, widget, data=None):
"""
Function opens the run window
"""
if data is not None:
self.kwargs = data.get('kwargs', None)
self.top_assistant = data.get('top_assistant', None)
self.current_main_assistant = data.get('current_main_assist... | [
"def",
"open_window",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"not",
"None",
":",
"self",
".",
"kwargs",
"=",
"data",
".",
"get",
"(",
"'kwargs'",
",",
"None",
")",
"self",
".",
"top_assistant",
"=",
"dat... | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L144-L175 | ||
openstack/ironic | b392dc19bcd29cef5a69ec00d2f18a7a19a679e5 | ironic/db/api.py | python | Connection.get_volume_connectors_by_node_id | (self, node_id, limit=None,
marker=None, sort_key=None,
sort_dir=None, project=None) | List all the volume connectors for a given node.
:param node_id: The integer node ID.
:param limit: Maximum number of volume connectors to return.
:param marker: The last item of the previous page; we return the next
result set.
:param sort_key: Attribute by which... | List all the volume connectors for a given node. | [
"List",
"all",
"the",
"volume",
"connectors",
"for",
"a",
"given",
"node",
"."
] | def get_volume_connectors_by_node_id(self, node_id, limit=None,
marker=None, sort_key=None,
sort_dir=None, project=None):
"""List all the volume connectors for a given node.
:param node_id: The integer node ID.
:p... | [
"def",
"get_volume_connectors_by_node_id",
"(",
"self",
",",
"node_id",
",",
"limit",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"sort_key",
"=",
"None",
",",
"sort_dir",
"=",
"None",
",",
"project",
"=",
"None",
")",
":"
] | https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/db/api.py#L776-L792 | ||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/StringIO.py | python | StringIO.truncate | (self, size=None) | return | Truncate the file's size.
If the optional size argument is present, the file is truncated to
(at most) that size. The size defaults to the current position.
The current file position is not changed unless the position
is beyond the new file size.
If the specifie... | Truncate the file's size.
If the optional size argument is present, the file is truncated to
(at most) that size. The size defaults to the current position.
The current file position is not changed unless the position
is beyond the new file size.
If the specifie... | [
"Truncate",
"the",
"file",
"s",
"size",
".",
"If",
"the",
"optional",
"size",
"argument",
"is",
"present",
"the",
"file",
"is",
"truncated",
"to",
"(",
"at",
"most",
")",
"that",
"size",
".",
"The",
"size",
"defaults",
"to",
"the",
"current",
"position",... | def truncate(self, size=None):
"""Truncate the file's size.
If the optional size argument is present, the file is truncated to
(at most) that size. The size defaults to the current position.
The current file position is not changed unless the position
is beyond the new f... | [
"def",
"truncate",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"_complain_ifclosed",
"(",
"self",
".",
"closed",
")",
"if",
"size",
"is",
"None",
":",
"size",
"=",
"self",
".",
"pos",
"elif",
"size",
"<",
"0",
":",
"raise",
"IOError",
"(",
"EI... | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/StringIO.py#L195-L215 | |
scrapy/scrapy | b04cfa48328d5d5749dca6f50fa34e0cfc664c89 | scrapy/utils/trackref.py | python | object_ref.__new__ | (cls, *args, **kwargs) | return obj | [] | def __new__(cls, *args, **kwargs):
obj = object.__new__(cls)
live_refs[cls][obj] = time()
return obj | [
"def",
"__new__",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"obj",
"=",
"object",
".",
"__new__",
"(",
"cls",
")",
"live_refs",
"[",
"cls",
"]",
"[",
"obj",
"]",
"=",
"time",
"(",
")",
"return",
"obj"
] | https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/utils/trackref.py#L28-L31 | |||
dr-costas/mad-twinnet | 446e49a423a4375e5ceedab5eb51bead1057d06b | helpers/printing.py | python | print_intro_messages | (device) | Prints initial messages.
:param device: The device to be used.
:type device: str | Prints initial messages. | [
"Prints",
"initial",
"messages",
"."
] | def print_intro_messages(device):
"""Prints initial messages.
:param device: The device to be used.
:type device: str
"""
print_date_and_time()
print_msg(' ', start='')
inform_about_device(device)
print_msg(' ', start='') | [
"def",
"print_intro_messages",
"(",
"device",
")",
":",
"print_date_and_time",
"(",
")",
"print_msg",
"(",
"' '",
",",
"start",
"=",
"''",
")",
"inform_about_device",
"(",
"device",
")",
"print_msg",
"(",
"' '",
",",
"start",
"=",
"''",
")"
] | https://github.com/dr-costas/mad-twinnet/blob/446e49a423a4375e5ceedab5eb51bead1057d06b/helpers/printing.py#L32-L41 | ||
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/AndroBugs/tools/modified/androguard/core/bytecodes/dvm.py | python | Instruction.get_kind | (self) | return DALVIK_OPCODES_FORMAT[self.OP][1][1] | Return the 'kind' argument of the instruction
:rtype: int | Return the 'kind' argument of the instruction | [
"Return",
"the",
"kind",
"argument",
"of",
"the",
"instruction"
] | def get_kind(self):
"""
Return the 'kind' argument of the instruction
:rtype: int
"""
if self.OP > 0xff:
if self.OP >= 0xf2ff:
return DALVIK_OPCODES_OPTIMIZED[self.OP][1][1]
return DALVIK_OPCODES_EXTENDED_WIDTH[self.OP][1][1]
retur... | [
"def",
"get_kind",
"(",
"self",
")",
":",
"if",
"self",
".",
"OP",
">",
"0xff",
":",
"if",
"self",
".",
"OP",
">=",
"0xf2ff",
":",
"return",
"DALVIK_OPCODES_OPTIMIZED",
"[",
"self",
".",
"OP",
"]",
"[",
"1",
"]",
"[",
"1",
"]",
"return",
"DALVIK_OP... | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/AndroBugs/tools/modified/androguard/core/bytecodes/dvm.py#L3814-L3824 | |
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | get_partitions_ps_args.write | (self, oprot) | [] | def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('get_partitions_ps_args')
if self.db_name is not None:
opr... | [
"def",
"write",
"(",
"self",
",",
"oprot",
")",
":",
"if",
"oprot",
".",
"_fast_encode",
"is",
"not",
"None",
"and",
"self",
".",
"thrift_spec",
"is",
"not",
"None",
":",
"oprot",
".",
"trans",
".",
"write",
"(",
"oprot",
".",
"_fast_encode",
"(",
"s... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L20841-L20866 | ||||
tenpy/tenpy | bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff | tenpy/linalg/sparse.py | python | FlatLinearOperator.flat_to_npc | (self, vec) | Convert flat numpy vector of selected charge sector into npc Array.
If :attr:`charge_sector` is not None, convert to a 1D npc vector with leg `self.leg`.
Otherwise convert `vec`, which can be non-zero in *all* charge sectors, to a npc matrix
with an additional ``'charge'`` leg to allow represen... | Convert flat numpy vector of selected charge sector into npc Array. | [
"Convert",
"flat",
"numpy",
"vector",
"of",
"selected",
"charge",
"sector",
"into",
"npc",
"Array",
"."
] | def flat_to_npc(self, vec):
"""Convert flat numpy vector of selected charge sector into npc Array.
If :attr:`charge_sector` is not None, convert to a 1D npc vector with leg `self.leg`.
Otherwise convert `vec`, which can be non-zero in *all* charge sectors, to a npc matrix
with an additi... | [
"def",
"flat_to_npc",
"(",
"self",
",",
"vec",
")",
":",
"if",
"self",
".",
"_charge_sector",
"is",
"not",
"None",
":",
"res",
"=",
"npc",
".",
"zeros",
"(",
"[",
"self",
".",
"leg",
"]",
",",
"vec",
".",
"dtype",
",",
"self",
".",
"_charge_sector"... | https://github.com/tenpy/tenpy/blob/bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff/tenpy/linalg/sparse.py#L391-L423 | ||
firewalld/firewalld | 368e5a1e3eeff21ed55d4f2549836d45d8636ab5 | src/firewall/server/firewalld.py | python | FirewallD.completeReload | (self, sender=None) | Completely reload the firewall.
Completely reload the firewall: Stops firewall, unloads modules and
starts the firewall again. | Completely reload the firewall. | [
"Completely",
"reload",
"the",
"firewall",
"."
] | def completeReload(self, sender=None): # pylint: disable=W0613
"""Completely reload the firewall.
Completely reload the firewall: Stops firewall, unloads modules and
starts the firewall again.
"""
log.debug1("completeReload()")
self.fw.reload(True)
self.config.... | [
"def",
"completeReload",
"(",
"self",
",",
"sender",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"log",
".",
"debug1",
"(",
"\"completeReload()\"",
")",
"self",
".",
"fw",
".",
"reload",
"(",
"True",
")",
"self",
".",
"config",
".",
"reload",
"(",
... | https://github.com/firewalld/firewalld/blob/368e5a1e3eeff21ed55d4f2549836d45d8636ab5/src/firewall/server/firewalld.py#L333-L343 | ||
taers232c/GAMADV-XTD3 | 3097d6c24b7377037c746317908fcaff8404d88a | src/gam/gdata/tlslite/SharedKeyDB.py | python | SharedKeyDB.__setitem__ | (self, username, sharedKey) | Add a shared key to the database.
@type username: str
@param username: The username to associate the shared key with.
Must be less than or equal to 16 characters in length, and must
not already be in the database.
@type sharedKey: str
@param sharedKey: The shared key to... | Add a shared key to the database. | [
"Add",
"a",
"shared",
"key",
"to",
"the",
"database",
"."
] | def __setitem__(self, username, sharedKey):
"""Add a shared key to the database.
@type username: str
@param username: The username to associate the shared key with.
Must be less than or equal to 16 characters in length, and must
not already be in the database.
@type sha... | [
"def",
"__setitem__",
"(",
"self",
",",
"username",
",",
"sharedKey",
")",
":",
"BaseDB",
".",
"__setitem__",
"(",
"self",
",",
"username",
",",
"sharedKey",
")"
] | https://github.com/taers232c/GAMADV-XTD3/blob/3097d6c24b7377037c746317908fcaff8404d88a/src/gam/gdata/tlslite/SharedKeyDB.py#L35-L47 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/tornado/web.py | python | RequestHandler.decode_argument | (self, value, name=None) | Decodes an argument from the request.
The argument has been percent-decoded and is now a byte string.
By default, this method decodes the argument as utf-8 and returns
a unicode string, but this may be overridden in subclasses.
This method is used as a filter for both `get_argument()` ... | Decodes an argument from the request. | [
"Decodes",
"an",
"argument",
"from",
"the",
"request",
"."
] | def decode_argument(self, value, name=None):
"""Decodes an argument from the request.
The argument has been percent-decoded and is now a byte string.
By default, this method decodes the argument as utf-8 and returns
a unicode string, but this may be overridden in subclasses.
Th... | [
"def",
"decode_argument",
"(",
"self",
",",
"value",
",",
"name",
"=",
"None",
")",
":",
"try",
":",
"return",
"_unicode",
"(",
"value",
")",
"except",
"UnicodeDecodeError",
":",
"raise",
"HTTPError",
"(",
"400",
",",
"\"Invalid unicode in %s: %r\"",
"%",
"(... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/tornado/web.py#L465-L482 | ||
mila-iqia/myia | 56774a39579b4ec4123f44843ad4ca688acc859b | myia/abstract/ref.py | python | EvaluationCache.set_value | (self, key, value) | Associate a key to a value.
This will wrap the value in a Future. | Associate a key to a value. | [
"Associate",
"a",
"key",
"to",
"a",
"value",
"."
] | def set_value(self, key, value):
"""Associate a key to a value.
This will wrap the value in a Future.
"""
fut = asyncio.Future(loop=self.loop)
fut.set_result(value)
self.cache[key] = self.new[key] = fut | [
"def",
"set_value",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"fut",
"=",
"asyncio",
".",
"Future",
"(",
"loop",
"=",
"self",
".",
"loop",
")",
"fut",
".",
"set_result",
"(",
"value",
")",
"self",
".",
"cache",
"[",
"key",
"]",
"=",
"self"... | https://github.com/mila-iqia/myia/blob/56774a39579b4ec4123f44843ad4ca688acc859b/myia/abstract/ref.py#L193-L200 | ||
bbfamily/abu | 2de85ae57923a720dac99a545b4f856f6b87304b | abupy/UmpBu/ABuUmpEdgePrice.py | python | AbuUmpEdgePrice.class_unique_id | (cls) | return 'price_edge' | 具体ump类关键字唯一名称,类方法:return 'price_edge'
主要针对外部user设置自定义ump使用, 需要user自己保证class_unique_id的唯一性,内部不做检测
具体使用见ABuUmpManager中extend_ump_block方法 | 具体ump类关键字唯一名称,类方法:return 'price_edge'
主要针对外部user设置自定义ump使用, 需要user自己保证class_unique_id的唯一性,内部不做检测
具体使用见ABuUmpManager中extend_ump_block方法 | [
"具体ump类关键字唯一名称,类方法:return",
"price_edge",
"主要针对外部user设置自定义ump使用",
"需要user自己保证class_unique_id的唯一性,内部不做检测",
"具体使用见ABuUmpManager中extend_ump_block方法"
] | def class_unique_id(cls):
"""
具体ump类关键字唯一名称,类方法:return 'price_edge'
主要针对外部user设置自定义ump使用, 需要user自己保证class_unique_id的唯一性,内部不做检测
具体使用见ABuUmpManager中extend_ump_block方法
"""
return 'price_edge' | [
"def",
"class_unique_id",
"(",
"cls",
")",
":",
"return",
"'price_edge'"
] | https://github.com/bbfamily/abu/blob/2de85ae57923a720dac99a545b4f856f6b87304b/abupy/UmpBu/ABuUmpEdgePrice.py#L117-L123 | |
google/personfinder | 475f4c0ce916036d39bae2d480cde07126550875 | app/model.py | python | Base.create_original | (cls, repo, **kwargs) | return cls(key_name=repo + ':' + record_id, repo=repo, **kwargs) | Creates a new original entity with the given field values. | Creates a new original entity with the given field values. | [
"Creates",
"a",
"new",
"original",
"entity",
"with",
"the",
"given",
"field",
"values",
"."
] | def create_original(cls, repo, **kwargs):
"""Creates a new original entity with the given field values."""
# TODO(ryok): Consider switching to URL-like record id format,
# which is more consitent with repo id format.
record_id = '%s.%s/%s.%d' % (
repo, HOME_DOMAIN, cls.__name... | [
"def",
"create_original",
"(",
"cls",
",",
"repo",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO(ryok): Consider switching to URL-like record id format,",
"# which is more consitent with repo id format.",
"record_id",
"=",
"'%s.%s/%s.%d'",
"%",
"(",
"repo",
",",
"HOME_DOMAIN",... | https://github.com/google/personfinder/blob/475f4c0ce916036d39bae2d480cde07126550875/app/model.py#L248-L254 | |
paulwinex/pw_MultiScriptEditor | e447e99f87cb07e238baf693b7e124e50efdbc51 | multi_script_editor/managers/nuke/main.py | python | Box.intersect | (self, x, y, r, t) | self.intersect(x, y, r, t) -> None.
Intersect with the given edges. | self.intersect(x, y, r, t) -> None. | [
"self",
".",
"intersect",
"(",
"x",
"y",
"r",
"t",
")",
"-",
">",
"None",
"."
] | def intersect(self, x, y, r, t):
"""self.intersect(x, y, r, t) -> None.
Intersect with the given edges."""
pass | [
"def",
"intersect",
"(",
"self",
",",
"x",
",",
"y",
",",
"r",
",",
"t",
")",
":",
"pass"
] | https://github.com/paulwinex/pw_MultiScriptEditor/blob/e447e99f87cb07e238baf693b7e124e50efdbc51/multi_script_editor/managers/nuke/main.py#L2485-L2489 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/application/app.py | python | ReactorSelectionMixin.opt_reactor | (self, shortName) | Which reactor to use (see --help-reactors for a list of possibilities) | Which reactor to use (see --help-reactors for a list of possibilities) | [
"Which",
"reactor",
"to",
"use",
"(",
"see",
"--",
"help",
"-",
"reactors",
"for",
"a",
"list",
"of",
"possibilities",
")"
] | def opt_reactor(self, shortName):
"""
Which reactor to use (see --help-reactors for a list of possibilities)
"""
# Actually actually actually install the reactor right at this very
# moment, before any other code (for example, a sub-command plugin)
# runs and accidentally... | [
"def",
"opt_reactor",
"(",
"self",
",",
"shortName",
")",
":",
"# Actually actually actually install the reactor right at this very",
"# moment, before any other code (for example, a sub-command plugin)",
"# runs and accidentally imports and installs the default reactor.",
"#",
"# This could... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/application/app.py#L498-L520 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/nexml/_nexml.py | python | LiteralMeta.exportLiteralChildren | (self, outfile, level, name_) | [] | def exportLiteralChildren(self, outfile, level, name_):
super(LiteralMeta, self).exportLiteralChildren(outfile, level, name_)
pass | [
"def",
"exportLiteralChildren",
"(",
"self",
",",
"outfile",
",",
"level",
",",
"name_",
")",
":",
"super",
"(",
"LiteralMeta",
",",
"self",
")",
".",
"exportLiteralChildren",
"(",
"outfile",
",",
"level",
",",
"name_",
")",
"pass"
] | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/nexml/_nexml.py#L745-L747 | ||||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/warnings.py | python | catch_warnings.__init__ | (self, record=False, module=None) | Specify whether to record warnings and if an alternative module
should be used other than sys.modules['warnings'].
For compatibility with Python 3.0, please consider all arguments to be
keyword-only. | Specify whether to record warnings and if an alternative module
should be used other than sys.modules['warnings']. | [
"Specify",
"whether",
"to",
"record",
"warnings",
"and",
"if",
"an",
"alternative",
"module",
"should",
"be",
"used",
"other",
"than",
"sys",
".",
"modules",
"[",
"warnings",
"]",
"."
] | def __init__(self, record=False, module=None):
"""Specify whether to record warnings and if an alternative module
should be used other than sys.modules['warnings'].
For compatibility with Python 3.0, please consider all arguments to be
keyword-only.
"""
self._record = r... | [
"def",
"__init__",
"(",
"self",
",",
"record",
"=",
"False",
",",
"module",
"=",
"None",
")",
":",
"self",
".",
"_record",
"=",
"record",
"self",
".",
"_module",
"=",
"sys",
".",
"modules",
"[",
"'warnings'",
"]",
"if",
"module",
"is",
"None",
"else"... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/warnings.py#L318-L328 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/transforms.py | python | Transform._iter_break_from_left_to_right | (self) | Returns an iterator breaking down this transform stack from left to
right recursively. If self == ((A, N), A) then the result will be an
iterator which yields I : ((A, N), A), followed by A : (N, A),
followed by (A, N) : (A), but not ((A, N), A) : I.
This is equivalent to flattening the... | Returns an iterator breaking down this transform stack from left to
right recursively. If self == ((A, N), A) then the result will be an
iterator which yields I : ((A, N), A), followed by A : (N, A),
followed by (A, N) : (A), but not ((A, N), A) : I. | [
"Returns",
"an",
"iterator",
"breaking",
"down",
"this",
"transform",
"stack",
"from",
"left",
"to",
"right",
"recursively",
".",
"If",
"self",
"==",
"((",
"A",
"N",
")",
"A",
")",
"then",
"the",
"result",
"will",
"be",
"an",
"iterator",
"which",
"yields... | def _iter_break_from_left_to_right(self):
"""
Returns an iterator breaking down this transform stack from left to
right recursively. If self == ((A, N), A) then the result will be an
iterator which yields I : ((A, N), A), followed by A : (N, A),
followed by (A, N) : (A), but not ... | [
"def",
"_iter_break_from_left_to_right",
"(",
"self",
")",
":",
"yield",
"IdentityTransform",
"(",
")",
",",
"self"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/transforms.py#L1291-L1302 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/ipython-4.0.0-py3.3.egg/IPython/utils/text.py | python | get_text_list | (list_, last_sep=' and ', sep=", ", wrap_item_with="") | return '%s%s%s' % (
sep.join(i for i in list_[:-1]),
last_sep, list_[-1]) | Return a string with a natural enumeration of items
>>> get_text_list(['a', 'b', 'c', 'd'])
'a, b, c and d'
>>> get_text_list(['a', 'b', 'c'], ' or ')
'a, b or c'
>>> get_text_list(['a', 'b', 'c'], ', ')
'a, b, c'
>>> get_text_list(['a', 'b'], ' or ')
'a or b'
>>> get_text_list(['a'... | Return a string with a natural enumeration of items | [
"Return",
"a",
"string",
"with",
"a",
"natural",
"enumeration",
"of",
"items"
] | def get_text_list(list_, last_sep=' and ', sep=", ", wrap_item_with=""):
"""
Return a string with a natural enumeration of items
>>> get_text_list(['a', 'b', 'c', 'd'])
'a, b, c and d'
>>> get_text_list(['a', 'b', 'c'], ' or ')
'a, b or c'
>>> get_text_list(['a', 'b', 'c'], ', ')
'a, b,... | [
"def",
"get_text_list",
"(",
"list_",
",",
"last_sep",
"=",
"' and '",
",",
"sep",
"=",
"\", \"",
",",
"wrap_item_with",
"=",
"\"\"",
")",
":",
"if",
"len",
"(",
"list_",
")",
"==",
"0",
":",
"return",
"''",
"if",
"wrap_item_with",
":",
"list_",
"=",
... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/ipython-4.0.0-py3.3.egg/IPython/utils/text.py#L735-L765 | |
kvazis/homeassistant | aca227a780f806d861342e3611025a52a3bb4366 | custom_components/hacs/repositories/appdaemon.py | python | HacsAppdaemon.update_repository | (self, ignore_issues=False, force=False) | Update. | Update. | [
"Update",
"."
] | async def update_repository(self, ignore_issues=False, force=False):
"""Update."""
if not await self.common_update(ignore_issues, force):
return
# Get appdaemon objects.
if self.repository_manifest:
if self.data.content_in_root:
self.content.path.... | [
"async",
"def",
"update_repository",
"(",
"self",
",",
"ignore_issues",
"=",
"False",
",",
"force",
"=",
"False",
")",
":",
"if",
"not",
"await",
"self",
".",
"common_update",
"(",
"ignore_issues",
",",
"force",
")",
":",
"return",
"# Get appdaemon objects.",
... | https://github.com/kvazis/homeassistant/blob/aca227a780f806d861342e3611025a52a3bb4366/custom_components/hacs/repositories/appdaemon.py#L53-L73 | ||
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | keras_/kerascv/models/resnet.py | python | resnet200 | (**kwargs) | return get_resnet(blocks=200, model_name="resnet200", **kwargs) | ResNet-200 model from 'Deep Residual Learning for Image Recognition,' https://arxiv.org/abs/1512.03385.
It's an experimental model.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, default '~/.keras/models'
Locatio... | ResNet-200 model from 'Deep Residual Learning for Image Recognition,' https://arxiv.org/abs/1512.03385.
It's an experimental model. | [
"ResNet",
"-",
"200",
"model",
"from",
"Deep",
"Residual",
"Learning",
"for",
"Image",
"Recognition",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1512",
".",
"03385",
".",
"It",
"s",
"an",
"experimental",
"model",
"."
] | def resnet200(**kwargs):
"""
ResNet-200 model from 'Deep Residual Learning for Image Recognition,' https://arxiv.org/abs/1512.03385.
It's an experimental model.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, defa... | [
"def",
"resnet200",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"get_resnet",
"(",
"blocks",
"=",
"200",
",",
"model_name",
"=",
"\"resnet200\"",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/keras_/kerascv/models/resnet.py#L663-L675 | |
exodrifter/unity-python | bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d | Lib/threading.py | python | _Event.wait | (self, timeout=None) | Block until the internal flag is true.
If the internal flag is true on entry, return immediately. Otherwise,
block until another thread calls set() to set the flag to true, or until
the optional timeout occurs.
When the timeout argument is present and not None, it should be a
f... | Block until the internal flag is true. | [
"Block",
"until",
"the",
"internal",
"flag",
"is",
"true",
"."
] | def wait(self, timeout=None):
"""Block until the internal flag is true.
If the internal flag is true on entry, return immediately. Otherwise,
block until another thread calls set() to set the flag to true, or until
the optional timeout occurs.
When the timeout argument is prese... | [
"def",
"wait",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"with",
"self",
".",
"__cond",
":",
"if",
"not",
"self",
".",
"__flag",
":",
"self",
".",
"__cond",
".",
"wait",
"(",
"timeout",
")",
"return",
"self",
".",
"__flag"
] | https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/threading.py#L597-L615 | ||
DxCx/plugin.video.9anime | 34358c2f701e5ddf19d3276926374a16f63f7b6a | resources/lib/ui/js2py/es6/babel.py | python | PyJs_anonymous_3457_ | (require, module, exports, this, arguments, var=var) | [] | def PyJs_anonymous_3457_(require, module, exports, this, arguments, var=var):
var = Scope({u'this':this, u'require':require, u'exports':exports, u'module':module, u'arguments':arguments}, var)
var.registers([u'arrayEach', u'require', u'exports', u'module'])
@Js
def PyJsHoisted_arrayEach_(array, iteratee... | [
"def",
"PyJs_anonymous_3457_",
"(",
"require",
",",
"module",
",",
"exports",
",",
"this",
",",
"arguments",
",",
"var",
"=",
"var",
")",
":",
"var",
"=",
"Scope",
"(",
"{",
"u'this'",
":",
"this",
",",
"u'require'",
":",
"require",
",",
"u'exports'",
... | https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/es6/babel.py#L39208-L39224 | ||||
landlab/landlab | a5dd80b8ebfd03d1ba87ef6c4368c409485f222c | landlab/plot/imshow.py | python | imshowhs_grid | (grid, values, **kwds) | return ax | imshowhs_grid(grid, values, **kwds)
Prepare a map view of data over all nodes in the grid using a hillshade
topography map in the background.
Data is plotted as cells shaded with the value at the node at its center.
Outer edges of perimeter cells are extrapolated. Closed elements are
colored unifo... | imshowhs_grid(grid, values, **kwds) | [
"imshowhs_grid",
"(",
"grid",
"values",
"**",
"kwds",
")"
] | def imshowhs_grid(grid, values, **kwds):
"""imshowhs_grid(grid, values, **kwds)
Prepare a map view of data over all nodes in the grid using a hillshade
topography map in the background.
Data is plotted as cells shaded with the value at the node at its center.
Outer edges of perimeter cells are ext... | [
"def",
"imshowhs_grid",
"(",
"grid",
",",
"values",
",",
"*",
"*",
"kwds",
")",
":",
"values_at",
"=",
"kwds",
".",
"pop",
"(",
"\"values_at\"",
",",
"\"node\"",
")",
"values_at",
"=",
"kwds",
".",
"pop",
"(",
"\"at\"",
",",
"values_at",
")",
"if",
"... | https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/plot/imshow.py#L1241-L1406 | |
wechatpy/wechatpy | 5f693a7e90156786c2540ad3c941d12cdf6d88ef | wechatpy/work/client/api/invoice.py | python | WeChatInvoice.get_info_batch | (self, item_list: List[Dict[str, str]]) | return self._post(url, data=data) | 批量查询电子发票
参考:https://work.weixin.qq.com/api/doc/90000/90135/90287
报销方在获得用户选择的电子发票标识参数后,可以通过该接口批量查询电子发票的结构化信息。
**权限说明**:
仅认证的企业微信账号并且企业激活人数超过200的企业才有接口权限,如果认证的企业
激活人数不超过200人请联系企业微信客服咨询。
返回结果参数说明请查看官方文档。
:param item_list: 发票列表,示例:
[{'card_id': 'id', ... | 批量查询电子发票 | [
"批量查询电子发票"
] | def get_info_batch(self, item_list: List[Dict[str, str]]) -> dict:
"""批量查询电子发票
参考:https://work.weixin.qq.com/api/doc/90000/90135/90287
报销方在获得用户选择的电子发票标识参数后,可以通过该接口批量查询电子发票的结构化信息。
**权限说明**:
仅认证的企业微信账号并且企业激活人数超过200的企业才有接口权限,如果认证的企业
激活人数不超过200人请联系企业微信客服咨询。
返回结果参数... | [
"def",
"get_info_batch",
"(",
"self",
",",
"item_list",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"str",
"]",
"]",
")",
"->",
"dict",
":",
"if",
"not",
"item_list",
":",
"raise",
"ValueError",
"(",
"\"the item_list cannot be empty\"",
")",
"url",
"=",
"... | https://github.com/wechatpy/wechatpy/blob/5f693a7e90156786c2540ad3c941d12cdf6d88ef/wechatpy/work/client/api/invoice.py#L51-L73 | |
zenodo/zenodo | 3c45e52a742ad5a0a7788a67b02fbbc15ab4d8d5 | zenodo/modules/records/permissions.py | python | has_read_files_permission | (user, record) | return has_update_permission(user, record) | Check if user has read access to the record. | Check if user has read access to the record. | [
"Check",
"if",
"user",
"has",
"read",
"access",
"to",
"the",
"record",
"."
] | def has_read_files_permission(user, record):
"""Check if user has read access to the record."""
# Allow if record is open access
if AccessRight.get(
record.get('access_right', 'closed'),
record.get('embargo_date')) == AccessRight.OPEN:
return True
# Allow token bearers
... | [
"def",
"has_read_files_permission",
"(",
"user",
",",
"record",
")",
":",
"# Allow if record is open access",
"if",
"AccessRight",
".",
"get",
"(",
"record",
".",
"get",
"(",
"'access_right'",
",",
"'closed'",
")",
",",
"record",
".",
"get",
"(",
"'embargo_date'... | https://github.com/zenodo/zenodo/blob/3c45e52a742ad5a0a7788a67b02fbbc15ab4d8d5/zenodo/modules/records/permissions.py#L362-L386 | |
aspiers/git-deps | 5dd7f4c4b6d4d771c5b6866b8256eb1bad632843 | git_deps/gitutils.py | python | GitUtils.rev_list | (cls, rev_range) | return subprocess.check_output(cmd, universal_newlines=True) \
.strip().split('\n') | [] | def rev_list(cls, rev_range):
cmd = ['git', 'rev-list', rev_range]
return subprocess.check_output(cmd, universal_newlines=True) \
.strip().split('\n') | [
"def",
"rev_list",
"(",
"cls",
",",
"rev_range",
")",
":",
"cmd",
"=",
"[",
"'git'",
",",
"'rev-list'",
",",
"rev_range",
"]",
"return",
"subprocess",
".",
"check_output",
"(",
"cmd",
",",
"universal_newlines",
"=",
"True",
")",
".",
"strip",
"(",
")",
... | https://github.com/aspiers/git-deps/blob/5dd7f4c4b6d4d771c5b6866b8256eb1bad632843/git_deps/gitutils.py#L83-L86 | |||
ARISE-Initiative/robosuite | a5dfaf03cd769170881a1931d8f19c8eb72f531a | robosuite/models/objects/generated_objects.py | python | CompositeObject._size_to_cartesian_half_lengths | (geom_type, geom_size) | converts from geom size specification to x, y, and z half-length bounding box | converts from geom size specification to x, y, and z half-length bounding box | [
"converts",
"from",
"geom",
"size",
"specification",
"to",
"x",
"y",
"and",
"z",
"half",
"-",
"length",
"bounding",
"box"
] | def _size_to_cartesian_half_lengths(geom_type, geom_size):
"""
converts from geom size specification to x, y, and z half-length bounding box
"""
if geom_type in ["box", "ellipsoid"]:
return geom_size
if geom_type == "sphere":
# size is radius
r... | [
"def",
"_size_to_cartesian_half_lengths",
"(",
"geom_type",
",",
"geom_size",
")",
":",
"if",
"geom_type",
"in",
"[",
"\"box\"",
",",
"\"ellipsoid\"",
"]",
":",
"return",
"geom_size",
"if",
"geom_type",
"==",
"\"sphere\"",
":",
"# size is radius",
"return",
"[",
... | https://github.com/ARISE-Initiative/robosuite/blob/a5dfaf03cd769170881a1931d8f19c8eb72f531a/robosuite/models/objects/generated_objects.py#L539-L554 | ||
Georce/lepus | 5b01bae82b5dc1df00c9e058989e2eb9b89ff333 | lepus/pymongo-2.7/bson/objectid.py | python | ObjectId.__hash__ | (self) | return hash(self.__id) | Get a hash value for this :class:`ObjectId`.
.. versionadded:: 1.1 | Get a hash value for this :class:`ObjectId`. | [
"Get",
"a",
"hash",
"value",
"for",
"this",
":",
"class",
":",
"ObjectId",
"."
] | def __hash__(self):
"""Get a hash value for this :class:`ObjectId`.
.. versionadded:: 1.1
"""
return hash(self.__id) | [
"def",
"__hash__",
"(",
"self",
")",
":",
"return",
"hash",
"(",
"self",
".",
"__id",
")"
] | https://github.com/Georce/lepus/blob/5b01bae82b5dc1df00c9e058989e2eb9b89ff333/lepus/pymongo-2.7/bson/objectid.py#L286-L291 | |
aleju/imgaug | 0101108d4fed06bc5056c4a03e2bcb0216dac326 | imgaug/parameters.py | python | Beta._draw_samples | (self, size, random_state) | return random_state.beta(alpha, beta, size=size).astype(np.float32) | [] | def _draw_samples(self, size, random_state):
alpha = self.alpha.draw_sample(random_state=random_state)
beta = self.beta.draw_sample(random_state=random_state)
alpha = max(alpha, self.epsilon)
beta = max(beta, self.epsilon)
return random_state.beta(alpha, beta, size=size).astype(n... | [
"def",
"_draw_samples",
"(",
"self",
",",
"size",
",",
"random_state",
")",
":",
"alpha",
"=",
"self",
".",
"alpha",
".",
"draw_sample",
"(",
"random_state",
"=",
"random_state",
")",
"beta",
"=",
"self",
".",
"beta",
".",
"draw_sample",
"(",
"random_state... | https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/parameters.py#L1835-L1840 | |||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | common/djangoapps/third_party_auth/pipeline.py | python | parse_query_params | (strategy, response, *args, **kwargs) | return {'auth_entry': auth_entry} | Reads whitelisted query params, transforms them into pipeline args. | Reads whitelisted query params, transforms them into pipeline args. | [
"Reads",
"whitelisted",
"query",
"params",
"transforms",
"them",
"into",
"pipeline",
"args",
"."
] | def parse_query_params(strategy, response, *args, **kwargs):
"""Reads whitelisted query params, transforms them into pipeline args."""
# If auth_entry is not in the session, we got here by a non-standard workflow.
# We simply assume 'login' in that case.
auth_entry = strategy.request.session.get(AUTH_EN... | [
"def",
"parse_query_params",
"(",
"strategy",
",",
"response",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# If auth_entry is not in the session, we got here by a non-standard workflow.",
"# We simply assume 'login' in that case.",
"auth_entry",
"=",
"strategy",
"."... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/third_party_auth/pipeline.py#L479-L489 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py | python | BigBirdPegasusForCausalLM.get_input_embeddings | (self) | return self.model.decoder.embed_tokens | [] | def get_input_embeddings(self):
return self.model.decoder.embed_tokens | [
"def",
"get_input_embeddings",
"(",
"self",
")",
":",
"return",
"self",
".",
"model",
".",
"decoder",
".",
"embed_tokens"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py#L2877-L2878 | |||
GNS3/gns3-gui | da8adbaa18ab60e053af2a619efd468f4c8950f3 | gns3/modules/builtin/pages/cloud_configuration_page.py | python | CloudConfigurationPage._TAPAddSlot | (self, interface=None) | Adds a new TAP interface. | Adds a new TAP interface. | [
"Adds",
"a",
"new",
"TAP",
"interface",
"."
] | def _TAPAddSlot(self, interface=None):
"""
Adds a new TAP interface.
"""
if not interface:
interface = self.uiTAPLineEdit.text()
if interface:
for port in self._ports:
if port["name"] == interface and port["type"] == "tap":
... | [
"def",
"_TAPAddSlot",
"(",
"self",
",",
"interface",
"=",
"None",
")",
":",
"if",
"not",
"interface",
":",
"interface",
"=",
"self",
".",
"uiTAPLineEdit",
".",
"text",
"(",
")",
"if",
"interface",
":",
"for",
"port",
"in",
"self",
".",
"_ports",
":",
... | https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/modules/builtin/pages/cloud_configuration_page.py#L200-L218 | ||
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/external/setuptools/package_index.py | python | interpret_distro_name | (
location, basename, metadata, py_version=None, precedence=SOURCE_DIST,
platform=None
) | Generate alternative interpretations of a source distro name
Note: if `location` is a filesystem filename, you should call
``pkg_resources.normalize_path()`` on it before passing it to this
routine! | Generate alternative interpretations of a source distro name | [
"Generate",
"alternative",
"interpretations",
"of",
"a",
"source",
"distro",
"name"
] | def interpret_distro_name(
location, basename, metadata, py_version=None, precedence=SOURCE_DIST,
platform=None
):
"""Generate alternative interpretations of a source distro name
Note: if `location` is a filesystem filename, you should call
``pkg_resources.normalize_path()`` on it before pa... | [
"def",
"interpret_distro_name",
"(",
"location",
",",
"basename",
",",
"metadata",
",",
"py_version",
"=",
"None",
",",
"precedence",
"=",
"SOURCE_DIST",
",",
"platform",
"=",
"None",
")",
":",
"# Generate alternative interpretations of a source distro name",
"# Because... | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/setuptools/package_index.py#L151-L183 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/nntplib.py | python | NNTP.head | (self, id) | return self.artcmd('HEAD ' + id) | Process a HEAD command. Argument:
- id: article number or message id
Returns:
- resp: server response if successful
- nr: article number
- id: message id
- list: the lines of the article's header | Process a HEAD command. Argument:
- id: article number or message id
Returns:
- resp: server response if successful
- nr: article number
- id: message id
- list: the lines of the article's header | [
"Process",
"a",
"HEAD",
"command",
".",
"Argument",
":",
"-",
"id",
":",
"article",
"number",
"or",
"message",
"id",
"Returns",
":",
"-",
"resp",
":",
"server",
"response",
"if",
"successful",
"-",
"nr",
":",
"article",
"number",
"-",
"id",
":",
"messa... | def head(self, id):
"""Process a HEAD command. Argument:
- id: article number or message id
Returns:
- resp: server response if successful
- nr: article number
- id: message id
- list: the lines of the article's header"""
return self.artcmd('HEAD ' + id) | [
"def",
"head",
"(",
"self",
",",
"id",
")",
":",
"return",
"self",
".",
"artcmd",
"(",
"'HEAD '",
"+",
"id",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/nntplib.py#L411-L420 | |
p2pool/p2pool | 53c438bbada06b9d4a9a465bc13f7694a7a322b7 | p2pool/node.py | python | P2PNode.start | (self) | [] | def start(self):
p2p.Node.start(self)
self.shared_share_hashes = set(self.node.tracker.items)
self.node.tracker.removed.watch_weakref(self, lambda self, share: self.shared_share_hashes.discard(share.hash))
@apply
@defer.inlineCallbacks
def download_share... | [
"def",
"start",
"(",
"self",
")",
":",
"p2p",
".",
"Node",
".",
"start",
"(",
"self",
")",
"self",
".",
"shared_share_hashes",
"=",
"set",
"(",
"self",
".",
"node",
".",
"tracker",
".",
"items",
")",
"self",
".",
"node",
".",
"tracker",
".",
"remov... | https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/p2pool/node.py#L98-L156 | ||||
billpmurphy/hask | 4609cc8d9d975f51b6ecdbd33640cdffdc28f953 | hask/Data/List.py | python | sum | (xs) | return functools.reduce(operator.add, xs, 0) | sum :: Num a => [a] -> a
The sum function computes the sum of a finite list of numbers. | sum :: Num a => [a] -> a | [
"sum",
"::",
"Num",
"a",
"=",
">",
"[",
"a",
"]",
"-",
">",
"a"
] | def sum(xs):
"""
sum :: Num a => [a] -> a
The sum function computes the sum of a finite list of numbers.
"""
return functools.reduce(operator.add, xs, 0) | [
"def",
"sum",
"(",
"xs",
")",
":",
"return",
"functools",
".",
"reduce",
"(",
"operator",
".",
"add",
",",
"xs",
",",
"0",
")"
] | https://github.com/billpmurphy/hask/blob/4609cc8d9d975f51b6ecdbd33640cdffdc28f953/hask/Data/List.py#L351-L357 | |
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/mparser.py | python | Parser.foreachblock | (self) | return ForeachClauseNode(varname, varnames, items, block) | [] | def foreachblock(self) -> ForeachClauseNode:
t = self.current
self.expect('id')
assert isinstance(t.value, str)
varname = t
varnames = [t.value] # type: T.List[str]
if self.accept('comma'):
t = self.current
self.expect('id')
assert is... | [
"def",
"foreachblock",
"(",
"self",
")",
"->",
"ForeachClauseNode",
":",
"t",
"=",
"self",
".",
"current",
"self",
".",
"expect",
"(",
"'id'",
")",
"assert",
"isinstance",
"(",
"t",
".",
"value",
",",
"str",
")",
"varname",
"=",
"t",
"varnames",
"=",
... | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/mparser.py#L747-L763 | |||
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/federation/federation_server.py | python | FederationHandlerRegistry.register_edu_handler | (
self, edu_type: str, handler: Callable[[str, JsonDict], Awaitable[None]]
) | Sets the handler callable that will be used to handle an incoming
federation EDU of the given type.
Args:
edu_type: The type of the incoming EDU to register handler for
handler: A callable invoked on incoming EDU
of the given type. The arguments are the origin se... | Sets the handler callable that will be used to handle an incoming
federation EDU of the given type. | [
"Sets",
"the",
"handler",
"callable",
"that",
"will",
"be",
"used",
"to",
"handle",
"an",
"incoming",
"federation",
"EDU",
"of",
"the",
"given",
"type",
"."
] | def register_edu_handler(
self, edu_type: str, handler: Callable[[str, JsonDict], Awaitable[None]]
) -> None:
"""Sets the handler callable that will be used to handle an incoming
federation EDU of the given type.
Args:
edu_type: The type of the incoming EDU to register h... | [
"def",
"register_edu_handler",
"(",
"self",
",",
"edu_type",
":",
"str",
",",
"handler",
":",
"Callable",
"[",
"[",
"str",
",",
"JsonDict",
"]",
",",
"Awaitable",
"[",
"None",
"]",
"]",
")",
"->",
"None",
":",
"if",
"edu_type",
"in",
"self",
".",
"ed... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/federation/federation_server.py#L1249-L1266 | ||
padelt/temper-python | be1a00c320bf707c40ab53438af78ce234cdc036 | temperusb/temper.py | python | TemperHandler.get_devices | (self) | return self._devices | Get a list of all devices attached to this handler | Get a list of all devices attached to this handler | [
"Get",
"a",
"list",
"of",
"all",
"devices",
"attached",
"to",
"this",
"handler"
] | def get_devices(self):
"""
Get a list of all devices attached to this handler
"""
return self._devices | [
"def",
"get_devices",
"(",
"self",
")",
":",
"return",
"self",
".",
"_devices"
] | https://github.com/padelt/temper-python/blob/be1a00c320bf707c40ab53438af78ce234cdc036/temperusb/temper.py#L435-L439 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/core.py | python | Cores_size._repr_ | (self) | return "%s-Cores of size %s" % (self.k, self.n) | TESTS::
sage: repr(Cores(4, size = 3)) #indirect doctest
'4-Cores of size 3' | TESTS:: | [
"TESTS",
"::"
] | def _repr_(self):
"""
TESTS::
sage: repr(Cores(4, size = 3)) #indirect doctest
'4-Cores of size 3'
"""
return "%s-Cores of size %s" % (self.k, self.n) | [
"def",
"_repr_",
"(",
"self",
")",
":",
"return",
"\"%s-Cores of size %s\"",
"%",
"(",
"self",
".",
"k",
",",
"self",
".",
"n",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/core.py#L705-L712 | |
google/rekall | 55d1925f2df9759a989b35271b4fa48fc54a1c86 | rekall-core/rekall/ui/text.py | python | TextRenderer.table_row | (self, *args, **kwargs) | Outputs a single row of a table.
Text tables support these additional kwargs:
highlight: Highlights this raw according to the color scheme (e.g.
important, good...) | Outputs a single row of a table. | [
"Outputs",
"a",
"single",
"row",
"of",
"a",
"table",
"."
] | def table_row(self, *args, **kwargs):
"""Outputs a single row of a table.
Text tables support these additional kwargs:
highlight: Highlights this raw according to the color scheme (e.g.
important, good...)
"""
super(TextRenderer, self).table_row(*args, **k... | [
"def",
"table_row",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"TextRenderer",
",",
"self",
")",
".",
"table_row",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"RenderProgress",
"(",
"message",
"... | https://github.com/google/rekall/blob/55d1925f2df9759a989b35271b4fa48fc54a1c86/rekall-core/rekall/ui/text.py#L1412-L1420 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/schubert_polynomial.py | python | SchubertPolynomial_class.divided_difference | (self, i, algorithm="sage") | r"""
Return the ``i``-th divided difference operator, applied to ``self``.
Here, ``i`` can be either a permutation or a positive integer.
INPUT:
- ``i`` -- permutation or positive integer
- ``algorithm`` -- (default: ``'sage'``) either ``'sage'``
or ``'symmetrica'``... | r"""
Return the ``i``-th divided difference operator, applied to ``self``. | [
"r",
"Return",
"the",
"i",
"-",
"th",
"divided",
"difference",
"operator",
"applied",
"to",
"self",
"."
] | def divided_difference(self, i, algorithm="sage"):
r"""
Return the ``i``-th divided difference operator, applied to ``self``.
Here, ``i`` can be either a permutation or a positive integer.
INPUT:
- ``i`` -- permutation or positive integer
- ``algorithm`` -- (default: ... | [
"def",
"divided_difference",
"(",
"self",
",",
"i",
",",
"algorithm",
"=",
"\"sage\"",
")",
":",
"if",
"not",
"self",
":",
"# if self is 0",
"return",
"self",
"Perms",
"=",
"Permutations",
"(",
")",
"if",
"i",
"in",
"ZZ",
":",
"if",
"algorithm",
"==",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/schubert_polynomial.py#L91-L253 | ||
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/build/inline_copy/yaml/yaml/__init__.py | python | safe_dump_all | (documents, stream=None, **kwds) | return dump_all(documents, stream, Dumper=SafeDumper, **kwds) | Serialize a sequence of Python objects into a YAML stream.
Produce only basic YAML tags.
If stream is None, return the produced string instead. | Serialize a sequence of Python objects into a YAML stream.
Produce only basic YAML tags.
If stream is None, return the produced string instead. | [
"Serialize",
"a",
"sequence",
"of",
"Python",
"objects",
"into",
"a",
"YAML",
"stream",
".",
"Produce",
"only",
"basic",
"YAML",
"tags",
".",
"If",
"stream",
"is",
"None",
"return",
"the",
"produced",
"string",
"instead",
"."
] | def safe_dump_all(documents, stream=None, **kwds):
"""
Serialize a sequence of Python objects into a YAML stream.
Produce only basic YAML tags.
If stream is None, return the produced string instead.
"""
return dump_all(documents, stream, Dumper=SafeDumper, **kwds) | [
"def",
"safe_dump_all",
"(",
"documents",
",",
"stream",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"dump_all",
"(",
"documents",
",",
"stream",
",",
"Dumper",
"=",
"SafeDumper",
",",
"*",
"*",
"kwds",
")"
] | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/yaml/yaml/__init__.py#L292-L298 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/scripts/cftp.py | python | StdioClient._printProgressBar | (self, f, startTime) | Update a console progress bar on this L{StdioClient}'s transport, based
on the difference between the start time of the operation and the
current time according to the reactor, and appropriate to the size of
the console window.
@param f: a wrapper around the file which is being written ... | Update a console progress bar on this L{StdioClient}'s transport, based
on the difference between the start time of the operation and the
current time according to the reactor, and appropriate to the size of
the console window. | [
"Update",
"a",
"console",
"progress",
"bar",
"on",
"this",
"L",
"{",
"StdioClient",
"}",
"s",
"transport",
"based",
"on",
"the",
"difference",
"between",
"the",
"start",
"time",
"of",
"the",
"operation",
"and",
"the",
"current",
"time",
"according",
"to",
... | def _printProgressBar(self, f, startTime):
"""
Update a console progress bar on this L{StdioClient}'s transport, based
on the difference between the start time of the operation and the
current time according to the reactor, and appropriate to the size of
the console window.
... | [
"def",
"_printProgressBar",
"(",
"self",
",",
"f",
",",
"startTime",
")",
":",
"diff",
"=",
"self",
".",
"reactor",
".",
"seconds",
"(",
")",
"-",
"startTime",
"total",
"=",
"f",
".",
"total",
"try",
":",
"winSize",
"=",
"struct",
".",
"unpack",
"(",... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/scripts/cftp.py#L811-L850 | ||
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/accounts/models.py | python | Profile.full_name | (self) | return self.user.full_name | Return user's full name. | Return user's full name. | [
"Return",
"user",
"s",
"full",
"name",
"."
] | def full_name(self):
"""Return user's full name."""
return self.user.full_name | [
"def",
"full_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"user",
".",
"full_name"
] | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/accounts/models.py#L589-L591 | |
eggnogdb/eggnog-mapper | d6e6cdf0a829f2bd85480f3f3f16e38c213cd091 | eggnogmapper/search/hmmer/hmmer_idmap.py | python | load_idmap_idx | (idmap_file) | return idmap_idx | [] | def load_idmap_idx(idmap_file):
idmap_idx = {}
# print(colorify("Reading idmap %s" % idmap_file, color='lblue'))
for _lnum, _line in enumerate(open(idmap_file)):
if not _line.strip():
continue
try:
fields = list(map(str, _line.strip().split(' ')))
if len(... | [
"def",
"load_idmap_idx",
"(",
"idmap_file",
")",
":",
"idmap_idx",
"=",
"{",
"}",
"# print(colorify(\"Reading idmap %s\" % idmap_file, color='lblue'))",
"for",
"_lnum",
",",
"_line",
"in",
"enumerate",
"(",
"open",
"(",
"idmap_file",
")",
")",
":",
"if",
"not",
"_... | https://github.com/eggnogdb/eggnog-mapper/blob/d6e6cdf0a829f2bd85480f3f3f16e38c213cd091/eggnogmapper/search/hmmer/hmmer_idmap.py#L19-L41 | |||
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/awscli/argprocess.py | python | ParamShorthandParser.__call__ | (self, cli_argument, value, event_name, **kwargs) | Attempt to parse shorthand syntax for values.
This is intended to be hooked up as an event handler (hence the
**kwargs). Given ``param`` object and its string ``value``,
figure out if we can parse it. If we can parse it, we return
the parsed value (typically some sort of python dict).... | Attempt to parse shorthand syntax for values. | [
"Attempt",
"to",
"parse",
"shorthand",
"syntax",
"for",
"values",
"."
] | def __call__(self, cli_argument, value, event_name, **kwargs):
"""Attempt to parse shorthand syntax for values.
This is intended to be hooked up as an event handler (hence the
**kwargs). Given ``param`` object and its string ``value``,
figure out if we can parse it. If we can parse it... | [
"def",
"__call__",
"(",
"self",
",",
"cli_argument",
",",
"value",
",",
"event_name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"_should_parse_as_shorthand",
"(",
"cli_argument",
",",
"value",
")",
":",
"return",
"else",
":",
"service_id... | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/awscli/argprocess.py#L280-L314 | ||
nelson-liu/paraphrase-id-tensorflow | 108e461dea0dd148464e985e47ac5c6c11818fcb | duplicate_questions/data/instances/instance.py | python | IndexedInstance.pad | (self, max_lengths) | Add zero-padding to make each data example of equal length for use
in the neural network.
This modifies the current object.
Parameters
----------
max_lengths: Dictionary of {str:int}
In this dictionary, each ``str`` refers to a type of token
(e.g. ``max_... | Add zero-padding to make each data example of equal length for use
in the neural network. | [
"Add",
"zero",
"-",
"padding",
"to",
"make",
"each",
"data",
"example",
"of",
"equal",
"length",
"for",
"use",
"in",
"the",
"neural",
"network",
"."
] | def pad(self, max_lengths):
"""
Add zero-padding to make each data example of equal length for use
in the neural network.
This modifies the current object.
Parameters
----------
max_lengths: Dictionary of {str:int}
In this dictionary, each ``str`` re... | [
"def",
"pad",
"(",
"self",
",",
"max_lengths",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/nelson-liu/paraphrase-id-tensorflow/blob/108e461dea0dd148464e985e47ac5c6c11818fcb/duplicate_questions/data/instances/instance.py#L215-L231 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/core/serializers/python.py | python | _get_model | (model_identifier) | return Model | Helper to look up a model from an "app_label.module_name" string. | Helper to look up a model from an "app_label.module_name" string. | [
"Helper",
"to",
"look",
"up",
"a",
"model",
"from",
"an",
"app_label",
".",
"module_name",
"string",
"."
] | def _get_model(model_identifier):
"""
Helper to look up a model from an "app_label.module_name" string.
"""
try:
Model = models.get_model(*model_identifier.split("."))
except TypeError:
Model = None
if Model is None:
raise base.DeserializationError(u"Invalid model identif... | [
"def",
"_get_model",
"(",
"model_identifier",
")",
":",
"try",
":",
"Model",
"=",
"models",
".",
"get_model",
"(",
"*",
"model_identifier",
".",
"split",
"(",
"\".\"",
")",
")",
"except",
"TypeError",
":",
"Model",
"=",
"None",
"if",
"Model",
"is",
"None... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/core/serializers/python.py#L132-L142 | |
harvard-lil/capstone | f15c98fce0b50b74616c40f862146d858b54be5d | capstone/scripts/render_case.py | python | VolumeRenderer.render_xml | (self, case) | return "<?xml version='1.0' encoding='utf-8'?>\n{}".format(self.render_markup(case).replace('\xad', '')) | Render <casebody> as XML, with <em> and <page-number> | Render <casebody> as XML, with <em> and <page-number> | [
"Render",
"<casebody",
">",
"as",
"XML",
"with",
"<em",
">",
"and",
"<page",
"-",
"number",
">"
] | def render_xml(self, case):
"""
Render <casebody> as XML, with <em> and <page-number>
"""
self.format = 'xml'
self.original_xml = False
return "<?xml version='1.0' encoding='utf-8'?>\n{}".format(self.render_markup(case).replace('\xad', '')) | [
"def",
"render_xml",
"(",
"self",
",",
"case",
")",
":",
"self",
".",
"format",
"=",
"'xml'",
"self",
".",
"original_xml",
"=",
"False",
"return",
"\"<?xml version='1.0' encoding='utf-8'?>\\n{}\"",
".",
"format",
"(",
"self",
".",
"render_markup",
"(",
"case",
... | https://github.com/harvard-lil/capstone/blob/f15c98fce0b50b74616c40f862146d858b54be5d/capstone/scripts/render_case.py#L282-L289 | |
nylas/sync-engine | b91b94b9a0033be4199006eb234d270779a04443 | inbox/sendmail/smtp/postel.py | python | _substitute_bcc | (raw_message) | return bcc_regexp.sub('', raw_message) | Substitute BCC in raw message. | Substitute BCC in raw message. | [
"Substitute",
"BCC",
"in",
"raw",
"message",
"."
] | def _substitute_bcc(raw_message):
"""
Substitute BCC in raw message.
"""
bcc_regexp = re.compile(r'^Bcc: [^\r\n]*\r\n',
re.IGNORECASE | re.MULTILINE)
return bcc_regexp.sub('', raw_message) | [
"def",
"_substitute_bcc",
"(",
"raw_message",
")",
":",
"bcc_regexp",
"=",
"re",
".",
"compile",
"(",
"r'^Bcc: [^\\r\\n]*\\r\\n'",
",",
"re",
".",
"IGNORECASE",
"|",
"re",
".",
"MULTILINE",
")",
"return",
"bcc_regexp",
".",
"sub",
"(",
"''",
",",
"raw_messag... | https://github.com/nylas/sync-engine/blob/b91b94b9a0033be4199006eb234d270779a04443/inbox/sendmail/smtp/postel.py#L122-L128 | |
kujason/avod | b2d32f6ddd5007c12afe37760fbcff993816da39 | avod/core/anchor_filter.py | python | get_empty_anchor_filter_2d | (anchors, voxel_grid_2d, density_threshold=1) | return anchor_filter | Returns a filter for empty anchors from the given 2D anchor list
Args:
anchors: list of 3d anchors in the format
N x [x, y, z, dim_x, dim_y, dim_z]
voxel_grid_2d: a VoxelGrid object containing a 2D voxel grid of
point cloud used to filter the anchors
density_threshol... | Returns a filter for empty anchors from the given 2D anchor list | [
"Returns",
"a",
"filter",
"for",
"empty",
"anchors",
"from",
"the",
"given",
"2D",
"anchor",
"list"
] | def get_empty_anchor_filter_2d(anchors, voxel_grid_2d, density_threshold=1):
""" Returns a filter for empty anchors from the given 2D anchor list
Args:
anchors: list of 3d anchors in the format
N x [x, y, z, dim_x, dim_y, dim_z]
voxel_grid_2d: a VoxelGrid object containing a 2D voxe... | [
"def",
"get_empty_anchor_filter_2d",
"(",
"anchors",
",",
"voxel_grid_2d",
",",
"density_threshold",
"=",
"1",
")",
":",
"format_checker",
".",
"check_anchor_format",
"(",
"anchors",
")",
"# Remove y dimensions from anchors to project into BEV",
"anchors_2d",
"=",
"anchors"... | https://github.com/kujason/avod/blob/b2d32f6ddd5007c12afe37760fbcff993816da39/avod/core/anchor_filter.py#L64-L119 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/ldap3/abstract/attribute.py | python | WritableAttribute.__repr__ | (self) | return r | [] | def __repr__(self):
filler = ' ' * (len(self.key) + 6)
if len(self.values) == 1:
r = to_stdout_encoding(self.key) + ': ' + to_stdout_encoding(self.values[0])
elif len(self.values) > 1:
r = to_stdout_encoding(self.key) + ': ' + to_stdout_encoding(self.values[0])
... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"filler",
"=",
"' '",
"*",
"(",
"len",
"(",
"self",
".",
"key",
")",
"+",
"6",
")",
"if",
"len",
"(",
"self",
".",
"values",
")",
"==",
"1",
":",
"r",
"=",
"to_stdout_encoding",
"(",
"self",
".",
"key",... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/ldap3/abstract/attribute.py#L140-L152 | |||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/metagoofil/hachoir_parser/misc/ttf.py | python | NameHeader.getCharset | (self) | [] | def getCharset(self):
platform = self["platformID"].value
encoding = self["encodingID"].value
try:
return CHARSET_MAP[platform][encoding]
except KeyError:
self.warning("TTF: Unknown charset (%s,%s)" % (platform, encoding))
return "ISO-8859-1" | [
"def",
"getCharset",
"(",
"self",
")",
":",
"platform",
"=",
"self",
"[",
"\"platformID\"",
"]",
".",
"value",
"encoding",
"=",
"self",
"[",
"\"encodingID\"",
"]",
".",
"value",
"try",
":",
"return",
"CHARSET_MAP",
"[",
"platform",
"]",
"[",
"encoding",
... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_parser/misc/ttf.py#L91-L98 | ||||
rietveld-codereview/rietveld | 82e415f6a291c58c714d3869c7a1de818546c7d5 | third_party/gflags.py | python | Flag._WriteCustomInfoInXMLFormat | (self, outfile, indent) | Writes extra info about this flag, in XML format.
"Extra" means "not already printed by WriteInfoInXMLFormat above."
Args:
outfile: File object we write to.
indent: A string that is prepended to each generated line. | Writes extra info about this flag, in XML format. | [
"Writes",
"extra",
"info",
"about",
"this",
"flag",
"in",
"XML",
"format",
"."
] | def _WriteCustomInfoInXMLFormat(self, outfile, indent):
"""Writes extra info about this flag, in XML format.
"Extra" means "not already printed by WriteInfoInXMLFormat above."
Args:
outfile: File object we write to.
indent: A string that is prepended to each generated line.
"""
# Usual... | [
"def",
"_WriteCustomInfoInXMLFormat",
"(",
"self",
",",
"outfile",
",",
"indent",
")",
":",
"# Usually, the parser knows the extra details about the flag, so",
"# we just forward the call to it.",
"self",
".",
"parser",
".",
"WriteCustomInfoInXMLFormat",
"(",
"outfile",
",",
... | https://github.com/rietveld-codereview/rietveld/blob/82e415f6a291c58c714d3869c7a1de818546c7d5/third_party/gflags.py#L1978-L1989 | ||
genforce/interfacegan | acec139909fb9aad41fbdbbbde651dfc0b7b3a17 | models/stylegan_tf_official/dnnlib/tflib/tfutil.py | python | log2 | (x: TfExpressionEx) | Logarithm in base 2. | Logarithm in base 2. | [
"Logarithm",
"in",
"base",
"2",
"."
] | def log2(x: TfExpressionEx) -> TfExpression:
"""Logarithm in base 2."""
with tf.name_scope("Log2"):
return tf.log(x) * np.float32(1.0 / np.log(2.0)) | [
"def",
"log2",
"(",
"x",
":",
"TfExpressionEx",
")",
"->",
"TfExpression",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"Log2\"",
")",
":",
"return",
"tf",
".",
"log",
"(",
"x",
")",
"*",
"np",
".",
"float32",
"(",
"1.0",
"/",
"np",
".",
"log",
"... | https://github.com/genforce/interfacegan/blob/acec139909fb9aad41fbdbbbde651dfc0b7b3a17/models/stylegan_tf_official/dnnlib/tflib/tfutil.py#L45-L48 | ||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/gfxattribs.py | python | GfxAttribs.__iter__ | (self) | return iter(self.items()) | Returns iter(self). | Returns iter(self). | [
"Returns",
"iter",
"(",
"self",
")",
"."
] | def __iter__(self) -> Iterator[Tuple[str, Any]]:
"""Returns iter(self)."""
return iter(self.items()) | [
"def",
"__iter__",
"(",
"self",
")",
"->",
"Iterator",
"[",
"Tuple",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"iter",
"(",
"self",
".",
"items",
"(",
")",
")"
] | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/gfxattribs.py#L95-L97 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py | python | IResourceProvider.get_resource_stream | (manager, resource_name) | Return a readable file-like object for `resource_name`
`manager` must be an ``IResourceManager`` | Return a readable file-like object for `resource_name` | [
"Return",
"a",
"readable",
"file",
"-",
"like",
"object",
"for",
"resource_name"
] | def get_resource_stream(manager, resource_name):
"""Return a readable file-like object for `resource_name`
`manager` must be an ``IResourceManager``""" | [
"def",
"get_resource_stream",
"(",
"manager",
",",
"resource_name",
")",
":"
] | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L531-L534 | ||
SchrodingersGat/KiBoM | 69e0a305bc1c376cfcbb0998e29cf846284b8734 | kibom/html_writer.py | python | WriteHTML | (filename, groups, net, headings, head_names, prefs) | return True | Write BoM out to a HTML file
filename = path to output file (must be a .htm or .html file)
groups = [list of ComponentGroup groups]
net = netlist object
headings = [list of headings to search for data in the BoM file]
head_names = [list of headings to display in the BoM file]
prefs = BomPref obj... | Write BoM out to a HTML file
filename = path to output file (must be a .htm or .html file)
groups = [list of ComponentGroup groups]
net = netlist object
headings = [list of headings to search for data in the BoM file]
head_names = [list of headings to display in the BoM file]
prefs = BomPref obj... | [
"Write",
"BoM",
"out",
"to",
"a",
"HTML",
"file",
"filename",
"=",
"path",
"to",
"output",
"file",
"(",
"must",
"be",
"a",
".",
"htm",
"or",
".",
"html",
"file",
")",
"groups",
"=",
"[",
"list",
"of",
"ComponentGroup",
"groups",
"]",
"net",
"=",
"n... | def WriteHTML(filename, groups, net, headings, head_names, prefs):
"""
Write BoM out to a HTML file
filename = path to output file (must be a .htm or .html file)
groups = [list of ComponentGroup groups]
net = netlist object
headings = [list of headings to search for data in the BoM file]
hea... | [
"def",
"WriteHTML",
"(",
"filename",
",",
"groups",
",",
"net",
",",
"headings",
",",
"head_names",
",",
"prefs",
")",
":",
"if",
"not",
"filename",
".",
"endswith",
"(",
"\".html\"",
")",
"and",
"not",
"filename",
".",
"endswith",
"(",
"\".htm\"",
")",
... | https://github.com/SchrodingersGat/KiBoM/blob/69e0a305bc1c376cfcbb0998e29cf846284b8734/kibom/html_writer.py#L35-L193 | |
timvieira/arsenal | 3a626722f46fd7ef6768abfdffc0eb28cae7dfa2 | arsenal/viz/util.py | python | update_ax | (ax, clear=True) | Manages clearing and updating a plot. | Manages clearing and updating a plot. | [
"Manages",
"clearing",
"and",
"updating",
"a",
"plot",
"."
] | def update_ax(ax, clear=True):
"Manages clearing and updating a plot."
if not hasattr(ax, '_did_show'):
ax._did_show = False
if clear:
ax.clear()
yield
for _ in range(2):
try:
ax.figure.canvas.draw_idle()
ax.figure.canvas.flush_events()
if ... | [
"def",
"update_ax",
"(",
"ax",
",",
"clear",
"=",
"True",
")",
":",
"if",
"not",
"hasattr",
"(",
"ax",
",",
"'_did_show'",
")",
":",
"ax",
".",
"_did_show",
"=",
"False",
"if",
"clear",
":",
"ax",
".",
"clear",
"(",
")",
"yield",
"for",
"_",
"in"... | https://github.com/timvieira/arsenal/blob/3a626722f46fd7ef6768abfdffc0eb28cae7dfa2/arsenal/viz/util.py#L229-L245 | ||
inasafe/inasafe | 355eb2ce63f516b9c26af0c86a24f99e53f63f87 | safe/plugin.py | python | Plugin.show_minimum_needs | (self) | Show the minimum needs dialog. | Show the minimum needs dialog. | [
"Show",
"the",
"minimum",
"needs",
"dialog",
"."
] | def show_minimum_needs(self):
"""Show the minimum needs dialog."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.minimum_needs.needs_calculator_dialog import (
NeedsCalculatorDialog
)
dialog = NeedsCalculatorDialog(self.iface.mainWindow())
... | [
"def",
"show_minimum_needs",
"(",
"self",
")",
":",
"# import here only so that it is AFTER i18n set up",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"minimum_needs",
".",
"needs_calculator_dialog",
"import",
"(",
"NeedsCalculatorDialog",
")",
"dialog",
"=",
"NeedsCa... | https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/plugin.py#L761-L769 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/plat-mac/aepack.py | python | mktype | (typecode, modulename=None) | return aetypes.mktype(typecode) | [] | def mktype(typecode, modulename=None):
if modulename:
module = __import__(modulename)
codenamemapper = module._classdeclarations
classtype = codenamemapper.get(typecode, None)
if classtype:
return classtype
return aetypes.mktype(typecode) | [
"def",
"mktype",
"(",
"typecode",
",",
"modulename",
"=",
"None",
")",
":",
"if",
"modulename",
":",
"module",
"=",
"__import__",
"(",
"modulename",
")",
"codenamemapper",
"=",
"module",
".",
"_classdeclarations",
"classtype",
"=",
"codenamemapper",
".",
"get"... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/plat-mac/aepack.py#L362-L369 | |||
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/Rotten-Tomatoes/PyAl/Request/requests/packages/oauthlib/oauth2/draft25/utils.py | python | host_from_uri | (uri) | return netloc, port | Extract hostname and port from URI.
Will use default port for HTTP and HTTPS if none is present in the URI. | Extract hostname and port from URI. | [
"Extract",
"hostname",
"and",
"port",
"from",
"URI",
"."
] | def host_from_uri(uri):
"""Extract hostname and port from URI.
Will use default port for HTTP and HTTPS if none is present in the URI.
"""
default_ports = {
u'HTTP': u'80',
u'HTTPS': u'443',
}
sch, netloc, path, par, query, fra = urlparse.urlparse(uri)
if u':' in netloc:
... | [
"def",
"host_from_uri",
"(",
"uri",
")",
":",
"default_ports",
"=",
"{",
"u'HTTP'",
":",
"u'80'",
",",
"u'HTTPS'",
":",
"u'443'",
",",
"}",
"sch",
",",
"netloc",
",",
"path",
",",
"par",
",",
"query",
",",
"fra",
"=",
"urlparse",
".",
"urlparse",
"("... | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/Rotten-Tomatoes/PyAl/Request/requests/packages/oauthlib/oauth2/draft25/utils.py#L12-L28 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/filedb/filestore.py | python | FileStorage.__repr__ | (self) | return "%s(%r)" % (self.__class__.__name__, self.folder) | [] | def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.folder) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"%s(%r)\"",
"%",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"folder",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/filedb/filestore.py#L404-L405 | |||
ProgVal/Limnoria | 181e34baf90a8cabc281e8349da6e36e1e558608 | plugins/Status/plugin.py | python | Status.cpu | (self, irc, msg, args) | takes no arguments
Returns some interesting CPU-related statistics on the bot. | takes no arguments | [
"takes",
"no",
"arguments"
] | def cpu(self, irc, msg, args):
"""takes no arguments
Returns some interesting CPU-related statistics on the bot.
"""
(user, system, childUser, childSystem, elapsed) = os.times()
now = time.time()
target = (msg.channel, irc.network)
timeRunning = now - world.start... | [
"def",
"cpu",
"(",
"self",
",",
"irc",
",",
"msg",
",",
"args",
")",
":",
"(",
"user",
",",
"system",
",",
"childUser",
",",
"childSystem",
",",
"elapsed",
")",
"=",
"os",
".",
"times",
"(",
")",
"now",
"=",
"time",
".",
"time",
"(",
")",
"targ... | https://github.com/ProgVal/Limnoria/blob/181e34baf90a8cabc281e8349da6e36e1e558608/plugins/Status/plugin.py#L137-L190 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/pydoc.py | python | Doc.fail | (self, object, name=None, *args) | Raise an exception for unimplemented types. | Raise an exception for unimplemented types. | [
"Raise",
"an",
"exception",
"for",
"unimplemented",
"types",
"."
] | def fail(self, object, name=None, *args):
"""Raise an exception for unimplemented types."""
message = "don't know how to document object%s of type %s" % (
name and ' ' + repr(name), type(object).__name__)
raise TypeError, message | [
"def",
"fail",
"(",
"self",
",",
"object",
",",
"name",
"=",
"None",
",",
"*",
"args",
")",
":",
"message",
"=",
"\"don't know how to document object%s of type %s\"",
"%",
"(",
"name",
"and",
"' '",
"+",
"repr",
"(",
"name",
")",
",",
"type",
"(",
"objec... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/pydoc.py#L337-L341 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/library/openshift_cert_expiry.py | python | FakeOpenSSLCertificate.__init__ | (self, cert_string) | `cert_string` is a certificate in the form you get from running a
.crt through 'openssl x509 -in CERT.cert -text | `cert_string` is a certificate in the form you get from running a
.crt through 'openssl x509 -in CERT.cert -text | [
"cert_string",
"is",
"a",
"certificate",
"in",
"the",
"form",
"you",
"get",
"from",
"running",
"a",
".",
"crt",
"through",
"openssl",
"x509",
"-",
"in",
"CERT",
".",
"cert",
"-",
"text"
] | def __init__(self, cert_string):
"""`cert_string` is a certificate in the form you get from running a
.crt through 'openssl x509 -in CERT.cert -text'"""
self.cert_string = cert_string
self.serial = None
self.subject = None
self.extensions = []
self.not_after = None
... | [
"def",
"__init__",
"(",
"self",
",",
"cert_string",
")",
":",
"self",
".",
"cert_string",
"=",
"cert_string",
"self",
".",
"serial",
"=",
"None",
"self",
".",
"subject",
"=",
"None",
"self",
".",
"extensions",
"=",
"[",
"]",
"self",
".",
"not_after",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/library/openshift_cert_expiry.py#L93-L101 | ||
replicahq/doppelganger | dc4709b87d48794b48c05d9776fb606fad4a8038 | doppelganger/marginals.py | python | Marginals.write | (self, outfile) | Write marginals to the given file
Args:
outfile (unicode): path to write to | Write marginals to the given file | [
"Write",
"marginals",
"to",
"the",
"given",
"file"
] | def write(self, outfile):
"""Write marginals to the given file
Args:
outfile (unicode): path to write to
"""
self.data.to_csv(outfile) | [
"def",
"write",
"(",
"self",
",",
"outfile",
")",
":",
"self",
".",
"data",
".",
"to_csv",
"(",
"outfile",
")"
] | https://github.com/replicahq/doppelganger/blob/dc4709b87d48794b48c05d9776fb606fad4a8038/doppelganger/marginals.py#L211-L218 | ||
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/distutils/command/build_py.py | python | build_py.build_package_data | (self) | Copy data files into build directory | Copy data files into build directory | [
"Copy",
"data",
"files",
"into",
"build",
"directory"
] | def build_package_data(self):
"""Copy data files into build directory"""
lastdir = None
for package, src_dir, build_dir, filenames in self.data_files:
for filename in filenames:
target = os.path.join(build_dir, filename)
self.mkpath(os.path.dirname(tar... | [
"def",
"build_package_data",
"(",
"self",
")",
":",
"lastdir",
"=",
"None",
"for",
"package",
",",
"src_dir",
",",
"build_dir",
",",
"filenames",
"in",
"self",
".",
"data_files",
":",
"for",
"filename",
"in",
"filenames",
":",
"target",
"=",
"os",
".",
"... | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/distutils/command/build_py.py#L134-L142 | ||
dbt-labs/dbt-core | e943b9fc842535e958ef4fd0b8703adc91556bc6 | scripts/werkzeug-refresh-token.py | python | _make_response | (client_id, client_secret, refresh_token) | return Response(textwrap.dedent(
f'''\
SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN="{refresh_token}"
SNOWFLAKE_TEST_OAUTH_CLIENT_ID="{client_id}"
SNOWFLAKE_TEST_OAUTH_CLIENT_SECRET="{client_secret}"'''
)) | [] | def _make_response(client_id, client_secret, refresh_token):
return Response(textwrap.dedent(
f'''\
SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN="{refresh_token}"
SNOWFLAKE_TEST_OAUTH_CLIENT_ID="{client_id}"
SNOWFLAKE_TEST_OAUTH_CLIENT_SECRET="{client_secret}"'''
)) | [
"def",
"_make_response",
"(",
"client_id",
",",
"client_secret",
",",
"refresh_token",
")",
":",
"return",
"Response",
"(",
"textwrap",
".",
"dedent",
"(",
"f'''\\\n SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN=\"{refresh_token}\"\n SNOWFLAKE_TEST_OAUTH_CLIENT_ID=\"{client_id}\... | https://github.com/dbt-labs/dbt-core/blob/e943b9fc842535e958ef4fd0b8703adc91556bc6/scripts/werkzeug-refresh-token.py#L21-L27 | |||
rwightman/pytorch-image-models | ccfeb06936549f19c453b7f1f27e8e632cfbe1c2 | timm/models/gluon_resnet.py | python | gluon_resnet50_v1s | (pretrained=False, **kwargs) | return _create_resnet('gluon_resnet50_v1s', pretrained, **model_args) | Constructs a ResNet-50 model. | Constructs a ResNet-50 model. | [
"Constructs",
"a",
"ResNet",
"-",
"50",
"model",
"."
] | def gluon_resnet50_v1s(pretrained=False, **kwargs):
"""Constructs a ResNet-50 model.
"""
model_args = dict(
block=Bottleneck, layers=[3, 4, 6, 3], stem_width=64, stem_type='deep', **kwargs)
return _create_resnet('gluon_resnet50_v1s', pretrained, **model_args) | [
"def",
"gluon_resnet50_v1s",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model_args",
"=",
"dict",
"(",
"block",
"=",
"Bottleneck",
",",
"layers",
"=",
"[",
"3",
",",
"4",
",",
"6",
",",
"3",
"]",
",",
"stem_width",
"=",
"6... | https://github.com/rwightman/pytorch-image-models/blob/ccfeb06936549f19c453b7f1f27e8e632cfbe1c2/timm/models/gluon_resnet.py#L159-L164 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/macpath.py | python | join | (s, *p) | return path | [] | def join(s, *p):
path = s
for t in p:
if (not path) or isabs(t):
path = t
continue
if t[:1] == ':':
t = t[1:]
if ':' not in path:
path = ':' + path
if path[-1:] != ':':
path = path + ':'
path = path + t
retur... | [
"def",
"join",
"(",
"s",
",",
"*",
"p",
")",
":",
"path",
"=",
"s",
"for",
"t",
"in",
"p",
":",
"if",
"(",
"not",
"path",
")",
"or",
"isabs",
"(",
"t",
")",
":",
"path",
"=",
"t",
"continue",
"if",
"t",
"[",
":",
"1",
"]",
"==",
"':'",
... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/macpath.py#L43-L56 | |||
xjsender/haoide | 717dd706db1169bfc41e818ac6fc6cd9a0aef12d | util.py | python | is_python3x | () | return sys.version > '3' | If python version is 3.x, return True | If python version is 3.x, return True | [
"If",
"python",
"version",
"is",
"3",
".",
"x",
"return",
"True"
] | def is_python3x():
"""
If python version is 3.x, return True
"""
return sys.version > '3' | [
"def",
"is_python3x",
"(",
")",
":",
"return",
"sys",
".",
"version",
">",
"'3'"
] | https://github.com/xjsender/haoide/blob/717dd706db1169bfc41e818ac6fc6cd9a0aef12d/util.py#L2033-L2038 | |
Yelp/mrjob | 091572e87bc24cc64be40278dd0f5c3617c98d4b | mrjob/bin.py | python | MRJobBinRunner._spark_script_path | (self, step_num) | return self._interpolate_spark_script_path(path) | The path of the spark script or JAR, used by
_args_for_spark_step(). | The path of the spark script or JAR, used by
_args_for_spark_step(). | [
"The",
"path",
"of",
"the",
"spark",
"script",
"or",
"JAR",
"used",
"by",
"_args_for_spark_step",
"()",
"."
] | def _spark_script_path(self, step_num):
"""The path of the spark script or JAR, used by
_args_for_spark_step()."""
step = self._get_step(step_num)
if step['type'] == 'spark':
path = self._script_path
elif step['type'] == 'spark_jar':
path = step['jar']
... | [
"def",
"_spark_script_path",
"(",
"self",
",",
"step_num",
")",
":",
"step",
"=",
"self",
".",
"_get_step",
"(",
"step_num",
")",
"if",
"step",
"[",
"'type'",
"]",
"==",
"'spark'",
":",
"path",
"=",
"self",
".",
"_script_path",
"elif",
"step",
"[",
"'t... | https://github.com/Yelp/mrjob/blob/091572e87bc24cc64be40278dd0f5c3617c98d4b/mrjob/bin.py#L996-L1010 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/pyclbr.py | python | _ModuleBrowser.visit_ImportFrom | (self, node) | [] | def visit_ImportFrom(self, node):
if node.col_offset != 0:
return
try:
module = "." * node.level
if node.module:
module += node.module
module = _readmodule(module, self.path, self.inpackage)
except (ImportError, SyntaxError):
... | [
"def",
"visit_ImportFrom",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
".",
"col_offset",
"!=",
"0",
":",
"return",
"try",
":",
"module",
"=",
"\".\"",
"*",
"node",
".",
"level",
"if",
"node",
".",
"module",
":",
"module",
"+=",
"node",
".",
... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/pyclbr.py#L248-L266 | ||||
automl/ConfigSpace | 4d69931de5540fc6be4230731ddebf6a25d2e1a8 | ConfigSpace/nx/classes/graph.py | python | Graph.is_multigraph | (self) | return False | Return True if graph is a multigraph, False otherwise. | Return True if graph is a multigraph, False otherwise. | [
"Return",
"True",
"if",
"graph",
"is",
"a",
"multigraph",
"False",
"otherwise",
"."
] | def is_multigraph(self):
"""Return True if graph is a multigraph, False otherwise."""
return False | [
"def",
"is_multigraph",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/automl/ConfigSpace/blob/4d69931de5540fc6be4230731ddebf6a25d2e1a8/ConfigSpace/nx/classes/graph.py#L1340-L1342 | |
rizar/attention-lvcsr | 1ae52cafdd8419874846f9544a299eef9c758f3b | libs/Theano/theano/tensor/opt.py | python | get_clients2 | (node) | return l | Used by erf/erfc opt to track less frequent op. | Used by erf/erfc opt to track less frequent op. | [
"Used",
"by",
"erf",
"/",
"erfc",
"opt",
"to",
"track",
"less",
"frequent",
"op",
"."
] | def get_clients2(node):
"""
Used by erf/erfc opt to track less frequent op.
"""
l = []
for c, i in node.outputs[0].clients:
if c != "output":
for var in c.outputs:
l.extend([cc for cc, ii in var.clients if cc != "output"])
return l | [
"def",
"get_clients2",
"(",
"node",
")",
":",
"l",
"=",
"[",
"]",
"for",
"c",
",",
"i",
"in",
"node",
".",
"outputs",
"[",
"0",
"]",
".",
"clients",
":",
"if",
"c",
"!=",
"\"output\"",
":",
"for",
"var",
"in",
"c",
".",
"outputs",
":",
"l",
"... | https://github.com/rizar/attention-lvcsr/blob/1ae52cafdd8419874846f9544a299eef9c758f3b/libs/Theano/theano/tensor/opt.py#L5837-L5847 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/Digital_Defense_FrontlineVM/Integrations/Digital_Defense_FrontlineVM/Digital_Defense_FrontlineVM.py | python | ip_number_to_address | (ip_number) | return socket.inet_ntoa(struct.pack("!L", ip_number)) | Convert a 32-bit packed IPv4 address (a bytes-like object four bytes in length)
to its standard dotted-quad string representation.
This is specifically used for creating scan payloads when sending POST requests using
our FrontlineVM API within the build_scan method. | Convert a 32-bit packed IPv4 address (a bytes-like object four bytes in length)
to its standard dotted-quad string representation. | [
"Convert",
"a",
"32",
"-",
"bit",
"packed",
"IPv4",
"address",
"(",
"a",
"bytes",
"-",
"like",
"object",
"four",
"bytes",
"in",
"length",
")",
"to",
"its",
"standard",
"dotted",
"-",
"quad",
"string",
"representation",
"."
] | def ip_number_to_address(ip_number):
'''
Convert a 32-bit packed IPv4 address (a bytes-like object four bytes in length)
to its standard dotted-quad string representation.
This is specifically used for creating scan payloads when sending POST requests using
our FrontlineVM API withi... | [
"def",
"ip_number_to_address",
"(",
"ip_number",
")",
":",
"return",
"socket",
".",
"inet_ntoa",
"(",
"struct",
".",
"pack",
"(",
"\"!L\"",
",",
"ip_number",
")",
")"
] | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/Digital_Defense_FrontlineVM/Integrations/Digital_Defense_FrontlineVM/Digital_Defense_FrontlineVM.py#L498-L506 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/gdata/src/gdata/docs/client.py | python | DocsClient.request | (self, method=None, uri=None, **kwargs) | return super(DocsClient, self).request(method=method, uri=uri, **kwargs) | Add support for imitating other users via 2-Legged OAuth.
Args:
uri: (optional) URI of the request in which to replace default with
self.xoauth_requestor_id.
Returns:
Result of super(DocsClient, self).request(). | Add support for imitating other users via 2-Legged OAuth. | [
"Add",
"support",
"for",
"imitating",
"other",
"users",
"via",
"2",
"-",
"Legged",
"OAuth",
"."
] | def request(self, method=None, uri=None, **kwargs):
"""Add support for imitating other users via 2-Legged OAuth.
Args:
uri: (optional) URI of the request in which to replace default with
self.xoauth_requestor_id.
Returns:
Result of super(DocsClient, self).request().
"""
if sel... | [
"def",
"request",
"(",
"self",
",",
"method",
"=",
"None",
",",
"uri",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"xoauth_requestor_id",
"is",
"not",
"None",
"and",
"uri",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/docs/client.py#L54-L67 | |
webpy/webpy.github.com | c6ccc32b6581edcc1b3e5991ad8cc30df14b5632 | static/web-0.133.py | python | header | (h, v) | Adds the header `h: v` with the response. | Adds the header `h: v` with the response. | [
"Adds",
"the",
"header",
"h",
":",
"v",
"with",
"the",
"response",
"."
] | def header(h, v):
"""Adds the header `h: v` with the response."""
context.headers.append((h, v)) | [
"def",
"header",
"(",
"h",
",",
"v",
")",
":",
"context",
".",
"headers",
".",
"append",
"(",
"(",
"h",
",",
"v",
")",
")"
] | https://github.com/webpy/webpy.github.com/blob/c6ccc32b6581edcc1b3e5991ad8cc30df14b5632/static/web-0.133.py#L1305-L1307 | ||
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/duration.py | python | Test.testCopyAndDeepcopy | (self) | Test copying all objects defined in this module | Test copying all objects defined in this module | [
"Test",
"copying",
"all",
"objects",
"defined",
"in",
"this",
"module"
] | def testCopyAndDeepcopy(self):
'''Test copying all objects defined in this module
'''
import sys
import types
for part in sys.modules[self.__module__].__dict__:
match = False
for skip in ['_', '__', 'Test', 'Exception']:
if part.startswith(... | [
"def",
"testCopyAndDeepcopy",
"(",
"self",
")",
":",
"import",
"sys",
"import",
"types",
"for",
"part",
"in",
"sys",
".",
"modules",
"[",
"self",
".",
"__module__",
"]",
".",
"__dict__",
":",
"match",
"=",
"False",
"for",
"skip",
"in",
"[",
"'_'",
",",... | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/duration.py#L3365-L3385 | ||
akfamily/akshare | 590e50eece9ec067da3538c7059fd660b71f1339 | akshare/fund/fund_em.py | python | fund_em_money_fund_info | (fund: str = "000009") | return temp_df | 东方财富网-天天基金网-基金数据-货币型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_004186.html
:param fund: 货币型基金代码, 可以通过 fund_em_money_fund_daily 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-货币型基金收益-历史净值数据
:rtype: pandas.DataFrame | 东方财富网-天天基金网-基金数据-货币型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_004186.html
:param fund: 货币型基金代码, 可以通过 fund_em_money_fund_daily 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-货币型基金收益-历史净值数据
:rtype: pandas.DataFrame | [
"东方财富网",
"-",
"天天基金网",
"-",
"基金数据",
"-",
"货币型基金收益",
"-",
"历史净值数据",
"http",
":",
"//",
"fundf10",
".",
"eastmoney",
".",
"com",
"/",
"jjjz_004186",
".",
"html",
":",
"param",
"fund",
":",
"货币型基金代码",
"可以通过",
"fund_em_money_fund_daily",
"来获取",
":",
"type",
... | def fund_em_money_fund_info(fund: str = "000009") -> pd.DataFrame:
"""
东方财富网-天天基金网-基金数据-货币型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_004186.html
:param fund: 货币型基金代码, 可以通过 fund_em_money_fund_daily 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-货币型基金收益-历史净值数据
:rtype: pandas.DataFrame
... | [
"def",
"fund_em_money_fund_info",
"(",
"fund",
":",
"str",
"=",
"\"000009\"",
")",
"->",
"pd",
".",
"DataFrame",
":",
"url",
"=",
"\"http://api.fund.eastmoney.com/f10/lsjz\"",
"headers",
"=",
"{",
"\"User-Agent\"",
":",
"\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWe... | https://github.com/akfamily/akshare/blob/590e50eece9ec067da3538c7059fd660b71f1339/akshare/fund/fund_em.py#L406-L449 | |
malwaredllc/byob | 3924dd6aea6d0421397cdf35f692933b340bfccf | web-gui/buildyourownbotnet/main/routes.py | python | faq | () | return render_template("faq.html", title="FAQ") | FAQ page. | FAQ page. | [
"FAQ",
"page",
"."
] | def faq():
"""FAQ page."""
return render_template("faq.html", title="FAQ") | [
"def",
"faq",
"(",
")",
":",
"return",
"render_template",
"(",
"\"faq.html\"",
",",
"title",
"=",
"\"FAQ\"",
")"
] | https://github.com/malwaredllc/byob/blob/3924dd6aea6d0421397cdf35f692933b340bfccf/web-gui/buildyourownbotnet/main/routes.py#L78-L80 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/alembic/runtime/migration.py | python | StampStep.should_delete_branch | (self, heads) | return self.is_downgrade and self.branch_move | [] | def should_delete_branch(self, heads):
return self.is_downgrade and self.branch_move | [
"def",
"should_delete_branch",
"(",
"self",
",",
"heads",
")",
":",
"return",
"self",
".",
"is_downgrade",
"and",
"self",
".",
"branch_move"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/alembic/runtime/migration.py#L969-L970 | |||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | official/nlp/xlnet/squad_utils.py | python | create_eval_data | (spm_basename,
sp_model,
eval_examples,
max_seq_length,
max_query_length,
doc_stride,
uncased,
output_dir=None) | return eval_features | Creates evaluation tfrecords. | Creates evaluation tfrecords. | [
"Creates",
"evaluation",
"tfrecords",
"."
] | def create_eval_data(spm_basename,
sp_model,
eval_examples,
max_seq_length,
max_query_length,
doc_stride,
uncased,
output_dir=None):
"""Creates evaluation tfrecords."""
... | [
"def",
"create_eval_data",
"(",
"spm_basename",
",",
"sp_model",
",",
"eval_examples",
",",
"max_seq_length",
",",
"max_query_length",
",",
"doc_stride",
",",
"uncased",
",",
"output_dir",
"=",
"None",
")",
":",
"eval_features",
"=",
"[",
"]",
"eval_writer",
"="... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/nlp/xlnet/squad_utils.py#L928-L972 | |
jinfagang/alfred | dd7420d1410f82f9dadf07a30b6fad5a71168001 | alfred/fusion/common.py | python | _corners_nd | (dims, origin=0.5) | return corners | [] | def _corners_nd(dims, origin=0.5):
ndim = int(dims.shape[1])
corners_norm = np.stack(
np.unravel_index(np.arange(2 ** ndim), [2] * ndim),
axis=1).astype(dims.dtype)
# now corners_norm has format: (2d) x0y0, x0y1, x1y0, x1y1
# (3d) x0y0z0, x0y0z1, x0y1z0, x0y1z1, x1y0z0, x1y0z1, x1y1z0, x... | [
"def",
"_corners_nd",
"(",
"dims",
",",
"origin",
"=",
"0.5",
")",
":",
"ndim",
"=",
"int",
"(",
"dims",
".",
"shape",
"[",
"1",
"]",
")",
"corners_norm",
"=",
"np",
".",
"stack",
"(",
"np",
".",
"unravel_index",
"(",
"np",
".",
"arange",
"(",
"2... | https://github.com/jinfagang/alfred/blob/dd7420d1410f82f9dadf07a30b6fad5a71168001/alfred/fusion/common.py#L136-L154 | |||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/util/cache_utils.py | python | is_rate_limited | (rate_limit_key) | return ExponentialBackoff.should_backoff(rate_limit_key) | [] | def is_rate_limited(rate_limit_key):
ExponentialBackoff.increment(rate_limit_key)
return ExponentialBackoff.should_backoff(rate_limit_key) | [
"def",
"is_rate_limited",
"(",
"rate_limit_key",
")",
":",
"ExponentialBackoff",
".",
"increment",
"(",
"rate_limit_key",
")",
"return",
"ExponentialBackoff",
".",
"should_backoff",
"(",
"rate_limit_key",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/util/cache_utils.py#L60-L62 | |||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/git.py | python | rev_parse | (
cwd,
rev=None,
opts="",
git_opts="",
user=None,
password=None,
ignore_retcode=False,
output_encoding=None,
) | return _git_run(
command,
cwd=cwd,
user=user,
password=password,
ignore_retcode=ignore_retcode,
output_encoding=output_encoding,
)["stdout"] | .. versionadded:: 2015.8.0
Interface to `git-rev-parse(1)`_
cwd
The path to the git checkout
rev
Revision to parse. See the `SPECIFYING REVISIONS`_ section of the
`git-rev-parse(1)`_ manpage for details on how to format this argument.
This argument is optional when using ... | .. versionadded:: 2015.8.0 | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | def rev_parse(
cwd,
rev=None,
opts="",
git_opts="",
user=None,
password=None,
ignore_retcode=False,
output_encoding=None,
):
"""
.. versionadded:: 2015.8.0
Interface to `git-rev-parse(1)`_
cwd
The path to the git checkout
rev
Revision to parse. See ... | [
"def",
"rev_parse",
"(",
"cwd",
",",
"rev",
"=",
"None",
",",
"opts",
"=",
"\"\"",
",",
"git_opts",
"=",
"\"\"",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"ignore_retcode",
"=",
"False",
",",
"output_encoding",
"=",
"None",
",",
")... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/git.py#L4427-L4524 | |
fkie/multimaster_fkie | 3d23df29d25d71a75c66bbd3cc6e9cbb255724d8 | fkie_master_discovery/src/fkie_master_discovery/master_info.py | python | NodeInfo.copy | (self, new_masteruri=None) | return result | Creates a copy of this object and returns it.
:param new_masteruri: the masteruri of the new masterinfo
:rtype: :mod:`fkie_master_discovery.master_info.NodeInfo` | Creates a copy of this object and returns it. | [
"Creates",
"a",
"copy",
"of",
"this",
"object",
"and",
"returns",
"it",
"."
] | def copy(self, new_masteruri=None):
'''
Creates a copy of this object and returns it.
:param new_masteruri: the masteruri of the new masterinfo
:rtype: :mod:`fkie_master_discovery.master_info.NodeInfo`
'''
if new_masteruri is None:
new_masteruri = self.master... | [
"def",
"copy",
"(",
"self",
",",
"new_masteruri",
"=",
"None",
")",
":",
"if",
"new_masteruri",
"is",
"None",
":",
"new_masteruri",
"=",
"self",
".",
"masteruri",
"result",
"=",
"NodeInfo",
"(",
"self",
".",
"name",
",",
"new_masteruri",
")",
"result",
"... | https://github.com/fkie/multimaster_fkie/blob/3d23df29d25d71a75c66bbd3cc6e9cbb255724d8/fkie_master_discovery/src/fkie_master_discovery/master_info.py#L244-L260 | |
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/GridCal/Gui/Main/GridCalMain.py | python | MainGUI.highlight_based_on_property | (self) | Highlight and select the buses of the selected objects | Highlight and select the buses of the selected objects | [
"Highlight",
"and",
"select",
"the",
"buses",
"of",
"the",
"selected",
"objects"
] | def highlight_based_on_property(self):
"""
Highlight and select the buses of the selected objects
"""
model = self.ui.dataStructureTableView.model()
if model is not None:
objects = model.objects
if len(objects) > 0:
elm = objects[0]
... | [
"def",
"highlight_based_on_property",
"(",
"self",
")",
":",
"model",
"=",
"self",
".",
"ui",
".",
"dataStructureTableView",
".",
"model",
"(",
")",
"if",
"model",
"is",
"not",
"None",
":",
"objects",
"=",
"model",
".",
"objects",
"if",
"len",
"(",
"obje... | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Gui/Main/GridCalMain.py#L6127-L6190 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/distutils/dir_util.py | python | remove_tree | (directory, verbose=1, dry_run=0) | Recursively remove an entire directory tree.
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true). | Recursively remove an entire directory tree. | [
"Recursively",
"remove",
"an",
"entire",
"directory",
"tree",
"."
] | def remove_tree(directory, verbose=1, dry_run=0):
"""Recursively remove an entire directory tree.
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true).
"""
from distutils.util import grok_environment_error
global _path_created
if verbose >= 1:
log.info(... | [
"def",
"remove_tree",
"(",
"directory",
",",
"verbose",
"=",
"1",
",",
"dry_run",
"=",
"0",
")",
":",
"from",
"distutils",
".",
"util",
"import",
"grok_environment_error",
"global",
"_path_created",
"if",
"verbose",
">=",
"1",
":",
"log",
".",
"info",
"(",... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/distutils/dir_util.py#L178-L202 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/cloud/__init__.py | python | Cloud.image_list | (self, lookup="all") | return data | Return a mapping of all image data for available providers | Return a mapping of all image data for available providers | [
"Return",
"a",
"mapping",
"of",
"all",
"image",
"data",
"for",
"available",
"providers"
] | def image_list(self, lookup="all"):
"""
Return a mapping of all image data for available providers
"""
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
fun = "{}.avail_images".for... | [
"def",
"image_list",
"(",
"self",
",",
"lookup",
"=",
"\"all\"",
")",
":",
"data",
"=",
"{",
"}",
"lookups",
"=",
"self",
".",
"lookup_providers",
"(",
"lookup",
")",
"if",
"not",
"lookups",
":",
"return",
"data",
"for",
"alias",
",",
"driver",
"in",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/cloud/__init__.py#L833-L871 | |
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/htmllib.py | python | HTMLParser.save_end | (self) | return data | Ends buffering character data and returns all data saved since
the preceding call to the save_bgn() method.
If the nofill flag is false, whitespace is collapsed to single
spaces. A call to this method without a preceding call to the
save_bgn() method will raise a TypeError exception. | Ends buffering character data and returns all data saved since
the preceding call to the save_bgn() method. | [
"Ends",
"buffering",
"character",
"data",
"and",
"returns",
"all",
"data",
"saved",
"since",
"the",
"preceding",
"call",
"to",
"the",
"save_bgn",
"()",
"method",
"."
] | def save_end(self):
"""Ends buffering character data and returns all data saved since
the preceding call to the save_bgn() method.
If the nofill flag is false, whitespace is collapsed to single
spaces. A call to this method without a preceding call to the
save_bgn() method will... | [
"def",
"save_end",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"savedata",
"self",
".",
"savedata",
"=",
"None",
"if",
"not",
"self",
".",
"nofill",
":",
"data",
"=",
"' '",
".",
"join",
"(",
"data",
".",
"split",
"(",
")",
")",
"return",
"d... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/htmllib.py#L84-L97 | |
tensorflow/tfx | b4a6b83269815ed12ba9df9e9154c7376fef2ea0 | tfx/orchestration/portable/partial_run_utils.py | python | _compute_nodes_to_run | (
node_map: 'collections.OrderedDict[str, pipeline_pb2.PipelineNode]',
from_node_ids: Collection[str], to_node_ids: Collection[str],
skip_node_ids: Collection[str]) | return nodes_considered_to_run.intersection(nodes_to_run) | Returns the set of nodes between from_node_ids and to_node_ids. | Returns the set of nodes between from_node_ids and to_node_ids. | [
"Returns",
"the",
"set",
"of",
"nodes",
"between",
"from_node_ids",
"and",
"to_node_ids",
"."
] | def _compute_nodes_to_run(
node_map: 'collections.OrderedDict[str, pipeline_pb2.PipelineNode]',
from_node_ids: Collection[str], to_node_ids: Collection[str],
skip_node_ids: Collection[str]) -> Set[str]:
"""Returns the set of nodes between from_node_ids and to_node_ids."""
ancestors_of_to_nodes = _traver... | [
"def",
"_compute_nodes_to_run",
"(",
"node_map",
":",
"'collections.OrderedDict[str, pipeline_pb2.PipelineNode]'",
",",
"from_node_ids",
":",
"Collection",
"[",
"str",
"]",
",",
"to_node_ids",
":",
"Collection",
"[",
"str",
"]",
",",
"skip_node_ids",
":",
"Collection",
... | https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/orchestration/portable/partial_run_utils.py#L316-L328 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/lib-tk/Tkinter.py | python | Wm.wm_resizable | (self, width=None, height=None) | return self.tk.call('wm', 'resizable', self._w, width, height) | Instruct the window manager whether this width can be resized
in WIDTH or HEIGHT. Both values are boolean values. | Instruct the window manager whether this width can be resized
in WIDTH or HEIGHT. Both values are boolean values. | [
"Instruct",
"the",
"window",
"manager",
"whether",
"this",
"width",
"can",
"be",
"resized",
"in",
"WIDTH",
"or",
"HEIGHT",
".",
"Both",
"values",
"are",
"boolean",
"values",
"."
] | def wm_resizable(self, width=None, height=None):
"""Instruct the window manager whether this width can be resized
in WIDTH or HEIGHT. Both values are boolean values."""
return self.tk.call('wm', 'resizable', self._w, width, height) | [
"def",
"wm_resizable",
"(",
"self",
",",
"width",
"=",
"None",
",",
"height",
"=",
"None",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'wm'",
",",
"'resizable'",
",",
"self",
".",
"_w",
",",
"width",
",",
"height",
")"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/lib-tk/Tkinter.py#L1769-L1772 | |
firewalld/firewalld | 368e5a1e3eeff21ed55d4f2549836d45d8636ab5 | src/firewall/core/ipXtables.py | python | common_check_passthrough | (args) | Check if passthough rule is valid (only add, insert and new chain
rules are allowed) | Check if passthough rule is valid (only add, insert and new chain
rules are allowed) | [
"Check",
"if",
"passthough",
"rule",
"is",
"valid",
"(",
"only",
"add",
"insert",
"and",
"new",
"chain",
"rules",
"are",
"allowed",
")"
] | def common_check_passthrough(args):
""" Check if passthough rule is valid (only add, insert and new chain
rules are allowed) """
args = set(args)
not_allowed = set(["-C", "--check", # check rule
"-D", "--delete", # delete rule
"-R", "--re... | [
"def",
"common_check_passthrough",
"(",
"args",
")",
":",
"args",
"=",
"set",
"(",
"args",
")",
"not_allowed",
"=",
"set",
"(",
"[",
"\"-C\"",
",",
"\"--check\"",
",",
"# check rule",
"\"-D\"",
",",
"\"--delete\"",
",",
"# delete rule",
"\"-R\"",
",",
"\"--r... | https://github.com/firewalld/firewalld/blob/368e5a1e3eeff21ed55d4f2549836d45d8636ab5/src/firewall/core/ipXtables.py#L137-L167 | ||
openstack/horizon | 12bb9fe5184c9dd3329ba17b3d03c90887dbcc3d | horizon/tables/actions.py | python | FilterAction.is_api_filter | (self, filter_field) | return False | Determine if agiven filter field should be used as an API filter. | Determine if agiven filter field should be used as an API filter. | [
"Determine",
"if",
"agiven",
"filter",
"field",
"should",
"be",
"used",
"as",
"an",
"API",
"filter",
"."
] | def is_api_filter(self, filter_field):
"""Determine if agiven filter field should be used as an API filter."""
if self.filter_type == 'server':
for choice in self.filter_choices:
if (choice[0] == filter_field and len(choice) > 2 and
choice[2]):
... | [
"def",
"is_api_filter",
"(",
"self",
",",
"filter_field",
")",
":",
"if",
"self",
".",
"filter_type",
"==",
"'server'",
":",
"for",
"choice",
"in",
"self",
".",
"filter_choices",
":",
"if",
"(",
"choice",
"[",
"0",
"]",
"==",
"filter_field",
"and",
"len"... | https://github.com/openstack/horizon/blob/12bb9fe5184c9dd3329ba17b3d03c90887dbcc3d/horizon/tables/actions.py#L528-L535 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/functions/other.py | python | Function_crootof._evalf_ | (self, poly, index, parent=None, algorithm=None) | return parent(sobj.n(1 + prec_to_dps(prec))._sage_()) | EXAMPLES::
sage: complex_root_of(x^2-2, 1).n()
1.41421356237309
sage: complex_root_of(x^2-2, 3).n()
Traceback (most recent call last):
...
IndexError: root index out of [-2, 1] range, got 3
TESTS:
Check that low precision is hand... | EXAMPLES:: | [
"EXAMPLES",
"::"
] | def _evalf_(self, poly, index, parent=None, algorithm=None):
"""
EXAMPLES::
sage: complex_root_of(x^2-2, 1).n()
1.41421356237309
sage: complex_root_of(x^2-2, 3).n()
Traceback (most recent call last):
...
IndexError: root index out ... | [
"def",
"_evalf_",
"(",
"self",
",",
"poly",
",",
"index",
",",
"parent",
"=",
"None",
",",
"algorithm",
"=",
"None",
")",
":",
"from",
"sympy",
".",
"core",
".",
"evalf",
"import",
"prec_to_dps",
"from",
"sympy",
".",
"polys",
"import",
"CRootOf",
",",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/functions/other.py#L2117-L2144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.