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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/graphs/digraph.py | python | DiGraph.neighbor_in_iterator | (self, vertex) | return iter(set(self._backend.iterator_in_nbrs(vertex))) | Return an iterator over the in-neighbors of ``vertex``.
An vertex `u` is an in-neighbor of a vertex `v` if `uv` in an edge.
EXAMPLES::
sage: D = DiGraph({0: [1,2,3], 1: [0,2], 2: [3], 3: [4], 4: [0,5], 5: [1]})
sage: for a in D.neighbor_in_iterator(0):
....: pr... | Return an iterator over the in-neighbors of ``vertex``. | [
"Return",
"an",
"iterator",
"over",
"the",
"in",
"-",
"neighbors",
"of",
"vertex",
"."
] | def neighbor_in_iterator(self, vertex):
"""
Return an iterator over the in-neighbors of ``vertex``.
An vertex `u` is an in-neighbor of a vertex `v` if `uv` in an edge.
EXAMPLES::
sage: D = DiGraph({0: [1,2,3], 1: [0,2], 2: [3], 3: [4], 4: [0,5], 5: [1]})
sage: ... | [
"def",
"neighbor_in_iterator",
"(",
"self",
",",
"vertex",
")",
":",
"return",
"iter",
"(",
"set",
"(",
"self",
".",
"_backend",
".",
"iterator_in_nbrs",
"(",
"vertex",
")",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/graphs/digraph.py#L1180-L1194 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_darwin/systrace/catapult/third_party/pyserial/serial/urlhandler/protocol_loop.py | python | LoopbackSerial.flushOutput | (self) | Clear output buffer, aborting the current output and
discarding all that is in the buffer. | Clear output buffer, aborting the current output and
discarding all that is in the buffer. | [
"Clear",
"output",
"buffer",
"aborting",
"the",
"current",
"output",
"and",
"discarding",
"all",
"that",
"is",
"in",
"the",
"buffer",
"."
] | def flushOutput(self):
"""Clear output buffer, aborting the current output and
discarding all that is in the buffer."""
if not self._isOpen: raise portNotOpenError
if self.logger:
self.logger.info('flushOutput()') | [
"def",
"flushOutput",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_isOpen",
":",
"raise",
"portNotOpenError",
"if",
"self",
".",
"logger",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'flushOutput()'",
")"
] | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_darwin/systrace/catapult/third_party/pyserial/serial/urlhandler/protocol_loop.py#L174-L179 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/words/protocols/irc.py | python | IRCClient.yourHost | (self, info) | Called with daemon information about the server, usually at logon.
@type info: C{str}
@param when: A string describing what software the server is running, probably. | Called with daemon information about the server, usually at logon. | [
"Called",
"with",
"daemon",
"information",
"about",
"the",
"server",
"usually",
"at",
"logon",
"."
] | def yourHost(self, info):
"""Called with daemon information about the server, usually at logon.
@type info: C{str}
@param when: A string describing what software the server is running, probably.
""" | [
"def",
"yourHost",
"(",
"self",
",",
"info",
")",
":"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/words/protocols/irc.py#L1108-L1113 | ||
Pagure/pagure | 512f23f5cd1f965276969747792edeb1215cba68 | pagure/cli/admin.py | python | _parser_admin_token_info | (subparser) | Set up the CLI argument parser for the admin-token info action.
:arg subparser: an argparse subparser allowing to have action's specific
arguments | Set up the CLI argument parser for the admin-token info action. | [
"Set",
"up",
"the",
"CLI",
"argument",
"parser",
"for",
"the",
"admin",
"-",
"token",
"info",
"action",
"."
] | def _parser_admin_token_info(subparser):
"""Set up the CLI argument parser for the admin-token info action.
:arg subparser: an argparse subparser allowing to have action's specific
arguments
"""
local_parser = subparser.add_parser(
"info", help="Provide some information about a specifi... | [
"def",
"_parser_admin_token_info",
"(",
"subparser",
")",
":",
"local_parser",
"=",
"subparser",
".",
"add_parser",
"(",
"\"info\"",
",",
"help",
"=",
"\"Provide some information about a specific API token\"",
")",
"local_parser",
".",
"add_argument",
"(",
"\"token\"",
... | https://github.com/Pagure/pagure/blob/512f23f5cd1f965276969747792edeb1215cba68/pagure/cli/admin.py#L148-L159 | ||
ebroecker/canmatrix | 219a19adf4639b0b4fd5328f039563c6d4060887 | src/canmatrix/_version.py | python | render_pep440_old | (pieces) | return rendered | TAG[.postDISTANCE[.dev0]] .
The ".dev0" means dirty.
Eexceptions:
1: no tags. 0.postDISTANCE[.dev0] | TAG[.postDISTANCE[.dev0]] . | [
"TAG",
"[",
".",
"postDISTANCE",
"[",
".",
"dev0",
"]]",
"."
] | def render_pep440_old(pieces):
"""TAG[.postDISTANCE[.dev0]] .
The ".dev0" means dirty.
Eexceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
rendered += ".post%d" % pie... | [
"def",
"render_pep440_old",
"(",
"pieces",
")",
":",
"if",
"pieces",
"[",
"\"closest-tag\"",
"]",
":",
"rendered",
"=",
"pieces",
"[",
"\"closest-tag\"",
"]",
"if",
"pieces",
"[",
"\"distance\"",
"]",
"or",
"pieces",
"[",
"\"dirty\"",
"]",
":",
"rendered",
... | https://github.com/ebroecker/canmatrix/blob/219a19adf4639b0b4fd5328f039563c6d4060887/src/canmatrix/_version.py#L384-L403 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_gcloud/library/gcloud_compute_disk_labels.py | python | GcloudCLI._delete_service_account_key | (self, sa_name, key_id) | return self.gcloud_cmd(cmd, output=True, output_type='raw') | delete service account key | delete service account key | [
"delete",
"service",
"account",
"key"
] | def _delete_service_account_key(self, sa_name, key_id):
'''delete service account key'''
cmd = ['iam', 'service-accounts', 'keys', 'delete', key_id, '--iam-account', sa_name, '-q']
return self.gcloud_cmd(cmd, output=True, output_type='raw') | [
"def",
"_delete_service_account_key",
"(",
"self",
",",
"sa_name",
",",
"key_id",
")",
":",
"cmd",
"=",
"[",
"'iam'",
",",
"'service-accounts'",
",",
"'keys'",
",",
"'delete'",
",",
"key_id",
",",
"'--iam-account'",
",",
"sa_name",
",",
"'-q'",
"]",
"return"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_gcloud/library/gcloud_compute_disk_labels.py#L291-L295 | |
MozillaSecurity/peach | e5129cb50ce899e3ad009518d8b7cdc535233bbc | Peach/Publishers/raw.py | python | Raw.receive | (self, size=None) | Receive upto 10000 bytes of data.
@rtype: string
@return: received data. | Receive upto 10000 bytes of data. | [
"Receive",
"upto",
"10000",
"bytes",
"of",
"data",
"."
] | def receive(self, size=None):
"""
Receive upto 10000 bytes of data.
@rtype: string
@return: received data.
"""
if size is not None:
return self._socket.recv(size)
else:
self._socket.setblocking(0)
timeout = self._timeout
... | [
"def",
"receive",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"if",
"size",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_socket",
".",
"recv",
"(",
"size",
")",
"else",
":",
"self",
".",
"_socket",
".",
"setblocking",
"(",
"0",
")",
"t... | https://github.com/MozillaSecurity/peach/blob/e5129cb50ce899e3ad009518d8b7cdc535233bbc/Peach/Publishers/raw.py#L131-L158 | ||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/matrices/common.py | python | MatrixOperations.adjoint | (self) | return self._eval_adjoint() | Conjugate transpose or Hermitian conjugation. | Conjugate transpose or Hermitian conjugation. | [
"Conjugate",
"transpose",
"or",
"Hermitian",
"conjugation",
"."
] | def adjoint(self):
"""Conjugate transpose or Hermitian conjugation."""
return self._eval_adjoint() | [
"def",
"adjoint",
"(",
"self",
")",
":",
"return",
"self",
".",
"_eval_adjoint",
"(",
")"
] | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/matrices/common.py#L2020-L2022 | |
home-assistant/supervisor | 69c2517d5211b483fdfe968b0a2b36b672ee7ab2 | supervisor/api/store.py | python | APIStore._extract_addon | (self, request: web.Request, installed=False) | return addon | Return add-on, throw an exception it it doesn't exist. | Return add-on, throw an exception it it doesn't exist. | [
"Return",
"add",
"-",
"on",
"throw",
"an",
"exception",
"it",
"it",
"doesn",
"t",
"exist",
"."
] | def _extract_addon(self, request: web.Request, installed=False) -> AnyAddon:
"""Return add-on, throw an exception it it doesn't exist."""
addon_slug: str = request.match_info.get("addon")
addon_version: str = request.match_info.get("version", "latest")
if installed:
addon = ... | [
"def",
"_extract_addon",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
",",
"installed",
"=",
"False",
")",
"->",
"AnyAddon",
":",
"addon_slug",
":",
"str",
"=",
"request",
".",
"match_info",
".",
"get",
"(",
"\"addon\"",
")",
"addon_version",
... | https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/api/store.py#L49-L66 | |
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/webapi/resources/search.py | python | SearchResource._search_groups | (self, request, max_results, local_site=None, q=None,
*args, **kwargs) | return groups.filter(visible=True)[:max_results] | Search for review groups and return the results.
Args:
request (django.http.HttpRequest):
The current HTTP request.
max_results (int):
The maximum number of results to return.
local_site (reviewboard.site.models.LocalSite, optional):
... | Search for review groups and return the results. | [
"Search",
"for",
"review",
"groups",
"and",
"return",
"the",
"results",
"."
] | def _search_groups(self, request, max_results, local_site=None, q=None,
*args, **kwargs):
"""Search for review groups and return the results.
Args:
request (django.http.HttpRequest):
The current HTTP request.
max_results (int):
... | [
"def",
"_search_groups",
"(",
"self",
",",
"request",
",",
"max_results",
",",
"local_site",
"=",
"None",
",",
"q",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"groups",
"=",
"Group",
".",
"objects",
".",
"accessible",
"(",
"req... | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/webapi/resources/search.py#L219-L256 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParseResults.copy | ( self ) | return ret | Returns a new copy of a C{ParseResults} object. | Returns a new copy of a C{ParseResults} object. | [
"Returns",
"a",
"new",
"copy",
"of",
"a",
"C",
"{",
"ParseResults",
"}",
"object",
"."
] | def copy( self ):
"""
Returns a new copy of a C{ParseResults} object.
"""
ret = ParseResults( self.__toklist )
ret.__tokdict = self.__tokdict.copy()
ret.__parent = self.__parent
ret.__accumNames.update( self.__accumNames )
ret.__name = self.__name
... | [
"def",
"copy",
"(",
"self",
")",
":",
"ret",
"=",
"ParseResults",
"(",
"self",
".",
"__toklist",
")",
"ret",
".",
"__tokdict",
"=",
"self",
".",
"__tokdict",
".",
"copy",
"(",
")",
"ret",
".",
"__parent",
"=",
"self",
".",
"__parent",
"ret",
".",
"... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L755-L764 | |
cbrgm/telegram-robot-rss | 58fe98de427121fdc152c8df0721f1891174e6c9 | venv/lib/python2.7/site-packages/pip/utils/ui.py | python | InterruptibleMixin.finish | (self) | Restore the original SIGINT handler after finishing.
This should happen regardless of whether the progress display finishes
normally, or gets interrupted. | Restore the original SIGINT handler after finishing. | [
"Restore",
"the",
"original",
"SIGINT",
"handler",
"after",
"finishing",
"."
] | def finish(self):
"""
Restore the original SIGINT handler after finishing.
This should happen regardless of whether the progress display finishes
normally, or gets interrupted.
"""
super(InterruptibleMixin, self).finish()
signal(SIGINT, self.original_handler) | [
"def",
"finish",
"(",
"self",
")",
":",
"super",
"(",
"InterruptibleMixin",
",",
"self",
")",
".",
"finish",
"(",
")",
"signal",
"(",
"SIGINT",
",",
"self",
".",
"original_handler",
")"
] | https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/pip/utils/ui.py#L94-L102 | ||
CharlesBlonde/libpurecoollink | a91362c57a0bc4126279c8c51c407dd713b08e10 | libpurecoollink/dyson_pure_hotcool_link.py | python | DysonPureHotCoolLink.set_configuration | (self, **kwargs) | Configure fan.
:param kwargs: Parameters | Configure fan. | [
"Configure",
"fan",
"."
] | def set_configuration(self, **kwargs):
"""Configure fan.
:param kwargs: Parameters
"""
data = self._parse_command_args(**kwargs)
self.set_fan_configuration(data) | [
"def",
"set_configuration",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_parse_command_args",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"set_fan_configuration",
"(",
"data",
")"
] | https://github.com/CharlesBlonde/libpurecoollink/blob/a91362c57a0bc4126279c8c51c407dd713b08e10/libpurecoollink/dyson_pure_hotcool_link.py#L35-L41 | ||
vivisect/vivisect | 37b0b655d8dedfcf322e86b0f144b096e48d547e | vivisect/symboliks/archs/i386.py | python | IntelSymbolikTranslator.i_mulsd | (self, op, off=0) | Also doesn't set flags? | Also doesn't set flags? | [
"Also",
"doesn",
"t",
"set",
"flags?"
] | def i_mulsd(self, op, off=0):
'''
Also doesn't set flags?
'''
v1 = self.getOperObj(op, off)
v2 = self.getOperObj(op, off + 1)
ocount = len(op.opers)
res = o_mul(v1, v2, v1.getWidth())
self.setOperObj(op, 0, res) | [
"def",
"i_mulsd",
"(",
"self",
",",
"op",
",",
"off",
"=",
"0",
")",
":",
"v1",
"=",
"self",
".",
"getOperObj",
"(",
"op",
",",
"off",
")",
"v2",
"=",
"self",
".",
"getOperObj",
"(",
"op",
",",
"off",
"+",
"1",
")",
"ocount",
"=",
"len",
"(",... | https://github.com/vivisect/vivisect/blob/37b0b655d8dedfcf322e86b0f144b096e48d547e/vivisect/symboliks/archs/i386.py#L612-L620 | ||
poppy-project/pypot | c5d384fe23eef9f6ec98467f6f76626cdf20afb9 | pypot/vrep/remoteApiBindings/vrep.py | python | simxPauseSimulation | (clientID, operationMode) | return c_PauseSimulation(clientID, operationMode) | Please have a look at the function description/documentation in the V-REP user manual | Please have a look at the function description/documentation in the V-REP user manual | [
"Please",
"have",
"a",
"look",
"at",
"the",
"function",
"description",
"/",
"documentation",
"in",
"the",
"V",
"-",
"REP",
"user",
"manual"
] | def simxPauseSimulation(clientID, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
return c_PauseSimulation(clientID, operationMode) | [
"def",
"simxPauseSimulation",
"(",
"clientID",
",",
"operationMode",
")",
":",
"return",
"c_PauseSimulation",
"(",
"clientID",
",",
"operationMode",
")"
] | https://github.com/poppy-project/pypot/blob/c5d384fe23eef9f6ec98467f6f76626cdf20afb9/pypot/vrep/remoteApiBindings/vrep.py#L411-L416 | |
intel/fMBT | a221c55cd7b6367aa458781b134ae155aa47a71f | utils3/fmbtgti.py | python | OcrEngine.removeScreenshot | (self, screenshot) | OCR queries on the screenshot will not be made anymore. | OCR queries on the screenshot will not be made anymore. | [
"OCR",
"queries",
"on",
"the",
"screenshot",
"will",
"not",
"be",
"made",
"anymore",
"."
] | def removeScreenshot(self, screenshot):
"""
OCR queries on the screenshot will not be made anymore.
"""
self._removeScreenshot(screenshot)
try:
del self._ssFindTextDefaults[id(screenshot)]
except KeyError:
raise KeyError('screenshot "%s" does not h... | [
"def",
"removeScreenshot",
"(",
"self",
",",
"screenshot",
")",
":",
"self",
".",
"_removeScreenshot",
"(",
"screenshot",
")",
"try",
":",
"del",
"self",
".",
"_ssFindTextDefaults",
"[",
"id",
"(",
"screenshot",
")",
"]",
"except",
"KeyError",
":",
"raise",
... | https://github.com/intel/fMBT/blob/a221c55cd7b6367aa458781b134ae155aa47a71f/utils3/fmbtgti.py#L580-L590 | ||
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | library/imdb/__init__.py | python | IMDbBase.new_company | (self, *arguments, **keywords) | return Company.Company(accessSystem=self.accessSystem,
*arguments, **keywords) | Return a Company object. | Return a Company object. | [
"Return",
"a",
"Company",
"object",
"."
] | def new_company(self, *arguments, **keywords):
"""Return a Company object."""
# XXX: not really useful...
if 'name' in keywords:
if not isinstance(keywords['name'], unicode):
keywords['name'] = unicode(keywords['name'],
enco... | [
"def",
"new_company",
"(",
"self",
",",
"*",
"arguments",
",",
"*",
"*",
"keywords",
")",
":",
"# XXX: not really useful...",
"if",
"'name'",
"in",
"keywords",
":",
"if",
"not",
"isinstance",
"(",
"keywords",
"[",
"'name'",
"]",
",",
"unicode",
")",
":",
... | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/imdb/__init__.py#L641-L652 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/management/commands/configauth.py | python | _get_or_prompt | (options, option, message, replace_none=False) | return config | Return a config option either from command line or interactive input. | Return a config option either from command line or interactive input. | [
"Return",
"a",
"config",
"option",
"either",
"from",
"command",
"line",
"or",
"interactive",
"input",
"."
] | def _get_or_prompt(options, option, message, replace_none=False):
"""Return a config option either from command line or interactive input."""
config = options.get(option)
if config is None:
config = read_input(message)
if replace_none and config == "none":
config = ""
if config is No... | [
"def",
"_get_or_prompt",
"(",
"options",
",",
"option",
",",
"message",
",",
"replace_none",
"=",
"False",
")",
":",
"config",
"=",
"options",
".",
"get",
"(",
"option",
")",
"if",
"config",
"is",
"None",
":",
"config",
"=",
"read_input",
"(",
"message",... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/management/commands/configauth.py#L257-L266 | |
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | alter_partitions_with_environment_context_args.read | (self, iprot) | [] | def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
... | [
"def",
"read",
"(",
"self",
",",
"iprot",
")",
":",
"if",
"iprot",
".",
"_fast_decode",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"iprot",
".",
"trans",
",",
"TTransport",
".",
"CReadableTransport",
")",
"and",
"self",
".",
"thrift_spec",
"is",
"not... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L22655-L22694 | ||||
MozillaSecurity/peach | e5129cb50ce899e3ad009518d8b7cdc535233bbc | Peach/Engine/dom.py | python | DataElement.isArray | (self) | Check if this data element is part of an array. | Check if this data element is part of an array. | [
"Check",
"if",
"this",
"data",
"element",
"is",
"part",
"of",
"an",
"array",
"."
] | def isArray(self):
"""
Check if this data element is part of an array.
"""
if self.array is not None:
return True | [
"def",
"isArray",
"(",
"self",
")",
":",
"if",
"self",
".",
"array",
"is",
"not",
"None",
":",
"return",
"True"
] | https://github.com/MozillaSecurity/peach/blob/e5129cb50ce899e3ad009518d8b7cdc535233bbc/Peach/Engine/dom.py#L2040-L2046 | ||
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/Mask RCNN/matterport-Mask_RCNN/train_mnist_simplify.py | python | ShapesDataset.random_comb | (self, mnist, height, width, train=True) | return comb_image, mask, class_ids | [] | def random_comb(self, mnist, height, width, train=True):
if train:
train = mnist.train
else:
train = mnist.test
num_images = train.num_examples
indexs = random.choices(np.arange(0, num_images), k=16) # 随机选择16个索引值
indexs = np.asarray(indexs, np.uint8).resh... | [
"def",
"random_comb",
"(",
"self",
",",
"mnist",
",",
"height",
",",
"width",
",",
"train",
"=",
"True",
")",
":",
"if",
"train",
":",
"train",
"=",
"mnist",
".",
"train",
"else",
":",
"train",
"=",
"mnist",
".",
"test",
"num_images",
"=",
"train",
... | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/Mask RCNN/matterport-Mask_RCNN/train_mnist_simplify.py#L195-L217 | |||
openai/universe | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c | universe/vncdriver/vendor/pydes.py | python | _baseDes.setKey | (self, key) | Will set the crypting key for this object. | Will set the crypting key for this object. | [
"Will",
"set",
"the",
"crypting",
"key",
"for",
"this",
"object",
"."
] | def setKey(self, key):
"""Will set the crypting key for this object."""
key = self._guardAgainstUnicode(key)
self.__key = key | [
"def",
"setKey",
"(",
"self",
",",
"key",
")",
":",
"key",
"=",
"self",
".",
"_guardAgainstUnicode",
"(",
"key",
")",
"self",
".",
"__key",
"=",
"key"
] | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L130-L133 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | source/addons/account/account_move_line.py | python | account_move_line.onchange_date | (self, cr, user, ids, date, context=None) | return {
'value':res,
'context':context,
} | Returns a dict that contains new values and context
@param cr: A database cursor
@param user: ID of the user currently logged in
@param date: latest value from user input for field date
@param args: other arguments
@param context: context arguments, like lang, time zone
@... | Returns a dict that contains new values and context | [
"Returns",
"a",
"dict",
"that",
"contains",
"new",
"values",
"and",
"context"
] | def onchange_date(self, cr, user, ids, date, context=None):
"""
Returns a dict that contains new values and context
@param cr: A database cursor
@param user: ID of the user currently logged in
@param date: latest value from user input for field date
@param args: other arg... | [
"def",
"onchange_date",
"(",
"self",
",",
"cr",
",",
"user",
",",
"ids",
",",
"date",
",",
"context",
"=",
"None",
")",
":",
"res",
"=",
"{",
"}",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"{",
"}",
"period_pool",
"=",
"self",
".",
"poo... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/account/account_move_line.py#L1155-L1176 | |
gbrindisi/xsssniper | 02b59afd15efead30bdf4829b6c1356abb8731cd | core/packages/clint/arguments.py | python | Args.files | (self, absolute=False) | return _paths | Returns an expanded list of all valid paths that were passed in. | Returns an expanded list of all valid paths that were passed in. | [
"Returns",
"an",
"expanded",
"list",
"of",
"all",
"valid",
"paths",
"that",
"were",
"passed",
"in",
"."
] | def files(self, absolute=False):
"""Returns an expanded list of all valid paths that were passed in."""
_paths = []
for arg in self.all:
for path in expand_path(arg):
if os.path.exists(path):
if absolute:
_paths.append(os.... | [
"def",
"files",
"(",
"self",
",",
"absolute",
"=",
"False",
")",
":",
"_paths",
"=",
"[",
"]",
"for",
"arg",
"in",
"self",
".",
"all",
":",
"for",
"path",
"in",
"expand_path",
"(",
"arg",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"... | https://github.com/gbrindisi/xsssniper/blob/02b59afd15efead30bdf4829b6c1356abb8731cd/core/packages/clint/arguments.py#L322-L335 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_internal/resolution/legacy/resolver.py | python | Resolver._get_dist_for | (self, req: InstallRequirement) | return dist | Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same. | Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same. | [
"Takes",
"a",
"InstallRequirement",
"and",
"returns",
"a",
"single",
"AbstractDist",
"\\",
"representing",
"a",
"prepared",
"variant",
"of",
"the",
"same",
"."
] | def _get_dist_for(self, req: InstallRequirement) -> Distribution:
"""Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
"""
if req.editable:
return self.preparer.prepare_editable_requirement(req)
# satisfied_by... | [
"def",
"_get_dist_for",
"(",
"self",
",",
"req",
":",
"InstallRequirement",
")",
"->",
"Distribution",
":",
"if",
"req",
".",
"editable",
":",
"return",
"self",
".",
"preparer",
".",
"prepare_editable_requirement",
"(",
"req",
")",
"# satisfied_by is only evaluate... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_internal/resolution/legacy/resolver.py#L306-L350 | |
facebookresearch/mmf | fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f | mmf/datasets/builders/vqacp_v2/database.py | python | VQACPv2AnnotationDatabase.load_annotation_db | (self, path) | [] | def load_annotation_db(self, path):
# Expect two paths, one to questions and one to annotations
assert (
len(path) == 2
), "VQACPv2 requires 2 paths; one to questions and one to annotations"
with PathManager.open(path[0]) as f:
path_0 = json.load(f)
with ... | [
"def",
"load_annotation_db",
"(",
"self",
",",
"path",
")",
":",
"# Expect two paths, one to questions and one to annotations",
"assert",
"(",
"len",
"(",
"path",
")",
"==",
"2",
")",
",",
"\"VQACPv2 requires 2 paths; one to questions and one to annotations\"",
"with",
"Pat... | https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/datasets/builders/vqacp_v2/database.py#L13-L45 | ||||
facebookresearch/detectron2 | cb92ae1763cd7d3777c243f07749574cdaec6cb8 | detectron2/data/datasets/builtin_meta.py | python | _get_coco_panoptic_separated_meta | () | return ret | Returns metadata for "separated" version of the panoptic segmentation dataset. | Returns metadata for "separated" version of the panoptic segmentation dataset. | [
"Returns",
"metadata",
"for",
"separated",
"version",
"of",
"the",
"panoptic",
"segmentation",
"dataset",
"."
] | def _get_coco_panoptic_separated_meta():
"""
Returns metadata for "separated" version of the panoptic segmentation dataset.
"""
stuff_ids = [k["id"] for k in COCO_CATEGORIES if k["isthing"] == 0]
assert len(stuff_ids) == 53, len(stuff_ids)
# For semantic segmentation, this mapping maps from con... | [
"def",
"_get_coco_panoptic_separated_meta",
"(",
")",
":",
"stuff_ids",
"=",
"[",
"k",
"[",
"\"id\"",
"]",
"for",
"k",
"in",
"COCO_CATEGORIES",
"if",
"k",
"[",
"\"isthing\"",
"]",
"==",
"0",
"]",
"assert",
"len",
"(",
"stuff_ids",
")",
"==",
"53",
",",
... | https://github.com/facebookresearch/detectron2/blob/cb92ae1763cd7d3777c243f07749574cdaec6cb8/detectron2/data/datasets/builtin_meta.py#L250-L280 | |
zatosource/zato | 2a9d273f06f9d776fbfeb53e73855af6e40fa208 | code/zato-common/src/zato/common/kvdb/api.py | python | KVDB.add_oauth_nonce | (self, username, nonce, max_nonce_log) | Adds an OAuth to the set containing last N used ones for a given username. | Adds an OAuth to the set containing last N used ones for a given username. | [
"Adds",
"an",
"OAuth",
"to",
"the",
"set",
"containing",
"last",
"N",
"used",
"ones",
"for",
"a",
"given",
"username",
"."
] | def add_oauth_nonce(self, username, nonce, max_nonce_log):
""" Adds an OAuth to the set containing last N used ones for a given username.
"""
key = NONCE_STORE.KEY_PATTERN.format('oauth', username)
# This lets us trim the set to top (last) N nonces
score = timegm(gmtime())
... | [
"def",
"add_oauth_nonce",
"(",
"self",
",",
"username",
",",
"nonce",
",",
"max_nonce_log",
")",
":",
"key",
"=",
"NONCE_STORE",
".",
"KEY_PATTERN",
".",
"format",
"(",
"'oauth'",
",",
"username",
")",
"# This lets us trim the set to top (last) N nonces",
"score",
... | https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/zato-common/src/zato/common/kvdb/api.py#L236-L245 | ||
GoogleCloudPlatform/webapp2 | deb34447ef8927c940bed2d80c7eec75f9f01be8 | webapp2_extras/securecookie.py | python | SecureCookieSerializer.__init__ | (self, secret_key) | Initiliazes the serializer/deserializer.
:param secret_key:
A random string to be used as the HMAC secret for the cookie
signature. | Initiliazes the serializer/deserializer. | [
"Initiliazes",
"the",
"serializer",
"/",
"deserializer",
"."
] | def __init__(self, secret_key):
"""Initiliazes the serializer/deserializer.
:param secret_key:
A random string to be used as the HMAC secret for the cookie
signature.
"""
self.secret_key = webapp2._to_utf8(secret_key) | [
"def",
"__init__",
"(",
"self",
",",
"secret_key",
")",
":",
"self",
".",
"secret_key",
"=",
"webapp2",
".",
"_to_utf8",
"(",
"secret_key",
")"
] | https://github.com/GoogleCloudPlatform/webapp2/blob/deb34447ef8927c940bed2d80c7eec75f9f01be8/webapp2_extras/securecookie.py#L39-L46 | ||
SciTools/iris | a12d0b15bab3377b23a148e891270b13a0419c38 | lib/iris/fileformats/_nc_load_rules/helpers.py | python | build_lambert_azimuthal_equal_area_coordinate_system | (engine, cf_grid_var) | return cs | Create a lambert azimuthal equal area coordinate system from the CF-netCDF
grid mapping variable. | Create a lambert azimuthal equal area coordinate system from the CF-netCDF
grid mapping variable. | [
"Create",
"a",
"lambert",
"azimuthal",
"equal",
"area",
"coordinate",
"system",
"from",
"the",
"CF",
"-",
"netCDF",
"grid",
"mapping",
"variable",
"."
] | def build_lambert_azimuthal_equal_area_coordinate_system(engine, cf_grid_var):
"""
Create a lambert azimuthal equal area coordinate system from the CF-netCDF
grid mapping variable.
"""
major, minor, inverse_flattening = _get_ellipsoid(cf_grid_var)
latitude_of_projection_origin = getattr(
... | [
"def",
"build_lambert_azimuthal_equal_area_coordinate_system",
"(",
"engine",
",",
"cf_grid_var",
")",
":",
"major",
",",
"minor",
",",
"inverse_flattening",
"=",
"_get_ellipsoid",
"(",
"cf_grid_var",
")",
"latitude_of_projection_origin",
"=",
"getattr",
"(",
"cf_grid_var... | https://github.com/SciTools/iris/blob/a12d0b15bab3377b23a148e891270b13a0419c38/lib/iris/fileformats/_nc_load_rules/helpers.py#L464-L497 | |
zhanghan1990/zipline-chinese | 86904cac4b6e928271f640910aa83675ce945b8b | zipline/finance/controls.py | python | TradingControl.__init__ | (self, **kwargs) | Track any arguments that should be printed in the error message
generated by self.fail. | Track any arguments that should be printed in the error message
generated by self.fail. | [
"Track",
"any",
"arguments",
"that",
"should",
"be",
"printed",
"in",
"the",
"error",
"message",
"generated",
"by",
"self",
".",
"fail",
"."
] | def __init__(self, **kwargs):
"""
Track any arguments that should be printed in the error message
generated by self.fail.
"""
self.__fail_args = kwargs | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"__fail_args",
"=",
"kwargs"
] | https://github.com/zhanghan1990/zipline-chinese/blob/86904cac4b6e928271f640910aa83675ce945b8b/zipline/finance/controls.py#L33-L38 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/ext/instrumentation.py | python | find_native_user_instrumentation_hook | (cls) | return getattr(cls, INSTRUMENTATION_MANAGER, None) | Find user-specified instrumentation management for a class. | Find user-specified instrumentation management for a class. | [
"Find",
"user",
"-",
"specified",
"instrumentation",
"management",
"for",
"a",
"class",
"."
] | def find_native_user_instrumentation_hook(cls):
"""Find user-specified instrumentation management for a class."""
return getattr(cls, INSTRUMENTATION_MANAGER, None) | [
"def",
"find_native_user_instrumentation_hook",
"(",
"cls",
")",
":",
"return",
"getattr",
"(",
"cls",
",",
"INSTRUMENTATION_MANAGER",
",",
"None",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/ext/instrumentation.py#L59-L61 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/lib-tk/ttk.py | python | Notebook.index | (self, tab_id) | return self.tk.getint(self.tk.call(self._w, "index", tab_id)) | Returns the numeric index of the tab specified by tab_id, or
the total number of tabs if tab_id is the string "end". | Returns the numeric index of the tab specified by tab_id, or
the total number of tabs if tab_id is the string "end". | [
"Returns",
"the",
"numeric",
"index",
"of",
"the",
"tab",
"specified",
"by",
"tab_id",
"or",
"the",
"total",
"number",
"of",
"tabs",
"if",
"tab_id",
"is",
"the",
"string",
"end",
"."
] | def index(self, tab_id):
"""Returns the numeric index of the tab specified by tab_id, or
the total number of tabs if tab_id is the string "end"."""
return self.tk.getint(self.tk.call(self._w, "index", tab_id)) | [
"def",
"index",
"(",
"self",
",",
"tab_id",
")",
":",
"return",
"self",
".",
"tk",
".",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"index\"",
",",
"tab_id",
")",
")"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/lib-tk/ttk.py#L866-L869 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/http/cookies.py | python | SimpleCookie.value_decode | (self, val) | return _unquote(val), val | [] | def value_decode(self, val):
return _unquote(val), val | [
"def",
"value_decode",
"(",
"self",
",",
"val",
")",
":",
"return",
"_unquote",
"(",
"val",
")",
",",
"val"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/http/cookies.py#L566-L567 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tbp/v20190627/tbp_client.py | python | TbpClient.TextProcess | (self, request) | 接收调用侧的文本输入,返回应答文本。
:param request: Request instance for TextProcess.
:type request: :class:`tencentcloud.tbp.v20190627.models.TextProcessRequest`
:rtype: :class:`tencentcloud.tbp.v20190627.models.TextProcessResponse` | 接收调用侧的文本输入,返回应答文本。 | [
"接收调用侧的文本输入,返回应答文本。"
] | def TextProcess(self, request):
"""接收调用侧的文本输入,返回应答文本。
:param request: Request instance for TextProcess.
:type request: :class:`tencentcloud.tbp.v20190627.models.TextProcessRequest`
:rtype: :class:`tencentcloud.tbp.v20190627.models.TextProcessResponse`
"""
try:
... | [
"def",
"TextProcess",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"TextProcess\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loads",
"(",
... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tbp/v20190627/tbp_client.py#L29-L54 | ||
CharlesBlonde/libpurecoollink | a91362c57a0bc4126279c8c51c407dd713b08e10 | libpurecoollink/dyson_360_eye.py | python | Dyson360Eye._send_command | (self, command, data=None) | Send command to the device.
:param command Command to send (const.Dyson360EyeCommand)
:param data Data dictionary to send. Can be empty | Send command to the device. | [
"Send",
"command",
"to",
"the",
"device",
"."
] | def _send_command(self, command, data=None):
"""Send command to the device.
:param command Command to send (const.Dyson360EyeCommand)
:param data Data dictionary to send. Can be empty
"""
if data is None:
data = {}
if self._connected:
payload = {
... | [
"def",
"_send_command",
"(",
"self",
",",
"command",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"{",
"}",
"if",
"self",
".",
"_connected",
":",
"payload",
"=",
"{",
"\"msg\"",
":",
"\"{0}\"",
".",
"format",
"(... | https://github.com/CharlesBlonde/libpurecoollink/blob/a91362c57a0bc4126279c8c51c407dd713b08e10/libpurecoollink/dyson_360_eye.py#L55-L75 | ||
facebookresearch/ParlAI | e4d59c30eef44f1f67105961b82a83fd28d7d78b | parlai/crowdsourcing/tasks/acute_eval/fast_eval.py | python | FastAcuteExecutor.compile_chat_logs | (self) | Compile chat logs.
Logs are generated depending on what is specified in the config for the model:
1. If a `model` is provided, run selfchat for model
2. If a `log_path` is provided, simply load the log path
3. If a `task` is provided, convert the task to ACUTE format and load that. | Compile chat logs. | [
"Compile",
"chat",
"logs",
"."
] | def compile_chat_logs(self):
"""
Compile chat logs.
Logs are generated depending on what is specified in the config for the model:
1. If a `model` is provided, run selfchat for model
2. If a `log_path` is provided, simply load the log path
3. If a `task` is provided, con... | [
"def",
"compile_chat_logs",
"(",
"self",
")",
":",
"for",
"model",
"in",
"self",
".",
"models",
":",
"try",
":",
"torch",
".",
"cuda",
".",
"empty_cache",
"(",
")",
"except",
"Exception",
":",
"pass",
"self",
".",
"_print_progress",
"(",
"f'Running self-ch... | https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/parlai/crowdsourcing/tasks/acute_eval/fast_eval.py#L445-L481 | ||
web2py/web2py | 095905c4e010a1426c729483d912e270a51b7ba8 | applications/admin/controllers/debug.py | python | list_breakpoints | () | return response.json({'ok': ok, 'breakpoints': breakpoints}) | Return a list of linenumbers for current breakpoints | Return a list of linenumbers for current breakpoints | [
"Return",
"a",
"list",
"of",
"linenumbers",
"for",
"current",
"breakpoints"
] | def list_breakpoints():
"Return a list of linenumbers for current breakpoints"
breakpoints = []
ok = False
try:
filename = os.path.join(request.env['applications_parent'],
'applications', request.vars.filename)
# normalize path name: replace slashes, refe... | [
"def",
"list_breakpoints",
"(",
")",
":",
"breakpoints",
"=",
"[",
"]",
"ok",
"=",
"False",
"try",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"request",
".",
"env",
"[",
"'applications_parent'",
"]",
",",
"'applications'",
",",
"request",... | https://github.com/web2py/web2py/blob/095905c4e010a1426c729483d912e270a51b7ba8/applications/admin/controllers/debug.py#L218-L237 | |
nvaccess/nvda | 20d5a25dced4da34338197f0ef6546270ebca5d0 | source/speech/manager.py | python | SpeechManager._checkForCancellations | (self, utterance: SpeechSequence) | return True | Checks utterance to ensure it is not cancelled (via a _CancellableSpeechCommand).
Because synthesizers do not expect CancellableSpeechCommands, they are removed from the utterance.
:arg utterance: The utterance to check for cancellations. Modified in place, CancellableSpeechCommands are
removed.
:return True if... | Checks utterance to ensure it is not cancelled (via a _CancellableSpeechCommand).
Because synthesizers do not expect CancellableSpeechCommands, they are removed from the utterance.
:arg utterance: The utterance to check for cancellations. Modified in place, CancellableSpeechCommands are
removed.
:return True if... | [
"Checks",
"utterance",
"to",
"ensure",
"it",
"is",
"not",
"cancelled",
"(",
"via",
"a",
"_CancellableSpeechCommand",
")",
".",
"Because",
"synthesizers",
"do",
"not",
"expect",
"CancellableSpeechCommands",
"they",
"are",
"removed",
"from",
"the",
"utterance",
".",... | def _checkForCancellations(self, utterance: SpeechSequence) -> bool:
"""
Checks utterance to ensure it is not cancelled (via a _CancellableSpeechCommand).
Because synthesizers do not expect CancellableSpeechCommands, they are removed from the utterance.
:arg utterance: The utterance to check for cancellations. ... | [
"def",
"_checkForCancellations",
"(",
"self",
",",
"utterance",
":",
"SpeechSequence",
")",
"->",
"bool",
":",
"if",
"not",
"_shouldCancelExpiredFocusEvents",
"(",
")",
":",
"return",
"True",
"utteranceIndex",
"=",
"self",
".",
"_getUtteranceIndex",
"(",
"utteranc... | https://github.com/nvaccess/nvda/blob/20d5a25dced4da34338197f0ef6546270ebca5d0/source/speech/manager.py#L480-L510 | |
amueller/word_cloud | 35ce9b781d3bd5c25ea178edd662b0f6dde9d065 | versioneer.py | python | render_pep440_pre | (pieces) | return rendered | TAG[.post.devDISTANCE] -- No -dirty.
Exceptions:
1: no tags. 0.post.devDISTANCE | TAG[.post.devDISTANCE] -- No -dirty. | [
"TAG",
"[",
".",
"post",
".",
"devDISTANCE",
"]",
"--",
"No",
"-",
"dirty",
"."
] | def render_pep440_pre(pieces):
"""TAG[.post.devDISTANCE] -- No -dirty.
Exceptions:
1: no tags. 0.post.devDISTANCE
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"]:
rendered += ".post.dev%d" % pieces["distance"]
else:
# exce... | [
"def",
"render_pep440_pre",
"(",
"pieces",
")",
":",
"if",
"pieces",
"[",
"\"closest-tag\"",
"]",
":",
"rendered",
"=",
"pieces",
"[",
"\"closest-tag\"",
"]",
"if",
"pieces",
"[",
"\"distance\"",
"]",
":",
"rendered",
"+=",
"\".post.dev%d\"",
"%",
"pieces",
... | https://github.com/amueller/word_cloud/blob/35ce9b781d3bd5c25ea178edd662b0f6dde9d065/versioneer.py#L1261-L1274 | |
thinkle/gourmet | 8af29c8ded24528030e5ae2ea3461f61c1e5a575 | gourmet/shopgui.py | python | OptionalIngDialog.toggle_ing_cb | (self, cellrenderertoggle, path, *args) | [] | def toggle_ing_cb (self, cellrenderertoggle, path, *args):
debug("toggle_ing_cb (self, cellrenderertoggle, path, *args):",5)
crt=cellrenderertoggle
iter=self.mod.get_iter(path)
val = self.mod.get_value(iter,4)
newval = not val
self.ret[self.mod.get_value(iter,0).ingkey]=n... | [
"def",
"toggle_ing_cb",
"(",
"self",
",",
"cellrenderertoggle",
",",
"path",
",",
"*",
"args",
")",
":",
"debug",
"(",
"\"toggle_ing_cb (self, cellrenderertoggle, path, *args):\"",
",",
"5",
")",
"crt",
"=",
"cellrenderertoggle",
"iter",
"=",
"self",
".",
"mod",
... | https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/shopgui.py#L966-L973 | ||||
cornellius-gp/gpytorch | 61f643eb8b487aef332c818f661fbcdb1df576ca | gpytorch/kernels/multitask_kernel.py | python | MultitaskKernel.num_outputs_per_input | (self, x1, x2) | return self.num_tasks | Given `n` data points `x1` and `m` datapoints `x2`, this multitask
kernel returns an `(n*num_tasks) x (m*num_tasks)` covariance matrix. | Given `n` data points `x1` and `m` datapoints `x2`, this multitask
kernel returns an `(n*num_tasks) x (m*num_tasks)` covariance matrix. | [
"Given",
"n",
"data",
"points",
"x1",
"and",
"m",
"datapoints",
"x2",
"this",
"multitask",
"kernel",
"returns",
"an",
"(",
"n",
"*",
"num_tasks",
")",
"x",
"(",
"m",
"*",
"num_tasks",
")",
"covariance",
"matrix",
"."
] | def num_outputs_per_input(self, x1, x2):
"""
Given `n` data points `x1` and `m` datapoints `x2`, this multitask
kernel returns an `(n*num_tasks) x (m*num_tasks)` covariance matrix.
"""
return self.num_tasks | [
"def",
"num_outputs_per_input",
"(",
"self",
",",
"x1",
",",
"x2",
")",
":",
"return",
"self",
".",
"num_tasks"
] | https://github.com/cornellius-gp/gpytorch/blob/61f643eb8b487aef332c818f661fbcdb1df576ca/gpytorch/kernels/multitask_kernel.py#L54-L59 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tcss/v20201101/models.py | python | ComplianceFilters.__init__ | (self) | r"""
:param Name: 过滤键的名称
:type Name: str
:param Values: 一个或者多个过滤值。
:type Values: list of str
:param ExactMatch: 是否模糊查询。默认为是。
:type ExactMatch: bool | r"""
:param Name: 过滤键的名称
:type Name: str
:param Values: 一个或者多个过滤值。
:type Values: list of str
:param ExactMatch: 是否模糊查询。默认为是。
:type ExactMatch: bool | [
"r",
":",
"param",
"Name",
":",
"过滤键的名称",
":",
"type",
"Name",
":",
"str",
":",
"param",
"Values",
":",
"一个或者多个过滤值。",
":",
"type",
"Values",
":",
"list",
"of",
"str",
":",
"param",
"ExactMatch",
":",
"是否模糊查询。默认为是。",
":",
"type",
"ExactMatch",
":",
"boo... | def __init__(self):
r"""
:param Name: 过滤键的名称
:type Name: str
:param Values: 一个或者多个过滤值。
:type Values: list of str
:param ExactMatch: 是否模糊查询。默认为是。
:type ExactMatch: bool
"""
self.Name = None
self.Values = None
self.ExactMatch = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Name",
"=",
"None",
"self",
".",
"Values",
"=",
"None",
"self",
".",
"ExactMatch",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tcss/v20201101/models.py#L2025-L2036 | ||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/beets/importer.py | python | ImportTask.record_replaced | (self, lib) | Records the replaced items and albums in the `replaced_items`
and `replaced_albums` dictionaries. | Records the replaced items and albums in the `replaced_items`
and `replaced_albums` dictionaries. | [
"Records",
"the",
"replaced",
"items",
"and",
"albums",
"in",
"the",
"replaced_items",
"and",
"replaced_albums",
"dictionaries",
"."
] | def record_replaced(self, lib):
"""Records the replaced items and albums in the `replaced_items`
and `replaced_albums` dictionaries.
"""
self.replaced_items = defaultdict(list)
self.replaced_albums = defaultdict(list)
replaced_album_ids = set()
for item in self.im... | [
"def",
"record_replaced",
"(",
"self",
",",
"lib",
")",
":",
"self",
".",
"replaced_items",
"=",
"defaultdict",
"(",
"list",
")",
"self",
".",
"replaced_albums",
"=",
"defaultdict",
"(",
"list",
")",
"replaced_album_ids",
"=",
"set",
"(",
")",
"for",
"item... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/beets/importer.py#L704-L723 | ||
mrkipling/maraschino | c6be9286937783ae01df2d6d8cebfc8b2734a7d7 | lib/transmissionrpc/constants.py | python | mirror_dict | (source) | return source | Creates a dictionary with all values as keys and all keys as values. | Creates a dictionary with all values as keys and all keys as values. | [
"Creates",
"a",
"dictionary",
"with",
"all",
"values",
"as",
"keys",
"and",
"all",
"keys",
"as",
"values",
"."
] | def mirror_dict(source):
"""
Creates a dictionary with all values as keys and all keys as values.
"""
source.update(dict((value, key) for key, value in source.iteritems()))
return source | [
"def",
"mirror_dict",
"(",
"source",
")",
":",
"source",
".",
"update",
"(",
"dict",
"(",
"(",
"value",
",",
"key",
")",
"for",
"key",
",",
"value",
"in",
"source",
".",
"iteritems",
"(",
")",
")",
")",
"return",
"source"
] | https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/transmissionrpc/constants.py#L10-L15 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/utilities/rpdb.py | python | PdbXMLRPCServer.register_signal | (self, signum) | [] | def register_signal(self, signum):
signal.signal(signum, self.signal_handler) | [
"def",
"register_signal",
"(",
"self",
",",
"signum",
")",
":",
"signal",
".",
"signal",
"(",
"signum",
",",
"self",
".",
"signal_handler",
")"
] | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/utilities/rpdb.py#L21-L22 | ||||
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/django/forms/fields.py | python | DateField.to_python | (self, value) | return super(DateField, self).to_python(value) | Validates that the input can be converted to a date. Returns a Python
datetime.date object. | Validates that the input can be converted to a date. Returns a Python
datetime.date object. | [
"Validates",
"that",
"the",
"input",
"can",
"be",
"converted",
"to",
"a",
"date",
".",
"Returns",
"a",
"Python",
"datetime",
".",
"date",
"object",
"."
] | def to_python(self, value):
"""
Validates that the input can be converted to a date. Returns a Python
datetime.date object.
"""
if value in validators.EMPTY_VALUES:
return None
if isinstance(value, datetime.datetime):
return value.date()
if... | [
"def",
"to_python",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"in",
"validators",
".",
"EMPTY_VALUES",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"datetime",
".",
"datetime",
")",
":",
"return",
"value",
".",
"date",
"(",
"... | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/forms/fields.py#L358-L369 | |
EDCD/EDMarketConnector | d8b29e45b86f36ab3cf540ec1503b9170a8505de | hotkey.py | python | get_hotkeymgr | () | Determine platform-specific HotkeyMgr.
:param args:
:param kwargs:
:return: Appropriate class instance.
:raises ValueError: If unsupported platform. | Determine platform-specific HotkeyMgr. | [
"Determine",
"platform",
"-",
"specific",
"HotkeyMgr",
"."
] | def get_hotkeymgr() -> AbstractHotkeyMgr:
"""
Determine platform-specific HotkeyMgr.
:param args:
:param kwargs:
:return: Appropriate class instance.
:raises ValueError: If unsupported platform.
"""
if sys.platform == 'darwin':
return MacHotkeyMgr()
elif sys.platform == 'wi... | [
"def",
"get_hotkeymgr",
"(",
")",
"->",
"AbstractHotkeyMgr",
":",
"if",
"sys",
".",
"platform",
"==",
"'darwin'",
":",
"return",
"MacHotkeyMgr",
"(",
")",
"elif",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"return",
"WindowsHotkeyMgr",
"(",
")",
"elif",
... | https://github.com/EDCD/EDMarketConnector/blob/d8b29e45b86f36ab3cf540ec1503b9170a8505de/hotkey.py#L680-L699 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v8/services/services/topic_constant_service/client.py | python | TopicConstantServiceClient.common_folder_path | (folder: str,) | return "folders/{folder}".format(folder=folder,) | Return a fully-qualified folder string. | Return a fully-qualified folder string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"folder",
"string",
"."
] | def common_folder_path(folder: str,) -> str:
"""Return a fully-qualified folder string."""
return "folders/{folder}".format(folder=folder,) | [
"def",
"common_folder_path",
"(",
"folder",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"folders/{folder}\"",
".",
"format",
"(",
"folder",
"=",
"folder",
",",
")"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/topic_constant_service/client.py#L183-L185 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/odict/odict.py | python | Values.reverse | (self) | Reverse the values | Reverse the values | [
"Reverse",
"the",
"values"
] | def reverse(self):
"""Reverse the values"""
vals = self._main.values()
vals.reverse()
# FIXME: efficiency
self[:] = vals | [
"def",
"reverse",
"(",
"self",
")",
":",
"vals",
"=",
"self",
".",
"_main",
".",
"values",
"(",
")",
"vals",
".",
"reverse",
"(",
")",
"# FIXME: efficiency",
"self",
"[",
":",
"]",
"=",
"vals"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/odict/odict.py#L1141-L1146 | ||
mac-zhou/homeassistant-mi-acpartner | 0e29f4252abd25d0a4f5067c670184a4e2971d10 | custom_components/climate/mi_acpartner.py | python | MiAcPartner.is_away_mode_on | (self) | return self._away | Return if away mode is on. | Return if away mode is on. | [
"Return",
"if",
"away",
"mode",
"is",
"on",
"."
] | def is_away_mode_on(self):
"""Return if away mode is on."""
return self._away | [
"def",
"is_away_mode_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_away"
] | https://github.com/mac-zhou/homeassistant-mi-acpartner/blob/0e29f4252abd25d0a4f5067c670184a4e2971d10/custom_components/climate/mi_acpartner.py#L374-L376 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/mfi/sensor.py | python | MfiSensor.native_value | (self) | return round(self._port.value, digits) | Return the state of the sensor. | Return the state of the sensor. | [
"Return",
"the",
"state",
"of",
"the",
"sensor",
"."
] | def native_value(self):
"""Return the state of the sensor."""
try:
tag = self._port.tag
except ValueError:
tag = None
if tag is None:
return STATE_OFF
if self._port.model == "Input Digital":
return STATE_ON if self._port.value > 0 e... | [
"def",
"native_value",
"(",
"self",
")",
":",
"try",
":",
"tag",
"=",
"self",
".",
"_port",
".",
"tag",
"except",
"ValueError",
":",
"tag",
"=",
"None",
"if",
"tag",
"is",
"None",
":",
"return",
"STATE_OFF",
"if",
"self",
".",
"_port",
".",
"model",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/mfi/sensor.py#L104-L115 | |
thunlp/ERNIE | 9a4ab4af54bccb70b4eb53cbfe71a2bc16b9e93f | pretrain_data/WikiExtractor.py | python | findMatchingBraces | (text, ldelim=0) | :param ldelim: number of braces to match. 0 means match [[]], {{}} and {{{}}}. | :param ldelim: number of braces to match. 0 means match [[]], {{}} and {{{}}}. | [
":",
"param",
"ldelim",
":",
"number",
"of",
"braces",
"to",
"match",
".",
"0",
"means",
"match",
"[[",
"]]",
"{{",
"}}",
"and",
"{{{",
"}}}",
"."
] | def findMatchingBraces(text, ldelim=0):
"""
:param ldelim: number of braces to match. 0 means match [[]], {{}} and {{{}}}.
"""
# Parsing is done with respect to pairs of double braces {{..}} delimiting
# a template, and pairs of triple braces {{{..}}} delimiting a tplarg.
# If double opening bra... | [
"def",
"findMatchingBraces",
"(",
"text",
",",
"ldelim",
"=",
"0",
")",
":",
"# Parsing is done with respect to pairs of double braces {{..}} delimiting",
"# a template, and pairs of triple braces {{{..}}} delimiting a tplarg.",
"# If double opening braces are followed by triple closing brac... | https://github.com/thunlp/ERNIE/blob/9a4ab4af54bccb70b4eb53cbfe71a2bc16b9e93f/pretrain_data/WikiExtractor.py#L1183-L1290 | ||
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/backend/xcodebackend.py | python | XCodeBackend.generate_native_frameworks_map | (self) | [] | def generate_native_frameworks_map(self):
self.native_frameworks = {}
self.native_frameworks_fileref = {}
for t in self.build_targets.values():
for dep in t.get_external_deps():
if isinstance(dep, dependencies.AppleFrameworks):
for f in dep.framewo... | [
"def",
"generate_native_frameworks_map",
"(",
"self",
")",
":",
"self",
".",
"native_frameworks",
"=",
"{",
"}",
"self",
".",
"native_frameworks_fileref",
"=",
"{",
"}",
"for",
"t",
"in",
"self",
".",
"build_targets",
".",
"values",
"(",
")",
":",
"for",
"... | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/backend/xcodebackend.py#L454-L462 | ||||
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/db/models/base.py | python | Model._save_parents | (self, cls, using, update_fields) | return inserted | Save all the parents of cls using values from self. | Save all the parents of cls using values from self. | [
"Save",
"all",
"the",
"parents",
"of",
"cls",
"using",
"values",
"from",
"self",
"."
] | def _save_parents(self, cls, using, update_fields):
"""Save all the parents of cls using values from self."""
meta = cls._meta
inserted = False
for parent, field in meta.parents.items():
# Make sure the link fields are synced between parent and self.
if (field and... | [
"def",
"_save_parents",
"(",
"self",
",",
"cls",
",",
"using",
",",
"update_fields",
")",
":",
"meta",
"=",
"cls",
".",
"_meta",
"inserted",
"=",
"False",
"for",
"parent",
",",
"field",
"in",
"meta",
".",
"parents",
".",
"items",
"(",
")",
":",
"# Ma... | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/db/models/base.py#L795-L821 | |
armancohan/long-summarization | 1328d4f37b3a3a460f455e93e84ed4ddcd10dab1 | model.py | python | SummarizationModel._add_emb_vis | (self, embedding_var) | Do setup so that we can view word embedding visualization in Tensorboard, as described here:
https://www.tensorflow.org/get_started/embedding_viz
Make the vocab metadata file, then make the projector config file pointing to it. | Do setup so that we can view word embedding visualization in Tensorboard, as described here:
https://www.tensorflow.org/get_started/embedding_viz
Make the vocab metadata file, then make the projector config file pointing to it. | [
"Do",
"setup",
"so",
"that",
"we",
"can",
"view",
"word",
"embedding",
"visualization",
"in",
"Tensorboard",
"as",
"described",
"here",
":",
"https",
":",
"//",
"www",
".",
"tensorflow",
".",
"org",
"/",
"get_started",
"/",
"embedding_viz",
"Make",
"the",
... | def _add_emb_vis(self, embedding_var):
"""Do setup so that we can view word embedding visualization in Tensorboard, as described here:
https://www.tensorflow.org/get_started/embedding_viz
Make the vocab metadata file, then make the projector config file pointing to it."""
train_dir = os.path.join(FLAGS.... | [
"def",
"_add_emb_vis",
"(",
"self",
",",
"embedding_var",
")",
":",
"train_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"FLAGS",
".",
"log_root",
",",
"\"train\"",
")",
"vocab_metadata_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"train_dir",
",",... | https://github.com/armancohan/long-summarization/blob/1328d4f37b3a3a460f455e93e84ed4ddcd10dab1/model.py#L209-L227 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/difflib.py | python | Differ._qformat | (self, aline, bline, atags, btags) | r"""
Format "?" output and deal with leading tabs.
Example:
>>> d = Differ()
>>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n',
... ' ^ ^ ^ ', ' ^ ^ ^ ')
>>> for line in results: print repr(line)
...
'- \t... | r"""
Format "?" output and deal with leading tabs. | [
"r",
"Format",
"?",
"output",
"and",
"deal",
"with",
"leading",
"tabs",
"."
] | def _qformat(self, aline, bline, atags, btags):
r"""
Format "?" output and deal with leading tabs.
Example:
>>> d = Differ()
>>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n',
... ' ^ ^ ^ ', ' ^ ^ ^ ')
>>> for lin... | [
"def",
"_qformat",
"(",
"self",
",",
"aline",
",",
"bline",
",",
"atags",
",",
"btags",
")",
":",
"# Can hurt, but will probably help most of the time.",
"common",
"=",
"min",
"(",
"_count_leading",
"(",
"aline",
",",
"\"\\t\"",
")",
",",
"_count_leading",
"(",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/difflib.py#L1054-L1085 | ||
CSAILVision/NetDissect | 20ce6f887607aadc04ab9fb3d452e4723685cbbb | src/loadseg.py | python | SegmentationData.resolve_segmentation | (cls, m, categories=None) | return result, (row['sh'], row['sw']) | Resolves a full segmentation, potentially in a differenct process,
for efficient multiprocess data loading. | Resolves a full segmentation, potentially in a differenct process,
for efficient multiprocess data loading. | [
"Resolves",
"a",
"full",
"segmentation",
"potentially",
"in",
"a",
"differenct",
"process",
"for",
"efficient",
"multiprocess",
"data",
"loading",
"."
] | def resolve_segmentation(cls, m, categories=None):
'''
Resolves a full segmentation, potentially in a differenct process,
for efficient multiprocess data loading.
'''
directory, row = m
result = {}
for cat, d in row.items():
if cat in cls.meta_categori... | [
"def",
"resolve_segmentation",
"(",
"cls",
",",
"m",
",",
"categories",
"=",
"None",
")",
":",
"directory",
",",
"row",
"=",
"m",
"result",
"=",
"{",
"}",
"for",
"cat",
",",
"d",
"in",
"row",
".",
"items",
"(",
")",
":",
"if",
"cat",
"in",
"cls",... | https://github.com/CSAILVision/NetDissect/blob/20ce6f887607aadc04ab9fb3d452e4723685cbbb/src/loadseg.py#L124-L147 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_adm_policy_user.py | python | SecurityContextConstraints.remove_group | (self, inc_group) | return True | remove a group | remove a group | [
"remove",
"a",
"group"
] | def remove_group(self, inc_group):
''' remove a group '''
try:
self.groups.remove(inc_group)
except ValueError as _:
return False
return True | [
"def",
"remove_group",
"(",
"self",
",",
"inc_group",
")",
":",
"try",
":",
"self",
".",
"groups",
".",
"remove",
"(",
"inc_group",
")",
"except",
"ValueError",
"as",
"_",
":",
"return",
"False",
"return",
"True"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_adm_policy_user.py#L1943-L1950 | |
lululxvi/deepxde | 730c97282636e86c845ce2ba3253482f2178469e | deepxde/model.py | python | Model.__init__ | (self, data, net) | [] | def __init__(self, data, net):
self.data = data
self.net = net
self.opt_name = None
self.batch_size = None
self.callbacks = None
self.metrics = None
self.external_trainable_variables = []
self.train_state = TrainState()
self.losshistory = LossHist... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"net",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"net",
"=",
"net",
"self",
".",
"opt_name",
"=",
"None",
"self",
".",
"batch_size",
"=",
"None",
"self",
".",
"callbacks",
"=",
"None"... | https://github.com/lululxvi/deepxde/blob/730c97282636e86c845ce2ba3253482f2178469e/deepxde/model.py#L28-L49 | ||||
yandexdataschool/AgentNet | c28b99f11eb5d1c9080c2368f387b2cc4942adc3 | agentnet/utils/layers/broadcast.py | python | UnbroadcastLayer.get_output_for | (self, input, **kwargs) | return input.dimshuffle(dimshuffle_order) | Un-broadcasts the broadcast layer (see class description)
:param input: input tensor
:param kwargs: no effect
:return: un-broadcasted tensor | Un-broadcasts the broadcast layer (see class description)
:param input: input tensor
:param kwargs: no effect
:return: un-broadcasted tensor | [
"Un",
"-",
"broadcasts",
"the",
"broadcast",
"layer",
"(",
"see",
"class",
"description",
")",
":",
"param",
"input",
":",
"input",
"tensor",
":",
"param",
"kwargs",
":",
"no",
"effect",
":",
"return",
":",
"un",
"-",
"broadcasted",
"tensor"
] | def get_output_for(self, input, **kwargs):
"""
Un-broadcasts the broadcast layer (see class description)
:param input: input tensor
:param kwargs: no effect
:return: un-broadcasted tensor
"""
if not hasattr(self.broadcast_layer, "symbolic_input_shape"):
... | [
"def",
"get_output_for",
"(",
"self",
",",
"input",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
".",
"broadcast_layer",
",",
"\"symbolic_input_shape\"",
")",
":",
"raise",
"ValueError",
"(",
"\"UnbroadcastLayer.get_output_for must be ca... | https://github.com/yandexdataschool/AgentNet/blob/c28b99f11eb5d1c9080c2368f387b2cc4942adc3/agentnet/utils/layers/broadcast.py#L111-L137 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/telnetlib.py | python | Telnet.__del__ | (self) | Destructor -- close the connection. | Destructor -- close the connection. | [
"Destructor",
"--",
"close",
"the",
"connection",
"."
] | def __del__(self):
"""Destructor -- close the connection."""
self.close() | [
"def",
"__del__",
"(",
"self",
")",
":",
"self",
".",
"close",
"(",
")"
] | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/telnetlib.py#L236-L238 | ||
windelbouwman/ppci | 915c069e0667042c085ec42c78e9e3c9a5295324 | ppci/arch/x86_64/arch.py | python | X86_64Arch.gen_function_enter | (self, args) | Copy arguments into local temporaries and mark registers live | Copy arguments into local temporaries and mark registers live | [
"Copy",
"arguments",
"into",
"local",
"temporaries",
"and",
"mark",
"registers",
"live"
] | def gen_function_enter(self, args):
""" Copy arguments into local temporaries and mark registers live """
arg_types = [a[0] for a in args]
arg_locs = self.determine_arg_locations(arg_types)
arg_regs = set(
arg_loc for arg_loc in arg_locs if isinstance(arg_loc, Register)
... | [
"def",
"gen_function_enter",
"(",
"self",
",",
"args",
")",
":",
"arg_types",
"=",
"[",
"a",
"[",
"0",
"]",
"for",
"a",
"in",
"args",
"]",
"arg_locs",
"=",
"self",
".",
"determine_arg_locations",
"(",
"arg_types",
")",
"arg_regs",
"=",
"set",
"(",
"arg... | https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/arch/x86_64/arch.py#L398-L471 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_internal/req/req_install.py | python | InstallRequirement.ensure_has_source_dir | (self, parent_dir) | return self.source_dir | Ensure that a source_dir is set.
This will create a temporary build dir if the name of the requirement
isn't known yet.
:param parent_dir: The ideal pip parent_dir for the source_dir.
Generally src_dir for editables and build_dir for sdists.
:return: self.source_dir | Ensure that a source_dir is set. | [
"Ensure",
"that",
"a",
"source_dir",
"is",
"set",
"."
] | def ensure_has_source_dir(self, parent_dir):
"""Ensure that a source_dir is set.
This will create a temporary build dir if the name of the requirement
isn't known yet.
:param parent_dir: The ideal pip parent_dir for the source_dir.
Generally src_dir for editables and build_... | [
"def",
"ensure_has_source_dir",
"(",
"self",
",",
"parent_dir",
")",
":",
"if",
"self",
".",
"source_dir",
"is",
"None",
":",
"self",
".",
"source_dir",
"=",
"self",
".",
"build_location",
"(",
"parent_dir",
")",
"return",
"self",
".",
"source_dir"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_internal/req/req_install.py#L769-L781 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/fnmatch.py | python | translate | (pat) | return res + '\Z(?ms)' | Translate a shell PATTERN to a regular expression.
There is no way to quote meta-characters. | Translate a shell PATTERN to a regular expression. | [
"Translate",
"a",
"shell",
"PATTERN",
"to",
"a",
"regular",
"expression",
"."
] | def translate(pat):
"""Translate a shell PATTERN to a regular expression.
There is no way to quote meta-characters.
"""
i, n = 0, len(pat)
res = ''
while i < n:
c = pat[i]
i = i+1
if c == '*':
res = res + '.*'
elif c == '?':
res = res + '... | [
"def",
"translate",
"(",
"pat",
")",
":",
"i",
",",
"n",
"=",
"0",
",",
"len",
"(",
"pat",
")",
"res",
"=",
"''",
"while",
"i",
"<",
"n",
":",
"c",
"=",
"pat",
"[",
"i",
"]",
"i",
"=",
"i",
"+",
"1",
"if",
"c",
"==",
"'*'",
":",
"res",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/fnmatch.py#L81-L116 | |
merkremont/LineVodka | c2fa74107cecf00dd17416b62e4eb579e2c7bbaf | LineAlpha/LineThrift/TalkService.py | python | Client.updateProfile | (self, reqSeq, profile) | Parameters:
- reqSeq
- profile | Parameters:
- reqSeq
- profile | [
"Parameters",
":",
"-",
"reqSeq",
"-",
"profile"
] | def updateProfile(self, reqSeq, profile):
"""
Parameters:
- reqSeq
- profile
"""
self.send_updateProfile(reqSeq, profile)
self.recv_updateProfile() | [
"def",
"updateProfile",
"(",
"self",
",",
"reqSeq",
",",
"profile",
")",
":",
"self",
".",
"send_updateProfile",
"(",
"reqSeq",
",",
"profile",
")",
"self",
".",
"recv_updateProfile",
"(",
")"
] | https://github.com/merkremont/LineVodka/blob/c2fa74107cecf00dd17416b62e4eb579e2c7bbaf/LineAlpha/LineThrift/TalkService.py#L7430-L7437 | ||
HonglinChu/SiamTrackers | 8471660b14f970578a43f077b28207d44a27e867 | TrTr/TrTr-pysot/trtr/utils/bbox.py | python | cxy_wh_2_rect | (pos, sz) | return np.array([pos[0] - sz[0] / 2, pos[1] - sz[1] / 2, sz[0], sz[1]]) | convert (cx, cy, w, h) to (x1, y1, w, h), 0-index | convert (cx, cy, w, h) to (x1, y1, w, h), 0-index | [
"convert",
"(",
"cx",
"cy",
"w",
"h",
")",
"to",
"(",
"x1",
"y1",
"w",
"h",
")",
"0",
"-",
"index"
] | def cxy_wh_2_rect(pos, sz):
""" convert (cx, cy, w, h) to (x1, y1, w, h), 0-index
"""
return np.array([pos[0] - sz[0] / 2, pos[1] - sz[1] / 2, sz[0], sz[1]]) | [
"def",
"cxy_wh_2_rect",
"(",
"pos",
",",
"sz",
")",
":",
"return",
"np",
".",
"array",
"(",
"[",
"pos",
"[",
"0",
"]",
"-",
"sz",
"[",
"0",
"]",
"/",
"2",
",",
"pos",
"[",
"1",
"]",
"-",
"sz",
"[",
"1",
"]",
"/",
"2",
",",
"sz",
"[",
"0... | https://github.com/HonglinChu/SiamTrackers/blob/8471660b14f970578a43f077b28207d44a27e867/TrTr/TrTr-pysot/trtr/utils/bbox.py#L82-L85 | |
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/devices.py | python | XBeeDevice._determine_operating_mode | (self) | return OperatingMode.UNKNOWN | Determines and returns the operating mode of the XBee dice.
If the XBee is not in AT command mode, this method attempts to enter on it.
Returns:
:class:`.OperatingMode`: This XBee operating mode.
.. seealso::
| :class:`.OperatingMode` | Determines and returns the operating mode of the XBee dice. | [
"Determines",
"and",
"returns",
"the",
"operating",
"mode",
"of",
"the",
"XBee",
"dice",
"."
] | def _determine_operating_mode(self):
"""
Determines and returns the operating mode of the XBee dice.
If the XBee is not in AT command mode, this method attempts to enter on it.
Returns:
:class:`.OperatingMode`: This XBee operating mode.
.. seealso::
| :c... | [
"def",
"_determine_operating_mode",
"(",
"self",
")",
":",
"try",
":",
"response",
"=",
"self",
".",
"get_parameter",
"(",
"ATStringCommand",
".",
"AP",
",",
"apply",
"=",
"False",
")",
"return",
"OperatingMode",
".",
"get",
"(",
"response",
"[",
"0",
"]",... | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/devices.py#L3968-L4007 | |
mpenning/ciscoconfparse | a6a176e6ceac7c5f3e974272fa70273476ba84a3 | ciscoconfparse/ccp_abc.py | python | BaseCfgLine.has_child_with | (self, linespec) | return bool(filter(methodcaller("re_search", linespec), self.children)) | [] | def has_child_with(self, linespec):
return bool(filter(methodcaller("re_search", linespec), self.children)) | [
"def",
"has_child_with",
"(",
"self",
",",
"linespec",
")",
":",
"return",
"bool",
"(",
"filter",
"(",
"methodcaller",
"(",
"\"re_search\"",
",",
"linespec",
")",
",",
"self",
".",
"children",
")",
")"
] | https://github.com/mpenning/ciscoconfparse/blob/a6a176e6ceac7c5f3e974272fa70273476ba84a3/ciscoconfparse/ccp_abc.py#L326-L327 | |||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/preprocess/impute.py | python | Default.__call__ | (self, data, variable, *, default=None) | return variable.copy(compute_value=ReplaceUnknowns(variable, default)) | [] | def __call__(self, data, variable, *, default=None):
variable = data.domain[variable]
default = default if default is not None else self.default
return variable.copy(compute_value=ReplaceUnknowns(variable, default)) | [
"def",
"__call__",
"(",
"self",
",",
"data",
",",
"variable",
",",
"*",
",",
"default",
"=",
"None",
")",
":",
"variable",
"=",
"data",
".",
"domain",
"[",
"variable",
"]",
"default",
"=",
"default",
"if",
"default",
"is",
"not",
"None",
"else",
"sel... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/preprocess/impute.py#L140-L143 | |||
PyThaiNLP/pythainlp | de38b8507bf0934540aa5094e5f7f57d7f67e2dc | pythainlp/tokenize/crfcut.py | python | extract_features | (
doc: List[str], window: int = 2, max_n_gram: int = 3
) | return doc_features | Extract features for CRF by sliding `max_n_gram` of tokens
for +/- `window` from the current token
:param List[str] doc: tokens from which features are to be extracted from
:param int window: size of window before and after the current token
:param int max_n_gram: create n_grams from 1-gram to `max_n_g... | Extract features for CRF by sliding `max_n_gram` of tokens
for +/- `window` from the current token | [
"Extract",
"features",
"for",
"CRF",
"by",
"sliding",
"max_n_gram",
"of",
"tokens",
"for",
"+",
"/",
"-",
"window",
"from",
"the",
"current",
"token"
] | def extract_features(
doc: List[str], window: int = 2, max_n_gram: int = 3
) -> List[List[str]]:
"""
Extract features for CRF by sliding `max_n_gram` of tokens
for +/- `window` from the current token
:param List[str] doc: tokens from which features are to be extracted from
:param int window: si... | [
"def",
"extract_features",
"(",
"doc",
":",
"List",
"[",
"str",
"]",
",",
"window",
":",
"int",
"=",
"2",
",",
"max_n_gram",
":",
"int",
"=",
"3",
")",
"->",
"List",
"[",
"List",
"[",
"str",
"]",
"]",
":",
"doc_features",
"=",
"[",
"]",
"doc",
... | https://github.com/PyThaiNLP/pythainlp/blob/de38b8507bf0934540aa5094e5f7f57d7f67e2dc/pythainlp/tokenize/crfcut.py#L126-L177 | |
midgetspy/Sick-Beard | 171a607e41b7347a74cc815f6ecce7968d9acccf | cherrypy/_cptools.py | python | Toolbox.__enter__ | (self) | return populate | Populate request.toolmaps from tools specified in config. | Populate request.toolmaps from tools specified in config. | [
"Populate",
"request",
".",
"toolmaps",
"from",
"tools",
"specified",
"in",
"config",
"."
] | def __enter__(self):
"""Populate request.toolmaps from tools specified in config."""
cherrypy.serving.request.toolmaps[self.namespace] = map = {}
def populate(k, v):
toolname, arg = k.split(".", 1)
bucket = map.setdefault(toolname, {})
bucket[arg] = v
... | [
"def",
"__enter__",
"(",
"self",
")",
":",
"cherrypy",
".",
"serving",
".",
"request",
".",
"toolmaps",
"[",
"self",
".",
"namespace",
"]",
"=",
"map",
"=",
"{",
"}",
"def",
"populate",
"(",
"k",
",",
"v",
")",
":",
"toolname",
",",
"arg",
"=",
"... | https://github.com/midgetspy/Sick-Beard/blob/171a607e41b7347a74cc815f6ecce7968d9acccf/cherrypy/_cptools.py#L420-L427 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/sparse/frame.py | python | SparseDataFrame._init_spmatrix | (self, data, index, columns, dtype=None,
fill_value=None) | return self._init_dict(sdict, index, columns, dtype) | Init self from scipy.sparse matrix | Init self from scipy.sparse matrix | [
"Init",
"self",
"from",
"scipy",
".",
"sparse",
"matrix"
] | def _init_spmatrix(self, data, index, columns, dtype=None,
fill_value=None):
""" Init self from scipy.sparse matrix """
index, columns = self._prep_index(data, index, columns)
data = data.tocoo()
N = len(index)
# Construct a dict of SparseSeries
sd... | [
"def",
"_init_spmatrix",
"(",
"self",
",",
"data",
",",
"index",
",",
"columns",
",",
"dtype",
"=",
"None",
",",
"fill_value",
"=",
"None",
")",
":",
"index",
",",
"columns",
"=",
"self",
".",
"_prep_index",
"(",
"data",
",",
"index",
",",
"columns",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/sparse/frame.py#L203-L231 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_6.4/ecdsa/curves.py | python | orderlen | (order) | return (1+len("%x"%order))//2 | [] | def orderlen(order):
return (1+len("%x"%order))//2 | [
"def",
"orderlen",
"(",
"order",
")",
":",
"return",
"(",
"1",
"+",
"len",
"(",
"\"%x\"",
"%",
"order",
")",
")",
"//",
"2"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_6.4/ecdsa/curves.py#L8-L9 | |||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/layouts/layouts.py | python | Layouts.set_active_layout | (self, name: str) | Set layout `name` as active paperspace layout. | Set layout `name` as active paperspace layout. | [
"Set",
"layout",
"name",
"as",
"active",
"paperspace",
"layout",
"."
] | def set_active_layout(self, name: str) -> None:
"""Set layout `name` as active paperspace layout."""
assert isinstance(name, str), type(name)
if key(name) == MODEL: # reserved layout name
raise DXFValueError("Can not set model space as active layout")
# raises KeyError if la... | [
"def",
"set_active_layout",
"(",
"self",
",",
"name",
":",
"str",
")",
"->",
"None",
":",
"assert",
"isinstance",
"(",
"name",
",",
"str",
")",
",",
"type",
"(",
"name",
")",
"if",
"key",
"(",
"name",
")",
"==",
"MODEL",
":",
"# reserved layout name",
... | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/layouts/layouts.py#L277-L293 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/states/bigip.py | python | manage_pool | (
hostname,
username,
password,
name,
allow_nat=None,
allow_snat=None,
description=None,
gateway_failsafe_device=None,
ignore_persisted_weight=None,
ip_tos_to_client=None,
ip_tos_to_server=None,
link_qos_to_client=None,
link_qos_to_server=None,
load_balancing_mode... | return ret | Create a new pool if it does not already exist. Pool members are managed separately. Only the
parameters specified are enforced.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the... | Create a new pool if it does not already exist. Pool members are managed separately. Only the
parameters specified are enforced. | [
"Create",
"a",
"new",
"pool",
"if",
"it",
"does",
"not",
"already",
"exist",
".",
"Pool",
"members",
"are",
"managed",
"separately",
".",
"Only",
"the",
"parameters",
"specified",
"are",
"enforced",
"."
] | def manage_pool(
hostname,
username,
password,
name,
allow_nat=None,
allow_snat=None,
description=None,
gateway_failsafe_device=None,
ignore_persisted_weight=None,
ip_tos_to_client=None,
ip_tos_to_server=None,
link_qos_to_client=None,
link_qos_to_server=None,
load... | [
"def",
"manage_pool",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"name",
",",
"allow_nat",
"=",
"None",
",",
"allow_snat",
"=",
"None",
",",
"description",
"=",
"None",
",",
"gateway_failsafe_device",
"=",
"None",
",",
"ignore_persisted_weight",
"... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/states/bigip.py#L821-L1052 | |
openstack/rally | 58b12c2e0bfa541bdb038be6e1679c5117b98484 | rally/cli/commands/verify.py | python | VerifyCommands.list_plugins | (self, api, platform=None) | List all plugins for verifiers management. | List all plugins for verifiers management. | [
"List",
"all",
"plugins",
"for",
"verifiers",
"management",
"."
] | def list_plugins(self, api, platform=None):
"""List all plugins for verifiers management."""
if platform:
platform = platform.lower()
verifier_plugins = api.verifier.list_plugins(platform=platform)
fields = ["Plugin name", "Platform", "Description"]
if logging.is_de... | [
"def",
"list_plugins",
"(",
"self",
",",
"api",
",",
"platform",
"=",
"None",
")",
":",
"if",
"platform",
":",
"platform",
"=",
"platform",
".",
"lower",
"(",
")",
"verifier_plugins",
"=",
"api",
".",
"verifier",
".",
"list_plugins",
"(",
"platform",
"="... | https://github.com/openstack/rally/blob/58b12c2e0bfa541bdb038be6e1679c5117b98484/rally/cli/commands/verify.py#L91-L104 | ||
google-research/batch-ppo | 3d09705977bae4e7c3eb20339a3b384d2a5531e4 | agents/parts/normalize.py | python | StreamingNormalize.__init__ | (
self, template, center=True, scale=True, clip=10, name='normalize') | Normalize tensors based on streaming estimates of mean and variance.
Centering the value, scaling it by the standard deviation, and clipping
outlier values are optional.
Args:
template: Example tensor providing shape and dtype of the vaule to track.
center: Python boolean indicating whether to... | Normalize tensors based on streaming estimates of mean and variance. | [
"Normalize",
"tensors",
"based",
"on",
"streaming",
"estimates",
"of",
"mean",
"and",
"variance",
"."
] | def __init__(
self, template, center=True, scale=True, clip=10, name='normalize'):
"""Normalize tensors based on streaming estimates of mean and variance.
Centering the value, scaling it by the standard deviation, and clipping
outlier values are optional.
Args:
template: Example tensor pro... | [
"def",
"__init__",
"(",
"self",
",",
"template",
",",
"center",
"=",
"True",
",",
"scale",
"=",
"True",
",",
"clip",
"=",
"10",
",",
"name",
"=",
"'normalize'",
")",
":",
"self",
".",
"_center",
"=",
"center",
"self",
".",
"_scale",
"=",
"scale",
"... | https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/parts/normalize.py#L27-L48 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/paramiko/sftp_client.py | python | SFTPClient.listdir_attr | (self, path='.') | return filelist | Return a list containing `.SFTPAttributes` objects corresponding to
files in the given ``path``. The list is in arbitrary order. It does
not include the special entries ``'.'`` and ``'..'`` even if they are
present in the folder.
The returned `.SFTPAttributes` objects will each have a... | Return a list containing `.SFTPAttributes` objects corresponding to
files in the given ``path``. The list is in arbitrary order. It does
not include the special entries ``'.'`` and ``'..'`` even if they are
present in the folder. | [
"Return",
"a",
"list",
"containing",
".",
"SFTPAttributes",
"objects",
"corresponding",
"to",
"files",
"in",
"the",
"given",
"path",
".",
"The",
"list",
"is",
"in",
"arbitrary",
"order",
".",
"It",
"does",
"not",
"include",
"the",
"special",
"entries",
".",
... | def listdir_attr(self, path='.'):
"""
Return a list containing `.SFTPAttributes` objects corresponding to
files in the given ``path``. The list is in arbitrary order. It does
not include the special entries ``'.'`` and ``'..'`` even if they are
present in the folder.
T... | [
"def",
"listdir_attr",
"(",
"self",
",",
"path",
"=",
"'.'",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"'listdir(%r)'",
"%",
"path",
")",
"t",
",",
"msg",
"=",
"self",
".",
"_reques... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/paramiko/sftp_client.py#L174-L214 | |
bshao001/ChatLearner | 4b7d8a617bb0cc5c2a792a3e87d7be7bf6364b43 | chatbot/modelhelper.py | python | _single_cell | (num_units, keep_prob, device_str=None) | return single_cell | Create an instance of a single RNN cell. | Create an instance of a single RNN cell. | [
"Create",
"an",
"instance",
"of",
"a",
"single",
"RNN",
"cell",
"."
] | def _single_cell(num_units, keep_prob, device_str=None):
"""Create an instance of a single RNN cell."""
single_cell = tf.contrib.rnn.GRUCell(num_units)
if keep_prob < 1.0:
single_cell = tf.contrib.rnn.DropoutWrapper(cell=single_cell, input_keep_prob=keep_prob)
# Device Wrapper
if device_st... | [
"def",
"_single_cell",
"(",
"num_units",
",",
"keep_prob",
",",
"device_str",
"=",
"None",
")",
":",
"single_cell",
"=",
"tf",
".",
"contrib",
".",
"rnn",
".",
"GRUCell",
"(",
"num_units",
")",
"if",
"keep_prob",
"<",
"1.0",
":",
"single_cell",
"=",
"tf"... | https://github.com/bshao001/ChatLearner/blob/4b7d8a617bb0cc5c2a792a3e87d7be7bf6364b43/chatbot/modelhelper.py#L47-L58 | |
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py | python | TarIter.__next__ | (self) | return tarinfo | Return the next item using TarFile's next() method.
When all members have been read, set TarFile as _loaded. | Return the next item using TarFile's next() method.
When all members have been read, set TarFile as _loaded. | [
"Return",
"the",
"next",
"item",
"using",
"TarFile",
"s",
"next",
"()",
"method",
".",
"When",
"all",
"members",
"have",
"been",
"read",
"set",
"TarFile",
"as",
"_loaded",
"."
] | def __next__(self):
"""Return the next item using TarFile's next() method.
When all members have been read, set TarFile as _loaded.
"""
# Fix for SF #1100429: Under rare circumstances it can
# happen that getmembers() is called during iteration,
# which will cause TarI... | [
"def",
"__next__",
"(",
"self",
")",
":",
"# Fix for SF #1100429: Under rare circumstances it can",
"# happen that getmembers() is called during iteration,",
"# which will cause TarIter to stop prematurely.",
"if",
"not",
"self",
".",
"tarfile",
".",
"_loaded",
":",
"tarinfo",
"=... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py#L2570-L2588 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/sso/models.py | python | UserExemptFromSingleSignOn.__str__ | (self) | return f"{self.username} is exempt from SSO with {self.email_domain}" | [] | def __str__(self):
return f"{self.username} is exempt from SSO with {self.email_domain}" | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"f\"{self.username} is exempt from SSO with {self.email_domain}\""
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/sso/models.py#L391-L392 | |||
SamSchott/maestral | a32653bac7b5a76cb326d4fd5a4fb2c11f19a2fc | src/maestral/utils/orm.py | python | SqlType.py_to_sql | (value) | return value | Converts a Python value to a type accepted by sqlite3. | Converts a Python value to a type accepted by sqlite3. | [
"Converts",
"a",
"Python",
"value",
"to",
"a",
"type",
"accepted",
"by",
"sqlite3",
"."
] | def py_to_sql(value):
"""Converts a Python value to a type accepted by sqlite3."""
return value | [
"def",
"py_to_sql",
"(",
"value",
")",
":",
"return",
"value"
] | https://github.com/SamSchott/maestral/blob/a32653bac7b5a76cb326d4fd5a4fb2c11f19a2fc/src/maestral/utils/orm.py#L57-L59 | |
rotki/rotki | aafa446815cdd5e9477436d1b02bee7d01b398c8 | tools/uniswapv2/detect.py | python | pairs_and_token_details_from_graph | () | return contracts | Detect the uniswap v2 pool tokens by using the subgraph | Detect the uniswap v2 pool tokens by using the subgraph | [
"Detect",
"the",
"uniswap",
"v2",
"pool",
"tokens",
"by",
"using",
"the",
"subgraph"
] | def pairs_and_token_details_from_graph() -> Dict[str, Any]:
"""Detect the uniswap v2 pool tokens by using the subgraph"""
step = 1000
querystr = """
pairs(first:$first, skip: $skip) {
id
token0{
id
symbol
name
decimals
}
token1{
... | [
"def",
"pairs_and_token_details_from_graph",
"(",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"step",
"=",
"1000",
"querystr",
"=",
"\"\"\"\n pairs(first:$first, skip: $skip) {\n id\n token0{\n id\n symbol\n name\n dec... | https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/tools/uniswapv2/detect.py#L76-L138 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | datadog_checks_downloader/datadog_checks/downloader/download.py | python | TUFDownloader.__download_with_tuf_in_toto | (self, target_relpath) | [] | def __download_with_tuf_in_toto(self, target_relpath):
target_abspath, target = self.__download_with_tuf(target_relpath)
# Next, we use in-toto to verify the supply chain of the target.
# NOTE: We use a flag to avoid recursively downloading in-toto
# metadata for in-toto metadata themse... | [
"def",
"__download_with_tuf_in_toto",
"(",
"self",
",",
"target_relpath",
")",
":",
"target_abspath",
",",
"target",
"=",
"self",
".",
"__download_with_tuf",
"(",
"target_relpath",
")",
"# Next, we use in-toto to verify the supply chain of the target.",
"# NOTE: We use a flag t... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_checks_downloader/datadog_checks/downloader/download.py#L251-L265 | ||||
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | lib/infi/pkg_resources/_vendor/pyparsing.py | python | ParserElement.__radd__ | (self, other ) | return other + self | Implementation of + operator when left operand is not a C{L{ParserElement}} | Implementation of + operator when left operand is not a C{L{ParserElement}} | [
"Implementation",
"of",
"+",
"operator",
"when",
"left",
"operand",
"is",
"not",
"a",
"C",
"{",
"L",
"{",
"ParserElement",
"}}"
] | def __radd__(self, other ):
"""
Implementation of + operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn(... | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/infi/pkg_resources/_vendor/pyparsing.py#L1800-L1810 | |
jyapayne/Web2Executable | 027b01914e4faecfa038169d477851de0cbd9b96 | image_utils/png.py | python | Writer.file_scanlines | (self, infile) | Generates boxed rows in flat pixel format, from the input file
`infile`. It assumes that the input file is in a "Netpbm-like"
binary format, and is positioned at the beginning of the first
pixel. The number of pixels to read is taken from the image
dimensions (`width`, `height`, `plane... | Generates boxed rows in flat pixel format, from the input file
`infile`. It assumes that the input file is in a "Netpbm-like"
binary format, and is positioned at the beginning of the first
pixel. The number of pixels to read is taken from the image
dimensions (`width`, `height`, `plane... | [
"Generates",
"boxed",
"rows",
"in",
"flat",
"pixel",
"format",
"from",
"the",
"input",
"file",
"infile",
".",
"It",
"assumes",
"that",
"the",
"input",
"file",
"is",
"in",
"a",
"Netpbm",
"-",
"like",
"binary",
"format",
"and",
"is",
"positioned",
"at",
"t... | def file_scanlines(self, infile):
"""
Generates boxed rows in flat pixel format, from the input file
`infile`. It assumes that the input file is in a "Netpbm-like"
binary format, and is positioned at the beginning of the first
pixel. The number of pixels to read is taken from t... | [
"def",
"file_scanlines",
"(",
"self",
",",
"infile",
")",
":",
"# Values per row",
"vpr",
"=",
"self",
".",
"width",
"*",
"self",
".",
"planes",
"row_bytes",
"=",
"vpr",
"if",
"self",
".",
"bitdepth",
">",
"8",
":",
"assert",
"self",
".",
"bitdepth",
"... | https://github.com/jyapayne/Web2Executable/blob/027b01914e4faecfa038169d477851de0cbd9b96/image_utils/png.py#L866-L890 | ||
pycontribs/pyrax | a0c022981f76a4cba96a22ecc19bb52843ac4fbe | pyrax/object_storage.py | python | StorageClient.delete_container_metadata | (self, container, prefix=None) | return self._manager.delete_metadata(container, prefix=prefix) | Removes all of thethe container's metadata.
By default, all metadata beginning with the standard container metadata
prefix ('X-Container-Meta-') is removed. If you wish to remove all
metadata beginning with a different prefix, you must specify that
prefix. | Removes all of thethe container's metadata. | [
"Removes",
"all",
"of",
"thethe",
"container",
"s",
"metadata",
"."
] | def delete_container_metadata(self, container, prefix=None):
"""
Removes all of thethe container's metadata.
By default, all metadata beginning with the standard container metadata
prefix ('X-Container-Meta-') is removed. If you wish to remove all
metadata beginning with a diffe... | [
"def",
"delete_container_metadata",
"(",
"self",
",",
"container",
",",
"prefix",
"=",
"None",
")",
":",
"return",
"self",
".",
"_manager",
".",
"delete_metadata",
"(",
"container",
",",
"prefix",
"=",
"prefix",
")"
] | https://github.com/pycontribs/pyrax/blob/a0c022981f76a4cba96a22ecc19bb52843ac4fbe/pyrax/object_storage.py#L2564-L2573 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/abc/_storage.py | python | StorageTableMetaABC.get_schema | (self) | [] | def get_schema(self):
... | [
"def",
"get_schema",
"(",
"self",
")",
":",
"..."
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/abc/_storage.py#L97-L98 | ||||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexes/multi.py | python | MultiIndex.is_lexsorted_for_tuple | (self, tup) | return len(tup) <= self.lexsort_depth | Return True if we are correctly lexsorted given the passed tuple | Return True if we are correctly lexsorted given the passed tuple | [
"Return",
"True",
"if",
"we",
"are",
"correctly",
"lexsorted",
"given",
"the",
"passed",
"tuple"
] | def is_lexsorted_for_tuple(self, tup):
"""
Return True if we are correctly lexsorted given the passed tuple
"""
return len(tup) <= self.lexsort_depth | [
"def",
"is_lexsorted_for_tuple",
"(",
"self",
",",
"tup",
")",
":",
"return",
"len",
"(",
"tup",
")",
"<=",
"self",
".",
"lexsort_depth"
] | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexes/multi.py#L1024-L1028 | |
erikdubois/Aureola | 005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef | lazuli8core/dropbox.py | python | lansync | (argv) | u"""enables or disables LAN sync
dropbox lansync [y/n]
options:
y dropbox will use LAN sync (default)
n dropbox will not use LAN sync | u"""enables or disables LAN sync
dropbox lansync [y/n] | [
"u",
"enables",
"or",
"disables",
"LAN",
"sync",
"dropbox",
"lansync",
"[",
"y",
"/",
"n",
"]"
] | def lansync(argv):
u"""enables or disables LAN sync
dropbox lansync [y/n]
options:
y dropbox will use LAN sync (default)
n dropbox will not use LAN sync
"""
if len(argv) != 1:
console_print(lansync.__doc__, linebreak=False)
return
s = argv[0].lower()
if s.startswith('y') or s.sta... | [
"def",
"lansync",
"(",
"argv",
")",
":",
"if",
"len",
"(",
"argv",
")",
"!=",
"1",
":",
"console_print",
"(",
"lansync",
".",
"__doc__",
",",
"linebreak",
"=",
"False",
")",
"return",
"s",
"=",
"argv",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"if",... | https://github.com/erikdubois/Aureola/blob/005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef/lazuli8core/dropbox.py#L1249-L1273 | ||
timkpaine/pyEX | 254acd2b0cf7cb7183100106f4ecc11d1860c46a | pyEX/stocks/news.py | python | marketNewsDF | (*args, **kwargs) | return _reindex(_toDatetime(pd.DataFrame(marketNews(*args, **kwargs))), "datetime") | [] | def marketNewsDF(*args, **kwargs):
return _reindex(_toDatetime(pd.DataFrame(marketNews(*args, **kwargs))), "datetime") | [
"def",
"marketNewsDF",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_reindex",
"(",
"_toDatetime",
"(",
"pd",
".",
"DataFrame",
"(",
"marketNews",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
")",
",",
"\"datetime\"",
")"
] | https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/stocks/news.py#L102-L103 | |||
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/storage/utils/processors.py | python | CSVFileWriter.write_line | (self, elements, filewriter=None) | [] | def write_line(self, elements, filewriter=None):
self._csv_writer.writerow(elements) | [
"def",
"write_line",
"(",
"self",
",",
"elements",
",",
"filewriter",
"=",
"None",
")",
":",
"self",
".",
"_csv_writer",
".",
"writerow",
"(",
"elements",
")"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/storage/utils/processors.py#L82-L83 | ||||
openstack/openstacksdk | 58384268487fa854f21c470b101641ab382c9897 | openstack/database/v1/instance.py | python | Instance.is_root_enabled | (self, session) | return resp.json()['rootEnabled'] | Determine if root is enabled on an instance.
Determine if root is enabled on this particular instance.
:param session: The session to use for making this request.
:type session: :class:`~keystoneauth1.adapter.Adapter`
:returns: ``True`` if root user is enabled for a specified database
... | Determine if root is enabled on an instance. | [
"Determine",
"if",
"root",
"is",
"enabled",
"on",
"an",
"instance",
"."
] | def is_root_enabled(self, session):
"""Determine if root is enabled on an instance.
Determine if root is enabled on this particular instance.
:param session: The session to use for making this request.
:type session: :class:`~keystoneauth1.adapter.Adapter`
:returns: ``True`` if... | [
"def",
"is_root_enabled",
"(",
"self",
",",
"session",
")",
":",
"url",
"=",
"utils",
".",
"urljoin",
"(",
"self",
".",
"base_path",
",",
"self",
".",
"id",
",",
"'root'",
")",
"resp",
"=",
"session",
".",
"get",
"(",
"url",
",",
")",
"return",
"re... | https://github.com/openstack/openstacksdk/blob/58384268487fa854f21c470b101641ab382c9897/openstack/database/v1/instance.py#L69-L81 | |
eBay/accelerator | 218d9a5e4451ac72b9e65df6c5b32e37d25136c8 | accelerator/dispatch.py | python | close_fds | (keep) | [] | def close_fds(keep):
for fd in valid_fds:
# Apparently sometimes one of them has gone away.
# That's a little worrying, so try to protect our stuff (and ignore errors).
try:
if fd not in keep:
os.close(fd)
except OSError:
pass | [
"def",
"close_fds",
"(",
"keep",
")",
":",
"for",
"fd",
"in",
"valid_fds",
":",
"# Apparently sometimes one of them has gone away.",
"# That's a little worrying, so try to protect our stuff (and ignore errors).",
"try",
":",
"if",
"fd",
"not",
"in",
"keep",
":",
"os",
"."... | https://github.com/eBay/accelerator/blob/218d9a5e4451ac72b9e65df6c5b32e37d25136c8/accelerator/dispatch.py#L47-L55 | ||||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/bottle/bottle.py | python | debug | (mode=True) | Change the debug level.
There is only one debug level supported at the moment. | Change the debug level.
There is only one debug level supported at the moment. | [
"Change",
"the",
"debug",
"level",
".",
"There",
"is",
"only",
"one",
"debug",
"level",
"supported",
"at",
"the",
"moment",
"."
] | def debug(mode=True):
""" Change the debug level.
There is only one debug level supported at the moment."""
global DEBUG
DEBUG = bool(mode) | [
"def",
"debug",
"(",
"mode",
"=",
"True",
")",
":",
"global",
"DEBUG",
"DEBUG",
"=",
"bool",
"(",
"mode",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/bottle/bottle.py#L2135-L2139 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/cgi.py | python | parse_header | (line) | return key, pdict | Parse a Content-type like header.
Return the main content-type and a dictionary of options. | Parse a Content-type like header. | [
"Parse",
"a",
"Content",
"-",
"type",
"like",
"header",
"."
] | def parse_header(line):
"""Parse a Content-type like header.
Return the main content-type and a dictionary of options.
"""
parts = _parseparam(';' + line)
key = parts.next()
pdict = {}
for p in parts:
i = p.find('=')
if i >= 0:
name = p[:i].strip().lower()
... | [
"def",
"parse_header",
"(",
"line",
")",
":",
"parts",
"=",
"_parseparam",
"(",
"';'",
"+",
"line",
")",
"key",
"=",
"parts",
".",
"next",
"(",
")",
"pdict",
"=",
"{",
"}",
"for",
"p",
"in",
"parts",
":",
"i",
"=",
"p",
".",
"find",
"(",
"'='",... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/cgi.py#L304-L322 | |
csparpa/pyowm | 0474b61cc67fa3c95f9e572b96d3248031828fce | pyowm/owm.py | python | OWM.airpollution_manager | (self) | return airpollution_manager.AirPollutionManager(self.api_key, self.config) | Gives a `pyowm.airpollutionapi30.airpollution_manager.AirPollutionManager` instance that can be used to fetch air
pollution data.
:return: a `pyowm.airpollutionapi30.airpollution_manager.AirPollutionManager` instance | Gives a `pyowm.airpollutionapi30.airpollution_manager.AirPollutionManager` instance that can be used to fetch air
pollution data.
:return: a `pyowm.airpollutionapi30.airpollution_manager.AirPollutionManager` instance | [
"Gives",
"a",
"pyowm",
".",
"airpollutionapi30",
".",
"airpollution_manager",
".",
"AirPollutionManager",
"instance",
"that",
"can",
"be",
"used",
"to",
"fetch",
"air",
"pollution",
"data",
".",
":",
"return",
":",
"a",
"pyowm",
".",
"airpollutionapi30",
".",
... | def airpollution_manager(self):
"""
Gives a `pyowm.airpollutionapi30.airpollution_manager.AirPollutionManager` instance that can be used to fetch air
pollution data.
:return: a `pyowm.airpollutionapi30.airpollution_manager.AirPollutionManager` instance
"""
return airpollu... | [
"def",
"airpollution_manager",
"(",
"self",
")",
":",
"return",
"airpollution_manager",
".",
"AirPollutionManager",
"(",
"self",
".",
"api_key",
",",
"self",
".",
"config",
")"
] | https://github.com/csparpa/pyowm/blob/0474b61cc67fa3c95f9e572b96d3248031828fce/pyowm/owm.py#L75-L81 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/pyparsing.py | python | Forward.__lshift__ | ( self, other ) | return self | [] | def __lshift__( self, other ):
if isinstance( other, basestring ):
other = ParserElement._literalStringClass(other)
self.expr = other
self.strRepr = None
self.mayIndexError = self.expr.mayIndexError
self.mayReturnEmpty = self.expr.mayReturnEmpty
self.setWhites... | [
"def",
"__lshift__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"self",
".",
"expr",
"=",
"other",
"self",
".",
"strRep... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/pyparsing.py#L4122-L4133 | |||
TensorSpeech/TensorflowTTS | 34358d82a4c91fd70344872f8ea8a405ea84aedb | tensorflow_tts/utils/weight_norm.py | python | WeightNormalization.__init__ | (self, layer, data_init=True, **kwargs) | Initialize WeightNorm wrapper.
Args:
layer: A `tf.keras.layers.Layer` instance. Supported layer types are
`Dense`, `Conv2D`, and `Conv2DTranspose`. Layers with multiple inputs
are not supported.
data_init: `bool`, if `True` use data dependent variable initialization.
... | Initialize WeightNorm wrapper.
Args:
layer: A `tf.keras.layers.Layer` instance. Supported layer types are
`Dense`, `Conv2D`, and `Conv2DTranspose`. Layers with multiple inputs
are not supported.
data_init: `bool`, if `True` use data dependent variable initialization.
... | [
"Initialize",
"WeightNorm",
"wrapper",
".",
"Args",
":",
"layer",
":",
"A",
"tf",
".",
"keras",
".",
"layers",
".",
"Layer",
"instance",
".",
"Supported",
"layer",
"types",
"are",
"Dense",
"Conv2D",
"and",
"Conv2DTranspose",
".",
"Layers",
"with",
"multiple"... | def __init__(self, layer, data_init=True, **kwargs):
"""Initialize WeightNorm wrapper.
Args:
layer: A `tf.keras.layers.Layer` instance. Supported layer types are
`Dense`, `Conv2D`, and `Conv2DTranspose`. Layers with multiple inputs
are not supported.
data_init... | [
"def",
"__init__",
"(",
"self",
",",
"layer",
",",
"data_init",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"layer",
",",
"tf",
".",
"keras",
".",
"layers",
".",
"Layer",
")",
":",
"raise",
"ValueError",
"(",
"\"... | https://github.com/TensorSpeech/TensorflowTTS/blob/34358d82a4c91fd70344872f8ea8a405ea84aedb/tensorflow_tts/utils/weight_norm.py#L48-L84 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.