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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wakatime/legacy-python-cli | 9b64548b16ab5ef16603d9a6c2620a16d0df8d46 | wakatime/packages/py27/cryptography/x509/base.py | python | CertificateRevocationListBuilder.add_revoked_certificate | (self, revoked_certificate) | return CertificateRevocationListBuilder(
self._issuer_name, self._last_update,
self._next_update, self._extensions,
self._revoked_certificates + [revoked_certificate]
) | Adds a revoked certificate to the CRL. | Adds a revoked certificate to the CRL. | [
"Adds",
"a",
"revoked",
"certificate",
"to",
"the",
"CRL",
"."
] | def add_revoked_certificate(self, revoked_certificate):
"""
Adds a revoked certificate to the CRL.
"""
if not isinstance(revoked_certificate, RevokedCertificate):
raise TypeError("Must be an instance of RevokedCertificate")
return CertificateRevocationListBuilder(
... | [
"def",
"add_revoked_certificate",
"(",
"self",
",",
"revoked_certificate",
")",
":",
"if",
"not",
"isinstance",
"(",
"revoked_certificate",
",",
"RevokedCertificate",
")",
":",
"raise",
"TypeError",
"(",
"\"Must be an instance of RevokedCertificate\"",
")",
"return",
"C... | https://github.com/wakatime/legacy-python-cli/blob/9b64548b16ab5ef16603d9a6c2620a16d0df8d46/wakatime/packages/py27/cryptography/x509/base.py#L672-L683 | |
qiyuangong/leetcode | 790f9ee86dcc7bf85be1bd9358f4c069b4a4c2f5 | python/101_Symmetric_Tree.py | python | Solution.isSymmetric | (self, root) | return self.mirrorVisit(root.left, root.right) | :type root: TreeNode
:rtype: bool | :type root: TreeNode
:rtype: bool | [
":",
"type",
"root",
":",
"TreeNode",
":",
"rtype",
":",
"bool"
] | def isSymmetric(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
if root is None:
return True
return self.mirrorVisit(root.left, root.right) | [
"def",
"isSymmetric",
"(",
"self",
",",
"root",
")",
":",
"if",
"root",
"is",
"None",
":",
"return",
"True",
"return",
"self",
".",
"mirrorVisit",
"(",
"root",
".",
"left",
",",
"root",
".",
"right",
")"
] | https://github.com/qiyuangong/leetcode/blob/790f9ee86dcc7bf85be1bd9358f4c069b4a4c2f5/python/101_Symmetric_Tree.py#L9-L16 | |
dyelax/Adversarial_Video_Generation | 458cef18dca1b5d13bee10f5ae39b85d602698f3 | Code/process_data.py | python | process_training_data | (num_clips) | Processes random training clips from the full training data. Saves to TRAIN_DIR_CLIPS by
default.
@param num_clips: The number of clips to process. Default = 5000000 (set in __main__).
@warning: This can take a couple of hours to complete with large numbers of clips. | Processes random training clips from the full training data. Saves to TRAIN_DIR_CLIPS by
default. | [
"Processes",
"random",
"training",
"clips",
"from",
"the",
"full",
"training",
"data",
".",
"Saves",
"to",
"TRAIN_DIR_CLIPS",
"by",
"default",
"."
] | def process_training_data(num_clips):
"""
Processes random training clips from the full training data. Saves to TRAIN_DIR_CLIPS by
default.
@param num_clips: The number of clips to process. Default = 5000000 (set in __main__).
@warning: This can take a couple of hours to complete with large number... | [
"def",
"process_training_data",
"(",
"num_clips",
")",
":",
"num_prev_clips",
"=",
"len",
"(",
"glob",
"(",
"c",
".",
"TRAIN_DIR_CLIPS",
"+",
"'*'",
")",
")",
"for",
"clip_num",
"in",
"xrange",
"(",
"num_prev_clips",
",",
"num_clips",
"+",
"num_prev_clips",
... | https://github.com/dyelax/Adversarial_Video_Generation/blob/458cef18dca1b5d13bee10f5ae39b85d602698f3/Code/process_data.py#L11-L27 | ||
census-instrumentation/opencensus-python | 15c122dd7e0187b35f956f5d3b77b78455a2aadb | opencensus/common/monitored_resource/k8s_utils.py | python | get_k8s_metadata | () | return k8s_metadata | Get kubernetes container metadata, as on GCP GKE. | Get kubernetes container metadata, as on GCP GKE. | [
"Get",
"kubernetes",
"container",
"metadata",
"as",
"on",
"GCP",
"GKE",
"."
] | def get_k8s_metadata():
"""Get kubernetes container metadata, as on GCP GKE."""
k8s_metadata = {}
gcp_cluster = (gcp_metadata_config.GcpMetadataConfig
.get_attribute(gcp_metadata_config.CLUSTER_NAME_KEY))
if gcp_cluster is not None:
k8s_metadata[CLUSTER_NAME_KEY] = gcp_cluste... | [
"def",
"get_k8s_metadata",
"(",
")",
":",
"k8s_metadata",
"=",
"{",
"}",
"gcp_cluster",
"=",
"(",
"gcp_metadata_config",
".",
"GcpMetadataConfig",
".",
"get_attribute",
"(",
"gcp_metadata_config",
".",
"CLUSTER_NAME_KEY",
")",
")",
"if",
"gcp_cluster",
"is",
"not"... | https://github.com/census-instrumentation/opencensus-python/blob/15c122dd7e0187b35f956f5d3b77b78455a2aadb/opencensus/common/monitored_resource/k8s_utils.py#L50-L64 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | chap19/monitor/monitor/monitor/openstack/common/rpc/impl_qpid.py | python | DirectConsumer.__init__ | (self, conf, session, msg_id, callback) | Init a 'direct' queue.
'session' is the amqp session to use
'msg_id' is the msg_id to listen on
'callback' is the callback to call when messages are received | Init a 'direct' queue. | [
"Init",
"a",
"direct",
"queue",
"."
] | def __init__(self, conf, session, msg_id, callback):
"""Init a 'direct' queue.
'session' is the amqp session to use
'msg_id' is the msg_id to listen on
'callback' is the callback to call when messages are received
"""
super(DirectConsumer, self).__init__(session, callba... | [
"def",
"__init__",
"(",
"self",
",",
"conf",
",",
"session",
",",
"msg_id",
",",
"callback",
")",
":",
"super",
"(",
"DirectConsumer",
",",
"self",
")",
".",
"__init__",
"(",
"session",
",",
"callback",
",",
"\"%s/%s\"",
"%",
"(",
"msg_id",
",",
"msg_i... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/monitor/openstack/common/rpc/impl_qpid.py#L144-L156 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/junos.py | python | fsentry_exists | (dir, **kwargs) | return status | Returns a dictionary indicating if `dir` refers to a file
or a non-file (generally a directory) in the file system,
or if there is no file by that name.
.. note::
This function only works on Juniper native minions
.. versionadded:: 3003
CLI Example:
.. code-block:: bash
salt... | Returns a dictionary indicating if `dir` refers to a file
or a non-file (generally a directory) in the file system,
or if there is no file by that name. | [
"Returns",
"a",
"dictionary",
"indicating",
"if",
"dir",
"refers",
"to",
"a",
"file",
"or",
"a",
"non",
"-",
"file",
"(",
"generally",
"a",
"directory",
")",
"in",
"the",
"file",
"system",
"or",
"if",
"there",
"is",
"no",
"file",
"by",
"that",
"name",
... | def fsentry_exists(dir, **kwargs):
"""
Returns a dictionary indicating if `dir` refers to a file
or a non-file (generally a directory) in the file system,
or if there is no file by that name.
.. note::
This function only works on Juniper native minions
.. versionadded:: 3003
CLI E... | [
"def",
"fsentry_exists",
"(",
"dir",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_junos",
"(",
")",
":",
"return",
"{",
"\"success\"",
":",
"False",
",",
"\"message\"",
":",
"\"This method is unsupported o... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/junos.py#L2115-L2162 | |
ankitects/anki | 4360fd16fb20b647ca2597d38129024d952f996e | qt/aqt/theme.py | python | set_macos_dark_mode | (enabled: bool) | return macos_helper.set_darkmode_enabled(enabled) | True if setting successful. | True if setting successful. | [
"True",
"if",
"setting",
"successful",
"."
] | def set_macos_dark_mode(enabled: bool) -> bool:
"True if setting successful."
from aqt._macos_helper import macos_helper
if not macos_helper:
return False
return macos_helper.set_darkmode_enabled(enabled) | [
"def",
"set_macos_dark_mode",
"(",
"enabled",
":",
"bool",
")",
"->",
"bool",
":",
"from",
"aqt",
".",
"_macos_helper",
"import",
"macos_helper",
"if",
"not",
"macos_helper",
":",
"return",
"False",
"return",
"macos_helper",
".",
"set_darkmode_enabled",
"(",
"en... | https://github.com/ankitects/anki/blob/4360fd16fb20b647ca2597d38129024d952f996e/qt/aqt/theme.py#L333-L339 | |
nosmokingbandit/Watcher3 | 0217e75158b563bdefc8e01c3be7620008cf3977 | lib/sqlalchemy/sql/compiler.py | python | Compiled.execute | (self, *multiparams, **params) | return e._execute_compiled(self, multiparams, params) | Execute this compiled object. | Execute this compiled object. | [
"Execute",
"this",
"compiled",
"object",
"."
] | def execute(self, *multiparams, **params):
"""Execute this compiled object."""
e = self.bind
if e is None:
raise exc.UnboundExecutionError(
"This Compiled object is not bound to any Engine "
"or Connection.")
return e._execute_compiled(self, m... | [
"def",
"execute",
"(",
"self",
",",
"*",
"multiparams",
",",
"*",
"*",
"params",
")",
":",
"e",
"=",
"self",
".",
"bind",
"if",
"e",
"is",
"None",
":",
"raise",
"exc",
".",
"UnboundExecutionError",
"(",
"\"This Compiled object is not bound to any Engine \"",
... | https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/sqlalchemy/sql/compiler.py#L264-L272 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/lib2to3/fixer_util.py | python | Attr | (obj, attr) | return [obj, Node(syms.trailer, [Dot(), attr])] | A node tuple for obj.attr | A node tuple for obj.attr | [
"A",
"node",
"tuple",
"for",
"obj",
".",
"attr"
] | def Attr(obj, attr):
"""A node tuple for obj.attr"""
return [obj, Node(syms.trailer, [Dot(), attr])] | [
"def",
"Attr",
"(",
"obj",
",",
"attr",
")",
":",
"return",
"[",
"obj",
",",
"Node",
"(",
"syms",
".",
"trailer",
",",
"[",
"Dot",
"(",
")",
",",
"attr",
"]",
")",
"]"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/lib2to3/fixer_util.py#L42-L44 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/ip_messaging/v2/service/binding.py | python | BindingInstance.message_types | (self) | return self._properties['message_types'] | :returns: The message_types
:rtype: list[unicode] | :returns: The message_types
:rtype: list[unicode] | [
":",
"returns",
":",
"The",
"message_types",
":",
"rtype",
":",
"list",
"[",
"unicode",
"]"
] | def message_types(self):
"""
:returns: The message_types
:rtype: list[unicode]
"""
return self._properties['message_types'] | [
"def",
"message_types",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'message_types'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/ip_messaging/v2/service/binding.py#L385-L390 | |
taehoonlee/tensornets | c9b1d78f806892193efdebee2789a47fd148b984 | tensornets/contrib_layers/layers.py | python | sequence_to_images | (inputs,
height,
output_data_format='channels_last',
outputs_collections=None,
scope=None) | Convert a batch of sequences into a batch of images.
Args:
inputs: (num_steps, num_batches, depth) sequence tensor
height: the height of the images
output_data_format: Format of output tensor. Currently supports
`'channels_first'` and `'channels_last'`.
outputs_collections: The collections to w... | Convert a batch of sequences into a batch of images. | [
"Convert",
"a",
"batch",
"of",
"sequences",
"into",
"a",
"batch",
"of",
"images",
"."
] | def sequence_to_images(inputs,
height,
output_data_format='channels_last',
outputs_collections=None,
scope=None):
"""Convert a batch of sequences into a batch of images.
Args:
inputs: (num_steps, num_batches, depth) seq... | [
"def",
"sequence_to_images",
"(",
"inputs",
",",
"height",
",",
"output_data_format",
"=",
"'channels_last'",
",",
"outputs_collections",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"scope",
",",
"'SequenceToImages'",... | https://github.com/taehoonlee/tensornets/blob/c9b1d78f806892193efdebee2789a47fd148b984/tensornets/contrib_layers/layers.py#L2855-L2885 | ||
deepfakes/faceswap | 09c7d8aca3c608d1afad941ea78e9fd9b64d9219 | plugins/extract/_base.py | python | Extractor._predict | (self, batch) | **Override method** (at `<plugin_type>` level)
This method should be overridden at the `<plugin_type>` level (IE.
``plugins.extract.detect._base`` or ``plugins.extract.align._base``) and should not
be overridden within plugins themselves.
It acts as a wrapper for the plugin's ``self.pr... | **Override method** (at `<plugin_type>` level) | [
"**",
"Override",
"method",
"**",
"(",
"at",
"<plugin_type",
">",
"level",
")"
] | def _predict(self, batch):
""" **Override method** (at `<plugin_type>` level)
This method should be overridden at the `<plugin_type>` level (IE.
``plugins.extract.detect._base`` or ``plugins.extract.align._base``) and should not
be overridden within plugins themselves.
It acts ... | [
"def",
"_predict",
"(",
"self",
",",
"batch",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/plugins/extract/_base.py#L228-L243 | ||
Yukinoshita47/Yuki-Chan-The-Auto-Pentest | bea1af4e1d544eadc166f728be2f543ea10af191 | Module/metagoofil/lib/markup.py | python | _argsdicts | ( args, mydict ) | A utility generator that pads argument list and dictionary values, will only be called with len( args ) = 0, 1. | A utility generator that pads argument list and dictionary values, will only be called with len( args ) = 0, 1. | [
"A",
"utility",
"generator",
"that",
"pads",
"argument",
"list",
"and",
"dictionary",
"values",
"will",
"only",
"be",
"called",
"with",
"len",
"(",
"args",
")",
"=",
"0",
"1",
"."
] | def _argsdicts( args, mydict ):
"""A utility generator that pads argument list and dictionary values, will only be called with len( args ) = 0, 1."""
if len( args ) == 0:
args = None,
elif len( args ) == 1:
args = _totuple( args[0] )
else:
raise Exception, "We should have n... | [
"def",
"_argsdicts",
"(",
"args",
",",
"mydict",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"args",
"=",
"None",
",",
"elif",
"len",
"(",
"args",
")",
"==",
"1",
":",
"args",
"=",
"_totuple",
"(",
"args",
"[",
"0",
"]",
")",
"el... | https://github.com/Yukinoshita47/Yuki-Chan-The-Auto-Pentest/blob/bea1af4e1d544eadc166f728be2f543ea10af191/Module/metagoofil/lib/markup.py#L354-L381 | ||
plaitpy/plaitpy | cac12297b8ca2eb46a5a672d5917902dc91e7588 | src/template.py | python | Template.setup_template_from_data | (self, template, data) | return self.setup_template_from_yaml_doc(template, doc) | [] | def setup_template_from_data(self, template, data):
doc = yaml.load(data)
YAML_CACHE[template] = doc
return self.setup_template_from_yaml_doc(template, doc) | [
"def",
"setup_template_from_data",
"(",
"self",
",",
"template",
",",
"data",
")",
":",
"doc",
"=",
"yaml",
".",
"load",
"(",
"data",
")",
"YAML_CACHE",
"[",
"template",
"]",
"=",
"doc",
"return",
"self",
".",
"setup_template_from_yaml_doc",
"(",
"template",... | https://github.com/plaitpy/plaitpy/blob/cac12297b8ca2eb46a5a672d5917902dc91e7588/src/template.py#L285-L289 | |||
Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks | 40c985b9a9ff1189ddf278462440b120cf96b196 | libs/scapy/layers/inet.py | python | defrag | (plist) | return _defrag_logic(plist, complete=False) | defrag(plist) -> ([not fragmented], [defragmented],
[ [bad fragments], [bad fragments], ... ]) | defrag(plist) -> ([not fragmented], [defragmented],
[ [bad fragments], [bad fragments], ... ]) | [
"defrag",
"(",
"plist",
")",
"-",
">",
"(",
"[",
"not",
"fragmented",
"]",
"[",
"defragmented",
"]",
"[",
"[",
"bad",
"fragments",
"]",
"[",
"bad",
"fragments",
"]",
"...",
"]",
")"
] | def defrag(plist):
"""defrag(plist) -> ([not fragmented], [defragmented],
[ [bad fragments], [bad fragments], ... ])"""
return _defrag_logic(plist, complete=False) | [
"def",
"defrag",
"(",
"plist",
")",
":",
"return",
"_defrag_logic",
"(",
"plist",
",",
"complete",
"=",
"False",
")"
] | https://github.com/Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks/blob/40c985b9a9ff1189ddf278462440b120cf96b196/libs/scapy/layers/inet.py#L1105-L1108 | |
JosephLai241/URS | 9f8cf3a3adb9aa5079dfc7bfd7832b53358ee40f | urs/praw_scrapers/static_scrapers/Subreddit.py | python | FormatJSON.make_json_skeleton | (cat_i, search_for, sub, time_filter) | return skeleton | Create a skeleton for JSON export. Include scrape details at the top.
Parameters
----------
cat_i: str
String denoting the shortened category in the `short_cat` list
search_for: str
String denoting n_results returned or keywords searched for
sub: str
... | Create a skeleton for JSON export. Include scrape details at the top. | [
"Create",
"a",
"skeleton",
"for",
"JSON",
"export",
".",
"Include",
"scrape",
"details",
"at",
"the",
"top",
"."
] | def make_json_skeleton(cat_i, search_for, sub, time_filter):
"""
Create a skeleton for JSON export. Include scrape details at the top.
Parameters
----------
cat_i: str
String denoting the shortened category in the `short_cat` list
search_for: str
... | [
"def",
"make_json_skeleton",
"(",
"cat_i",
",",
"search_for",
",",
"sub",
",",
"time_filter",
")",
":",
"skeleton",
"=",
"{",
"\"scrape_settings\"",
":",
"{",
"\"subreddit\"",
":",
"sub",
",",
"\"category\"",
":",
"categories",
"[",
"short_cat",
".",
"index",
... | https://github.com/JosephLai241/URS/blob/9f8cf3a3adb9aa5079dfc7bfd7832b53358ee40f/urs/praw_scrapers/static_scrapers/Subreddit.py#L417-L448 | |
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V1.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/lockfile/__init__.py | python | _SharedBase.acquire | (self, timeout=None) | Acquire the lock.
* If timeout is omitted (or None), wait forever trying to lock the
file.
* If timeout > 0, try to acquire the lock for that many seconds. If
the lock period expires and the file is still locked, raise
LockTimeout.
* If timeout <= 0, raise Alrea... | Acquire the lock. | [
"Acquire",
"the",
"lock",
"."
] | def acquire(self, timeout=None):
"""
Acquire the lock.
* If timeout is omitted (or None), wait forever trying to lock the
file.
* If timeout > 0, try to acquire the lock for that many seconds. If
the lock period expires and the file is still locked, raise
... | [
"def",
"acquire",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"raise",
"NotImplemented",
"(",
"\"implement in subclass\"",
")"
] | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V1.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/lockfile/__init__.py#L169-L183 | ||
francisck/DanderSpritz_docs | 86bb7caca5a957147f120b18bb5c31f299914904 | Python/Core/Lib/mimetypes.py | python | MimeTypes.guess_type | (self, url, strict=True) | Guess the type of a file based on its URL.
Return value is a tuple (type, encoding) where type is None if
the type can't be guessed (no or unknown suffix) or a string
of the form type/subtype, usable for a MIME Content-type
header; and encoding is None for no encoding or the nam... | Guess the type of a file based on its URL.
Return value is a tuple (type, encoding) where type is None if
the type can't be guessed (no or unknown suffix) or a string
of the form type/subtype, usable for a MIME Content-type
header; and encoding is None for no encoding or the nam... | [
"Guess",
"the",
"type",
"of",
"a",
"file",
"based",
"on",
"its",
"URL",
".",
"Return",
"value",
"is",
"a",
"tuple",
"(",
"type",
"encoding",
")",
"where",
"type",
"is",
"None",
"if",
"the",
"type",
"can",
"t",
"be",
"guessed",
"(",
"no",
"or",
"unk... | def guess_type(self, url, strict=True):
"""Guess the type of a file based on its URL.
Return value is a tuple (type, encoding) where type is None if
the type can't be guessed (no or unknown suffix) or a string
of the form type/subtype, usable for a MIME Content-type
head... | [
"def",
"guess_type",
"(",
"self",
",",
"url",
",",
"strict",
"=",
"True",
")",
":",
"scheme",
",",
"url",
"=",
"urllib",
".",
"splittype",
"(",
"url",
")",
"if",
"scheme",
"==",
"'data'",
":",
"comma",
"=",
"url",
".",
"find",
"(",
"','",
")",
"i... | https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/mimetypes.py#L97-L153 | ||
pytorch/benchmark | 5c93a5389563a5b6ccfa17d265d60f4fe7272f31 | torchbenchmark/util/torchtext_legacy/translation.py | python | TranslationDataset.__init__ | (self, path, exts, fields, **kwargs) | Create a TranslationDataset given paths and fields.
Args:
path: Common prefix of paths to the data files for both languages.
exts: A tuple containing the extension to path for each language.
fields: A tuple containing the fields that will be used for data
in ... | Create a TranslationDataset given paths and fields. | [
"Create",
"a",
"TranslationDataset",
"given",
"paths",
"and",
"fields",
"."
] | def __init__(self, path, exts, fields, **kwargs):
"""Create a TranslationDataset given paths and fields.
Args:
path: Common prefix of paths to the data files for both languages.
exts: A tuple containing the extension to path for each language.
fields: A tuple contain... | [
"def",
"__init__",
"(",
"self",
",",
"path",
",",
"exts",
",",
"fields",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"fields",
"[",
"0",
"]",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"fields",
"=",
"[",
"(",
"'src'"... | https://github.com/pytorch/benchmark/blob/5c93a5389563a5b6ccfa17d265d60f4fe7272f31/torchbenchmark/util/torchtext_legacy/translation.py#L21-L46 | ||
VLSIDA/OpenRAM | f66aac3264598eeae31225c62b6a4af52412d407 | compiler/base/vector.py | python | vector.__radd__ | (self, other) | Override + function (right add) | Override + function (right add) | [
"Override",
"+",
"function",
"(",
"right",
"add",
")"
] | def __radd__(self, other):
"""
Override + function (right add)
"""
if other == 0:
return self
else:
return self.__add__(other) | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
"==",
"0",
":",
"return",
"self",
"else",
":",
"return",
"self",
".",
"__add__",
"(",
"other",
")"
] | https://github.com/VLSIDA/OpenRAM/blob/f66aac3264598eeae31225c62b6a4af52412d407/compiler/base/vector.py#L75-L82 | ||
freedombox/FreedomBox | 335a7f92cc08f27981f838a7cddfc67740598e54 | plinth/modules/networks/views.py | python | NetworkTopologyFirstBootView.form_valid | (self, form) | return super().form_valid(form) | Mark the first wizard step as done, save value and redirect. | Mark the first wizard step as done, save value and redirect. | [
"Mark",
"the",
"first",
"wizard",
"step",
"as",
"done",
"save",
"value",
"and",
"redirect",
"."
] | def form_valid(self, form):
"""Mark the first wizard step as done, save value and redirect."""
first_boot.mark_step_done('network_topology_wizard')
if 'skip' in form.data:
first_boot.mark_step_done('router_setup_wizard')
return FormView.form_valid(self, form)
ret... | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"first_boot",
".",
"mark_step_done",
"(",
"'network_topology_wizard'",
")",
"if",
"'skip'",
"in",
"form",
".",
"data",
":",
"first_boot",
".",
"mark_step_done",
"(",
"'router_setup_wizard'",
")",
"return",... | https://github.com/freedombox/FreedomBox/blob/335a7f92cc08f27981f838a7cddfc67740598e54/plinth/modules/networks/views.py#L551-L558 | |
rotki/rotki | aafa446815cdd5e9477436d1b02bee7d01b398c8 | rotkehlchen/exchanges/bitfinex.py | python | Bitfinex.validate_api_key | (self) | return True, '' | Validates that the Bitfinex API key is good for usage in rotki.
Makes sure that the following permissions are given to the key:
- Account History: get historical balances entries and trade information.
- Wallets: get wallet balances and addresses. | Validates that the Bitfinex API key is good for usage in rotki. | [
"Validates",
"that",
"the",
"Bitfinex",
"API",
"key",
"is",
"good",
"for",
"usage",
"in",
"rotki",
"."
] | def validate_api_key(self) -> Tuple[bool, str]:
"""Validates that the Bitfinex API key is good for usage in rotki.
Makes sure that the following permissions are given to the key:
- Account History: get historical balances entries and trade information.
- Wallets: get wallet balances and... | [
"def",
"validate_api_key",
"(",
"self",
")",
"->",
"Tuple",
"[",
"bool",
",",
"str",
"]",
":",
"response",
"=",
"self",
".",
"_api_query",
"(",
"'wallets'",
")",
"if",
"response",
".",
"status_code",
"!=",
"HTTPStatus",
".",
"OK",
":",
"result",
",",
"... | https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/rotkehlchen/exchanges/bitfinex.py#L991-L1007 | |
eskerda/pybikes | ecca502bdd4200281c71d5e65fd3eacc4e0e166a | pybikes/gewista_citybike.py | python | GewistaStation.__init__ | (self, data) | <station>
<id>2001</id>
<internal_id>1046</internal_id>
<name>Wallensteinplatz</name>
<boxes>27</boxes>
<free_boxes>19</free_boxes>
<free_bikes>8</free_bikes>
<status>aktiv</status>
<description/>
<latitude>48.22... | <station>
<id>2001</id>
<internal_id>1046</internal_id>
<name>Wallensteinplatz</name>
<boxes>27</boxes>
<free_boxes>19</free_boxes>
<free_bikes>8</free_bikes>
<status>aktiv</status>
<description/>
<latitude>48.22... | [
"<station",
">",
"<id",
">",
"2001<",
"/",
"id",
">",
"<internal_id",
">",
"1046<",
"/",
"internal_id",
">",
"<name",
">",
"Wallensteinplatz<",
"/",
"name",
">",
"<boxes",
">",
"27<",
"/",
"boxes",
">",
"<free_boxes",
">",
"19<",
"/",
"free_boxes",
">",
... | def __init__(self, data):
"""
<station>
<id>2001</id>
<internal_id>1046</internal_id>
<name>Wallensteinplatz</name>
<boxes>27</boxes>
<free_boxes>19</free_boxes>
<free_bikes>8</free_bikes>
<status>aktiv</status>
... | [
"def",
"__init__",
"(",
"self",
",",
"data",
")",
":",
"super",
"(",
"GewistaStation",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"name",
"=",
"data",
".",
"find",
"(",
"'name'",
")",
".",
"text",
"self",
".",
"latitude",
"=",
"float... | https://github.com/eskerda/pybikes/blob/ecca502bdd4200281c71d5e65fd3eacc4e0e166a/pybikes/gewista_citybike.py#L36-L63 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/billing_setup_service/client.py | python | BillingSetupServiceClient.payments_account_path | (
customer_id: str, payments_account_id: str,
) | return "customers/{customer_id}/paymentsAccounts/{payments_account_id}".format(
customer_id=customer_id, payments_account_id=payments_account_id,
) | Return a fully-qualified payments_account string. | Return a fully-qualified payments_account string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"payments_account",
"string",
"."
] | def payments_account_path(
customer_id: str, payments_account_id: str,
) -> str:
"""Return a fully-qualified payments_account string."""
return "customers/{customer_id}/paymentsAccounts/{payments_account_id}".format(
customer_id=customer_id, payments_account_id=payments_account_i... | [
"def",
"payments_account_path",
"(",
"customer_id",
":",
"str",
",",
"payments_account_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/paymentsAccounts/{payments_account_id}\"",
".",
"format",
"(",
"customer_id",
"=",
"customer_id",
","... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/billing_setup_service/client.py#L185-L191 | |
yangxue0827/R2CNN_HEAD_FPN_Tensorflow | 506d3456ae436f8f245a8e49f51b79aa8c390449 | libs/rpn/build_rpn.py | python | RPN.build_feature_pyramid | (self) | return feature_pyramid | reference: https://github.com/CharlesShang/FastMaskRCNN
build P2, P3, P4, P5
:return: multi-scale feature map | reference: https://github.com/CharlesShang/FastMaskRCNN
build P2, P3, P4, P5
:return: multi-scale feature map | [
"reference",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"CharlesShang",
"/",
"FastMaskRCNN",
"build",
"P2",
"P3",
"P4",
"P5",
":",
"return",
":",
"multi",
"-",
"scale",
"feature",
"map"
] | def build_feature_pyramid(self):
'''
reference: https://github.com/CharlesShang/FastMaskRCNN
build P2, P3, P4, P5
:return: multi-scale feature map
'''
feature_pyramid = {}
with tf.variable_scope('build_feature_pyramid'):
with slim.arg_scope([slim.con... | [
"def",
"build_feature_pyramid",
"(",
"self",
")",
":",
"feature_pyramid",
"=",
"{",
"}",
"with",
"tf",
".",
"variable_scope",
"(",
"'build_feature_pyramid'",
")",
":",
"with",
"slim",
".",
"arg_scope",
"(",
"[",
"slim",
".",
"conv2d",
"]",
",",
"weights_regu... | https://github.com/yangxue0827/R2CNN_HEAD_FPN_Tensorflow/blob/506d3456ae436f8f245a8e49f51b79aa8c390449/libs/rpn/build_rpn.py#L151-L185 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/conch/client/options.py | python | ConchOptions.opt_ciphers | (self, ciphers) | Select encryption algorithms | Select encryption algorithms | [
"Select",
"encryption",
"algorithms"
] | def opt_ciphers(self, ciphers):
"Select encryption algorithms"
ciphers = ciphers.split(',')
for cipher in ciphers:
if not SSHCiphers.cipherMap.has_key(cipher):
sys.exit("Unknown cipher type '%s'" % cipher)
self['ciphers'] = ciphers | [
"def",
"opt_ciphers",
"(",
"self",
",",
"ciphers",
")",
":",
"ciphers",
"=",
"ciphers",
".",
"split",
"(",
"','",
")",
"for",
"cipher",
"in",
"ciphers",
":",
"if",
"not",
"SSHCiphers",
".",
"cipherMap",
".",
"has_key",
"(",
"cipher",
")",
":",
"sys",
... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/conch/client/options.py#L58-L64 | ||
hmmlearn/hmmlearn | 2f808ecbbab15dbac951ee7d31bf56e59e565a91 | lib/hmmlearn/base.py | python | _BaseHMM._accumulate_sufficient_statistics_log | (
self, stats, X, lattice, posteriors, fwdlattice, bwdlattice) | Implementation of `_accumulate_sufficient_statistics`
for ``implementation = "log"``. | Implementation of `_accumulate_sufficient_statistics`
for ``implementation = "log"``. | [
"Implementation",
"of",
"_accumulate_sufficient_statistics",
"for",
"implementation",
"=",
"log",
"."
] | def _accumulate_sufficient_statistics_log(
self, stats, X, lattice, posteriors, fwdlattice, bwdlattice):
"""
Implementation of `_accumulate_sufficient_statistics`
for ``implementation = "log"``.
"""
stats['nobs'] += 1
if 's' in self.params:
stats['... | [
"def",
"_accumulate_sufficient_statistics_log",
"(",
"self",
",",
"stats",
",",
"X",
",",
"lattice",
",",
"posteriors",
",",
"fwdlattice",
",",
"bwdlattice",
")",
":",
"stats",
"[",
"'nobs'",
"]",
"+=",
"1",
"if",
"'s'",
"in",
"self",
".",
"params",
":",
... | https://github.com/hmmlearn/hmmlearn/blob/2f808ecbbab15dbac951ee7d31bf56e59e565a91/lib/hmmlearn/base.py#L806-L824 | ||
filerock/FileRock-Client | 37214f701666e76e723595f8f9ed238a42f6eb06 | filerockclient/ui/wxGui/notify_user.py | python | Notify_user.notifyUser | (self, what, *args, **kwds) | This method is supposed to be called by a non-gui thread
to request user notification.
It is a facade to other methods selected by parameter what. | This method is supposed to be called by a non-gui thread
to request user notification.
It is a facade to other methods selected by parameter what. | [
"This",
"method",
"is",
"supposed",
"to",
"be",
"called",
"by",
"a",
"non",
"-",
"gui",
"thread",
"to",
"request",
"user",
"notification",
".",
"It",
"is",
"a",
"facade",
"to",
"other",
"methods",
"selected",
"by",
"parameter",
"what",
"."
] | def notifyUser(self, what, *args, **kwds):
'''
This method is supposed to be called by a non-gui thread
to request user notification.
It is a facade to other methods selected by parameter what.
'''
self.app.waitReady()
method_name = '_notifyUser_' + what
... | [
"def",
"notifyUser",
"(",
"self",
",",
"what",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"self",
".",
"app",
".",
"waitReady",
"(",
")",
"method_name",
"=",
"'_notifyUser_'",
"+",
"what",
"try",
":",
"askMethod",
"=",
"getattr",
"(",
"self",... | https://github.com/filerock/FileRock-Client/blob/37214f701666e76e723595f8f9ed238a42f6eb06/filerockclient/ui/wxGui/notify_user.py#L58-L76 | ||
Veil-Framework/Veil-Evasion | 3c0dec3117dd4d39965719bf73fd822f1002ef93 | tools/backdoor/intel/LinuxIntelELF64.py | python | linux_elfI64_shellcode.user_supplied_shellcode | (self, flItms, CavesPicked={}) | return (self.shellcode1) | For user supplied shellcode | For user supplied shellcode | [
"For",
"user",
"supplied",
"shellcode"
] | def user_supplied_shellcode(self, flItms, CavesPicked={}):
"""
For user supplied shellcode
"""
if self.SUPPLIED_SHELLCODE is None:
print "[!] User must provide shellcode for this module (-U)"
return False
else:
supplied_shellcode = open(self.SU... | [
"def",
"user_supplied_shellcode",
"(",
"self",
",",
"flItms",
",",
"CavesPicked",
"=",
"{",
"}",
")",
":",
"if",
"self",
".",
"SUPPLIED_SHELLCODE",
"is",
"None",
":",
"print",
"\"[!] User must provide shellcode for this module (-U)\"",
"return",
"False",
"else",
":"... | https://github.com/Veil-Framework/Veil-Evasion/blob/3c0dec3117dd4d39965719bf73fd822f1002ef93/tools/backdoor/intel/LinuxIntelELF64.py#L119-L137 | |
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/threading.py | python | current_thread | () | Return the current Thread object, corresponding to the caller's thread of control.
If the caller's thread of control was not created through the threading
module, a dummy thread object with limited functionality is returned. | Return the current Thread object, corresponding to the caller's thread of control. | [
"Return",
"the",
"current",
"Thread",
"object",
"corresponding",
"to",
"the",
"caller",
"s",
"thread",
"of",
"control",
"."
] | def current_thread():
"""Return the current Thread object, corresponding to the caller's thread of control.
If the caller's thread of control was not created through the threading
module, a dummy thread object with limited functionality is returned.
"""
try:
return _active[get_ident()]
... | [
"def",
"current_thread",
"(",
")",
":",
"try",
":",
"return",
"_active",
"[",
"get_ident",
"(",
")",
"]",
"except",
"KeyError",
":",
"return",
"_DummyThread",
"(",
")"
] | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/threading.py#L1206-L1216 | ||
gwastro/pycbc | 1e1c85534b9dba8488ce42df693230317ca63dea | pycbc/tmpltbank/lattice_utils.py | python | generate_anstar_3d_lattice | (maxv1, minv1, maxv2, minv2, maxv3, minv3, \
mindist) | return vs1, vs2, vs3 | This function calls into LAL routines to generate a 3-dimensional array
of points using the An^* lattice.
Parameters
-----------
maxv1 : float
Largest value in the 1st dimension to cover
minv1 : float
Smallest value in the 1st dimension to cover
maxv2 : float
Largest val... | This function calls into LAL routines to generate a 3-dimensional array
of points using the An^* lattice. | [
"This",
"function",
"calls",
"into",
"LAL",
"routines",
"to",
"generate",
"a",
"3",
"-",
"dimensional",
"array",
"of",
"points",
"using",
"the",
"An^",
"*",
"lattice",
"."
] | def generate_anstar_3d_lattice(maxv1, minv1, maxv2, minv2, maxv3, minv3, \
mindist):
"""
This function calls into LAL routines to generate a 3-dimensional array
of points using the An^* lattice.
Parameters
-----------
maxv1 : float
Largest value in the 1st... | [
"def",
"generate_anstar_3d_lattice",
"(",
"maxv1",
",",
"minv1",
",",
"maxv2",
",",
"minv2",
",",
"maxv3",
",",
"minv3",
",",
"mindist",
")",
":",
"# Lalpulsar not a requirement for the rest of pycbc, so check if we have it",
"# here in this function.",
"try",
":",
"impor... | https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/tmpltbank/lattice_utils.py#L88-L159 | |
guoruoqian/cascade-rcnn_Pytorch | 947ebe93b9431c1dd654a54024c902d4386f030e | lib/model/fpn/non_cascade/detnet_backbone.py | python | conv3x3 | (in_planes, out_planes, stride=1) | return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | 3x3 convolution with padding | 3x3 convolution with padding | [
"3x3",
"convolution",
"with",
"padding"
] | def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | [
"def",
"conv3x3",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"3",
",",
"stride",
"=",
"stride",
",",
"padding",
"=",
"1",
",",
"... | https://github.com/guoruoqian/cascade-rcnn_Pytorch/blob/947ebe93b9431c1dd654a54024c902d4386f030e/lib/model/fpn/non_cascade/detnet_backbone.py#L15-L18 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/compileall.py | python | compile_file | (fullname, ddir=None, force=0, rx=None, quiet=0) | return success | Byte-compile one file.
Arguments (only fullname is required):
fullname: the file to byte-compile
ddir: if given, purported directory name (this is the
directory name that will show up in error messages)
force: if 1, force compilation, even if timestamps are up-to-date
quie... | Byte-compile one file. | [
"Byte",
"-",
"compile",
"one",
"file",
"."
] | def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0):
"""Byte-compile one file.
Arguments (only fullname is required):
fullname: the file to byte-compile
ddir: if given, purported directory name (this is the
directory name that will show up in error messages)
force... | [
"def",
"compile_file",
"(",
"fullname",
",",
"ddir",
"=",
"None",
",",
"force",
"=",
"0",
",",
"rx",
"=",
"None",
",",
"quiet",
"=",
"0",
")",
":",
"success",
"=",
"1",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"fullname",
")",
"if",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/compileall.py#L61-L111 | |
gaasedelen/lighthouse | 7245a2d2c4e84351cd259ed81dafa4263167909a | plugins/lighthouse/director.py | python | CoverageDirector.get_coverage | (self, name) | return None | Retrieve coverage data for the requested coverage_name. | Retrieve coverage data for the requested coverage_name. | [
"Retrieve",
"coverage",
"data",
"for",
"the",
"requested",
"coverage_name",
"."
] | def get_coverage(self, name):
"""
Retrieve coverage data for the requested coverage_name.
"""
# if the given name was an alias, this will dereference it
coverage_name = self._alias2name.get(name, name)
# attempt to retrieve the requested coverage
if coverage_nam... | [
"def",
"get_coverage",
"(",
"self",
",",
"name",
")",
":",
"# if the given name was an alias, this will dereference it",
"coverage_name",
"=",
"self",
".",
"_alias2name",
".",
"get",
"(",
"name",
",",
"name",
")",
"# attempt to retrieve the requested coverage",
"if",
"c... | https://github.com/gaasedelen/lighthouse/blob/7245a2d2c4e84351cd259ed81dafa4263167909a/plugins/lighthouse/director.py#L1015-L1030 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/metadata.py | python | LegacyMetadata.set_metadata_version | (self) | [] | def set_metadata_version(self):
self._fields['Metadata-Version'] = _best_version(self._fields) | [
"def",
"set_metadata_version",
"(",
"self",
")",
":",
"self",
".",
"_fields",
"[",
"'Metadata-Version'",
"]",
"=",
"_best_version",
"(",
"self",
".",
"_fields",
")"
] | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/metadata.py#L264-L265 | ||||
bugcrowd/HUNT | ed3e1adee724bf6c98750f377f6c40cd656c82d3 | Burp/lib/scanner_issue.py | python | ScannerIssue.getParameter | (self) | return self._parameter | [] | def getParameter(self):
return self._parameter | [
"def",
"getParameter",
"(",
"self",
")",
":",
"return",
"self",
".",
"_parameter"
] | https://github.com/bugcrowd/HUNT/blob/ed3e1adee724bf6c98750f377f6c40cd656c82d3/Burp/lib/scanner_issue.py#L27-L28 | |||
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/python27/1.0/lib/linux/gevent/event.py | python | Event.rawlink | (self, callback) | Register a callback to call when the internal flag is set to true.
*callback* will be called in the :class:`Hub <gevent.hub.Hub>`, so it must not use blocking gevent API.
*callback* will be passed one argument: this instance. | Register a callback to call when the internal flag is set to true. | [
"Register",
"a",
"callback",
"to",
"call",
"when",
"the",
"internal",
"flag",
"is",
"set",
"to",
"true",
"."
] | def rawlink(self, callback):
"""Register a callback to call when the internal flag is set to true.
*callback* will be called in the :class:`Hub <gevent.hub.Hub>`, so it must not use blocking gevent API.
*callback* will be passed one argument: this instance.
"""
if not callable(c... | [
"def",
"rawlink",
"(",
"self",
",",
"callback",
")",
":",
"if",
"not",
"callable",
"(",
"callback",
")",
":",
"raise",
"TypeError",
"(",
"'Expected callable: %r'",
"%",
"(",
"callback",
",",
")",
")",
"self",
".",
"_links",
".",
"append",
"(",
"callback"... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/linux/gevent/event.py#L85-L95 | ||
enthought/mayavi | 2103a273568b8f0bd62328801aafbd6252543ae8 | tvtk/pyface/scene_model.py | python | SceneModel.save_jpg | (self, file_name, quality=None, progressive=None) | Arguments: file_name if passed will be used, quality is the
quality of the JPEG(10-100) are valid, the progressive
arguments toggles progressive jpegs. | Arguments: file_name if passed will be used, quality is the
quality of the JPEG(10-100) are valid, the progressive
arguments toggles progressive jpegs. | [
"Arguments",
":",
"file_name",
"if",
"passed",
"will",
"be",
"used",
"quality",
"is",
"the",
"quality",
"of",
"the",
"JPEG",
"(",
"10",
"-",
"100",
")",
"are",
"valid",
"the",
"progressive",
"arguments",
"toggles",
"progressive",
"jpegs",
"."
] | def save_jpg(self, file_name, quality=None, progressive=None):
"""Arguments: file_name if passed will be used, quality is the
quality of the JPEG(10-100) are valid, the progressive
arguments toggles progressive jpegs."""
self._check_scene_editor()
self.scene_editor.save_jpg(file_... | [
"def",
"save_jpg",
"(",
"self",
",",
"file_name",
",",
"quality",
"=",
"None",
",",
"progressive",
"=",
"None",
")",
":",
"self",
".",
"_check_scene_editor",
"(",
")",
"self",
".",
"scene_editor",
".",
"save_jpg",
"(",
"file_name",
",",
"quality",
",",
"... | https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/tvtk/pyface/scene_model.py#L204-L209 | ||
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/commands/controlCommands.py | python | ControlCommandsClass.__init__ | (self, c) | Ctor for ControlCommandsClass. | Ctor for ControlCommandsClass. | [
"Ctor",
"for",
"ControlCommandsClass",
"."
] | def __init__(self, c):
"""Ctor for ControlCommandsClass."""
# pylint: disable=super-init-not-called
self.c = c | [
"def",
"__init__",
"(",
"self",
",",
"c",
")",
":",
"# pylint: disable=super-init-not-called",
"self",
".",
"c",
"=",
"c"
] | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/commands/controlCommands.py#L22-L25 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/diagram_algebras.py | python | UnitDiagramMixin.one_basis | (self) | return self._base_diagrams(identity_set_partition(self._k)) | r"""
The following constructs the identity element of ``self``.
It is not called directly; instead one should use ``DA.one()`` if
``DA`` is a defined diagram algebra.
EXAMPLES::
sage: R.<x> = QQ[]
sage: P = PartitionAlgebra(2, x, R)
sage: P.one_basi... | r"""
The following constructs the identity element of ``self``. | [
"r",
"The",
"following",
"constructs",
"the",
"identity",
"element",
"of",
"self",
"."
] | def one_basis(self):
r"""
The following constructs the identity element of ``self``.
It is not called directly; instead one should use ``DA.one()`` if
``DA`` is a defined diagram algebra.
EXAMPLES::
sage: R.<x> = QQ[]
sage: P = PartitionAlgebra(2, x, R)... | [
"def",
"one_basis",
"(",
"self",
")",
":",
"return",
"self",
".",
"_base_diagrams",
"(",
"identity_set_partition",
"(",
"self",
".",
"_k",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/diagram_algebras.py#L2082-L2096 | |
francisck/DanderSpritz_docs | 86bb7caca5a957147f120b18bb5c31f299914904 | Python/Core/Lib/lib2to3/pytree.py | python | Node.insert_child | (self, i, child) | Equivalent to 'node.children.insert(i, child)'. This method also sets
the child's parent attribute appropriately. | Equivalent to 'node.children.insert(i, child)'. This method also sets
the child's parent attribute appropriately. | [
"Equivalent",
"to",
"node",
".",
"children",
".",
"insert",
"(",
"i",
"child",
")",
".",
"This",
"method",
"also",
"sets",
"the",
"child",
"s",
"parent",
"attribute",
"appropriately",
"."
] | def insert_child(self, i, child):
"""
Equivalent to 'node.children.insert(i, child)'. This method also sets
the child's parent attribute appropriately.
"""
child.parent = self
self.children.insert(i, child)
self.changed() | [
"def",
"insert_child",
"(",
"self",
",",
"i",
",",
"child",
")",
":",
"child",
".",
"parent",
"=",
"self",
"self",
".",
"children",
".",
"insert",
"(",
"i",
",",
"child",
")",
"self",
".",
"changed",
"(",
")"
] | https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/lib2to3/pytree.py#L333-L340 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/http/cookiejar.py | python | liberal_is_HDN | (text) | return True | Return True if text is a sort-of-like a host domain name.
For accepting/blocking domains. | Return True if text is a sort-of-like a host domain name. | [
"Return",
"True",
"if",
"text",
"is",
"a",
"sort",
"-",
"of",
"-",
"like",
"a",
"host",
"domain",
"name",
"."
] | def liberal_is_HDN(text):
"""Return True if text is a sort-of-like a host domain name.
For accepting/blocking domains.
"""
if IPV4_RE.search(text):
return False
return True | [
"def",
"liberal_is_HDN",
"(",
"text",
")",
":",
"if",
"IPV4_RE",
".",
"search",
"(",
"text",
")",
":",
"return",
"False",
"return",
"True"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/http/cookiejar.py#L582-L590 | |
gwpy/gwpy | 82becd78d166a32985cb657a54d0d39f6a207739 | gwpy/plot/axes.py | python | Axes._fmt_ydata | (self, y) | return self.yaxis.get_major_formatter().format_data_short(y) | [] | def _fmt_ydata(self, y):
if self.get_yscale() in GPS_SCALES:
return str(to_gps(y))
return self.yaxis.get_major_formatter().format_data_short(y) | [
"def",
"_fmt_ydata",
"(",
"self",
",",
"y",
")",
":",
"if",
"self",
".",
"get_yscale",
"(",
")",
"in",
"GPS_SCALES",
":",
"return",
"str",
"(",
"to_gps",
"(",
"y",
")",
")",
"return",
"self",
".",
"yaxis",
".",
"get_major_formatter",
"(",
")",
".",
... | https://github.com/gwpy/gwpy/blob/82becd78d166a32985cb657a54d0d39f6a207739/gwpy/plot/axes.py#L162-L165 | |||
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/requests/packages/urllib3/packages/six.py | python | _LazyDescr.__get__ | (self, obj, tp) | return result | [] | def __get__(self, obj, tp):
result = self._resolve()
setattr(obj, self.name, result)
# This is a bit ugly, but it avoids running this again.
delattr(tp, self.name)
return result | [
"def",
"__get__",
"(",
"self",
",",
"obj",
",",
"tp",
")",
":",
"result",
"=",
"self",
".",
"_resolve",
"(",
")",
"setattr",
"(",
"obj",
",",
"self",
".",
"name",
",",
"result",
")",
"# This is a bit ugly, but it avoids running this again.",
"delattr",
"(",
... | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/requests/packages/urllib3/packages/six.py#L83-L88 | |||
Scarygami/mirror-api | 497783f6d721b24b793c1fcd8c71d0c7d11956d4 | lib/cloudstorage/storage_api.py | python | StreamingBuffer._get_offset_from_gcs | (self) | return int(offset) | Get the last offset that has been written to GCS.
This is a utility method that does not modify self.
Returns:
an int of the last offset written to GCS by this upload, inclusive.
-1 means nothing has been written. | Get the last offset that has been written to GCS. | [
"Get",
"the",
"last",
"offset",
"that",
"has",
"been",
"written",
"to",
"GCS",
"."
] | def _get_offset_from_gcs(self):
"""Get the last offset that has been written to GCS.
This is a utility method that does not modify self.
Returns:
an int of the last offset written to GCS by this upload, inclusive.
-1 means nothing has been written.
"""
headers = {'content-range': 'byte... | [
"def",
"_get_offset_from_gcs",
"(",
"self",
")",
":",
"headers",
"=",
"{",
"'content-range'",
":",
"'bytes */*'",
"}",
"status",
",",
"response_headers",
",",
"content",
"=",
"self",
".",
"_api",
".",
"put_object",
"(",
"self",
".",
"_path_with_token",
",",
... | https://github.com/Scarygami/mirror-api/blob/497783f6d721b24b793c1fcd8c71d0c7d11956d4/lib/cloudstorage/storage_api.py#L823-L842 | |
Azure/azure-cosmos-python | 02522666b37ec24acfbd0537878eda73c90d2442 | azure/cosmos/consistent_hash_ring.py | python | _ConsistentHashRing._FindPartition | (self, key) | return self._LowerBoundSearch(self.partitions, hash_value) | Finds the partition from the byte array representation of the partition key. | Finds the partition from the byte array representation of the partition key. | [
"Finds",
"the",
"partition",
"from",
"the",
"byte",
"array",
"representation",
"of",
"the",
"partition",
"key",
"."
] | def _FindPartition(self, key):
"""Finds the partition from the byte array representation of the partition key.
"""
hash_value = self.hash_generator.ComputeHash(key)
return self._LowerBoundSearch(self.partitions, hash_value) | [
"def",
"_FindPartition",
"(",
"self",
",",
"key",
")",
":",
"hash_value",
"=",
"self",
".",
"hash_generator",
".",
"ComputeHash",
"(",
"key",
")",
"return",
"self",
".",
"_LowerBoundSearch",
"(",
"self",
".",
"partitions",
",",
"hash_value",
")"
] | https://github.com/Azure/azure-cosmos-python/blob/02522666b37ec24acfbd0537878eda73c90d2442/azure/cosmos/consistent_hash_ring.py#L93-L97 | |
emmetio/livestyle-sublime-old | c42833c046e9b2f53ebce3df3aa926528f5a33b5 | tornado/simple_httpclient.py | python | _HTTPConnection._on_chunk_length | (self, data) | [] | def _on_chunk_length(self, data):
# TODO: "chunk extensions" http://tools.ietf.org/html/rfc2616#section-3.6.1
length = int(data.strip(), 16)
if length == 0:
if self._decompressor is not None:
tail = self._decompressor.flush()
if tail:
... | [
"def",
"_on_chunk_length",
"(",
"self",
",",
"data",
")",
":",
"# TODO: \"chunk extensions\" http://tools.ietf.org/html/rfc2616#section-3.6.1",
"length",
"=",
"int",
"(",
"data",
".",
"strip",
"(",
")",
",",
"16",
")",
"if",
"length",
"==",
"0",
":",
"if",
"self... | https://github.com/emmetio/livestyle-sublime-old/blob/c42833c046e9b2f53ebce3df3aa926528f5a33b5/tornado/simple_httpclient.py#L459-L481 | ||||
yujiali/gmmn | 6cab7eb72dbe6c1893adb11f4c81f469663b0a25 | core/generative.py | python | SampleFilter.filter | (self, x) | x: n x D is a matrix of examples
Return a matrix n' x D, with n' <= n, such that it contains all 'good'
samples. | x: n x D is a matrix of examples | [
"x",
":",
"n",
"x",
"D",
"is",
"a",
"matrix",
"of",
"examples"
] | def filter(self, x):
"""
x: n x D is a matrix of examples
Return a matrix n' x D, with n' <= n, such that it contains all 'good'
samples.
"""
raise NotImplementedError() | [
"def",
"filter",
"(",
"self",
",",
"x",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/yujiali/gmmn/blob/6cab7eb72dbe6c1893adb11f4c81f469663b0a25/core/generative.py#L1053-L1060 | ||
flan/staticdhcpd | 40ef788908beb9355aa06cabd5ff628a577d8595 | staticDHCPd/extensions/official/dynamism.py | python | DynamicPool.show_leases_csv | (self, *args, **kwargs) | return ('text/csv', output.read()) | Provides every lease in the system as a CSV document. | Provides every lease in the system as a CSV document. | [
"Provides",
"every",
"lease",
"in",
"the",
"system",
"as",
"a",
"CSV",
"document",
"."
] | def show_leases_csv(self, *args, **kwargs):
"""
Provides every lease in the system as a CSV document.
"""
import csv
import io
output = io.StringIO()
writer = csv.writer(output)
writer.writerow(('ip', 'mac', 'expiration', 'last seen'))
ren... | [
"def",
"show_leases_csv",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"csv",
"import",
"io",
"output",
"=",
"io",
".",
"StringIO",
"(",
")",
"writer",
"=",
"csv",
".",
"writer",
"(",
"output",
")",
"writer",
".",
"wr... | https://github.com/flan/staticdhcpd/blob/40ef788908beb9355aa06cabd5ff628a577d8595/staticDHCPd/extensions/official/dynamism.py#L314-L333 | |
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | qlist_cinsn_t.__init__ | (self, *args) | __init__(self) -> qlist_cinsn_t
__init__(self, x) -> qlist_cinsn_t | __init__(self) -> qlist_cinsn_t
__init__(self, x) -> qlist_cinsn_t | [
"__init__",
"(",
"self",
")",
"-",
">",
"qlist_cinsn_t",
"__init__",
"(",
"self",
"x",
")",
"-",
">",
"qlist_cinsn_t"
] | def __init__(self, *args):
"""
__init__(self) -> qlist_cinsn_t
__init__(self, x) -> qlist_cinsn_t
"""
this = _idaapi.new_qlist_cinsn_t(*args)
try: self.this.append(this)
except: self.this = this | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"this",
"=",
"_idaapi",
".",
"new_qlist_cinsn_t",
"(",
"*",
"args",
")",
"try",
":",
"self",
".",
"this",
".",
"append",
"(",
"this",
")",
"except",
":",
"self",
".",
"this",
"=",
"this"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L34748-L34755 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_version.py | python | Utils.get_resource_file | (sfile, sfile_type='yaml') | return contents | return the service file | return the service file | [
"return",
"the",
"service",
"file"
] | def get_resource_file(sfile, sfile_type='yaml'):
''' return the service file '''
contents = None
with open(sfile) as sfd:
contents = sfd.read()
if sfile_type == 'yaml':
# AUDIT:no-member makes sense here due to ruamel.YAML/PyYAML usage
# pylint: disab... | [
"def",
"get_resource_file",
"(",
"sfile",
",",
"sfile_type",
"=",
"'yaml'",
")",
":",
"contents",
"=",
"None",
"with",
"open",
"(",
"sfile",
")",
"as",
"sfd",
":",
"contents",
"=",
"sfd",
".",
"read",
"(",
")",
"if",
"sfile_type",
"==",
"'yaml'",
":",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_version.py#L1225-L1241 | |
GothicAi/Instaboost | b6f80405b8706adad4aca1c1bdbb650b9c1c71e5 | detectron/lib/datasets/json_dataset.py | python | JsonDataset._add_gt_annotations | (self, entry) | Add ground truth annotation metadata to an roidb entry. | Add ground truth annotation metadata to an roidb entry. | [
"Add",
"ground",
"truth",
"annotation",
"metadata",
"to",
"an",
"roidb",
"entry",
"."
] | def _add_gt_annotations(self, entry):
"""Add ground truth annotation metadata to an roidb entry."""
ann_ids = self.COCO.getAnnIds(imgIds=entry['id'], iscrowd=None)
objs = self.COCO.loadAnns(ann_ids)
# Sanitize bboxes -- some are invalid
valid_objs = []
valid_segms = []
... | [
"def",
"_add_gt_annotations",
"(",
"self",
",",
"entry",
")",
":",
"ann_ids",
"=",
"self",
".",
"COCO",
".",
"getAnnIds",
"(",
"imgIds",
"=",
"entry",
"[",
"'id'",
"]",
",",
"iscrowd",
"=",
"None",
")",
"objs",
"=",
"self",
".",
"COCO",
".",
"loadAnn... | https://github.com/GothicAi/Instaboost/blob/b6f80405b8706adad4aca1c1bdbb650b9c1c71e5/detectron/lib/datasets/json_dataset.py#L208-L294 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | official/nlp/tasks/sentence_prediction.py | python | predict | (task: SentencePredictionTask,
params: cfg.DataConfig,
model: tf.keras.Model,
params_aug: Optional[cfg.DataConfig] = None,
test_time_aug_wgt: float = 0.3) | Predicts on the input data.
Args:
task: A `SentencePredictionTask` object.
params: A `cfg.DataConfig` object.
model: A keras.Model.
params_aug: A `cfg.DataConfig` object for augmented data.
test_time_aug_wgt: Test time augmentation weight. The prediction score will
use (1. - test_time_aug_w... | Predicts on the input data. | [
"Predicts",
"on",
"the",
"input",
"data",
"."
] | def predict(task: SentencePredictionTask,
params: cfg.DataConfig,
model: tf.keras.Model,
params_aug: Optional[cfg.DataConfig] = None,
test_time_aug_wgt: float = 0.3) -> List[Union[int, float]]:
"""Predicts on the input data.
Args:
task: A `SentencePredictionTask`... | [
"def",
"predict",
"(",
"task",
":",
"SentencePredictionTask",
",",
"params",
":",
"cfg",
".",
"DataConfig",
",",
"model",
":",
"tf",
".",
"keras",
".",
"Model",
",",
"params_aug",
":",
"Optional",
"[",
"cfg",
".",
"DataConfig",
"]",
"=",
"None",
",",
"... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/nlp/tasks/sentence_prediction.py#L246-L310 | ||
biocore/qiime | 76d633c0389671e93febbe1338b5ded658eba31f | qiime/identify_chimeric_seqs.py | python | get_chimeras_from_Nast_aligned | (seqs_fp, ref_db_aligned_fp=None,
ref_db_fasta_fp=None,
HALT_EXEC=False, min_div_ratio=None,
keep_intermediates=False) | return chimeras | remove chimeras from seqs_fp using chimeraSlayer.
seqs_fp: a filepath with the seqs to check in the file
ref_db_aligned_fp: fp to (pynast) aligned reference sequences
ref_db_fasta_fp: same seqs as above, just unaligned. Will be computed on the fly if not provided,
HALT_EXEC: stop execution if true
... | remove chimeras from seqs_fp using chimeraSlayer. | [
"remove",
"chimeras",
"from",
"seqs_fp",
"using",
"chimeraSlayer",
"."
] | def get_chimeras_from_Nast_aligned(seqs_fp, ref_db_aligned_fp=None,
ref_db_fasta_fp=None,
HALT_EXEC=False, min_div_ratio=None,
keep_intermediates=False):
"""remove chimeras from seqs_fp using chimeraSlayer.
... | [
"def",
"get_chimeras_from_Nast_aligned",
"(",
"seqs_fp",
",",
"ref_db_aligned_fp",
"=",
"None",
",",
"ref_db_fasta_fp",
"=",
"None",
",",
"HALT_EXEC",
"=",
"False",
",",
"min_div_ratio",
"=",
"None",
",",
"keep_intermediates",
"=",
"False",
")",
":",
"files_to_rem... | https://github.com/biocore/qiime/blob/76d633c0389671e93febbe1338b5ded658eba31f/qiime/identify_chimeric_seqs.py#L587-L649 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/tableau_tuple.py | python | StandardTableauTuple.restrict | (self, m=None) | Returns the restriction of the standard tableau ``self`` to ``m``,
which defaults to one less than the current :meth:`~TableauTuple.size`.
EXAMPLES::
sage: StandardTableauTuple([[[5]],[[1,2],[3,4]]]).restrict(6)
([[5]], [[1, 2], [3, 4]])
sage: StandardTableauTuple([... | Returns the restriction of the standard tableau ``self`` to ``m``,
which defaults to one less than the current :meth:`~TableauTuple.size`. | [
"Returns",
"the",
"restriction",
"of",
"the",
"standard",
"tableau",
"self",
"to",
"m",
"which",
"defaults",
"to",
"one",
"less",
"than",
"the",
"current",
":",
"meth",
":",
"~TableauTuple",
".",
"size",
"."
] | def restrict(self, m=None):
"""
Returns the restriction of the standard tableau ``self`` to ``m``,
which defaults to one less than the current :meth:`~TableauTuple.size`.
EXAMPLES::
sage: StandardTableauTuple([[[5]],[[1,2],[3,4]]]).restrict(6)
([[5]], [[1, 2], [... | [
"def",
"restrict",
"(",
"self",
",",
"m",
"=",
"None",
")",
":",
"if",
"m",
"is",
"None",
":",
"m",
"=",
"self",
".",
"size",
"(",
")",
"-",
"1",
"# We are lucky in that currently restriction is defined for arbitrary",
"# (level one) tableau and not just standard on... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/tableau_tuple.py#L1995-L2039 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/xml/dom/expatbuilder.py | python | ExpatBuilder.end_cdata_section_handler | (self) | [] | def end_cdata_section_handler(self):
self._cdata = False
self._cdata_continue = False | [
"def",
"end_cdata_section_handler",
"(",
"self",
")",
":",
"self",
".",
"_cdata",
"=",
"False",
"self",
".",
"_cdata_continue",
"=",
"False"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/xml/dom/expatbuilder.py#L343-L345 | ||||
cagbal/ros_people_object_detection_tensorflow | 982ffd4a54b8059638f5cd4aa167299c7fc9e61f | src/object_detection/exporter.py | python | replace_variable_values_with_moving_averages | (graph,
current_checkpoint_file,
new_checkpoint_file) | Replaces variable values in the checkpoint with their moving averages.
If the current checkpoint has shadow variables maintaining moving averages of
the variables defined in the graph, this function generates a new checkpoint
where the variables contain the values of their moving averages.
Args:
graph: a ... | Replaces variable values in the checkpoint with their moving averages. | [
"Replaces",
"variable",
"values",
"in",
"the",
"checkpoint",
"with",
"their",
"moving",
"averages",
"."
] | def replace_variable_values_with_moving_averages(graph,
current_checkpoint_file,
new_checkpoint_file):
"""Replaces variable values in the checkpoint with their moving averages.
If the current checkpoint has shadow var... | [
"def",
"replace_variable_values_with_moving_averages",
"(",
"graph",
",",
"current_checkpoint_file",
",",
"new_checkpoint_file",
")",
":",
"with",
"graph",
".",
"as_default",
"(",
")",
":",
"variable_averages",
"=",
"tf",
".",
"train",
".",
"ExponentialMovingAverage",
... | https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/object_detection/exporter.py#L101-L123 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/tornado/web.py | python | RequestHandler.on_connection_close | (self) | Called in async handlers if the client closed the connection.
Override this to clean up resources associated with
long-lived connections. Note that this method is called only if
the connection was closed during asynchronous processing; if you
need to do cleanup after every request over... | Called in async handlers if the client closed the connection. | [
"Called",
"in",
"async",
"handlers",
"if",
"the",
"client",
"closed",
"the",
"connection",
"."
] | def on_connection_close(self):
"""Called in async handlers if the client closed the connection.
Override this to clean up resources associated with
long-lived connections. Note that this method is called only if
the connection was closed during asynchronous processing; if you
n... | [
"def",
"on_connection_close",
"(",
"self",
")",
":",
"if",
"_has_stream_request_body",
"(",
"self",
".",
"__class__",
")",
":",
"if",
"not",
"self",
".",
"request",
".",
"body",
".",
"done",
"(",
")",
":",
"self",
".",
"request",
".",
"body",
".",
"set... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/tornado/web.py#L270-L287 | ||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/traceback.py | python | format_stack | (f=None, limit=None) | return format_list(extract_stack(f, limit)) | Shorthand for 'format_list(extract_stack(f, limit))'. | Shorthand for 'format_list(extract_stack(f, limit))'. | [
"Shorthand",
"for",
"format_list",
"(",
"extract_stack",
"(",
"f",
"limit",
"))",
"."
] | def format_stack(f=None, limit=None):
"""Shorthand for 'format_list(extract_stack(f, limit))'."""
if f is None:
try:
raise ZeroDivisionError
except ZeroDivisionError:
f = sys.exc_info()[2].tb_frame.f_back
return format_list(extract_stack(f, limit)) | [
"def",
"format_stack",
"(",
"f",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"if",
"f",
"is",
"None",
":",
"try",
":",
"raise",
"ZeroDivisionError",
"except",
"ZeroDivisionError",
":",
"f",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"2",
"]",
... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/traceback.py#L286-L293 | |
ztosec/hunter | 4ee5cca8dc5fc5d7e631e935517bd0f493c30a37 | XssEyeCelery/model/vulnerability.py | python | VulnerabilityService.save | (**kwargs) | return HunterModelService.save(Vulnerability, **kwargs) | 保存漏洞信息
To use:
>>> VulnerabilityService.save(url_id=url.id, task_id=task_id, info=result['info'], plugin_info=None,
>>> payload=result["payload"],
>>> imp_version=result['details']['imp_version'], error=''.join(result['error']),
... | 保存漏洞信息
To use:
>>> VulnerabilityService.save(url_id=url.id, task_id=task_id, info=result['info'], plugin_info=None,
>>> payload=result["payload"],
>>> imp_version=result['details']['imp_version'], error=''.join(result['error']),
... | [
"保存漏洞信息",
"To",
"use",
":",
">>>",
"VulnerabilityService",
".",
"save",
"(",
"url_id",
"=",
"url",
".",
"id",
"task_id",
"=",
"task_id",
"info",
"=",
"result",
"[",
"info",
"]",
"plugin_info",
"=",
"None",
">>>",
"payload",
"=",
"result",
"[",
"payload",... | def save(**kwargs):
"""
保存漏洞信息
To use:
>>> VulnerabilityService.save(url_id=url.id, task_id=task_id, info=result['info'], plugin_info=None,
>>> payload=result["payload"],
>>> imp_version=result['details']['imp_version'],... | [
"def",
"save",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"HunterModelService",
".",
"save",
"(",
"Vulnerability",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/XssEyeCelery/model/vulnerability.py#L102-L120 | |
oleg-agapov/flask-jwt-auth | d68bb2522f9d71764bd2e67f9939bd7119859f20 | step_2/resources.py | python | AllUsers.delete | (self) | return {'message': 'Delete all users'} | [] | def delete(self):
return {'message': 'Delete all users'} | [
"def",
"delete",
"(",
"self",
")",
":",
"return",
"{",
"'message'",
":",
"'Delete all users'",
"}"
] | https://github.com/oleg-agapov/flask-jwt-auth/blob/d68bb2522f9d71764bd2e67f9939bd7119859f20/step_2/resources.py#L38-L39 | |||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | python | UniSpeechSatEncoder.__init__ | (self, config) | [] | def __init__(self, config):
super().__init__()
self.config = config
self.pos_conv_embed = UniSpeechSatPositionalConvEmbedding(config)
self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(config.hidden_dropout)
self.layers... | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"config",
"=",
"config",
"self",
".",
"pos_conv_embed",
"=",
"UniSpeechSatPositionalConvEmbedding",
"(",
"config",
")",
"self",
".",
"layer_... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py#L711-L718 | ||||
r9y9/nnsvs | 2ac94fcac19527840ad797d98ed4328b2ff0b89a | nnsvs/bin/prepare_features.py | python | _prepare_timelag_feature | (in_timelag_root, out_timelag_root,
in_timelag: FileSourceDataset,
out_timelag: FileSourceDataset, idx: int) | prepare timelag feature for one item of in_duration | prepare timelag feature for one item of in_duration | [
"prepare",
"timelag",
"feature",
"for",
"one",
"item",
"of",
"in_duration"
] | def _prepare_timelag_feature(in_timelag_root, out_timelag_root,
in_timelag: FileSourceDataset,
out_timelag: FileSourceDataset, idx: int) -> None:
"""prepare timelag feature for one item of in_duration
"""
x, y = in_timelag[idx], out_timelag[idx]
... | [
"def",
"_prepare_timelag_feature",
"(",
"in_timelag_root",
",",
"out_timelag_root",
",",
"in_timelag",
":",
"FileSourceDataset",
",",
"out_timelag",
":",
"FileSourceDataset",
",",
"idx",
":",
"int",
")",
"->",
"None",
":",
"x",
",",
"y",
"=",
"in_timelag",
"[",
... | https://github.com/r9y9/nnsvs/blob/2ac94fcac19527840ad797d98ed4328b2ff0b89a/nnsvs/bin/prepare_features.py#L19-L29 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/plat-mac/pimp.py | python | PimpPackage.dump | (self) | return self._dict | Return a dict object containing the information on the package. | Return a dict object containing the information on the package. | [
"Return",
"a",
"dict",
"object",
"containing",
"the",
"information",
"on",
"the",
"package",
"."
] | def dump(self):
"""Return a dict object containing the information on the package."""
return self._dict | [
"def",
"dump",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dict"
] | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/plat-mac/pimp.py#L564-L566 | |
SymbiFlow/symbiflow-arch-defs | f38793112ff78a06de9f1e3269bd22543e29729f | quicklogic/pp3/utils/rr_utils.py | python | node_joint_location | (node_a, node_b) | Given two VPR nodes returns a location of the point where they touch each
other. | Given two VPR nodes returns a location of the point where they touch each
other. | [
"Given",
"two",
"VPR",
"nodes",
"returns",
"a",
"location",
"of",
"the",
"point",
"where",
"they",
"touch",
"each",
"other",
"."
] | def node_joint_location(node_a, node_b):
"""
Given two VPR nodes returns a location of the point where they touch each
other.
"""
loc_a1 = Loc(node_a.loc.x_low, node_a.loc.y_low, 0)
loc_a2 = Loc(node_a.loc.x_high, node_a.loc.y_high, 0)
loc_b1 = Loc(node_b.loc.x_low, node_b.loc.y_low, 0)
... | [
"def",
"node_joint_location",
"(",
"node_a",
",",
"node_b",
")",
":",
"loc_a1",
"=",
"Loc",
"(",
"node_a",
".",
"loc",
".",
"x_low",
",",
"node_a",
".",
"loc",
".",
"y_low",
",",
"0",
")",
"loc_a2",
"=",
"Loc",
"(",
"node_a",
".",
"loc",
".",
"x_hi... | https://github.com/SymbiFlow/symbiflow-arch-defs/blob/f38793112ff78a06de9f1e3269bd22543e29729f/quicklogic/pp3/utils/rr_utils.py#L71-L92 | ||
hangoutsbot/hangoutsbot | aabe1059d5873f53691e28c19273277817fb34ba | hangupsbot/hangupsbot.py | python | HangupsBot.remove_user | (self, chat_id, user_id) | Remove a user from this conversation.
Args:
user_id (str): ID of the existing user.
Raises:
TypeError: If conversation is not a group.
NetworkError: If conversation cannot be removed from. | Remove a user from this conversation.
Args:
user_id (str): ID of the existing user.
Raises:
TypeError: If conversation is not a group.
NetworkError: If conversation cannot be removed from. | [
"Remove",
"a",
"user",
"from",
"this",
"conversation",
".",
"Args",
":",
"user_id",
"(",
"str",
")",
":",
"ID",
"of",
"the",
"existing",
"user",
".",
"Raises",
":",
"TypeError",
":",
"If",
"conversation",
"is",
"not",
"a",
"group",
".",
"NetworkError",
... | def remove_user(self, chat_id, user_id):
"""Remove a user from this conversation.
Args:
user_id (str): ID of the existing user.
Raises:
TypeError: If conversation is not a group.
NetworkError: If conversation cannot be removed from.
"""
conv = ... | [
"def",
"remove_user",
"(",
"self",
",",
"chat_id",
",",
"user_id",
")",
":",
"conv",
"=",
"self",
".",
"_conv_list",
".",
"get",
"(",
"chat_id",
")",
"if",
"not",
"conv",
".",
"_conversation",
".",
"type",
"==",
"hangups",
".",
"hangouts_pb2",
".",
"CO... | https://github.com/hangoutsbot/hangoutsbot/blob/aabe1059d5873f53691e28c19273277817fb34ba/hangupsbot/hangupsbot.py#L895-L916 | ||
Xavier-Lam/wechat-django | 258e193e9ec9558709e889fd105c9bf474b013e6 | wechat_django/models/rule.py | python | Rule._event_match | (self, message) | [] | def _event_match(self, message):
event = message.event.lower()
target = self.content["event"].lower()
if target == MessageHandler.EventType.SUBSCRIBE:
# wechatpy对eventtype进行了二次封装
return event in (
MessageHandler.EventType.SUBSCRIBE, "subscribe_scan")
... | [
"def",
"_event_match",
"(",
"self",
",",
"message",
")",
":",
"event",
"=",
"message",
".",
"event",
".",
"lower",
"(",
")",
"target",
"=",
"self",
".",
"content",
"[",
"\"event\"",
"]",
".",
"lower",
"(",
")",
"if",
"target",
"==",
"MessageHandler",
... | https://github.com/Xavier-Lam/wechat-django/blob/258e193e9ec9558709e889fd105c9bf474b013e6/wechat_django/models/rule.py#L118-L126 | ||||
containernet/containernet | 7b2ae38d691b2ed8da2b2700b85ed03562271d01 | mininet/cli.py | python | CLI.do_net | ( self, _line ) | List network connections. | List network connections. | [
"List",
"network",
"connections",
"."
] | def do_net( self, _line ):
"List network connections."
dumpNodeConnections( self.mn.values() ) | [
"def",
"do_net",
"(",
"self",
",",
"_line",
")",
":",
"dumpNodeConnections",
"(",
"self",
".",
"mn",
".",
"values",
"(",
")",
")"
] | https://github.com/containernet/containernet/blob/7b2ae38d691b2ed8da2b2700b85ed03562271d01/mininet/cli.py#L171-L173 | ||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/provisioningserver/import_images/boot_resources.py | python | link_bootloaders | (destination) | Link the all the required file from each bootloader method.
:param destination: Directory where the loaders should be stored. | Link the all the required file from each bootloader method.
:param destination: Directory where the loaders should be stored. | [
"Link",
"the",
"all",
"the",
"required",
"file",
"from",
"each",
"bootloader",
"method",
".",
":",
"param",
"destination",
":",
"Directory",
"where",
"the",
"loaders",
"should",
"be",
"stored",
"."
] | def link_bootloaders(destination):
"""Link the all the required file from each bootloader method.
:param destination: Directory where the loaders should be stored.
"""
for _, boot_method in BootMethodRegistry:
try:
boot_method.link_bootloader(destination)
except BaseException... | [
"def",
"link_bootloaders",
"(",
"destination",
")",
":",
"for",
"_",
",",
"boot_method",
"in",
"BootMethodRegistry",
":",
"try",
":",
"boot_method",
".",
"link_bootloader",
"(",
"destination",
")",
"except",
"BaseException",
":",
"msg",
"=",
"\"Unable to link the ... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/provisioningserver/import_images/boot_resources.py#L41-L51 | ||
OlafenwaMoses/ImageAI | fe2d6bab3ddb1027c54abe7eb961364928869a30 | imageai/Detection/keras_retinanet/models/retinanet.py | python | __build_anchors | (anchor_parameters, features) | return keras.layers.Concatenate(axis=1, name='anchors')(anchors) | Builds anchors for the shape of the features from FPN.
Args
anchor_parameters : Parameteres that determine how anchors are generated.
features : The FPN features.
Returns
A tensor containing the anchors for the FPN features.
The shape is:
```
(batch_si... | Builds anchors for the shape of the features from FPN. | [
"Builds",
"anchors",
"for",
"the",
"shape",
"of",
"the",
"features",
"from",
"FPN",
"."
] | def __build_anchors(anchor_parameters, features):
""" Builds anchors for the shape of the features from FPN.
Args
anchor_parameters : Parameteres that determine how anchors are generated.
features : The FPN features.
Returns
A tensor containing the anchors for the FPN feat... | [
"def",
"__build_anchors",
"(",
"anchor_parameters",
",",
"features",
")",
":",
"anchors",
"=",
"[",
"layers",
".",
"Anchors",
"(",
"size",
"=",
"anchor_parameters",
".",
"sizes",
"[",
"i",
"]",
",",
"stride",
"=",
"anchor_parameters",
".",
"strides",
"[",
... | https://github.com/OlafenwaMoses/ImageAI/blob/fe2d6bab3ddb1027c54abe7eb961364928869a30/imageai/Detection/keras_retinanet/models/retinanet.py#L229-L254 | |
alcarithemad/zfsp | 37a25b83103aa67a269b31cd4413d3baaffcde56 | zfs/datasets.py | python | Dataset.snapshots | (self) | return self._snapshots | [] | def snapshots(self) -> Dict[str, 'Dataset']:
if not self._snapshots:
snapshots = {}
for name, index in self.snapshot_names.items():
dsl_dataset = self.parent_objectset[index]
dataset = Dataset(
self.pool,
self.dsl_di... | [
"def",
"snapshots",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"'Dataset'",
"]",
":",
"if",
"not",
"self",
".",
"_snapshots",
":",
"snapshots",
"=",
"{",
"}",
"for",
"name",
",",
"index",
"in",
"self",
".",
"snapshot_names",
".",
"items",
"(",
... | https://github.com/alcarithemad/zfsp/blob/37a25b83103aa67a269b31cd4413d3baaffcde56/zfs/datasets.py#L41-L54 | |||
kvesteri/sqlalchemy-utils | 850d0ea5a8a84c0529d175ee41b9036bea597119 | sqlalchemy_utils/functions/database.py | python | database_exists | (url) | Check if a database exists.
:param url: A SQLAlchemy engine URL.
Performs backend-specific testing to quickly determine if a database
exists on the server. ::
database_exists('postgresql://postgres@localhost/name') #=> False
create_database('postgresql://postgres@localhost/name')
... | Check if a database exists. | [
"Check",
"if",
"a",
"database",
"exists",
"."
] | def database_exists(url):
"""Check if a database exists.
:param url: A SQLAlchemy engine URL.
Performs backend-specific testing to quickly determine if a database
exists on the server. ::
database_exists('postgresql://postgres@localhost/name') #=> False
create_database('postgresql://... | [
"def",
"database_exists",
"(",
"url",
")",
":",
"url",
"=",
"copy",
"(",
"make_url",
"(",
"url",
")",
")",
"database",
"=",
"url",
".",
"database",
"dialect_name",
"=",
"url",
".",
"get_dialect",
"(",
")",
".",
"name",
"engine",
"=",
"None",
"try",
"... | https://github.com/kvesteri/sqlalchemy-utils/blob/850d0ea5a8a84c0529d175ee41b9036bea597119/sqlalchemy_utils/functions/database.py#L462-L524 | ||
ybabakhin/kaggle_salt_bes_phalanx | 2f81d4dd8d50a01579e5f7650259dde92c5c3b8d | bes/segmentation_models/backbones/classification_models/classification_models/resnet/blocks.py | python | basic_identity_block | (filters, stage, block) | return layer | The identity block is the block that has no conv layer at shortcut.
# Arguments
kernel_size: default 3, the kernel size of
middle conv layer at main path
filters: list of integers, the filters of 3 conv layer at main path
stage: integer, current stage label, used for generating l... | The identity block is the block that has no conv layer at shortcut.
# Arguments
kernel_size: default 3, the kernel size of
middle conv layer at main path
filters: list of integers, the filters of 3 conv layer at main path
stage: integer, current stage label, used for generating l... | [
"The",
"identity",
"block",
"is",
"the",
"block",
"that",
"has",
"no",
"conv",
"layer",
"at",
"shortcut",
".",
"#",
"Arguments",
"kernel_size",
":",
"default",
"3",
"the",
"kernel",
"size",
"of",
"middle",
"conv",
"layer",
"at",
"main",
"path",
"filters",
... | def basic_identity_block(filters, stage, block):
"""The identity block is the block that has no conv layer at shortcut.
# Arguments
kernel_size: default 3, the kernel size of
middle conv layer at main path
filters: list of integers, the filters of 3 conv layer at main path
st... | [
"def",
"basic_identity_block",
"(",
"filters",
",",
"stage",
",",
"block",
")",
":",
"def",
"layer",
"(",
"input_tensor",
")",
":",
"conv_params",
"=",
"get_conv_params",
"(",
")",
"bn_params",
"=",
"get_bn_params",
"(",
")",
"conv_name",
",",
"bn_name",
","... | https://github.com/ybabakhin/kaggle_salt_bes_phalanx/blob/2f81d4dd8d50a01579e5f7650259dde92c5c3b8d/bes/segmentation_models/backbones/classification_models/classification_models/resnet/blocks.py#L20-L50 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/urllib/request.py | python | URLopener.http_error_default | (self, url, fp, errcode, errmsg, headers) | Default error handler: close the connection and raise OSError. | Default error handler: close the connection and raise OSError. | [
"Default",
"error",
"handler",
":",
"close",
"the",
"connection",
"and",
"raise",
"OSError",
"."
] | def http_error_default(self, url, fp, errcode, errmsg, headers):
"""Default error handler: close the connection and raise OSError."""
fp.close()
raise HTTPError(url, errcode, errmsg, headers, None) | [
"def",
"http_error_default",
"(",
"self",
",",
"url",
",",
"fp",
",",
"errcode",
",",
"errmsg",
",",
"headers",
")",
":",
"fp",
".",
"close",
"(",
")",
"raise",
"HTTPError",
"(",
"url",
",",
"errcode",
",",
"errmsg",
",",
"headers",
",",
"None",
")"
... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/urllib/request.py#L1986-L1989 | ||
hmarr/django-mumblr | 36f6e4b0d5d5f999591987b24765915edce92400 | mumblr/views/admin.py | python | edit_entry | (request, entry_id) | return render_to_response(_lookup_template('add_entry'), context,
context_instance=RequestContext(request)) | Edit an existing entry. | Edit an existing entry. | [
"Edit",
"an",
"existing",
"entry",
"."
] | def edit_entry(request, entry_id):
"""Edit an existing entry.
"""
entry = EntryType.objects.with_id(entry_id)
if not entry:
return HttpResponseRedirect(reverse('admin'))
# Select correct form for entry type
form_class = entry.AdminForm
if request.method == 'POST':
form = fo... | [
"def",
"edit_entry",
"(",
"request",
",",
"entry_id",
")",
":",
"entry",
"=",
"EntryType",
".",
"objects",
".",
"with_id",
"(",
"entry_id",
")",
"if",
"not",
"entry",
":",
"return",
"HttpResponseRedirect",
"(",
"reverse",
"(",
"'admin'",
")",
")",
"# Selec... | https://github.com/hmarr/django-mumblr/blob/36f6e4b0d5d5f999591987b24765915edce92400/mumblr/views/admin.py#L39-L90 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/site-packages/lxml/html/__init__.py | python | tostring | (doc, pretty_print=False, include_meta_content_type=False,
encoding=None, method="html", with_tail=True, doctype=None) | return html | Return an HTML string representation of the document.
Note: if include_meta_content_type is true this will create a
``<meta http-equiv="Content-Type" ...>`` tag in the head;
regardless of the value of include_meta_content_type any existing
``<meta http-equiv="Content-Type" ...>`` tag will be removed
... | Return an HTML string representation of the document. | [
"Return",
"an",
"HTML",
"string",
"representation",
"of",
"the",
"document",
"."
] | def tostring(doc, pretty_print=False, include_meta_content_type=False,
encoding=None, method="html", with_tail=True, doctype=None):
"""Return an HTML string representation of the document.
Note: if include_meta_content_type is true this will create a
``<meta http-equiv="Content-Type" ...>`` ta... | [
"def",
"tostring",
"(",
"doc",
",",
"pretty_print",
"=",
"False",
",",
"include_meta_content_type",
"=",
"False",
",",
"encoding",
"=",
"None",
",",
"method",
"=",
"\"html\"",
",",
"with_tail",
"=",
"True",
",",
"doctype",
"=",
"None",
")",
":",
"html",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/site-packages/lxml/html/__init__.py#L1524-L1595 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/cryptography/hazmat/primitives/asymmetric/rsa.py | python | RSAPublicNumbers.__ne__ | (self, other) | return not self == other | [] | def __ne__(self, other):
return not self == other | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"self",
"==",
"other"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/cryptography/hazmat/primitives/asymmetric/rsa.py#L364-L365 | |||
fossasia/x-mario-center | fe67afe28d995dcf4e2498e305825a4859566172 | apt-xapian-index-plugin/origin.py | python | OriginPlugin.init | (self, info, progress) | If needed, perform long initialisation tasks here.
info is a dictionary with useful information. Currently it contains
the following values:
"values": a dict mapping index mnemonics to index numbers
The progress indicator can be used to report progress. | If needed, perform long initialisation tasks here. | [
"If",
"needed",
"perform",
"long",
"initialisation",
"tasks",
"here",
"."
] | def init(self, info, progress):
"""
If needed, perform long initialisation tasks here.
info is a dictionary with useful information. Currently it contains
the following values:
"values": a dict mapping index mnemonics to index numbers
The progress indicator can be u... | [
"def",
"init",
"(",
"self",
",",
"info",
",",
"progress",
")",
":",
"pass"
] | https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/apt-xapian-index-plugin/origin.py#L32-L43 | ||
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/lfads/utils.py | python | list_t_bxn_to_list_b_txn | (values_t_bxn) | return values_b_txn | Convert a length T list of BxN numpy tensors of length B list of TxN numpy
tensors.
Args:
values_t_bxn: The length T list of BxN numpy tensors.
Returns:
The length B list of TxN numpy tensors. | Convert a length T list of BxN numpy tensors of length B list of TxN numpy
tensors. | [
"Convert",
"a",
"length",
"T",
"list",
"of",
"BxN",
"numpy",
"tensors",
"of",
"length",
"B",
"list",
"of",
"TxN",
"numpy",
"tensors",
"."
] | def list_t_bxn_to_list_b_txn(values_t_bxn):
"""Convert a length T list of BxN numpy tensors of length B list of TxN numpy
tensors.
Args:
values_t_bxn: The length T list of BxN numpy tensors.
Returns:
The length B list of TxN numpy tensors.
"""
T = len(values_t_bxn)
B, N = values_t_bxn[0].shape
... | [
"def",
"list_t_bxn_to_list_b_txn",
"(",
"values_t_bxn",
")",
":",
"T",
"=",
"len",
"(",
"values_t_bxn",
")",
"B",
",",
"N",
"=",
"values_t_bxn",
"[",
"0",
"]",
".",
"shape",
"values_b_txn",
"=",
"[",
"]",
"for",
"b",
"in",
"range",
"(",
"B",
")",
":"... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/lfads/utils.py#L278-L297 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | openedx/core/djangolib/markup.py | python | clean_dangerous_html | (html) | return HTML(html) | Mark a string as already HTML and remove unsafe tags, so that it won't be escaped before output.
Usage:
<%page expression_filter="h"/>
<%!
from openedx.core.djangolib.markup import clean_dangerous_html
%>
${course_details.overview | n, clean_dangerous_html} | Mark a string as already HTML and remove unsafe tags, so that it won't be escaped before output.
Usage:
<%page expression_filter="h"/>
<%!
from openedx.core.djangolib.markup import clean_dangerous_html
%>
${course_details.overview | n, clean_dangerous_html} | [
"Mark",
"a",
"string",
"as",
"already",
"HTML",
"and",
"remove",
"unsafe",
"tags",
"so",
"that",
"it",
"won",
"t",
"be",
"escaped",
"before",
"output",
".",
"Usage",
":",
"<%page",
"expression_filter",
"=",
"h",
"/",
">",
"<%!",
"from",
"openedx",
".",
... | def clean_dangerous_html(html):
"""
Mark a string as already HTML and remove unsafe tags, so that it won't be escaped before output.
Usage:
<%page expression_filter="h"/>
<%!
from openedx.core.djangolib.markup import clean_dangerous_html
%>
${course_details.overvi... | [
"def",
"clean_dangerous_html",
"(",
"html",
")",
":",
"if",
"not",
"html",
":",
"return",
"html",
"cleaner",
"=",
"Cleaner",
"(",
"style",
"=",
"True",
",",
"inline_style",
"=",
"False",
",",
"safe_attrs_only",
"=",
"False",
")",
"html",
"=",
"cleaner",
... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangolib/markup.py#L61-L75 | |
ayoolaolafenwa/PixelLib | ae56003c416a98780141a1170c9d888fe9a31317 | pixellib/torchbackend/instance/utils/events.py | python | EventStorage.put_scalars | (self, *, smoothing_hint=True, **kwargs) | Put multiple scalars from keyword arguments.
Examples:
storage.put_scalars(loss=my_loss, accuracy=my_accuracy, smoothing_hint=True) | Put multiple scalars from keyword arguments. | [
"Put",
"multiple",
"scalars",
"from",
"keyword",
"arguments",
"."
] | def put_scalars(self, *, smoothing_hint=True, **kwargs):
"""
Put multiple scalars from keyword arguments.
Examples:
storage.put_scalars(loss=my_loss, accuracy=my_accuracy, smoothing_hint=True)
"""
for k, v in kwargs.items():
self.put_scalar(k, v, smoothi... | [
"def",
"put_scalars",
"(",
"self",
",",
"*",
",",
"smoothing_hint",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"self",
".",
"put_scalar",
"(",
"k",
",",
"v",
",",
"smoothing_... | https://github.com/ayoolaolafenwa/PixelLib/blob/ae56003c416a98780141a1170c9d888fe9a31317/pixellib/torchbackend/instance/utils/events.py#L336-L345 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/vcs/bazaar.py | python | Bazaar.get_revision | (self, location) | return revision.splitlines()[-1] | [] | def get_revision(self, location):
revision = self.run_command(
['revno'], show_stdout=False, cwd=location)
return revision.splitlines()[-1] | [
"def",
"get_revision",
"(",
"self",
",",
"location",
")",
":",
"revision",
"=",
"self",
".",
"run_command",
"(",
"[",
"'revno'",
"]",
",",
"show_stdout",
"=",
"False",
",",
"cwd",
"=",
"location",
")",
"return",
"revision",
".",
"splitlines",
"(",
")",
... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/vcs/bazaar.py#L96-L99 | |||
vlachoudis/bCNC | 67126b4894dabf6579baf47af8d0f9b7de35e6e3 | bCNC/lib/tkExtra.py | python | SearchListbox.__init__ | (self, master, **kw) | [] | def __init__(self, master, **kw):
ExListbox.__init__(self, master, **kw)
self.prefixSearch = False
self._items = []
self._pos = [] | [
"def",
"__init__",
"(",
"self",
",",
"master",
",",
"*",
"*",
"kw",
")",
":",
"ExListbox",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"*",
"*",
"kw",
")",
"self",
".",
"prefixSearch",
"=",
"False",
"self",
".",
"_items",
"=",
"[",
"]",
"se... | https://github.com/vlachoudis/bCNC/blob/67126b4894dabf6579baf47af8d0f9b7de35e6e3/bCNC/lib/tkExtra.py#L1147-L1151 | ||||
b2wdigital/aiologger | bb0b7ca06082520d6fe59e71882ab3cb30e6ccfe | src-archived/aiologger/filters.py | python | Filterer.filter | (self, record: LogRecord) | return True | Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto
this and the record is then dropped. Returns a zero value if a record
is to be dropped, else non-zero. | Determine if a record is loggable by consulting all the filters. | [
"Determine",
"if",
"a",
"record",
"is",
"loggable",
"by",
"consulting",
"all",
"the",
"filters",
"."
] | def filter(self, record: LogRecord) -> bool:
"""
Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto
this and the record is then dropped. Returns a zero value if a record
is to be dropped, else non... | [
"def",
"filter",
"(",
"self",
",",
"record",
":",
"LogRecord",
")",
"->",
"bool",
":",
"for",
"filter",
"in",
"self",
".",
"filters",
":",
"result",
"=",
"filter",
"(",
"record",
")",
"if",
"not",
"result",
":",
"return",
"False",
"return",
"True"
] | https://github.com/b2wdigital/aiologger/blob/bb0b7ca06082520d6fe59e71882ab3cb30e6ccfe/src-archived/aiologger/filters.py#L79-L91 | |
eegsynth/eegsynth | bb2b88be4c5758e23c3c12d0ac34c5b98896df3b | lib/EEGsynth.py | python | butter_bandpass_filter | (dat, lowcut, highcut, fs, order=9) | return y | This filter does not retain state and is not optimal for online filtering. | This filter does not retain state and is not optimal for online filtering. | [
"This",
"filter",
"does",
"not",
"retain",
"state",
"and",
"is",
"not",
"optimal",
"for",
"online",
"filtering",
"."
] | def butter_bandpass_filter(dat, lowcut, highcut, fs, order=9):
'''
This filter does not retain state and is not optimal for online filtering.
'''
b, a = butter_bandpass(lowcut, highcut, fs, order=order)
y = lfilter(b, a, dat)
return y | [
"def",
"butter_bandpass_filter",
"(",
"dat",
",",
"lowcut",
",",
"highcut",
",",
"fs",
",",
"order",
"=",
"9",
")",
":",
"b",
",",
"a",
"=",
"butter_bandpass",
"(",
"lowcut",
",",
"highcut",
",",
"fs",
",",
"order",
"=",
"order",
")",
"y",
"=",
"lf... | https://github.com/eegsynth/eegsynth/blob/bb2b88be4c5758e23c3c12d0ac34c5b98896df3b/lib/EEGsynth.py#L657-L663 | |
MongoEngine/flask-mongoengine | 8cd926c29b88b8ca0489d99693864be4546f6091 | flask_mongoengine/pagination.py | python | Pagination.iter_pages | (self, left_edge=2, left_current=2, right_current=5, right_edge=2) | Iterates over the page numbers in the pagination. The four
parameters control the thresholds how many numbers should be produced
from the sides. Skipped page numbers are represented as `None`.
This is how you could render such a pagination in the templates:
.. sourcecode:: html+jinja
... | Iterates over the page numbers in the pagination. The four
parameters control the thresholds how many numbers should be produced
from the sides. Skipped page numbers are represented as `None`.
This is how you could render such a pagination in the templates: | [
"Iterates",
"over",
"the",
"page",
"numbers",
"in",
"the",
"pagination",
".",
"The",
"four",
"parameters",
"control",
"the",
"thresholds",
"how",
"many",
"numbers",
"should",
"be",
"produced",
"from",
"the",
"sides",
".",
"Skipped",
"page",
"numbers",
"are",
... | def iter_pages(self, left_edge=2, left_current=2, right_current=5, right_edge=2):
"""Iterates over the page numbers in the pagination. The four
parameters control the thresholds how many numbers should be produced
from the sides. Skipped page numbers are represented as `None`.
This is ... | [
"def",
"iter_pages",
"(",
"self",
",",
"left_edge",
"=",
"2",
",",
"left_current",
"=",
"2",
",",
"right_current",
"=",
"5",
",",
"right_edge",
"=",
"2",
")",
":",
"last",
"=",
"0",
"for",
"num",
"in",
"range",
"(",
"1",
",",
"self",
".",
"pages",
... | https://github.com/MongoEngine/flask-mongoengine/blob/8cd926c29b88b8ca0489d99693864be4546f6091/flask_mongoengine/pagination.py#L80-L118 | ||
anchore/anchore-engine | bb18b70e0cbcad58beb44cd439d00067d8f7ea8b | anchore_engine/util/docker.py | python | parse_dockerimage_string | (instr, strict=True) | return ret | Parses a string you'd give 'docker pull' into its consitutent parts: registry, repository, tag and/or digest.
Returns a dict with keys:
host - hostname for registry
port - port for registry
repo - repository name and user/namespace if present
tag - tag value
registry - registry full string incl... | Parses a string you'd give 'docker pull' into its consitutent parts: registry, repository, tag and/or digest.
Returns a dict with keys: | [
"Parses",
"a",
"string",
"you",
"d",
"give",
"docker",
"pull",
"into",
"its",
"consitutent",
"parts",
":",
"registry",
"repository",
"tag",
"and",
"/",
"or",
"digest",
".",
"Returns",
"a",
"dict",
"with",
"keys",
":"
] | def parse_dockerimage_string(instr, strict=True):
"""
Parses a string you'd give 'docker pull' into its consitutent parts: registry, repository, tag and/or digest.
Returns a dict with keys:
host - hostname for registry
port - port for registry
repo - repository name and user/namespace if presen... | [
"def",
"parse_dockerimage_string",
"(",
"instr",
",",
"strict",
"=",
"True",
")",
":",
"host",
"=",
"None",
"port",
"=",
"None",
"repo",
"=",
"None",
"tag",
"=",
"None",
"registry",
"=",
"None",
"repotag",
"=",
"None",
"fulltag",
"=",
"None",
"fulldigest... | https://github.com/anchore/anchore-engine/blob/bb18b70e0cbcad58beb44cd439d00067d8f7ea8b/anchore_engine/util/docker.py#L12-L153 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/string.py | python | expandtabs | (s, tabsize=8) | return s.expandtabs(tabsize) | expandtabs(s [,tabsize]) -> string
Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current
column, and the tabsize (default 8). | expandtabs(s [,tabsize]) -> string | [
"expandtabs",
"(",
"s",
"[",
"tabsize",
"]",
")",
"-",
">",
"string"
] | def expandtabs(s, tabsize=8):
"""expandtabs(s [,tabsize]) -> string
Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current
column, and the tabsize (default 8).
"""
return s.expandtabs(tabsize) | [
"def",
"expandtabs",
"(",
"s",
",",
"tabsize",
"=",
"8",
")",
":",
"return",
"s",
".",
"expandtabs",
"(",
"tabsize",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/string.py#L471-L479 | |
google-research/mixmatch | 1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e | libml/data.py | python | default_parse | (dataset: tf.data.Dataset, parse_fn=record_parse) | return dataset.map(parse_fn, num_parallel_calls=para) | [] | def default_parse(dataset: tf.data.Dataset, parse_fn=record_parse) -> tf.data.Dataset:
para = 4 * max(1, len(utils.get_available_gpus())) * FLAGS.para_parse
return dataset.map(parse_fn, num_parallel_calls=para) | [
"def",
"default_parse",
"(",
"dataset",
":",
"tf",
".",
"data",
".",
"Dataset",
",",
"parse_fn",
"=",
"record_parse",
")",
"->",
"tf",
".",
"data",
".",
"Dataset",
":",
"para",
"=",
"4",
"*",
"max",
"(",
"1",
",",
"len",
"(",
"utils",
".",
"get_ava... | https://github.com/google-research/mixmatch/blob/1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e/libml/data.py#L50-L52 | |||
junsukchoe/ADL | dab2e78163bd96970ec9ae41de62835332dbf4fe | tensorpack/models/utils.py | python | VariableHolder.__init__ | (self, **kwargs) | Args:
kwargs: {name:variable} | Args:
kwargs: {name:variable} | [
"Args",
":",
"kwargs",
":",
"{",
"name",
":",
"variable",
"}"
] | def __init__(self, **kwargs):
"""
Args:
kwargs: {name:variable}
"""
self._vars = {}
for k, v in six.iteritems(kwargs):
self._add_variable(k, v) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_vars",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"kwargs",
")",
":",
"self",
".",
"_add_variable",
"(",
"k",
",",
"v",
")"
] | https://github.com/junsukchoe/ADL/blob/dab2e78163bd96970ec9ae41de62835332dbf4fe/tensorpack/models/utils.py#L9-L16 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/email/_header_value_parser.py | python | NameAddr.route | (self) | return self[-1].route | [] | def route(self):
return self[-1].route | [
"def",
"route",
"(",
"self",
")",
":",
"return",
"self",
"[",
"-",
"1",
"]",
".",
"route"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/email/_header_value_parser.py#L404-L405 | |||
facebookresearch/mmf | fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f | mmf/common/report.py | python | Report.__setattr__ | (self, key: str, value: Any) | [] | def __setattr__(self, key: str, value: Any):
self[key] = value | [
"def",
"__setattr__",
"(",
"self",
",",
"key",
":",
"str",
",",
"value",
":",
"Any",
")",
":",
"self",
"[",
"key",
"]",
"=",
"value"
] | https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/common/report.py#L72-L73 | ||||
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | py2.7/multiprocess/__init__.py | python | RawValue | (typecode_or_type, *args) | return RawValue(typecode_or_type, *args) | Returns a shared object | Returns a shared object | [
"Returns",
"a",
"shared",
"object"
] | def RawValue(typecode_or_type, *args):
'''
Returns a shared object
'''
from multiprocess.sharedctypes import RawValue
return RawValue(typecode_or_type, *args) | [
"def",
"RawValue",
"(",
"typecode_or_type",
",",
"*",
"args",
")",
":",
"from",
"multiprocess",
".",
"sharedctypes",
"import",
"RawValue",
"return",
"RawValue",
"(",
"typecode_or_type",
",",
"*",
"args",
")"
] | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py2.7/multiprocess/__init__.py#L237-L242 | |
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | examples/ltl.py | python | walk_ltl_g | (self, formula, args, **kwargs) | return self.mgr.G(args[0]) | [] | def walk_ltl_g(self, formula, args, **kwargs): return self.mgr.G(args[0]) | [
"def",
"walk_ltl_g",
"(",
"self",
",",
"formula",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"mgr",
".",
"G",
"(",
"args",
"[",
"0",
"]",
")"
] | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/examples/ltl.py#L131-L131 | |||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backends/backend_pdf.py | python | Stream.__init__ | (self, id, len, file, extra=None, png=None) | id: object id of stream; len: an unused Reference object for the
length of the stream, or None (to use a memory buffer); file:
a PdfFile; extra: a dictionary of extra key-value pairs to
include in the stream header; png: if the data is already
png compressed, the decode parameters | id: object id of stream; len: an unused Reference object for the
length of the stream, or None (to use a memory buffer); file:
a PdfFile; extra: a dictionary of extra key-value pairs to
include in the stream header; png: if the data is already
png compressed, the decode parameters | [
"id",
":",
"object",
"id",
"of",
"stream",
";",
"len",
":",
"an",
"unused",
"Reference",
"object",
"for",
"the",
"length",
"of",
"the",
"stream",
"or",
"None",
"(",
"to",
"use",
"a",
"memory",
"buffer",
")",
";",
"file",
":",
"a",
"PdfFile",
";",
"... | def __init__(self, id, len, file, extra=None, png=None):
"""id: object id of stream; len: an unused Reference object for the
length of the stream, or None (to use a memory buffer); file:
a PdfFile; extra: a dictionary of extra key-value pairs to
include in the stream header; png: if the ... | [
"def",
"__init__",
"(",
"self",
",",
"id",
",",
"len",
",",
"file",
",",
"extra",
"=",
"None",
",",
"png",
"=",
"None",
")",
":",
"self",
".",
"id",
"=",
"id",
"# object id",
"self",
".",
"len",
"=",
"len",
"# id of length object",
"self",
".",
"pd... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backends/backend_pdf.py#L351-L377 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/cryptography/x509/base.py | python | CertificateSigningRequestBuilder.__init__ | (self, subject_name=None, extensions=[]) | Creates an empty X.509 certificate request (v1). | Creates an empty X.509 certificate request (v1). | [
"Creates",
"an",
"empty",
"X",
".",
"509",
"certificate",
"request",
"(",
"v1",
")",
"."
] | def __init__(self, subject_name=None, extensions=[]):
"""
Creates an empty X.509 certificate request (v1).
"""
self._subject_name = subject_name
self._extensions = extensions | [
"def",
"__init__",
"(",
"self",
",",
"subject_name",
"=",
"None",
",",
"extensions",
"=",
"[",
"]",
")",
":",
"self",
".",
"_subject_name",
"=",
"subject_name",
"self",
".",
"_extensions",
"=",
"extensions"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/cryptography/x509/base.py#L366-L371 | ||
tanghaibao/goatools | 647e9dd833695f688cd16c2f9ea18f1692e5c6bc | goatools/parsers/david_chart.py | python | _Init._init_nt | (self, flds) | return self.ntobj(
Category = flds[0],
GO = term[:10], # 1 GO:0045202~synapse
name = term[10:], # 1 GO:0045202~synapse
Count = int(flds[2]), # 2 94
Perc = float(flds[3]), # 3 9.456740442655935
... | Given string fields from a DAVID chart file, return namedtuple. | Given string fields from a DAVID chart file, return namedtuple. | [
"Given",
"string",
"fields",
"from",
"a",
"DAVID",
"chart",
"file",
"return",
"namedtuple",
"."
] | def _init_nt(self, flds):
"""Given string fields from a DAVID chart file, return namedtuple."""
term = flds[1]
genes_str = flds[5]
# pylint: disable=bad-whitespace
return self.ntobj(
Category = flds[0],
GO = term[:10], # 1 GO:004520... | [
"def",
"_init_nt",
"(",
"self",
",",
"flds",
")",
":",
"term",
"=",
"flds",
"[",
"1",
"]",
"genes_str",
"=",
"flds",
"[",
"5",
"]",
"# pylint: disable=bad-whitespace",
"return",
"self",
".",
"ntobj",
"(",
"Category",
"=",
"flds",
"[",
"0",
"]",
",",
... | https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/parsers/david_chart.py#L147-L167 | |
pydicom/pydicom | 935de3b4ac94a5f520f3c91b42220ff0f13bce54 | pydicom/encaps.py | python | generate_pixel_data_fragment | (
fp: DicomFileLike
) | Yield the encapsulated pixel data fragments.
For compressed (encapsulated) Transfer Syntaxes, the (7FE0,0010) *Pixel
Data* element is encoded in an encapsulated format.
**Encapsulation**
The encoded pixel data stream is fragmented into one or more Items. The
stream may represent a single or multi... | Yield the encapsulated pixel data fragments. | [
"Yield",
"the",
"encapsulated",
"pixel",
"data",
"fragments",
"."
] | def generate_pixel_data_fragment(
fp: DicomFileLike
) -> Generator[bytes, None, None]:
"""Yield the encapsulated pixel data fragments.
For compressed (encapsulated) Transfer Syntaxes, the (7FE0,0010) *Pixel
Data* element is encoded in an encapsulated format.
**Encapsulation**
The encoded pixe... | [
"def",
"generate_pixel_data_fragment",
"(",
"fp",
":",
"DicomFileLike",
")",
"->",
"Generator",
"[",
"bytes",
",",
"None",
",",
"None",
"]",
":",
"if",
"not",
"fp",
".",
"is_little_endian",
":",
"raise",
"ValueError",
"(",
"\"'fp.is_little_endian' must be True\"",... | https://github.com/pydicom/pydicom/blob/935de3b4ac94a5f520f3c91b42220ff0f13bce54/pydicom/encaps.py#L140-L227 | ||
nosmokingbandit/Watcher3 | 0217e75158b563bdefc8e01c3be7620008cf3977 | lib/sqlalchemy/sql/visitors.py | python | CloningVisitor.traverse | (self, obj) | return cloned_traverse(
obj, self.__traverse_options__, self._visitor_dict) | traverse and visit the given expression structure. | traverse and visit the given expression structure. | [
"traverse",
"and",
"visit",
"the",
"given",
"expression",
"structure",
"."
] | def traverse(self, obj):
"""traverse and visit the given expression structure."""
return cloned_traverse(
obj, self.__traverse_options__, self._visitor_dict) | [
"def",
"traverse",
"(",
"self",
",",
"obj",
")",
":",
"return",
"cloned_traverse",
"(",
"obj",
",",
"self",
".",
"__traverse_options__",
",",
"self",
".",
"_visitor_dict",
")"
] | https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/sqlalchemy/sql/visitors.py#L177-L181 | |
kstaats/karoo_gp | 75a860306a165d1e29f90bb82c50bd1045a13a3c | karoo_gp/base_class.py | python | Base_GP.fx_fitness_eval | (self, expr, data, get_pred_labels = False) | return {'result': result, 'pred_labels': pred_labels, 'solution': solution, 'fitness': float(fitness), 'pairwise_fitness': pairwise_fitness} | Computes tree expression using TensorFlow (TF) returning results and fitness scores.
This method orchestrates most of the TF routines by parsing input string 'expression' and converting it into a TF
operation graph which is then processed in an isolated TF session to compute the results and corresponding fitnes... | Computes tree expression using TensorFlow (TF) returning results and fitness scores.
This method orchestrates most of the TF routines by parsing input string 'expression' and converting it into a TF
operation graph which is then processed in an isolated TF session to compute the results and corresponding fitnes... | [
"Computes",
"tree",
"expression",
"using",
"TensorFlow",
"(",
"TF",
")",
"returning",
"results",
"and",
"fitness",
"scores",
".",
"This",
"method",
"orchestrates",
"most",
"of",
"the",
"TF",
"routines",
"by",
"parsing",
"input",
"string",
"expression",
"and",
... | def fx_fitness_eval(self, expr, data, get_pred_labels = False):
'''
Computes tree expression using TensorFlow (TF) returning results and fitness scores.
This method orchestrates most of the TF routines by parsing input string 'expression' and converting it into a TF
operation graph which is then process... | [
"def",
"fx_fitness_eval",
"(",
"self",
",",
"expr",
",",
"data",
",",
"get_pred_labels",
"=",
"False",
")",
":",
"# Initialize TensorFlow session",
"tf",
".",
"reset_default_graph",
"(",
")",
"# Reset TF internal state and cache (after previous processing)",
"config",
"="... | https://github.com/kstaats/karoo_gp/blob/75a860306a165d1e29f90bb82c50bd1045a13a3c/karoo_gp/base_class.py#L1197-L1324 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.