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
EmpireProject/EmPyre
c73854ed9d90d2bba1717d3fe6df758d18c20b8f
data/agent/stager.py
python
aes_decrypt
(key, data)
return CBCdec(aes, data[16:])
Generate an AES cipher object, pull out the IV from the data and return the unencrypted data.
Generate an AES cipher object, pull out the IV from the data and return the unencrypted data.
[ "Generate", "an", "AES", "cipher", "object", "pull", "out", "the", "IV", "from", "the", "data", "and", "return", "the", "unencrypted", "data", "." ]
def aes_decrypt(key, data): """ Generate an AES cipher object, pull out the IV from the data and return the unencrypted data. """ IV = data[0:16] aes = AESModeOfOperationCBC(key, iv=IV) return CBCdec(aes, data[16:])
[ "def", "aes_decrypt", "(", "key", ",", "data", ")", ":", "IV", "=", "data", "[", "0", ":", "16", "]", "aes", "=", "AESModeOfOperationCBC", "(", "key", ",", "iv", "=", "IV", ")", "return", "CBCdec", "(", "aes", ",", "data", "[", "16", ":", "]", ...
https://github.com/EmpireProject/EmPyre/blob/c73854ed9d90d2bba1717d3fe6df758d18c20b8f/data/agent/stager.py#L546-L553
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/rootisolation.py
python
dup_isolate_real_roots_sqf
(f, K, eps=None, inf=None, sup=None, fast=False, blackbox=False)
Isolate real roots of a square-free polynomial using the Vincent-Akritas-Strzebonski (VAS) CF approach. References: =========== 1. Alkiviadis G. Akritas and Adam W. Strzebonski: A Comparative Study of Two Real Root Isolation Methods. Nonlinear Analysis: Modelling and Control, Vol. 10, No. 4...
Isolate real roots of a square-free polynomial using the Vincent-Akritas-Strzebonski (VAS) CF approach.
[ "Isolate", "real", "roots", "of", "a", "square", "-", "free", "polynomial", "using", "the", "Vincent", "-", "Akritas", "-", "Strzebonski", "(", "VAS", ")", "CF", "approach", "." ]
def dup_isolate_real_roots_sqf(f, K, eps=None, inf=None, sup=None, fast=False, blackbox=False): """Isolate real roots of a square-free polynomial using the Vincent-Akritas-Strzebonski (VAS) CF approach. References: =========== 1. Alkiviadis G. Akritas and Adam W. Strzebonski: A Comparative Stu...
[ "def", "dup_isolate_real_roots_sqf", "(", "f", ",", "K", ",", "eps", "=", "None", ",", "inf", "=", "None", ",", "sup", "=", "None", ",", "fast", "=", "False", ",", "blackbox", "=", "False", ")", ":", "if", "K", ".", "is_QQ", ":", "(", "_", ",", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/rootisolation.py#L488-L517
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/metagoofil/hachoir_core/i18n.py
python
_dummy_ngettext
(singular, plural, count)
[]
def _dummy_ngettext(singular, plural, count): if 1 < abs(count) or not count: return unicode(plural) else: return unicode(singular)
[ "def", "_dummy_ngettext", "(", "singular", ",", "plural", ",", "count", ")", ":", "if", "1", "<", "abs", "(", "count", ")", "or", "not", "count", ":", "return", "unicode", "(", "plural", ")", "else", ":", "return", "unicode", "(", "singular", ")" ]
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_core/i18n.py#L108-L112
w3h/isf
6faf0a3df185465ec17369c90ccc16e2a03a1870
lib/thirdparty/bitstring.py
python
Bits._truncatestart
(self, bits)
Truncate bits from the start of the bitstring.
Truncate bits from the start of the bitstring.
[ "Truncate", "bits", "from", "the", "start", "of", "the", "bitstring", "." ]
def _truncatestart(self, bits): """Truncate bits from the start of the bitstring.""" assert 0 <= bits <= self.len if not bits: return if bits == self.len: self._clear() return bytepos, offset = divmod(self._offset + bits, 8) self._setby...
[ "def", "_truncatestart", "(", "self", ",", "bits", ")", ":", "assert", "0", "<=", "bits", "<=", "self", ".", "len", "if", "not", "bits", ":", "return", "if", "bits", "==", "self", ".", "len", ":", "self", ".", "_clear", "(", ")", "return", "bytepos...
https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/bitstring.py#L2042-L2053
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/userreports/indicators/specs.py
python
IndicatorSpecBase.readable_output
(self, context)
return self.type
[]
def readable_output(self, context): return self.type
[ "def", "readable_output", "(", "self", ",", "context", ")", ":", "return", "self", ".", "type" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/userreports/indicators/specs.py#L46-L47
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/clients/restful/flask/google/config.py
python
GoogleConfiguration.quit_text
(self)
return self._quit_text
[]
def quit_text(self): return self._quit_text
[ "def", "quit_text", "(", "self", ")", ":", "return", "self", ".", "_quit_text" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/clients/restful/flask/google/config.py#L50-L51
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
rpython/memory/gc/minimark.py
python
MiniMarkGC.writebarrier_before_copy
(self, source_addr, dest_addr, source_start, dest_start, length)
return True
This has the same effect as calling writebarrier over each element in dest copied from source, except it might reset one of the following flags a bit too eagerly, which means we'll have a bit more objects to track, but being on the safe side.
This has the same effect as calling writebarrier over each element in dest copied from source, except it might reset one of the following flags a bit too eagerly, which means we'll have a bit more objects to track, but being on the safe side.
[ "This", "has", "the", "same", "effect", "as", "calling", "writebarrier", "over", "each", "element", "in", "dest", "copied", "from", "source", "except", "it", "might", "reset", "one", "of", "the", "following", "flags", "a", "bit", "too", "eagerly", "which", ...
def writebarrier_before_copy(self, source_addr, dest_addr, source_start, dest_start, length): """ This has the same effect as calling writebarrier over each element in dest copied from source, except it might reset one of the following flags a bit too eagerly, wh...
[ "def", "writebarrier_before_copy", "(", "self", ",", "source_addr", ",", "dest_addr", ",", "source_start", ",", "dest_start", ",", "length", ")", ":", "source_hdr", "=", "self", ".", "header", "(", "source_addr", ")", "dest_hdr", "=", "self", ".", "header", ...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/rpython/memory/gc/minimark.py#L1188-L1232
open-cogsci/OpenSesame
c4a3641b097a80a76937edbd8c365f036bcc9705
libopensesame/plugins.py
python
plugin_folders
(only_existing=True, _type=u'plugins')
return l
desc: Returns a list of plugin folders. keywords: only_existing: desc: Specifies if only existing folders should be returned. type: bool _type: desc: Indicates whether runtime plugins ('plugins') or GUI extensions ('extensions') should be listed. type: [str, unicode] returns: desc: A list o...
desc: Returns a list of plugin folders.
[ "desc", ":", "Returns", "a", "list", "of", "plugin", "folders", "." ]
def plugin_folders(only_existing=True, _type=u'plugins'): """ desc: Returns a list of plugin folders. keywords: only_existing: desc: Specifies if only existing folders should be returned. type: bool _type: desc: Indicates whether runtime plugins ('plugins') or GUI extensions ('extensions') shou...
[ "def", "plugin_folders", "(", "only_existing", "=", "True", ",", "_type", "=", "u'plugins'", ")", ":", "l", "=", "[", "]", "# Build a list of default plugin/ extension folders", "for", "folder", "in", "misc", ".", "base_folders", ":", "path", "=", "os", ".", "...
https://github.com/open-cogsci/OpenSesame/blob/c4a3641b097a80a76937edbd8c365f036bcc9705/libopensesame/plugins.py#L41-L98
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/proxy/v1/service/session/__init__.py
python
SessionInstance.url
(self)
return self._properties['url']
:returns: The absolute URL of the Session resource :rtype: unicode
:returns: The absolute URL of the Session resource :rtype: unicode
[ ":", "returns", ":", "The", "absolute", "URL", "of", "the", "Session", "resource", ":", "rtype", ":", "unicode" ]
def url(self): """ :returns: The absolute URL of the Session resource :rtype: unicode """ return self._properties['url']
[ "def", "url", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'url'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/proxy/v1/service/session/__init__.py#L523-L528
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/interfaces/singular.py
python
Singular.set_seed
(self, seed=None)
return seed
Set the seed for singular interpreter. The seed should be an integer at least 1 and not more than 30 bits. See http://www.singular.uni-kl.de/Manual/html/sing_19.htm#SEC26 and http://www.singular.uni-kl.de/Manual/html/sing_283.htm#SEC323 EXAMPLES:: s...
Set the seed for singular interpreter.
[ "Set", "the", "seed", "for", "singular", "interpreter", "." ]
def set_seed(self, seed=None): """ Set the seed for singular interpreter. The seed should be an integer at least 1 and not more than 30 bits. See http://www.singular.uni-kl.de/Manual/html/sing_19.htm#SEC26 and http://www.singular.uni-kl.de/Manual/html/sin...
[ "def", "set_seed", "(", "self", ",", "seed", "=", "None", ")", ":", "if", "seed", "is", "None", ":", "seed", "=", "self", ".", "rand_seed", "(", ")", "self", ".", "eval", "(", "'system(\"--random\",%d)'", "%", "seed", ")", "self", ".", "_seed", "=", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/singular.py#L414-L437
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/scripts/dict_diff.py
python
exit_with_parsing_error
()
Report invalid arguments and usage.
Report invalid arguments and usage.
[ "Report", "invalid", "arguments", "and", "usage", "." ]
def exit_with_parsing_error(): """Report invalid arguments and usage.""" print("Invalid argument(s).") usage() sys.exit(2)
[ "def", "exit_with_parsing_error", "(", ")", ":", "print", "(", "\"Invalid argument(s).\"", ")", "usage", "(", ")", "sys", ".", "exit", "(", "2", ")" ]
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/scripts/dict_diff.py#L45-L49
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/ui/gui/tools/proxywin.py
python
ProxiedRequests._supervise_requests
(self, *args)
return self.keep_checking
Supervise if there are requests to show. :return: True to gobject to keep calling it, False when all is done.
Supervise if there are requests to show.
[ "Supervise", "if", "there", "are", "requests", "to", "show", "." ]
def _supervise_requests(self, *args): """Supervise if there are requests to show. :return: True to gobject to keep calling it, False when all is done. """ if self.waiting_requests: req = self.proxy.get_trapped_request() if req is not None: self.wa...
[ "def", "_supervise_requests", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "waiting_requests", ":", "req", "=", "self", ".", "proxy", ".", "get_trapped_request", "(", ")", "if", "req", "is", "not", "None", ":", "self", ".", "waiting_reques...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/tools/proxywin.py#L316-L331
CGATOxford/cgat
326aad4694bdfae8ddc194171bb5d73911243947
obsolete/benchmark_ranges.py
python
sample_uniform_segments
( workspace_size, segment_size )
sample from a uniform set of covering segments without overlap
sample from a uniform set of covering segments without overlap
[ "sample", "from", "a", "uniform", "set", "of", "covering", "segments", "without", "overlap" ]
def sample_uniform_segments( workspace_size, segment_size ): """sample from a uniform set of covering segments without overlap """ starts = list(range( 0, workspace_size, segment_size)) random.shuffle( starts ) for x in starts: yield (x, min(workspace_size,x+segment_size) )
[ "def", "sample_uniform_segments", "(", "workspace_size", ",", "segment_size", ")", ":", "starts", "=", "list", "(", "range", "(", "0", ",", "workspace_size", ",", "segment_size", ")", ")", "random", ".", "shuffle", "(", "starts", ")", "for", "x", "in", "st...
https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/obsolete/benchmark_ranges.py#L128-L136
xiepaup/dbatools
8549f2571aaee6a39f5c6f32179ac9c5d301a9aa
mysqlTools/mysql_utilities/mysql/utilities/common/replication.py
python
negotiate_rpl_connection
(server, is_master=True, strict=True, options={})
return change_master
Determine replication connection This method attempts to determine if it is possible to build a CHANGE MASTER command based on the server passed. If it is possible, the method will return a CHANGE MASTER command. If there are errors and the strict option is turned on, it will throw errors if there is s...
Determine replication connection
[ "Determine", "replication", "connection" ]
def negotiate_rpl_connection(server, is_master=True, strict=True, options={}): """Determine replication connection This method attempts to determine if it is possible to build a CHANGE MASTER command based on the server passed. If it is possible, the method will return a CHANGE MASTER command. If there...
[ "def", "negotiate_rpl_connection", "(", "server", ",", "is_master", "=", "True", ",", "strict", "=", "True", ",", "options", "=", "{", "}", ")", ":", "rpl_mode", "=", "options", ".", "get", "(", "\"rpl_mode\"", ",", "\"master\"", ")", "rpl_user", "=", "o...
https://github.com/xiepaup/dbatools/blob/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/utilities/common/replication.py#L82-L200
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/pydoc.py
python
pipepager
(text, cmd)
Page through text by feeding it to another program.
Page through text by feeding it to another program.
[ "Page", "through", "text", "by", "feeding", "it", "to", "another", "program", "." ]
def pipepager(text, cmd): """Page through text by feeding it to another program.""" pipe = os.popen(cmd, 'w') try: pipe.write(text) pipe.close() except IOError: pass
[ "def", "pipepager", "(", "text", ",", "cmd", ")", ":", "pipe", "=", "os", ".", "popen", "(", "cmd", ",", "'w'", ")", "try", ":", "pipe", ".", "write", "(", "text", ")", "pipe", ".", "close", "(", ")", "except", "IOError", ":", "pass" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/pydoc.py#L1278-L1285
skylander86/lambda-text-extractor
6da52d077a2fc571e38bfe29c33ae68f6443cd5a
lib-linux_x64/pptx/oxml/chart/chart.py
python
CT_ChartSpace.xlsx_part_rId
(self)
return externalData.rId
The string in the required ``r:id`` attribute of the `<c:externalData>` child, or |None| if no externalData element is present.
The string in the required ``r:id`` attribute of the `<c:externalData>` child, or |None| if no externalData element is present.
[ "The", "string", "in", "the", "required", "r", ":", "id", "attribute", "of", "the", "<c", ":", "externalData", ">", "child", "or", "|None|", "if", "no", "externalData", "element", "is", "present", "." ]
def xlsx_part_rId(self): """ The string in the required ``r:id`` attribute of the `<c:externalData>` child, or |None| if no externalData element is present. """ externalData = self.externalData if externalData is None: return None return extern...
[ "def", "xlsx_part_rId", "(", "self", ")", ":", "externalData", "=", "self", ".", "externalData", "if", "externalData", "is", "None", ":", "return", "None", "return", "externalData", ".", "rId" ]
https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/pptx/oxml/chart/chart.py#L121-L130
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/pythontwitter/__init__.py
python
_FileCache.Get
(self,key)
[]
def Get(self,key): path = self._GetPath(key) if os.path.exists(path): return open(path).read() else: return None
[ "def", "Get", "(", "self", ",", "key", ")", ":", "path", "=", "self", ".", "_GetPath", "(", "key", ")", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "return", "open", "(", "path", ")", ".", "read", "(", ")", "else", ":", "re...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/pythontwitter/__init__.py#L4573-L4578
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/SophosXGFirewall/Integrations/SophosXGFirewall/SophosXGFirewall.py
python
sophos_firewall_rule_group_add_command
(client: Client, params: dict)
return generic_save_and_get(client, RULE_GROUP['endpoint_tag'], params, rule_group_builder, # type: ignore RULE_GROUP['table_headers'])
Add rule group Args: client (Client): Sophos XG Firewall Client params (dict): params for the creation of the rule group Returns: CommandResults: Command results object
Add rule group
[ "Add", "rule", "group" ]
def sophos_firewall_rule_group_add_command(client: Client, params: dict) -> CommandResults: """Add rule group Args: client (Client): Sophos XG Firewall Client params (dict): params for the creation of the rule group Returns: CommandResults: Command results object """ return...
[ "def", "sophos_firewall_rule_group_add_command", "(", "client", ":", "Client", ",", "params", ":", "dict", ")", "->", "CommandResults", ":", "return", "generic_save_and_get", "(", "client", ",", "RULE_GROUP", "[", "'endpoint_tag'", "]", ",", "params", ",", "rule_g...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/SophosXGFirewall/Integrations/SophosXGFirewall/SophosXGFirewall.py#L247-L258
deanishe/zothero
5b057ef080ee730d82d5dd15e064d2a4730c2b11
src/lib/zothero/models.py
python
Entry.authors
(self)
return [c for c in self.creators if c.type == 'author']
Creators whose type is ``author``. Returns: list: Sequence of `Creator` objects.
Creators whose type is ``author``.
[ "Creators", "whose", "type", "is", "author", "." ]
def authors(self): """Creators whose type is ``author``. Returns: list: Sequence of `Creator` objects. """ return [c for c in self.creators if c.type == 'author']
[ "def", "authors", "(", "self", ")", ":", "return", "[", "c", "for", "c", "in", "self", ".", "creators", "if", "c", ".", "type", "==", "'author'", "]" ]
https://github.com/deanishe/zothero/blob/5b057ef080ee730d82d5dd15e064d2a4730c2b11/src/lib/zothero/models.py#L114-L121
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
lib/spack/spack/hooks/monitor.py
python
on_phase_error
(pkg, phase_name, log_file)
Triggered on a phase error
Triggered on a phase error
[ "Triggered", "on", "a", "phase", "error" ]
def on_phase_error(pkg, phase_name, log_file): """Triggered on a phase error """ if not spack.monitor.cli: return tty.debug("Running on_phase_error %s, phase %s" % (pkg.name, phase_name)) result = spack.monitor.cli.send_phase(pkg, phase_name, log_file, "ERROR") tty.verbose(result.get('m...
[ "def", "on_phase_error", "(", "pkg", ",", "phase_name", ",", "log_file", ")", ":", "if", "not", "spack", ".", "monitor", ".", "cli", ":", "return", "tty", ".", "debug", "(", "\"Running on_phase_error %s, phase %s\"", "%", "(", "pkg", ".", "name", ",", "pha...
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/hooks/monitor.py#L66-L74
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/jobs/views.py
python
detail
(request, slug=None, template_name="jobs/view.html")
[]
def detail(request, slug=None, template_name="jobs/view.html"): if not slug: return HttpResponseRedirect(reverse('jobs')) job = get_object_or_404(Job.objects.select_related(), slug=slug) can_view = has_view_perm(request.user, 'jobs.view_job', job) if can_view: EventLog.objects.log(inst...
[ "def", "detail", "(", "request", ",", "slug", "=", "None", ",", "template_name", "=", "\"jobs/view.html\"", ")", ":", "if", "not", "slug", ":", "return", "HttpResponseRedirect", "(", "reverse", "(", "'jobs'", ")", ")", "job", "=", "get_object_or_404", "(", ...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/jobs/views.py#L47-L59
nedbat/coveragepy
d004b18a1ad59ec89b89c96c03a789a55cc51693
coverage/numbits.py
python
numbits_intersection
(numbits1, numbits2)
return _to_blob(intersection_bytes.rstrip(b'\0'))
Compute the intersection of two numbits. Returns: A new numbits, the intersection `numbits1` and `numbits2`.
Compute the intersection of two numbits.
[ "Compute", "the", "intersection", "of", "two", "numbits", "." ]
def numbits_intersection(numbits1, numbits2): """Compute the intersection of two numbits. Returns: A new numbits, the intersection `numbits1` and `numbits2`. """ byte_pairs = zip_longest(numbits1, numbits2, fillvalue=0) intersection_bytes = bytes(b1 & b2 for b1, b2 in byte_pairs) return...
[ "def", "numbits_intersection", "(", "numbits1", ",", "numbits2", ")", ":", "byte_pairs", "=", "zip_longest", "(", "numbits1", ",", "numbits2", ",", "fillvalue", "=", "0", ")", "intersection_bytes", "=", "bytes", "(", "b1", "&", "b2", "for", "b1", ",", "b2"...
https://github.com/nedbat/coveragepy/blob/d004b18a1ad59ec89b89c96c03a789a55cc51693/coverage/numbits.py#L84-L92
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/verify/v2/service/entity/new_factor.py
python
NewFactorInstance.__init__
(self, version, payload, service_sid, identity)
Initialize the NewFactorInstance :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance
Initialize the NewFactorInstance
[ "Initialize", "the", "NewFactorInstance" ]
def __init__(self, version, payload, service_sid, identity): """ Initialize the NewFactorInstance :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance """ super(NewFactorInst...
[ "def", "__init__", "(", "self", ",", "version", ",", "payload", ",", "service_sid", ",", "identity", ")", ":", "super", "(", "NewFactorInstance", ",", "self", ")", ".", "__init__", "(", "version", ")", "# Marshaled Properties", "self", ".", "_properties", "=...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/verify/v2/service/entity/new_factor.py#L168-L196
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/pens/t2CharStringPen.py
python
T2CharStringPen._p
(self, pt)
return [pt[0]-p0[0], pt[1]-p0[1]]
[]
def _p(self, pt): p0 = self._p0 pt = self._p0 = (self.round(pt[0]), self.round(pt[1])) return [pt[0]-p0[0], pt[1]-p0[1]]
[ "def", "_p", "(", "self", ",", "pt", ")", ":", "p0", "=", "self", ".", "_p0", "pt", "=", "self", ".", "_p0", "=", "(", "self", ".", "round", "(", "pt", "[", "0", "]", ")", ",", "self", ".", "round", "(", "pt", "[", "1", "]", ")", ")", "...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/pens/t2CharStringPen.py#L29-L32
mne-tools/mne-python
f90b303ce66a8415e64edd4605b09ac0179c1ebf
doc/conf.py
python
append_attr_meth_examples
(app, what, name, obj, options, lines)
Append SG examples backreferences to method and attr docstrings.
Append SG examples backreferences to method and attr docstrings.
[ "Append", "SG", "examples", "backreferences", "to", "method", "and", "attr", "docstrings", "." ]
def append_attr_meth_examples(app, what, name, obj, options, lines): """Append SG examples backreferences to method and attr docstrings.""" # NumpyDoc nicely embeds method and attribute docstrings for us, but it # does not respect the autodoc templates that would otherwise insert # the .. include:: line...
[ "def", "append_attr_meth_examples", "(", "app", ",", "what", ",", "name", ",", "obj", ",", "options", ",", "lines", ")", ":", "# NumpyDoc nicely embeds method and attribute docstrings for us, but it", "# does not respect the autodoc templates that would otherwise insert", "# the ...
https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/doc/conf.py#L421-L438
MeanEYE/Sunflower
1024bbdde3b8e202ddad3553b321a7b6230bffc9
sunflower/plugin_base/item_list.py
python
ItemList._rename_file
(self, widget=None, data=None)
return True
Rename highlighed item
Rename highlighed item
[ "Rename", "highlighed", "item" ]
def _rename_file(self, widget=None, data=None): """Rename highlighed item""" return True
[ "def", "_rename_file", "(", "self", ",", "widget", "=", "None", ",", "data", "=", "None", ")", ":", "return", "True" ]
https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/plugin_base/item_list.py#L840-L842
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_funnel.py
python
Funnel.legendgrouptitle
(self)
return self["legendgrouptitle"]
The 'legendgrouptitle' property is an instance of Legendgrouptitle that may be specified as: - An instance of :class:`plotly.graph_objs.funnel.Legendgrouptitle` - A dict of string/value properties that will be passed to the Legendgrouptitle constructor Supported ...
The 'legendgrouptitle' property is an instance of Legendgrouptitle that may be specified as: - An instance of :class:`plotly.graph_objs.funnel.Legendgrouptitle` - A dict of string/value properties that will be passed to the Legendgrouptitle constructor Supported ...
[ "The", "legendgrouptitle", "property", "is", "an", "instance", "of", "Legendgrouptitle", "that", "may", "be", "specified", "as", ":", "-", "An", "instance", "of", ":", "class", ":", "plotly", ".", "graph_objs", ".", "funnel", ".", "Legendgrouptitle", "-", "A...
def legendgrouptitle(self): """ The 'legendgrouptitle' property is an instance of Legendgrouptitle that may be specified as: - An instance of :class:`plotly.graph_objs.funnel.Legendgrouptitle` - A dict of string/value properties that will be passed to the Legendgr...
[ "def", "legendgrouptitle", "(", "self", ")", ":", "return", "self", "[", "\"legendgrouptitle\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_funnel.py#L629-L648
mcneel/rhinoscriptsyntax
c49bd0bf24c2513bdcb84d1bf307144489600fd9
Scripts/rhinoscript/plane.py
python
PlaneFromFrame
(origin, x_axis, y_axis)
return Rhino.Geometry.Plane(origin, x_axis, y_axis)
Construct a plane from a point, and two vectors in the plane. Parameters: origin (point): A 3D point identifying the origin of the plane. x_axis (vector): A non-zero 3D vector in the plane that determines the X axis direction. y_axis (vector): A non-zero 3D vector not parallel to x_...
Construct a plane from a point, and two vectors in the plane. Parameters: origin (point): A 3D point identifying the origin of the plane. x_axis (vector): A non-zero 3D vector in the plane that determines the X axis direction. y_axis (vector): A non-zero 3D vector not parallel to x_...
[ "Construct", "a", "plane", "from", "a", "point", "and", "two", "vectors", "in", "the", "plane", ".", "Parameters", ":", "origin", "(", "point", ")", ":", "A", "3D", "point", "identifying", "the", "origin", "of", "the", "plane", ".", "x_axis", "(", "vec...
def PlaneFromFrame(origin, x_axis, y_axis): """Construct a plane from a point, and two vectors in the plane. Parameters: origin (point): A 3D point identifying the origin of the plane. x_axis (vector): A non-zero 3D vector in the plane that determines the X axis direction. y_axi...
[ "def", "PlaneFromFrame", "(", "origin", ",", "x_axis", ",", "y_axis", ")", ":", "origin", "=", "rhutil", ".", "coerce3dpoint", "(", "origin", ",", "True", ")", "x_axis", "=", "rhutil", ".", "coerce3dvector", "(", "x_axis", ",", "True", ")", "y_axis", "="...
https://github.com/mcneel/rhinoscriptsyntax/blob/c49bd0bf24c2513bdcb84d1bf307144489600fd9/Scripts/rhinoscript/plane.py#L273-L301
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/vpc/v20170312/vpc_client.py
python
VpcClient.DescribeDhcpIps
(self, request)
本接口(DescribeDhcpIps)用于查询DhcpIp列表 :param request: Request instance for DescribeDhcpIps. :type request: :class:`tencentcloud.vpc.v20170312.models.DescribeDhcpIpsRequest` :rtype: :class:`tencentcloud.vpc.v20170312.models.DescribeDhcpIpsResponse`
本接口(DescribeDhcpIps)用于查询DhcpIp列表
[ "本接口(DescribeDhcpIps)用于查询DhcpIp列表" ]
def DescribeDhcpIps(self, request): """本接口(DescribeDhcpIps)用于查询DhcpIp列表 :param request: Request instance for DescribeDhcpIps. :type request: :class:`tencentcloud.vpc.v20170312.models.DescribeDhcpIpsRequest` :rtype: :class:`tencentcloud.vpc.v20170312.models.DescribeDhcpIpsResponse` ...
[ "def", "DescribeDhcpIps", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeDhcpIps\"", ",", "params", ")", "response", "=", "json", ".", "loads", ...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vpc/v20170312/vpc_client.py#L3368-L3393
trailofbits/manticore
b050fdf0939f6c63f503cdf87ec0ab159dd41159
manticore/platforms/linux_syscall_stubs.py
python
SyscallStubs.sys_rt_sigqueueinfo
(self, pid, sig, uinfo)
return self.simple_returns()
AUTOGENERATED UNIMPLEMENTED STUB
AUTOGENERATED UNIMPLEMENTED STUB
[ "AUTOGENERATED", "UNIMPLEMENTED", "STUB" ]
def sys_rt_sigqueueinfo(self, pid, sig, uinfo) -> int: """ AUTOGENERATED UNIMPLEMENTED STUB """ return self.simple_returns()
[ "def", "sys_rt_sigqueueinfo", "(", "self", ",", "pid", ",", "sig", ",", "uinfo", ")", "->", "int", ":", "return", "self", ".", "simple_returns", "(", ")" ]
https://github.com/trailofbits/manticore/blob/b050fdf0939f6c63f503cdf87ec0ab159dd41159/manticore/platforms/linux_syscall_stubs.py#L742-L744
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/set/src/core/scapy.py
python
Packet.build_ps
(self,internal=0)
return p,lst
[]
def build_ps(self,internal=0): p,lst = self.do_build_ps() # if not internal: # pkt = self # while pkt.haslayer(Padding): # pkt = pkt.getlayer(Padding) # lst.append( (pkt, [ ("loakjkjd", pkt.load, pkt.load) ] ) ) # p += pkt.load # ...
[ "def", "build_ps", "(", "self", ",", "internal", "=", "0", ")", ":", "p", ",", "lst", "=", "self", ".", "do_build_ps", "(", ")", "# if not internal:", "# pkt = self", "# while pkt.haslayer(Padding):", "# pkt = pkt.getlayer(Paddi...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/set/src/core/scapy.py#L5307-L5316
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/collections/asr/data/audio_to_label.py
python
_TarredAudioLabelDataset._filter
(self, iterator)
return TarredAudioFilter(self.collection, self.file_occurence)
This function is used to remove samples that have been filtered out by ASRSpeechLabel already. Otherwise, we would get a KeyError as _build_sample attempts to find the manifest entry for a sample that was filtered out (e.g. for duration). Note that if using multi-GPU training, filtering may lead...
This function is used to remove samples that have been filtered out by ASRSpeechLabel already. Otherwise, we would get a KeyError as _build_sample attempts to find the manifest entry for a sample that was filtered out (e.g. for duration). Note that if using multi-GPU training, filtering may lead...
[ "This", "function", "is", "used", "to", "remove", "samples", "that", "have", "been", "filtered", "out", "by", "ASRSpeechLabel", "already", ".", "Otherwise", "we", "would", "get", "a", "KeyError", "as", "_build_sample", "attempts", "to", "find", "the", "manifes...
def _filter(self, iterator): """This function is used to remove samples that have been filtered out by ASRSpeechLabel already. Otherwise, we would get a KeyError as _build_sample attempts to find the manifest entry for a sample that was filtered out (e.g. for duration). Note that if usin...
[ "def", "_filter", "(", "self", ",", "iterator", ")", ":", "class", "TarredAudioFilter", ":", "def", "__init__", "(", "self", ",", "collection", ",", "file_occurence", ")", ":", "self", ".", "iterator", "=", "iterator", "self", ".", "collection", "=", "coll...
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/asr/data/audio_to_label.py#L595-L644
team-approx-bayes/dl-with-bayes
fbf9b0ee185346bc269a4c40b3904384bf3c4338
distributed/classification/models/resnet_b.py
python
conv1x1
(in_planes, out_planes, stride=1)
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
1x1 convolution
1x1 convolution
[ "1x1", "convolution" ]
def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
[ "def", "conv1x1", "(", "in_planes", ",", "out_planes", ",", "stride", "=", "1", ")", ":", "return", "nn", ".", "Conv2d", "(", "in_planes", ",", "out_planes", ",", "kernel_size", "=", "1", ",", "stride", "=", "stride", ",", "bias", "=", "False", ")" ]
https://github.com/team-approx-bayes/dl-with-bayes/blob/fbf9b0ee185346bc269a4c40b3904384bf3c4338/distributed/classification/models/resnet_b.py#L24-L26
Flexget/Flexget
ffad58f206278abefc88d63a1ffaa80476fc4d98
flexget/utils/bittorrent.py
python
Torrent.remove_multitracker
(self, tracker: str)
Removes passed multi-tracker from this torrent
Removes passed multi-tracker from this torrent
[ "Removes", "passed", "multi", "-", "tracker", "from", "this", "torrent" ]
def remove_multitracker(self, tracker: str) -> None: """Removes passed multi-tracker from this torrent""" for tl in self.content.get('announce-list', [])[:]: with suppress(AttributeError, ValueError): tl.remove(tracker) self.modified = True # i...
[ "def", "remove_multitracker", "(", "self", ",", "tracker", ":", "str", ")", "->", "None", ":", "for", "tl", "in", "self", ".", "content", ".", "get", "(", "'announce-list'", ",", "[", "]", ")", "[", ":", "]", ":", "with", "suppress", "(", "AttributeE...
https://github.com/Flexget/Flexget/blob/ffad58f206278abefc88d63a1ffaa80476fc4d98/flexget/utils/bittorrent.py#L353-L361
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/tvdbapiv2/models/user_data.py
python
UserData.data
(self, data)
Sets the data of this UserData. :param data: The data of this UserData. :type: User
Sets the data of this UserData.
[ "Sets", "the", "data", "of", "this", "UserData", "." ]
def data(self, data): """ Sets the data of this UserData. :param data: The data of this UserData. :type: User """ self._data = data
[ "def", "data", "(", "self", ",", "data", ")", ":", "self", ".", "_data", "=", "data" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tvdbapiv2/models/user_data.py#L64-L72
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
deep-learning/fastai-docs/fastai_docs-master/dev_nb/nb_007a.py
python
Vocab.create
(cls, path:PathOrStr, tokens:Tokens, max_vocab:int, min_freq:int)
return cls(path)
Create a vocabulary from a set of tokens.
Create a vocabulary from a set of tokens.
[ "Create", "a", "vocabulary", "from", "a", "set", "of", "tokens", "." ]
def create(cls, path:PathOrStr, tokens:Tokens, max_vocab:int, min_freq:int) -> 'Vocab': "Create a vocabulary from a set of tokens." freq = Counter(p for o in tokens for p in o) itos = [o for o,c in freq.most_common(max_vocab) if c > min_freq] itos.insert(0, PAD) if UNK in itos: i...
[ "def", "create", "(", "cls", ",", "path", ":", "PathOrStr", ",", "tokens", ":", "Tokens", ",", "max_vocab", ":", "int", ",", "min_freq", ":", "int", ")", "->", "'Vocab'", ":", "freq", "=", "Counter", "(", "p", "for", "o", "in", "tokens", "for", "p"...
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/deep-learning/fastai-docs/fastai_docs-master/dev_nb/nb_007a.py#L182-L192
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/cups/sensor.py
python
MarkerSensor.name
(self)
return self._name
Return the name of the sensor.
Return the name of the sensor.
[ "Return", "the", "name", "of", "the", "sensor", "." ]
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/cups/sensor.py#L260-L262
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventDetails.is_device_approvals_remove_exception_details
(self)
return self._tag == 'device_approvals_remove_exception_details'
Check if the union tag is ``device_approvals_remove_exception_details``. :rtype: bool
Check if the union tag is ``device_approvals_remove_exception_details``.
[ "Check", "if", "the", "union", "tag", "is", "device_approvals_remove_exception_details", "." ]
def is_device_approvals_remove_exception_details(self): """ Check if the union tag is ``device_approvals_remove_exception_details``. :rtype: bool """ return self._tag == 'device_approvals_remove_exception_details'
[ "def", "is_device_approvals_remove_exception_details", "(", "self", ")", ":", "return", "self", ".", "_tag", "==", "'device_approvals_remove_exception_details'" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L16303-L16309
reddit-archive/reddit
753b17407e9a9dca09558526805922de24133d53
r2/r2/models/link.py
python
Comment.author_slow
(self)
return Account._byID(self.author_id, data=True, return_dict=False)
Returns the comment's author.
Returns the comment's author.
[ "Returns", "the", "comment", "s", "author", "." ]
def author_slow(self): """Returns the comment's author.""" # The author is often already on the wrapped comment as .author # If available, that should be used instead of calling this return Account._byID(self.author_id, data=True, return_dict=False)
[ "def", "author_slow", "(", "self", ")", ":", "# The author is often already on the wrapped comment as .author", "# If available, that should be used instead of calling this", "return", "Account", ".", "_byID", "(", "self", ".", "author_id", ",", "data", "=", "True", ",", "r...
https://github.com/reddit-archive/reddit/blob/753b17407e9a9dca09558526805922de24133d53/r2/r2/models/link.py#L1468-L1472
taomujian/linbing
fe772a58f41e3b046b51a866bdb7e4655abaf51a
python/app/thirdparty/oneforall/common/tablib/tablib.py
python
Dataset.width
(self)
The number of columns currently in the :class:`Dataset`. Cannot be directly modified.
The number of columns currently in the :class:`Dataset`. Cannot be directly modified.
[ "The", "number", "of", "columns", "currently", "in", "the", ":", "class", ":", "Dataset", ".", "Cannot", "be", "directly", "modified", "." ]
def width(self): """The number of columns currently in the :class:`Dataset`. Cannot be directly modified. """ try: return len(self._data[0]) except IndexError: try: return len(self.headers) except TypeError: ...
[ "def", "width", "(", "self", ")", ":", "try", ":", "return", "len", "(", "self", ".", "_data", "[", "0", "]", ")", "except", "IndexError", ":", "try", ":", "return", "len", "(", "self", ".", "headers", ")", "except", "TypeError", ":", "return", "0"...
https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/oneforall/common/tablib/tablib.py#L259-L270
pret/pokemon-reverse-engineering-tools
5e0715f2579adcfeb683448c9a7826cfd3afa57d
pokemontools/pcm.py
python
main
()
[]
def main(): ap = argparse.ArgumentParser() ap.add_argument('mode') ap.add_argument('filenames', nargs='*') args = ap.parse_args() method = { 'wav': convert_to_wav, 'pcm': convert_to_pcm, }.get(args.mode, None) if method == None: raise Exception("Unknown conversion m...
[ "def", "main", "(", ")", ":", "ap", "=", "argparse", ".", "ArgumentParser", "(", ")", "ap", ".", "add_argument", "(", "'mode'", ")", "ap", ".", "add_argument", "(", "'filenames'", ",", "nargs", "=", "'*'", ")", "args", "=", "ap", ".", "parse_args", "...
https://github.com/pret/pokemon-reverse-engineering-tools/blob/5e0715f2579adcfeb683448c9a7826cfd3afa57d/pokemontools/pcm.py#L142-L156
lukelbd/proplot
d0bc9c0857d9295b380b8613ef9aba81d50a067c
proplot/axes/base.py
python
Axes._parse_colorbar_inset
( self, loc=None, width=None, length=None, shrink=None, frame=None, frameon=None, label=None, pad=None, tickloc=None, ticklocation=None, orientation=None, **kwargs, )
return ax, kwargs
Return the axes and adjusted keyword args for an inset colorbar.
Return the axes and adjusted keyword args for an inset colorbar.
[ "Return", "the", "axes", "and", "adjusted", "keyword", "args", "for", "an", "inset", "colorbar", "." ]
def _parse_colorbar_inset( self, loc=None, width=None, length=None, shrink=None, frame=None, frameon=None, label=None, pad=None, tickloc=None, ticklocation=None, orientation=None, **kwargs, ): """ Return the axes and adjusted keyword args for an inset colorbar. """ ...
[ "def", "_parse_colorbar_inset", "(", "self", ",", "loc", "=", "None", ",", "width", "=", "None", ",", "length", "=", "None", ",", "shrink", "=", "None", ",", "frame", "=", "None", ",", "frameon", "=", "None", ",", "label", "=", "None", ",", "pad", ...
https://github.com/lukelbd/proplot/blob/d0bc9c0857d9295b380b8613ef9aba81d50a067c/proplot/axes/base.py#L1922-L1988
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/setuptools/glob.py
python
glob1
(dirname, pattern)
return fnmatch.filter(names, pattern)
[]
def glob1(dirname, pattern): if not dirname: if isinstance(pattern, binary_type): dirname = os.curdir.encode('ASCII') else: dirname = os.curdir try: names = os.listdir(dirname) except OSError: return [] return fnmatch.filter(names, pattern)
[ "def", "glob1", "(", "dirname", ",", "pattern", ")", ":", "if", "not", "dirname", ":", "if", "isinstance", "(", "pattern", ",", "binary_type", ")", ":", "dirname", "=", "os", ".", "curdir", ".", "encode", "(", "'ASCII'", ")", "else", ":", "dirname", ...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/setuptools/glob.py#L93-L103
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/network_load_balancer/network_load_balancer_client.py
python
NetworkLoadBalancerClient.delete_backend
(self, network_load_balancer_id, backend_set_name, backend_name, **kwargs)
Removes a backend server from a given network load balancer and backend set. :param str network_load_balancer_id: (required) The `OCID`__ of the network load balancer to update. __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm :param str backend_set_n...
Removes a backend server from a given network load balancer and backend set.
[ "Removes", "a", "backend", "server", "from", "a", "given", "network", "load", "balancer", "and", "backend", "set", "." ]
def delete_backend(self, network_load_balancer_id, backend_set_name, backend_name, **kwargs): """ Removes a backend server from a given network load balancer and backend set. :param str network_load_balancer_id: (required) The `OCID`__ of the network load balancer to update. ...
[ "def", "delete_backend", "(", "self", ",", "network_load_balancer_id", ",", "backend_set_name", ",", "backend_name", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/networkLoadBalancers/{networkLoadBalancerId}/backendSets/{backendSetName}/backends/{backendName}\"", ...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/network_load_balancer/network_load_balancer_client.py#L606-L705
closeio/flask-mongorest
30a23dbe7afa364b286cae1c1ead5cf8e8b19b57
flask_mongorest/resources.py
python
Resource.uri
(cls, path)
Generate a URI reference for the given path
Generate a URI reference for the given path
[ "Generate", "a", "URI", "reference", "for", "the", "given", "path" ]
def uri(cls, path): """Generate a URI reference for the given path""" if cls.uri_prefix: ret = cls.uri_prefix + path return ret else: raise ValueError( "Cannot generate URI for resources that do not specify a uri_prefix" )
[ "def", "uri", "(", "cls", ",", "path", ")", ":", "if", "cls", ".", "uri_prefix", ":", "ret", "=", "cls", ".", "uri_prefix", "+", "path", "return", "ret", "else", ":", "raise", "ValueError", "(", "\"Cannot generate URI for resources that do not specify a uri_pref...
https://github.com/closeio/flask-mongorest/blob/30a23dbe7afa364b286cae1c1ead5cf8e8b19b57/flask_mongorest/resources.py#L207-L215
poppy-project/pypot
c5d384fe23eef9f6ec98467f6f76626cdf20afb9
pypot/sensor/contact/contact.py
python
ContactSensor.__init__
(self, name, gpio_data, gpio_vcc=None)
[]
def __init__(self, name, gpio_data, gpio_vcc=None): Sensor.__init__(self, name) self._pin = gpio_data GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(self._pin, GPIO.IN) if gpio_vcc is not None: self._vcc = gpio_vcc GPIO.setup(self._vcc...
[ "def", "__init__", "(", "self", ",", "name", ",", "gpio_data", ",", "gpio_vcc", "=", "None", ")", ":", "Sensor", ".", "__init__", "(", "self", ",", "name", ")", "self", ".", "_pin", "=", "gpio_data", "GPIO", ".", "setmode", "(", "GPIO", ".", "BCM", ...
https://github.com/poppy-project/pypot/blob/c5d384fe23eef9f6ec98467f6f76626cdf20afb9/pypot/sensor/contact/contact.py#L10-L21
Esri/ArcREST
ab240fde2b0200f61d4a5f6df033516e53f2f416
src/arcrest/common/spatial.py
python
create_feature_layer
(ds, sql, name="layer")
return result[0]
creates a feature layer object
creates a feature layer object
[ "creates", "a", "feature", "layer", "object" ]
def create_feature_layer(ds, sql, name="layer"): """ creates a feature layer object """ if arcpyFound == False: raise Exception("ArcPy is required to use this function") result = arcpy.MakeFeatureLayer_management(in_features=ds, out_layer=name, ...
[ "def", "create_feature_layer", "(", "ds", ",", "sql", ",", "name", "=", "\"layer\"", ")", ":", "if", "arcpyFound", "==", "False", ":", "raise", "Exception", "(", "\"ArcPy is required to use this function\"", ")", "result", "=", "arcpy", ".", "MakeFeatureLayer_mana...
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/spatial.py#L16-L23
plone/guillotina
57ad54988f797a93630e424fd4b6a75fa26410af
guillotina/utils/misc.py
python
get_current_transaction
()
Return the current request by heuristically looking it up from stack
Return the current request by heuristically looking it up from stack
[ "Return", "the", "current", "request", "by", "heuristically", "looking", "it", "up", "from", "stack" ]
def get_current_transaction() -> ITransaction: """ Return the current request by heuristically looking it up from stack """ try: task_context = task_vars.txn.get() if task_context is not None: return task_context except (ValueError, AttributeError, RuntimeError): ...
[ "def", "get_current_transaction", "(", ")", "->", "ITransaction", ":", "try", ":", "task_context", "=", "task_vars", ".", "txn", ".", "get", "(", ")", "if", "task_context", "is", "not", "None", ":", "return", "task_context", "except", "(", "ValueError", ",",...
https://github.com/plone/guillotina/blob/57ad54988f797a93630e424fd4b6a75fa26410af/guillotina/utils/misc.py#L161-L172
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
custom/reports/mc/reports/models.py
python
AsyncDrillableFilter.api_root
(self)
return reverse('api_dispatch_list', kwargs={'domain': self.domain, 'resource_name': 'fixture_internal', 'api_name': 'v0.5'})
[]
def api_root(self): return reverse('api_dispatch_list', kwargs={'domain': self.domain, 'resource_name': 'fixture_internal', 'api_name': 'v0.5'})
[ "def", "api_root", "(", "self", ")", ":", "return", "reverse", "(", "'api_dispatch_list'", ",", "kwargs", "=", "{", "'domain'", ":", "self", ".", "domain", ",", "'resource_name'", ":", "'fixture_internal'", ",", "'api_name'", ":", "'v0.5'", "}", ")" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/custom/reports/mc/reports/models.py#L37-L40
Ekultek/Pybelt
b4ff6d2e58b5322cca6c7c830b2319a0b86aedd1
lib/pointers.py
python
run_xss_scan
(url, url_file=None, proxy=None, user_agent=False)
Pointer to run a XSS Scan on a given URL
Pointer to run a XSS Scan on a given URL
[ "Pointer", "to", "run", "a", "XSS", "Scan", "on", "a", "given", "URL" ]
def run_xss_scan(url, url_file=None, proxy=None, user_agent=False): """ Pointer to run a XSS Scan on a given URL """ proxy = proxy if proxy is not None else None header = RANDOM_USER_AGENT if user_agent is not False else None if proxy is not None: LOGGER.info("Proxy configured, running through: ...
[ "def", "run_xss_scan", "(", "url", ",", "url_file", "=", "None", ",", "proxy", "=", "None", ",", "user_agent", "=", "False", ")", ":", "proxy", "=", "proxy", "if", "proxy", "is", "not", "None", "else", "None", "header", "=", "RANDOM_USER_AGENT", "if", ...
https://github.com/Ekultek/Pybelt/blob/b4ff6d2e58b5322cca6c7c830b2319a0b86aedd1/lib/pointers.py#L83-L136
otsaloma/gaupol
6dec7826654d223c71a8d3279dcd967e95c46714
gaupol/agents/close.py
python
CloseAgent._need_confirmation
(self, page)
return tuple(docs)
Return documents in `page` with unsaved changes.
Return documents in `page` with unsaved changes.
[ "Return", "documents", "in", "page", "with", "unsaved", "changes", "." ]
def _need_confirmation(self, page): """Return documents in `page` with unsaved changes.""" docs = [] if page.project.main_changed: docs.append(aeidon.documents.MAIN) elif page.project.main_file is not None: if not os.path.isfile(page.project.main_file.path): ...
[ "def", "_need_confirmation", "(", "self", ",", "page", ")", ":", "docs", "=", "[", "]", "if", "page", ".", "project", ".", "main_changed", ":", "docs", ".", "append", "(", "aeidon", ".", "documents", ".", "MAIN", ")", "elif", "page", ".", "project", ...
https://github.com/otsaloma/gaupol/blob/6dec7826654d223c71a8d3279dcd967e95c46714/gaupol/agents/close.py#L87-L100
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/contrib/auth/backends.py
python
ModelBackend.get_user_permissions
(self, user_obj, obj=None)
return self._get_permissions(user_obj, obj, 'user')
Return a set of permission strings the user `user_obj` has from their `user_permissions`.
Return a set of permission strings the user `user_obj` has from their `user_permissions`.
[ "Return", "a", "set", "of", "permission", "strings", "the", "user", "user_obj", "has", "from", "their", "user_permissions", "." ]
def get_user_permissions(self, user_obj, obj=None): """ Return a set of permission strings the user `user_obj` has from their `user_permissions`. """ return self._get_permissions(user_obj, obj, 'user')
[ "def", "get_user_permissions", "(", "self", ",", "user_obj", ",", "obj", "=", "None", ")", ":", "return", "self", ".", "_get_permissions", "(", "user_obj", ",", "obj", ",", "'user'", ")" ]
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/contrib/auth/backends.py#L86-L91
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/http/server.py
python
SimpleHTTPRequestHandler.guess_type
(self, path)
return 'application/octet-stream'
Guess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map, using application/octet-stream ...
Guess the type of a file.
[ "Guess", "the", "type", "of", "a", "file", "." ]
def guess_type(self, path): """Guess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map...
[ "def", "guess_type", "(", "self", ",", "path", ")", ":", "base", ",", "ext", "=", "posixpath", ".", "splitext", "(", "path", ")", "if", "ext", "in", "self", ".", "extensions_map", ":", "return", "self", ".", "extensions_map", "[", "ext", "]", "ext", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/http/server.py#L862-L885
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/db/models/base.py
python
Model.full_clean
(self, exclude=None)
Calls clean_fields, clean, and validate_unique, on the model, and raises a ``ValidationError`` for any errors that occured.
Calls clean_fields, clean, and validate_unique, on the model, and raises a ``ValidationError`` for any errors that occured.
[ "Calls", "clean_fields", "clean", "and", "validate_unique", "on", "the", "model", "and", "raises", "a", "ValidationError", "for", "any", "errors", "that", "occured", "." ]
def full_clean(self, exclude=None): """ Calls clean_fields, clean, and validate_unique, on the model, and raises a ``ValidationError`` for any errors that occured. """ errors = {} if exclude is None: exclude = [] try: self.clean_fields(exc...
[ "def", "full_clean", "(", "self", ",", "exclude", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "exclude", "is", "None", ":", "exclude", "=", "[", "]", "try", ":", "self", ".", "clean_fields", "(", "exclude", "=", "exclude", ")", "except", ...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/db/models/base.py#L793-L824
etetoolkit/ete
2b207357dc2a40ccad7bfd8f54964472c72e4726
ete3/treeview/qt4_gui.py
python
_GUI.on_actionZoomOutY_triggered
(self)
[]
def on_actionZoomOutY_triggered(self): if self.scene.img.branch_vertical_margin > 0: margin = self.scene.img.branch_vertical_margin - 5 if margin > 0: self.scene.img.branch_vertical_margin = margin else: self.scene.img.branch_vertical_margin = ...
[ "def", "on_actionZoomOutY_triggered", "(", "self", ")", ":", "if", "self", ".", "scene", ".", "img", ".", "branch_vertical_margin", ">", "0", ":", "margin", "=", "self", ".", "scene", ".", "img", ".", "branch_vertical_margin", "-", "5", "if", "margin", ">"...
https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/treeview/qt4_gui.py#L220-L228
dmlc/gluon-nlp
5d4bc9eba7226ea9f9aabbbd39e3b1e886547e48
src/gluonnlp/data/sampler.py
python
ConstWidthBucket.__call__
(self, max_lengths: Union[int, Sequence[int]], min_lengths: Union[int, Sequence[int]], num_buckets: int)
return bucket_keys
r"""This generate bucket keys given that all the buckets have the same width. Parameters ---------- max_lengths Maximum of lengths of sequences. min_lengths Minimum of lengths of sequences. num_buckets Number of buckets Returns ...
r"""This generate bucket keys given that all the buckets have the same width.
[ "r", "This", "generate", "bucket", "keys", "given", "that", "all", "the", "buckets", "have", "the", "same", "width", "." ]
def __call__(self, max_lengths: Union[int, Sequence[int]], min_lengths: Union[int, Sequence[int]], num_buckets: int) -> List[int]: r"""This generate bucket keys given that all the buckets have the same width. Parameters ---------- max_lengths Maximum of leng...
[ "def", "__call__", "(", "self", ",", "max_lengths", ":", "Union", "[", "int", ",", "Sequence", "[", "int", "]", "]", ",", "min_lengths", ":", "Union", "[", "int", ",", "Sequence", "[", "int", "]", "]", ",", "num_buckets", ":", "int", ")", "->", "Li...
https://github.com/dmlc/gluon-nlp/blob/5d4bc9eba7226ea9f9aabbbd39e3b1e886547e48/src/gluonnlp/data/sampler.py#L115-L145
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/kms/v20190118/kms_client.py
python
KmsClient.ArchiveKey
(self, request)
对密钥进行归档,被归档的密钥只能用于解密,不能加密 :param request: Request instance for ArchiveKey. :type request: :class:`tencentcloud.kms.v20190118.models.ArchiveKeyRequest` :rtype: :class:`tencentcloud.kms.v20190118.models.ArchiveKeyResponse`
对密钥进行归档,被归档的密钥只能用于解密,不能加密
[ "对密钥进行归档,被归档的密钥只能用于解密,不能加密" ]
def ArchiveKey(self, request): """对密钥进行归档,被归档的密钥只能用于解密,不能加密 :param request: Request instance for ArchiveKey. :type request: :class:`tencentcloud.kms.v20190118.models.ArchiveKeyRequest` :rtype: :class:`tencentcloud.kms.v20190118.models.ArchiveKeyResponse` """ try: ...
[ "def", "ArchiveKey", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"ArchiveKey\"", ",", "params", ")", "response", "=", "json", ".", "loads", "(", "b...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/kms/v20190118/kms_client.py#L29-L54
SheffieldML/GPy
bb1bc5088671f9316bc92a46d356734e34c2d5c0
GPy/kern/src/multidimensional_integral_limits.py
python
Multidimensional_Integral_Limits.K
(self, X, X2=None)
[]
def K(self, X, X2=None): if X2 is None: #X vs X K_xx = self.calc_K_xx_wo_variance(X) return K_xx * self.variances[0] else: #X vs X2 K_xf = np.ones([X.shape[0],X2.shape[0]]) for i,x in enumerate(X): for j,x2 in enumerate(X2): ...
[ "def", "K", "(", "self", ",", "X", ",", "X2", "=", "None", ")", ":", "if", "X2", "is", "None", ":", "#X vs X", "K_xx", "=", "self", ".", "calc_K_xx_wo_variance", "(", "X", ")", "return", "K_xx", "*", "self", ".", "variances", "[", "0", "]", "else...
https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/kern/src/multidimensional_integral_limits.py#L98-L109
viewfinderco/viewfinder
453845b5d64ab5b3b826c08b02546d1ca0a07c14
scripts/fetch_logs.py
python
_GetFD
(filename, file_pos, fd_cache)
return fd
Returns the file descriptor matching "filename" if present in the cache. Otherwise, opens the file (and seeks to "file_pos"). If too many file descriptors are in the cache, cleans out 10% of them. The cache includes tuples of the form (access time, file descriptor).
Returns the file descriptor matching "filename" if present in the cache. Otherwise, opens the file (and seeks to "file_pos"). If too many file descriptors are in the cache, cleans out 10% of them. The cache includes tuples of the form (access time, file descriptor).
[ "Returns", "the", "file", "descriptor", "matching", "filename", "if", "present", "in", "the", "cache", ".", "Otherwise", "opens", "the", "file", "(", "and", "seeks", "to", "file_pos", ")", ".", "If", "too", "many", "file", "descriptors", "are", "in", "the"...
def _GetFD(filename, file_pos, fd_cache): """Returns the file descriptor matching "filename" if present in the cache. Otherwise, opens the file (and seeks to "file_pos"). If too many file descriptors are in the cache, cleans out 10% of them. The cache includes tuples of the form (access time, file descriptor). ...
[ "def", "_GetFD", "(", "filename", ",", "file_pos", ",", "fd_cache", ")", ":", "if", "filename", "in", "fd_cache", ":", "at", ",", "fd", "=", "fd_cache", "[", "filename", "]", "fd_cache", "[", "filename", "]", "=", "(", "time", ".", "time", "(", ")", ...
https://github.com/viewfinderco/viewfinder/blob/453845b5d64ab5b3b826c08b02546d1ca0a07c14/scripts/fetch_logs.py#L242-L267
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/idlelib/PyShell.py
python
ModifiedInterpreter.showsyntaxerror
(self, filename=None)
Override Interactive Interpreter method: Use Colorizing Color the offending position instead of printing it and pointing at it with a caret.
Override Interactive Interpreter method: Use Colorizing
[ "Override", "Interactive", "Interpreter", "method", ":", "Use", "Colorizing" ]
def showsyntaxerror(self, filename=None): """Override Interactive Interpreter method: Use Colorizing Color the offending position instead of printing it and pointing at it with a caret. """ tkconsole = self.tkconsole text = tkconsole.text text.tag_remove("ERROR"...
[ "def", "showsyntaxerror", "(", "self", ",", "filename", "=", "None", ")", ":", "tkconsole", "=", "self", ".", "tkconsole", "text", "=", "tkconsole", ".", "text", "text", ".", "tag_remove", "(", "\"ERROR\"", ",", "\"1.0\"", ",", "\"end\"", ")", "type", ",...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/idlelib/PyShell.py#L701-L725
thinkle/gourmet
8af29c8ded24528030e5ae2ea3461f61c1e5a575
gourmet/plugins/unit_display_prefs/unit_prefs_dialog.py
python
UnitPrefsDialog.run
(self)
[]
def run (self): old_pref = self.prefs.get('preferred_unit_groups',[]) option = de.getRadio(label=_("Automatically adjust units"), sublabel="Choose how you would like to adjust units for display and printing. The underlying ingredient data stored in the database will not be a...
[ "def", "run", "(", "self", ")", ":", "old_pref", "=", "self", ".", "prefs", ".", "get", "(", "'preferred_unit_groups'", ",", "[", "]", ")", "option", "=", "de", ".", "getRadio", "(", "label", "=", "_", "(", "\"Automatically adjust units\"", ")", ",", "...
https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/plugins/unit_display_prefs/unit_prefs_dialog.py#L17-L26
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/data/utils/pythoneditor/completer.py
python
CompletionWidget.update_current
(self)
Update the displayed list.
Update the displayed list.
[ "Update", "the", "displayed", "list", "." ]
def update_current(self): """ Update the displayed list. """ if not self.is_position_correct(): self.hide() return current_word = self.textedit.get_current_word(completion=True) self.update_list(current_word) # self.setFocus() # se...
[ "def", "update_current", "(", "self", ")", ":", "if", "not", "self", ".", "is_position_correct", "(", ")", ":", "self", ".", "hide", "(", ")", "return", "current_word", "=", "self", ".", "textedit", ".", "get_current_word", "(", "completion", "=", "True", ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/utils/pythoneditor/completer.py#L404-L416
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbLingShouZhongDuan.tmall_nrt_easyhomemember_syn
( self, param )
return self._top_request( "tmall.nrt.easyhomemember.syn", { "param": param } )
会员信息同 居然之家将会员信息同步到零售中台 包含基本的会员信息 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=38132 :param param: 入参
会员信息同 居然之家将会员信息同步到零售中台 包含基本的会员信息 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=38132
[ "会员信息同", "居然之家将会员信息同步到零售中台", "包含基本的会员信息", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "38132" ]
def tmall_nrt_easyhomemember_syn( self, param ): """ 会员信息同 居然之家将会员信息同步到零售中台 包含基本的会员信息 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=38132 :param param: 入参 """ return self._top_request( "tmall.nrt.easyhomemember.syn"...
[ "def", "tmall_nrt_easyhomemember_syn", "(", "self", ",", "param", ")", ":", "return", "self", ".", "_top_request", "(", "\"tmall.nrt.easyhomemember.syn\"", ",", "{", "\"param\"", ":", "param", "}", ")" ]
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L97019-L97035
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/compiler/future.py
python
FutureParser.get_features
(self)
return self.found.keys()
Return list of features enabled by future statements
Return list of features enabled by future statements
[ "Return", "list", "of", "features", "enabled", "by", "future", "statements" ]
def get_features(self): """Return list of features enabled by future statements""" return self.found.keys()
[ "def", "get_features", "(", "self", ")", ":", "return", "self", ".", "found", ".", "keys", "(", ")" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/compiler/future.py#L46-L48
PyHDI/veriloggen
2382d200deabf59cfcfd741f5eba371010aaf2bb
veriloggen/thread/axistreamin.py
python
AXIStreamIn._synthesize_read_fsm_same
(self, ram, port, ram_method, ram_datawidth)
new op and fsm
new op and fsm
[ "new", "op", "and", "fsm" ]
def _synthesize_read_fsm_same(self, ram, port, ram_method, ram_datawidth): op_id = self._get_read_op_id(ram, port, ram_method) port = vtypes.to_int(port) if op_id in self.read_ops: """ already synthesized op """ return if self.read_fsm is not None: ...
[ "def", "_synthesize_read_fsm_same", "(", "self", ",", "ram", ",", "port", ",", "ram_method", ",", "ram_datawidth", ")", ":", "op_id", "=", "self", ".", "_get_read_op_id", "(", "ram", ",", "port", ",", "ram_method", ")", "port", "=", "vtypes", ".", "to_int"...
https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/thread/axistreamin.py#L259-L354
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/distutils/misc_util.py
python
_get_f90_modules
(source)
return modules
Return a list of Fortran f90 module names that given source file defines.
Return a list of Fortran f90 module names that given source file defines.
[ "Return", "a", "list", "of", "Fortran", "f90", "module", "names", "that", "given", "source", "file", "defines", "." ]
def _get_f90_modules(source): """Return a list of Fortran f90 module names that given source file defines. """ if not f90_ext_match(source): return [] modules = [] f = open(source, 'r') for line in f: m = f90_module_name_match(line) if m: name = m.group('n...
[ "def", "_get_f90_modules", "(", "source", ")", ":", "if", "not", "f90_ext_match", "(", "source", ")", ":", "return", "[", "]", "modules", "=", "[", "]", "f", "=", "open", "(", "source", ",", "'r'", ")", "for", "line", "in", "f", ":", "m", "=", "f...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/distutils/misc_util.py#L439-L454
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Django/django/contrib/localflavor/se/utils.py
python
id_number_checksum
(gd)
return (((s // 10) + 1) * 10) - s
Calculates a Swedish ID number checksum, using the "Luhn"-algoritm
Calculates a Swedish ID number checksum, using the "Luhn"-algoritm
[ "Calculates", "a", "Swedish", "ID", "number", "checksum", "using", "the", "Luhn", "-", "algoritm" ]
def id_number_checksum(gd): """ Calculates a Swedish ID number checksum, using the "Luhn"-algoritm """ n = s = 0 for c in (gd['year'] + gd['month'] + gd['day'] + gd['serial']): tmp = ((n % 2) and 1 or 2) * int(c) if tmp > 9: tmp = sum([int(i) for i in str(tmp)]) ...
[ "def", "id_number_checksum", "(", "gd", ")", ":", "n", "=", "s", "=", "0", "for", "c", "in", "(", "gd", "[", "'year'", "]", "+", "gd", "[", "'month'", "]", "+", "gd", "[", "'day'", "]", "+", "gd", "[", "'serial'", "]", ")", ":", "tmp", "=", ...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/contrib/localflavor/se/utils.py#L4-L22
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
cms/djangoapps/contentstore/views/assets.py
python
_check_thumbnail_uploaded
(thumbnail_content)
return thumbnail_content is not None
returns whether thumbnail is None
returns whether thumbnail is None
[ "returns", "whether", "thumbnail", "is", "None" ]
def _check_thumbnail_uploaded(thumbnail_content): """returns whether thumbnail is None""" return thumbnail_content is not None
[ "def", "_check_thumbnail_uploaded", "(", "thumbnail_content", ")", ":", "return", "thumbnail_content", "is", "not", "None" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/cms/djangoapps/contentstore/views/assets.py#L502-L504
inventree/InvenTree
4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b
InvenTree/InvenTree/helpers.py
python
TestIfImage
(img)
Test if an image file is indeed an image
Test if an image file is indeed an image
[ "Test", "if", "an", "image", "file", "is", "indeed", "an", "image" ]
def TestIfImage(img): """ Test if an image file is indeed an image """ try: Image.open(img).verify() return True except: return False
[ "def", "TestIfImage", "(", "img", ")", ":", "try", ":", "Image", ".", "open", "(", "img", ")", ".", "verify", "(", ")", "return", "True", "except", ":", "return", "False" ]
https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/InvenTree/helpers.py#L117-L123
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/vistir/_winconsole.py
python
ConsoleStream.isatty
(self)
return self.buffer.isatty()
[]
def isatty(self): return self.buffer.isatty()
[ "def", "isatty", "(", "self", ")", ":", "return", "self", ".", "buffer", ".", "isatty", "(", ")" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/vistir/_winconsole.py#L274-L275
carla-simulator/scenario_runner
f4d00d88eda4212a1e119515c96281a4be5c234e
srunner/scenarios/object_crash_intersection.py
python
BaseVehicleTurning._create_test_criteria
(self)
return criteria
A list of all test criteria will be created that is later used in parallel behavior tree.
A list of all test criteria will be created that is later used in parallel behavior tree.
[ "A", "list", "of", "all", "test", "criteria", "will", "be", "created", "that", "is", "later", "used", "in", "parallel", "behavior", "tree", "." ]
def _create_test_criteria(self): """ A list of all test criteria will be created that is later used in parallel behavior tree. """ criteria = [] collision_criterion = CollisionTest(self.ego_vehicles[0]) criteria.append(collision_criterion) return criteria
[ "def", "_create_test_criteria", "(", "self", ")", ":", "criteria", "=", "[", "]", "collision_criterion", "=", "CollisionTest", "(", "self", ".", "ego_vehicles", "[", "0", "]", ")", "criteria", ".", "append", "(", "collision_criterion", ")", "return", "criteria...
https://github.com/carla-simulator/scenario_runner/blob/f4d00d88eda4212a1e119515c96281a4be5c234e/srunner/scenarios/object_crash_intersection.py#L199-L208
Netflix/image_compression_comparison
a25b8823b5e835bf6b980a230001108c05767cad
script_compress_parallel.py
python
remove_files_keeping_encode
(temp_folder, encoded_file)
remove files but keep encode
remove files but keep encode
[ "remove", "files", "but", "keep", "encode" ]
def remove_files_keeping_encode(temp_folder, encoded_file): """ remove files but keep encode """ for f in listdir_full_path(temp_folder): if ntpath.basename(f) != ntpath.basename(encoded_file): os.remove(f)
[ "def", "remove_files_keeping_encode", "(", "temp_folder", ",", "encoded_file", ")", ":", "for", "f", "in", "listdir_full_path", "(", "temp_folder", ")", ":", "if", "ntpath", ".", "basename", "(", "f", ")", "!=", "ntpath", ".", "basename", "(", "encoded_file", ...
https://github.com/Netflix/image_compression_comparison/blob/a25b8823b5e835bf6b980a230001108c05767cad/script_compress_parallel.py#L886-L891
modoboa/modoboa
9065b7a5679fee149fc6f6f0e1760699c194cf89
modoboa/core/sms_backends/__init__.py
python
get_active_backend
(parameters)
return backend_class(parameters)
Return active SMS backend.
Return active SMS backend.
[ "Return", "active", "SMS", "backend", "." ]
def get_active_backend(parameters): """Return active SMS backend.""" name = parameters.get_value("sms_provider") if not name: return None backend_class = get_backend_class(name) if not backend_class: return None return backend_class(parameters)
[ "def", "get_active_backend", "(", "parameters", ")", ":", "name", "=", "parameters", ".", "get_value", "(", "\"sms_provider\"", ")", "if", "not", "name", ":", "return", "None", "backend_class", "=", "get_backend_class", "(", "name", ")", "if", "not", "backend_...
https://github.com/modoboa/modoboa/blob/9065b7a5679fee149fc6f6f0e1760699c194cf89/modoboa/core/sms_backends/__init__.py#L115-L123
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_vendor/distlib/util.py
python
_get_external_data
(url)
return result
[]
def _get_external_data(url): result = {} try: # urlopen might fail if it runs into redirections, # because of Python issue #13696. Fixed in locators # using a custom redirect handler. resp = urlopen(url) headers = resp.info() ct = headers.get('Content-Type') ...
[ "def", "_get_external_data", "(", "url", ")", ":", "result", "=", "{", "}", "try", ":", "# urlopen might fail if it runs into redirections,", "# because of Python issue #13696. Fixed in locators", "# using a custom redirect handler.", "resp", "=", "urlopen", "(", "url", ")", ...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/distlib/util.py#L907-L925
deepfakes/faceswap
09c7d8aca3c608d1afad941ea78e9fd9b64d9219
tools/alignments/media.py
python
Frames.process_frames
(self)
Process exported Frames
Process exported Frames
[ "Process", "exported", "Frames" ]
def process_frames(self): """ Process exported Frames """ logger.info("Loading file list from %s", self.folder) for frame in os.listdir(self.folder): if not self.valid_extension(frame): continue filename = os.path.splitext(frame)[0] file_extens...
[ "def", "process_frames", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Loading file list from %s\"", ",", "self", ".", "folder", ")", "for", "frame", "in", "os", ".", "listdir", "(", "self", ".", "folder", ")", ":", "if", "not", "self", ".", "v...
https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/tools/alignments/media.py#L313-L326
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/http/cookiejar.py
python
MozillaCookieJar._really_load
(self, f, filename, ignore_discard, ignore_expires)
[]
def _really_load(self, f, filename, ignore_discard, ignore_expires): now = time.time() magic = f.readline() if not self.magic_re.search(magic): f.close() raise LoadError( "%r does not look like a Netscape format cookies file" % filename) ...
[ "def", "_really_load", "(", "self", ",", "f", ",", "filename", ",", "ignore_discard", ",", "ignore_expires", ")", ":", "now", "=", "time", ".", "time", "(", ")", "magic", "=", "f", ".", "readline", "(", ")", "if", "not", "self", ".", "magic_re", ".",...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/http/cookiejar.py#L2010-L2074
tensorflow/tensor2tensor
2a33b152d7835af66a6d20afe7961751047e28dd
tensor2tensor/utils/rouge.py
python
rouge_2_fscore
(predictions, labels, **unused_kwargs)
return rouge_2_f_score, tf.constant(1.0)
ROUGE-2 F1 score computation between labels and predictions. This is an approximate ROUGE scoring method since we do not glue word pieces or decode the ids and tokenize the output. Args: predictions: tensor, model predictions labels: tensor, gold output. Returns: rouge2_fscore: approx rouge-2 f1 ...
ROUGE-2 F1 score computation between labels and predictions.
[ "ROUGE", "-", "2", "F1", "score", "computation", "between", "labels", "and", "predictions", "." ]
def rouge_2_fscore(predictions, labels, **unused_kwargs): """ROUGE-2 F1 score computation between labels and predictions. This is an approximate ROUGE scoring method since we do not glue word pieces or decode the ids and tokenize the output. Args: predictions: tensor, model predictions labels: tensor,...
[ "def", "rouge_2_fscore", "(", "predictions", ",", "labels", ",", "*", "*", "unused_kwargs", ")", ":", "outputs", "=", "tf", ".", "to_int32", "(", "tf", ".", "argmax", "(", "predictions", ",", "axis", "=", "-", "1", ")", ")", "# Convert the outputs and labe...
https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/utils/rouge.py#L217-L236
wxGlade/wxGlade
44ed0d1cba78f27c5c0a56918112a737653b7b27
codegen/__init__.py
python
BaseLangCodeWriter._quote_str
(self, s)
Language specific implementation for escaping or quoting.
Language specific implementation for escaping or quoting.
[ "Language", "specific", "implementation", "for", "escaping", "or", "quoting", "." ]
def _quote_str(self, s): "Language specific implementation for escaping or quoting." raise NotImplementedError
[ "def", "_quote_str", "(", "self", ",", "s", ")", ":", "raise", "NotImplementedError" ]
https://github.com/wxGlade/wxGlade/blob/44ed0d1cba78f27c5c0a56918112a737653b7b27/codegen/__init__.py#L1032-L1034
IntelLabs/nlp-architect
60afd0dd1bfd74f01b4ac8f613cb484777b80284
examples/sparse_gnmt/train.py
python
run_internal_and_external_eval
( model_dir, infer_model, infer_sess, eval_model, eval_sess, hparams, summary_writer, avg_ckpts=False, dev_eval_iterator_feed_dict=None, test_eval_iterator_feed_dict=None, dev_infer_iterator_feed_dict=None, test_infer_iterator_feed_dict=None, )
return result_summary, global_step, metrics
Compute internal evaluation (perplexity) for both dev / test. Computes development and testing perplexities for given model. Args: model_dir: Directory from which to load models from. infer_model: Inference model for which to compute perplexities. infer_sess: Inference TensorFlow session. ...
Compute internal evaluation (perplexity) for both dev / test.
[ "Compute", "internal", "evaluation", "(", "perplexity", ")", "for", "both", "dev", "/", "test", "." ]
def run_internal_and_external_eval( model_dir, infer_model, infer_sess, eval_model, eval_sess, hparams, summary_writer, avg_ckpts=False, dev_eval_iterator_feed_dict=None, test_eval_iterator_feed_dict=None, dev_infer_iterator_feed_dict=None, test_infer_iterator_feed_dict=N...
[ "def", "run_internal_and_external_eval", "(", "model_dir", ",", "infer_model", ",", "infer_sess", ",", "eval_model", ",", "eval_sess", ",", "hparams", ",", "summary_writer", ",", "avg_ckpts", "=", "False", ",", "dev_eval_iterator_feed_dict", "=", "None", ",", "test_...
https://github.com/IntelLabs/nlp-architect/blob/60afd0dd1bfd74f01b4ac8f613cb484777b80284/examples/sparse_gnmt/train.py#L270-L357
globocom/m3u8
cf7ae5fda4681efcea796cd7c51c02f152c36009
m3u8/parser.py
python
parse
(content, strict=False, custom_tags_parser=None)
return data
Given a M3U8 playlist content returns a dictionary with all data found
Given a M3U8 playlist content returns a dictionary with all data found
[ "Given", "a", "M3U8", "playlist", "content", "returns", "a", "dictionary", "with", "all", "data", "found" ]
def parse(content, strict=False, custom_tags_parser=None): ''' Given a M3U8 playlist content returns a dictionary with all data found ''' data = { 'media_sequence': 0, 'is_variant': False, 'is_endlist': False, 'is_i_frames_only': False, 'is_independent_segments': ...
[ "def", "parse", "(", "content", ",", "strict", "=", "False", ",", "custom_tags_parser", "=", "None", ")", ":", "data", "=", "{", "'media_sequence'", ":", "0", ",", "'is_variant'", ":", "False", ",", "'is_endlist'", ":", "False", ",", "'is_i_frames_only'", ...
https://github.com/globocom/m3u8/blob/cf7ae5fda4681efcea796cd7c51c02f152c36009/m3u8/parser.py#L38-L220
frePPLe/frepple
57aa612030b4fcd03cb9c613f83a7dac4f0e8d6d
freppledb/common/templatetags.py
python
extensionfilter
(val)
return Path(val).suffix[1:].lower()
[]
def extensionfilter(val): return Path(val).suffix[1:].lower()
[ "def", "extensionfilter", "(", "val", ")", ":", "return", "Path", "(", "val", ")", ".", "suffix", "[", "1", ":", "]", ".", "lower", "(", ")" ]
https://github.com/frePPLe/frepple/blob/57aa612030b4fcd03cb9c613f83a7dac4f0e8d6d/freppledb/common/templatetags.py#L782-L783
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/html5lib/inputstream.py
python
EncodingParser.getAttribute
(self)
Return a name,value pair for the next attribute in the stream, if one is found, or None
Return a name,value pair for the next attribute in the stream, if one is found, or None
[ "Return", "a", "name", "value", "pair", "for", "the", "next", "attribute", "in", "the", "stream", "if", "one", "is", "found", "or", "None" ]
def getAttribute(self): """Return a name,value pair for the next attribute in the stream, if one is found, or None""" data = self.data # Step 1 (skip chars) c = data.skip(spaceCharactersBytes | frozenset([b"/"])) assert c is None or len(c) == 1 # Step 2 if...
[ "def", "getAttribute", "(", "self", ")", ":", "data", "=", "self", ".", "data", "# Step 1 (skip chars)", "c", "=", "data", ".", "skip", "(", "spaceCharactersBytes", "|", "frozenset", "(", "[", "b\"/\"", "]", ")", ")", "assert", "c", "is", "None", "or", ...
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/html5lib/inputstream.py#L758-L832
allegroai/clearml
5953dc6eefadcdfcc2bdbb6a0da32be58823a5af
clearml/backend_config/config.py
python
Config.get_config_for_bucket
(self, base_url, extra_configurations=None)
return S3BucketConfig( key=self.get("sdk.aws.s3.key", None), secret=self.get("sdk.aws.s3.secret", None), region=self.get("sdk.aws.s3.region", None), use_credentials_chain=self.get("sdk.aws.s3.use_credentials_chain", None), multipart=True, bucket=bu...
Get the credentials for an AWS S3 bucket from the config :param base_url: URL of bucket :param extra_configurations: :return: bucket config
Get the credentials for an AWS S3 bucket from the config :param base_url: URL of bucket :param extra_configurations: :return: bucket config
[ "Get", "the", "credentials", "for", "an", "AWS", "S3", "bucket", "from", "the", "config", ":", "param", "base_url", ":", "URL", "of", "bucket", ":", "param", "extra_configurations", ":", ":", "return", ":", "bucket", "config" ]
def get_config_for_bucket(self, base_url, extra_configurations=None): """ Get the credentials for an AWS S3 bucket from the config :param base_url: URL of bucket :param extra_configurations: :return: bucket config """ warnings.warn( "Use backend_confi...
[ "def", "get_config_for_bucket", "(", "self", ",", "base_url", ",", "extra_configurations", "=", "None", ")", ":", "warnings", ".", "warn", "(", "\"Use backend_config.bucket_config.BucketList.get_config_for_uri\"", ",", "DeprecationWarning", ",", ")", "configs", "=", "S3...
https://github.com/allegroai/clearml/blob/5953dc6eefadcdfcc2bdbb6a0da32be58823a5af/clearml/backend_config/config.py#L335-L413
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/openstack/common/rpc/impl_qpid.py
python
ConsumerBase.consume
(self)
Fetch the message and pass it to the callback object
Fetch the message and pass it to the callback object
[ "Fetch", "the", "message", "and", "pass", "it", "to", "the", "callback", "object" ]
def consume(self): """Fetch the message and pass it to the callback object""" message = self.receiver.fetch() try: msg = rpc_common.deserialize_msg(message.content) self.callback(msg) except Exception: LOG.exception(_("Failed to process message... skip...
[ "def", "consume", "(", "self", ")", ":", "message", "=", "self", ".", "receiver", ".", "fetch", "(", ")", "try", ":", "msg", "=", "rpc_common", ".", "deserialize_msg", "(", "message", ".", "content", ")", "self", ".", "callback", "(", "msg", ")", "ex...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/openstack/common/rpc/impl_qpid.py#L126-L135
dmlc/gluon-cv
709bc139919c02f7454cb411311048be188cde64
gluoncv/data/transforms/presets/center_net.py
python
CenterNetDefaultTrainTransform.__call__
(self, src, label)
return img, heatmap, wh_target, wh_mask, center_reg, center_reg_mask
Apply transform to training image/label.
Apply transform to training image/label.
[ "Apply", "transform", "to", "training", "image", "/", "label", "." ]
def __call__(self, src, label): """Apply transform to training image/label.""" # random color jittering img = src bbox = label # random horizontal flip h, w, _ = img.shape img, flips = timage.random_flip(img, px=0.5) bbox = tbbox.flip(bbox, (w, h), flip_x...
[ "def", "__call__", "(", "self", ",", "src", ",", "label", ")", ":", "# random color jittering", "img", "=", "src", "bbox", "=", "label", "# random horizontal flip", "h", ",", "w", ",", "_", "=", "img", ".", "shape", "img", ",", "flips", "=", "timage", ...
https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/gluoncv/data/transforms/presets/center_net.py#L146-L191
mylar3/mylar3
fce4771c5b627f8de6868dd4ab6bc53f7b22d303
lib/rarfile/rarfile.py
python
DirectReader.readinto
(self, buf)
return got
Zero-copy read directly into buffer.
Zero-copy read directly into buffer.
[ "Zero", "-", "copy", "read", "directly", "into", "buffer", "." ]
def readinto(self, buf): """Zero-copy read directly into buffer.""" got = 0 vbuf = memoryview(buf) while got < len(buf): # next vol needed? if self._cur_avail == 0: if not self._open_next(): break # length for next ...
[ "def", "readinto", "(", "self", ",", "buf", ")", ":", "got", "=", "0", "vbuf", "=", "memoryview", "(", "buf", ")", "while", "got", "<", "len", "(", "buf", ")", ":", "# next vol needed?", "if", "self", ".", "_cur_avail", "==", "0", ":", "if", "not",...
https://github.com/mylar3/mylar3/blob/fce4771c5b627f8de6868dd4ab6bc53f7b22d303/lib/rarfile/rarfile.py#L2498-L2521
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/PIL/ImageFont.py
python
FreeTypeFont.set_variation_by_name
(self, name)
:param name: The name of the style. :exception OSError: If the font is not a variation font.
:param name: The name of the style. :exception OSError: If the font is not a variation font.
[ ":", "param", "name", ":", "The", "name", "of", "the", "style", ".", ":", "exception", "OSError", ":", "If", "the", "font", "is", "not", "a", "variation", "font", "." ]
def set_variation_by_name(self, name): """ :param name: The name of the style. :exception OSError: If the font is not a variation font. """ names = self.get_variation_names() if not isinstance(name, bytes): name = name.encode() index = names.index(name...
[ "def", "set_variation_by_name", "(", "self", ",", "name", ")", ":", "names", "=", "self", ".", "get_variation_names", "(", ")", "if", "not", "isinstance", "(", "name", ",", "bytes", ")", ":", "name", "=", "name", ".", "encode", "(", ")", "index", "=", ...
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/PIL/ImageFont.py#L712-L729
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/aiohttp_lib_py352/multidict/_multidict_py.py
python
MultiDict.update
(self, *args, **kwargs)
Update the dictionary from *other*, overwriting existing keys.
Update the dictionary from *other*, overwriting existing keys.
[ "Update", "the", "dictionary", "from", "*", "other", "*", "overwriting", "existing", "keys", "." ]
def update(self, *args, **kwargs): """Update the dictionary from *other*, overwriting existing keys.""" self._extend(args, kwargs, 'update', self._update_items)
[ "def", "update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_extend", "(", "args", ",", "kwargs", ",", "'update'", ",", "self", ".", "_update_items", ")" ]
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/aiohttp_lib_py352/multidict/_multidict_py.py#L347-L349
IntelAI/models
1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c
models/language_translation/tensorflow/transformer_mlperf/inference/int8/transformer/compute_bleu.py
python
bleu_tokenize
(string)
return string.split()
r"""Tokenize a string following the official BLEU implementation. See https://github.com/moses-smt/mosesdecoder/' 'blob/master/scripts/generic/mteval-v14.pl#L954-L983 In our case, the input string is expected to be just one line and no HTML entities de-escaping is needed. So we just tokenize on punc...
r"""Tokenize a string following the official BLEU implementation.
[ "r", "Tokenize", "a", "string", "following", "the", "official", "BLEU", "implementation", "." ]
def bleu_tokenize(string): r"""Tokenize a string following the official BLEU implementation. See https://github.com/moses-smt/mosesdecoder/' 'blob/master/scripts/generic/mteval-v14.pl#L954-L983 In our case, the input string is expected to be just one line and no HTML entities de-escaping is needed. ...
[ "def", "bleu_tokenize", "(", "string", ")", ":", "string", "=", "uregex", ".", "nondigit_punct_re", ".", "sub", "(", "r\"\\1 \\2 \"", ",", "string", ")", "string", "=", "uregex", ".", "punct_nondigit_re", ".", "sub", "(", "r\" \\1 \\2\"", ",", "string", ")",...
https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_mlperf/inference/int8/transformer/compute_bleu.py#L53-L80
tensorflow/tensor2tensor
2a33b152d7835af66a6d20afe7961751047e28dd
tensor2tensor/models/research/transformer_vae_flow_prior.py
python
wmt_diag_base_trueadam_longer_1e4
()
return hparams
Set of hyperparameters.
Set of hyperparameters.
[ "Set", "of", "hyperparameters", "." ]
def wmt_diag_base_trueadam_longer_1e4(): """Set of hyperparameters.""" hparams = wmt_diag_base_trueadam_1e4() hparams.learning_rate_constant = 4.0 hparams.learning_rate_warmup_steps = 20000 return hparams
[ "def", "wmt_diag_base_trueadam_longer_1e4", "(", ")", ":", "hparams", "=", "wmt_diag_base_trueadam_1e4", "(", ")", "hparams", ".", "learning_rate_constant", "=", "4.0", "hparams", ".", "learning_rate_warmup_steps", "=", "20000", "return", "hparams" ]
https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/models/research/transformer_vae_flow_prior.py#L723-L728
returntocorp/bento
05b365da71b65170d41fe92a702480ab76c1d17c
bento/tool/runner/js_tool.py
python
JsTool._installed_version
(self, package: str, location: Path)
Gets the version of a package that was installed. Returns None if that package has not been installed.
Gets the version of a package that was installed.
[ "Gets", "the", "version", "of", "a", "package", "that", "was", "installed", "." ]
def _installed_version(self, package: str, location: Path) -> Optional[Version]: """ Gets the version of a package that was installed. Returns None if that package has not been installed. """ package_json_path = location / "node_modules" / package / "package.json" try: ...
[ "def", "_installed_version", "(", "self", ",", "package", ":", "str", ",", "location", ":", "Path", ")", "->", "Optional", "[", "Version", "]", ":", "package_json_path", "=", "location", "/", "\"node_modules\"", "/", "package", "/", "\"package.json\"", "try", ...
https://github.com/returntocorp/bento/blob/05b365da71b65170d41fe92a702480ab76c1d17c/bento/tool/runner/js_tool.py#L50-L65
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/PIL/ImagePalette.py
python
random
(mode="RGB")
return ImagePalette(mode, palette)
[]
def random(mode="RGB"): from random import randint palette = [] for i in range(256 * len(mode)): palette.append(randint(0, 255)) return ImagePalette(mode, palette)
[ "def", "random", "(", "mode", "=", "\"RGB\"", ")", ":", "from", "random", "import", "randint", "palette", "=", "[", "]", "for", "i", "in", "range", "(", "256", "*", "len", "(", "mode", ")", ")", ":", "palette", ".", "append", "(", "randint", "(", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/PIL/ImagePalette.py#L177-L183
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/pyasn1/type/univ.py
python
Real.__add__
(self, value)
return self.clone(float(self) + value)
[]
def __add__(self, value): return self.clone(float(self) + value)
[ "def", "__add__", "(", "self", ",", "value", ")", ":", "return", "self", ".", "clone", "(", "float", "(", "self", ")", "+", "value", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/pyasn1/type/univ.py#L1416-L1417
donnemartin/gitsome
d7c57abc7cb66e9c910a844f15d4536866da3310
gitsome/github.py
python
GitHub.create_issue
(self, user_repo, issue_title, issue_desc='')
Create an issue. :type user_repo: str :param user_repo: The user/repo. :type issue_title: str :param issue_title: The issue title. :type issue_desc: str :param issue_desc: The issue body (optional).
Create an issue.
[ "Create", "an", "issue", "." ]
def create_issue(self, user_repo, issue_title, issue_desc=''): """Create an issue. :type user_repo: str :param user_repo: The user/repo. :type issue_title: str :param issue_title: The issue title. :type issue_desc: str :param issue_desc: The issue body (optiona...
[ "def", "create_issue", "(", "self", ",", "user_repo", ",", "issue_title", ",", "issue_desc", "=", "''", ")", ":", "try", ":", "user", ",", "repo_name", "=", "user_repo", ".", "split", "(", "'/'", ")", "except", "ValueError", ":", "click", ".", "secho", ...
https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/gitsome/github.py#L222-L249
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/subprocess.py
python
Popen.__init__
(self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0)
return
Create new Popen instance.
Create new Popen instance.
[ "Create", "new", "Popen", "instance", "." ]
def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0): """Create new Popen instance.""" _cleanup() self._child_created = False ...
[ "def", "__init__", "(", "self", ",", "args", ",", "bufsize", "=", "0", ",", "executable", "=", "None", ",", "stdin", "=", "None", ",", "stdout", "=", "None", ",", "stderr", "=", "None", ",", "preexec_fn", "=", "None", ",", "close_fds", "=", "False", ...
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/subprocess.py#L594-L637
rietveld-codereview/rietveld
82e415f6a291c58c714d3869c7a1de818546c7d5
third_party/gflags.py
python
FlagValues._AssertValidators
(self, validators)
Assert if all validators in the list are satisfied. Asserts validators in the order they were created. Args: validators: Iterable(gflags_validators.Validator), validators to be verified Raises: AttributeError: if validators work with a non-existing flag. IllegalFlagValue: if valid...
Assert if all validators in the list are satisfied.
[ "Assert", "if", "all", "validators", "in", "the", "list", "are", "satisfied", "." ]
def _AssertValidators(self, validators): """Assert if all validators in the list are satisfied. Asserts validators in the order they were created. Args: validators: Iterable(gflags_validators.Validator), validators to be verified Raises: AttributeError: if validators work with a non...
[ "def", "_AssertValidators", "(", "self", ",", "validators", ")", ":", "for", "validator", "in", "sorted", "(", "validators", ",", "key", "=", "lambda", "validator", ":", "validator", ".", "insertion_index", ")", ":", "try", ":", "validator", ".", "Verify", ...
https://github.com/rietveld-codereview/rietveld/blob/82e415f6a291c58c714d3869c7a1de818546c7d5/third_party/gflags.py#L1076-L1093
aliles/begins
23bc0d802198831375f4286a7e22377a1a1bf952
begin/formatters.py
python
compose
(*mixins, **kwargs)
return type(name, tuple(mixins) + (argparse.HelpFormatter,), {})
Compose a new help formatter class for argparse. Accepts a variable number of mixin class and uses these as base classes with multiple inheritance against argparse.HelpFormatter to create a new help formatter class.
Compose a new help formatter class for argparse.
[ "Compose", "a", "new", "help", "formatter", "class", "for", "argparse", "." ]
def compose(*mixins, **kwargs): """Compose a new help formatter class for argparse. Accepts a variable number of mixin class and uses these as base classes with multiple inheritance against argparse.HelpFormatter to create a new help formatter class. """ if not set(['name']).issuperset(kwargs.k...
[ "def", "compose", "(", "*", "mixins", ",", "*", "*", "kwargs", ")", ":", "if", "not", "set", "(", "[", "'name'", "]", ")", ".", "issuperset", "(", "kwargs", ".", "keys", "(", ")", ")", ":", "unknown", "=", "set", "(", "kwargs", ".", "keys", "("...
https://github.com/aliles/begins/blob/23bc0d802198831375f4286a7e22377a1a1bf952/begin/formatters.py#L58-L71
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/marian/modeling_tf_marian.py
python
_expand_mask
(mask: tf.Tensor, tgt_len: Optional[int] = None, past_key_values_length: int = 0)
return (one_cst - expanded_mask) * LARGE_NEGATIVE
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
[ "Expands", "attention_mask", "from", "[", "bsz", "seq_len", "]", "to", "[", "bsz", "1", "tgt_seq_len", "src_seq_len", "]", "." ]
def _expand_mask(mask: tf.Tensor, tgt_len: Optional[int] = None, past_key_values_length: int = 0): """ Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`. """ src_len = shape_list(mask)[1] tgt_len = tgt_len if tgt_len is not None else src_len one_cst = tf.consta...
[ "def", "_expand_mask", "(", "mask", ":", "tf", ".", "Tensor", ",", "tgt_len", ":", "Optional", "[", "int", "]", "=", "None", ",", "past_key_values_length", ":", "int", "=", "0", ")", ":", "src_len", "=", "shape_list", "(", "mask", ")", "[", "1", "]",...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/marian/modeling_tf_marian.py#L104-L114
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/forms/fields.py
python
ChoiceField.to_python
(self, value)
return str(value)
Return a string.
Return a string.
[ "Return", "a", "string", "." ]
def to_python(self, value): """Return a string.""" if value in self.empty_values: return '' return str(value)
[ "def", "to_python", "(", "self", ",", "value", ")", ":", "if", "value", "in", "self", ".", "empty_values", ":", "return", "''", "return", "str", "(", "value", ")" ]
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/forms/fields.py#L806-L810
wtforms/wtforms
efe4e90acdb4a6b5d9b64a25756a33b41719319b
src/wtforms/form.py
python
BaseForm.__getitem__
(self, name)
return self._fields[name]
Dict-style access to this form's fields.
Dict-style access to this form's fields.
[ "Dict", "-", "style", "access", "to", "this", "form", "s", "fields", "." ]
def __getitem__(self, name): """Dict-style access to this form's fields.""" return self._fields[name]
[ "def", "__getitem__", "(", "self", ",", "name", ")", ":", "return", "self", ".", "_fields", "[", "name", "]" ]
https://github.com/wtforms/wtforms/blob/efe4e90acdb4a6b5d9b64a25756a33b41719319b/src/wtforms/form.py#L61-L63