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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CentOS-PaaS-SIG/linchpin | a449385a4823a43e6f336de42b874ac7877d8b3e | linchpin/cli/context.py | python | LinchpinCliContext.inventory_path | (self) | return self.get_cfg('lp', 'inventory_path', default) | getter function for inventory_path | getter function for inventory_path | [
"getter",
"function",
"for",
"inventory_path"
] | def inventory_path(self):
"""
getter function for inventory_path
"""
default = self._get_latest_file(self.inventory_folder)
return self.get_cfg('lp', 'inventory_path', default) | [
"def",
"inventory_path",
"(",
"self",
")",
":",
"default",
"=",
"self",
".",
"_get_latest_file",
"(",
"self",
".",
"inventory_folder",
")",
"return",
"self",
".",
"get_cfg",
"(",
"'lp'",
",",
"'inventory_path'",
",",
"default",
")"
] | https://github.com/CentOS-PaaS-SIG/linchpin/blob/a449385a4823a43e6f336de42b874ac7877d8b3e/linchpin/cli/context.py#L149-L154 | |
Diaoul/subliminal | e25589dbcc5b2455bf9f0b49cf2083bb0eae449f | subliminal/utils.py | python | hash_shooter | (video_path) | return ';'.join(filehash) | Compute a hash using Shooter's algorithm
:param string video_path: path of the video
:return: the hash
:rtype: string | Compute a hash using Shooter's algorithm | [
"Compute",
"a",
"hash",
"using",
"Shooter",
"s",
"algorithm"
] | def hash_shooter(video_path):
"""Compute a hash using Shooter's algorithm
:param string video_path: path of the video
:return: the hash
:rtype: string
"""
filesize = os.path.getsize(video_path)
readsize = 4096
if os.path.getsize(video_path) < readsize * 2:
return None
offse... | [
"def",
"hash_shooter",
"(",
"video_path",
")",
":",
"filesize",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"video_path",
")",
"readsize",
"=",
"4096",
"if",
"os",
".",
"path",
".",
"getsize",
"(",
"video_path",
")",
"<",
"readsize",
"*",
"2",
":",
... | https://github.com/Diaoul/subliminal/blob/e25589dbcc5b2455bf9f0b49cf2083bb0eae449f/subliminal/utils.py#L83-L101 | |
alejandroautalan/pygubu | 29a46966900fdb621bce9b615746719949e7c68e | pygubu/widgets/dialog.py | python | Dialog.set_title | (self, title) | Sets the dialog title | Sets the dialog title | [
"Sets",
"the",
"dialog",
"title"
] | def set_title(self, title):
"""Sets the dialog title"""
if self.toplevel:
self.toplevel.title(title) | [
"def",
"set_title",
"(",
"self",
",",
"title",
")",
":",
"if",
"self",
".",
"toplevel",
":",
"self",
".",
"toplevel",
".",
"title",
"(",
"title",
")"
] | https://github.com/alejandroautalan/pygubu/blob/29a46966900fdb621bce9b615746719949e7c68e/pygubu/widgets/dialog.py#L98-L101 | ||
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/pbc/scf/hf.py | python | get_t | (cell, kpt=np.zeros(3)) | return cell.pbc_intor('int1e_kin', hermi=1, kpts=kpt) | Get the kinetic energy AO matrix. | Get the kinetic energy AO matrix. | [
"Get",
"the",
"kinetic",
"energy",
"AO",
"matrix",
"."
] | def get_t(cell, kpt=np.zeros(3)):
'''Get the kinetic energy AO matrix.
'''
return cell.pbc_intor('int1e_kin', hermi=1, kpts=kpt) | [
"def",
"get_t",
"(",
"cell",
",",
"kpt",
"=",
"np",
".",
"zeros",
"(",
"3",
")",
")",
":",
"return",
"cell",
".",
"pbc_intor",
"(",
"'int1e_kin'",
",",
"hermi",
"=",
"1",
",",
"kpts",
"=",
"kpt",
")"
] | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/pbc/scf/hf.py#L88-L91 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/_pyio.py | python | BufferedRandom.readinto | (self, b) | return BufferedReader.readinto(self, b) | [] | def readinto(self, b):
self.flush()
return BufferedReader.readinto(self, b) | [
"def",
"readinto",
"(",
"self",
",",
"b",
")",
":",
"self",
".",
"flush",
"(",
")",
"return",
"BufferedReader",
".",
"readinto",
"(",
"self",
",",
"b",
")"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/_pyio.py#L1446-L1448 | |||
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/src/oscar/OscarBuddies.py | python | OscarBuddy.guess_client | (self) | Guess a buddy's client based on capabilities. | Guess a buddy's client based on capabilities. | [
"Guess",
"a",
"buddy",
"s",
"client",
"based",
"on",
"capabilities",
"."
] | def guess_client(self):
'''
Guess a buddy's client based on capabilities.
'''
# Hopefully this combination will seperate the official ICQ clients
# from others
caps = set(self.pretty_caps)
might_be_icq = False
if caps.issuperset(icq6_caps):
m... | [
"def",
"guess_client",
"(",
"self",
")",
":",
"# Hopefully this combination will seperate the official ICQ clients",
"# from others",
"caps",
"=",
"set",
"(",
"self",
".",
"pretty_caps",
")",
"might_be_icq",
"=",
"False",
"if",
"caps",
".",
"issuperset",
"(",
"icq6_ca... | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/oscar/OscarBuddies.py#L639-L684 | ||
wmliang/pe-afl | 4036d2f41da20ff12ecac43a076de5d60ce68bd9 | lighthouse/lighthouse/util/disassembler/api.py | python | DisassemblerAPI.warning | (self, text) | Display a warning dialog box with the given text. | Display a warning dialog box with the given text. | [
"Display",
"a",
"warning",
"dialog",
"box",
"with",
"the",
"given",
"text",
"."
] | def warning(self, text):
"""
Display a warning dialog box with the given text.
"""
pass | [
"def",
"warning",
"(",
"self",
",",
"text",
")",
":",
"pass"
] | https://github.com/wmliang/pe-afl/blob/4036d2f41da20ff12ecac43a076de5d60ce68bd9/lighthouse/lighthouse/util/disassembler/api.py#L191-L195 | ||
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/http/proxyagent.py | python | http_proxy_endpoint | (
proxy: Optional[bytes],
reactor: IReactorCore,
tls_options_factory: Optional[IPolicyForHTTPS],
**kwargs,
) | return proxy_endpoint, credentials | Parses an http proxy setting and returns an endpoint for the proxy
Args:
proxy: the proxy setting in the form: [scheme://][<username>:<password>@]<host>[:<port>]
This currently supports http:// and https:// proxies.
A hostname without scheme is assumed to be http.
reactor: ... | Parses an http proxy setting and returns an endpoint for the proxy | [
"Parses",
"an",
"http",
"proxy",
"setting",
"and",
"returns",
"an",
"endpoint",
"for",
"the",
"proxy"
] | def http_proxy_endpoint(
proxy: Optional[bytes],
reactor: IReactorCore,
tls_options_factory: Optional[IPolicyForHTTPS],
**kwargs,
) -> Tuple[Optional[IStreamClientEndpoint], Optional[ProxyCredentials]]:
"""Parses an http proxy setting and returns an endpoint for the proxy
Args:
proxy: t... | [
"def",
"http_proxy_endpoint",
"(",
"proxy",
":",
"Optional",
"[",
"bytes",
"]",
",",
"reactor",
":",
"IReactorCore",
",",
"tls_options_factory",
":",
"Optional",
"[",
"IPolicyForHTTPS",
"]",
",",
"*",
"*",
"kwargs",
",",
")",
"->",
"Tuple",
"[",
"Optional",
... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/http/proxyagent.py#L244-L290 | |
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/html5lib/trie/py.py | python | Trie.__iter__ | (self) | return iter(self._data) | [] | def __iter__(self):
return iter(self._data) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"_data",
")"
] | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/html5lib/trie/py.py#L25-L26 | |||
tanghaibao/goatools | 647e9dd833695f688cd16c2f9ea18f1692e5c6bc | goatools/cli/gosubdag_plot.py | python | PlotCli._get_relationships | (kws_all, relationship_in_godag) | Return value for GoSubDag arg, relationships. | Return value for GoSubDag arg, relationships. | [
"Return",
"value",
"for",
"GoSubDag",
"arg",
"relationships",
"."
] | def _get_relationships(kws_all, relationship_in_godag):
"""Return value for GoSubDag arg, relationships."""
if not relationship_in_godag:
return None
if 'relationship' in kws_all:
return RELATIONSHIP_SET
if 'relationships' not in kws_all:
return None
... | [
"def",
"_get_relationships",
"(",
"kws_all",
",",
"relationship_in_godag",
")",
":",
"if",
"not",
"relationship_in_godag",
":",
"return",
"None",
"if",
"'relationship'",
"in",
"kws_all",
":",
"return",
"RELATIONSHIP_SET",
"if",
"'relationships'",
"not",
"in",
"kws_a... | https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/cli/gosubdag_plot.py#L336-L350 | ||
brython-dev/brython | 9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3 | www/src/Lib/ntpath.py | python | relpath | (path, start=None) | Return a relative version of a path | Return a relative version of a path | [
"Return",
"a",
"relative",
"version",
"of",
"a",
"path"
] | def relpath(path, start=None):
"""Return a relative version of a path"""
path = os.fspath(path)
if isinstance(path, bytes):
sep = b'\\'
curdir = b'.'
pardir = b'..'
else:
sep = '\\'
curdir = '.'
pardir = '..'
if start is None:
start = curdir
... | [
"def",
"relpath",
"(",
"path",
",",
"start",
"=",
"None",
")",
":",
"path",
"=",
"os",
".",
"fspath",
"(",
"path",
")",
"if",
"isinstance",
"(",
"path",
",",
"bytes",
")",
":",
"sep",
"=",
"b'\\\\'",
"curdir",
"=",
"b'.'",
"pardir",
"=",
"b'..'",
... | https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/ntpath.py#L693-L736 | ||
microsoft/ptvsd | 99c8513921021d2cc7cd82e132b65c644c256768 | src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/crash.py | python | Crash.getNotes | (self) | return self.notes | Get the list of notes of this crash event.
@rtype: list( str )
@return: List of notes. | Get the list of notes of this crash event. | [
"Get",
"the",
"list",
"of",
"notes",
"of",
"this",
"crash",
"event",
"."
] | def getNotes(self):
"""
Get the list of notes of this crash event.
@rtype: list( str )
@return: List of notes.
"""
return self.notes | [
"def",
"getNotes",
"(",
"self",
")",
":",
"return",
"self",
".",
"notes"
] | https://github.com/microsoft/ptvsd/blob/99c8513921021d2cc7cd82e132b65c644c256768/src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/crash.py#L1099-L1106 | |
Anaconda-Platform/anaconda-project | df5ec33c12591e6512436d38d36c6132fa2e9618 | anaconda_project/internal/conda_api.py | python | _contains_conda_meta | (path) | return os.path.isdir(conda_meta) | [] | def _contains_conda_meta(path):
conda_meta = os.path.join(path, "conda-meta")
return os.path.isdir(conda_meta) | [
"def",
"_contains_conda_meta",
"(",
"path",
")",
":",
"conda_meta",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"\"conda-meta\"",
")",
"return",
"os",
".",
"path",
".",
"isdir",
"(",
"conda_meta",
")"
] | https://github.com/Anaconda-Platform/anaconda-project/blob/df5ec33c12591e6512436d38d36c6132fa2e9618/anaconda_project/internal/conda_api.py#L408-L410 | |||
ideoforms/pylive | 87a4f2a384668b6f3e9475a6bc3c3d63b4734f5b | live/set.py | python | Set.get_track_names | (self, offset=None, count=None) | Return all track names. If offset and count are given, return names
within this range. | Return all track names. If offset and count are given, return names
within this range. | [
"Return",
"all",
"track",
"names",
".",
"If",
"offset",
"and",
"count",
"are",
"given",
"return",
"names",
"within",
"this",
"range",
"."
] | def get_track_names(self, offset=None, count=None):
""" Return all track names. If offset and count are given, return names
within this range. """
if count is None:
rv = self.live.query("/live/name/track")
rv = [ rv[a] for a in range(1, len(rv), 2) ]
return rv... | [
"def",
"get_track_names",
"(",
"self",
",",
"offset",
"=",
"None",
",",
"count",
"=",
"None",
")",
":",
"if",
"count",
"is",
"None",
":",
"rv",
"=",
"self",
".",
"live",
".",
"query",
"(",
"\"/live/name/track\"",
")",
"rv",
"=",
"[",
"rv",
"[",
"a"... | https://github.com/ideoforms/pylive/blob/87a4f2a384668b6f3e9475a6bc3c3d63b4734f5b/live/set.py#L375-L385 | ||
emposha/Shell-Detector | 5ac8ab2bf514bea737ddff16a75d85d887478f85 | shelldetect.py | python | ShellDetector.fingerprint | (self, _filename, _content) | [] | def fingerprint(self, _filename, _content):
for _regex, shellname in self._get_precomputed_fingerprints():
_match = _regex.findall(base64.b64encode(_content))
if _match:
self._badfiles.append([_filename])
_regex_shell = re.compile('^(.+?)\[(.+?)\]\[(.+?)\]... | [
"def",
"fingerprint",
"(",
"self",
",",
"_filename",
",",
"_content",
")",
":",
"for",
"_regex",
",",
"shellname",
"in",
"self",
".",
"_get_precomputed_fingerprints",
"(",
")",
":",
"_match",
"=",
"_regex",
".",
"findall",
"(",
"base64",
".",
"b64encode",
... | https://github.com/emposha/Shell-Detector/blob/5ac8ab2bf514bea737ddff16a75d85d887478f85/shelldetect.py#L195-L208 | ||||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/parallel/map_reduce.py | python | RESetMapReduce._get_stats | (self) | r"""
Gather the communication statistics at the end of a run.
EXAMPLES::
sage: from sage.parallel.map_reduce import RESetMPExample
sage: S = RESetMPExample(maxl=6)
sage: S.run() # indirect doctest
720*x^6 + 120*x^5 + 24*x^4 + 6*x^3 + 2*x^2 + x + 1 | r"""
Gather the communication statistics at the end of a run. | [
"r",
"Gather",
"the",
"communication",
"statistics",
"at",
"the",
"end",
"of",
"a",
"run",
"."
] | def _get_stats(self):
r"""
Gather the communication statistics at the end of a run.
EXAMPLES::
sage: from sage.parallel.map_reduce import RESetMPExample
sage: S = RESetMPExample(maxl=6)
sage: S.run() # indirect doctest
720*x^6 + 120*x^5 + 24*x^4... | [
"def",
"_get_stats",
"(",
"self",
")",
":",
"res",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"_nprocess",
")",
":",
"res",
".",
"append",
"(",
"tuple",
"(",
"self",
".",
"_workers",
"[",
"i",
"]",
".",
"_stats",
")",
")",
"sel... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/parallel/map_reduce.py#L1487-L1501 | ||
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/groups/groups_server.py | python | GroupsServerWorkerHandler.get_group_profile | (
self, group_id: str, requester_user_id: str
) | Get the group profile as seen by requester_user_id | Get the group profile as seen by requester_user_id | [
"Get",
"the",
"group",
"profile",
"as",
"seen",
"by",
"requester_user_id"
] | async def get_group_profile(
self, group_id: str, requester_user_id: str
) -> JsonDict:
"""Get the group profile as seen by requester_user_id"""
await self.check_group_is_ours(group_id, requester_user_id)
group = await self.store.get_group(group_id)
if group:
c... | [
"async",
"def",
"get_group_profile",
"(",
"self",
",",
"group_id",
":",
"str",
",",
"requester_user_id",
":",
"str",
")",
"->",
"JsonDict",
":",
"await",
"self",
".",
"check_group_is_ours",
"(",
"group_id",
",",
"requester_user_id",
")",
"group",
"=",
"await",... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/groups/groups_server.py#L214-L236 | ||
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/hazardlib/source/base.py | python | ParametricSeismicSource.modify_set_msr | (self, new_msr) | Updates the MSR originally assigned to the source
:param new_msr:
An instance of the :class:`openquake.hazardlib.scalerel.BaseMSR` | Updates the MSR originally assigned to the source | [
"Updates",
"the",
"MSR",
"originally",
"assigned",
"to",
"the",
"source"
] | def modify_set_msr(self, new_msr):
"""
Updates the MSR originally assigned to the source
:param new_msr:
An instance of the :class:`openquake.hazardlib.scalerel.BaseMSR`
"""
self.magnitude_scaling_relationship = new_msr | [
"def",
"modify_set_msr",
"(",
"self",
",",
"new_msr",
")",
":",
"self",
".",
"magnitude_scaling_relationship",
"=",
"new_msr"
] | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hazardlib/source/base.py#L363-L370 | ||
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/email/headerregistry.py | python | HeaderRegistry.map_to_type | (self, name, cls) | Register cls as the specialized class for handling "name" headers. | Register cls as the specialized class for handling "name" headers. | [
"Register",
"cls",
"as",
"the",
"specialized",
"class",
"for",
"handling",
"name",
"headers",
"."
] | def map_to_type(self, name, cls):
"""Register cls as the specialized class for handling "name" headers.
"""
self.registry[name.lower()] = cls | [
"def",
"map_to_type",
"(",
"self",
",",
"name",
",",
"cls",
")",
":",
"self",
".",
"registry",
"[",
"name",
".",
"lower",
"(",
")",
"]",
"=",
"cls"
] | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/email/headerregistry.py#L569-L573 | ||
mstamy2/PyPDF2 | 18a2627adac13124d4122c8b92aaa863ccfb8c29 | PyPDF2/pdf.py | python | PdfFileWriter.removeText | (self, ignoreByteStringObject=False) | Removes images from this output.
:param bool ignoreByteStringObject: optional parameter
to ignore ByteString Objects. | Removes images from this output. | [
"Removes",
"images",
"from",
"this",
"output",
"."
] | def removeText(self, ignoreByteStringObject=False):
"""
Removes images from this output.
:param bool ignoreByteStringObject: optional parameter
to ignore ByteString Objects.
"""
pages = self.getObject(self._pages)['/Kids']
for j in range(len(pages)):
... | [
"def",
"removeText",
"(",
"self",
",",
"ignoreByteStringObject",
"=",
"False",
")",
":",
"pages",
"=",
"self",
".",
"getObject",
"(",
"self",
".",
"_pages",
")",
"[",
"'/Kids'",
"]",
"for",
"j",
"in",
"range",
"(",
"len",
"(",
"pages",
")",
")",
":",... | https://github.com/mstamy2/PyPDF2/blob/18a2627adac13124d4122c8b92aaa863ccfb8c29/PyPDF2/pdf.py#L845-L897 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/tkinter/__init__.py | python | Text.edit_redo | (self) | return self.edit("redo") | Redo the last undone edit
When the undo option is true, reapplies the last
undone edits provided no other edits were done since
then. Generates an error when the redo stack is empty.
Does nothing when the undo option is false. | Redo the last undone edit | [
"Redo",
"the",
"last",
"undone",
"edit"
] | def edit_redo(self):
"""Redo the last undone edit
When the undo option is true, reapplies the last
undone edits provided no other edits were done since
then. Generates an error when the redo stack is empty.
Does nothing when the undo option is false.
"""
return s... | [
"def",
"edit_redo",
"(",
"self",
")",
":",
"return",
"self",
".",
"edit",
"(",
"\"redo\"",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/tkinter/__init__.py#L3211-L3219 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/hubert/modeling_hubert.py | python | HubertEncoderLayer.forward | (self, hidden_states, attention_mask=None, output_attentions=False) | return outputs | [] | def forward(self, hidden_states, attention_mask=None, output_attentions=False):
attn_residual = hidden_states
hidden_states, attn_weights, _ = self.attention(
hidden_states, attention_mask=attention_mask, output_attentions=output_attentions
)
hidden_states = self.dropout(hidd... | [
"def",
"forward",
"(",
"self",
",",
"hidden_states",
",",
"attention_mask",
"=",
"None",
",",
"output_attentions",
"=",
"False",
")",
":",
"attn_residual",
"=",
"hidden_states",
"hidden_states",
",",
"attn_weights",
",",
"_",
"=",
"self",
".",
"attention",
"("... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/hubert/modeling_hubert.py#L554-L571 | |||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/_backport/sysconfig.py | python | parse_config_h | (fp, vars=None) | return vars | Parse a config.h-style file.
A dictionary containing name/value pairs is returned. If an
optional dictionary is passed in as the second argument, it is
used instead of a new dictionary. | Parse a config.h-style file. | [
"Parse",
"a",
"config",
".",
"h",
"-",
"style",
"file",
"."
] | def parse_config_h(fp, vars=None):
"""Parse a config.h-style file.
A dictionary containing name/value pairs is returned. If an
optional dictionary is passed in as the second argument, it is
used instead of a new dictionary.
"""
if vars is None:
vars = {}
define_rx = re.compile("#de... | [
"def",
"parse_config_h",
"(",
"fp",
",",
"vars",
"=",
"None",
")",
":",
"if",
"vars",
"is",
"None",
":",
"vars",
"=",
"{",
"}",
"define_rx",
"=",
"re",
".",
"compile",
"(",
"\"#define ([A-Z][A-Za-z0-9_]+) (.*)\\n\"",
")",
"undef_rx",
"=",
"re",
".",
"com... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/_backport/sysconfig.py#L388-L416 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | custom/inddex/reports/r2b_gaps_detail.py | python | GapsDetailsData.rows | (self) | [] | def rows(self):
for row in sorted(self._gaps_data, key=lambda row: (row['food_name'], row['gap_type'], row['gap_code'])):
yield format_row([row[header] for header in self.headers]) | [
"def",
"rows",
"(",
"self",
")",
":",
"for",
"row",
"in",
"sorted",
"(",
"self",
".",
"_gaps_data",
",",
"key",
"=",
"lambda",
"row",
":",
"(",
"row",
"[",
"'food_name'",
"]",
",",
"row",
"[",
"'gap_type'",
"]",
",",
"row",
"[",
"'gap_code'",
"]",
... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/custom/inddex/reports/r2b_gaps_detail.py#L135-L137 | ||||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/posixpath.py | python | expanduser | (path) | return (userhome + path[i:]) or root | Expand ~ and ~user constructions. If user or $HOME is unknown,
do nothing. | Expand ~ and ~user constructions. If user or $HOME is unknown,
do nothing. | [
"Expand",
"~",
"and",
"~user",
"constructions",
".",
"If",
"user",
"or",
"$HOME",
"is",
"unknown",
"do",
"nothing",
"."
] | def expanduser(path):
"""Expand ~ and ~user constructions. If user or $HOME is unknown,
do nothing."""
path = os.fspath(path)
if isinstance(path, bytes):
tilde = b'~'
else:
tilde = '~'
if not path.startswith(tilde):
return path
sep = _get_sep(path)
i = path.find(... | [
"def",
"expanduser",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"fspath",
"(",
"path",
")",
"if",
"isinstance",
"(",
"path",
",",
"bytes",
")",
":",
"tilde",
"=",
"b'~'",
"else",
":",
"tilde",
"=",
"'~'",
"if",
"not",
"path",
".",
"startswith",... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/posixpath.py#L232-L275 | |
anson0910/CNN_face_detection | 62cf7ea5a737b758095a9b7e7a07760cb4f306df | face_net_surgery/list_full_conv_blobs_ranges.py | python | cal_face_12c | (net_12_cal, caffe_img, rectangles) | return result | :param caffe_image: image in caffe style to detect faces
:param rectangles: rectangles in form [x11, y11, x12, y12, confidence, current_scale]
:return: rectangles after calibration | :param caffe_image: image in caffe style to detect faces
:param rectangles: rectangles in form [x11, y11, x12, y12, confidence, current_scale]
:return: rectangles after calibration | [
":",
"param",
"caffe_image",
":",
"image",
"in",
"caffe",
"style",
"to",
"detect",
"faces",
":",
"param",
"rectangles",
":",
"rectangles",
"in",
"form",
"[",
"x11",
"y11",
"x12",
"y12",
"confidence",
"current_scale",
"]",
":",
"return",
":",
"rectangles",
... | def cal_face_12c(net_12_cal, caffe_img, rectangles):
'''
:param caffe_image: image in caffe style to detect faces
:param rectangles: rectangles in form [x11, y11, x12, y12, confidence, current_scale]
:return: rectangles after calibration
'''
height, width, channels = caffe_img.shape
resu... | [
"def",
"cal_face_12c",
"(",
"net_12_cal",
",",
"caffe_img",
",",
"rectangles",
")",
":",
"height",
",",
"width",
",",
"channels",
"=",
"caffe_img",
".",
"shape",
"result",
"=",
"[",
"]",
"all_cropped_caffe_img",
"=",
"[",
"]",
"for",
"cur_rectangle",
"in",
... | https://github.com/anson0910/CNN_face_detection/blob/62cf7ea5a737b758095a9b7e7a07760cb4f306df/face_net_surgery/list_full_conv_blobs_ranges.py#L262-L381 | |
markmckinnon/Autopsy-Plugins | 99f8a485bda437eb0508f35fcf843c303bd367c4 | Executable Programs For Plugins/export_jl_ad.exe/JL_App_Ids.py | python | JL_App_Ids.__init__ | (self) | Initializes the database file object. | Initializes the database file object. | [
"Initializes",
"the",
"database",
"file",
"object",
"."
] | def __init__(self):
"""Initializes the database file object."""
super(JL_App_Ids, self).__init__()
self._connection = None
self._cursor = None
self.filename = 'Jump_List_App_Ids.db3'
self.read_only = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"JL_App_Ids",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_connection",
"=",
"None",
"self",
".",
"_cursor",
"=",
"None",
"self",
".",
"filename",
"=",
"'Jump_List_App_Ids.db3'",
"sel... | https://github.com/markmckinnon/Autopsy-Plugins/blob/99f8a485bda437eb0508f35fcf843c303bd367c4/Executable Programs For Plugins/export_jl_ad.exe/JL_App_Ids.py#L8-L14 | ||
pyansys/pymapdl | c07291fc062b359abf0e92b95a92d753a95ef3d7 | ansys/mapdl/core/_commands/post1_/path_operations.py | python | PathOperations.paresu | (self, lab="", fname="", ext="", **kwargs) | return self.run(command, **kwargs) | Restores previously saved paths from a file.
APDL Command: PARESU
Parameters
----------
lab
Read operation:
S - Saves only selected paths.
ALL - Read all paths from the selected file (default).
Pname - Saves the named path (from the PS... | Restores previously saved paths from a file. | [
"Restores",
"previously",
"saved",
"paths",
"from",
"a",
"file",
"."
] | def paresu(self, lab="", fname="", ext="", **kwargs):
"""Restores previously saved paths from a file.
APDL Command: PARESU
Parameters
----------
lab
Read operation:
S - Saves only selected paths.
ALL - Read all paths from the selected file ... | [
"def",
"paresu",
"(",
"self",
",",
"lab",
"=",
"\"\"",
",",
"fname",
"=",
"\"\"",
",",
"ext",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"command",
"=",
"f\"PARESU,{lab},{fname},{ext}\"",
"return",
"self",
".",
"run",
"(",
"command",
",",
"*",
"... | https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/post1_/path_operations.py#L94-L131 | |
ProgVal/Limnoria | 181e34baf90a8cabc281e8349da6e36e1e558608 | plugins/Channel/plugin.py | python | Channel.op | (self, irc, msg, args, channel, nicks) | [<channel>] [<nick> ...]
If you have the #channel,op capability, this will give all the <nick>s
you provide ops. If you don't provide any <nick>s, this will op you.
<channel> is only necessary if the message isn't sent in the channel
itself. | [<channel>] [<nick> ...] | [
"[",
"<channel",
">",
"]",
"[",
"<nick",
">",
"...",
"]"
] | def op(self, irc, msg, args, channel, nicks):
"""[<channel>] [<nick> ...]
If you have the #channel,op capability, this will give all the <nick>s
you provide ops. If you don't provide any <nick>s, this will op you.
<channel> is only necessary if the message isn't sent in the channel
... | [
"def",
"op",
"(",
"self",
",",
"irc",
",",
"msg",
",",
"args",
",",
"channel",
",",
"nicks",
")",
":",
"if",
"not",
"nicks",
":",
"nicks",
"=",
"[",
"msg",
".",
"nick",
"]",
"def",
"f",
"(",
"L",
")",
":",
"return",
"ircmsgs",
".",
"ops",
"("... | https://github.com/ProgVal/Limnoria/blob/181e34baf90a8cabc281e8349da6e36e1e558608/plugins/Channel/plugin.py#L159-L171 | ||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/asyncio/sslproto.py | python | _SSLProtocolTransport.pause_reading | (self) | Pause the receiving end.
No data will be passed to the protocol's data_received()
method until resume_reading() is called. | Pause the receiving end. | [
"Pause",
"the",
"receiving",
"end",
"."
] | def pause_reading(self):
"""Pause the receiving end.
No data will be passed to the protocol's data_received()
method until resume_reading() is called.
"""
self._ssl_protocol._transport.pause_reading() | [
"def",
"pause_reading",
"(",
"self",
")",
":",
"self",
".",
"_ssl_protocol",
".",
"_transport",
".",
"pause_reading",
"(",
")"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/asyncio/sslproto.py#L331-L337 | ||
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/docutils/nodes.py | python | Element.update_basic_atts | (self, dict_) | Update basic attributes ('ids', 'names', 'classes',
'dupnames', but not 'source') from node or dictionary `dict_`. | Update basic attributes ('ids', 'names', 'classes',
'dupnames', but not 'source') from node or dictionary `dict_`. | [
"Update",
"basic",
"attributes",
"(",
"ids",
"names",
"classes",
"dupnames",
"but",
"not",
"source",
")",
"from",
"node",
"or",
"dictionary",
"dict_",
"."
] | def update_basic_atts(self, dict_):
"""
Update basic attributes ('ids', 'names', 'classes',
'dupnames', but not 'source') from node or dictionary `dict_`.
"""
if isinstance(dict_, Node):
dict_ = dict_.attributes
for att in self.basic_attributes:
se... | [
"def",
"update_basic_atts",
"(",
"self",
",",
"dict_",
")",
":",
"if",
"isinstance",
"(",
"dict_",
",",
"Node",
")",
":",
"dict_",
"=",
"dict_",
".",
"attributes",
"for",
"att",
"in",
"self",
".",
"basic_attributes",
":",
"self",
".",
"append_attr_list",
... | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/nodes.py#L697-L705 | ||
Theano/Theano | 8fd9203edfeecebced9344b0c70193be292a9ade | theano/gof/unify.py | python | unify_walk | (fv, v, U) | return U.merge(v, fv) | Both variables are unified. | Both variables are unified. | [
"Both",
"variables",
"are",
"unified",
"."
] | def unify_walk(fv, v, U):
"""
Both variables are unified.
"""
v = U[v]
return U.merge(v, fv) | [
"def",
"unify_walk",
"(",
"fv",
",",
"v",
",",
"U",
")",
":",
"v",
"=",
"U",
"[",
"v",
"]",
"return",
"U",
".",
"merge",
"(",
"v",
",",
"fv",
")"
] | https://github.com/Theano/Theano/blob/8fd9203edfeecebced9344b0c70193be292a9ade/theano/gof/unify.py#L278-L284 | |
aliles/begins | 23bc0d802198831375f4286a7e22377a1a1bf952 | docs/examples/multiple_subcommands.py | python | quest | (answer) | What is your quest? | What is your quest? | [
"What",
"is",
"your",
"quest?"
] | def quest(answer):
"What is your quest?"
print(answer) | [
"def",
"quest",
"(",
"answer",
")",
":",
"print",
"(",
"answer",
")"
] | https://github.com/aliles/begins/blob/23bc0d802198831375f4286a7e22377a1a1bf952/docs/examples/multiple_subcommands.py#L10-L12 | ||
djblets/djblets | 0496e1ec49e43d43d776768c9fc5b6f8af56ec2c | djblets/extensions/settings.py | python | ExtensionSettings.set | (self, key, value) | Set a setting's value.
This is equivalent to setting the value through standard dictionary
attribute storage.
Args:
key (unicode):
The key to set.
value (object):
The value for the setting. | Set a setting's value. | [
"Set",
"a",
"setting",
"s",
"value",
"."
] | def set(self, key, value):
"""Set a setting's value.
This is equivalent to setting the value through standard dictionary
attribute storage.
Args:
key (unicode):
The key to set.
value (object):
The value for the setting.
"... | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
"[",
"key",
"]",
"=",
"value"
] | https://github.com/djblets/djblets/blob/0496e1ec49e43d43d776768c9fc5b6f8af56ec2c/djblets/extensions/settings.py#L136-L149 | ||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/redis/client.py | python | Redis.hlen | (self, name) | return self.execute_command('HLEN', name) | Return the number of elements in hash ``name`` | Return the number of elements in hash ``name`` | [
"Return",
"the",
"number",
"of",
"elements",
"in",
"hash",
"name"
] | def hlen(self, name):
"Return the number of elements in hash ``name``"
return self.execute_command('HLEN', name) | [
"def",
"hlen",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"'HLEN'",
",",
"name",
")"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/redis/client.py#L2733-L2735 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/ext/mapreduce/model.py | python | CountersMap.to_json | (self) | return {"counters": self.counters} | Serializes all the data in this map into json form.
Returns:
json-compatible data representation. | Serializes all the data in this map into json form. | [
"Serializes",
"all",
"the",
"data",
"in",
"this",
"map",
"into",
"json",
"form",
"."
] | def to_json(self):
"""Serializes all the data in this map into json form.
Returns:
json-compatible data representation.
"""
return {"counters": self.counters} | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"\"counters\"",
":",
"self",
".",
"counters",
"}"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/mapreduce/model.py#L328-L334 | |
marl/jams | edea1c4e4d5751cb10ca4379802fd898dc025d01 | jams/core.py | python | Annotation.to_html | (self, max_rows=None) | return out | Render this annotation list in HTML
Returns
-------
rendered : str
An HTML table containing this annotation's data. | Render this annotation list in HTML | [
"Render",
"this",
"annotation",
"list",
"in",
"HTML"
] | def to_html(self, max_rows=None):
'''Render this annotation list in HTML
Returns
-------
rendered : str
An HTML table containing this annotation's data.
'''
n = len(self.data)
div_id = _get_divid(self)
out = r''' <div class="panel panel-def... | [
"def",
"to_html",
"(",
"self",
",",
"max_rows",
"=",
"None",
")",
":",
"n",
"=",
"len",
"(",
"self",
".",
"data",
")",
"div_id",
"=",
"_get_divid",
"(",
"self",
")",
"out",
"=",
"r''' <div class=\"panel panel-default\">\n <div class=\"panel... | https://github.com/marl/jams/blob/edea1c4e4d5751cb10ca4379802fd898dc025d01/jams/core.py#L1168-L1238 | |
pwndbg/pwndbg | 136b3b6a80d94f494dcb00a614af1c24ca706700 | pwndbg/arguments.py | python | argument | (n, abi=None) | return int(pwndbg.memory.poi(pwndbg.typeinfo.ppvoid, sp)) | Returns the nth argument, as if $pc were a 'call' or 'bl' type
instruction.
Works only for ABIs that use registers for arguments. | Returns the nth argument, as if $pc were a 'call' or 'bl' type
instruction.
Works only for ABIs that use registers for arguments. | [
"Returns",
"the",
"nth",
"argument",
"as",
"if",
"$pc",
"were",
"a",
"call",
"or",
"bl",
"type",
"instruction",
".",
"Works",
"only",
"for",
"ABIs",
"that",
"use",
"registers",
"for",
"arguments",
"."
] | def argument(n, abi=None):
"""
Returns the nth argument, as if $pc were a 'call' or 'bl' type
instruction.
Works only for ABIs that use registers for arguments.
"""
abi = abi or pwndbg.abi.ABI.default()
regs = abi.register_arguments
if n < len(regs):
return getattr(pwndbg.regs,... | [
"def",
"argument",
"(",
"n",
",",
"abi",
"=",
"None",
")",
":",
"abi",
"=",
"abi",
"or",
"pwndbg",
".",
"abi",
".",
"ABI",
".",
"default",
"(",
")",
"regs",
"=",
"abi",
".",
"register_arguments",
"if",
"n",
"<",
"len",
"(",
"regs",
")",
":",
"r... | https://github.com/pwndbg/pwndbg/blob/136b3b6a80d94f494dcb00a614af1c24ca706700/pwndbg/arguments.py#L168-L184 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/aws/notify.py | python | AWSSNS.async_send_message | (self, message="", **kwargs) | Send notification to specified SNS ARN. | Send notification to specified SNS ARN. | [
"Send",
"notification",
"to",
"specified",
"SNS",
"ARN",
"."
] | async def async_send_message(self, message="", **kwargs):
"""Send notification to specified SNS ARN."""
if not kwargs.get(ATTR_TARGET):
_LOGGER.error("At least one target is required")
return
message_attributes = {
k: {"StringValue": json.dumps(v), "DataType"... | [
"async",
"def",
"async_send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET",
")",
":",
"_LOGGER",
".",
"error",
"(",
"\"At least one target is required\"",
")",
"r... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/aws/notify.py#L163-L191 | ||
spulec/moto | a688c0032596a7dfef122b69a08f2bec3be2e481 | moto/elbv2/models.py | python | FakeLoadBalancer.delete | (self, region) | Not exposed as part of the ELB API - used for CloudFormation. | Not exposed as part of the ELB API - used for CloudFormation. | [
"Not",
"exposed",
"as",
"part",
"of",
"the",
"ELB",
"API",
"-",
"used",
"for",
"CloudFormation",
"."
] | def delete(self, region):
"""Not exposed as part of the ELB API - used for CloudFormation."""
elbv2_backends[region].delete_load_balancer(self.arn) | [
"def",
"delete",
"(",
"self",
",",
"region",
")",
":",
"elbv2_backends",
"[",
"region",
"]",
".",
"delete_load_balancer",
"(",
"self",
".",
"arn",
")"
] | https://github.com/spulec/moto/blob/a688c0032596a7dfef122b69a08f2bec3be2e481/moto/elbv2/models.py#L487-L489 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/keyword_plan_ad_group_keyword_service/client.py | python | KeywordPlanAdGroupKeywordServiceClient.keyword_plan_ad_group_keyword_path | (
customer_id: str, keyword_plan_ad_group_keyword_id: str,
) | return "customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}".format(
customer_id=customer_id,
keyword_plan_ad_group_keyword_id=keyword_plan_ad_group_keyword_id,
) | Return a fully-qualified keyword_plan_ad_group_keyword string. | Return a fully-qualified keyword_plan_ad_group_keyword string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"keyword_plan_ad_group_keyword",
"string",
"."
] | def keyword_plan_ad_group_keyword_path(
customer_id: str, keyword_plan_ad_group_keyword_id: str,
) -> str:
"""Return a fully-qualified keyword_plan_ad_group_keyword string."""
return "customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}".format(
c... | [
"def",
"keyword_plan_ad_group_keyword_path",
"(",
"customer_id",
":",
"str",
",",
"keyword_plan_ad_group_keyword_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}\"",
".",
"format",
"(... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/keyword_plan_ad_group_keyword_service/client.py#L195-L202 | |
metabrainz/picard | 535bf8c7d9363ffc7abb3f69418ec11823c38118 | picard/pluginmanager.py | python | PluginManager._install_plugin_file | (self, path, update=False) | [] | def _install_plugin_file(self, path, update=False):
dst = os.path.join(self.plugins_directory, os.path.basename(path))
if update:
dst += _UPDATE_SUFFIX
if os.path.isfile(dst):
os.remove(dst)
shutil.copy2(path, dst)
log.debug("Plugin (file) saved to... | [
"def",
"_install_plugin_file",
"(",
"self",
",",
"path",
",",
"update",
"=",
"False",
")",
":",
"dst",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"plugins_directory",
",",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")",
"if",
... | https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/pluginmanager.py#L360-L367 | ||||
somewacko/deconvfaces | 9e9620c52cb1de37e6ae3f52387791ee21dbda67 | faces/generate.py | python | GenParser.pose_vector | (self, value, params) | return self.constrain(vec, params['constrained'], params['ps_scale'],
params['ps_min'], params['ps_max']) | Create an pose vector for a provided value. | Create an pose vector for a provided value. | [
"Create",
"an",
"pose",
"vector",
"for",
"a",
"provided",
"value",
"."
] | def pose_vector(self, value, params):
""" Create an pose vector for a provided value. """
if isinstance(value, str):
if '+' not in value:
raise RuntimeError("Pose '{}' not understood".format(value))
try:
values = [int(x) for x in value.split('+')... | [
"def",
"pose_vector",
"(",
"self",
",",
"value",
",",
"params",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"if",
"'+'",
"not",
"in",
"value",
":",
"raise",
"RuntimeError",
"(",
"\"Pose '{}' not understood\"",
".",
"format",
"(",
"v... | https://github.com/somewacko/deconvfaces/blob/9e9620c52cb1de37e6ae3f52387791ee21dbda67/faces/generate.py#L416-L439 | |
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/python27/1.0/lib/noarch/sortedcontainers/sortedset.py | python | SortedSet.symmetric_difference | (self, that) | return new_set | Return a new set with elements in either *self* or *that* but not both. | Return a new set with elements in either *self* or *that* but not both. | [
"Return",
"a",
"new",
"set",
"with",
"elements",
"in",
"either",
"*",
"self",
"*",
"or",
"*",
"that",
"*",
"but",
"not",
"both",
"."
] | def symmetric_difference(self, that):
"""
Return a new set with elements in either *self* or *that* but not both.
"""
diff = self._set.symmetric_difference(that)
new_set = self.__class__(key=self._key, load=self._load, _set=diff)
return new_set | [
"def",
"symmetric_difference",
"(",
"self",
",",
"that",
")",
":",
"diff",
"=",
"self",
".",
"_set",
".",
"symmetric_difference",
"(",
"that",
")",
"new_set",
"=",
"self",
".",
"__class__",
"(",
"key",
"=",
"self",
".",
"_key",
",",
"load",
"=",
"self"... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/noarch/sortedcontainers/sortedset.py#L230-L236 | |
Kkevsterrr/backdoorme | f9755ca6cec600335e681752e7a1c5c617bb5a39 | backdoors/shell/__pupy/pupy/packages/windows/x86/psutil/_pssunos.py | python | net_connections | (kind, _pid=-1) | return list(ret) | Return socket connections. If pid == -1 return system-wide
connections (as opposed to connections opened by one process only).
Only INET sockets are returned (UNIX are not). | Return socket connections. If pid == -1 return system-wide
connections (as opposed to connections opened by one process only).
Only INET sockets are returned (UNIX are not). | [
"Return",
"socket",
"connections",
".",
"If",
"pid",
"==",
"-",
"1",
"return",
"system",
"-",
"wide",
"connections",
"(",
"as",
"opposed",
"to",
"connections",
"opened",
"by",
"one",
"process",
"only",
")",
".",
"Only",
"INET",
"sockets",
"are",
"returned"... | def net_connections(kind, _pid=-1):
"""Return socket connections. If pid == -1 return system-wide
connections (as opposed to connections opened by one process only).
Only INET sockets are returned (UNIX are not).
"""
cmap = _common.conn_tmap.copy()
if _pid == -1:
cmap.pop('unix', 0)
... | [
"def",
"net_connections",
"(",
"kind",
",",
"_pid",
"=",
"-",
"1",
")",
":",
"cmap",
"=",
"_common",
".",
"conn_tmap",
".",
"copy",
"(",
")",
"if",
"_pid",
"==",
"-",
"1",
":",
"cmap",
".",
"pop",
"(",
"'unix'",
",",
"0",
")",
"if",
"kind",
"no... | https://github.com/Kkevsterrr/backdoorme/blob/f9755ca6cec600335e681752e7a1c5c617bb5a39/backdoors/shell/__pupy/pupy/packages/windows/x86/psutil/_pssunos.py#L206-L234 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | examples/research_projects/longform-qa/eli5_utils.py | python | eval_qa_s2s_epoch | (model, dataset, tokenizer, args) | [] | def eval_qa_s2s_epoch(model, dataset, tokenizer, args):
model.eval()
# make iterator
train_sampler = SequentialSampler(dataset)
model_collate_fn = functools.partial(
make_qa_s2s_batch, tokenizer=tokenizer, max_len=args.max_length, device="cuda:0"
)
data_loader = DataLoader(dataset, batch... | [
"def",
"eval_qa_s2s_epoch",
"(",
"model",
",",
"dataset",
",",
"tokenizer",
",",
"args",
")",
":",
"model",
".",
"eval",
"(",
")",
"# make iterator",
"train_sampler",
"=",
"SequentialSampler",
"(",
"dataset",
")",
"model_collate_fn",
"=",
"functools",
".",
"pa... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/longform-qa/eli5_utils.py#L459-L492 | ||||
bsmali4/xssfork | 515b45dfb0edb9263da544ad91fc1cb5f410bfd1 | thirdparty/requests/cookies.py | python | RequestsCookieJar.__getstate__ | (self) | return state | Unlike a normal CookieJar, this class is pickleable. | Unlike a normal CookieJar, this class is pickleable. | [
"Unlike",
"a",
"normal",
"CookieJar",
"this",
"class",
"is",
"pickleable",
"."
] | def __getstate__(self):
"""Unlike a normal CookieJar, this class is pickleable."""
state = self.__dict__.copy()
# remove the unpickleable RLock object
state.pop('_cookies_lock')
return state | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"# remove the unpickleable RLock object",
"state",
".",
"pop",
"(",
"'_cookies_lock'",
")",
"return",
"state"
] | https://github.com/bsmali4/xssfork/blob/515b45dfb0edb9263da544ad91fc1cb5f410bfd1/thirdparty/requests/cookies.py#L333-L338 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | gui/lib/png.py | python | Writer.write_passes | (self, outfile, rows, packed=False) | return i+1 | Write a PNG image to the output file.
Most users are expected to find the :meth:`write` or
:meth:`write_array` method more convenient.
The rows should be given to this method in the order that
they appear in the output file. For straightlaced images,
this is the usual top to b... | Write a PNG image to the output file. | [
"Write",
"a",
"PNG",
"image",
"to",
"the",
"output",
"file",
"."
] | def write_passes(self, outfile, rows, packed=False):
"""
Write a PNG image to the output file.
Most users are expected to find the :meth:`write` or
:meth:`write_array` method more convenient.
The rows should be given to this method in the order that
they appear in the o... | [
"def",
"write_passes",
"(",
"self",
",",
"outfile",
",",
"rows",
",",
"packed",
"=",
"False",
")",
":",
"# http://www.w3.org/TR/PNG/#5PNG-file-signature",
"outfile",
".",
"write",
"(",
"_signature",
")",
"# http://www.w3.org/TR/PNG/#11IHDR",
"write_chunk",
"(",
"outfi... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/gui/lib/png.py#L626-L797 | |
log2timeline/plaso | fe2e316b8c76a0141760c0f2f181d84acb83abc2 | plaso/parsers/winfirewall.py | python | WinFirewallParser._ParseLogLine | (self, parser_mediator, structure) | Parse a single log line and produce an event object.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
structure (pyparsing.ParseResults): structure of tokens derived from
a line of a text file. | Parse a single log line and produce an event object. | [
"Parse",
"a",
"single",
"log",
"line",
"and",
"produce",
"an",
"event",
"object",
"."
] | def _ParseLogLine(self, parser_mediator, structure):
"""Parse a single log line and produce an event object.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
structure (pyparsing.ParseResults): structure of toke... | [
"def",
"_ParseLogLine",
"(",
"self",
",",
"parser_mediator",
",",
"structure",
")",
":",
"# Ensure time_elements_tuple is not a pyparsing.ParseResults otherwise",
"# copy.deepcopy() of the dfDateTime object will fail on Python 3.8 with:",
"# \"TypeError: 'str' object is not callable\" due to... | https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/parsers/winfirewall.py#L137-L191 | ||
ioflo/ioflo | 177ac656d7c4ff801aebb0d8b401db365a5248ce | ioflo/aio/uxd/uxding.py | python | SocketUxdNb.send | (self, data, da) | return result | Perform non blocking send on socket.
data is string in python2 and bytes in python3
da is destination address tuple (destHost, destPort) | Perform non blocking send on socket. | [
"Perform",
"non",
"blocking",
"send",
"on",
"socket",
"."
] | def send(self, data, da):
"""Perform non blocking send on socket.
data is string in python2 and bytes in python3
da is destination address tuple (destHost, destPort)
"""
try:
result = self.ss.sendto(data, da) #result is number of bytes sent
except sock... | [
"def",
"send",
"(",
"self",
",",
"data",
",",
"da",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"ss",
".",
"sendto",
"(",
"data",
",",
"da",
")",
"#result is number of bytes sent",
"except",
"socket",
".",
"error",
"as",
"ex",
":",
"emsg",
"=",... | https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/aio/uxd/uxding.py#L155-L181 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/billiard-3.5.0.5/billiard/managers.py | python | dispatch | (c, id, methodname, args=(), kwds={}) | Send a message to manager using connection `c` and return response | Send a message to manager using connection `c` and return response | [
"Send",
"a",
"message",
"to",
"manager",
"using",
"connection",
"c",
"and",
"return",
"response"
] | def dispatch(c, id, methodname, args=(), kwds={}):
'''
Send a message to manager using connection `c` and return response
'''
c.send((id, methodname, args, kwds))
kind, result = c.recv()
if kind == '#RETURN':
return result
raise convert_to_error(kind, result) | [
"def",
"dispatch",
"(",
"c",
",",
"id",
",",
"methodname",
",",
"args",
"=",
"(",
")",
",",
"kwds",
"=",
"{",
"}",
")",
":",
"c",
".",
"send",
"(",
"(",
"id",
",",
"methodname",
",",
"args",
",",
"kwds",
")",
")",
"kind",
",",
"result",
"=",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/billiard-3.5.0.5/billiard/managers.py#L87-L95 | ||
pascanur/GroundHog | 3691cbf2cd4e46aaae5d7a986b0ac172016ce729 | groundhog/layers/rec_layers.py | python | RecurrentMultiLayer.step_fprop | (self,
state_below,
mask=None,
dpmask=None,
state_before=None,
init_state=None,
use_noise=True,
no_noise_bias=False) | return rval | Constructs the computational graph of a single step of the recurrent
layer.
:type state_below: theano variable
:param state_below: the input to the layer
:type mask: None or theano variable
:param mask: mask describing the length of each sequence in a
minibatch
... | Constructs the computational graph of a single step of the recurrent
layer. | [
"Constructs",
"the",
"computational",
"graph",
"of",
"a",
"single",
"step",
"of",
"the",
"recurrent",
"layer",
"."
] | def step_fprop(self,
state_below,
mask=None,
dpmask=None,
state_before=None,
init_state=None,
use_noise=True,
no_noise_bias=False):
"""
Constructs the computational graph ... | [
"def",
"step_fprop",
"(",
"self",
",",
"state_below",
",",
"mask",
"=",
"None",
",",
"dpmask",
"=",
"None",
",",
"state_before",
"=",
"None",
",",
"init_state",
"=",
"None",
",",
"use_noise",
"=",
"True",
",",
"no_noise_bias",
"=",
"False",
")",
":",
"... | https://github.com/pascanur/GroundHog/blob/3691cbf2cd4e46aaae5d7a986b0ac172016ce729/groundhog/layers/rec_layers.py#L190-L270 | |
lisa-lab/pylearn2 | af81e5c362f0df4df85c3e54e23b2adeec026055 | pylearn2/datasets/csv_dataset.py | python | CSVDataset._load_data | (self) | return X, y | Loads the data from a CSV file (ending with a '.csv' filename).
Returns
-------
X : object
The features of the dataset.
y : object, optional
The target variable of the model. | Loads the data from a CSV file (ending with a '.csv' filename). | [
"Loads",
"the",
"data",
"from",
"a",
"CSV",
"file",
"(",
"ending",
"with",
"a",
".",
"csv",
"filename",
")",
"."
] | def _load_data(self):
"""
Loads the data from a CSV file (ending with a '.csv' filename).
Returns
-------
X : object
The features of the dataset.
y : object, optional
The target variable of the model... | [
"def",
"_load_data",
"(",
"self",
")",
":",
"assert",
"self",
".",
"path",
".",
"endswith",
"(",
"'.csv'",
")",
"if",
"self",
".",
"expect_headers",
":",
"data",
"=",
"np",
".",
"loadtxt",
"(",
"self",
".",
"path",
",",
"delimiter",
"=",
"self",
".",... | https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/datasets/csv_dataset.py#L131-L199 | |
pixelogik/NearPy | 1b534b864d320d875508e95cd2b76b6d8c07a90b | nearpy/storage/storage.py | python | Storage.get_all_bucket_keys | (self, hash_name) | Returns all bucket keys for the given hash as iterable of strings | Returns all bucket keys for the given hash as iterable of strings | [
"Returns",
"all",
"bucket",
"keys",
"for",
"the",
"given",
"hash",
"as",
"iterable",
"of",
"strings"
] | def get_all_bucket_keys(self, hash_name):
"""
Returns all bucket keys for the given hash as iterable of strings
"""
raise NotImplementedError | [
"def",
"get_all_bucket_keys",
"(",
"self",
",",
"hash_name",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/pixelogik/NearPy/blob/1b534b864d320d875508e95cd2b76b6d8c07a90b/nearpy/storage/storage.py#L40-L44 | ||
softlayer/softlayer-python | cdef7d63c66413197a9a97b0414de9f95887a82a | SoftLayer/managers/network.py | python | NetworkManager.get_cancel_failure_reasons | (self, identifier) | return self.vlan.getCancelFailureReasons(id=identifier) | get the reasons why we cannot cancel the VLAN.
:param integer identifier: the instance ID | get the reasons why we cannot cancel the VLAN. | [
"get",
"the",
"reasons",
"why",
"we",
"cannot",
"cancel",
"the",
"VLAN",
"."
] | def get_cancel_failure_reasons(self, identifier):
"""get the reasons why we cannot cancel the VLAN.
:param integer identifier: the instance ID
"""
return self.vlan.getCancelFailureReasons(id=identifier) | [
"def",
"get_cancel_failure_reasons",
"(",
"self",
",",
"identifier",
")",
":",
"return",
"self",
".",
"vlan",
".",
"getCancelFailureReasons",
"(",
"id",
"=",
"identifier",
")"
] | https://github.com/softlayer/softlayer-python/blob/cdef7d63c66413197a9a97b0414de9f95887a82a/SoftLayer/managers/network.py#L761-L766 | |
volatilityfoundation/volatility3 | 168b0d0b053ab97a7cb096ef2048795cc54d885f | volatility3/framework/plugins/timeliner.py | python | Timeliner.get_usable_plugins | (cls, selected_list: List[str] = None) | return [plugin_class for plugin_class in plugin_list if filter_func(plugin_class.__name__, selected_list)] | [] | def get_usable_plugins(cls, selected_list: List[str] = None) -> List[Type]:
# Initialize for the run
plugin_list = list(framework.class_subclasses(TimeLinerInterface))
# Get the filter from the configuration
def passthrough(name: str, selected: List[str]) -> bool:
return Tru... | [
"def",
"get_usable_plugins",
"(",
"cls",
",",
"selected_list",
":",
"List",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"List",
"[",
"Type",
"]",
":",
"# Initialize for the run",
"plugin_list",
"=",
"list",
"(",
"framework",
".",
"class_subclasses",
"(",
"TimeL... | https://github.com/volatilityfoundation/volatility3/blob/168b0d0b053ab97a7cb096ef2048795cc54d885f/volatility3/framework/plugins/timeliner.py#L54-L72 | |||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/apps_v1beta1_deployment_status.py | python | AppsV1beta1DeploymentStatus.updated_replicas | (self) | return self._updated_replicas | Gets the updated_replicas of this AppsV1beta1DeploymentStatus.
Total number of non-terminated pods targeted by this deployment that have the desired template spec.
:return: The updated_replicas of this AppsV1beta1DeploymentStatus.
:rtype: int | Gets the updated_replicas of this AppsV1beta1DeploymentStatus.
Total number of non-terminated pods targeted by this deployment that have the desired template spec. | [
"Gets",
"the",
"updated_replicas",
"of",
"this",
"AppsV1beta1DeploymentStatus",
".",
"Total",
"number",
"of",
"non",
"-",
"terminated",
"pods",
"targeted",
"by",
"this",
"deployment",
"that",
"have",
"the",
"desired",
"template",
"spec",
"."
] | def updated_replicas(self):
"""
Gets the updated_replicas of this AppsV1beta1DeploymentStatus.
Total number of non-terminated pods targeted by this deployment that have the desired template spec.
:return: The updated_replicas of this AppsV1beta1DeploymentStatus.
:rtype: int
... | [
"def",
"updated_replicas",
"(",
"self",
")",
":",
"return",
"self",
".",
"_updated_replicas"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/apps_v1beta1_deployment_status.py#L226-L234 | |
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/compute/manager.py | python | ComputeManager._heal_instance_info_cache | (self, context) | Called periodically. On every call, try to update the
info_cache's network information for another instance by
calling to the network manager.
This is implemented by keeping a cache of uuids of instances
that live on this host. On each call, we pop one off of a
list, pull the ... | Called periodically. On every call, try to update the
info_cache's network information for another instance by
calling to the network manager. | [
"Called",
"periodically",
".",
"On",
"every",
"call",
"try",
"to",
"update",
"the",
"info_cache",
"s",
"network",
"information",
"for",
"another",
"instance",
"by",
"calling",
"to",
"the",
"network",
"manager",
"."
] | def _heal_instance_info_cache(self, context):
"""Called periodically. On every call, try to update the
info_cache's network information for another instance by
calling to the network manager.
This is implemented by keeping a cache of uuids of instances
that live on this host. ... | [
"def",
"_heal_instance_info_cache",
"(",
"self",
",",
"context",
")",
":",
"heal_interval",
"=",
"CONF",
".",
"heal_instance_info_cache_interval",
"if",
"not",
"heal_interval",
":",
"return",
"instance_uuids",
"=",
"getattr",
"(",
"self",
",",
"'_instance_uuids_to_hea... | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/compute/manager.py#L9340-L9445 | ||
klmitch/turnstile | 8fe9a359b45e505d3192ab193ecf9be177ab1a17 | turnstile/tools.py | python | turnstile_command | (conf_file, command, arguments=[], channel=None,
debug=False) | Issue a command to all running control daemons.
:param conf_file: Name of the configuration file.
:param command: The command to execute. Note that 'ping' is
handled specially; in particular, the "channel"
parameter is implied. (A random value will be
... | Issue a command to all running control daemons. | [
"Issue",
"a",
"command",
"to",
"all",
"running",
"control",
"daemons",
"."
] | def turnstile_command(conf_file, command, arguments=[], channel=None,
debug=False):
"""
Issue a command to all running control daemons.
:param conf_file: Name of the configuration file.
:param command: The command to execute. Note that 'ping' is
handled specia... | [
"def",
"turnstile_command",
"(",
"conf_file",
",",
"command",
",",
"arguments",
"=",
"[",
"]",
",",
"channel",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"# Connect to the database...",
"conf",
"=",
"config",
".",
"Config",
"(",
"conf_file",
"=",
"... | https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/tools.py#L712-L803 | ||
chaoss/grimoirelab-perceval | ba19bfd5e40bffdd422ca8e68526326b47f97491 | perceval/backend.py | python | fetch | (backend_class, backend_args, category, filter_classified=False,
manager=None) | Fetch items using the given backend.
Generator to get items using the given backend class. When
an archive manager is given, this function will store
the fetched items in an `Archive`. If an exception is raised,
this archive will be removed to avoid corrupted archives.
The parameters needed to ini... | Fetch items using the given backend. | [
"Fetch",
"items",
"using",
"the",
"given",
"backend",
"."
] | def fetch(backend_class, backend_args, category, filter_classified=False,
manager=None):
"""Fetch items using the given backend.
Generator to get items using the given backend class. When
an archive manager is given, this function will store
the fetched items in an `Archive`. If an exception ... | [
"def",
"fetch",
"(",
"backend_class",
",",
"backend_args",
",",
"category",
",",
"filter_classified",
"=",
"False",
",",
"manager",
"=",
"None",
")",
":",
"init_args",
"=",
"find_signature_parameters",
"(",
"backend_class",
".",
"__init__",
",",
"backend_args",
... | https://github.com/chaoss/grimoirelab-perceval/blob/ba19bfd5e40bffdd422ca8e68526326b47f97491/perceval/backend.py#L1096-L1140 | ||
douban/graph-index | cc60ac25edf167efb768ee9b93eaf4b9523671e5 | bottle.py | python | html_quote | (string) | return '"%s"' % html_escape(string).replace('\n','%#10;')\
.replace('\r',' ').replace('\t','	') | Escape and quote a string to be used as an HTTP attribute. | Escape and quote a string to be used as an HTTP attribute. | [
"Escape",
"and",
"quote",
"a",
"string",
"to",
"be",
"used",
"as",
"an",
"HTTP",
"attribute",
"."
] | def html_quote(string):
''' Escape and quote a string to be used as an HTTP attribute.'''
return '"%s"' % html_escape(string).replace('\n','%#10;')\
.replace('\r',' ').replace('\t','	') | [
"def",
"html_quote",
"(",
"string",
")",
":",
"return",
"'\"%s\"'",
"%",
"html_escape",
"(",
"string",
")",
".",
"replace",
"(",
"'\\n'",
",",
"'%#10;'",
")",
".",
"replace",
"(",
"'\\r'",
",",
"' '",
")",
".",
"replace",
"(",
"'\\t'",
",",
"'	'... | https://github.com/douban/graph-index/blob/cc60ac25edf167efb768ee9b93eaf4b9523671e5/bottle.py#L2220-L2223 | |
girder/girder | 0766ba8e7f9b25ce81e7c0d19bd343479bceea20 | plugins/jobs/girder_jobs/models/job.py | python | Job.save | (self, job, *args, **kwargs) | return job | We extend save so that we can serialize the kwargs before sending them
to the database. This will allow kwargs with $ and . characters in the
keys. | We extend save so that we can serialize the kwargs before sending them
to the database. This will allow kwargs with $ and . characters in the
keys. | [
"We",
"extend",
"save",
"so",
"that",
"we",
"can",
"serialize",
"the",
"kwargs",
"before",
"sending",
"them",
"to",
"the",
"database",
".",
"This",
"will",
"allow",
"kwargs",
"with",
"$",
"and",
".",
"characters",
"in",
"the",
"keys",
"."
] | def save(self, job, *args, **kwargs):
"""
We extend save so that we can serialize the kwargs before sending them
to the database. This will allow kwargs with $ and . characters in the
keys.
"""
job['kwargs'] = json_util.dumps(job['kwargs'])
job = super().save(job,... | [
"def",
"save",
"(",
"self",
",",
"job",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"job",
"[",
"'kwargs'",
"]",
"=",
"json_util",
".",
"dumps",
"(",
"job",
"[",
"'kwargs'",
"]",
")",
"job",
"=",
"super",
"(",
")",
".",
"save",
"(",
... | https://github.com/girder/girder/blob/0766ba8e7f9b25ce81e7c0d19bd343479bceea20/plugins/jobs/girder_jobs/models/job.py#L264-L273 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/factortools.py | python | dup_zz_zassenhaus | (f, K) | return factors + [f] | Factor primitive square-free polynomials in `Z[x]`. | Factor primitive square-free polynomials in `Z[x]`. | [
"Factor",
"primitive",
"square",
"-",
"free",
"polynomials",
"in",
"Z",
"[",
"x",
"]",
"."
] | def dup_zz_zassenhaus(f, K):
"""Factor primitive square-free polynomials in `Z[x]`. """
n = dup_degree(f)
if n == 1:
return [f]
fc = f[-1]
A = dup_max_norm(f, K)
b = dup_LC(f, K)
B = int(abs(K.sqrt(K(n + 1))*2**n*A*b))
C = int((n + 1)**(2*n)*A**(2*n - 1))
gamma = int(_ceil(... | [
"def",
"dup_zz_zassenhaus",
"(",
"f",
",",
"K",
")",
":",
"n",
"=",
"dup_degree",
"(",
"f",
")",
"if",
"n",
"==",
"1",
":",
"return",
"[",
"f",
"]",
"fc",
"=",
"f",
"[",
"-",
"1",
"]",
"A",
"=",
"dup_max_norm",
"(",
"f",
",",
"K",
")",
"b",... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/factortools.py#L262-L362 | |
nerdvegas/rez | d392c65bf63b4bca8106f938cec49144ba54e770 | src/rez/utils/platform_.py | python | Platform.image_viewer | (self) | return self._image_viewer() | Returns the system default image viewer.
If None, rez will use the web browser to display images. | Returns the system default image viewer. | [
"Returns",
"the",
"system",
"default",
"image",
"viewer",
"."
] | def image_viewer(self):
"""Returns the system default image viewer.
If None, rez will use the web browser to display images.
"""
return self._image_viewer() | [
"def",
"image_viewer",
"(",
"self",
")",
":",
"return",
"self",
".",
"_image_viewer",
"(",
")"
] | https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/utils/platform_.py#L75-L80 | |
RJT1990/pyflux | 297f2afc2095acd97c12e827dd500e8ea5da0c0f | pyflux/garch/egarchmreg.py | python | EGARCHMReg._sim_predicted_mean | (self, lmda, Y, scores, h, t_params, simulations, X_oos) | return np.append(lmda, np.array([np.mean(i) for i in np.transpose(sim_vector)])) | Simulates a h-step ahead mean prediction
Parameters
----------
lmda : np.array
The past predicted values
Y : np.array
The past data
scores : np.array
The past scores
h : int
How many steps ahead for the prediction
... | Simulates a h-step ahead mean prediction | [
"Simulates",
"a",
"h",
"-",
"step",
"ahead",
"mean",
"prediction"
] | def _sim_predicted_mean(self, lmda, Y, scores, h, t_params, simulations, X_oos):
""" Simulates a h-step ahead mean prediction
Parameters
----------
lmda : np.array
The past predicted values
Y : np.array
The past data
scores : np.array
... | [
"def",
"_sim_predicted_mean",
"(",
"self",
",",
"lmda",
",",
"Y",
",",
"scores",
",",
"h",
",",
"t_params",
",",
"simulations",
",",
"X_oos",
")",
":",
"sim_vector",
"=",
"np",
".",
"zeros",
"(",
"[",
"simulations",
",",
"h",
"]",
")",
"for",
"n",
... | https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/garch/egarchmreg.py#L403-L466 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/parser/template/nodes/id.py | python | TemplateIdNode.to_xml | (self, client_context) | return "<id />" | [] | def to_xml(self, client_context):
return "<id />" | [
"def",
"to_xml",
"(",
"self",
",",
"client_context",
")",
":",
"return",
"\"<id />\""
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/parser/template/nodes/id.py#L36-L37 | |||
memray/seq2seq-keyphrase | 9145c63ebdc4c3bc431f8091dc52547a46804012 | emolga/models/covc_encdec.py | python | RNNLM.__init__ | (self,
config, n_rng, rng,
mode='Evaluation') | [] | def __init__(self,
config, n_rng, rng,
mode='Evaluation'):
super(RNNLM, self).__init__()
self.config = config
self.n_rng = n_rng # numpy random stream
self.rng = rng # Theano random stream
self.mode = mode
self.name = 'rnnlm' | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"n_rng",
",",
"rng",
",",
"mode",
"=",
"'Evaluation'",
")",
":",
"super",
"(",
"RNNLM",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"config",
"=",
"config",
"self",
".",
"n_rng",
"="... | https://github.com/memray/seq2seq-keyphrase/blob/9145c63ebdc4c3bc431f8091dc52547a46804012/emolga/models/covc_encdec.py#L1562-L1571 | ||||
hzy46/Deep-Learning-21-Examples | 15c2d9edccad090cd67b033f24a43c544e5cba3e | chapter_3/slim/nets/resnet_v2.py | python | bottleneck | (inputs, depth, depth_bottleneck, stride, rate=1,
outputs_collections=None, scope=None) | Bottleneck residual unit variant with BN before convolutions.
This is the full preactivation residual unit variant proposed in [2]. See
Fig. 1(b) of [2] for its definition. Note that we use here the bottleneck
variant which has an extra bottleneck layer.
When putting together two consecutive ResNet blocks tha... | Bottleneck residual unit variant with BN before convolutions. | [
"Bottleneck",
"residual",
"unit",
"variant",
"with",
"BN",
"before",
"convolutions",
"."
] | def bottleneck(inputs, depth, depth_bottleneck, stride, rate=1,
outputs_collections=None, scope=None):
"""Bottleneck residual unit variant with BN before convolutions.
This is the full preactivation residual unit variant proposed in [2]. See
Fig. 1(b) of [2] for its definition. Note that we use he... | [
"def",
"bottleneck",
"(",
"inputs",
",",
"depth",
",",
"depth_bottleneck",
",",
"stride",
",",
"rate",
"=",
"1",
",",
"outputs_collections",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"scope",
",",
"'bottl... | https://github.com/hzy46/Deep-Learning-21-Examples/blob/15c2d9edccad090cd67b033f24a43c544e5cba3e/chapter_3/slim/nets/resnet_v2.py#L62-L108 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_persistent_volume_list.py | python | V1PersistentVolumeList.to_str | (self) | return pprint.pformat(self.to_dict()) | Returns the string representation of the model | Returns the string representation of the model | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"model"
] | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_persistent_volume_list.py#L185-L187 | |
freelawproject/courtlistener | ab3ae7bb6e5e836b286749113e7dbb403d470912 | cl/corpus_importer/tasks.py | python | get_pacer_doc_by_rd_and_description | (
self: Task,
rd_pk: int,
description_re: Pattern,
cookies: RequestsCookieJar,
fallback_to_main_doc: bool = False,
tag_name: Optional[List[str]] = None,
) | Using a RECAPDocument object ID and a description of a document, get the
document from PACER.
This function was originally meant to get civil cover sheets, but can be
repurposed as needed.
:param self: The celery task
:param rd_pk: The PK of a RECAPDocument object to use as a source.
:param de... | Using a RECAPDocument object ID and a description of a document, get the
document from PACER. | [
"Using",
"a",
"RECAPDocument",
"object",
"ID",
"and",
"a",
"description",
"of",
"a",
"document",
"get",
"the",
"document",
"from",
"PACER",
"."
] | def get_pacer_doc_by_rd_and_description(
self: Task,
rd_pk: int,
description_re: Pattern,
cookies: RequestsCookieJar,
fallback_to_main_doc: bool = False,
tag_name: Optional[List[str]] = None,
) -> None:
"""Using a RECAPDocument object ID and a description of a document, get the
document ... | [
"def",
"get_pacer_doc_by_rd_and_description",
"(",
"self",
":",
"Task",
",",
"rd_pk",
":",
"int",
",",
"description_re",
":",
"Pattern",
",",
"cookies",
":",
"RequestsCookieJar",
",",
"fallback_to_main_doc",
":",
"bool",
"=",
"False",
",",
"tag_name",
":",
"Opti... | https://github.com/freelawproject/courtlistener/blob/ab3ae7bb6e5e836b286749113e7dbb403d470912/cl/corpus_importer/tasks.py#L1684-L1778 | ||
gluon/AbletonLive9_RemoteScripts | 0c0db5e2e29bbed88c82bf327f54d4968d36937e | ableton/v2/control_surface/profile.py | python | profile | (fn) | Decorator to mark a function to be profiled. Only mark top level functions | Decorator to mark a function to be profiled. Only mark top level functions | [
"Decorator",
"to",
"mark",
"a",
"function",
"to",
"be",
"profiled",
".",
"Only",
"mark",
"top",
"level",
"functions"
] | def profile(fn):
"""
Decorator to mark a function to be profiled. Only mark top level functions
"""
if ENABLE_PROFILING:
@wraps(fn)
def wrapper(self, *a, **k):
if PROFILER:
return PROFILER.runcall(partial(fn, self, *a, **k))
else:
... | [
"def",
"profile",
"(",
"fn",
")",
":",
"if",
"ENABLE_PROFILING",
":",
"@",
"wraps",
"(",
"fn",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"a",
",",
"*",
"*",
"k",
")",
":",
"if",
"PROFILER",
":",
"return",
"PROFILER",
".",
"runcall",
"(",
"par... | https://github.com/gluon/AbletonLive9_RemoteScripts/blob/0c0db5e2e29bbed88c82bf327f54d4968d36937e/ableton/v2/control_surface/profile.py#L9-L25 | ||
NVIDIA/NeMo | 5b0c0b4dec12d87d3cd960846de4105309ce938e | nemo/utils/app_state.py | python | AppState.log_dir | (self) | return self._log_dir | Returns the log_dir set by exp_manager. | Returns the log_dir set by exp_manager. | [
"Returns",
"the",
"log_dir",
"set",
"by",
"exp_manager",
"."
] | def log_dir(self):
"""Returns the log_dir set by exp_manager.
"""
return self._log_dir | [
"def",
"log_dir",
"(",
"self",
")",
":",
"return",
"self",
".",
"_log_dir"
] | https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/utils/app_state.py#L248-L251 | |
happyleavesaoc/python-firetv | 24707ca1842e6b08b502f442eee85dcab13682e3 | firetv/__init__.py | python | FireTV.key_e | (self) | Send e keypress. | Send e keypress. | [
"Send",
"e",
"keypress",
"."
] | def key_e(self):
"""Send e keypress."""
self._key(KEY_E) | [
"def",
"key_e",
"(",
"self",
")",
":",
"self",
".",
"_key",
"(",
"KEY_E",
")"
] | https://github.com/happyleavesaoc/python-firetv/blob/24707ca1842e6b08b502f442eee85dcab13682e3/firetv/__init__.py#L851-L853 | ||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventType.file_request_delete | (cls, val) | return cls('file_request_delete', val) | Create an instance of this class set to the ``file_request_delete`` tag
with value ``val``.
:param FileRequestDeleteType val:
:rtype: EventType | Create an instance of this class set to the ``file_request_delete`` tag
with value ``val``. | [
"Create",
"an",
"instance",
"of",
"this",
"class",
"set",
"to",
"the",
"file_request_delete",
"tag",
"with",
"value",
"val",
"."
] | def file_request_delete(cls, val):
"""
Create an instance of this class set to the ``file_request_delete`` tag
with value ``val``.
:param FileRequestDeleteType val:
:rtype: EventType
"""
return cls('file_request_delete', val) | [
"def",
"file_request_delete",
"(",
"cls",
",",
"val",
")",
":",
"return",
"cls",
"(",
"'file_request_delete'",
",",
"val",
")"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L24283-L24291 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/keystone/keystone/common/serializer.py | python | XmlSerializer._populate_list | (self, element, k, v) | Populates an element with a key & list value. | Populates an element with a key & list value. | [
"Populates",
"an",
"element",
"with",
"a",
"key",
"&",
"list",
"value",
"."
] | def _populate_list(self, element, k, v):
"""Populates an element with a key & list value."""
# spec has a lot of inconsistency here!
container = element
if k == 'media-types':
# xsd compliance: <media-types> contains <media-type>s
# find an existing <media-types>... | [
"def",
"_populate_list",
"(",
"self",
",",
"element",
",",
"k",
",",
"v",
")",
":",
"# spec has a lot of inconsistency here!",
"container",
"=",
"element",
"if",
"k",
"==",
"'media-types'",
":",
"# xsd compliance: <media-types> contains <media-type>s",
"# find an existing... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/keystone/keystone/common/serializer.py#L219-L260 | ||
anki/cozmo-python-sdk | dd29edef18748fcd816550469195323842a7872e | examples/tutorials/05_async_python/02_cube_blinker.py | python | cozmo_program | (robot: cozmo.robot.Robot) | The async equivalent of 01_cube_blinker_sync.
The usage of ``async def`` makes the cozmo_program method a coroutine.
Within a coroutine, ``await`` can be used. With ``await``, the statement
blocks until the request being waited for has completed. Meanwhile
the event loop continues in the background.
... | The async equivalent of 01_cube_blinker_sync. | [
"The",
"async",
"equivalent",
"of",
"01_cube_blinker_sync",
"."
] | async def cozmo_program(robot: cozmo.robot.Robot):
'''The async equivalent of 01_cube_blinker_sync.
The usage of ``async def`` makes the cozmo_program method a coroutine.
Within a coroutine, ``await`` can be used. With ``await``, the statement
blocks until the request being waited for has completed. Me... | [
"async",
"def",
"cozmo_program",
"(",
"robot",
":",
"cozmo",
".",
"robot",
".",
"Robot",
")",
":",
"cube",
"=",
"None",
"look_around",
"=",
"robot",
".",
"start_behavior",
"(",
"cozmo",
".",
"behavior",
".",
"BehaviorTypes",
".",
"LookAroundInPlace",
")",
... | https://github.com/anki/cozmo-python-sdk/blob/dd29edef18748fcd816550469195323842a7872e/examples/tutorials/05_async_python/02_cube_blinker.py#L60-L101 | ||
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_vendor/distlib/markers.py | python | Evaluator.evaluate | (self, expr, context) | return result | Evaluate a marker expression returned by the :func:`parse_requirement`
function in the specified context. | Evaluate a marker expression returned by the :func:`parse_requirement`
function in the specified context. | [
"Evaluate",
"a",
"marker",
"expression",
"returned",
"by",
"the",
":",
"func",
":",
"parse_requirement",
"function",
"in",
"the",
"specified",
"context",
"."
] | def evaluate(self, expr, context):
"""
Evaluate a marker expression returned by the :func:`parse_requirement`
function in the specified context.
"""
if isinstance(expr, string_types):
if expr[0] in '\'"':
result = expr[1:-1]
else:
... | [
"def",
"evaluate",
"(",
"self",
",",
"expr",
",",
"context",
")",
":",
"if",
"isinstance",
"(",
"expr",
",",
"string_types",
")",
":",
"if",
"expr",
"[",
"0",
"]",
"in",
"'\\'\"'",
":",
"result",
"=",
"expr",
"[",
"1",
":",
"-",
"1",
"]",
"else",... | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/distlib/markers.py#L59-L91 | |
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/lib2to3/refactor.py | python | RefactoringTool.gen_lines | (self, block, indent) | Generates lines as expected by tokenize from a list of lines.
This strips the first len(indent + self.PS1) characters off each line. | Generates lines as expected by tokenize from a list of lines. | [
"Generates",
"lines",
"as",
"expected",
"by",
"tokenize",
"from",
"a",
"list",
"of",
"lines",
"."
] | def gen_lines(self, block, indent):
"""Generates lines as expected by tokenize from a list of lines.
This strips the first len(indent + self.PS1) characters off each line.
"""
prefix1 = indent + self.PS1
prefix2 = indent + self.PS2
prefix = prefix1
for line in bl... | [
"def",
"gen_lines",
"(",
"self",
",",
"block",
",",
"indent",
")",
":",
"prefix1",
"=",
"indent",
"+",
"self",
".",
"PS1",
"prefix2",
"=",
"indent",
"+",
"self",
".",
"PS2",
"prefix",
"=",
"prefix1",
"for",
"line",
"in",
"block",
":",
"if",
"line",
... | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/lib2to3/refactor.py#L671-L688 | ||
SCons/scons | 309f0234d1d9cc76955818be47c5c722f577dac6 | SCons/Tool/jar.py | python | Jar | (env, target = None, source = [], *args, **kw) | return env.JarFile(target = target, source = target_nodes, *args, **kw) | A pseudo-Builder wrapper around the separate Jar sources{File,Dir}
Builders. | A pseudo-Builder wrapper around the separate Jar sources{File,Dir}
Builders. | [
"A",
"pseudo",
"-",
"Builder",
"wrapper",
"around",
"the",
"separate",
"Jar",
"sources",
"{",
"File",
"Dir",
"}",
"Builders",
"."
] | def Jar(env, target = None, source = [], *args, **kw):
"""
A pseudo-Builder wrapper around the separate Jar sources{File,Dir}
Builders.
"""
# jar target should not be a list so assume they passed
# no target and want implicit target to be made and the arg
# was actaully the list of sources
... | [
"def",
"Jar",
"(",
"env",
",",
"target",
"=",
"None",
",",
"source",
"=",
"[",
"]",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"# jar target should not be a list so assume they passed",
"# no target and want implicit target to be made and the arg",
"# was actaul... | https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/Tool/jar.py#L91-L205 | |
alan-turing-institute/sktime | 79cc513346b1257a6f3fa8e4ed855b5a2a7de716 | sktime/forecasting/compose/_reduce.py | python | _concat_y_X | (y, X) | return z | Concatenate y and X prior to sliding-window transform. | Concatenate y and X prior to sliding-window transform. | [
"Concatenate",
"y",
"and",
"X",
"prior",
"to",
"sliding",
"-",
"window",
"transform",
"."
] | def _concat_y_X(y, X):
"""Concatenate y and X prior to sliding-window transform."""
z = y.to_numpy()
if z.ndim == 1:
z = z.reshape(-1, 1)
if X is not None:
z = np.column_stack([z, X.to_numpy()])
return z | [
"def",
"_concat_y_X",
"(",
"y",
",",
"X",
")",
":",
"z",
"=",
"y",
".",
"to_numpy",
"(",
")",
"if",
"z",
".",
"ndim",
"==",
"1",
":",
"z",
"=",
"z",
".",
"reshape",
"(",
"-",
"1",
",",
"1",
")",
"if",
"X",
"is",
"not",
"None",
":",
"z",
... | https://github.com/alan-turing-institute/sktime/blob/79cc513346b1257a6f3fa8e4ed855b5a2a7de716/sktime/forecasting/compose/_reduce.py#L37-L44 | |
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py | python | pprint | (walker) | return "\n".join(output) | Pretty printer for tree walkers | Pretty printer for tree walkers | [
"Pretty",
"printer",
"for",
"tree",
"walkers"
] | def pprint(walker):
"""Pretty printer for tree walkers"""
output = []
indent = 0
for token in concatenateCharacterTokens(walker):
type = token["type"]
if type in ("StartTag", "EmptyTag"):
# tag name
if token["namespace"] and token["namespace"] != constants.namespa... | [
"def",
"pprint",
"(",
"walker",
")",
":",
"output",
"=",
"[",
"]",
"indent",
"=",
"0",
"for",
"token",
"in",
"concatenateCharacterTokens",
"(",
"walker",
")",
":",
"type",
"=",
"token",
"[",
"\"type\"",
"]",
"if",
"type",
"in",
"(",
"\"StartTag\"",
","... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py#L79-L147 | |
francisck/DanderSpritz_docs | 86bb7caca5a957147f120b18bb5c31f299914904 | Python/Core/Lib/distutils/command/bdist_msi.py | python | PyDialog.next | (self, title, next, name='Next', active=1) | return self.pushbutton(name, 236, self.h - 27, 56, 17, flags, title, next) | Add a Next button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated | Add a Next button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated | [
"Add",
"a",
"Next",
"button",
"with",
"a",
"given",
"title",
"the",
"tab",
"-",
"next",
"button",
"its",
"name",
"in",
"the",
"Control",
"table",
"possibly",
"initially",
"disabled",
".",
"Return",
"the",
"button",
"so",
"that",
"events",
"can",
"be",
"a... | def next(self, title, next, name='Next', active=1):
"""Add a Next button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated"""
if active:
flags = 3
else:
... | [
"def",
"next",
"(",
"self",
",",
"title",
",",
"next",
",",
"name",
"=",
"'Next'",
",",
"active",
"=",
"1",
")",
":",
"if",
"active",
":",
"flags",
"=",
"3",
"else",
":",
"flags",
"=",
"1",
"return",
"self",
".",
"pushbutton",
"(",
"name",
",",
... | https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/distutils/command/bdist_msi.py#L60-L69 | |
tensorly/tensorly | 87b435b3f3343447b49d47ebb5461118f6c8a9ab | doc/sphinx_ext/sphinx_gallery/notebook.py | python | directive_fun | (match, directive) | return ('<div class="alert alert-{0}"><h4>{1}</h4><p>{2}</p></div>'
.format(directive_to_alert[directive], directive.capitalize(),
match.group(1).strip())) | Helper to fill in directives | Helper to fill in directives | [
"Helper",
"to",
"fill",
"in",
"directives"
] | def directive_fun(match, directive):
"""Helper to fill in directives"""
directive_to_alert = dict(note="info", warning="danger")
return ('<div class="alert alert-{0}"><h4>{1}</h4><p>{2}</p></div>'
.format(directive_to_alert[directive], directive.capitalize(),
match.group(1).s... | [
"def",
"directive_fun",
"(",
"match",
",",
"directive",
")",
":",
"directive_to_alert",
"=",
"dict",
"(",
"note",
"=",
"\"info\"",
",",
"warning",
"=",
"\"danger\"",
")",
"return",
"(",
"'<div class=\"alert alert-{0}\"><h4>{1}</h4><p>{2}</p></div>'",
".",
"format",
... | https://github.com/tensorly/tensorly/blob/87b435b3f3343447b49d47ebb5461118f6c8a9ab/doc/sphinx_ext/sphinx_gallery/notebook.py#L51-L56 | |
theislab/scanpy | b69015e9e7007193c9ac461d5c6fbf845b3d6962 | scanpy/plotting/_utils.py | python | circles | (x, y, s, ax, marker=None, c='b', vmin=None, vmax=None, **kwargs) | return collection | Taken from here: https://gist.github.com/syrte/592a062c562cd2a98a83
Make a scatter plot of circles.
Similar to pl.scatter, but the size of circles are in data scale.
Parameters
----------
x, y : scalar or array_like, shape (n, )
Input data
s : scalar or array_like, shape (n, )
Ra... | Taken from here: https://gist.github.com/syrte/592a062c562cd2a98a83
Make a scatter plot of circles.
Similar to pl.scatter, but the size of circles are in data scale.
Parameters
----------
x, y : scalar or array_like, shape (n, )
Input data
s : scalar or array_like, shape (n, )
Ra... | [
"Taken",
"from",
"here",
":",
"https",
":",
"//",
"gist",
".",
"github",
".",
"com",
"/",
"syrte",
"/",
"592a062c562cd2a98a83",
"Make",
"a",
"scatter",
"plot",
"of",
"circles",
".",
"Similar",
"to",
"pl",
".",
"scatter",
"but",
"the",
"size",
"of",
"ci... | def circles(x, y, s, ax, marker=None, c='b', vmin=None, vmax=None, **kwargs):
"""
Taken from here: https://gist.github.com/syrte/592a062c562cd2a98a83
Make a scatter plot of circles.
Similar to pl.scatter, but the size of circles are in data scale.
Parameters
----------
x, y : scalar or array... | [
"def",
"circles",
"(",
"x",
",",
"y",
",",
"s",
",",
"ax",
",",
"marker",
"=",
"None",
",",
"c",
"=",
"'b'",
",",
"vmin",
"=",
"None",
",",
"vmax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# You can set `facecolor` with an array for each patch,... | https://github.com/theislab/scanpy/blob/b69015e9e7007193c9ac461d5c6fbf845b3d6962/scanpy/plotting/_utils.py#L1063-L1117 | |
euphrat1ca/fuzzdb-collect | f32552a4d5d84350552c68801aed281ca1f48e66 | ScriptShare/0my/Some-PoC-oR-ExP-master/验证Joomla是否存在反序列化漏洞的脚本/批量/hackUtils-master/bs4/element.py | python | Tag.has_key | (self, key) | return self.has_attr(key) | This was kind of misleading because has_key() (attributes)
was different from __in__ (contents). has_key() is gone in
Python 3, anyway. | This was kind of misleading because has_key() (attributes)
was different from __in__ (contents). has_key() is gone in
Python 3, anyway. | [
"This",
"was",
"kind",
"of",
"misleading",
"because",
"has_key",
"()",
"(",
"attributes",
")",
"was",
"different",
"from",
"__in__",
"(",
"contents",
")",
".",
"has_key",
"()",
"is",
"gone",
"in",
"Python",
"3",
"anyway",
"."
] | def has_key(self, key):
"""This was kind of misleading because has_key() (attributes)
was different from __in__ (contents). has_key() is gone in
Python 3, anyway."""
warnings.warn('has_key is deprecated. Use has_attr("%s") instead.' % (
key))
return self.has_attr(... | [
"def",
"has_key",
"(",
"self",
",",
"key",
")",
":",
"warnings",
".",
"warn",
"(",
"'has_key is deprecated. Use has_attr(\"%s\") instead.'",
"%",
"(",
"key",
")",
")",
"return",
"self",
".",
"has_attr",
"(",
"key",
")"
] | https://github.com/euphrat1ca/fuzzdb-collect/blob/f32552a4d5d84350552c68801aed281ca1f48e66/ScriptShare/0my/Some-PoC-oR-ExP-master/验证Joomla是否存在反序列化漏洞的脚本/批量/hackUtils-master/bs4/element.py#L1408-L1414 | |
dmlc/gluon-cv | 709bc139919c02f7454cb411311048be188cde64 | gluoncv/model_zoo/center_net/target_generator.py | python | _gaussian_radius | (det_size, min_overlap=0.7) | return min(r1, r2, r3) | Calculate gaussian radius for foreground objects.
Parameters
----------
det_size : tuple of int
Object size (h, w).
min_overlap : float
Minimal overlap between objects.
Returns
-------
float
Gaussian radius. | Calculate gaussian radius for foreground objects. | [
"Calculate",
"gaussian",
"radius",
"for",
"foreground",
"objects",
"."
] | def _gaussian_radius(det_size, min_overlap=0.7):
"""Calculate gaussian radius for foreground objects.
Parameters
----------
det_size : tuple of int
Object size (h, w).
min_overlap : float
Minimal overlap between objects.
Returns
-------
float
Gaussian radius.
... | [
"def",
"_gaussian_radius",
"(",
"det_size",
",",
"min_overlap",
"=",
"0.7",
")",
":",
"height",
",",
"width",
"=",
"det_size",
"a1",
"=",
"1",
"b1",
"=",
"(",
"height",
"+",
"width",
")",
"c1",
"=",
"width",
"*",
"height",
"*",
"(",
"1",
"-",
"min_... | https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/gluoncv/model_zoo/center_net/target_generator.py#L65-L100 | |
ysymyth/3D-SDN | d7a4519bfd57d4c5d99dbdb6a53a82ba5b66ec9e | geometric/maskrcnn/config.py | python | Config.display | (self) | Display Configuration values. | Display Configuration values. | [
"Display",
"Configuration",
"values",
"."
] | def display(self):
"""Display Configuration values."""
print("\nConfigurations:")
for a in dir(self):
if not a.startswith("__") and not callable(getattr(self, a)):
print("{:30} {}".format(a, getattr(self, a)))
print("\n") | [
"def",
"display",
"(",
"self",
")",
":",
"print",
"(",
"\"\\nConfigurations:\"",
")",
"for",
"a",
"in",
"dir",
"(",
"self",
")",
":",
"if",
"not",
"a",
".",
"startswith",
"(",
"\"__\"",
")",
"and",
"not",
"callable",
"(",
"getattr",
"(",
"self",
",",... | https://github.com/ysymyth/3D-SDN/blob/d7a4519bfd57d4c5d99dbdb6a53a82ba5b66ec9e/geometric/maskrcnn/config.py#L177-L183 | ||
spotify/luigi | c3b66f4a5fa7eaa52f9a72eb6704b1049035c789 | luigi/contrib/pyspark_runner.py | python | _pyspark_runner_with | (name, entry_point_class) | return type(name, (AbstractPySparkRunner,), {'_entry_point_class': entry_point_class}) | [] | def _pyspark_runner_with(name, entry_point_class):
return type(name, (AbstractPySparkRunner,), {'_entry_point_class': entry_point_class}) | [
"def",
"_pyspark_runner_with",
"(",
"name",
",",
"entry_point_class",
")",
":",
"return",
"type",
"(",
"name",
",",
"(",
"AbstractPySparkRunner",
",",
")",
",",
"{",
"'_entry_point_class'",
":",
"entry_point_class",
"}",
")"
] | https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/contrib/pyspark_runner.py#L115-L116 | |||
hsoft/pdfmasher | 08943dd1ad9d8fa91c547d5e91d2f90114d76094 | hscommon/gui/column.py | python | Columns.resize_column | (self, colname, newwidth) | Set column ``colname``'s width to ``newwidth``. | Set column ``colname``'s width to ``newwidth``. | [
"Set",
"column",
"colname",
"s",
"width",
"to",
"newwidth",
"."
] | def resize_column(self, colname, newwidth):
"""Set column ``colname``'s width to ``newwidth``.
"""
self._set_colname_attr(colname, 'width', newwidth) | [
"def",
"resize_column",
"(",
"self",
",",
"colname",
",",
"newwidth",
")",
":",
"self",
".",
"_set_colname_attr",
"(",
"colname",
",",
"'width'",
",",
"newwidth",
")"
] | https://github.com/hsoft/pdfmasher/blob/08943dd1ad9d8fa91c547d5e91d2f90114d76094/hscommon/gui/column.py#L206-L209 | ||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/bruteforce/form_auth.py | python | form_auth.audit | (self, freq, debugging_id=None) | Tries to bruteforce a form auth. This is slow!
:param freq: A FuzzableRequest
:param debugging_id: The ID to use in the logs to be able to track this
call to audit(). Plugins need to send this ID to
the ExtendedUrllib to get improved logging. | Tries to bruteforce a form auth. This is slow! | [
"Tries",
"to",
"bruteforce",
"a",
"form",
"auth",
".",
"This",
"is",
"slow!"
] | def audit(self, freq, debugging_id=None):
"""
Tries to bruteforce a form auth. This is slow!
:param freq: A FuzzableRequest
:param debugging_id: The ID to use in the logs to be able to track this
call to audit(). Plugins need to send this ID to
... | [
"def",
"audit",
"(",
"self",
",",
"freq",
",",
"debugging_id",
"=",
"None",
")",
":",
"if",
"freq",
".",
"get_url",
"(",
")",
"in",
"self",
".",
"_already_tested",
":",
"return",
"mutant",
"=",
"form_pointer_factory",
"(",
"freq",
")",
"if",
"not",
"se... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/bruteforce/form_auth.py#L56-L132 | ||
hubo1016/vlcp | 61c4c2595b610675ac0cbc4dbc46f70ec40090d3 | vlcp/utils/networkplugin.py | python | updatephysicalport | (update_processor = partial(default_processor, excluding=('vhost', 'systemid',
'bridge', 'name'),
disabled=('physicalnetwork',)),
reorder_dict = ... | return walker | :param update_processor: update_processor(physcialport, walk, write, \*, parameters) | :param update_processor: update_processor(physcialport, walk, write, \*, parameters) | [
":",
"param",
"update_processor",
":",
"update_processor",
"(",
"physcialport",
"walk",
"write",
"\\",
"*",
"parameters",
")"
] | def updatephysicalport(update_processor = partial(default_processor, excluding=('vhost', 'systemid',
'bridge', 'name'),
disabled=('physicalnetwork',)),
... | [
"def",
"updatephysicalport",
"(",
"update_processor",
"=",
"partial",
"(",
"default_processor",
",",
"excluding",
"=",
"(",
"'vhost'",
",",
"'systemid'",
",",
"'bridge'",
",",
"'name'",
")",
",",
"disabled",
"=",
"(",
"'physicalnetwork'",
",",
")",
")",
",",
... | https://github.com/hubo1016/vlcp/blob/61c4c2595b610675ac0cbc4dbc46f70ec40090d3/vlcp/utils/networkplugin.py#L183-L200 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/tkinter/__init__.py | python | Misc.winfo_screenvisual | (self) | return self.tk.call('winfo', 'screenvisual', self._w) | Return one of the strings directcolor, grayscale, pseudocolor,
staticcolor, staticgray, or truecolor for the default
colormodel of this screen. | Return one of the strings directcolor, grayscale, pseudocolor,
staticcolor, staticgray, or truecolor for the default
colormodel of this screen. | [
"Return",
"one",
"of",
"the",
"strings",
"directcolor",
"grayscale",
"pseudocolor",
"staticcolor",
"staticgray",
"or",
"truecolor",
"for",
"the",
"default",
"colormodel",
"of",
"this",
"screen",
"."
] | def winfo_screenvisual(self):
"""Return one of the strings directcolor, grayscale, pseudocolor,
staticcolor, staticgray, or truecolor for the default
colormodel of this screen."""
return self.tk.call('winfo', 'screenvisual', self._w) | [
"def",
"winfo_screenvisual",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'screenvisual'",
",",
"self",
".",
"_w",
")"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/tkinter/__init__.py#L1241-L1245 | |
pgjones/quart | 68a5bc4e98a07d903e7bfe148c1b7faa260f4334 | src/quart/sessions.py | python | SessionInterface.get_cookie_name | (self, app: "Quart") | return app.session_cookie_name | Helper method to return the Cookie Name for the App. | Helper method to return the Cookie Name for the App. | [
"Helper",
"method",
"to",
"return",
"the",
"Cookie",
"Name",
"for",
"the",
"App",
"."
] | def get_cookie_name(self, app: "Quart") -> str:
"""Helper method to return the Cookie Name for the App."""
return app.session_cookie_name | [
"def",
"get_cookie_name",
"(",
"self",
",",
"app",
":",
"\"Quart\"",
")",
"->",
"str",
":",
"return",
"app",
".",
"session_cookie_name"
] | https://github.com/pgjones/quart/blob/68a5bc4e98a07d903e7bfe148c1b7faa260f4334/src/quart/sessions.py#L132-L134 | |
IntelAI/models | 1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c | models/language_translation/tensorflow/bert/inference/fp32/tokenization.py | python | convert_by_vocab | (vocab, items) | return output | Converts a sequence of [tokens|ids] using the vocab. | Converts a sequence of [tokens|ids] using the vocab. | [
"Converts",
"a",
"sequence",
"of",
"[",
"tokens|ids",
"]",
"using",
"the",
"vocab",
"."
] | def convert_by_vocab(vocab, items):
"""Converts a sequence of [tokens|ids] using the vocab."""
output = []
for item in items:
output.append(vocab[item])
return output | [
"def",
"convert_by_vocab",
"(",
"vocab",
",",
"items",
")",
":",
"output",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"output",
".",
"append",
"(",
"vocab",
"[",
"item",
"]",
")",
"return",
"output"
] | https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/bert/inference/fp32/tokenization.py#L136-L141 | |
clips/pattern | d25511f9ca7ed9356b801d8663b8b5168464e68f | pattern/vector/__init__.py | python | SVM._extension | (self) | return self._svm.libsvm.libsvm | Yields the extension module object,
e.g., pattern/vector/svm/3.17/libsvm-mac64.so. | Yields the extension module object,
e.g., pattern/vector/svm/3.17/libsvm-mac64.so. | [
"Yields",
"the",
"extension",
"module",
"object",
"e",
".",
"g",
".",
"pattern",
"/",
"vector",
"/",
"svm",
"/",
"3",
".",
"17",
"/",
"libsvm",
"-",
"mac64",
".",
"so",
"."
] | def _extension(self):
""" Yields the extension module object,
e.g., pattern/vector/svm/3.17/libsvm-mac64.so.
"""
if self.extension == LIBLINEAR:
return self._svm.liblinear.liblinear
return self._svm.libsvm.libsvm | [
"def",
"_extension",
"(",
"self",
")",
":",
"if",
"self",
".",
"extension",
"==",
"LIBLINEAR",
":",
"return",
"self",
".",
"_svm",
".",
"liblinear",
".",
"liblinear",
"return",
"self",
".",
"_svm",
".",
"libsvm",
".",
"libsvm"
] | https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/vector/__init__.py#L3461-L3467 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/pydoc.py | python | resolve | (thing, forceload=0) | Given an object or a path to an object, get the object and its name. | Given an object or a path to an object, get the object and its name. | [
"Given",
"an",
"object",
"or",
"a",
"path",
"to",
"an",
"object",
"get",
"the",
"object",
"and",
"its",
"name",
"."
] | def resolve(thing, forceload=0):
"""Given an object or a path to an object, get the object and its name."""
if isinstance(thing, str):
object = locate(thing, forceload)
if object is None:
raise ImportError('''\
No Python documentation found for %r.
Use help() to get the interactive h... | [
"def",
"resolve",
"(",
"thing",
",",
"forceload",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"thing",
",",
"str",
")",
":",
"object",
"=",
"locate",
"(",
"thing",
",",
"forceload",
")",
"if",
"object",
"is",
"None",
":",
"raise",
"ImportError",
"("... | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/pydoc.py#L1589-L1601 | ||
whyliam/whyliam.workflows.youdao | 2dfa7f1de56419dab1c2e70c1a27e5e13ba25a5c | urllib3/packages/rfc3986/_mixin.py | python | URIMixin.authority_is_valid | (self, require=False) | return validators.authority_is_valid(
self.authority, host=self.host, require=require
) | Determine if the authority component is valid.
.. deprecated:: 1.1.0
Use the :class:`~rfc3986.validators.Validator` object instead.
:param bool require:
Set to ``True`` to require the presence of this component.
:returns:
``True`` if the authority is valid.... | Determine if the authority component is valid. | [
"Determine",
"if",
"the",
"authority",
"component",
"is",
"valid",
"."
] | def authority_is_valid(self, require=False):
"""Determine if the authority component is valid.
.. deprecated:: 1.1.0
Use the :class:`~rfc3986.validators.Validator` object instead.
:param bool require:
Set to ``True`` to require the presence of this component.
:... | [
"def",
"authority_is_valid",
"(",
"self",
",",
"require",
"=",
"False",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Please use rfc3986.validators.Validator instead. \"",
"\"This method will be eventually removed.\"",
",",
"DeprecationWarning",
",",
")",
"try",
":",
"self",... | https://github.com/whyliam/whyliam.workflows.youdao/blob/2dfa7f1de56419dab1c2e70c1a27e5e13ba25a5c/urllib3/packages/rfc3986/_mixin.py#L130-L156 | |
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/subliminal/utils.py | python | hash_thesubdb | (video_path) | return hashlib.md5(data).hexdigest() | Compute a hash using TheSubDB's algorithm.
:param str video_path: path of the video.
:return: the hash.
:rtype: str | Compute a hash using TheSubDB's algorithm. | [
"Compute",
"a",
"hash",
"using",
"TheSubDB",
"s",
"algorithm",
"."
] | def hash_thesubdb(video_path):
"""Compute a hash using TheSubDB's algorithm.
:param str video_path: path of the video.
:return: the hash.
:rtype: str
"""
readsize = 64 * 1024
if os.path.getsize(video_path) < readsize:
return
with open(video_path, 'rb') as f:
data = f.re... | [
"def",
"hash_thesubdb",
"(",
"video_path",
")",
":",
"readsize",
"=",
"64",
"*",
"1024",
"if",
"os",
".",
"path",
".",
"getsize",
"(",
"video_path",
")",
"<",
"readsize",
":",
"return",
"with",
"open",
"(",
"video_path",
",",
"'rb'",
")",
"as",
"f",
... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/subliminal/utils.py#L39-L55 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/xml/sax/expatreader.py | python | ExpatParser.feed | (self, data, isFinal = 0) | [] | def feed(self, data, isFinal = 0):
if not self._parsing:
self.reset()
self._parsing = 1
self._cont_handler.startDocument()
try:
# The isFinal parameter is internal to the expat reader.
# If it is set to true, expat will check validity of the e... | [
"def",
"feed",
"(",
"self",
",",
"data",
",",
"isFinal",
"=",
"0",
")",
":",
"if",
"not",
"self",
".",
"_parsing",
":",
"self",
".",
"reset",
"(",
")",
"self",
".",
"_parsing",
"=",
"1",
"self",
".",
"_cont_handler",
".",
"startDocument",
"(",
")",... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/xml/sax/expatreader.py#L202-L217 | ||||
ynhacler/RedKindle | 7c970920dc840f869e38cbda480d630cc2e7b200 | bs4/element.py | python | Tag.select | (self, selector, _candidate_generator=None) | return current_context | Perform a CSS selection operation on the current element. | Perform a CSS selection operation on the current element. | [
"Perform",
"a",
"CSS",
"selection",
"operation",
"on",
"the",
"current",
"element",
"."
] | def select(self, selector, _candidate_generator=None):
"""Perform a CSS selection operation on the current element."""
tokens = selector.split()
current_context = [self]
if tokens[-1] in self._selector_combinators:
raise ValueError(
'Final combinator "%s" is ... | [
"def",
"select",
"(",
"self",
",",
"selector",
",",
"_candidate_generator",
"=",
"None",
")",
":",
"tokens",
"=",
"selector",
".",
"split",
"(",
")",
"current_context",
"=",
"[",
"self",
"]",
"if",
"tokens",
"[",
"-",
"1",
"]",
"in",
"self",
".",
"_s... | https://github.com/ynhacler/RedKindle/blob/7c970920dc840f869e38cbda480d630cc2e7b200/bs4/element.py#L1191-L1386 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.