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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_api_resource.py | python | V1APIResource.verbs | (self) | return self._verbs | Gets the verbs of this V1APIResource. # noqa: E501
verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy) # noqa: E501
:return: The verbs of this V1APIResource. # noqa: E501
:rtype: list[str] | Gets the verbs of this V1APIResource. # noqa: E501 | [
"Gets",
"the",
"verbs",
"of",
"this",
"V1APIResource",
".",
"#",
"noqa",
":",
"E501"
] | def verbs(self):
"""Gets the verbs of this V1APIResource. # noqa: E501
verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy) # noqa: E501
:return: The verbs of this V1APIResource. # noqa: E501
:rtype: lis... | [
"def",
"verbs",
"(",
"self",
")",
":",
"return",
"self",
".",
"_verbs"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_api_resource.py#L288-L296 | |
mylar3/mylar3 | fce4771c5b627f8de6868dd4ab6bc53f7b22d303 | lib/rarfile/rarfile.py | python | Rar5FileInfo.is_dir | (self) | return False | Returns True if entry is a directory. | Returns True if entry is a directory. | [
"Returns",
"True",
"if",
"entry",
"is",
"a",
"directory",
"."
] | def is_dir(self):
"""Returns True if entry is a directory."""
if not self.file_redir:
if self.file_flags & RAR5_FILE_FLAG_ISDIR:
return True
return False | [
"def",
"is_dir",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"file_redir",
":",
"if",
"self",
".",
"file_flags",
"&",
"RAR5_FILE_FLAG_ISDIR",
":",
"return",
"True",
"return",
"False"
] | https://github.com/mylar3/mylar3/blob/fce4771c5b627f8de6868dd4ab6bc53f7b22d303/lib/rarfile/rarfile.py#L1697-L1702 | |
manrajgrover/halo | 89c7934ddc79b544b48357822f4136c5a18d9cce | halo/halo.py | python | Halo.clear | (self) | return self | Clears the line and returns cursor to the start.
of line
Returns
-------
self | Clears the line and returns cursor to the start.
of line
Returns
-------
self | [
"Clears",
"the",
"line",
"and",
"returns",
"cursor",
"to",
"the",
"start",
".",
"of",
"line",
"Returns",
"-------",
"self"
] | def clear(self):
"""Clears the line and returns cursor to the start.
of line
Returns
-------
self
"""
self._write("\r")
self._write(self.CLEAR_LINE)
return self | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_write",
"(",
"\"\\r\"",
")",
"self",
".",
"_write",
"(",
"self",
".",
"CLEAR_LINE",
")",
"return",
"self"
] | https://github.com/manrajgrover/halo/blob/89c7934ddc79b544b48357822f4136c5a18d9cce/halo/halo.py#L386-L395 | |
gongzhitaao/tensorflow-adversarial | b12104a2c06286319c0662dc09253391a87ec061 | example/cw2_mnist.py | python | Timer.__exit__ | (self, exc_type, exc_value, exc_traceback) | Set the end time | Set the end time | [
"Set",
"the",
"end",
"time"
] | def __exit__(self, exc_type, exc_value, exc_traceback):
"""
Set the end time
"""
self.end = self()
print(str(self)) | [
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
",",
"exc_value",
",",
"exc_traceback",
")",
":",
"self",
".",
"end",
"=",
"self",
"(",
")",
"print",
"(",
"str",
"(",
"self",
")",
")"
] | https://github.com/gongzhitaao/tensorflow-adversarial/blob/b12104a2c06286319c0662dc09253391a87ec061/example/cw2_mnist.py#L56-L61 | ||
tenable/pyTenable | 1ccab9fc6f6e4c9f1cfe5128f694388ea112719d | tenable/io/remediation_scans.py | python | RemediationScansAPI._create_scan_document | (self, kwargs) | return scan | Takes the key-worded arguments and will provide a scan settings
document based on the values inputted.
Args:
kwargs (dict): The keyword dict passed from the user
Returns:
:obj:`dict`:
The resulting scan document based on the kwargs provided. | Takes the key-worded arguments and will provide a scan settings
document based on the values inputted. | [
"Takes",
"the",
"key",
"-",
"worded",
"arguments",
"and",
"will",
"provide",
"a",
"scan",
"settings",
"document",
"based",
"on",
"the",
"values",
"inputted",
"."
] | def _create_scan_document(self, kwargs):
'''
Takes the key-worded arguments and will provide a scan settings
document based on the values inputted.
Args:
kwargs (dict): The keyword dict passed from the user
Returns:
:obj:`dict`:
The result... | [
"def",
"_create_scan_document",
"(",
"self",
",",
"kwargs",
")",
":",
"scan",
"=",
"{",
"'settings'",
":",
"dict",
"(",
")",
",",
"}",
"# If a template is specified, then we will pull the listing of available",
"# templates and set the policy UUID to match the template name giv... | https://github.com/tenable/pyTenable/blob/1ccab9fc6f6e4c9f1cfe5128f694388ea112719d/tenable/io/remediation_scans.py#L190-L297 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/db/sqlmap/plugins/dbms/sybase/enumeration.py | python | Enumeration.getHostname | (self) | [] | def getHostname(self):
warnMsg = "on Sybase it is not possible to enumerate the hostname"
logger.warn(warnMsg) | [
"def",
"getHostname",
"(",
"self",
")",
":",
"warnMsg",
"=",
"\"on Sybase it is not possible to enumerate the hostname\"",
"logger",
".",
"warn",
"(",
"warnMsg",
")"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/plugins/dbms/sybase/enumeration.py#L321-L323 | ||||
ni/nidaqmx-python | 62fc6b48cbbb330fe1bcc9aedadc86610a1269b6 | nidaqmx/system/physical_channel.py | python | PhysicalChannel.teds_model_num | (self) | return val.value | int: Indicates the model number of the sensor. | int: Indicates the model number of the sensor. | [
"int",
":",
"Indicates",
"the",
"model",
"number",
"of",
"the",
"sensor",
"."
] | def teds_model_num(self):
"""
int: Indicates the model number of the sensor.
"""
val = ctypes.c_uint()
cfunc = lib_importer.windll.DAQmxGetPhysicalChanTEDSModelNum
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
... | [
"def",
"teds_model_num",
"(",
"self",
")",
":",
"val",
"=",
"ctypes",
".",
"c_uint",
"(",
")",
"cfunc",
"=",
"lib_importer",
".",
"windll",
".",
"DAQmxGetPhysicalChanTEDSModelNum",
"if",
"cfunc",
".",
"argtypes",
"is",
"None",
":",
"with",
"cfunc",
".",
"a... | https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/system/physical_channel.py#L801-L818 | |
ttu/ruuvitag-sensor | c21b21f34644954767d0fbf22fb71c3f67d1ce02 | ruuvitag_sensor/decoder.py | python | Df5Decoder._get_powerinfo | (self, data) | return (battery_voltage, tx_power) | Return battery voltage and tx power | Return battery voltage and tx power | [
"Return",
"battery",
"voltage",
"and",
"tx",
"power"
] | def _get_powerinfo(self, data):
"""Return battery voltage and tx power"""
battery_voltage = data[7] >> 5
tx_power = data[7] & 0x001F
return (battery_voltage, tx_power) | [
"def",
"_get_powerinfo",
"(",
"self",
",",
"data",
")",
":",
"battery_voltage",
"=",
"data",
"[",
"7",
"]",
">>",
"5",
"tx_power",
"=",
"data",
"[",
"7",
"]",
"&",
"0x001F",
"return",
"(",
"battery_voltage",
",",
"tx_power",
")"
] | https://github.com/ttu/ruuvitag-sensor/blob/c21b21f34644954767d0fbf22fb71c3f67d1ce02/ruuvitag_sensor/decoder.py#L212-L217 | |
scanny/python-pptx | 71d1ca0b2b3b9178d64cdab565e8503a25a54e0b | pptx/oxml/shapes/shared.py | python | BaseShapeElement.shape_name | (self) | return self._nvXxPr.cNvPr.name | Name of this shape | Name of this shape | [
"Name",
"of",
"this",
"shape"
] | def shape_name(self):
"""
Name of this shape
"""
return self._nvXxPr.cNvPr.name | [
"def",
"shape_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_nvXxPr",
".",
"cNvPr",
".",
"name"
] | https://github.com/scanny/python-pptx/blob/71d1ca0b2b3b9178d64cdab565e8503a25a54e0b/pptx/oxml/shapes/shared.py#L164-L168 | |
openstack/swift | b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100 | swift/common/manager.py | python | Server.pid_files | (self, **kwargs) | return pid_files | Get pid files for this server
:param number: if supplied will only lookup the nth server
:returns: list of pid files | Get pid files for this server | [
"Get",
"pid",
"files",
"for",
"this",
"server"
] | def pid_files(self, **kwargs):
"""Get pid files for this server
:param number: if supplied will only lookup the nth server
:returns: list of pid files
"""
if self.conf is not None:
pid_files = search_tree(self.run_dir, '%s*' % self.server,
... | [
"def",
"pid_files",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"conf",
"is",
"not",
"None",
":",
"pid_files",
"=",
"search_tree",
"(",
"self",
".",
"run_dir",
",",
"'%s*'",
"%",
"self",
".",
"server",
",",
"exts",
"=",
"[",
... | https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/common/manager.py#L612-L630 | |
joaoventura/pylibui | 2e74db787bfea533f3ae465670963daedcaec344 | pylibui/libui/window.py | python | uiWindowSetTitle | (window, title) | Sets the window's title.
:param window: uiWindow
:param title: string
:return: None | Sets the window's title. | [
"Sets",
"the",
"window",
"s",
"title",
"."
] | def uiWindowSetTitle(window, title):
"""
Sets the window's title.
:param window: uiWindow
:param title: string
:return: None
"""
clibui.uiWindowSetTitle(window, bytes(title, 'utf-8')) | [
"def",
"uiWindowSetTitle",
"(",
"window",
",",
"title",
")",
":",
"clibui",
".",
"uiWindowSetTitle",
"(",
"window",
",",
"bytes",
"(",
"title",
",",
"'utf-8'",
")",
")"
] | https://github.com/joaoventura/pylibui/blob/2e74db787bfea533f3ae465670963daedcaec344/pylibui/libui/window.py#L44-L53 | ||
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/android/decorators.py | python | WithTimeoutAndRetries | (f) | return _TimeoutRetryWrapper(f, get_timeout, get_retries) | A decorator that handles timeouts and retries.
'timeout' and 'retries' kwargs must be passed to the function.
Args:
f: The function to decorate.
Returns:
The decorated function. | A decorator that handles timeouts and retries. | [
"A",
"decorator",
"that",
"handles",
"timeouts",
"and",
"retries",
"."
] | def WithTimeoutAndRetries(f):
"""A decorator that handles timeouts and retries.
'timeout' and 'retries' kwargs must be passed to the function.
Args:
f: The function to decorate.
Returns:
The decorated function.
"""
get_timeout = lambda *a, **kw: kw['timeout']
get_retries = lambda *a, **kw: kw['r... | [
"def",
"WithTimeoutAndRetries",
"(",
"f",
")",
":",
"get_timeout",
"=",
"lambda",
"*",
"a",
",",
"*",
"*",
"kw",
":",
"kw",
"[",
"'timeout'",
"]",
"get_retries",
"=",
"lambda",
"*",
"a",
",",
"*",
"*",
"kw",
":",
"kw",
"[",
"'retries'",
"]",
"retur... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/android/decorators.py#L67-L79 | |
cbrgm/telegram-robot-rss | 58fe98de427121fdc152c8df0721f1891174e6c9 | venv/lib/python2.7/site-packages/telegram/ext/jobqueue.py | python | JobQueue.put | (self, job, next_t=None) | Queue a new job.
Note:
This method is deprecated. Please use: :attr:`run_once`, :attr:`run_daily`
or :attr:`run_repeating` instead.
Args:
job (:class:`telegram.ext.Job`): The ``Job`` instance representing the new job.
next_t (:obj:`int` | :obj:`float` | ... | Queue a new job. | [
"Queue",
"a",
"new",
"job",
"."
] | def put(self, job, next_t=None):
"""Queue a new job.
Note:
This method is deprecated. Please use: :attr:`run_once`, :attr:`run_daily`
or :attr:`run_repeating` instead.
Args:
job (:class:`telegram.ext.Job`): The ``Job`` instance representing the new job.
... | [
"def",
"put",
"(",
"self",
",",
"job",
",",
"next_t",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"\"'JobQueue.put' is being deprecated, use 'JobQueue.run_once', \"",
"\"'JobQueue.run_daily' or 'JobQueue.run_repeating' instead\"",
")",
"if",
"job",
".",
"job_queu... | https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/telegram/ext/jobqueue.py#L67-L96 | ||
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/cpython/charseq.py | python | _same_kind | (a, b) | return False | [] | def _same_kind(a, b):
for t in [(types.CharSeq, types.Bytes),
(types.UnicodeCharSeq, types.UnicodeType)]:
if isinstance(a, t) and isinstance(b, t):
return True
return False | [
"def",
"_same_kind",
"(",
"a",
",",
"b",
")",
":",
"for",
"t",
"in",
"[",
"(",
"types",
".",
"CharSeq",
",",
"types",
".",
"Bytes",
")",
",",
"(",
"types",
".",
"UnicodeCharSeq",
",",
"types",
".",
"UnicodeType",
")",
"]",
":",
"if",
"isinstance",
... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cpython/charseq.py#L123-L128 | |||
quodlibet/mutagen | 399513b167ed00c4b7a9ef98dfe591a276efb701 | docs/user/examples/fileobj-iface.py | python | IOInterface.tell | (self) | Returns he current offset as int. Always >= 0.
Raises IOError in case fetching the position is for some reason
not possible. | Returns he current offset as int. Always >= 0. | [
"Returns",
"he",
"current",
"offset",
"as",
"int",
".",
"Always",
">",
"=",
"0",
"."
] | def tell(self):
"""Returns he current offset as int. Always >= 0.
Raises IOError in case fetching the position is for some reason
not possible.
"""
raise NotImplementedError | [
"def",
"tell",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/quodlibet/mutagen/blob/399513b167ed00c4b7a9ef98dfe591a276efb701/docs/user/examples/fileobj-iface.py#L14-L21 | ||
zhang-can/ECO-pytorch | 355c3866b35cdaa5d451263c1f3291c150e22eeb | tf_model_zoo/models/street/python/vgsl_model.py | python | VGSLImageModel.Restore | (self, checkpoint_path, sess) | return tf.train.global_step(sess, self.global_step) | Restores the model from the given checkpoint path into the session.
Args:
checkpoint_path: File pathname of the checkpoint.
sess: Session in which to restore the model.
Returns:
global_step of the model. | Restores the model from the given checkpoint path into the session. | [
"Restores",
"the",
"model",
"from",
"the",
"given",
"checkpoint",
"path",
"into",
"the",
"session",
"."
] | def Restore(self, checkpoint_path, sess):
"""Restores the model from the given checkpoint path into the session.
Args:
checkpoint_path: File pathname of the checkpoint.
sess: Session in which to restore the model.
Returns:
global_step of the model.
"""
self.saver.restor... | [
"def",
"Restore",
"(",
"self",
",",
"checkpoint_path",
",",
"sess",
")",
":",
"self",
".",
"saver",
".",
"restore",
"(",
"sess",
",",
"checkpoint_path",
")",
"return",
"tf",
".",
"train",
".",
"global_step",
"(",
"sess",
",",
"self",
".",
"global_step",
... | https://github.com/zhang-can/ECO-pytorch/blob/355c3866b35cdaa5d451263c1f3291c150e22eeb/tf_model_zoo/models/street/python/vgsl_model.py#L335-L345 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/pytz/tzinfo.py | python | memorized_datetime | (seconds) | Create only one instance of each distinct datetime | Create only one instance of each distinct datetime | [
"Create",
"only",
"one",
"instance",
"of",
"each",
"distinct",
"datetime"
] | def memorized_datetime(seconds):
'''Create only one instance of each distinct datetime'''
try:
return _datetime_cache[seconds]
except KeyError:
# NB. We can't just do datetime.utcfromtimestamp(seconds) as this
# fails with negative values under Windows (Bug #90096)
dt = _epoc... | [
"def",
"memorized_datetime",
"(",
"seconds",
")",
":",
"try",
":",
"return",
"_datetime_cache",
"[",
"seconds",
"]",
"except",
"KeyError",
":",
"# NB. We can't just do datetime.utcfromtimestamp(seconds) as this",
"# fails with negative values under Windows (Bug #90096)",
"dt",
... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/pytz/tzinfo.py#L27-L36 | ||
postlund/pyatv | 4ed1f5539f37d86d80272663d1f2ea34a6c41ec4 | scripts/release.py | python | verify_changes | (version) | Verify that CHANGES.md is valid. | Verify that CHANGES.md is valid. | [
"Verify",
"that",
"CHANGES",
".",
"md",
"is",
"valid",
"."
] | def verify_changes(version):
"""Verify that CHANGES.md is valid."""
_LOGGER.info("Verifying CHANGES.md")
changes = Path("CHANGES.md").read_text(encoding="utf-8")
if version not in changes:
bail("Version {0} not in CHANGES.md", version)
if "REMOVE ME" in changes:
bail("CHANGES.md co... | [
"def",
"verify_changes",
"(",
"version",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Verifying CHANGES.md\"",
")",
"changes",
"=",
"Path",
"(",
"\"CHANGES.md\"",
")",
".",
"read_text",
"(",
"encoding",
"=",
"\"utf-8\"",
")",
"if",
"version",
"not",
"in",
"chan... | https://github.com/postlund/pyatv/blob/4ed1f5539f37d86d80272663d1f2ea34a6c41ec4/scripts/release.py#L196-L205 | ||
pyglet/pyglet | 2833c1df902ca81aeeffa786c12e7e87d402434b | pyglet/image/atlas.py | python | Allocator.get_usage | (self) | return self.used_area / float(self.width * self.height) | Get the fraction of area already allocated.
This method is useful for debugging and profiling only.
:rtype: float | Get the fraction of area already allocated. | [
"Get",
"the",
"fraction",
"of",
"area",
"already",
"allocated",
"."
] | def get_usage(self):
"""Get the fraction of area already allocated.
This method is useful for debugging and profiling only.
:rtype: float
"""
return self.used_area / float(self.width * self.height) | [
"def",
"get_usage",
"(",
"self",
")",
":",
"return",
"self",
".",
"used_area",
"/",
"float",
"(",
"self",
".",
"width",
"*",
"self",
".",
"height",
")"
] | https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/image/atlas.py#L152-L159 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/smsforms/models.py | python | SQLXFormsSession.set_current_action_due_timestamp | (self) | [] | def set_current_action_due_timestamp(self):
if self.expire_after == 0:
self.end_time = self.start_time
self.current_action_due = self.start_time
self.session_is_open = False
return
if self.current_action_is_a_reminder:
minutes_from_beginning =... | [
"def",
"set_current_action_due_timestamp",
"(",
"self",
")",
":",
"if",
"self",
".",
"expire_after",
"==",
"0",
":",
"self",
".",
"end_time",
"=",
"self",
".",
"start_time",
"self",
".",
"current_action_due",
"=",
"self",
".",
"start_time",
"self",
".",
"ses... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/smsforms/models.py#L270-L281 | ||||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/asyncio/base_events.py | python | BaseEventLoop._sendfile_fallback | (self, transp, file, offset, count) | [] | async def _sendfile_fallback(self, transp, file, offset, count):
if offset:
file.seek(offset)
blocksize = min(count, 16384) if count else 16384
buf = bytearray(blocksize)
total_sent = 0
proto = _SendfileFallbackProtocol(transp)
try:
while True:
... | [
"async",
"def",
"_sendfile_fallback",
"(",
"self",
",",
"transp",
",",
"file",
",",
"offset",
",",
"count",
")",
":",
"if",
"offset",
":",
"file",
".",
"seek",
"(",
"offset",
")",
"blocksize",
"=",
"min",
"(",
"count",
",",
"16384",
")",
"if",
"count... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/asyncio/base_events.py#L1168-L1191 | ||||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/app.py | python | MedusaApp.LOG_DIR | (self) | return self._LOG_DIR | Return app.LOG_DIR. | Return app.LOG_DIR. | [
"Return",
"app",
".",
"LOG_DIR",
"."
] | def LOG_DIR(self):
"""Return app.LOG_DIR."""
return self._LOG_DIR | [
"def",
"LOG_DIR",
"(",
"self",
")",
":",
"return",
"self",
".",
"_LOG_DIR"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/app.py#L951-L953 | |
smicallef/spiderfoot | fd4bf9394c9ab3ecc90adc3115c56349fb23165b | modules/sfp_dns_for_family.py | python | sfp_dns_for_family.handleEvent | (self, event) | [] | def handleEvent(self, event):
eventName = event.eventType
eventData = event.data
self.debug(f"Received event, {eventName}, from {event.module}")
if eventData in self.results:
return
self.results[eventData] = True
if eventName == "INTERNET_NAME":
... | [
"def",
"handleEvent",
"(",
"self",
",",
"event",
")",
":",
"eventName",
"=",
"event",
".",
"eventType",
"eventData",
"=",
"event",
".",
"data",
"self",
".",
"debug",
"(",
"f\"Received event, {eventName}, from {event.module}\"",
")",
"if",
"eventData",
"in",
"sel... | https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/modules/sfp_dns_for_family.py#L83-L115 | ||||
GalSim-developers/GalSim | a05d4ec3b8d8574f99d3b0606ad882cbba53f345 | galsim/position.py | python | PositionD.round | (self) | return _PositionI(int(round(self.x)), int(round(self.y))) | Return the rounded-off PositionI version of this position. | Return the rounded-off PositionI version of this position. | [
"Return",
"the",
"rounded",
"-",
"off",
"PositionI",
"version",
"of",
"this",
"position",
"."
] | def round(self):
"""Return the rounded-off PositionI version of this position.
"""
return _PositionI(int(round(self.x)), int(round(self.y))) | [
"def",
"round",
"(",
"self",
")",
":",
"return",
"_PositionI",
"(",
"int",
"(",
"round",
"(",
"self",
".",
"x",
")",
")",
",",
"int",
"(",
"round",
"(",
"self",
".",
"y",
")",
")",
")"
] | https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/galsim/position.py#L193-L196 | |
AndroBugs/AndroBugs_Framework | 7fd3a2cb1cf65a9af10b7ed2129701d4451493fe | tools/modified/androguard/core/analysis/analysis.py | python | TaintedPackages.get_permissions | (self, permissions_needed) | return permissions | @param permissions_needed : a list of restricted permissions to get ([] returns all permissions)
@rtype : a dictionnary of permissions' paths | [] | def get_permissions(self, permissions_needed):
"""
@param permissions_needed : a list of restricted permissions to get ([] returns all permissions)
@rtype : a dictionnary of permissions' paths
"""
permissions = {}
pn = set(permissions_needed)
if permissio... | [
"def",
"get_permissions",
"(",
"self",
",",
"permissions_needed",
")",
":",
"permissions",
"=",
"{",
"}",
"pn",
"=",
"set",
"(",
"permissions_needed",
")",
"if",
"permissions_needed",
"==",
"[",
"]",
":",
"pn",
"=",
"set",
"(",
"self",
".",
"AOSP_PERMISSIO... | https://github.com/AndroBugs/AndroBugs_Framework/blob/7fd3a2cb1cf65a9af10b7ed2129701d4451493fe/tools/modified/androguard/core/analysis/analysis.py#L1742-L1772 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_env.py | python | Yedit.yaml_dict | (self, value) | setter method for yaml_dict | setter method for yaml_dict | [
"setter",
"method",
"for",
"yaml_dict"
] | def yaml_dict(self, value):
''' setter method for yaml_dict '''
self.__yaml_dict = value | [
"def",
"yaml_dict",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"__yaml_dict",
"=",
"value"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_env.py#L194-L196 | ||
postgres/pgadmin4 | 374c5e952fa594d749fadf1f88076c1cba8c5f64 | web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py | python | IndexesModule.module_use_template_javascript | (self) | return False | Returns whether Jinja2 template is used for generating the javascript
module. | Returns whether Jinja2 template is used for generating the javascript
module. | [
"Returns",
"whether",
"Jinja2",
"template",
"is",
"used",
"for",
"generating",
"the",
"javascript",
"module",
"."
] | def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False | [
"def",
"module_use_template_javascript",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py#L126-L131 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/distutils/command/sdist.py | python | sdist.prune_file_list | (self) | Prune off branches that might slip into the file list as created
by 'read_template()', but really don't belong there:
* the build tree (typically "build")
* the release tree itself (only an issue if we ran "sdist"
previously with --keep-temp, or it aborted)
* any RCS, C... | Prune off branches that might slip into the file list as created
by 'read_template()', but really don't belong there:
* the build tree (typically "build")
* the release tree itself (only an issue if we ran "sdist"
previously with --keep-temp, or it aborted)
* any RCS, C... | [
"Prune",
"off",
"branches",
"that",
"might",
"slip",
"into",
"the",
"file",
"list",
"as",
"created",
"by",
"read_template",
"()",
"but",
"really",
"don",
"t",
"belong",
"there",
":",
"*",
"the",
"build",
"tree",
"(",
"typically",
"build",
")",
"*",
"the"... | def prune_file_list(self):
"""Prune off branches that might slip into the file list as created
by 'read_template()', but really don't belong there:
* the build tree (typically "build")
* the release tree itself (only an issue if we ran "sdist"
previously with --keep-temp,... | [
"def",
"prune_file_list",
"(",
"self",
")",
":",
"build",
"=",
"self",
".",
"get_finalized_command",
"(",
"'build'",
")",
"base_dir",
"=",
"self",
".",
"distribution",
".",
"get_fullname",
"(",
")",
"self",
".",
"filelist",
".",
"exclude_pattern",
"(",
"None... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/distutils/command/sdist.py#L321-L345 | ||
dmeranda/demjson | 5bc65974e7141746acc88c581f5d2dfb8ea14064 | demjson.py | python | buffered_stream.save_position | (self) | return True | [] | def save_position(self):
self.__saved_pos.append( self.__pos.copy() )
return True | [
"def",
"save_position",
"(",
"self",
")",
":",
"self",
".",
"__saved_pos",
".",
"append",
"(",
"self",
".",
"__pos",
".",
"copy",
"(",
")",
")",
"return",
"True"
] | https://github.com/dmeranda/demjson/blob/5bc65974e7141746acc88c581f5d2dfb8ea14064/demjson.py#L1629-L1631 | |||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbYingKeSongPaiZhaoShenHeJieKou.yunos_tvpubadmin_diccontroltask_update | (
self,
id='',
status='0',
license='0'
) | return self._top_request(
"yunos.tvpubadmin.diccontroltask.update",
{
"id": id,
"status": status,
"license": license
},
result_processor=lambda x: x["object"]
) | 停开服任务状态变更
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28584
:param id: 任务ID
:param status: 任务状态
:param license: 牌照方 | 停开服任务状态变更
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28584 | [
"停开服任务状态变更",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"28584"
] | def yunos_tvpubadmin_diccontroltask_update(
self,
id='',
status='0',
license='0'
):
"""
停开服任务状态变更
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28584
:param id: 任务ID
:param status: 任务状态
:param license: 牌照方
... | [
"def",
"yunos_tvpubadmin_diccontroltask_update",
"(",
"self",
",",
"id",
"=",
"''",
",",
"status",
"=",
"'0'",
",",
"license",
"=",
"'0'",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"yunos.tvpubadmin.diccontroltask.update\"",
",",
"{",
"\"id\"",
":"... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L84273-L84295 | |
hauntek/python-ngrok | cc6162c18dd7844c9f492272bd9ea601d09af27d | demo/sunny.py | python | ngrok_adds | (Tunnel) | [] | def ngrok_adds(Tunnel):
global Tunnels
for tunnelinfo in Tunnel:
if tunnelinfo.get('proto'):
if tunnelinfo.get('proto').get('http'):
protocol = 'http'
if tunnelinfo.get('proto').get('https'):
protocol = 'https'
if tunnelinfo.get('proto'... | [
"def",
"ngrok_adds",
"(",
"Tunnel",
")",
":",
"global",
"Tunnels",
"for",
"tunnelinfo",
"in",
"Tunnel",
":",
"if",
"tunnelinfo",
".",
"get",
"(",
"'proto'",
")",
":",
"if",
"tunnelinfo",
".",
"get",
"(",
"'proto'",
")",
".",
"get",
"(",
"'http'",
")",
... | https://github.com/hauntek/python-ngrok/blob/cc6162c18dd7844c9f492272bd9ea601d09af27d/demo/sunny.py#L76-L101 | ||||
facebookresearch/pytorch3d | fddd6a700fa9685c1ce2d4b266c111d7db424ecc | pytorch3d/utils/camera_conversions.py | python | cameras_from_opencv_projection | (
R: torch.Tensor,
tvec: torch.Tensor,
camera_matrix: torch.Tensor,
image_size: torch.Tensor,
) | return _cameras_from_opencv_projection(R, tvec, camera_matrix, image_size) | Converts a batch of OpenCV-conventioned cameras parametrized with the
rotation matrices `R`, translation vectors `tvec`, and the camera
calibration matrices `camera_matrix` to `PerspectiveCameras` in PyTorch3D
convention.
More specifically, the conversion is carried out such that a projection
of a ... | Converts a batch of OpenCV-conventioned cameras parametrized with the
rotation matrices `R`, translation vectors `tvec`, and the camera
calibration matrices `camera_matrix` to `PerspectiveCameras` in PyTorch3D
convention. | [
"Converts",
"a",
"batch",
"of",
"OpenCV",
"-",
"conventioned",
"cameras",
"parametrized",
"with",
"the",
"rotation",
"matrices",
"R",
"translation",
"vectors",
"tvec",
"and",
"the",
"camera",
"calibration",
"matrices",
"camera_matrix",
"to",
"PerspectiveCameras",
"i... | def cameras_from_opencv_projection(
R: torch.Tensor,
tvec: torch.Tensor,
camera_matrix: torch.Tensor,
image_size: torch.Tensor,
) -> PerspectiveCameras:
"""
Converts a batch of OpenCV-conventioned cameras parametrized with the
rotation matrices `R`, translation vectors `tvec`, and the camera... | [
"def",
"cameras_from_opencv_projection",
"(",
"R",
":",
"torch",
".",
"Tensor",
",",
"tvec",
":",
"torch",
".",
"Tensor",
",",
"camera_matrix",
":",
"torch",
".",
"Tensor",
",",
"image_size",
":",
"torch",
".",
"Tensor",
",",
")",
"->",
"PerspectiveCameras",... | https://github.com/facebookresearch/pytorch3d/blob/fddd6a700fa9685c1ce2d4b266c111d7db424ecc/pytorch3d/utils/camera_conversions.py#L20-L62 | |
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | py/path/__init__.py | python | SvnPathBase.new | (self, **kw) | create a modified version of this path. A 'rev' argument
indicates a new revision.
the following keyword arguments modify various path parts::
http://host.com/repo/path/file.ext
|-----------------------| dirname
|-----... | create a modified version of this path. A 'rev' argument
indicates a new revision.
the following keyword arguments modify various path parts:: | [
"create",
"a",
"modified",
"version",
"of",
"this",
"path",
".",
"A",
"rev",
"argument",
"indicates",
"a",
"new",
"revision",
".",
"the",
"following",
"keyword",
"arguments",
"modify",
"various",
"path",
"parts",
"::"
] | def new(self, **kw):
""" create a modified version of this path. A 'rev' argument
indicates a new revision.
the following keyword arguments modify various path parts::
http://host.com/repo/path/file.ext
|-----------------------| dirname
... | [
"def",
"new",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/py/path/__init__.py#L399-L409 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python3-alpha/python-libs/gdata/docs/client.py | python | DocsClient.get_resource_acl | (self, entry, **kwargs) | return self.get_feed(entry.GetAclFeedLink().href,
desired_class=gdata.docs.data.AclFeed, **kwargs) | Retrieves the ACL sharing permissions for the given entry.
Args:
entry: gdata.docs.data.Resource for which to get ACL.
kwargs: Other parameters to pass to self.get_feed().
Returns:
gdata.docs.data.AclFeed representing the resource's ACL. | Retrieves the ACL sharing permissions for the given entry. | [
"Retrieves",
"the",
"ACL",
"sharing",
"permissions",
"for",
"the",
"given",
"entry",
"."
] | def get_resource_acl(self, entry, **kwargs):
"""Retrieves the ACL sharing permissions for the given entry.
Args:
entry: gdata.docs.data.Resource for which to get ACL.
kwargs: Other parameters to pass to self.get_feed().
Returns:
gdata.docs.data.AclFeed representing the resource's ACL.
... | [
"def",
"get_resource_acl",
"(",
"self",
",",
"entry",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_check_entry_is_resource",
"(",
"entry",
")",
"return",
"self",
".",
"get_feed",
"(",
"entry",
".",
"GetAclFeedLink",
"(",
")",
".",
"href",
",",
"desi... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/gdata/docs/client.py#L250-L262 | |
hankcs/HanLP | 6c02812969c4827d74b404c3ad4207f71ca9165a | hanlp/utils/io_util.py | python | get_resource | (path: str, save_dir=hanlp_home(), extract=True, prefix=HANLP_URL, append_location=True,
verbose=HANLP_VERBOSE) | return path | Fetch real (local) path for a resource (model, corpus, whatever) to ``save_dir``.
Args:
path: A local path (which will returned as is) or a remote URL (which will be downloaded, decompressed then
returned).
save_dir: Where to store the resource (Default value = :meth:`hanlp.utils.io_util.hanlp_... | Fetch real (local) path for a resource (model, corpus, whatever) to ``save_dir``. | [
"Fetch",
"real",
"(",
"local",
")",
"path",
"for",
"a",
"resource",
"(",
"model",
"corpus",
"whatever",
")",
"to",
"save_dir",
"."
] | def get_resource(path: str, save_dir=hanlp_home(), extract=True, prefix=HANLP_URL, append_location=True,
verbose=HANLP_VERBOSE):
"""Fetch real (local) path for a resource (model, corpus, whatever) to ``save_dir``.
Args:
path: A local path (which will returned as is) or a remote URL (whic... | [
"def",
"get_resource",
"(",
"path",
":",
"str",
",",
"save_dir",
"=",
"hanlp_home",
"(",
")",
",",
"extract",
"=",
"True",
",",
"prefix",
"=",
"HANLP_URL",
",",
"append_location",
"=",
"True",
",",
"verbose",
"=",
"HANLP_VERBOSE",
")",
":",
"path",
"=",
... | https://github.com/hankcs/HanLP/blob/6c02812969c4827d74b404c3ad4207f71ca9165a/hanlp/utils/io_util.py#L277-L348 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/shutil.py | python | copy | (src, dst, *, follow_symlinks=True) | return dst | Copy data and mode bits ("cp src dst"). Return the file's destination.
The destination may be a directory.
If follow_symlinks is false, symlinks won't be followed. This
resembles GNU's "cp -P src dst".
If source and destination are the same file, a SameFileError will be
raised. | Copy data and mode bits ("cp src dst"). Return the file's destination. | [
"Copy",
"data",
"and",
"mode",
"bits",
"(",
"cp",
"src",
"dst",
")",
".",
"Return",
"the",
"file",
"s",
"destination",
"."
] | def copy(src, dst, *, follow_symlinks=True):
"""Copy data and mode bits ("cp src dst"). Return the file's destination.
The destination may be a directory.
If follow_symlinks is false, symlinks won't be followed. This
resembles GNU's "cp -P src dst".
If source and destination are the same file, a ... | [
"def",
"copy",
"(",
"src",
",",
"dst",
",",
"*",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"dst",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dst",
",",
"os",
".",
"path",
".",
... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/shutil.py#L405-L421 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/Mali.py | python | Mali.maskColumns | (self, columns, mask_char="x") | mask columns in a multiple alignment. | mask columns in a multiple alignment. | [
"mask",
"columns",
"in",
"a",
"multiple",
"alignment",
"."
] | def maskColumns(self, columns, mask_char="x"):
"""mask columns in a multiple alignment."""
for identifier, s in list(self.mMali.items()):
s.maskColumns(columns, mask_char=mask_char) | [
"def",
"maskColumns",
"(",
"self",
",",
"columns",
",",
"mask_char",
"=",
"\"x\"",
")",
":",
"for",
"identifier",
",",
"s",
"in",
"list",
"(",
"self",
".",
"mMali",
".",
"items",
"(",
")",
")",
":",
"s",
".",
"maskColumns",
"(",
"columns",
",",
"ma... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/Mali.py#L1059-L1063 | ||
xiaohan2012/twitter-sent-dnn | 74a16c7edd3be4cb5fb61e15a56e3249da504603 | plot_util.py | python | plot_hist | (rows, title) | histogram plot as described in http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf | histogram plot as described in http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf | [
"histogram",
"plot",
"as",
"described",
"in",
"http",
":",
"//",
"jmlr",
".",
"org",
"/",
"proceedings",
"/",
"papers",
"/",
"v9",
"/",
"glorot10a",
"/",
"glorot10a",
".",
"pdf"
] | def plot_hist(rows, title):
"""
histogram plot as described in http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf
"""
fig = plt.figure()
ax = fig.add_subplot(111)
# plot the activation history
layer_i = 1
assert len(rows[0]) > 0
for x in rows:
ax.hist(x,
... | [
"def",
"plot_hist",
"(",
"rows",
",",
"title",
")",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
")",
"ax",
"=",
"fig",
".",
"add_subplot",
"(",
"111",
")",
"# plot the activation history",
"layer_i",
"=",
"1",
"assert",
"len",
"(",
"rows",
"[",
"0",
... | https://github.com/xiaohan2012/twitter-sent-dnn/blob/74a16c7edd3be4cb5fb61e15a56e3249da504603/plot_util.py#L35-L57 | ||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/metagoofil/hachoir_metadata/formatter.py | python | humanComprRate | (rate) | return u"%.1fx" % rate | [] | def humanComprRate(rate):
return u"%.1fx" % rate | [
"def",
"humanComprRate",
"(",
"rate",
")",
":",
"return",
"u\"%.1fx\"",
"%",
"rate"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_metadata/formatter.py#L14-L15 | |||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/chat/v2/service/role.py | python | RoleList.create | (self, friendly_name, type, permission) | return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) | Create the RoleInstance
:param unicode friendly_name: A string to describe the new resource
:param RoleInstance.RoleType type: The type of role
:param list[unicode] permission: A permission the role should have
:returns: The created RoleInstance
:rtype: twilio.rest.chat.v2.serv... | Create the RoleInstance | [
"Create",
"the",
"RoleInstance"
] | def create(self, friendly_name, type, permission):
"""
Create the RoleInstance
:param unicode friendly_name: A string to describe the new resource
:param RoleInstance.RoleType type: The type of role
:param list[unicode] permission: A permission the role should have
:ret... | [
"def",
"create",
"(",
"self",
",",
"friendly_name",
",",
"type",
",",
"permission",
")",
":",
"data",
"=",
"values",
".",
"of",
"(",
"{",
"'FriendlyName'",
":",
"friendly_name",
",",
"'Type'",
":",
"type",
",",
"'Permission'",
":",
"serialize",
".",
"map... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/chat/v2/service/role.py#L36-L55 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/runpy.py | python | run_module | (mod_name, init_globals=None,
run_name=None, alter_sys=False) | Execute a module's code without importing it
Returns the resulting top level namespace dictionary | Execute a module's code without importing it | [
"Execute",
"a",
"module",
"s",
"code",
"without",
"importing",
"it"
] | def run_module(mod_name, init_globals=None,
run_name=None, alter_sys=False):
"""Execute a module's code without importing it
Returns the resulting top level namespace dictionary
"""
mod_name, loader, code, fname = _get_module_details(mod_name)
if run_name is None:
run_name... | [
"def",
"run_module",
"(",
"mod_name",
",",
"init_globals",
"=",
"None",
",",
"run_name",
"=",
"None",
",",
"alter_sys",
"=",
"False",
")",
":",
"mod_name",
",",
"loader",
",",
"code",
",",
"fname",
"=",
"_get_module_details",
"(",
"mod_name",
")",
"if",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/runpy.py#L164-L180 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/multiprocessing/managers.py | python | ListProxy.__iadd__ | (self, value) | return self | [] | def __iadd__(self, value):
self._callmethod('extend', (value,))
return self | [
"def",
"__iadd__",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_callmethod",
"(",
"'extend'",
",",
"(",
"value",
",",
")",
")",
"return",
"self"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/multiprocessing/managers.py#L1053-L1055 | |||
timkpaine/paperboy | 6c0854b2c0dad139c25153e520ca79ffed820fa4 | paperboy/scheduler/luigi/luigi.py | python | LuigiScheduler.template | (config, user, notebook, job, reports, *args, **kwargs) | return tpl | jinja templatize luigi task for paperboy (paperboy.luigi.py) | jinja templatize luigi task for paperboy (paperboy.luigi.py) | [
"jinja",
"templatize",
"luigi",
"task",
"for",
"paperboy",
"(",
"paperboy",
".",
"luigi",
".",
"py",
")"
] | def template(config, user, notebook, job, reports, *args, **kwargs):
'''jinja templatize luigi task for paperboy (paperboy.luigi.py)'''
owner = user.name
start_date = job.meta.start_time.strftime('%m/%d/%Y %H:%M:%S')
email = 'test@test.com'
job_json = b64encode(json.dumps(job.to_... | [
"def",
"template",
"(",
"config",
",",
"user",
",",
"notebook",
",",
"job",
",",
"reports",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"owner",
"=",
"user",
".",
"name",
"start_date",
"=",
"job",
".",
"meta",
".",
"start_time",
".",
"strf... | https://github.com/timkpaine/paperboy/blob/6c0854b2c0dad139c25153e520ca79ffed820fa4/paperboy/scheduler/luigi/luigi.py#L49-L67 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/storage/stores/file/config.py | python | FileStorageConfiguration.services_storage | (self) | return self._services_storage | [] | def services_storage(self):
return self._services_storage | [
"def",
"services_storage",
"(",
"self",
")",
":",
"return",
"self",
".",
"_services_storage"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/storage/stores/file/config.py#L243-L244 | |||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/tarfile.py | python | _FileInFile.readable | (self) | return True | [] | def readable(self):
return True | [
"def",
"readable",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/tarfile.py#L634-L635 | |||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/epo/Integrations/epoV2/epoV2.py | python | epo_get_latest_dat_command | (client: Client) | return CommandResults(
readable_output=readable_output,
outputs_prefix='McAfee.ePO.latestDAT',
outputs=latest_dat_version,
raw_response=raw_response
) | get the latest available version of the dat file.
dat file is the McAfee A/V software definition file.
XSOAR Cmd example: !epo-get-latest-dat
Args:
client (Client: BaseClient): a utility class used for communicating with ePO Server
Returns:
CommandResults (dict) | get the latest available version of the dat file.
dat file is the McAfee A/V software definition file.
XSOAR Cmd example: !epo-get-latest-dat
Args:
client (Client: BaseClient): a utility class used for communicating with ePO Server
Returns:
CommandResults (dict) | [
"get",
"the",
"latest",
"available",
"version",
"of",
"the",
"dat",
"file",
".",
"dat",
"file",
"is",
"the",
"McAfee",
"A",
"/",
"V",
"software",
"definition",
"file",
".",
"XSOAR",
"Cmd",
"example",
":",
"!epo",
"-",
"get",
"-",
"latest",
"-",
"dat",
... | def epo_get_latest_dat_command(client: Client) -> CommandResults:
"""
get the latest available version of the dat file.
dat file is the McAfee A/V software definition file.
XSOAR Cmd example: !epo-get-latest-dat
Args:
client (Client: BaseClient): a utility class used for communicating with e... | [
"def",
"epo_get_latest_dat_command",
"(",
"client",
":",
"Client",
")",
"->",
"CommandResults",
":",
"json_response",
",",
"raw_response",
"=",
"client",
".",
"epo_get_latest_dat",
"(",
")",
"latest_dat_version",
"=",
"json_response",
".",
"get",
"(",
"'LatestVersio... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/epo/Integrations/epoV2/epoV2.py#L979-L1000 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/idlelib/pyparse.py | python | Parser.get_num_lines_in_stmt | (self) | return goodlines[-1] - goodlines[-2] | Return number of physical lines in last stmt.
The statement doesn't have to be an interesting statement. This is
intended to be called when continuation is C_BACKSLASH. | Return number of physical lines in last stmt. | [
"Return",
"number",
"of",
"physical",
"lines",
"in",
"last",
"stmt",
"."
] | def get_num_lines_in_stmt(self):
"""Return number of physical lines in last stmt.
The statement doesn't have to be an interesting statement. This is
intended to be called when continuation is C_BACKSLASH.
"""
self._study1()
goodlines = self.goodlines
return good... | [
"def",
"get_num_lines_in_stmt",
"(",
"self",
")",
":",
"self",
".",
"_study1",
"(",
")",
"goodlines",
"=",
"self",
".",
"goodlines",
"return",
"goodlines",
"[",
"-",
"1",
"]",
"-",
"goodlines",
"[",
"-",
"2",
"]"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/idlelib/pyparse.py#L493-L501 | |
hankcs/HanLP | 6c02812969c4827d74b404c3ad4207f71ca9165a | hanlp/common/torch_component.py | python | TorchComponent.predict | (self, *args, **kwargs) | Predict on data fed by user. Users shall avoid directly call this method since it is not guarded with
``torch.no_grad`` and will introduces unnecessary gradient computation. Use ``__call__`` instead.
Args:
*args: Sentences or tokens.
**kwargs: Used in sub-classes. | Predict on data fed by user. Users shall avoid directly call this method since it is not guarded with
``torch.no_grad`` and will introduces unnecessary gradient computation. Use ``__call__`` instead. | [
"Predict",
"on",
"data",
"fed",
"by",
"user",
".",
"Users",
"shall",
"avoid",
"directly",
"call",
"this",
"method",
"since",
"it",
"is",
"not",
"guarded",
"with",
"torch",
".",
"no_grad",
"and",
"will",
"introduces",
"unnecessary",
"gradient",
"computation",
... | def predict(self, *args, **kwargs):
"""Predict on data fed by user. Users shall avoid directly call this method since it is not guarded with
``torch.no_grad`` and will introduces unnecessary gradient computation. Use ``__call__`` instead.
Args:
*args: Sentences or tokens.
... | [
"def",
"predict",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | https://github.com/hankcs/HanLP/blob/6c02812969c4827d74b404c3ad4207f71ca9165a/hanlp/common/torch_component.py#L604-L612 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/grizzled/grizzled/net/ftp/parse.py | python | parse_ftp_list_line | (ftp_list_line) | return FTPListDataParser().parse_line(ftp_list_line) | Convenience function that instantiates an `FTPListDataParser` object
and passes ``ftp_list_line`` to the object's ``parse_line()`` method,
returning the result.
:Parameters:
ftp_list_line : str
The line of output
:rtype: `FTPListData`
:return: An `FTPListData` object describing... | Convenience function that instantiates an `FTPListDataParser` object
and passes ``ftp_list_line`` to the object's ``parse_line()`` method,
returning the result. | [
"Convenience",
"function",
"that",
"instantiates",
"an",
"FTPListDataParser",
"object",
"and",
"passes",
"ftp_list_line",
"to",
"the",
"object",
"s",
"parse_line",
"()",
"method",
"returning",
"the",
"result",
"."
] | def parse_ftp_list_line(ftp_list_line):
"""
Convenience function that instantiates an `FTPListDataParser` object
and passes ``ftp_list_line`` to the object's ``parse_line()`` method,
returning the result.
:Parameters:
ftp_list_line : str
The line of output
:rtype: `FTPListD... | [
"def",
"parse_ftp_list_line",
"(",
"ftp_list_line",
")",
":",
"return",
"FTPListDataParser",
"(",
")",
".",
"parse_line",
"(",
"ftp_list_line",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/grizzled/grizzled/net/ftp/parse.py#L507-L523 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/db/models/query.py | python | QuerySet.get | (self, *args, **kwargs) | Performs the query and returns a single object matching the given
keyword arguments. | Performs the query and returns a single object matching the given
keyword arguments. | [
"Performs",
"the",
"query",
"and",
"returns",
"a",
"single",
"object",
"matching",
"the",
"given",
"keyword",
"arguments",
"."
] | def get(self, *args, **kwargs):
"""
Performs the query and returns a single object matching the given
keyword arguments.
"""
clone = self.filter(*args, **kwargs)
if self.query.can_filter():
clone = clone.order_by()
num = len(clone)
if num == 1:... | [
"def",
"get",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"clone",
"=",
"self",
".",
"filter",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"self",
".",
"query",
".",
"can_filter",
"(",
")",
":",
"clone",
"=",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/db/models/query.py#L334-L349 | ||
jjakimoto/finance_ml | 8ff4727916e39f62cca32eddeff31d94bdc85867 | finance_ml/multiprocessing/partition.py | python | linear_parts | (num_atoms, num_threads) | return parts | Linear partitions
Args:
num_atoms (int): The number of data points
num_threads (int): The number of partitions to split
Returns:
array-like: indices of start and end | Linear partitions | [
"Linear",
"partitions"
] | def linear_parts(num_atoms, num_threads):
"""Linear partitions
Args:
num_atoms (int): The number of data points
num_threads (int): The number of partitions to split
Returns:
array-like: indices of start and end
"""
parts = np.linspace(0, num_atoms, min(num_threads, num_ato... | [
"def",
"linear_parts",
"(",
"num_atoms",
",",
"num_threads",
")",
":",
"parts",
"=",
"np",
".",
"linspace",
"(",
"0",
",",
"num_atoms",
",",
"min",
"(",
"num_threads",
",",
"num_atoms",
")",
"+",
"1",
")",
"parts",
"=",
"np",
".",
"ceil",
"(",
"parts... | https://github.com/jjakimoto/finance_ml/blob/8ff4727916e39f62cca32eddeff31d94bdc85867/finance_ml/multiprocessing/partition.py#L4-L17 | |
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | src/outwiker/gui/controls/ultimatelistctrl.py | python | UltimateListItem.SetState | (self, state) | Sets the item state flags.
:param `state`: any combination of the following bits:
============================ ========= ==============================
State Bits Hex Value Description
============================ ========= ==============================
`... | Sets the item state flags. | [
"Sets",
"the",
"item",
"state",
"flags",
"."
] | def SetState(self, state):
"""
Sets the item state flags.
:param `state`: any combination of the following bits:
============================ ========= ==============================
State Bits Hex Value Description
============================ ====... | [
"def",
"SetState",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"_mask",
"|=",
"ULC_MASK_STATE",
"self",
".",
"_state",
"=",
"state",
"self",
".",
"_stateMask",
"|=",
"state"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L1469-L1497 | ||
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | futures/ctp/ApiStruct.py | python | ErrExecOrder.__init__ | (self, BrokerID='', InvestorID='', InstrumentID='', ExecOrderRef='', UserID='', Volume=0, RequestID=0, BusinessUnit='', OffsetFlag=OF_Open, HedgeFlag=HF_Speculation, ActionType=ACTP_Exec, PosiDirection=PD_Net, ReservePositionFlag=EOPF_Reserve, CloseFlag=EOCF_AutoClose, ErrorID=0, ErrorMsg='') | [] | def __init__(self, BrokerID='', InvestorID='', InstrumentID='', ExecOrderRef='', UserID='', Volume=0, RequestID=0, BusinessUnit='', OffsetFlag=OF_Open, HedgeFlag=HF_Speculation, ActionType=ACTP_Exec, PosiDirection=PD_Net, ReservePositionFlag=EOPF_Reserve, CloseFlag=EOCF_AutoClose, ErrorID=0, ErrorMsg=''):
self.... | [
"def",
"__init__",
"(",
"self",
",",
"BrokerID",
"=",
"''",
",",
"InvestorID",
"=",
"''",
",",
"InstrumentID",
"=",
"''",
",",
"ExecOrderRef",
"=",
"''",
",",
"UserID",
"=",
"''",
",",
"Volume",
"=",
"0",
",",
"RequestID",
"=",
"0",
",",
"BusinessUni... | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/futures/ctp/ApiStruct.py#L3466-L3482 | ||||
SolidCode/SolidPython | 4715c827ad90db26ee37df57bc425e6f2de3cf8d | solid/py_scadparser/scad_tokens.py | python | t_error | (t) | [] | def t_error(t):
print(f'py_scadparser: Illegal character: {t.lexer.filename}({t.lexer.lineno}) "{t.value[0]}"')
t.lexer.skip(1) | [
"def",
"t_error",
"(",
"t",
")",
":",
"print",
"(",
"f'py_scadparser: Illegal character: {t.lexer.filename}({t.lexer.lineno}) \"{t.value[0]}\"'",
")",
"t",
".",
"lexer",
".",
"skip",
"(",
"1",
")"
] | https://github.com/SolidCode/SolidPython/blob/4715c827ad90db26ee37df57bc425e6f2de3cf8d/solid/py_scadparser/scad_tokens.py#L88-L90 | ||||
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/scipy/signal/ltisys.py | python | TransferFunction.__repr__ | (self) | return '{0}(\n{1},\n{2},\ndt: {3}\n)'.format(
self.__class__.__name__,
repr(self.num),
repr(self.den),
repr(self.dt),
) | Return representation of the system's transfer function | Return representation of the system's transfer function | [
"Return",
"representation",
"of",
"the",
"system",
"s",
"transfer",
"function"
] | def __repr__(self):
"""Return representation of the system's transfer function"""
return '{0}(\n{1},\n{2},\ndt: {3}\n)'.format(
self.__class__.__name__,
repr(self.num),
repr(self.den),
repr(self.dt),
) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'{0}(\\n{1},\\n{2},\\ndt: {3}\\n)'",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"repr",
"(",
"self",
".",
"num",
")",
",",
"repr",
"(",
"self",
".",
"den",
")",
",",
"repr",
... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/signal/ltisys.py#L763-L770 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/sqli/plugins/dbms/postgresql/takeover.py | python | Takeover.uncPathRequest | (self) | [] | def uncPathRequest(self):
self.createSupportTbl(self.fileTblName, self.tblField, "text")
inject.goStacked("COPY %s(%s) FROM '%s'" % (self.fileTblName, self.tblField, self.uncPath), silent=True)
self.cleanup(onlyFileTbl=True) | [
"def",
"uncPathRequest",
"(",
"self",
")",
":",
"self",
".",
"createSupportTbl",
"(",
"self",
".",
"fileTblName",
",",
"self",
".",
"tblField",
",",
"\"text\"",
")",
"inject",
".",
"goStacked",
"(",
"\"COPY %s(%s) FROM '%s'\"",
"%",
"(",
"self",
".",
"fileTb... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/plugins/dbms/postgresql/takeover.py#L95-L98 | ||||
hzy46/Deep-Learning-21-Examples | 15c2d9edccad090cd67b033f24a43c544e5cba3e | chapter_16/nmt/utils/evaluation_utils.py | python | _accuracy | (label_file, pred_file) | return 100 * match / count | Compute accuracy, each line contains a label. | Compute accuracy, each line contains a label. | [
"Compute",
"accuracy",
"each",
"line",
"contains",
"a",
"label",
"."
] | def _accuracy(label_file, pred_file):
"""Compute accuracy, each line contains a label."""
with codecs.getreader("utf-8")(tf.gfile.GFile(label_file, "rb")) as label_fh:
with codecs.getreader("utf-8")(tf.gfile.GFile(pred_file, "rb")) as pred_fh:
count = 0.0
match = 0.0
for label in label_fh:
... | [
"def",
"_accuracy",
"(",
"label_file",
",",
"pred_file",
")",
":",
"with",
"codecs",
".",
"getreader",
"(",
"\"utf-8\"",
")",
"(",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"label_file",
",",
"\"rb\"",
")",
")",
"as",
"label_fh",
":",
"with",
"codecs",
".... | https://github.com/hzy46/Deep-Learning-21-Examples/blob/15c2d9edccad090cd67b033f24a43c544e5cba3e/chapter_16/nmt/utils/evaluation_utils.py#L111-L124 | |
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | s2s-ft/s2s_ft/modeling_decoding.py | python | LabelSmoothingLoss.forward | (self, output, target) | return F.kl_div(output, model_prob, reduction='none').view(batch_size, num_pos, -1).sum(2) | output (FloatTensor): batch_size * num_pos * n_classes
target (LongTensor): batch_size * num_pos | output (FloatTensor): batch_size * num_pos * n_classes
target (LongTensor): batch_size * num_pos | [
"output",
"(",
"FloatTensor",
")",
":",
"batch_size",
"*",
"num_pos",
"*",
"n_classes",
"target",
"(",
"LongTensor",
")",
":",
"batch_size",
"*",
"num_pos"
] | def forward(self, output, target):
"""
output (FloatTensor): batch_size * num_pos * n_classes
target (LongTensor): batch_size * num_pos
"""
assert self.tgt_vocab_size == output.size(2)
batch_size, num_pos = target.size(0), target.size(1)
output = output.view(-1, s... | [
"def",
"forward",
"(",
"self",
",",
"output",
",",
"target",
")",
":",
"assert",
"self",
".",
"tgt_vocab_size",
"==",
"output",
".",
"size",
"(",
"2",
")",
"batch_size",
",",
"num_pos",
"=",
"target",
".",
"size",
"(",
"0",
")",
",",
"target",
".",
... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/s2s-ft/s2s_ft/modeling_decoding.py#L52-L65 | |
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/gluon/contrib/pysimplesoap/simplexml.py | python | SimpleXMLElement.get_namespace_uri | (self, ns) | Return the namespace uri for a prefix | Return the namespace uri for a prefix | [
"Return",
"the",
"namespace",
"uri",
"for",
"a",
"prefix"
] | def get_namespace_uri(self, ns):
"""Return the namespace uri for a prefix"""
element = self._element
while element is not None and element.attributes is not None:
try:
return element.attributes['xmlns:%s' % ns].value
except KeyError:
elemen... | [
"def",
"get_namespace_uri",
"(",
"self",
",",
"ns",
")",
":",
"element",
"=",
"self",
".",
"_element",
"while",
"element",
"is",
"not",
"None",
"and",
"element",
".",
"attributes",
"is",
"not",
"None",
":",
"try",
":",
"return",
"element",
".",
"attribut... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/gluon/contrib/pysimplesoap/simplexml.py#L145-L152 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/aui/framemanager.py | python | AuiManager.CopyTarget | (self, target) | return drop | Copies all the attributes of the input `target` into another :class:`AuiPaneInfo`.
:param `target`: the source :class:`AuiPaneInfo` from where to copy attributes. | Copies all the attributes of the input `target` into another :class:`AuiPaneInfo`. | [
"Copies",
"all",
"the",
"attributes",
"of",
"the",
"input",
"target",
"into",
"another",
":",
"class",
":",
"AuiPaneInfo",
"."
] | def CopyTarget(self, target):
"""
Copies all the attributes of the input `target` into another :class:`AuiPaneInfo`.
:param `target`: the source :class:`AuiPaneInfo` from where to copy attributes.
"""
drop = AuiPaneInfo()
drop.name = target.name
drop.caption = t... | [
"def",
"CopyTarget",
"(",
"self",
",",
"target",
")",
":",
"drop",
"=",
"AuiPaneInfo",
"(",
")",
"drop",
".",
"name",
"=",
"target",
".",
"name",
"drop",
".",
"caption",
"=",
"target",
".",
"caption",
"drop",
".",
"window",
"=",
"target",
".",
"windo... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/aui/framemanager.py#L7351-L7383 | |
tlsnotary/tlsnotary | be3346ca8e754c7f1d027c33b183f7e799d2b0b0 | src/auditee/tlsnotary-auditee.py | python | negotiate_crippled_secrets | (tlsn_session, tls_sock) | return 'success' | Negotiate with auditor in order to create valid session keys
(except server mac is garbage as auditor withholds it) | Negotiate with auditor in order to create valid session keys
(except server mac is garbage as auditor withholds it) | [
"Negotiate",
"with",
"auditor",
"in",
"order",
"to",
"create",
"valid",
"session",
"keys",
"(",
"except",
"server",
"mac",
"is",
"garbage",
"as",
"auditor",
"withholds",
"it",
")"
] | def negotiate_crippled_secrets(tlsn_session, tls_sock):
'''Negotiate with auditor in order to create valid session keys
(except server mac is garbage as auditor withholds it)'''
assert tlsn_session.handshake_hash_md5
assert tlsn_session.handshake_hash_sha
tlsn_session.set_auditee_secret()
cs_cr_... | [
"def",
"negotiate_crippled_secrets",
"(",
"tlsn_session",
",",
"tls_sock",
")",
":",
"assert",
"tlsn_session",
".",
"handshake_hash_md5",
"assert",
"tlsn_session",
".",
"handshake_hash_sha",
"tlsn_session",
".",
"set_auditee_secret",
"(",
")",
"cs_cr_sr_hmacms_verifymd5sha"... | https://github.com/tlsnotary/tlsnotary/blob/be3346ca8e754c7f1d027c33b183f7e799d2b0b0/src/auditee/tlsnotary-auditee.py#L597-L626 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cvm/v20170312/models.py | python | SystemDisk.__init__ | (self) | r"""
:param DiskType: 系统盘类型。系统盘类型限制详见[存储概述](https://cloud.tencent.com/document/product/213/4952)。取值范围:<br><li>LOCAL_BASIC:本地硬盘<br><li>LOCAL_SSD:本地SSD硬盘<br><li>CLOUD_BASIC:普通云硬盘<br><li>CLOUD_SSD:SSD云硬盘<br><li>CLOUD_PREMIUM:高性能云硬盘<br><br>默认取值:当前有库存的硬盘类型。
:type DiskType: str
:param DiskId: 系统盘ID。LO... | r"""
:param DiskType: 系统盘类型。系统盘类型限制详见[存储概述](https://cloud.tencent.com/document/product/213/4952)。取值范围:<br><li>LOCAL_BASIC:本地硬盘<br><li>LOCAL_SSD:本地SSD硬盘<br><li>CLOUD_BASIC:普通云硬盘<br><li>CLOUD_SSD:SSD云硬盘<br><li>CLOUD_PREMIUM:高性能云硬盘<br><br>默认取值:当前有库存的硬盘类型。
:type DiskType: str
:param DiskId: 系统盘ID。LO... | [
"r",
":",
"param",
"DiskType",
":",
"系统盘类型。系统盘类型限制详见",
"[",
"存储概述",
"]",
"(",
"https",
":",
"//",
"cloud",
".",
"tencent",
".",
"com",
"/",
"document",
"/",
"product",
"/",
"213",
"/",
"4952",
")",
"。取值范围:<br",
">",
"<li",
">",
"LOCAL_BASIC:本地硬盘<br",
"... | def __init__(self):
r"""
:param DiskType: 系统盘类型。系统盘类型限制详见[存储概述](https://cloud.tencent.com/document/product/213/4952)。取值范围:<br><li>LOCAL_BASIC:本地硬盘<br><li>LOCAL_SSD:本地SSD硬盘<br><li>CLOUD_BASIC:普通云硬盘<br><li>CLOUD_SSD:SSD云硬盘<br><li>CLOUD_PREMIUM:高性能云硬盘<br><br>默认取值:当前有库存的硬盘类型。
:type DiskType: str
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"DiskType",
"=",
"None",
"self",
".",
"DiskId",
"=",
"None",
"self",
".",
"DiskSize",
"=",
"None",
"self",
".",
"CdcId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cvm/v20170312/models.py#L7530-L7544 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/support/bench.py | python | Bench.search_file | (self, lib) | [] | def search_file(self, lib):
f = open(self.options.termfile, "rb")
terms = [line.strip() for line in f]
f.close()
print("Searching %d terms with %s" % (len(terms), lib))
lib.searcher()
starttime = now()
for r in lib.findterms(terms):
pass
searc... | [
"def",
"search_file",
"(",
"self",
",",
"lib",
")",
":",
"f",
"=",
"open",
"(",
"self",
".",
"options",
".",
"termfile",
",",
"\"rb\"",
")",
"terms",
"=",
"[",
"line",
".",
"strip",
"(",
")",
"for",
"line",
"in",
"f",
"]",
"f",
".",
"close",
"(... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/support/bench.py#L513-L524 | ||||
facebookresearch/mmf | fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f | mmf/modules/layers.py | python | TwoLayerElementMultiply.forward | (self, image_feat, question_embedding) | return joint_feature | [] | def forward(self, image_feat, question_embedding):
image_fa = self.fa_image2(self.fa_image1(image_feat))
question_fa = self.fa_txt2(self.fa_txt1(question_embedding))
if len(image_feat.size()) == 3:
num_location = image_feat.size(1)
question_fa_expand = torch.unsqueeze(qu... | [
"def",
"forward",
"(",
"self",
",",
"image_feat",
",",
"question_embedding",
")",
":",
"image_fa",
"=",
"self",
".",
"fa_image2",
"(",
"self",
".",
"fa_image1",
"(",
"image_feat",
")",
")",
"question_fa",
"=",
"self",
".",
"fa_txt2",
"(",
"self",
".",
"f... | https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/modules/layers.py#L452-L467 | |||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/dev/bdf_vectorized2/cards/loads/pressure_loads.py | python | PLOADv.make_current | (self) | creates an array of the elements | creates an array of the elements | [
"creates",
"an",
"array",
"of",
"the",
"elements"
] | def make_current(self):
"""creates an array of the elements"""
if not self.is_current:
if len(self.sid) > 0: # there are already elements in self.eid
self.sid = np.hstack([self.sid, self._sid])
self.nids = np.vstack([self.nids, self._nids])
se... | [
"def",
"make_current",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_current",
":",
"if",
"len",
"(",
"self",
".",
"sid",
")",
">",
"0",
":",
"# there are already elements in self.eid",
"self",
".",
"sid",
"=",
"np",
".",
"hstack",
"(",
"[",
"se... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized2/cards/loads/pressure_loads.py#L111-L128 | ||
log2timeline/plaso | fe2e316b8c76a0141760c0f2f181d84acb83abc2 | plaso/cli/pinfo_tool.py | python | PinfoTool._PrintRecoveryWarningsDetails | (self, storage_reader) | Prints the details of the recovery warnings.
Args:
storage_reader (StorageReader): storage reader. | Prints the details of the recovery warnings. | [
"Prints",
"the",
"details",
"of",
"the",
"recovery",
"warnings",
"."
] | def _PrintRecoveryWarningsDetails(self, storage_reader):
"""Prints the details of the recovery warnings.
Args:
storage_reader (StorageReader): storage reader.
"""
generator = storage_reader.GetAttributeContainers(
self._CONTAINER_TYPE_RECOVERY_WARNING)
for index, warning in enumerate... | [
"def",
"_PrintRecoveryWarningsDetails",
"(",
"self",
",",
"storage_reader",
")",
":",
"generator",
"=",
"storage_reader",
".",
"GetAttributeContainers",
"(",
"self",
".",
"_CONTAINER_TYPE_RECOVERY_WARNING",
")",
"for",
"index",
",",
"warning",
"in",
"enumerate",
"(",
... | https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/cli/pinfo_tool.py#L844-L872 | ||
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | core/src/autogluon/core/augmentation/distill_utils.py | python | postprocess_augmented | (X_aug, X) | return X_aug.reset_index(drop=True, inplace=False) | Drops rows from augmented data that are duplicated (including duplicates that appeared in original data X). | Drops rows from augmented data that are duplicated (including duplicates that appeared in original data X). | [
"Drops",
"rows",
"from",
"augmented",
"data",
"that",
"are",
"duplicated",
"(",
"including",
"duplicates",
"that",
"appeared",
"in",
"original",
"data",
"X",
")",
"."
] | def postprocess_augmented(X_aug, X):
""" Drops rows from augmented data that are duplicated (including duplicates that appeared in original data X). """
X_aug = pd.concat([X, X_aug])
X_aug.drop_duplicates(keep='first', inplace=True)
X_aug = X_aug.tail(len(X_aug)-len(X))
logger.log(15, f"Augmented tr... | [
"def",
"postprocess_augmented",
"(",
"X_aug",
",",
"X",
")",
":",
"X_aug",
"=",
"pd",
".",
"concat",
"(",
"[",
"X",
",",
"X_aug",
"]",
")",
"X_aug",
".",
"drop_duplicates",
"(",
"keep",
"=",
"'first'",
",",
"inplace",
"=",
"True",
")",
"X_aug",
"=",
... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/core/src/autogluon/core/augmentation/distill_utils.py#L58-L64 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/protobuf-3.13.0/google/protobuf/descriptor.py | python | EnumValueDescriptor.__init__ | (self, name, index, number,
type=None, # pylint: disable=redefined-builtin
options=None, serialized_options=None, create_key=None) | Arguments are as described in the attribute description above. | Arguments are as described in the attribute description above. | [
"Arguments",
"are",
"as",
"described",
"in",
"the",
"attribute",
"description",
"above",
"."
] | def __init__(self, name, index, number,
type=None, # pylint: disable=redefined-builtin
options=None, serialized_options=None, create_key=None):
"""Arguments are as described in the attribute description above."""
if create_key is not _internal_create_key:
_Deprecated('EnumVa... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"index",
",",
"number",
",",
"type",
"=",
"None",
",",
"# pylint: disable=redefined-builtin",
"options",
"=",
"None",
",",
"serialized_options",
"=",
"None",
",",
"create_key",
"=",
"None",
")",
":",
"if",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/protobuf-3.13.0/google/protobuf/descriptor.py#L724-L736 | ||
pyansys/pymapdl | c07291fc062b359abf0e92b95a92d753a95ef3d7 | ansys/mapdl/core/mapdl_corba.py | python | MapdlCorba.exit | (self, close_log=True, timeout=3) | Exit MAPDL process | Exit MAPDL process | [
"Exit",
"MAPDL",
"process"
] | def exit(self, close_log=True, timeout=3):
"""Exit MAPDL process"""
if self._exited:
return
# self._log.debug('Exiting ANSYS')
if self._server is not None:
# attempt to cache final path and lockfile before exiting
try:
path = self.dire... | [
"def",
"exit",
"(",
"self",
",",
"close_log",
"=",
"True",
",",
"timeout",
"=",
"3",
")",
":",
"if",
"self",
".",
"_exited",
":",
"return",
"# self._log.debug('Exiting ANSYS')",
"if",
"self",
".",
"_server",
"is",
"not",
"None",
":",
"# attempt to cache fina... | https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/mapdl_corba.py#L251-L294 | ||
EtienneCmb/visbrain | b599038e095919dc193b12d5e502d127de7d03c9 | visbrain/objects/source_obj.py | python | SourceObj.radius_min | (self) | return self._radius_min | Get the radius_min value. | Get the radius_min value. | [
"Get",
"the",
"radius_min",
"value",
"."
] | def radius_min(self):
"""Get the radius_min value."""
return self._radius_min | [
"def",
"radius_min",
"(",
"self",
")",
":",
"return",
"self",
".",
"_radius_min"
] | https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/objects/source_obj.py#L618-L620 | |
dreamnettech/dreampower | 0253fe6b403552deb1a5fe3363678e4aea7437fa | src/transform/opencv/mask.py | python | MaskdetToMaskfin._execute | (self, *args) | Create maskfin.
steps:
1. Extract annotation
1.a: Filter by color
1.b: Find ellipses
1.c: Filter out ellipses by max size, and max total numbers
1.d: Detect Problems
1.e: Resolve the problems, or discard the transformat... | Create maskfin. | [
"Create",
"maskfin",
"."
] | def _execute(self, *args):
"""
Create maskfin.
steps:
1. Extract annotation
1.a: Filter by color
1.b: Find ellipses
1.c: Filter out ellipses by max size, and max total numbers
1.d: Detect Problems
1.e: R... | [
"def",
"_execute",
"(",
"self",
",",
"*",
"args",
")",
":",
"def",
"to_int",
"(",
"a",
",",
"b",
")",
":",
"return",
"int",
"(",
"round",
"(",
"a",
"*",
"float",
"(",
"b",
")",
")",
")",
"enable_pubes",
"=",
"(",
"self",
".",
"__hair_size",
">"... | https://github.com/dreamnettech/dreampower/blob/0253fe6b403552deb1a5fe3363678e4aea7437fa/src/transform/opencv/mask.py#L82-L131 | ||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | chap19/monitor/monitor/build/lib.linux-x86_64-2.7/monitor/openstack/common/rpc/matchmaker.py | python | MatchMakerBase.register | (self, key, host) | Register a host on a backend.
Heartbeats, if applicable, may keepalive registration. | Register a host on a backend.
Heartbeats, if applicable, may keepalive registration. | [
"Register",
"a",
"host",
"on",
"a",
"backend",
".",
"Heartbeats",
"if",
"applicable",
"may",
"keepalive",
"registration",
"."
] | def register(self, key, host):
"""
Register a host on a backend.
Heartbeats, if applicable, may keepalive registration.
"""
pass | [
"def",
"register",
"(",
"self",
",",
"key",
",",
"host",
")",
":",
"pass"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/build/lib.linux-x86_64-2.7/monitor/openstack/common/rpc/matchmaker.py#L92-L97 | ||
jgyates/genmon | 2cb2ed2945f55cd8c259b09ccfa9a51e23f1341e | genmonlib/generac_HPanel.py | python | HPanel.SetGeneratorTimeDate | (self) | [] | def SetGeneratorTimeDate(self):
try:
# get system time
d = datetime.datetime.now()
# We will write four registers at once: GEN_TIME_HR_MIN - GEN_TIME_YR.
Data= []
Data.append(d.hour) #GEN_TIME_HR_MIN
Data.append(d.minute)
... | [
"def",
"SetGeneratorTimeDate",
"(",
"self",
")",
":",
"try",
":",
"# get system time",
"d",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"# We will write four registers at once: GEN_TIME_HR_MIN - GEN_TIME_YR.",
"Data",
"=",
"[",
"]",
"Data",
".",
"append"... | https://github.com/jgyates/genmon/blob/2cb2ed2945f55cd8c259b09ccfa9a51e23f1341e/genmonlib/generac_HPanel.py#L2112-L2147 | ||||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/Django-1.11.29/django/utils/text.py | python | capfirst | (x) | return x and force_text(x)[0].upper() + force_text(x)[1:] | Capitalize the first letter of a string. | Capitalize the first letter of a string. | [
"Capitalize",
"the",
"first",
"letter",
"of",
"a",
"string",
"."
] | def capfirst(x):
"""Capitalize the first letter of a string."""
return x and force_text(x)[0].upper() + force_text(x)[1:] | [
"def",
"capfirst",
"(",
"x",
")",
":",
"return",
"x",
"and",
"force_text",
"(",
"x",
")",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"+",
"force_text",
"(",
"x",
")",
"[",
"1",
":",
"]"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/utils/text.py#L24-L26 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/physics/quantum/shor.py | python | period_find | (a, N) | return g | Finds the period of a in modulo N arithmetic
This is quantum part of Shor's algorithm.It takes two registers,
puts first in superposition of states with Hadamards so: ``|k>|0>``
with k being all possible choices. It then does a controlled mod and
a QFT to determine the order of a. | Finds the period of a in modulo N arithmetic | [
"Finds",
"the",
"period",
"of",
"a",
"in",
"modulo",
"N",
"arithmetic"
] | def period_find(a, N):
"""Finds the period of a in modulo N arithmetic
This is quantum part of Shor's algorithm.It takes two registers,
puts first in superposition of states with Hadamards so: ``|k>|0>``
with k being all possible choices. It then does a controlled mod and
a QFT to determine the ord... | [
"def",
"period_find",
"(",
"a",
",",
"N",
")",
":",
"epsilon",
"=",
".5",
"#picks out t's such that maintains accuracy within epsilon",
"t",
"=",
"int",
"(",
"2",
"*",
"math",
".",
"ceil",
"(",
"log",
"(",
"N",
",",
"2",
")",
")",
")",
"# make the first ha... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/physics/quantum/shor.py#L129-L183 | |
jaychsu/algorithm | 87dac5456b74a515dd97507ac68e9b8588066a04 | leetcode/234_palindrome_linked_list.py | python | Solution.isPalindrome | (self, head) | return not rev | :type head: ListNode
:rtype: bool | :type head: ListNode
:rtype: bool | [
":",
"type",
"head",
":",
"ListNode",
":",
"rtype",
":",
"bool"
] | def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
rev = nxt = None
slow = fast = head
while fast and fast.next:
fast = fast.next.next
nxt = slow.next
slow.next = rev
rev = slow
slo... | [
"def",
"isPalindrome",
"(",
"self",
",",
"head",
")",
":",
"rev",
"=",
"nxt",
"=",
"None",
"slow",
"=",
"fast",
"=",
"head",
"while",
"fast",
"and",
"fast",
".",
"next",
":",
"fast",
"=",
"fast",
".",
"next",
".",
"next",
"nxt",
"=",
"slow",
".",... | https://github.com/jaychsu/algorithm/blob/87dac5456b74a515dd97507ac68e9b8588066a04/leetcode/234_palindrome_linked_list.py#L32-L55 | |
blackye/webdirdig | 11eb3df84d228127dde1dd4afcb922f5075903a2 | thirdparty_libs/requests/utils.py | python | default_user_agent | () | return " ".join(['python-requests/%s' % __version__,
'%s/%s' % (_implementation, _implementation_version),
'%s/%s' % (p_system, p_release)]) | Return a string representing the default user agent. | Return a string representing the default user agent. | [
"Return",
"a",
"string",
"representing",
"the",
"default",
"user",
"agent",
"."
] | def default_user_agent():
"""Return a string representing the default user agent."""
_implementation = platform.python_implementation()
if _implementation == 'CPython':
_implementation_version = platform.python_version()
elif _implementation == 'PyPy':
_implementation_version = '%s.%s.%... | [
"def",
"default_user_agent",
"(",
")",
":",
"_implementation",
"=",
"platform",
".",
"python_implementation",
"(",
")",
"if",
"_implementation",
"==",
"'CPython'",
":",
"_implementation_version",
"=",
"platform",
".",
"python_version",
"(",
")",
"elif",
"_implementa... | https://github.com/blackye/webdirdig/blob/11eb3df84d228127dde1dd4afcb922f5075903a2/thirdparty_libs/requests/utils.py#L419-L447 | |
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/mainwindows/mdi/mdi.py | python | MdiChild.documentWasModified | (self) | [] | def documentWasModified(self):
self.setWindowModified(self.document().isModified()) | [
"def",
"documentWasModified",
"(",
"self",
")",
":",
"self",
".",
"setWindowModified",
"(",
"self",
".",
"document",
"(",
")",
".",
"isModified",
"(",
")",
")"
] | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/mainwindows/mdi/mdi.py#L130-L131 | ||||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | lib/pkg_resources/__init__.py | python | IMetadataProvider.get_metadata | (name) | The named metadata resource as a string | The named metadata resource as a string | [
"The",
"named",
"metadata",
"resource",
"as",
"a",
"string"
] | def get_metadata(name):
"""The named metadata resource as a string""" | [
"def",
"get_metadata",
"(",
"name",
")",
":"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/lib/pkg_resources/__init__.py#L496-L497 | ||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/resolve/resolver_options.py | python | _ManylinuxAction.__call__ | (self, parser, namespace, value, option_str=None) | [] | def __call__(self, parser, namespace, value, option_str=None):
if option_str.startswith("--no"):
setattr(namespace, self.dest, None)
elif value.startswith("manylinux"):
setattr(namespace, self.dest, value)
else:
raise ArgumentTypeError(
"Please... | [
"def",
"__call__",
"(",
"self",
",",
"parser",
",",
"namespace",
",",
"value",
",",
"option_str",
"=",
"None",
")",
":",
"if",
"option_str",
".",
"startswith",
"(",
"\"--no\"",
")",
":",
"setattr",
"(",
"namespace",
",",
"self",
".",
"dest",
",",
"None... | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/resolve/resolver_options.py#L30-L39 | ||||
lxdock/lxdock | f71006d130bc8b53603eea36a546003495437493 | lxdock/network.py | python | ContainerEtcHosts.save | (self) | [] | def save(self):
tosave = self.get_mangled_contents()
towrite = ''.join(tosave).encode('utf-8')
self.container.files.put(self.path, towrite) | [
"def",
"save",
"(",
"self",
")",
":",
"tosave",
"=",
"self",
".",
"get_mangled_contents",
"(",
")",
"towrite",
"=",
"''",
".",
"join",
"(",
"tosave",
")",
".",
"encode",
"(",
"'utf-8'",
")",
"self",
".",
"container",
".",
"files",
".",
"put",
"(",
... | https://github.com/lxdock/lxdock/blob/f71006d130bc8b53603eea36a546003495437493/lxdock/network.py#L105-L108 | ||||
google-research/football | c5c6a5c1d587a94673597ff6d61da43044a0c9ac | gfootball/env/players/bot.py | python | Player._closest_front_opponent | (self, o, target) | return closest | For an object and its movement direction returns the closest opponent.
Args:
o: Source object.
target: Movement direction.
Returns:
Closest front opponent. | For an object and its movement direction returns the closest opponent. | [
"For",
"an",
"object",
"and",
"its",
"movement",
"direction",
"returns",
"the",
"closest",
"opponent",
"."
] | def _closest_front_opponent(self, o, target):
"""For an object and its movement direction returns the closest opponent.
Args:
o: Source object.
target: Movement direction.
Returns:
Closest front opponent."""
delta = target - o
min_d = None
closest = None
for p in self._ob... | [
"def",
"_closest_front_opponent",
"(",
"self",
",",
"o",
",",
"target",
")",
":",
"delta",
"=",
"target",
"-",
"o",
"min_d",
"=",
"None",
"closest",
"=",
"None",
"for",
"p",
"in",
"self",
".",
"_observation",
"[",
"'right_team'",
"]",
":",
"delta_opp",
... | https://github.com/google-research/football/blob/c5c6a5c1d587a94673597ff6d61da43044a0c9ac/gfootball/env/players/bot.py#L78-L100 | |
CiscoDevNet/webexteamssdk | 673312779b8e05cf0535bea8b96599015cccbff1 | webexteamssdk/models/mixins/membership.py | python | MembershipBasicPropertiesMixin.roomId | (self) | return self._json_data.get('roomId') | The room ID. | The room ID. | [
"The",
"room",
"ID",
"."
] | def roomId(self):
"""The room ID."""
return self._json_data.get('roomId') | [
"def",
"roomId",
"(",
"self",
")",
":",
"return",
"self",
".",
"_json_data",
".",
"get",
"(",
"'roomId'",
")"
] | https://github.com/CiscoDevNet/webexteamssdk/blob/673312779b8e05cf0535bea8b96599015cccbff1/webexteamssdk/models/mixins/membership.py#L49-L51 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/commands/BuildAtom/AtomGenerator.py | python | AtomGenerator.build_struct | ( self, name, parameters, position ) | return outMolecule | Build an Atom (as a chunk) according to the given parameters.
@param name: The name which should be given to the toplevel Node of the
generated structure. The name is also passed in self.name.
@type name: str
@param parameters: The parameter tuple returned from
... | Build an Atom (as a chunk) according to the given parameters. | [
"Build",
"an",
"Atom",
"(",
"as",
"a",
"chunk",
")",
"according",
"to",
"the",
"given",
"parameters",
"."
] | def build_struct( self, name, parameters, position ):
"""
Build an Atom (as a chunk) according to the given parameters.
@param name: The name which should be given to the toplevel Node of the
generated structure. The name is also passed in self.name.
@type name: st... | [
"def",
"build_struct",
"(",
"self",
",",
"name",
",",
"parameters",
",",
"position",
")",
":",
"x",
",",
"y",
",",
"z",
",",
"theElement",
",",
"theAtomType",
"=",
"parameters",
"# Create new chunk to contain the atom.",
"outMolecule",
"=",
"Chunk",
"(",
"self... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/commands/BuildAtom/AtomGenerator.py#L96-L128 | |
jupyter/jupyter_client | 263173095ceab87a572937f21f843886ffe356f1 | jupyter_client/client.py | python | KernelClient.start_channels | (
self,
shell: bool = True,
iopub: bool = True,
stdin: bool = True,
hb: bool = True,
control: bool = True,
) | Starts the channels for this kernel.
This will create the channels if they do not exist and then start
them (their activity runs in a thread). If port numbers of 0 are
being used (random ports) then you must first call
:meth:`start_kernel`. If the channels have been stopped and you
... | Starts the channels for this kernel. | [
"Starts",
"the",
"channels",
"for",
"this",
"kernel",
"."
] | def start_channels(
self,
shell: bool = True,
iopub: bool = True,
stdin: bool = True,
hb: bool = True,
control: bool = True,
) -> None:
"""Starts the channels for this kernel.
This will create the channels if they do not exist and then start
t... | [
"def",
"start_channels",
"(",
"self",
",",
"shell",
":",
"bool",
"=",
"True",
",",
"iopub",
":",
"bool",
"=",
"True",
",",
"stdin",
":",
"bool",
"=",
"True",
",",
"hb",
":",
"bool",
"=",
"True",
",",
"control",
":",
"bool",
"=",
"True",
",",
")",... | https://github.com/jupyter/jupyter_client/blob/263173095ceab87a572937f21f843886ffe356f1/jupyter_client/client.py#L269-L297 | ||
simonpercivall/astunparse | 2acce01fcdda2ea32eea835c30ccca21aaff7297 | lib/astunparse/unparser.py | python | Unparser._SetComp | (self, t) | [] | def _SetComp(self, t):
self.write("{")
self.dispatch(t.elt)
for gen in t.generators:
self.dispatch(gen)
self.write("}") | [
"def",
"_SetComp",
"(",
"self",
",",
"t",
")",
":",
"self",
".",
"write",
"(",
"\"{\"",
")",
"self",
".",
"dispatch",
"(",
"t",
".",
"elt",
")",
"for",
"gen",
"in",
"t",
".",
"generators",
":",
"self",
".",
"dispatch",
"(",
"gen",
")",
"self",
... | https://github.com/simonpercivall/astunparse/blob/2acce01fcdda2ea32eea835c30ccca21aaff7297/lib/astunparse/unparser.py#L589-L594 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/redis/client.py | python | StrictRedis.geoadd | (self, name, *values) | return self.execute_command('GEOADD', name, *values) | Add the specified geospatial items to the specified key identified
by the ``name`` argument. The Geospatial items are given as ordered
members of the ``values`` argument, each item or place is formed by
the triad longitude, latitude and name. | Add the specified geospatial items to the specified key identified
by the ``name`` argument. The Geospatial items are given as ordered
members of the ``values`` argument, each item or place is formed by
the triad longitude, latitude and name. | [
"Add",
"the",
"specified",
"geospatial",
"items",
"to",
"the",
"specified",
"key",
"identified",
"by",
"the",
"name",
"argument",
".",
"The",
"Geospatial",
"items",
"are",
"given",
"as",
"ordered",
"members",
"of",
"the",
"values",
"argument",
"each",
"item",
... | def geoadd(self, name, *values):
"""
Add the specified geospatial items to the specified key identified
by the ``name`` argument. The Geospatial items are given as ordered
members of the ``values`` argument, each item or place is formed by
the triad longitude, latitude and name.
... | [
"def",
"geoadd",
"(",
"self",
",",
"name",
",",
"*",
"values",
")",
":",
"if",
"len",
"(",
"values",
")",
"%",
"3",
"!=",
"0",
":",
"raise",
"RedisError",
"(",
"\"GEOADD requires places with lon, lat and name\"",
"\" values\"",
")",
"return",
"self",
".",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/redis/client.py#L2111-L2121 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/internet/interfaces.py | python | IUDPTransport.getHost | () | Returns L{IPv4Address}. | Returns L{IPv4Address}. | [
"Returns",
"L",
"{",
"IPv4Address",
"}",
"."
] | def getHost():
"""
Returns L{IPv4Address}.
""" | [
"def",
"getHost",
"(",
")",
":"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/interfaces.py#L1635-L1638 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/http/cookies.py | python | Morsel.__init__ | (self) | [] | def __init__(self):
# Set defaults
self._key = self._value = self._coded_value = None
# Set default attributes
for key in self._reserved:
dict.__setitem__(self, key, "") | [
"def",
"__init__",
"(",
"self",
")",
":",
"# Set defaults",
"self",
".",
"_key",
"=",
"self",
".",
"_value",
"=",
"self",
".",
"_coded_value",
"=",
"None",
"# Set default attributes",
"for",
"key",
"in",
"self",
".",
"_reserved",
":",
"dict",
".",
"__setit... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/http/cookies.py#L289-L295 | ||||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/site-packages/win32com/server/dispatcher.py | python | DispatcherWin32dbg._HandleException_ | (self) | Invoke the debugger post mortem capability | Invoke the debugger post mortem capability | [
"Invoke",
"the",
"debugger",
"post",
"mortem",
"capability"
] | def _HandleException_(self):
""" Invoke the debugger post mortem capability """
# Save details away.
typ, val, tb = exc_info()
#import pywin.debugger, pywin.debugger.dbgcon
debug = 0
try:
raise typ(val)
except Exception: # AARG - What is this Exception???
# Use some inside knowle... | [
"def",
"_HandleException_",
"(",
"self",
")",
":",
"# Save details away.",
"typ",
",",
"val",
",",
"tb",
"=",
"exc_info",
"(",
")",
"#import pywin.debugger, pywin.debugger.dbgcon",
"debug",
"=",
"0",
"try",
":",
"raise",
"typ",
"(",
"val",
")",
"except",
"Exce... | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/site-packages/win32com/server/dispatcher.py#L242-L264 | ||
LinkedInAttic/indextank-service | 880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e | storefront/boto/fps/connection.py | python | FPSConnection.install_payment_instruction | (self, instruction, token_type="Unrestricted", transaction_id=None) | return response | InstallPaymentInstruction
instruction: The PaymentInstruction to send, for example:
MyRole=='Caller' orSay 'Roles do not match';
token_type: Defaults to "Unrestricted"
transaction_id: Defaults to a new ID | InstallPaymentInstruction
instruction: The PaymentInstruction to send, for example:
MyRole=='Caller' orSay 'Roles do not match';
token_type: Defaults to "Unrestricted"
transaction_id: Defaults to a new ID | [
"InstallPaymentInstruction",
"instruction",
":",
"The",
"PaymentInstruction",
"to",
"send",
"for",
"example",
":",
"MyRole",
"==",
"Caller",
"orSay",
"Roles",
"do",
"not",
"match",
";",
"token_type",
":",
"Defaults",
"to",
"Unrestricted",
"transaction_id",
":",
"D... | def install_payment_instruction(self, instruction, token_type="Unrestricted", transaction_id=None):
"""
InstallPaymentInstruction
instruction: The PaymentInstruction to send, for example:
MyRole=='Caller' orSay 'Roles do not match';
token_type: Defaults to "Unrestricted"
transaction_id: Defaults to ... | [
"def",
"install_payment_instruction",
"(",
"self",
",",
"instruction",
",",
"token_type",
"=",
"\"Unrestricted\"",
",",
"transaction_id",
"=",
"None",
")",
":",
"if",
"(",
"transaction_id",
"==",
"None",
")",
":",
"transaction_id",
"=",
"uuid",
".",
"uuid4",
"... | https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/storefront/boto/fps/connection.py#L47-L65 | |
ckan/ckan | b3b01218ad88ed3fb914b51018abe8b07b07bff3 | ckanext/example_theme_docs/v15_webassets/plugin.py | python | most_popular_groups | () | return groups | Return a sorted list of the groups with the most datasets. | Return a sorted list of the groups with the most datasets. | [
"Return",
"a",
"sorted",
"list",
"of",
"the",
"groups",
"with",
"the",
"most",
"datasets",
"."
] | def most_popular_groups():
'''Return a sorted list of the groups with the most datasets.'''
# Get a list of all the site's groups from CKAN, sorted by number of
# datasets.
groups = toolkit.get_action('group_list')(
data_dict={'sort': 'package_count desc', 'all_fields': True})
# Truncate t... | [
"def",
"most_popular_groups",
"(",
")",
":",
"# Get a list of all the site's groups from CKAN, sorted by number of",
"# datasets.",
"groups",
"=",
"toolkit",
".",
"get_action",
"(",
"'group_list'",
")",
"(",
"data_dict",
"=",
"{",
"'sort'",
":",
"'package_count desc'",
",... | https://github.com/ckan/ckan/blob/b3b01218ad88ed3fb914b51018abe8b07b07bff3/ckanext/example_theme_docs/v15_webassets/plugin.py#L7-L18 | |
hasegaw/IkaLog | bd476da541fcc296f792d4db76a6b9174c4777ad | ikalog/scenes/plaza_user_stat.py | python | PlazaUserStat.__init__ | (self) | [] | def __init__(self):
self.mask_return = ImageUtils.load_mask(
'masks/plaza_userstat.png', self.return_left, self.return_top, self.return_width, self.return_height)
self.mask_order = ImageUtils.load_mask(
'masks/plaza_userstat.png', self.order_left, self.order_top, self.order_width... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"mask_return",
"=",
"ImageUtils",
".",
"load_mask",
"(",
"'masks/plaza_userstat.png'",
",",
"self",
".",
"return_left",
",",
"self",
".",
"return_top",
",",
"self",
".",
"return_width",
",",
"self",
".",... | https://github.com/hasegaw/IkaLog/blob/bd476da541fcc296f792d4db76a6b9174c4777ad/ikalog/scenes/plaza_user_stat.py#L61-L65 | ||||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/generic.py | python | NDFrame._selected_obj | (self) | return self | internal compat with SelectionMixin | internal compat with SelectionMixin | [
"internal",
"compat",
"with",
"SelectionMixin"
] | def _selected_obj(self):
""" internal compat with SelectionMixin """
return self | [
"def",
"_selected_obj",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/generic.py#L498-L500 | |
MycroftAI/mycroft-core | 3d963cee402e232174850f36918313e87313fb13 | mycroft/enclosure/display_manager.py | python | DisplayManager.set_active | (self, skill_name=None) | Sets skill name as active in the display Manager
Args:
string: skill_name | Sets skill name as active in the display Manager
Args:
string: skill_name | [
"Sets",
"skill",
"name",
"as",
"active",
"in",
"the",
"display",
"Manager",
"Args",
":",
"string",
":",
"skill_name"
] | def set_active(self, skill_name=None):
""" Sets skill name as active in the display Manager
Args:
string: skill_name
"""
name = skill_name if skill_name is not None else self.name
_write_data({"active_skill": name}) | [
"def",
"set_active",
"(",
"self",
",",
"skill_name",
"=",
"None",
")",
":",
"name",
"=",
"skill_name",
"if",
"skill_name",
"is",
"not",
"None",
"else",
"self",
".",
"name",
"_write_data",
"(",
"{",
"\"active_skill\"",
":",
"name",
"}",
")"
] | https://github.com/MycroftAI/mycroft-core/blob/3d963cee402e232174850f36918313e87313fb13/mycroft/enclosure/display_manager.py#L123-L129 | ||
s-leger/archipack | 5a6243bf1edf08a6b429661ce291dacb551e5f8a | pygeos/geomgraph.py | python | GeometryGraph._addLineString | (self, geom) | * Add the boundary points of the LineString, if any.
* Even if the LineString is closed, add both points as if they
* were endpoints.
* This allows for the case that the node already exists and is
* a boundary point. | * Add the boundary points of the LineString, if any.
* Even if the LineString is closed, add both points as if they
* were endpoints.
* This allows for the case that the node already exists and is
* a boundary point. | [
"*",
"Add",
"the",
"boundary",
"points",
"of",
"the",
"LineString",
"if",
"any",
".",
"*",
"Even",
"if",
"the",
"LineString",
"is",
"closed",
"add",
"both",
"points",
"as",
"if",
"they",
"*",
"were",
"endpoints",
".",
"*",
"This",
"allows",
"for",
"the... | def _addLineString(self, geom) -> None:
coords = geom.coords
if len(coords) < 2:
self.hasTooFewPoints = True
self.invalidPoint = coords[0]
return
edge = Edge(coords, Label(self.geomIndex, Location.INTERIOR))
self._lineEdgeMap[id(geom)] = edge
... | [
"def",
"_addLineString",
"(",
"self",
",",
"geom",
")",
"->",
"None",
":",
"coords",
"=",
"geom",
".",
"coords",
"if",
"len",
"(",
"coords",
")",
"<",
"2",
":",
"self",
".",
"hasTooFewPoints",
"=",
"True",
"self",
".",
"invalidPoint",
"=",
"coords",
... | https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/geomgraph.py#L2596-L2615 | ||
CalciferZh/minimal-hand | da91d777a36207ea67d87f06fc881a4806312ef0 | wrappers.py | python | ModelDet.process | (self, img) | return results | Process a color image.
Parameters
----------
img : np.ndarray
A 128x128 RGB image of **left hand** with dtype uint8.
Returns
-------
np.ndarray, shape [21, 3]
Normalized keypoint locations. The coordinates are relative to the M0
joint and normalized by the length of the bone ... | Process a color image. | [
"Process",
"a",
"color",
"image",
"."
] | def process(self, img):
"""
Process a color image.
Parameters
----------
img : np.ndarray
A 128x128 RGB image of **left hand** with dtype uint8.
Returns
-------
np.ndarray, shape [21, 3]
Normalized keypoint locations. The coordinates are relative to the M0
joint and n... | [
"def",
"process",
"(",
"self",
",",
"img",
")",
":",
"results",
"=",
"self",
".",
"sess",
".",
"run",
"(",
"[",
"self",
".",
"xyz",
",",
"self",
".",
"uv",
"]",
",",
"{",
"self",
".",
"input_ph",
":",
"img",
"}",
")",
"return",
"results"
] | https://github.com/CalciferZh/minimal-hand/blob/da91d777a36207ea67d87f06fc881a4806312ef0/wrappers.py#L50-L70 | |
gwastro/pycbc | 1e1c85534b9dba8488ce42df693230317ca63dea | pycbc/transforms.py | python | LambdaFromTOVFile.lambda_from_tov_data | (m_src, mass_data, lambda_data) | return lambdav | Returns Lambda corresponding to a given mass interpolating from the
TOV data.
Parameters
----------
m : float
Value of the mass.
mass_data : array
Mass array from the Lambda-M curve of an EOS.
lambda_data : array
Lambda array from the ... | Returns Lambda corresponding to a given mass interpolating from the
TOV data. | [
"Returns",
"Lambda",
"corresponding",
"to",
"a",
"given",
"mass",
"interpolating",
"from",
"the",
"TOV",
"data",
"."
] | def lambda_from_tov_data(m_src, mass_data, lambda_data):
"""Returns Lambda corresponding to a given mass interpolating from the
TOV data.
Parameters
----------
m : float
Value of the mass.
mass_data : array
Mass array from the Lambda-M curve of an... | [
"def",
"lambda_from_tov_data",
"(",
"m_src",
",",
"mass_data",
",",
"lambda_data",
")",
":",
"if",
"m_src",
">",
"mass_data",
".",
"max",
"(",
")",
":",
"# assume black hole",
"lambdav",
"=",
"0.0",
"else",
":",
"lambdav",
"=",
"numpy",
".",
"interp",
"(",... | https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/transforms.py#L1264-L1287 | |
caserec/CaseRecommender | 779bc5dd91ff704ce60c0f3fafd07e2eba689dd7 | caserec/evaluation/base_evaluation.py | python | BaseEvaluation.evaluate_folds | (self, folds_dir, predictions_file_name, test_file_name, k_folds=10) | return folds_results | Evaluate ranking in a set of folds. The name of folds needs to be integer and start with 0. e.g.
Exist a dir '/home/user/folds', in which contains folds 0, 1, ..., 10.
:param folds_dir: Directory of folds
:type folds_dir: str
:param k_folds: Number of folds
:type k_folds: int, ... | Evaluate ranking in a set of folds. The name of folds needs to be integer and start with 0. e.g.
Exist a dir '/home/user/folds', in which contains folds 0, 1, ..., 10. | [
"Evaluate",
"ranking",
"in",
"a",
"set",
"of",
"folds",
".",
"The",
"name",
"of",
"folds",
"needs",
"to",
"be",
"integer",
"and",
"start",
"with",
"0",
".",
"e",
".",
"g",
".",
"Exist",
"a",
"dir",
"/",
"home",
"/",
"user",
"/",
"folds",
"in",
"w... | def evaluate_folds(self, folds_dir, predictions_file_name, test_file_name, k_folds=10):
"""
Evaluate ranking in a set of folds. The name of folds needs to be integer and start with 0. e.g.
Exist a dir '/home/user/folds', in which contains folds 0, 1, ..., 10.
:param folds_dir: Directory... | [
"def",
"evaluate_folds",
"(",
"self",
",",
"folds_dir",
",",
"predictions_file_name",
",",
"test_file_name",
",",
"k_folds",
"=",
"10",
")",
":",
"folds_results",
"=",
"defaultdict",
"(",
")",
"for",
"fold",
"in",
"range",
"(",
"k_folds",
")",
":",
"predicti... | https://github.com/caserec/CaseRecommender/blob/779bc5dd91ff704ce60c0f3fafd07e2eba689dd7/caserec/evaluation/base_evaluation.py#L108-L144 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_windows/systrace/catapult/devil/devil/android/device_utils.py | python | DeviceUtils.RunShellCommand | (self, cmd, shell=False, check_return=False, cwd=None,
env=None, run_as=None, as_root=False, single_line=False,
large_output=False, raw_output=False,
ensure_logs_on_timeout=False, timeout=None, retries=None) | Run an ADB shell command.
The command to run |cmd| should be a sequence of program arguments
(preferred) or a single string with a shell script to run.
When |cmd| is a sequence, it is assumed to contain the name of the command
to run followed by its arguments. In this case, arguments are passed to the... | Run an ADB shell command. | [
"Run",
"an",
"ADB",
"shell",
"command",
"."
] | def RunShellCommand(self, cmd, shell=False, check_return=False, cwd=None,
env=None, run_as=None, as_root=False, single_line=False,
large_output=False, raw_output=False,
ensure_logs_on_timeout=False, timeout=None, retries=None):
"""Run an ADB shell co... | [
"def",
"RunShellCommand",
"(",
"self",
",",
"cmd",
",",
"shell",
"=",
"False",
",",
"check_return",
"=",
"False",
",",
"cwd",
"=",
"None",
",",
"env",
"=",
"None",
",",
"run_as",
"=",
"None",
",",
"as_root",
"=",
"False",
",",
"single_line",
"=",
"Fa... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_windows/systrace/catapult/devil/devil/android/device_utils.py#L1021-L1171 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.