nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/parallel/map_reduce.py | python | RESetMapReduce.post_process | (self, a) | return a | r"""
Return the image of ``a`` under the post-processing function for ``self``.
INPUT:
- ``a`` -- a node
With the default post-processing function, which is the identity function,
this returns ``a`` itself.
.. note:: This should be overloaded in applications.
... | r"""
Return the image of ``a`` under the post-processing function for ``self``. | [
"r",
"Return",
"the",
"image",
"of",
"a",
"under",
"the",
"post",
"-",
"processing",
"function",
"for",
"self",
"."
] | def post_process(self, a):
r"""
Return the image of ``a`` under the post-processing function for ``self``.
INPUT:
- ``a`` -- a node
With the default post-processing function, which is the identity function,
this returns ``a`` itself.
.. note:: This should be o... | [
"def",
"post_process",
"(",
"self",
",",
"a",
")",
":",
"return",
"a"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/parallel/map_reduce.py#L1052-L1075 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_pt_objects.py | python | AutoModel.from_pretrained | (cls, *args, **kwargs) | [] | def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["torch"]) | [
"def",
"from_pretrained",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"cls",
",",
"[",
"\"torch\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pt_objects.py#L406-L407 | ||||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/tempfile.py | python | mkdtemp | (suffix=None, prefix=None, dir=None) | User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, and searchable only by the
creating user.
Caller is... | User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory. | [
"User",
"-",
"callable",
"function",
"to",
"create",
"and",
"return",
"a",
"unique",
"temporary",
"directory",
".",
"The",
"return",
"value",
"is",
"the",
"pathname",
"of",
"the",
"directory",
"."
] | def mkdtemp(suffix=None, prefix=None, dir=None):
"""User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, and ... | [
"def",
"mkdtemp",
"(",
"suffix",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"dir",
"=",
"None",
")",
":",
"prefix",
",",
"suffix",
",",
"dir",
",",
"output_type",
"=",
"_sanitize_params",
"(",
"prefix",
",",
"suffix",
",",
"dir",
")",
"names",
"="... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/tempfile.py#L343-L380 | ||
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/matplotlib/figure.py | python | FigureBase.delaxes | (self, ax) | Remove the `~.axes.Axes` *ax* from the figure; update the current Axes. | Remove the `~.axes.Axes` *ax* from the figure; update the current Axes. | [
"Remove",
"the",
"~",
".",
"axes",
".",
"Axes",
"*",
"ax",
"*",
"from",
"the",
"figure",
";",
"update",
"the",
"current",
"Axes",
"."
] | def delaxes(self, ax):
"""
Remove the `~.axes.Axes` *ax* from the figure; update the current Axes.
"""
def _reset_locators_and_formatters(axis):
# Set the formatters and locators to be associated with axis
# (where previously they may have been associated with an... | [
"def",
"delaxes",
"(",
"self",
",",
"ax",
")",
":",
"def",
"_reset_locators_and_formatters",
"(",
"axis",
")",
":",
"# Set the formatters and locators to be associated with axis",
"# (where previously they may have been associated with another",
"# Axis instance)",
"axis",
".",
... | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/figure.py#L904-L939 | ||
welch/seasonal | 2a2396014d46283d0c7aff34cde5dafb6c462c58 | seasonal/sequences.py | python | sine | (amp, period, cycles, partial=0) | return seq | sine wave
Parameters
----------
amp : float
values range from -amp..amp
period : int
sine period (samples)
cycles : int
number of cycles to generate
partial : int
additional samples to append
Returns
-------
ndarray | sine wave | [
"sine",
"wave"
] | def sine(amp, period, cycles, partial=0):
"""sine wave
Parameters
----------
amp : float
values range from -amp..amp
period : int
sine period (samples)
cycles : int
number of cycles to generate
partial : int
additional samples to append
Returns
-----... | [
"def",
"sine",
"(",
"amp",
",",
"period",
",",
"cycles",
",",
"partial",
"=",
"0",
")",
":",
"cycle",
"=",
"[",
"math",
".",
"sin",
"(",
"i",
"*",
"2",
"*",
"math",
".",
"pi",
"/",
"period",
")",
"for",
"i",
"in",
"range",
"(",
"period",
")",... | https://github.com/welch/seasonal/blob/2a2396014d46283d0c7aff34cde5dafb6c462c58/seasonal/sequences.py#L90-L112 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/docutils/utils/math/math2html.py | python | Formula.parse | (self, pos) | return self | Parse using a parse position instead of self.parser. | Parse using a parse position instead of self.parser. | [
"Parse",
"using",
"a",
"parse",
"position",
"instead",
"of",
"self",
".",
"parser",
"."
] | def parse(self, pos):
"Parse using a parse position instead of self.parser."
if pos.checkskip('$$'):
self.parsedollarblock(pos)
elif pos.checkskip('$'):
self.parsedollarinline(pos)
elif pos.checkskip('\\('):
self.parseinlineto(pos, '\\)')
elif pos.checkskip('\\['):
self.parse... | [
"def",
"parse",
"(",
"self",
",",
"pos",
")",
":",
"if",
"pos",
".",
"checkskip",
"(",
"'$$'",
")",
":",
"self",
".",
"parsedollarblock",
"(",
"pos",
")",
"elif",
"pos",
".",
"checkskip",
"(",
"'$'",
")",
":",
"self",
".",
"parsedollarinline",
"(",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/docutils/utils/math/math2html.py#L2957-L2970 | |
mne-tools/mne-python | f90b303ce66a8415e64edd4605b09ac0179c1ebf | mne/utils/check.py | python | _check_eeglabio_installed | (strict=True) | return _soft_import('eeglabio', 'exporting to EEGLab', strict=strict) | Aux function. | Aux function. | [
"Aux",
"function",
"."
] | def _check_eeglabio_installed(strict=True):
"""Aux function."""
return _soft_import('eeglabio', 'exporting to EEGLab', strict=strict) | [
"def",
"_check_eeglabio_installed",
"(",
"strict",
"=",
"True",
")",
":",
"return",
"_soft_import",
"(",
"'eeglabio'",
",",
"'exporting to EEGLab'",
",",
"strict",
"=",
"strict",
")"
] | https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/utils/check.py#L298-L300 | |
openembedded/openembedded-core | 9154f71c7267e9731156c1dfd57397103e9e6a2b | meta/lib/oe/path.py | python | find | (dir, **walkoptions) | Given a directory, recurses into that directory,
returning all files as absolute paths. | Given a directory, recurses into that directory,
returning all files as absolute paths. | [
"Given",
"a",
"directory",
"recurses",
"into",
"that",
"directory",
"returning",
"all",
"files",
"as",
"absolute",
"paths",
"."
] | def find(dir, **walkoptions):
""" Given a directory, recurses into that directory,
returning all files as absolute paths. """
for root, dirs, files in os.walk(dir, **walkoptions):
for file in files:
yield os.path.join(root, file) | [
"def",
"find",
"(",
"dir",
",",
"*",
"*",
"walkoptions",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"dir",
",",
"*",
"*",
"walkoptions",
")",
":",
"for",
"file",
"in",
"files",
":",
"yield",
"os",
".",
"pa... | https://github.com/openembedded/openembedded-core/blob/9154f71c7267e9731156c1dfd57397103e9e6a2b/meta/lib/oe/path.py#L172-L178 | ||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/bdf/cards/properties/shell.py | python | PSHELL.get_z_locations | (self) | return z | returns the locations of the bottom and top surface of the shell | returns the locations of the bottom and top surface of the shell | [
"returns",
"the",
"locations",
"of",
"the",
"bottom",
"and",
"top",
"surface",
"of",
"the",
"shell"
] | def get_z_locations(self) -> List[float]:
"""returns the locations of the bottom and top surface of the shell"""
z = np.array([self.z1, self.z2])
return z | [
"def",
"get_z_locations",
"(",
"self",
")",
"->",
"List",
"[",
"float",
"]",
":",
"z",
"=",
"np",
".",
"array",
"(",
"[",
"self",
".",
"z1",
",",
"self",
".",
"z2",
"]",
")",
"return",
"z"
] | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/cards/properties/shell.py#L2391-L2394 | |
Kozea/WeasyPrint | 6cce2978165134e37683cb5b3d156cac6a11a7f9 | weasyprint/css/validation/expanders.py | python | expander | (property_name) | return expander_decorator | Decorator adding a function to the ``EXPANDERS``. | Decorator adding a function to the ``EXPANDERS``. | [
"Decorator",
"adding",
"a",
"function",
"to",
"the",
"EXPANDERS",
"."
] | def expander(property_name):
"""Decorator adding a function to the ``EXPANDERS``."""
def expander_decorator(function):
"""Add ``function`` to the ``EXPANDERS``."""
assert property_name not in EXPANDERS, property_name
EXPANDERS[property_name] = function
return function
return ... | [
"def",
"expander",
"(",
"property_name",
")",
":",
"def",
"expander_decorator",
"(",
"function",
")",
":",
"\"\"\"Add ``function`` to the ``EXPANDERS``.\"\"\"",
"assert",
"property_name",
"not",
"in",
"EXPANDERS",
",",
"property_name",
"EXPANDERS",
"[",
"property_name",
... | https://github.com/Kozea/WeasyPrint/blob/6cce2978165134e37683cb5b3d156cac6a11a7f9/weasyprint/css/validation/expanders.py#L30-L37 | |
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/multiprocessing/process.py | python | Process.join | (self, timeout=None) | Wait until child process terminates | Wait until child process terminates | [
"Wait",
"until",
"child",
"process",
"terminates"
] | def join(self, timeout=None):
'''
Wait until child process terminates
'''
assert self._parent_pid == os.getpid(), 'can only join a child process'
assert self._popen is not None, 'can only join a started process'
res = self._popen.wait(timeout)
if res is not None:
... | [
"def",
"join",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"assert",
"self",
".",
"_parent_pid",
"==",
"os",
".",
"getpid",
"(",
")",
",",
"'can only join a child process'",
"assert",
"self",
".",
"_popen",
"is",
"not",
"None",
",",
"'can only join... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/multiprocessing/process.py#L139-L147 | ||
Esri/ArcREST | ab240fde2b0200f61d4a5f6df033516e53f2f416 | src/arcrest/agol/services.py | python | FeatureLayer.syncCanReturnChanges | (self) | return self._syncCanReturnChanges | returns the syncCanReturnChanges value | returns the syncCanReturnChanges value | [
"returns",
"the",
"syncCanReturnChanges",
"value"
] | def syncCanReturnChanges(self):
""" returns the syncCanReturnChanges value"""
if self._syncCanReturnChanges is None:
self.__init()
return self._syncCanReturnChanges | [
"def",
"syncCanReturnChanges",
"(",
"self",
")",
":",
"if",
"self",
".",
"_syncCanReturnChanges",
"is",
"None",
":",
"self",
".",
"__init",
"(",
")",
"return",
"self",
".",
"_syncCanReturnChanges"
] | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/agol/services.py#L1406-L1410 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/src/class/oc_adm_policy_group.py | python | PolicyGroup.perform | (self) | return self.openshift_cmd(cmd, oadm=True) | perform action on resource | perform action on resource | [
"perform",
"action",
"on",
"resource"
] | def perform(self):
'''perform action on resource'''
cmd = ['policy',
self.config.config_options['action']['value'],
self.config.config_options['name']['value'],
self.config.config_options['group']['value']]
if self.config.config_options['rolebinding_... | [
"def",
"perform",
"(",
"self",
")",
":",
"cmd",
"=",
"[",
"'policy'",
",",
"self",
".",
"config",
".",
"config_options",
"[",
"'action'",
"]",
"[",
"'value'",
"]",
",",
"self",
".",
"config",
".",
"config_options",
"[",
"'name'",
"]",
"[",
"'value'",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/src/class/oc_adm_policy_group.py#L153-L163 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/dns/rdatatype.py | python | is_singleton | (rdtype) | return False | Is the specified type a singleton type?
Singleton types can only have a single rdata in an rdataset, or a single
RR in an RRset.
The currently defined singleton types are CNAME, DNAME, NSEC, NXT, and
SOA.
*rdtype* is an ``int``.
Returns a ``bool``. | Is the specified type a singleton type? | [
"Is",
"the",
"specified",
"type",
"a",
"singleton",
"type?"
] | def is_singleton(rdtype):
"""Is the specified type a singleton type?
Singleton types can only have a single rdata in an rdataset, or a single
RR in an RRset.
The currently defined singleton types are CNAME, DNAME, NSEC, NXT, and
SOA.
*rdtype* is an ``int``.
Returns a ``bool``.
"""
... | [
"def",
"is_singleton",
"(",
"rdtype",
")",
":",
"if",
"rdtype",
"in",
"_singletons",
":",
"return",
"True",
"return",
"False"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dns/rdatatype.py#L188-L204 | |
JohnHammond/katana | 4f58537428dc6776b0dcb8a852f7ccdde87dbebe | katana/util.py | python | ellipsize | (data: str, length: int = 64) | return data | Ellipsize the string with a max-length of 64 characters | Ellipsize the string with a max-length of 64 characters | [
"Ellipsize",
"the",
"string",
"with",
"a",
"max",
"-",
"length",
"of",
"64",
"characters"
] | def ellipsize(data: str, length: int = 64) -> str:
""" Ellipsize the string with a max-length of 64 characters """
if isinstance(data, bytes):
data = repr(data)[2:-1]
data = data.split("\n")[0]
if len(data) > (length - 3):
data = data[: length - 3] + "..."
return data | [
"def",
"ellipsize",
"(",
"data",
":",
"str",
",",
"length",
":",
"int",
"=",
"64",
")",
"->",
"str",
":",
"if",
"isinstance",
"(",
"data",
",",
"bytes",
")",
":",
"data",
"=",
"repr",
"(",
"data",
")",
"[",
"2",
":",
"-",
"1",
"]",
"data",
"=... | https://github.com/JohnHammond/katana/blob/4f58537428dc6776b0dcb8a852f7ccdde87dbebe/katana/util.py#L46-L53 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/io/ga.py | python | GDataReader.get_web_property | (self, account_id=None, name=None, id=None, **kwargs) | return _get_match(prop_for_acct, name, id, **kwargs) | Retrieve a web property given and account and property name, id, or
custom attribute
Parameters
----------
account_id : str, optional, default: None
name : str, optional, default: None
id : str, optional, default: None | Retrieve a web property given and account and property name, id, or
custom attribute | [
"Retrieve",
"a",
"web",
"property",
"given",
"and",
"account",
"and",
"property",
"name",
"id",
"or",
"custom",
"attribute"
] | def get_web_property(self, account_id=None, name=None, id=None, **kwargs):
"""
Retrieve a web property given and account and property name, id, or
custom attribute
Parameters
----------
account_id : str, optional, default: None
name : str, optional, default: None... | [
"def",
"get_web_property",
"(",
"self",
",",
"account_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"prop_store",
"=",
"self",
".",
"service",
".",
"management",
"(",
")",
".",
"webproperties",
... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/io/ga.py#L200-L216 | |
libertysoft3/saidit | 271c7d03adb369f82921d811360b00812e42da24 | r2/r2/lib/providers/search/cloudsearch.py | python | CloudSearchUploader.xml_from_things | (self) | return batch | Generate a <batch> XML tree to send to cloudsearch for
adding/updating/deleting the given things | Generate a <batch> XML tree to send to cloudsearch for
adding/updating/deleting the given things | [
"Generate",
"a",
"<batch",
">",
"XML",
"tree",
"to",
"send",
"to",
"cloudsearch",
"for",
"adding",
"/",
"updating",
"/",
"deleting",
"the",
"given",
"things"
] | def xml_from_things(self):
'''Generate a <batch> XML tree to send to cloudsearch for
adding/updating/deleting the given things
'''
batch = etree.Element("batch")
self.batch_lookups()
version = self._version()
for thing in self.things:
try:
... | [
"def",
"xml_from_things",
"(",
"self",
")",
":",
"batch",
"=",
"etree",
".",
"Element",
"(",
"\"batch\"",
")",
"self",
".",
"batch_lookups",
"(",
")",
"version",
"=",
"self",
".",
"_version",
"(",
")",
"for",
"thing",
"in",
"self",
".",
"things",
":",
... | https://github.com/libertysoft3/saidit/blob/271c7d03adb369f82921d811360b00812e42da24/r2/r2/lib/providers/search/cloudsearch.py#L135-L163 | |
saltstack/raet | 54858029568115550c7cb7d93e999d9c52b1494a | raet/road/packeting.py | python | TxHead.packFlags | (self) | return packByte(fmt=b'11111111', fields=values) | Packs all the flag fields into a single two char hex string | Packs all the flag fields into a single two char hex string | [
"Packs",
"all",
"the",
"flag",
"fields",
"into",
"a",
"single",
"two",
"char",
"hex",
"string"
] | def packFlags(self):
'''
Packs all the flag fields into a single two char hex string
'''
values = []
for field in raeting.PACKET_FLAG_FIELDS:
values.append(1 if self.packet.data.get(field, 0) else 0)
return packByte(fmt=b'11111111', fields=values) | [
"def",
"packFlags",
"(",
"self",
")",
":",
"values",
"=",
"[",
"]",
"for",
"field",
"in",
"raeting",
".",
"PACKET_FLAG_FIELDS",
":",
"values",
".",
"append",
"(",
"1",
"if",
"self",
".",
"packet",
".",
"data",
".",
"get",
"(",
"field",
",",
"0",
")... | https://github.com/saltstack/raet/blob/54858029568115550c7cb7d93e999d9c52b1494a/raet/road/packeting.py#L152-L159 | |
plone/Products.CMFPlone | 83137764e3e7e4fe60d03c36dfc6ba9c7c543324 | Products/CMFPlone/exportimport/memberdata_properties.py | python | exportMemberDataProperties | (context) | Export MemberData tool properties . | Export MemberData tool properties . | [
"Export",
"MemberData",
"tool",
"properties",
"."
] | def exportMemberDataProperties(context):
""" Export MemberData tool properties .
"""
site = context.getSite()
logger = context.getLogger('memberdata')
ptool = getToolByName(site, 'portal_memberdata', None)
if ptool is None:
return
exporter = queryMultiAdapter((ptool, context), IBody... | [
"def",
"exportMemberDataProperties",
"(",
"context",
")",
":",
"site",
"=",
"context",
".",
"getSite",
"(",
")",
"logger",
"=",
"context",
".",
"getLogger",
"(",
"'memberdata'",
")",
"ptool",
"=",
"getToolByName",
"(",
"site",
",",
"'portal_memberdata'",
",",
... | https://github.com/plone/Products.CMFPlone/blob/83137764e3e7e4fe60d03c36dfc6ba9c7c543324/Products/CMFPlone/exportimport/memberdata_properties.py#L33-L48 | ||
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | lib/spack/external/jinja2/visitor.py | python | NodeVisitor.generic_visit | (self, node, *args, **kwargs) | Called if no explicit visitor function exists for a node. | Called if no explicit visitor function exists for a node. | [
"Called",
"if",
"no",
"explicit",
"visitor",
"function",
"exists",
"for",
"a",
"node",
"."
] | def generic_visit(self, node, *args, **kwargs):
"""Called if no explicit visitor function exists for a node."""
for node in node.iter_child_nodes():
self.visit(node, *args, **kwargs) | [
"def",
"generic_visit",
"(",
"self",
",",
"node",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"node",
"in",
"node",
".",
"iter_child_nodes",
"(",
")",
":",
"self",
".",
"visit",
"(",
"node",
",",
"*",
"args",
",",
"*",
"*",
"kwarg... | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/external/jinja2/visitor.py#L35-L38 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cheroot/server.py | python | HTTPConnection.peer_uid | (self) | return uid | Return the user id of the connected peer process. | Return the user id of the connected peer process. | [
"Return",
"the",
"user",
"id",
"of",
"the",
"connected",
"peer",
"process",
"."
] | def peer_uid(self):
"""Return the user id of the connected peer process."""
_, uid, _ = self.get_peer_creds()
return uid | [
"def",
"peer_uid",
"(",
"self",
")",
":",
"_",
",",
"uid",
",",
"_",
"=",
"self",
".",
"get_peer_creds",
"(",
")",
"return",
"uid"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cheroot/server.py#L1440-L1443 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/pydoc.py | python | TextDoc.indent | (self, text, prefix=' ') | return '\n'.join(lines) | Indent text by prepending a given prefix to each line. | Indent text by prepending a given prefix to each line. | [
"Indent",
"text",
"by",
"prepending",
"a",
"given",
"prefix",
"to",
"each",
"line",
"."
] | def indent(self, text, prefix=' '):
"""Indent text by prepending a given prefix to each line."""
if not text: return ''
lines = [prefix + line for line in text.split('\n')]
if lines: lines[-1] = lines[-1].rstrip()
return '\n'.join(lines) | [
"def",
"indent",
"(",
"self",
",",
"text",
",",
"prefix",
"=",
"' '",
")",
":",
"if",
"not",
"text",
":",
"return",
"''",
"lines",
"=",
"[",
"prefix",
"+",
"line",
"for",
"line",
"in",
"text",
".",
"split",
"(",
"'\\n'",
")",
"]",
"if",
"lines... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/pydoc.py#L1019-L1024 | |
robhagemans/pcbasic | c3a043b46af66623a801e18a38175be077251ada | pcbasic/basic/display/graphics.py | python | Graphics.point_ | (self, args) | POINT (1 argument): Return current coordinate
(2 arguments): Return the attribute of a pixel. | POINT (1 argument): Return current coordinate
(2 arguments): Return the attribute of a pixel. | [
"POINT",
"(",
"1",
"argument",
")",
":",
"Return",
"current",
"coordinate",
"(",
"2",
"arguments",
")",
":",
"Return",
"the",
"attribute",
"of",
"a",
"pixel",
"."
] | def point_(self, args):
"""
POINT (1 argument): Return current coordinate
(2 arguments): Return the attribute of a pixel.
"""
arg0 = next(args)
arg1 = next(args)
if arg1 is None:
arg0 = values.to_integer(arg0)
fn = values.to_int(arg0)
... | [
"def",
"point_",
"(",
"self",
",",
"args",
")",
":",
"arg0",
"=",
"next",
"(",
"args",
")",
"arg1",
"=",
"next",
"(",
"args",
")",
"if",
"arg1",
"is",
"None",
":",
"arg0",
"=",
"values",
".",
"to_integer",
"(",
"arg0",
")",
"fn",
"=",
"values",
... | https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/display/graphics.py#L1159-L1189 | ||
pyenchant/pyenchant | fc2a4a3fca6a55d510d01455b814aa27cdfc961e | enchant/__init__.py | python | Broker.__del__ | (self) | Broker object destructor. | Broker object destructor. | [
"Broker",
"object",
"destructor",
"."
] | def __del__(self) -> None:
"""Broker object destructor."""
# Calling free() might fail if python is shutting down
try:
self._free()
except (AttributeError, TypeError):
pass | [
"def",
"__del__",
"(",
"self",
")",
"->",
"None",
":",
"# Calling free() might fail if python is shutting down",
"try",
":",
"self",
".",
"_free",
"(",
")",
"except",
"(",
"AttributeError",
",",
"TypeError",
")",
":",
"pass"
] | https://github.com/pyenchant/pyenchant/blob/fc2a4a3fca6a55d510d01455b814aa27cdfc961e/enchant/__init__.py#L223-L229 | ||
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/_pydecimal.py | python | Decimal.__floor__ | (self) | return int(self._rescale(0, ROUND_FLOOR)) | Return the floor of self, as an integer.
For a finite Decimal instance self, return the greatest
integer n such that n <= self. If self is infinite or a NaN
then a Python exception is raised. | Return the floor of self, as an integer. | [
"Return",
"the",
"floor",
"of",
"self",
"as",
"an",
"integer",
"."
] | def __floor__(self):
"""Return the floor of self, as an integer.
For a finite Decimal instance self, return the greatest
integer n such that n <= self. If self is infinite or a NaN
then a Python exception is raised.
"""
if self._is_special:
if self.is_nan()... | [
"def",
"__floor__",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_special",
":",
"if",
"self",
".",
"is_nan",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"cannot round a NaN\"",
")",
"else",
":",
"raise",
"OverflowError",
"(",
"\"cannot round an infinity\"",... | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/_pydecimal.py#L1879-L1892 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/polynomial/polynomial.py | python | polyvander | (x, deg) | return np.rollaxis(v, 0, v.ndim) | Vandermonde matrix of given degree.
Returns the Vandermonde matrix of degree `deg` and sample points
`x`. The Vandermonde matrix is defined by
.. math:: V[..., i] = x^i,
where `0 <= i <= deg`. The leading indices of `V` index the elements of
`x` and the last index is the power of `x`.
If `c`... | Vandermonde matrix of given degree. | [
"Vandermonde",
"matrix",
"of",
"given",
"degree",
"."
] | def polyvander(x, deg) :
"""Vandermonde matrix of given degree.
Returns the Vandermonde matrix of degree `deg` and sample points
`x`. The Vandermonde matrix is defined by
.. math:: V[..., i] = x^i,
where `0 <= i <= deg`. The leading indices of `V` index the elements of
`x` and the last index ... | [
"def",
"polyvander",
"(",
"x",
",",
"deg",
")",
":",
"ideg",
"=",
"int",
"(",
"deg",
")",
"if",
"ideg",
"!=",
"deg",
":",
"raise",
"ValueError",
"(",
"\"deg must be integer\"",
")",
"if",
"ideg",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"deg must b... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/polynomial/polynomial.py#L1013-L1066 | |
hvac/hvac | ec048ded30d21c13c21cfa950d148c8bfc1467b0 | hvac/api/secrets_engines/identity.py | python | Identity.delete_entity_alias | (self, alias_id, mount_point=DEFAULT_MOUNT_POINT) | return self._adapter.delete(
url=api_path,
) | Delete a entity alias.
Supported methods:
DELETE: /{mount_point}/entity-alias/id/{alias_id}. Produces: 204 (empty body)
:param alias_id: Identifier of the entity.
:type alias_id: str | unicode
:param mount_point: The "path" the method/backend was mounted on.
:type m... | Delete a entity alias. | [
"Delete",
"a",
"entity",
"alias",
"."
] | def delete_entity_alias(self, alias_id, mount_point=DEFAULT_MOUNT_POINT):
"""Delete a entity alias.
Supported methods:
DELETE: /{mount_point}/entity-alias/id/{alias_id}. Produces: 204 (empty body)
:param alias_id: Identifier of the entity.
:type alias_id: str | unicode
... | [
"def",
"delete_entity_alias",
"(",
"self",
",",
"alias_id",
",",
"mount_point",
"=",
"DEFAULT_MOUNT_POINT",
")",
":",
"api_path",
"=",
"utils",
".",
"format_url",
"(",
"\"/v1/{mount_point}/entity-alias/id/{id}\"",
",",
"mount_point",
"=",
"mount_point",
",",
"id",
"... | https://github.com/hvac/hvac/blob/ec048ded30d21c13c21cfa950d148c8bfc1467b0/hvac/api/secrets_engines/identity.py#L522-L542 | |
abseil/abseil-py | a1c1af693b9f15bd0f67fe383cb05e7cc955556b | absl/logging/converter.py | python | get_initial_for_level | (level) | Gets the initial that should start the log line for the given level.
It returns:
- 'I' when: level < STANDARD_WARNING.
- 'W' when: STANDARD_WARNING <= level < STANDARD_ERROR.
- 'E' when: STANDARD_ERROR <= level < STANDARD_CRITICAL.
- 'F' when: level >= STANDARD_CRITICAL.
Args:
level: int, a Python sta... | Gets the initial that should start the log line for the given level. | [
"Gets",
"the",
"initial",
"that",
"should",
"start",
"the",
"log",
"line",
"for",
"the",
"given",
"level",
"."
] | def get_initial_for_level(level):
"""Gets the initial that should start the log line for the given level.
It returns:
- 'I' when: level < STANDARD_WARNING.
- 'W' when: STANDARD_WARNING <= level < STANDARD_ERROR.
- 'E' when: STANDARD_ERROR <= level < STANDARD_CRITICAL.
- 'F' when: level >= STANDARD_CRITICAL... | [
"def",
"get_initial_for_level",
"(",
"level",
")",
":",
"if",
"level",
"<",
"STANDARD_WARNING",
":",
"return",
"'I'",
"elif",
"level",
"<",
"STANDARD_ERROR",
":",
"return",
"'W'",
"elif",
"level",
"<",
"STANDARD_CRITICAL",
":",
"return",
"'E'",
"else",
":",
... | https://github.com/abseil/abseil-py/blob/a1c1af693b9f15bd0f67fe383cb05e7cc955556b/absl/logging/converter.py#L92-L114 | ||
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/handlers/e2e_keys.py | python | _check_device_signature | (
user_id: str,
verify_key: VerifyKey,
signed_device: JsonDict,
stored_device: JsonDict,
) | Check that a signature on a device or cross-signing key is correct and
matches the copy of the device/key that we have stored. Throws an
exception if an error is detected.
Args:
user_id: the user ID whose signature is being checked
verify_key: the key to verify the device with
sign... | Check that a signature on a device or cross-signing key is correct and
matches the copy of the device/key that we have stored. Throws an
exception if an error is detected. | [
"Check",
"that",
"a",
"signature",
"on",
"a",
"device",
"or",
"cross",
"-",
"signing",
"key",
"is",
"correct",
"and",
"matches",
"the",
"copy",
"of",
"the",
"device",
"/",
"key",
"that",
"we",
"have",
"stored",
".",
"Throws",
"an",
"exception",
"if",
"... | def _check_device_signature(
user_id: str,
verify_key: VerifyKey,
signed_device: JsonDict,
stored_device: JsonDict,
) -> None:
"""Check that a signature on a device or cross-signing key is correct and
matches the copy of the device/key that we have stored. Throws an
exception if an error is... | [
"def",
"_check_device_signature",
"(",
"user_id",
":",
"str",
",",
"verify_key",
":",
"VerifyKey",
",",
"signed_device",
":",
"JsonDict",
",",
"stored_device",
":",
"JsonDict",
",",
")",
"->",
"None",
":",
"# make sure that the device submitted matches what we have stor... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/handlers/e2e_keys.py#L1247-L1288 | ||
easyw/RF-tools-KiCAD | e42ea8e44d009e6ba6bd8cbf22a3f0a4df1aa5d8 | tracks_length/trace_length.py | python | find_Tracks_inNet_Pad | (pcb,pad) | return tracks_on_net | [] | def find_Tracks_inNet_Pad(pcb,pad):
track_list = []
# get list of all selected pads
#selected_pads = [pad1, pad2]
# get the net the pins are on
net = pad.GetNetname()
# find all tracks
tracks = pcb.GetTracks()
# find all tracks on net
tracks_on_net = []
for track in tracks:
... | [
"def",
"find_Tracks_inNet_Pad",
"(",
"pcb",
",",
"pad",
")",
":",
"track_list",
"=",
"[",
"]",
"# get list of all selected pads",
"#selected_pads = [pad1, pad2]",
"# get the net the pins are on",
"net",
"=",
"pad",
".",
"GetNetname",
"(",
")",
"# find all tracks ",
"tra... | https://github.com/easyw/RF-tools-KiCAD/blob/e42ea8e44d009e6ba6bd8cbf22a3f0a4df1aa5d8/tracks_length/trace_length.py#L319-L333 | |||
Gallopsled/pwntools | 1573957cc8b1957399b7cc9bfae0c6f80630d5d4 | pwnlib/elf/elf.py | python | ELF.segments | (self) | return list(self.iter_segments()) | :class:`list`: A list of :class:`elftools.elf.segments.Segment` objects
for the segments in the ELF. | :class:`list`: A list of :class:`elftools.elf.segments.Segment` objects
for the segments in the ELF. | [
":",
"class",
":",
"list",
":",
"A",
"list",
"of",
":",
"class",
":",
"elftools",
".",
"elf",
".",
"segments",
".",
"Segment",
"objects",
"for",
"the",
"segments",
"in",
"the",
"ELF",
"."
] | def segments(self):
"""
:class:`list`: A list of :class:`elftools.elf.segments.Segment` objects
for the segments in the ELF.
"""
return list(self.iter_segments()) | [
"def",
"segments",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"iter_segments",
"(",
")",
")"
] | https://github.com/Gallopsled/pwntools/blob/1573957cc8b1957399b7cc9bfae0c6f80630d5d4/pwnlib/elf/elf.py#L502-L507 | |
poliastro/poliastro | 6223a3f127ed730967a7091c4535100176a6c9e4 | src/poliastro/core/maneuver.py | python | correct_pericenter | (k, R, J2, max_delta_r, v, a, inc, ecc) | return delta_t, vf_ | Calculates the time before burning and the velocity vector in direction of the burn.
Parameters
----------
k: float
Standard Gravitational parameter
R: float
Radius of the attractor
J2: float
Oblateness factor
max_delta_r: float
Maximum satellite’s geocentric dis... | Calculates the time before burning and the velocity vector in direction of the burn. | [
"Calculates",
"the",
"time",
"before",
"burning",
"and",
"the",
"velocity",
"vector",
"in",
"direction",
"of",
"the",
"burn",
"."
] | def correct_pericenter(k, R, J2, max_delta_r, v, a, inc, ecc):
"""Calculates the time before burning and the velocity vector in direction of the burn.
Parameters
----------
k: float
Standard Gravitational parameter
R: float
Radius of the attractor
J2: float
Oblateness fa... | [
"def",
"correct_pericenter",
"(",
"k",
",",
"R",
",",
"J2",
",",
"max_delta_r",
",",
"v",
",",
"a",
",",
"inc",
",",
"ecc",
")",
":",
"p",
"=",
"a",
"*",
"(",
"1",
"-",
"ecc",
"**",
"2",
")",
"n",
"=",
"(",
"k",
"/",
"a",
"**",
"3",
")",
... | https://github.com/poliastro/poliastro/blob/6223a3f127ed730967a7091c4535100176a6c9e4/src/poliastro/core/maneuver.py#L145-L195 | |
AutodeskRoboticsLab/Mimic | 85447f0d346be66988303a6a054473d92f1ed6f4 | mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/graphicsItems/GraphItem.py | python | GraphItem.setData | (self, **kwds) | Change the data displayed by the graph.
============== =======================================================================
**Arguments:**
pos (N,2) array of the positions of each node in the graph.
adj (M,2) array of connection data. Each row contai... | Change the data displayed by the graph.
============== =======================================================================
**Arguments:**
pos (N,2) array of the positions of each node in the graph.
adj (M,2) array of connection data. Each row contai... | [
"Change",
"the",
"data",
"displayed",
"by",
"the",
"graph",
".",
"==============",
"=======================================================================",
"**",
"Arguments",
":",
"**",
"pos",
"(",
"N",
"2",
")",
"array",
"of",
"the",
"positions",
"of",
"each",
"n... | def setData(self, **kwds):
"""
Change the data displayed by the graph.
============== =======================================================================
**Arguments:**
pos (N,2) array of the positions of each node in the graph.
adj ... | [
"def",
"setData",
"(",
"self",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"'adj'",
"in",
"kwds",
":",
"self",
".",
"adjacency",
"=",
"kwds",
".",
"pop",
"(",
"'adj'",
")",
"if",
"self",
".",
"adjacency",
".",
"dtype",
".",
"kind",
"not",
"in",
"'iu'"... | https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/graphicsItems/GraphItem.py#L27-L73 | ||
fabioz/PyDev.Debugger | 0f8c02a010fe5690405da1dd30ed72326191ce63 | third_party/pep8/autopep8.py | python | fix_multiple_files | (filenames, options, output=None) | Fix list of files.
Optionally fix files recursively. | Fix list of files. | [
"Fix",
"list",
"of",
"files",
"."
] | def fix_multiple_files(filenames, options, output=None):
"""Fix list of files.
Optionally fix files recursively.
"""
filenames = find_files(filenames, options.recursive, options.exclude)
if options.jobs > 1:
import multiprocessing
pool = multiprocessing.Pool(options.jobs)
p... | [
"def",
"fix_multiple_files",
"(",
"filenames",
",",
"options",
",",
"output",
"=",
"None",
")",
":",
"filenames",
"=",
"find_files",
"(",
"filenames",
",",
"options",
".",
"recursive",
",",
"options",
".",
"exclude",
")",
"if",
"options",
".",
"jobs",
">",... | https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/third_party/pep8/autopep8.py#L3692-L3706 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/game_theory/matching_game.py | python | MatchingGame.add_reviewer | (self, name=None) | r"""
Add a reviewer to the game.
INPUT:
- ``name`` -- can be a string or number; if left blank will
automatically generate an integer
EXAMPLES:
Creating a two player game::
sage: g = MatchingGame(2)
sage: g.reviewers()
(-1, -2)
... | r"""
Add a reviewer to the game. | [
"r",
"Add",
"a",
"reviewer",
"to",
"the",
"game",
"."
] | def add_reviewer(self, name=None):
r"""
Add a reviewer to the game.
INPUT:
- ``name`` -- can be a string or number; if left blank will
automatically generate an integer
EXAMPLES:
Creating a two player game::
sage: g = MatchingGame(2)
... | [
"def",
"add_reviewer",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"-",
"len",
"(",
"self",
".",
"_reviewers",
")",
"-",
"1",
"while",
"name",
"in",
"self",
".",
"_reviewers",
":",
"name",
"-=",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/game_theory/matching_game.py#L743-L812 | ||
AnasAboureada/Penetration-Testing-Study-Notes | 8152fd609cf818dba2f07e060738a24c56221687 | scripts/sqldeli.py | python | printOptions | (node) | [] | def printOptions(node):
index = 0
for i in node:
index += 1
if i.get(VALUE):
print ("%i:\t%s" % (index, i.get(VALUE)))
elif i.get(QUERY):
print ("%s:%s%s" % (i.tag, (2 - int(len(i.tag)/8)) * "\t", i.get(QUERY)))
else:
print ("%i:\t%s" % (index,... | [
"def",
"printOptions",
"(",
"node",
")",
":",
"index",
"=",
"0",
"for",
"i",
"in",
"node",
":",
"index",
"+=",
"1",
"if",
"i",
".",
"get",
"(",
"VALUE",
")",
":",
"print",
"(",
"\"%i:\\t%s\"",
"%",
"(",
"index",
",",
"i",
".",
"get",
"(",
"VALU... | https://github.com/AnasAboureada/Penetration-Testing-Study-Notes/blob/8152fd609cf818dba2f07e060738a24c56221687/scripts/sqldeli.py#L77-L86 | ||||
xiepaup/dbatools | 8549f2571aaee6a39f5c6f32179ac9c5d301a9aa | mysqlTools/mysql_utilities/mysql/utilities/common/server.py | python | Server.is_alive | (self) | return res | Determine if connection to server is still alive.
Returns bool - True = alive, False = error or cannot connect. | Determine if connection to server is still alive.
Returns bool - True = alive, False = error or cannot connect. | [
"Determine",
"if",
"connection",
"to",
"server",
"is",
"still",
"alive",
".",
"Returns",
"bool",
"-",
"True",
"=",
"alive",
"False",
"=",
"error",
"or",
"cannot",
"connect",
"."
] | def is_alive(self):
"""Determine if connection to server is still alive.
Returns bool - True = alive, False = error or cannot connect.
"""
res = True
try:
if self.db_conn is None:
res = False
else:
# ping and is_con... | [
"def",
"is_alive",
"(",
"self",
")",
":",
"res",
"=",
"True",
"try",
":",
"if",
"self",
".",
"db_conn",
"is",
"None",
":",
"res",
"=",
"False",
"else",
":",
"# ping and is_connected only work partially, try exec_query",
"# to make sure connection is really alive",
"... | https://github.com/xiepaup/dbatools/blob/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/utilities/common/server.py#L474-L493 | |
pycom/pycom-libraries | 75d0e67cb421e0576a3a9677bb0d9d81f27ebdb7 | shields/lib/pycoproc_1.py | python | Pycoproc.get_sleep_remaining | (self) | return time_s | returns the remaining time from sleep, as an interrupt (wakeup source) might have triggered | returns the remaining time from sleep, as an interrupt (wakeup source) might have triggered | [
"returns",
"the",
"remaining",
"time",
"from",
"sleep",
"as",
"an",
"interrupt",
"(",
"wakeup",
"source",
")",
"might",
"have",
"triggered"
] | def get_sleep_remaining(self):
""" returns the remaining time from sleep, as an interrupt (wakeup source) might have triggered """
c3 = self.peek_memory(WAKE_REASON_ADDR + 3)
c2 = self.peek_memory(WAKE_REASON_ADDR + 2)
c1 = self.peek_memory(WAKE_REASON_ADDR + 1)
time_device_s = (... | [
"def",
"get_sleep_remaining",
"(",
"self",
")",
":",
"c3",
"=",
"self",
".",
"peek_memory",
"(",
"WAKE_REASON_ADDR",
"+",
"3",
")",
"c2",
"=",
"self",
".",
"peek_memory",
"(",
"WAKE_REASON_ADDR",
"+",
"2",
")",
"c1",
"=",
"self",
".",
"peek_memory",
"(",... | https://github.com/pycom/pycom-libraries/blob/75d0e67cb421e0576a3a9677bb0d9d81f27ebdb7/shields/lib/pycoproc_1.py#L192-L204 | |
mcneel/rhinoscriptsyntax | c49bd0bf24c2513bdcb84d1bf307144489600fd9 | Scripts/rhinoscript/layer.py | python | LayerPrintColor | (layer, color=None) | return rc | Returns or changes the print color of a layer. Layer print colors are
represented as RGB colors.
Parameters:
layer (str): name of existing layer
color (color): new print color
Returns:
color: if color is not specified, the current layer print color
color: if color is specified, the p... | Returns or changes the print color of a layer. Layer print colors are
represented as RGB colors.
Parameters:
layer (str): name of existing layer
color (color): new print color
Returns:
color: if color is not specified, the current layer print color
color: if color is specified, the p... | [
"Returns",
"or",
"changes",
"the",
"print",
"color",
"of",
"a",
"layer",
".",
"Layer",
"print",
"colors",
"are",
"represented",
"as",
"RGB",
"colors",
".",
"Parameters",
":",
"layer",
"(",
"str",
")",
":",
"name",
"of",
"existing",
"layer",
"color",
"(",... | def LayerPrintColor(layer, color=None):
"""Returns or changes the print color of a layer. Layer print colors are
represented as RGB colors.
Parameters:
layer (str): name of existing layer
color (color): new print color
Returns:
color: if color is not specified, the current layer print ... | [
"def",
"LayerPrintColor",
"(",
"layer",
",",
"color",
"=",
"None",
")",
":",
"layer",
"=",
"__getlayer",
"(",
"layer",
",",
"True",
")",
"rc",
"=",
"layer",
".",
"PlotColor",
"if",
"color",
":",
"color",
"=",
"rhutil",
".",
"coercecolor",
"(",
"color",... | https://github.com/mcneel/rhinoscriptsyntax/blob/c49bd0bf24c2513bdcb84d1bf307144489600fd9/Scripts/rhinoscript/layer.py#L725-L753 | |
pydata/xarray | 9226c7ac87b3eb246f7a7e49f8f0f23d68951624 | xarray/plot/plot.py | python | scatter | (
darray,
*args,
row=None,
col=None,
figsize=None,
aspect=None,
size=None,
ax=None,
hue=None,
hue_style=None,
x=None,
z=None,
xincrease=None,
yincrease=None,
xscale=None,
yscale=None,
xticks=None,
yticks=None,
xlim=None,
ylim=None,
add_... | return primitive | Scatter plot a DataArray along some coordinates.
Parameters
----------
darray : DataArray
Dataarray to plot.
x, y : str
Variable names for x, y axis.
hue: str, optional
Variable by which to color scattered points
hue_style: str, optional
Can be either 'discrete' ... | Scatter plot a DataArray along some coordinates. | [
"Scatter",
"plot",
"a",
"DataArray",
"along",
"some",
"coordinates",
"."
] | def scatter(
darray,
*args,
row=None,
col=None,
figsize=None,
aspect=None,
size=None,
ax=None,
hue=None,
hue_style=None,
x=None,
z=None,
xincrease=None,
yincrease=None,
xscale=None,
yscale=None,
xticks=None,
yticks=None,
xlim=None,
ylim=Non... | [
"def",
"scatter",
"(",
"darray",
",",
"*",
"args",
",",
"row",
"=",
"None",
",",
"col",
"=",
"None",
",",
"figsize",
"=",
"None",
",",
"aspect",
"=",
"None",
",",
"size",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"hue",
"=",
"None",
",",
"hue_s... | https://github.com/pydata/xarray/blob/9226c7ac87b3eb246f7a7e49f8f0f23d68951624/xarray/plot/plot.py#L567-L849 | |
johnroper100/CrowdMaster | dfd72c424c8cc8d1877830ff9dd2e00226f518c3 | cm_generation/cm_templates.py | python | GeoTemplate.build | (self, buildRequest) | Called when this GeoTemplate is being used to modify the scene | Called when this GeoTemplate is being used to modify the scene | [
"Called",
"when",
"this",
"GeoTemplate",
"is",
"being",
"used",
"to",
"modify",
"the",
"scene"
] | def build(self, buildRequest):
"""Called when this GeoTemplate is being used to modify the scene"""
pass | [
"def",
"build",
"(",
"self",
",",
"buildRequest",
")",
":",
"pass"
] | https://github.com/johnroper100/CrowdMaster/blob/dfd72c424c8cc8d1877830ff9dd2e00226f518c3/cm_generation/cm_templates.py#L111-L113 | ||
awslabs/dgl-ke | e9d4f4916f570d2c9f2e1aa3bdec9196c68120e5 | python/dglke/models/ke_model.py | python | BasicGEModel.fit | (self) | Start training | Start training | [
"Start",
"training"
] | def fit(self):
""" Start training
"""
assert False, 'Not support training now' | [
"def",
"fit",
"(",
"self",
")",
":",
"assert",
"False",
",",
"'Not support training now'"
] | https://github.com/awslabs/dgl-ke/blob/e9d4f4916f570d2c9f2e1aa3bdec9196c68120e5/python/dglke/models/ke_model.py#L117-L120 | ||
PythonJS/PythonJS | 591a80afd8233fb715493591db2b68f1748558d9 | pythonjs/lib/python2.7/posixpath.py | python | expandvars | (path) | return path | Expand shell variables of form $var and ${var}. Unknown variables
are left unchanged. | Expand shell variables of form $var and ${var}. Unknown variables
are left unchanged. | [
"Expand",
"shell",
"variables",
"of",
"form",
"$var",
"and",
"$",
"{",
"var",
"}",
".",
"Unknown",
"variables",
"are",
"left",
"unchanged",
"."
] | def expandvars(path):
"""Expand shell variables of form $var and ${var}. Unknown variables
are left unchanged."""
global _varprog
if '$' not in path:
return path
if not _varprog:
import re
_varprog = re.compile(r'\$(\w+|\{[^}]*\})')
i = 0
while True:
m = _var... | [
"def",
"expandvars",
"(",
"path",
")",
":",
"global",
"_varprog",
"if",
"'$'",
"not",
"in",
"path",
":",
"return",
"path",
"if",
"not",
"_varprog",
":",
"import",
"re",
"_varprog",
"=",
"re",
".",
"compile",
"(",
"r'\\$(\\w+|\\{[^}]*\\})'",
")",
"i",
"="... | https://github.com/PythonJS/PythonJS/blob/591a80afd8233fb715493591db2b68f1748558d9/pythonjs/lib/python2.7/posixpath.py#L280-L305 | |
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/polys/solvers.py | python | sympy_eqs_to_ring | (eqs, symbols) | return eqs_K, K.to_domain() | Convert a system of equations from Expr to a PolyRing
Explanation
===========
High-level functions like ``solve`` expect Expr as inputs but can use
``solve_lin_sys`` internally. This function converts equations from
``Expr`` to the low-level poly types used by the ``solve_lin_sys``
function.
... | Convert a system of equations from Expr to a PolyRing | [
"Convert",
"a",
"system",
"of",
"equations",
"from",
"Expr",
"to",
"a",
"PolyRing"
] | def sympy_eqs_to_ring(eqs, symbols):
"""Convert a system of equations from Expr to a PolyRing
Explanation
===========
High-level functions like ``solve`` expect Expr as inputs but can use
``solve_lin_sys`` internally. This function converts equations from
``Expr`` to the low-level poly types u... | [
"def",
"sympy_eqs_to_ring",
"(",
"eqs",
",",
"symbols",
")",
":",
"try",
":",
"K",
",",
"eqs_K",
"=",
"sring",
"(",
"eqs",
",",
"symbols",
",",
"field",
"=",
"True",
",",
"extension",
"=",
"True",
")",
"except",
"NotInvertible",
":",
"# https://github.co... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/polys/solvers.py#L127-L179 | |
plastex/plastex | af1628719b50cf25fbe80f16a3e100d566e9bc32 | plasTeX/Context.py | python | Context.loadPackage | (self, tex: TeX, file_name: str, options: Optional[Dict] = None) | return False | Load a Python or LaTeX package
A Python version of the package is searched for first,
if one cannot be found then a LaTeX version of the package
is searched for if config['general']['load-tex-packages']
is True, or the package has been white-listed in
config['general']['tex-pack... | Load a Python or LaTeX package | [
"Load",
"a",
"Python",
"or",
"LaTeX",
"package"
] | def loadPackage(self, tex: TeX, file_name: str, options: Optional[Dict] = None) -> bool:
"""
Load a Python or LaTeX package
A Python version of the package is searched for first,
if one cannot be found then a LaTeX version of the package
is searched for if config['general']['loa... | [
"def",
"loadPackage",
"(",
"self",
",",
"tex",
":",
"TeX",
",",
"file_name",
":",
"str",
",",
"options",
":",
"Optional",
"[",
"Dict",
"]",
"=",
"None",
")",
"->",
"bool",
":",
"config",
"=",
"tex",
".",
"ownerDocument",
".",
"config",
"working_dir",
... | https://github.com/plastex/plastex/blob/af1628719b50cf25fbe80f16a3e100d566e9bc32/plasTeX/Context.py#L382-L513 | |
researchmm/tasn | 5dba8ccc096cedc63913730eeea14a9647911129 | tasn-mxnet/benchmark/python/sparse/dot.py | python | test_dot_synthetic | (data_dict) | benchmark sparse mxnet dot and scipy dot operator with matrices of given density.
`t_sparse` is the runtime of the invoked sparse dot operator in ms, while `t_dense` is the
runtime of dot(dns, dns), with the same matrices except that they are in default storage type. | benchmark sparse mxnet dot and scipy dot operator with matrices of given density.
`t_sparse` is the runtime of the invoked sparse dot operator in ms, while `t_dense` is the
runtime of dot(dns, dns), with the same matrices except that they are in default storage type. | [
"benchmark",
"sparse",
"mxnet",
"dot",
"and",
"scipy",
"dot",
"operator",
"with",
"matrices",
"of",
"given",
"density",
".",
"t_sparse",
"is",
"the",
"runtime",
"of",
"the",
"invoked",
"sparse",
"dot",
"operator",
"in",
"ms",
"while",
"t_dense",
"is",
"the",... | def test_dot_synthetic(data_dict):
"""benchmark sparse mxnet dot and scipy dot operator with matrices of given density.
`t_sparse` is the runtime of the invoked sparse dot operator in ms, while `t_dense` is the
runtime of dot(dns, dns), with the same matrices except that they are in default storage type.
... | [
"def",
"test_dot_synthetic",
"(",
"data_dict",
")",
":",
"# Benchmark MXNet and Scipys dot operator",
"def",
"bench_dot",
"(",
"lhs_shape",
",",
"rhs_shape",
",",
"lhs_stype",
",",
"rhs_stype",
",",
"lhs_den",
",",
"rhs_den",
",",
"trans_lhs",
",",
"ctx",
",",
"nu... | https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/benchmark/python/sparse/dot.py#L262-L455 | ||
Fallen-Breath/MCDReforged | fdb1d2520b35f916123f265dbd94603981bb2b0c | mcdreforged/translation/translation_text.py | python | RTextMCDRTranslation.set_styles | (self, styles: Union[RStyle, Iterable[RStyle]]) | return self | [] | def set_styles(self, styles: Union[RStyle, Iterable[RStyle]]) -> 'RTextBase':
self.__post_process.append(lambda rt: rt.set_styles(styles))
return self | [
"def",
"set_styles",
"(",
"self",
",",
"styles",
":",
"Union",
"[",
"RStyle",
",",
"Iterable",
"[",
"RStyle",
"]",
"]",
")",
"->",
"'RTextBase'",
":",
"self",
".",
"__post_process",
".",
"append",
"(",
"lambda",
"rt",
":",
"rt",
".",
"set_styles",
"(",... | https://github.com/Fallen-Breath/MCDReforged/blob/fdb1d2520b35f916123f265dbd94603981bb2b0c/mcdreforged/translation/translation_text.py#L81-L83 | |||
evhub/coconut | 27a4af9dc06667870f736f20c862930001b8cbb2 | coconut/compiler/matching.py | python | Matcher.using_python_rules | (self) | return self.style.startswith("python") | Whether the current style uses PEP 622 rules. | Whether the current style uses PEP 622 rules. | [
"Whether",
"the",
"current",
"style",
"uses",
"PEP",
"622",
"rules",
"."
] | def using_python_rules(self):
"""Whether the current style uses PEP 622 rules."""
return self.style.startswith("python") | [
"def",
"using_python_rules",
"(",
"self",
")",
":",
"return",
"self",
".",
"style",
".",
"startswith",
"(",
"\"python\"",
")"
] | https://github.com/evhub/coconut/blob/27a4af9dc06667870f736f20c862930001b8cbb2/coconut/compiler/matching.py#L211-L213 | |
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | pkg_resources/_vendor/pyparsing.py | python | ParserElement.__sub__ | (self, other) | return self + And._ErrorStop() + other | Implementation of - operator, returns C{L{And}} with error stop | Implementation of - operator, returns C{L{And}} with error stop | [
"Implementation",
"of",
"-",
"operator",
"returns",
"C",
"{",
"L",
"{",
"And",
"}}",
"with",
"error",
"stop"
] | def __sub__(self, other):
"""
Implementation of - operator, returns C{L{And}} with error stop
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combin... | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/pkg_resources/_vendor/pyparsing.py#L1853-L1863 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/simulators/simulator.py | python | Simulator.get_link_world_angular_velocities | (self, body_id, link_ids) | Return the angular velocity of the link(s) in the Cartesian world space coordinates.
Args:
body_id (int): unique body id.
link_ids (int, list[int]): link index, or list of link indices.
Returns:
if 1 link:
np.array[float[3]]: angular velocity of the ... | Return the angular velocity of the link(s) in the Cartesian world space coordinates. | [
"Return",
"the",
"angular",
"velocity",
"of",
"the",
"link",
"(",
"s",
")",
"in",
"the",
"Cartesian",
"world",
"space",
"coordinates",
"."
] | def get_link_world_angular_velocities(self, body_id, link_ids):
"""
Return the angular velocity of the link(s) in the Cartesian world space coordinates.
Args:
body_id (int): unique body id.
link_ids (int, list[int]): link index, or list of link indices.
Returns:... | [
"def",
"get_link_world_angular_velocities",
"(",
"self",
",",
"body_id",
",",
"link_ids",
")",
":",
"pass"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/simulator.py#L1563-L1577 | ||
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/gui/qt4ui/Conversation.py | python | Conversation.set_sensitive | (self, is_sensitive, force_sensitive_block_button=False) | used to make the conversation insensitive while the conversation
is still open while the user is disconnected and to set it back to
sensitive when the user is reconnected | used to make the conversation insensitive while the conversation
is still open while the user is disconnected and to set it back to
sensitive when the user is reconnected | [
"used",
"to",
"make",
"the",
"conversation",
"insensitive",
"while",
"the",
"conversation",
"is",
"still",
"open",
"while",
"the",
"user",
"is",
"disconnected",
"and",
"to",
"set",
"it",
"back",
"to",
"sensitive",
"when",
"the",
"user",
"is",
"reconnected"
] | def set_sensitive(self, is_sensitive, force_sensitive_block_button=False):
"""
used to make the conversation insensitive while the conversation
is still open while the user is disconnected and to set it back to
sensitive when the user is reconnected
"""
self.info.set_sens... | [
"def",
"set_sensitive",
"(",
"self",
",",
"is_sensitive",
",",
"force_sensitive_block_button",
"=",
"False",
")",
":",
"self",
".",
"info",
".",
"set_sensitive",
"(",
"is_sensitive",
"or",
"force_sensitive_block_button",
")",
"self",
".",
"toolbar",
".",
"set_sens... | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/gui/qt4ui/Conversation.py#L299-L312 | ||
hubblestack/hubble | 763142474edcecdec5fd25591dc29c3536e8f969 | hubblestack/files/hubblestack_nova/win_secedit.py | python | apply_labels | (__data__, labels) | return labelled_data | Filters out the tests whose label doesn't match the labels given when running audit and returns a new data structure with only labelled tests. | Filters out the tests whose label doesn't match the labels given when running audit and returns a new data structure with only labelled tests. | [
"Filters",
"out",
"the",
"tests",
"whose",
"label",
"doesn",
"t",
"match",
"the",
"labels",
"given",
"when",
"running",
"audit",
"and",
"returns",
"a",
"new",
"data",
"structure",
"with",
"only",
"labelled",
"tests",
"."
] | def apply_labels(__data__, labels):
"""
Filters out the tests whose label doesn't match the labels given when running audit and returns a new data structure with only labelled tests.
"""
labelled_data = {}
if labels:
labelled_data[__virtualname__] = {}
for topkey in ('blacklist', 'wh... | [
"def",
"apply_labels",
"(",
"__data__",
",",
"labels",
")",
":",
"labelled_data",
"=",
"{",
"}",
"if",
"labels",
":",
"labelled_data",
"[",
"__virtualname__",
"]",
"=",
"{",
"}",
"for",
"topkey",
"in",
"(",
"'blacklist'",
",",
"'whitelist'",
")",
":",
"i... | https://github.com/hubblestack/hubble/blob/763142474edcecdec5fd25591dc29c3536e8f969/hubblestack/files/hubblestack_nova/win_secedit.py#L29-L48 | |
kamalgill/flask-appengine-template | 11760f83faccbb0d0afe416fc58e67ecfb4643c2 | src/pkg_resources.py | python | Distribution.activate | (self,path=None) | Ensure distribution is importable on `path` (default=sys.path) | Ensure distribution is importable on `path` (default=sys.path) | [
"Ensure",
"distribution",
"is",
"importable",
"on",
"path",
"(",
"default",
"=",
"sys",
".",
"path",
")"
] | def activate(self,path=None):
"""Ensure distribution is importable on `path` (default=sys.path)"""
if path is None: path = sys.path
self.insert_on(path)
if path is sys.path:
fixup_namespace_packages(self.location)
map(declare_namespace, self._get_metadata('namespa... | [
"def",
"activate",
"(",
"self",
",",
"path",
"=",
"None",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"sys",
".",
"path",
"self",
".",
"insert_on",
"(",
"path",
")",
"if",
"path",
"is",
"sys",
".",
"path",
":",
"fixup_namespace_packages",... | https://github.com/kamalgill/flask-appengine-template/blob/11760f83faccbb0d0afe416fc58e67ecfb4643c2/src/pkg_resources.py#L2174-L2180 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | common/lib/xmodule/xmodule/modulestore/mongo/base.py | python | MongoModuleStore._course_key_to_son | (course_id, tag='i4x') | return SON([
('_id.tag', tag),
('_id.org', course_id.org),
('_id.course', course_id.course),
]) | Generate the partial key to look up items relative to a given course | Generate the partial key to look up items relative to a given course | [
"Generate",
"the",
"partial",
"key",
"to",
"look",
"up",
"items",
"relative",
"to",
"a",
"given",
"course"
] | def _course_key_to_son(course_id, tag='i4x'):
"""
Generate the partial key to look up items relative to a given course
"""
return SON([
('_id.tag', tag),
('_id.org', course_id.org),
('_id.course', course_id.course),
]) | [
"def",
"_course_key_to_son",
"(",
"course_id",
",",
"tag",
"=",
"'i4x'",
")",
":",
"return",
"SON",
"(",
"[",
"(",
"'_id.tag'",
",",
"tag",
")",
",",
"(",
"'_id.org'",
",",
"course_id",
".",
"org",
")",
",",
"(",
"'_id.course'",
",",
"course_id",
".",
... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/modulestore/mongo/base.py#L1173-L1181 | |
intrig-unicamp/mininet-wifi | 3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba | mn_wifi/node.py | python | Node_wifi.addWIntf | (self, intf, port=None) | Add an interface.
intf: interface
port: port number (optional, typically OpenFlow port number)
moveIntfFn: function to move interface (optional) | Add an interface.
intf: interface
port: port number (optional, typically OpenFlow port number)
moveIntfFn: function to move interface (optional) | [
"Add",
"an",
"interface",
".",
"intf",
":",
"interface",
"port",
":",
"port",
"number",
"(",
"optional",
"typically",
"OpenFlow",
"port",
"number",
")",
"moveIntfFn",
":",
"function",
"to",
"move",
"interface",
"(",
"optional",
")"
] | def addWIntf(self, intf, port=None):
"""Add an interface.
intf: interface
port: port number (optional, typically OpenFlow port number)
moveIntfFn: function to move interface (optional)"""
if port is None: port = self.newPort()
self.intfs[port] = intf
self... | [
"def",
"addWIntf",
"(",
"self",
",",
"intf",
",",
"port",
"=",
"None",
")",
":",
"if",
"port",
"is",
"None",
":",
"port",
"=",
"self",
".",
"newPort",
"(",
")",
"self",
".",
"intfs",
"[",
"port",
"]",
"=",
"intf",
"self",
".",
"ports",
"[",
"in... | https://github.com/intrig-unicamp/mininet-wifi/blob/3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba/mn_wifi/node.py#L335-L345 | ||
ambujraj/hacktoberfest2018 | 53df2cac8b3404261131a873352ec4f2ffa3544d | MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_hooks | (self, hooks) | Prepares the given hooks. | Prepares the given hooks. | [
"Prepares",
"the",
"given",
"hooks",
"."
] | def prepare_hooks(self, hooks):
"""Prepares the given hooks."""
# hooks can be passed as None to the prepare method and to this
# method. To prevent iterating over None, simply use an empty list
# if hooks is False-y
hooks = hooks or []
for event in hooks:
sel... | [
"def",
"prepare_hooks",
"(",
"self",
",",
"hooks",
")",
":",
"# hooks can be passed as None to the prepare method and to this",
"# method. To prevent iterating over None, simply use an empty list",
"# if hooks is False-y",
"hooks",
"=",
"hooks",
"or",
"[",
"]",
"for",
"event",
... | https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/models.py#L568-L575 | ||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/wallet.py | python | Imported_Wallet.get_fingerprint | (self) | return '' | [] | def get_fingerprint(self):
return '' | [
"def",
"get_fingerprint",
"(",
"self",
")",
":",
"return",
"''"
] | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/wallet.py#L2708-L2709 | |||
JakubSochor/BoxCars | 8757b8b36857259cc6549fe4a62cca9861ca098d | lib/boxcars_dataset.py | python | BoxCarsDataset.load_classification_split | (self, split_name) | [] | def load_classification_split(self, split_name):
self.split = load_cache(BOXCARS_CLASSIFICATION_SPLITS)[split_name]
self.split_name = split_name | [
"def",
"load_classification_split",
"(",
"self",
",",
"split_name",
")",
":",
"self",
".",
"split",
"=",
"load_cache",
"(",
"BOXCARS_CLASSIFICATION_SPLITS",
")",
"[",
"split_name",
"]",
"self",
".",
"split_name",
"=",
"split_name"
] | https://github.com/JakubSochor/BoxCars/blob/8757b8b36857259cc6549fe4a62cca9861ca098d/lib/boxcars_dataset.py#L35-L37 | ||||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/nltk/chunk/regexp.py | python | UnChunkRule.__repr__ | (self) | return '<UnChunkRule: '+`self._pattern`+'>' | Return a string representation of this rule. It has the form::
<UnChunkRule: '<IN|VB.*>'>
Note that this representation does not include the
description string; that string can be accessed
separately with the ``descr()`` method.
:rtype: str | Return a string representation of this rule. It has the form:: | [
"Return",
"a",
"string",
"representation",
"of",
"this",
"rule",
".",
"It",
"has",
"the",
"form",
"::"
] | def __repr__(self):
"""
Return a string representation of this rule. It has the form::
<UnChunkRule: '<IN|VB.*>'>
Note that this representation does not include the
description string; that string can be accessed
separately with the ``descr()`` method.
:rt... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<UnChunkRule: '",
"+",
"`self._pattern`",
"+",
"'>'"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/chunk/regexp.py#L490-L502 | |
linkedin/qark | ba1b26562507d631389b111e5033dad4128a8541 | qark/plugins/webview/set_allow_file_access.py | python | SetAllowFileAccess.run | (self) | [] | def run(self):
self.issues.extend(webview_default_vulnerable(self.java_ast, method_name="setAllowFileAccess", issue_name=self.name,
description=self.description, file_object=self.file_path,
severity=self.... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"issues",
".",
"extend",
"(",
"webview_default_vulnerable",
"(",
"self",
".",
"java_ast",
",",
"method_name",
"=",
"\"setAllowFileAccess\"",
",",
"issue_name",
"=",
"self",
".",
"name",
",",
"description",
"=... | https://github.com/linkedin/qark/blob/ba1b26562507d631389b111e5033dad4128a8541/qark/plugins/webview/set_allow_file_access.py#L25-L28 | ||||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/addons/browser/model.py | python | DXFTagsModel.compiled_tags | (self) | return self._tags | Returns the compiled tags. Only points codes are compiled, group
code 10, ... | Returns the compiled tags. Only points codes are compiled, group
code 10, ... | [
"Returns",
"the",
"compiled",
"tags",
".",
"Only",
"points",
"codes",
"are",
"compiled",
"group",
"code",
"10",
"..."
] | def compiled_tags(self) -> Tags:
"""Returns the compiled tags. Only points codes are compiled, group
code 10, ...
"""
return self._tags | [
"def",
"compiled_tags",
"(",
"self",
")",
"->",
"Tags",
":",
"return",
"self",
".",
"_tags"
] | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/addons/browser/model.py#L111-L115 | |
idanr1986/cuckoo-droid | 1350274639473d3d2b0ac740cae133ca53ab7444 | analyzer/android_on_linux/lib/api/androguard/dvm.py | python | EncodedMethod.add_note | (self, msg) | Add a message to this method
:param msg: the message
:type msg: string | Add a message to this method | [
"Add",
"a",
"message",
"to",
"this",
"method"
] | def add_note(self, msg) :
"""
Add a message to this method
:param msg: the message
:type msg: string
"""
self.notes.append( msg ) | [
"def",
"add_note",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"notes",
".",
"append",
"(",
"msg",
")"
] | https://github.com/idanr1986/cuckoo-droid/blob/1350274639473d3d2b0ac740cae133ca53ab7444/analyzer/android_on_linux/lib/api/androguard/dvm.py#L2898-L2905 | ||
poodarchu/Det3D | 01258d8cb26656c5b950f8d41f9dcc1dd62a391e | det3d/ops/roipool3d/roipool3d_utils.py | python | pts_in_boxes3d_cpu | (pts, boxes3d) | :param pts: (N, 3) in rect-camera coords
:param boxes3d: (M, 7)
:return: boxes_pts_mask_list: (M), list with [(N), (N), ..] | :param pts: (N, 3) in rect-camera coords
:param boxes3d: (M, 7)
:return: boxes_pts_mask_list: (M), list with [(N), (N), ..] | [
":",
"param",
"pts",
":",
"(",
"N",
"3",
")",
"in",
"rect",
"-",
"camera",
"coords",
":",
"param",
"boxes3d",
":",
"(",
"M",
"7",
")",
":",
"return",
":",
"boxes_pts_mask_list",
":",
"(",
"M",
")",
"list",
"with",
"[",
"(",
"N",
")",
"(",
"N",
... | def pts_in_boxes3d_cpu(pts, boxes3d):
"""
:param pts: (N, 3) in rect-camera coords
:param boxes3d: (M, 7)
:return: boxes_pts_mask_list: (M), list with [(N), (N), ..]
"""
if not pts.is_cuda:
pts = pts.float().contiguous()
boxes3d = boxes3d.float().contiguous()
pts_flag = t... | [
"def",
"pts_in_boxes3d_cpu",
"(",
"pts",
",",
"boxes3d",
")",
":",
"if",
"not",
"pts",
".",
"is_cuda",
":",
"pts",
"=",
"pts",
".",
"float",
"(",
")",
".",
"contiguous",
"(",
")",
"boxes3d",
"=",
"boxes3d",
".",
"float",
"(",
")",
".",
"contiguous",
... | https://github.com/poodarchu/Det3D/blob/01258d8cb26656c5b950f8d41f9dcc1dd62a391e/det3d/ops/roipool3d/roipool3d_utils.py#L45-L65 | ||
pillone/usntssearch | 24b5e5bc4b6af2589d95121c4d523dc58cb34273 | NZBmegasearch/werkzeug/urls.py | python | url_quote | (s, charset='utf-8', safe='/:') | return _quote(s, safe=safe) | URL encode a single string with a given encoding.
:param s: the string to quote.
:param charset: the charset to be used.
:param safe: an optional sequence of safe characters. | URL encode a single string with a given encoding. | [
"URL",
"encode",
"a",
"single",
"string",
"with",
"a",
"given",
"encoding",
"."
] | def url_quote(s, charset='utf-8', safe='/:'):
"""URL encode a single string with a given encoding.
:param s: the string to quote.
:param charset: the charset to be used.
:param safe: an optional sequence of safe characters.
"""
if isinstance(s, unicode):
s = s.encode(charset)
elif n... | [
"def",
"url_quote",
"(",
"s",
",",
"charset",
"=",
"'utf-8'",
",",
"safe",
"=",
"'/:'",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"unicode",
")",
":",
"s",
"=",
"s",
".",
"encode",
"(",
"charset",
")",
"elif",
"not",
"isinstance",
"(",
"s",
",... | https://github.com/pillone/usntssearch/blob/24b5e5bc4b6af2589d95121c4d523dc58cb34273/NZBmegasearch/werkzeug/urls.py#L369-L380 | |
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/tf/util/basic.py | python | enforce_copy | (x) | :param tf.Tensor|tf.Variable x:
:return: copy of input, i.e. enforces that this is not a ref
:rtype: tf.Tensor | :param tf.Tensor|tf.Variable x:
:return: copy of input, i.e. enforces that this is not a ref
:rtype: tf.Tensor | [
":",
"param",
"tf",
".",
"Tensor|tf",
".",
"Variable",
"x",
":",
":",
"return",
":",
"copy",
"of",
"input",
"i",
".",
"e",
".",
"enforces",
"that",
"this",
"is",
"not",
"a",
"ref",
":",
"rtype",
":",
"tf",
".",
"Tensor"
] | def enforce_copy(x):
"""
:param tf.Tensor|tf.Variable x:
:return: copy of input, i.e. enforces that this is not a ref
:rtype: tf.Tensor
"""
with tf.name_scope("copy"):
zero = x.dtype.as_numpy_dtype()
return tf.add(x, zero) | [
"def",
"enforce_copy",
"(",
"x",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"copy\"",
")",
":",
"zero",
"=",
"x",
".",
"dtype",
".",
"as_numpy_dtype",
"(",
")",
"return",
"tf",
".",
"add",
"(",
"x",
",",
"zero",
")"
] | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/tf/util/basic.py#L4228-L4236 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/minio/__init__.py | python | QueueListener.run | (self) | Listen to queue events, and forward them to Home Assistant event bus. | Listen to queue events, and forward them to Home Assistant event bus. | [
"Listen",
"to",
"queue",
"events",
"and",
"forward",
"them",
"to",
"Home",
"Assistant",
"event",
"bus",
"."
] | def run(self):
"""Listen to queue events, and forward them to Home Assistant event bus."""
_LOGGER.info("Running QueueListener")
while True:
if (event := self._queue.get()) is None:
break
_, file_name = os.path.split(event[ATTR_KEY])
_LOGGER.... | [
"def",
"run",
"(",
"self",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Running QueueListener\"",
")",
"while",
"True",
":",
"if",
"(",
"event",
":=",
"self",
".",
"_queue",
".",
"get",
"(",
")",
")",
"is",
"None",
":",
"break",
"_",
",",
"file_name",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/minio/__init__.py#L184-L199 | ||
Unidata/siphon | d8ede355114801bf7a05db20dfe49ab132723f86 | src/siphon/cdmr/xarray_support.py | python | CDMArrayWrapper.get_array | (self) | return self.datastore.ds.variables[self.variable_name] | Get the actual array data from CDM Remote. | Get the actual array data from CDM Remote. | [
"Get",
"the",
"actual",
"array",
"data",
"from",
"CDM",
"Remote",
"."
] | def get_array(self):
"""Get the actual array data from CDM Remote."""
return self.datastore.ds.variables[self.variable_name] | [
"def",
"get_array",
"(",
"self",
")",
":",
"return",
"self",
".",
"datastore",
".",
"ds",
".",
"variables",
"[",
"self",
".",
"variable_name",
"]"
] | https://github.com/Unidata/siphon/blob/d8ede355114801bf7a05db20dfe49ab132723f86/src/siphon/cdmr/xarray_support.py#L29-L31 | |
anyant/rssant | effeb5b01fd6ae8e53516ad919a8275ef47ccbcc | actorlib/node.py | python | ActorNode.ask | (self, dst, content=None, dst_node=None) | return self.client.ask(msg) | Send request and wait response | Send request and wait response | [
"Send",
"request",
"and",
"wait",
"response"
] | def ask(self, dst, content=None, dst_node=None):
"""Send request and wait response"""
if not dst_node:
dst_node = self.registery.choice_dst_node(dst)
msg = self.registery.create_message(
is_ask=True,
content=content,
src=ACTOR_SYSTEM,
d... | [
"def",
"ask",
"(",
"self",
",",
"dst",
",",
"content",
"=",
"None",
",",
"dst_node",
"=",
"None",
")",
":",
"if",
"not",
"dst_node",
":",
"dst_node",
"=",
"self",
".",
"registery",
".",
"choice_dst_node",
"(",
"dst",
")",
"msg",
"=",
"self",
".",
"... | https://github.com/anyant/rssant/blob/effeb5b01fd6ae8e53516ad919a8275ef47ccbcc/actorlib/node.py#L161-L172 | |
KhronosGroup/NNEF-Tools | c913758ca687dab8cb7b49e8f1556819a2d0ca25 | nnef_tools/interpreter/pytorch/nnef_module.py | python | NNEFModule.__init__ | (self,
path, # type: str
decomposed=None, # type: typing.Optional[typing.List[str]]
custom_operators=None, # type: typing.Optional[typing.Dict[str, typing.Callable]]
activation_callback=None, # type: typing.Optional[... | nnef_graph might be modified by this class if training and write_nnef is used | nnef_graph might be modified by this class if training and write_nnef is used | [
"nnef_graph",
"might",
"be",
"modified",
"by",
"this",
"class",
"if",
"training",
"and",
"write_nnef",
"is",
"used"
] | def __init__(self,
path, # type: str
decomposed=None, # type: typing.Optional[typing.List[str]]
custom_operators=None, # type: typing.Optional[typing.Dict[str, typing.Callable]]
activation_callback=None, # type: typi... | [
"def",
"__init__",
"(",
"self",
",",
"path",
",",
"# type: str",
"decomposed",
"=",
"None",
",",
"# type: typing.Optional[typing.List[str]]",
"custom_operators",
"=",
"None",
",",
"# type: typing.Optional[typing.Dict[str, typing.Callable]]",
"activation_callback",
"=",
"None"... | https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/interpreter/pytorch/nnef_module.py#L31-L67 | ||
mikr/whatstyle | 736d1bcc1e95808861d2cbb6cf00ac9a7293b917 | whatstyle.py | python | CodeFormatter.reformat | (self, sourcefile, destfile, configfile) | Reformats sourcefile according to configfile and writes it to destfile.
This method is only used for testing. | Reformats sourcefile according to configfile and writes it to destfile.
This method is only used for testing. | [
"Reformats",
"sourcefile",
"according",
"to",
"configfile",
"and",
"writes",
"it",
"to",
"destfile",
".",
"This",
"method",
"is",
"only",
"used",
"for",
"testing",
"."
] | def reformat(self, sourcefile, destfile, configfile):
# type: (str, str, str) -> None
"""Reformats sourcefile according to configfile and writes it to destfile.
This method is only used for testing.
"""
tmpdir = tempfile.mkdtemp(prefix='whatstyle_')
cfg = os.path.join(tmp... | [
"def",
"reformat",
"(",
"self",
",",
"sourcefile",
",",
"destfile",
",",
"configfile",
")",
":",
"# type: (str, str, str) -> None",
"tmpdir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
"prefix",
"=",
"'whatstyle_'",
")",
"cfg",
"=",
"os",
".",
"path",
".",
"join"... | https://github.com/mikr/whatstyle/blob/736d1bcc1e95808861d2cbb6cf00ac9a7293b917/whatstyle.py#L1574-L1589 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/sqlmap/thirdparty/bottle/bottle.py | python | BaseResponse.add_header | (self, name, value) | Add an additional response header, not removing duplicates. | Add an additional response header, not removing duplicates. | [
"Add",
"an",
"additional",
"response",
"header",
"not",
"removing",
"duplicates",
"."
] | def add_header(self, name, value):
''' Add an additional response header, not removing duplicates. '''
self._headers.setdefault(_hkey(name), []).append(str(value)) | [
"def",
"add_header",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"self",
".",
"_headers",
".",
"setdefault",
"(",
"_hkey",
"(",
"name",
")",
",",
"[",
"]",
")",
".",
"append",
"(",
"str",
"(",
"value",
")",
")"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/thirdparty/bottle/bottle.py#L1370-L1372 | ||
django-cms/django-cms | 272d62ced15a86c9d34eb21700e6358bb08388ea | cms/extensions/models.py | python | BaseExtension.copy | (self, target, language) | return clone | This method copies this extension to an unrelated-target. If you intend
to "publish" this extension to the publisher counterpart of target, then
use copy_to_publish() instead. | This method copies this extension to an unrelated-target. If you intend
to "publish" this extension to the publisher counterpart of target, then
use copy_to_publish() instead. | [
"This",
"method",
"copies",
"this",
"extension",
"to",
"an",
"unrelated",
"-",
"target",
".",
"If",
"you",
"intend",
"to",
"publish",
"this",
"extension",
"to",
"the",
"publisher",
"counterpart",
"of",
"target",
"then",
"use",
"copy_to_publish",
"()",
"instead... | def copy(self, target, language):
"""
This method copies this extension to an unrelated-target. If you intend
to "publish" this extension to the publisher counterpart of target, then
use copy_to_publish() instead.
"""
clone = self.__class__.objects.get(pk=self.pk) # get ... | [
"def",
"copy",
"(",
"self",
",",
"target",
",",
"language",
")",
":",
"clone",
"=",
"self",
".",
"__class__",
".",
"objects",
".",
"get",
"(",
"pk",
"=",
"self",
".",
"pk",
")",
"# get a copy of this instance",
"clone",
".",
"pk",
"=",
"None",
"clone",... | https://github.com/django-cms/django-cms/blob/272d62ced15a86c9d34eb21700e6358bb08388ea/cms/extensions/models.py#L43-L74 | |
Esri/ArcREST | ab240fde2b0200f61d4a5f6df033516e53f2f416 | src/arcrest/manageags/administration.py | python | AGSAdministration.createSite | (self,
username,
password,
configStoreConnection,
directories,
cluster=None,
logsSettings=None,
runAsync=False
) | return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | This is the first operation that you must invoke when you install
ArcGIS Server for the first time. Creating a new site involves:
-Allocating a store to save the site configuration
-Configuring the server machine and registering it with the site
-Creating a new cluster configurati... | This is the first operation that you must invoke when you install
ArcGIS Server for the first time. Creating a new site involves: | [
"This",
"is",
"the",
"first",
"operation",
"that",
"you",
"must",
"invoke",
"when",
"you",
"install",
"ArcGIS",
"Server",
"for",
"the",
"first",
"time",
".",
"Creating",
"a",
"new",
"site",
"involves",
":"
] | def createSite(self,
username,
password,
configStoreConnection,
directories,
cluster=None,
logsSettings=None,
runAsync=False
):
"""
This is the first op... | [
"def",
"createSite",
"(",
"self",
",",
"username",
",",
"password",
",",
"configStoreConnection",
",",
"directories",
",",
"cluster",
"=",
"None",
",",
"logsSettings",
"=",
"None",
",",
"runAsync",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"_url",
... | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/administration.py#L131-L189 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/wav/v20210129/models.py | python | QueryDealerInfoListResponse.__init__ | (self) | r"""
:param PageData: 经销商信息列表
注意:此字段可能返回 null,表示取不到有效值。
:type PageData: list of DealerInfo
:param NextCursor: 分页游标,下次调用带上该值,则从当前的位置继续往后拉取新增的数据,以实现增量拉取。
注意:此字段可能返回 null,表示取不到有效值。
:type NextCursor: str
:param HasMore: 是否还有更多数据。0-否;1-是。
注意:此字段可能返回 null,表示取不到有效值。
:type HasMor... | r"""
:param PageData: 经销商信息列表
注意:此字段可能返回 null,表示取不到有效值。
:type PageData: list of DealerInfo
:param NextCursor: 分页游标,下次调用带上该值,则从当前的位置继续往后拉取新增的数据,以实现增量拉取。
注意:此字段可能返回 null,表示取不到有效值。
:type NextCursor: str
:param HasMore: 是否还有更多数据。0-否;1-是。
注意:此字段可能返回 null,表示取不到有效值。
:type HasMor... | [
"r",
":",
"param",
"PageData",
":",
"经销商信息列表",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"PageData",
":",
"list",
"of",
"DealerInfo",
":",
"param",
"NextCursor",
":",
"分页游标,下次调用带上该值,则从当前的位置继续往后拉取新增的数据,以实现增量拉取。",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"NextCur... | def __init__(self):
r"""
:param PageData: 经销商信息列表
注意:此字段可能返回 null,表示取不到有效值。
:type PageData: list of DealerInfo
:param NextCursor: 分页游标,下次调用带上该值,则从当前的位置继续往后拉取新增的数据,以实现增量拉取。
注意:此字段可能返回 null,表示取不到有效值。
:type NextCursor: str
:param HasMore: 是否还有更多数据。0-否;1-是。
注意:此字段可能返回 null,表示... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"PageData",
"=",
"None",
"self",
".",
"NextCursor",
"=",
"None",
"self",
".",
"HasMore",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/wav/v20210129/models.py#L1515-L1532 | ||
treeio/treeio | bae3115f4015aad2cbc5ab45572232ceec990495 | treeio/core/middleware/modules.py | python | ModuleDetect.process_request | (self, request) | Process request | Process request | [
"Process",
"request"
] | def process_request(self, request):
"Process request"
hmodules = dict()
for module in settings.INSTALLED_APPS:
import_name = str(
module) + "." + settings.HARDTREE_MODULE_IDENTIFIER
try:
hmodule = __import__(import_name, fromlist=[str(modul... | [
"def",
"process_request",
"(",
"self",
",",
"request",
")",
":",
"hmodules",
"=",
"dict",
"(",
")",
"for",
"module",
"in",
"settings",
".",
"INSTALLED_APPS",
":",
"import_name",
"=",
"str",
"(",
"module",
")",
"+",
"\".\"",
"+",
"settings",
".",
"HARDTRE... | https://github.com/treeio/treeio/blob/bae3115f4015aad2cbc5ab45572232ceec990495/treeio/core/middleware/modules.py#L21-L72 | ||
PennyLaneAI/pennylane | 1275736f790ced1d778858ed383448d4a43a4cdd | pennylane/transforms/control.py | python | ctrl | (fn, control) | return wrapper | Create a method that applies a controlled version of the provided method.
Args:
fn (function): Any python function that applies pennylane operations.
control (Wires): The control wire(s).
Returns:
function: A new function that applies the controlled equivalent of ``fn``. The returned
... | Create a method that applies a controlled version of the provided method. | [
"Create",
"a",
"method",
"that",
"applies",
"a",
"controlled",
"version",
"of",
"the",
"provided",
"method",
"."
] | def ctrl(fn, control):
"""Create a method that applies a controlled version of the provided method.
Args:
fn (function): Any python function that applies pennylane operations.
control (Wires): The control wire(s).
Returns:
function: A new function that applies the controlled equiva... | [
"def",
"ctrl",
"(",
"fn",
",",
"control",
")",
":",
"@",
"wraps",
"(",
"fn",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"QuantumTape",
"(",
"do_queue",
"=",
"False",
")",
"as",
"tape",
":",
"fn",
"(",
"*... | https://github.com/PennyLaneAI/pennylane/blob/1275736f790ced1d778858ed383448d4a43a4cdd/pennylane/transforms/control.py#L138-L220 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/telnetlib.py | python | Telnet.open | (self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT) | Connect to a host.
The optional second argument is the port number, which
defaults to the standard telnet port (23).
Don't try to reopen an already connected instance. | Connect to a host. | [
"Connect",
"to",
"a",
"host",
"."
] | def open(self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
"""Connect to a host.
The optional second argument is the port number, which
defaults to the standard telnet port (23).
Don't try to reopen an already connected instance.
"""
self.eof = 0
if n... | [
"def",
"open",
"(",
"self",
",",
"host",
",",
"port",
"=",
"0",
",",
"timeout",
"=",
"socket",
".",
"_GLOBAL_DEFAULT_TIMEOUT",
")",
":",
"self",
".",
"eof",
"=",
"0",
"if",
"not",
"port",
":",
"port",
"=",
"TELNET_PORT",
"self",
".",
"host",
"=",
"... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/telnetlib.py#L211-L225 | ||
Yelp/data_pipeline | e143a4031b0940e17b22cdf36db0b677b46e3975 | data_pipeline/zookeeper.py | python | ZK._local_zk | (self) | Get (with caching) the local zookeeper cluster definition. | Get (with caching) the local zookeeper cluster definition. | [
"Get",
"(",
"with",
"caching",
")",
"the",
"local",
"zookeeper",
"cluster",
"definition",
"."
] | def _local_zk(self):
"""Get (with caching) the local zookeeper cluster definition."""
path = get_config().zookeeper_discovery_path.format(ecosystem=self.ecosystem)
with open(path, 'r') as f:
return yaml.safe_load(f) | [
"def",
"_local_zk",
"(",
"self",
")",
":",
"path",
"=",
"get_config",
"(",
")",
".",
"zookeeper_discovery_path",
".",
"format",
"(",
"ecosystem",
"=",
"self",
".",
"ecosystem",
")",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"f",
":",
"return"... | https://github.com/Yelp/data_pipeline/blob/e143a4031b0940e17b22cdf36db0b677b46e3975/data_pipeline/zookeeper.py#L56-L60 | ||
wwqgtxx/wwqLyParse | 33136508e52821babd9294fdecffbdf02d73a6fc | wwqLyParse/lib/python-3.7.2-embed-win32/gevent/_sslgte279.py | python | SSLSocket.read | (self, len=1024, buffer=None) | Read up to LEN bytes and return them.
Return zero-length string on EOF. | Read up to LEN bytes and return them.
Return zero-length string on EOF. | [
"Read",
"up",
"to",
"LEN",
"bytes",
"and",
"return",
"them",
".",
"Return",
"zero",
"-",
"length",
"string",
"on",
"EOF",
"."
] | def read(self, len=1024, buffer=None):
"""Read up to LEN bytes and return them.
Return zero-length string on EOF."""
self._checkClosed()
while 1:
if not self._sslobj:
raise ValueError("Read on closed or unwrapped SSL socket.")
if len == 0:
... | [
"def",
"read",
"(",
"self",
",",
"len",
"=",
"1024",
",",
"buffer",
"=",
"None",
")",
":",
"self",
".",
"_checkClosed",
"(",
")",
"while",
"1",
":",
"if",
"not",
"self",
".",
"_sslobj",
":",
"raise",
"ValueError",
"(",
"\"Read on closed or unwrapped SSL ... | https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-win32/gevent/_sslgte279.py#L298-L329 | ||
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/util/input_warping_functions.py | python | InputWarpingTest.__init__ | (self) | [] | def __init__(self):
super(InputWarpingTest, self).__init__(name='input_warp_test')
self.a = Param('a', 1.0)
self.set_prior(LogGaussian(0.0, 0.75))
self.link_parameter(self.a) | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"InputWarpingTest",
",",
"self",
")",
".",
"__init__",
"(",
"name",
"=",
"'input_warp_test'",
")",
"self",
".",
"a",
"=",
"Param",
"(",
"'a'",
",",
"1.0",
")",
"self",
".",
"set_prior",
"(",
"Lo... | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/util/input_warping_functions.py#L44-L48 | ||||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ttypes.py | python | LongColumnStatsData.__ne__ | (self, other) | return not (self == other) | [] | def __ne__(self, other):
return not (self == other) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"(",
"self",
"==",
"other",
")"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ttypes.py#L3990-L3991 | |||
Azure/azure-linux-extensions | a42ef718c746abab2b3c6a21da87b29e76364558 | CustomScript/azure/storage/queueservice.py | python | QueueService.list_queues | (self, prefix=None, marker=None, maxresults=None,
include=None) | return _parse_enum_results_list(
response, QueueEnumResults, "Queues", Queue) | Lists all of the queues in a given storage account.
prefix:
Filters the results to return only queues with names that begin
with the specified prefix.
marker:
A string value that identifies the portion of the list to be
returned with the next list operati... | Lists all of the queues in a given storage account. | [
"Lists",
"all",
"of",
"the",
"queues",
"in",
"a",
"given",
"storage",
"account",
"."
] | def list_queues(self, prefix=None, marker=None, maxresults=None,
include=None):
'''
Lists all of the queues in a given storage account.
prefix:
Filters the results to return only queues with names that begin
with the specified prefix.
marker:
... | [
"def",
"list_queues",
"(",
"self",
",",
"prefix",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"maxresults",
"=",
"None",
",",
"include",
"=",
"None",
")",
":",
"request",
"=",
"HTTPRequest",
"(",
")",
"request",
".",
"method",
"=",
"'GET'",
"request"... | https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/CustomScript/azure/storage/queueservice.py#L90-L129 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/conch/interfaces.py | python | ISFTPServer.getAttrs | (path, followLinks) | Return the attributes for the given path.
This method returns a dictionary in the same format as the attrs
argument to openFile or a Deferred that is called back with same.
@param path: the path to return attributes for as a string.
@param followLinks: a boolean. If it is True, follow... | Return the attributes for the given path. | [
"Return",
"the",
"attributes",
"for",
"the",
"given",
"path",
"."
] | def getAttrs(path, followLinks):
"""
Return the attributes for the given path.
This method returns a dictionary in the same format as the attrs
argument to openFile or a Deferred that is called back with same.
@param path: the path to return attributes for as a string.
... | [
"def",
"getAttrs",
"(",
"path",
",",
"followLinks",
")",
":"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/conch/interfaces.py#L228-L239 | ||
liutinglt/CE2P | dec670bd1af7742851a49a8e31a9694dc6173879 | libs/bn.py | python | InPlaceABN.__init__ | (self, num_features, eps=1e-5, momentum=0.1, affine=True, activation="leaky_relu", slope=0.01) | Creates an InPlace Activated Batch Normalization module
Parameters
----------
num_features : int
Number of feature channels in the input and output.
eps : float
Small constant to prevent numerical issues.
momentum : float
Momentum factor appli... | Creates an InPlace Activated Batch Normalization module | [
"Creates",
"an",
"InPlace",
"Activated",
"Batch",
"Normalization",
"module"
] | def __init__(self, num_features, eps=1e-5, momentum=0.1, affine=True, activation="leaky_relu", slope=0.01):
"""Creates an InPlace Activated Batch Normalization module
Parameters
----------
num_features : int
Number of feature channels in the input and output.
eps : f... | [
"def",
"__init__",
"(",
"self",
",",
"num_features",
",",
"eps",
"=",
"1e-5",
",",
"momentum",
"=",
"0.1",
",",
"affine",
"=",
"True",
",",
"activation",
"=",
"\"leaky_relu\"",
",",
"slope",
"=",
"0.01",
")",
":",
"super",
"(",
"InPlaceABN",
",",
"self... | https://github.com/liutinglt/CE2P/blob/dec670bd1af7742851a49a8e31a9694dc6173879/libs/bn.py#L51-L84 | ||
IntelAI/models | 1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c | models/language_translation/tensorflow/transformer_mlperf/training/bfloat16/transformer/model/transformer.py | python | Transformer.__call__ | (self, inputs, targets=None) | Calculate target logits or inferred target sequences.
Args:
inputs: int tensor with shape [batch_size, input_length].
targets: None or int tensor with shape [batch_size, target_length].
Returns:
If targets is defined, then return logits for each word in the target
sequence. float tenso... | Calculate target logits or inferred target sequences. | [
"Calculate",
"target",
"logits",
"or",
"inferred",
"target",
"sequences",
"."
] | def __call__(self, inputs, targets=None):
"""Calculate target logits or inferred target sequences.
Args:
inputs: int tensor with shape [batch_size, input_length].
targets: None or int tensor with shape [batch_size, target_length].
Returns:
If targets is defined, then return logits for ea... | [
"def",
"__call__",
"(",
"self",
",",
"inputs",
",",
"targets",
"=",
"None",
")",
":",
"# Variance scaling is used here because it seems to work in many problems.",
"# Other reasonable initializers may also work just as well.",
"mlperf_log",
".",
"transformer_print",
"(",
"key",
... | https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_mlperf/training/bfloat16/transformer/model/transformer.py#L68-L105 | ||
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/aui/framemanager.py | python | FindPaneInDock | (dock, window) | return None | This method looks up a specified window pointer inside a dock.
If found, the corresponding :class:`AuiDockInfo` pointer is returned, otherwise ``None``.
:param `dock`: a :class:`AuiDockInfo` structure;
:param wx.Window `window`: the window associated to the pane we are seeking. | This method looks up a specified window pointer inside a dock.
If found, the corresponding :class:`AuiDockInfo` pointer is returned, otherwise ``None``. | [
"This",
"method",
"looks",
"up",
"a",
"specified",
"window",
"pointer",
"inside",
"a",
"dock",
".",
"If",
"found",
"the",
"corresponding",
":",
"class",
":",
"AuiDockInfo",
"pointer",
"is",
"returned",
"otherwise",
"None",
"."
] | def FindPaneInDock(dock, window):
"""
This method looks up a specified window pointer inside a dock.
If found, the corresponding :class:`AuiDockInfo` pointer is returned, otherwise ``None``.
:param `dock`: a :class:`AuiDockInfo` structure;
:param wx.Window `window`: the window associated to the pan... | [
"def",
"FindPaneInDock",
"(",
"dock",
",",
"window",
")",
":",
"for",
"p",
"in",
"dock",
".",
"panes",
":",
"if",
"p",
".",
"window",
"==",
"window",
":",
"return",
"p",
"return",
"None"
] | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/aui/framemanager.py#L3706-L3719 | |
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/pkg_resources/__init__.py | python | IMetadataProvider.metadata_isdir | (name) | Is the named metadata a directory? (like ``os.path.isdir()``) | Is the named metadata a directory? (like ``os.path.isdir()``) | [
"Is",
"the",
"named",
"metadata",
"a",
"directory?",
"(",
"like",
"os",
".",
"path",
".",
"isdir",
"()",
")"
] | def metadata_isdir(name):
"""Is the named metadata a directory? (like ``os.path.isdir()``)""" | [
"def",
"metadata_isdir",
"(",
"name",
")",
":"
] | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pkg_resources/__init__.py#L591-L592 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/ftplib.py | python | FTP.__exit__ | (self, *args) | [] | def __exit__(self, *args):
if self.sock is not None:
try:
self.quit()
except (OSError, EOFError):
pass
finally:
if self.sock is not None:
self.close() | [
"def",
"__exit__",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"sock",
"is",
"not",
"None",
":",
"try",
":",
"self",
".",
"quit",
"(",
")",
"except",
"(",
"OSError",
",",
"EOFError",
")",
":",
"pass",
"finally",
":",
"if",
"self",... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/ftplib.py#L129-L137 | ||||
pallets/werkzeug | 9efe8c00dcb2b6fc086961ba304729db01912652 | src/werkzeug/sansio/response.py | python | Response.content_security_policy | (self) | return rv | The ``Content-Security-Policy`` header as a
:class:`~werkzeug.datastructures.ContentSecurityPolicy` object. Available
even if the header is not set.
The Content-Security-Policy header adds an additional layer of
security to help detect and mitigate certain types of attacks. | The ``Content-Security-Policy`` header as a
:class:`~werkzeug.datastructures.ContentSecurityPolicy` object. Available
even if the header is not set. | [
"The",
"Content",
"-",
"Security",
"-",
"Policy",
"header",
"as",
"a",
":",
"class",
":",
"~werkzeug",
".",
"datastructures",
".",
"ContentSecurityPolicy",
"object",
".",
"Available",
"even",
"if",
"the",
"header",
"is",
"not",
"set",
"."
] | def content_security_policy(self) -> ContentSecurityPolicy:
"""The ``Content-Security-Policy`` header as a
:class:`~werkzeug.datastructures.ContentSecurityPolicy` object. Available
even if the header is not set.
The Content-Security-Policy header adds an additional layer of
secu... | [
"def",
"content_security_policy",
"(",
"self",
")",
"->",
"ContentSecurityPolicy",
":",
"def",
"on_update",
"(",
"csp",
":",
"ContentSecurityPolicy",
")",
"->",
"None",
":",
"if",
"not",
"csp",
":",
"del",
"self",
".",
"headers",
"[",
"\"content-security-policy\... | https://github.com/pallets/werkzeug/blob/9efe8c00dcb2b6fc086961ba304729db01912652/src/werkzeug/sansio/response.py#L571-L589 | |
thomasvs/morituri | 135b2f7bf27721177e3aeb1d26403f1b29116599 | morituri/extern/task/task.py | python | Task.addListener | (self, listener) | Add a listener for task status changes.
Listeners should implement started, stopped, and progressed. | Add a listener for task status changes. | [
"Add",
"a",
"listener",
"for",
"task",
"status",
"changes",
"."
] | def addListener(self, listener):
"""
Add a listener for task status changes.
Listeners should implement started, stopped, and progressed.
"""
self.debug('Adding listener %r', listener)
if not self._listeners:
self._listeners = []
self._listeners.appen... | [
"def",
"addListener",
"(",
"self",
",",
"listener",
")",
":",
"self",
".",
"debug",
"(",
"'Adding listener %r'",
",",
"listener",
")",
"if",
"not",
"self",
".",
"_listeners",
":",
"self",
".",
"_listeners",
"=",
"[",
"]",
"self",
".",
"_listeners",
".",
... | https://github.com/thomasvs/morituri/blob/135b2f7bf27721177e3aeb1d26403f1b29116599/morituri/extern/task/task.py#L221-L230 | ||
Parisson/TimeSide | 3fb5995b5b47ae7d56acedadab5c28b2b1455ea9 | timeside/core/processor.py | python | ProcessPipe.append_pipe | (self, proc_pipe) | Append a sub-pipe to the pipe | Append a sub-pipe to the pipe | [
"Append",
"a",
"sub",
"-",
"pipe",
"to",
"the",
"pipe"
] | def append_pipe(self, proc_pipe):
"Append a sub-pipe to the pipe"
for proc in proc_pipe.processors:
self.append_processor(proc) | [
"def",
"append_pipe",
"(",
"self",
",",
"proc_pipe",
")",
":",
"for",
"proc",
"in",
"proc_pipe",
".",
"processors",
":",
"self",
".",
"append_processor",
"(",
"proc",
")"
] | https://github.com/Parisson/TimeSide/blob/3fb5995b5b47ae7d56acedadab5c28b2b1455ea9/timeside/core/processor.py#L429-L433 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/sklearn/gaussian_process/kernels.py | python | Kernel.clone_with_theta | (self, theta) | return cloned | Returns a clone of self with given hyperparameters theta. | Returns a clone of self with given hyperparameters theta. | [
"Returns",
"a",
"clone",
"of",
"self",
"with",
"given",
"hyperparameters",
"theta",
"."
] | def clone_with_theta(self, theta):
"""Returns a clone of self with given hyperparameters theta. """
cloned = clone(self)
cloned.theta = theta
return cloned | [
"def",
"clone_with_theta",
"(",
"self",
",",
"theta",
")",
":",
"cloned",
"=",
"clone",
"(",
"self",
")",
"cloned",
".",
"theta",
"=",
"theta",
"return",
"cloned"
] | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/gaussian_process/kernels.py#L201-L205 | |
deepgram/kur | fd0c120e50815c1e5be64e5dde964dcd47234556 | kur/sources/jsonl.py | python | JSONLSource.__init__ | (self, source, key, num_entries, *args, **kwargs) | Creates a new JSONL source for file named `source`. | Creates a new JSONL source for file named `source`. | [
"Creates",
"a",
"new",
"JSONL",
"source",
"for",
"file",
"named",
"source",
"."
] | def __init__(self, source, key, num_entries, *args, **kwargs):
""" Creates a new JSONL source for file named `source`.
"""
super().__init__(*args, **kwargs)
self.source = source
self.num_entries = num_entries
self.key = key
self.indices = numpy.arange(len(self)) | [
"def",
"__init__",
"(",
"self",
",",
"source",
",",
"key",
",",
"num_entries",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"source",
"=",
... | https://github.com/deepgram/kur/blob/fd0c120e50815c1e5be64e5dde964dcd47234556/kur/sources/jsonl.py#L14-L23 | ||
evernote/evernote-sdk-python3 | e0349a366f89db81ef23392746ed8c9ccb6fd2e9 | lib/evernote/edam/userstore/UserStore.py | python | Client.getBootstrapInfo | (self, locale) | return self.recv_getBootstrapInfo() | This provides bootstrap information to the client. Various bootstrap
profiles and settings may be used by the client to configure itself.
@param locale
The client's current locale, expressed in language[_country]
format. E.g., "en_US". See ISO-639 and ISO-3166 for valid
language and country c... | This provides bootstrap information to the client. Various bootstrap
profiles and settings may be used by the client to configure itself. | [
"This",
"provides",
"bootstrap",
"information",
"to",
"the",
"client",
".",
"Various",
"bootstrap",
"profiles",
"and",
"settings",
"may",
"be",
"used",
"by",
"the",
"client",
"to",
"configure",
"itself",
"."
] | def getBootstrapInfo(self, locale):
"""
This provides bootstrap information to the client. Various bootstrap
profiles and settings may be used by the client to configure itself.
@param locale
The client's current locale, expressed in language[_country]
format. E.g., "en_US". See ISO-639 and... | [
"def",
"getBootstrapInfo",
"(",
"self",
",",
"locale",
")",
":",
"self",
".",
"send_getBootstrapInfo",
"(",
"locale",
")",
"return",
"self",
".",
"recv_getBootstrapInfo",
"(",
")"
] | https://github.com/evernote/evernote-sdk-python3/blob/e0349a366f89db81ef23392746ed8c9ccb6fd2e9/lib/evernote/edam/userstore/UserStore.py#L517-L534 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/opsworks/layer1.py | python | OpsWorksConnection.register_rds_db_instance | (self, stack_id, rds_db_instance_arn,
db_user, db_password) | return self.make_request(action='RegisterRdsDbInstance',
body=json.dumps(params)) | Registers an Amazon RDS instance with a stack.
**Required Permissions**: To use this action, an IAM user must
have a Manage permissions level for the stack, or an attached
policy that explicitly grants permissions. For more
information on user permissions, see `Managing User
Per... | Registers an Amazon RDS instance with a stack. | [
"Registers",
"an",
"Amazon",
"RDS",
"instance",
"with",
"a",
"stack",
"."
] | def register_rds_db_instance(self, stack_id, rds_db_instance_arn,
db_user, db_password):
"""
Registers an Amazon RDS instance with a stack.
**Required Permissions**: To use this action, an IAM user must
have a Manage permissions level for the stack, or a... | [
"def",
"register_rds_db_instance",
"(",
"self",
",",
"stack_id",
",",
"rds_db_instance_arn",
",",
"db_user",
",",
"db_password",
")",
":",
"params",
"=",
"{",
"'StackId'",
":",
"stack_id",
",",
"'RdsDbInstanceArn'",
":",
"rds_db_instance_arn",
",",
"'DbUser'",
":"... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/opsworks/layer1.py#L2109-L2140 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/verify/v2/service/entity/challenge/__init__.py | python | ChallengePage.__init__ | (self, version, response, solution) | Initialize the ChallengePage
:param Version version: Version that contains the resource
:param Response response: Response from the API
:param service_sid: Service Sid.
:param identity: Unique external identifier of the Entity
:returns: twilio.rest.verify.v2.service.entity.chal... | Initialize the ChallengePage | [
"Initialize",
"the",
"ChallengePage"
] | def __init__(self, version, response, solution):
"""
Initialize the ChallengePage
:param Version version: Version that contains the resource
:param Response response: Response from the API
:param service_sid: Service Sid.
:param identity: Unique external identifier of th... | [
"def",
"__init__",
"(",
"self",
",",
"version",
",",
"response",
",",
"solution",
")",
":",
"super",
"(",
"ChallengePage",
",",
"self",
")",
".",
"__init__",
"(",
"version",
",",
"response",
")",
"# Path Solution",
"self",
".",
"_solution",
"=",
"solution"... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/verify/v2/service/entity/challenge/__init__.py#L222-L237 | ||
stratosphereips/StratosphereLinuxIPS | 985ac0f141dd71fe9c6faa8307bcf95a3754951d | modules/blocking/blocking.py | python | Module.test | (self) | For debugging purposes, once we're done with the module we'll delete it | For debugging purposes, once we're done with the module we'll delete it | [
"For",
"debugging",
"purposes",
"once",
"we",
"re",
"done",
"with",
"the",
"module",
"we",
"ll",
"delete",
"it"
] | def test(self):
""" For debugging purposes, once we're done with the module we'll delete it """
if not self.is_ip_blocked('2.2.0.0'):
blocking_data = {
"ip" : "2.2.0.0",
"block" : True ,
"from" : True... | [
"def",
"test",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_ip_blocked",
"(",
"'2.2.0.0'",
")",
":",
"blocking_data",
"=",
"{",
"\"ip\"",
":",
"\"2.2.0.0\"",
",",
"\"block\"",
":",
"True",
",",
"\"from\"",
":",
"True",
",",
"\"to\"",
":",
"True... | https://github.com/stratosphereips/StratosphereLinuxIPS/blob/985ac0f141dd71fe9c6faa8307bcf95a3754951d/modules/blocking/blocking.py#L64-L82 | ||
ryderling/DEEPSEC | 2c67afac0ae966767b6712a51db85f04f4f5c565 | Attacks/AttackMethods/BLB.py | python | BLBAttack.batch_perturbation | (self, xs, ys_target, batch_size, device) | return np.array(adv_sample) | :param xs:
:param ys_target:
:param batch_size:
:param device:
:return: | [] | def batch_perturbation(self, xs, ys_target, batch_size, device):
"""
:param xs:
:param ys_target:
:param batch_size:
:param device:
:return:
"""
assert len(xs) == len(ys_target), "The lengths of samples and its ys should be equal"
adv_sample = []... | [
"def",
"batch_perturbation",
"(",
"self",
",",
"xs",
",",
"ys_target",
",",
"batch_size",
",",
"device",
")",
":",
"assert",
"len",
"(",
"xs",
")",
"==",
"len",
"(",
"ys_target",
")",
",",
"\"The lengths of samples and its ys should be equal\"",
"adv_sample",
"=... | https://github.com/ryderling/DEEPSEC/blob/2c67afac0ae966767b6712a51db85f04f4f5c565/Attacks/AttackMethods/BLB.py#L120-L140 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/tarfile.py | python | TarFile.makefile | (self, tarinfo, targetpath) | Make a file called targetpath. | Make a file called targetpath. | [
"Make",
"a",
"file",
"called",
"targetpath",
"."
] | def makefile(self, tarinfo, targetpath):
"""Make a file called targetpath.
"""
source = self.fileobj
source.seek(tarinfo.offset_data)
target = bltn_open(targetpath, "wb")
if tarinfo.sparse is not None:
for offset, size in tarinfo.sparse:
target... | [
"def",
"makefile",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"source",
"=",
"self",
".",
"fileobj",
"source",
".",
"seek",
"(",
"tarinfo",
".",
"offset_data",
")",
"target",
"=",
"bltn_open",
"(",
"targetpath",
",",
"\"wb\"",
")",
"if",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tarfile.py#L2290-L2304 | ||
Rockhopper-Technologies/enlighten | e98ea52b4aebd9a8f458c98a54453c385f4867dc | examples/floats.py | python | process_files | (count=None) | Process files with a single progress bar | Process files with a single progress bar | [
"Process",
"files",
"with",
"a",
"single",
"progress",
"bar"
] | def process_files(count=None):
"""
Process files with a single progress bar
"""
pbar = enlighten.Counter(total=count, desc='Simple', unit='ticks',
bar_format=BAR_FMT, counter_format=COUNTER_FMT)
for _ in range(100):
time.sleep(0.05)
pbar.update(1.1) | [
"def",
"process_files",
"(",
"count",
"=",
"None",
")",
":",
"pbar",
"=",
"enlighten",
".",
"Counter",
"(",
"total",
"=",
"count",
",",
"desc",
"=",
"'Simple'",
",",
"unit",
"=",
"'ticks'",
",",
"bar_format",
"=",
"BAR_FMT",
",",
"counter_format",
"=",
... | https://github.com/Rockhopper-Technologies/enlighten/blob/e98ea52b4aebd9a8f458c98a54453c385f4867dc/examples/floats.py#L25-L35 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.