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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/ihooks.py | python | Hooks.load_package | (self, name, filename, file=None) | return imp.load_module(name, file, filename, ("", "", PKG_DIRECTORY)) | [] | def load_package(self, name, filename, file=None):
return imp.load_module(name, file, filename, ("", "", PKG_DIRECTORY)) | [
"def",
"load_package",
"(",
"self",
",",
"name",
",",
"filename",
",",
"file",
"=",
"None",
")",
":",
"return",
"imp",
".",
"load_module",
"(",
"name",
",",
"file",
",",
"filename",
",",
"(",
"\"\"",
",",
"\"\"",
",",
"PKG_DIRECTORY",
")",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/ihooks.py#L175-L176 | |||
p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch | 135d3e2e06bbde2868047d738e3fc2d73fd8cc93 | environments/Atari_Environment.py | python | wrap_deepmind | (env, episode_life=True, clip_rewards=True, frame_stack=True, scale=True) | return env | Configure environment for DeepMind-style Atari | Configure environment for DeepMind-style Atari | [
"Configure",
"environment",
"for",
"DeepMind",
"-",
"style",
"Atari"
] | def wrap_deepmind(env, episode_life=True, clip_rewards=True, frame_stack=True, scale=True):
"""Configure environment for DeepMind-style Atari """
if episode_life:
env = EpisodicLifeEnv(env)
if 'FIRE' in env.unwrapped.get_action_meanings():
env = FireResetEnv(env)
env = WarpFrame(env)
... | [
"def",
"wrap_deepmind",
"(",
"env",
",",
"episode_life",
"=",
"True",
",",
"clip_rewards",
"=",
"True",
",",
"frame_stack",
"=",
"True",
",",
"scale",
"=",
"True",
")",
":",
"if",
"episode_life",
":",
"env",
"=",
"EpisodicLifeEnv",
"(",
"env",
")",
"if",... | https://github.com/p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch/blob/135d3e2e06bbde2868047d738e3fc2d73fd8cc93/environments/Atari_Environment.py#L15-L28 | |
FSecureLABS/needle | 891b6601262020bb2df98f81f6c0ef2d97ddd82c | needle/core/device/device.py | python | Device.connect | (self) | Connect to the device (both SSH and AGENT). | Connect to the device (both SSH and AGENT). | [
"Connect",
"to",
"the",
"device",
"(",
"both",
"SSH",
"and",
"AGENT",
")",
"."
] | def connect(self):
"""Connect to the device (both SSH and AGENT)."""
# Using USB, setup port forwarding first
if self.is_usb():
self._portforward_usb_start()
self._portforward_agent_start()
# Setup channels
self._connect_agent()
self.ssh = self._co... | [
"def",
"connect",
"(",
"self",
")",
":",
"# Using USB, setup port forwarding first",
"if",
"self",
".",
"is_usb",
"(",
")",
":",
"self",
".",
"_portforward_usb_start",
"(",
")",
"self",
".",
"_portforward_agent_start",
"(",
")",
"# Setup channels",
"self",
".",
... | https://github.com/FSecureLABS/needle/blob/891b6601262020bb2df98f81f6c0ef2d97ddd82c/needle/core/device/device.py#L211-L219 | ||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/rpc/regionservice.py | python | Region.update_lease | (
self,
cluster_uuid,
action,
mac,
ip_family,
ip,
timestamp,
lease_time=None,
hostname=None,
) | return d | update_lease(
cluster_uuid, action, mac, ip_family, ip, timestamp,
lease_time, hostname)
Implementation of
:py:class`~provisioningserver.rpc.region.UpdateLease`. | update_lease(
cluster_uuid, action, mac, ip_family, ip, timestamp,
lease_time, hostname) | [
"update_lease",
"(",
"cluster_uuid",
"action",
"mac",
"ip_family",
"ip",
"timestamp",
"lease_time",
"hostname",
")"
] | def update_lease(
self,
cluster_uuid,
action,
mac,
ip_family,
ip,
timestamp,
lease_time=None,
hostname=None,
):
"""update_lease(
cluster_uuid, action, mac, ip_family, ip, timestamp,
lease_time, hostname)
... | [
"def",
"update_lease",
"(",
"self",
",",
"cluster_uuid",
",",
"action",
",",
"mac",
",",
"ip_family",
",",
"ip",
",",
"timestamp",
",",
"lease_time",
"=",
"None",
",",
"hostname",
"=",
"None",
",",
")",
":",
"dbtasks",
"=",
"eventloop",
".",
"services",
... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/rpc/regionservice.py#L117-L161 | |
hhstore/annotated-py-projects | 4f4eca9a3913a19983cae496279a72699c083a0b | flask/flask-0.5/flask/helpers.py | python | _PackageBoundObject.has_static_folder | (self) | return os.path.isdir(os.path.join(self.root_path, 'static')) | 判断 App 根目录下,是否存在 'static'文件夹, 存在为真. | 判断 App 根目录下,是否存在 'static'文件夹, 存在为真. | [
"判断",
"App",
"根目录下",
"是否存在",
"static",
"文件夹",
"存在为真",
"."
] | def has_static_folder(self):
"""判断 App 根目录下,是否存在 'static'文件夹, 存在为真.
"""
return os.path.isdir(os.path.join(self.root_path, 'static')) | [
"def",
"has_static_folder",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"root_path",
",",
"'static'",
")",
")"
] | https://github.com/hhstore/annotated-py-projects/blob/4f4eca9a3913a19983cae496279a72699c083a0b/flask/flask-0.5/flask/helpers.py#L361-L364 | |
ring04h/wyportmap | c4201e2313504e780a7f25238eba2a2d3223e739 | sqlalchemy/orm/events.py | python | SessionEvents.after_begin | (self, session, transaction, connection) | Execute after a transaction is begun on a connection
:param session: The target :class:`.Session`.
:param transaction: The :class:`.SessionTransaction`.
:param connection: The :class:`~.engine.Connection` object
which will be used for SQL statements.
.. seealso::
... | Execute after a transaction is begun on a connection | [
"Execute",
"after",
"a",
"transaction",
"is",
"begun",
"on",
"a",
"connection"
] | def after_begin(self, session, transaction, connection):
"""Execute after a transaction is begun on a connection
:param session: The target :class:`.Session`.
:param transaction: The :class:`.SessionTransaction`.
:param connection: The :class:`~.engine.Connection` object
which ... | [
"def",
"after_begin",
"(",
"self",
",",
"session",
",",
"transaction",
",",
"connection",
")",
":"
] | https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/sqlalchemy/orm/events.py#L1464-L1482 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/http/multipartparser.py | python | MultiPartParser.IE_sanitize | (self, filename) | return filename and filename[filename.rfind("\\")+1:].strip() | Cleanup filename from Internet Explorer full paths. | Cleanup filename from Internet Explorer full paths. | [
"Cleanup",
"filename",
"from",
"Internet",
"Explorer",
"full",
"paths",
"."
] | def IE_sanitize(self, filename):
"""Cleanup filename from Internet Explorer full paths."""
return filename and filename[filename.rfind("\\")+1:].strip() | [
"def",
"IE_sanitize",
"(",
"self",
",",
"filename",
")",
":",
"return",
"filename",
"and",
"filename",
"[",
"filename",
".",
"rfind",
"(",
"\"\\\\\"",
")",
"+",
"1",
":",
"]",
".",
"strip",
"(",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/http/multipartparser.py#L261-L263 | |
scikit-learn-contrib/DESlib | 64260ae7c6dd745ef0003cc6322c9f829c807708 | deslib/util/aggregation.py | python | average_combiner | (classifier_ensemble, X) | return average_rule(ensemble_proba) | Ensemble combination using the Average rule.
Parameters
----------
classifier_ensemble : list of shape = [n_classifiers]
Containing the ensemble of classifiers used in the aggregation scheme.
X : array of shape (n_samples, n_features)
The input data.
Returns
-------
predic... | Ensemble combination using the Average rule. | [
"Ensemble",
"combination",
"using",
"the",
"Average",
"rule",
"."
] | def average_combiner(classifier_ensemble, X):
"""Ensemble combination using the Average rule.
Parameters
----------
classifier_ensemble : list of shape = [n_classifiers]
Containing the ensemble of classifiers used in the aggregation scheme.
X : array of shape (n_samples, n_features)
... | [
"def",
"average_combiner",
"(",
"classifier_ensemble",
",",
"X",
")",
":",
"ensemble_proba",
"=",
"_get_ensemble_probabilities",
"(",
"classifier_ensemble",
",",
"X",
")",
"return",
"average_rule",
"(",
"ensemble_proba",
")"
] | https://github.com/scikit-learn-contrib/DESlib/blob/64260ae7c6dd745ef0003cc6322c9f829c807708/deslib/util/aggregation.py#L262-L279 | |
graphcore/examples | 46d2b7687b829778369fc6328170a7b14761e5c6 | code_examples/tensorflow/ssd/bounding_box_utils/bounding_box_utils.py | python | convert_coordinates2 | (tensor, start_index, conversion) | return tensor1 | A matrix multiplication implementation of `convert_coordinates()`.
Supports only conversion between the 'centroids' and 'minmax' formats.
This function is marginally slower on average than `convert_coordinates()`,
probably because it involves more (unnecessary) arithmetic operations (unnecessary
becaus... | A matrix multiplication implementation of `convert_coordinates()`.
Supports only conversion between the 'centroids' and 'minmax' formats. | [
"A",
"matrix",
"multiplication",
"implementation",
"of",
"convert_coordinates",
"()",
".",
"Supports",
"only",
"conversion",
"between",
"the",
"centroids",
"and",
"minmax",
"formats",
"."
] | def convert_coordinates2(tensor, start_index, conversion):
"""
A matrix multiplication implementation of `convert_coordinates()`.
Supports only conversion between the 'centroids' and 'minmax' formats.
This function is marginally slower on average than `convert_coordinates()`,
probably because it in... | [
"def",
"convert_coordinates2",
"(",
"tensor",
",",
"start_index",
",",
"conversion",
")",
":",
"ind",
"=",
"start_index",
"tensor1",
"=",
"np",
".",
"copy",
"(",
"tensor",
")",
".",
"astype",
"(",
"np",
".",
"float",
")",
"if",
"conversion",
"==",
"'minm... | https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/code_examples/tensorflow/ssd/bounding_box_utils/bounding_box_utils.py#L92-L120 | |
carnal0wnage/weirdAAL | c14e36d7bb82447f38a43da203f4bc29429f4cf4 | modules/aws/recon.py | python | module_recon_defaults | () | Recon defaults that every account seems to have minus route53_geolocations (static data)
python3 weirdAAL.py -m recon_defaults -t demo | Recon defaults that every account seems to have minus route53_geolocations (static data)
python3 weirdAAL.py -m recon_defaults -t demo | [
"Recon",
"defaults",
"that",
"every",
"account",
"seems",
"to",
"have",
"minus",
"route53_geolocations",
"(",
"static",
"data",
")",
"python3",
"weirdAAL",
".",
"py",
"-",
"m",
"recon_defaults",
"-",
"t",
"demo"
] | def module_recon_defaults():
'''
Recon defaults that every account seems to have minus route53_geolocations (static data)
python3 weirdAAL.py -m recon_defaults -t demo
'''
elasticbeanstalk_describe_applications()
elasticbeanstalk_describe_application_versions()
elasticbeanstalk_describe_envi... | [
"def",
"module_recon_defaults",
"(",
")",
":",
"elasticbeanstalk_describe_applications",
"(",
")",
"elasticbeanstalk_describe_application_versions",
"(",
")",
"elasticbeanstalk_describe_environments",
"(",
")",
"elasticbeanstalk_describe_events",
"(",
")",
"opsworks_describe_stacks... | https://github.com/carnal0wnage/weirdAAL/blob/c14e36d7bb82447f38a43da203f4bc29429f4cf4/modules/aws/recon.py#L252-L263 | ||
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/share/drivers/ganesha/manager.py | python | GaneshaManager.add_export | (self, name, confdict) | Add an export to Ganesha specified by confdict. | Add an export to Ganesha specified by confdict. | [
"Add",
"an",
"export",
"to",
"Ganesha",
"specified",
"by",
"confdict",
"."
] | def add_export(self, name, confdict):
"""Add an export to Ganesha specified by confdict."""
xid = confdict["EXPORT"]["Export_Id"]
undos = []
_mkindex_called = False
try:
path = self._write_export(name, confdict)
if self.ganesha_rados_store_enable:
... | [
"def",
"add_export",
"(",
"self",
",",
"name",
",",
"confdict",
")",
":",
"xid",
"=",
"confdict",
"[",
"\"EXPORT\"",
"]",
"[",
"\"Export_Id\"",
"]",
"undos",
"=",
"[",
"]",
"_mkindex_called",
"=",
"False",
"try",
":",
"path",
"=",
"self",
".",
"_write_... | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/ganesha/manager.py#L459-L490 | ||
rucio/rucio | 6d0d358e04f5431f0b9a98ae40f31af0ddff4833 | lib/rucio/api/rse.py | python | get_rse_protocols | (rse, issuer, vo='def') | return rse_module.get_rse_protocols(rse_id) | Returns all matching protocols (including detailed information) for the given RSE.
:param rse: The RSE name.
:param issuer: The issuer account.
:param vo: The VO to act on.
:returns: A dict with all supported protocols and their attibutes. | Returns all matching protocols (including detailed information) for the given RSE. | [
"Returns",
"all",
"matching",
"protocols",
"(",
"including",
"detailed",
"information",
")",
"for",
"the",
"given",
"RSE",
"."
] | def get_rse_protocols(rse, issuer, vo='def'):
"""
Returns all matching protocols (including detailed information) for the given RSE.
:param rse: The RSE name.
:param issuer: The issuer account.
:param vo: The VO to act on.
:returns: A dict with all supported protocols and their attibutes.
... | [
"def",
"get_rse_protocols",
"(",
"rse",
",",
"issuer",
",",
"vo",
"=",
"'def'",
")",
":",
"rse_id",
"=",
"rse_module",
".",
"get_rse_id",
"(",
"rse",
"=",
"rse",
",",
"vo",
"=",
"vo",
")",
"return",
"rse_module",
".",
"get_rse_protocols",
"(",
"rse_id",
... | https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/api/rse.py#L223-L234 | |
mlflow/mlflow | 364aca7daf0fcee3ec407ae0b1b16d9cb3085081 | mlflow/pytorch/__init__.py | python | save_state_dict | (state_dict, path, **kwargs) | Save a state_dict to a path on the local file system
:param state_dict: state_dict to be saved.
:param path: Local path where the state_dict is to be saved.
:param kwargs: kwargs to pass to ``torch.save``. | Save a state_dict to a path on the local file system | [
"Save",
"a",
"state_dict",
"to",
"a",
"path",
"on",
"the",
"local",
"file",
"system"
] | def save_state_dict(state_dict, path, **kwargs):
"""
Save a state_dict to a path on the local file system
:param state_dict: state_dict to be saved.
:param path: Local path where the state_dict is to be saved.
:param kwargs: kwargs to pass to ``torch.save``.
"""
import torch
# The obje... | [
"def",
"save_state_dict",
"(",
"state_dict",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"torch",
"# The object type check here aims to prevent a scenario where a user accidentally passees",
"# a model instead of a state_dict and `torch.save` (which accepts both model and... | https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/pytorch/__init__.py#L816-L838 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/xmlrpc/server.py | python | list_public_methods | (obj) | return [member for member in dir(obj)
if not member.startswith('_') and
callable(getattr(obj, member))] | Returns a list of attribute strings, found in the specified
object, which represent callable attributes | Returns a list of attribute strings, found in the specified
object, which represent callable attributes | [
"Returns",
"a",
"list",
"of",
"attribute",
"strings",
"found",
"in",
"the",
"specified",
"object",
"which",
"represent",
"callable",
"attributes"
] | def list_public_methods(obj):
"""Returns a list of attribute strings, found in the specified
object, which represent callable attributes"""
return [member for member in dir(obj)
if not member.startswith('_') and
callable(getattr(obj, member))] | [
"def",
"list_public_methods",
"(",
"obj",
")",
":",
"return",
"[",
"member",
"for",
"member",
"in",
"dir",
"(",
"obj",
")",
"if",
"not",
"member",
".",
"startswith",
"(",
"'_'",
")",
"and",
"callable",
"(",
"getattr",
"(",
"obj",
",",
"member",
")",
... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/xmlrpc/server.py#L146-L152 | |
bikalims/bika.lims | 35e4bbdb5a3912cae0b5eb13e51097c8b0486349 | bika/lims/browser/sample/partitions.py | python | SamplePartitionsView.__call__ | (self) | return super(SamplePartitionsView, self).__call__() | [] | def __call__(self):
mtool = getToolByName(self.context, 'portal_membership')
checkPermission = mtool.checkPermission
if self.context.portal_type == 'AnalysisRequest':
self.sample = self.context.getSample()
else:
self.sample = self.context
if checkPermissio... | [
"def",
"__call__",
"(",
"self",
")",
":",
"mtool",
"=",
"getToolByName",
"(",
"self",
".",
"context",
",",
"'portal_membership'",
")",
"checkPermission",
"=",
"mtool",
".",
"checkPermission",
"if",
"self",
".",
"context",
".",
"portal_type",
"==",
"'AnalysisRe... | https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/browser/sample/partitions.py#L93-L105 | |||
facebook/FAI-PEP | 632918e8b4025044b67eb24aff57027e84836995 | ailab/file_storage/views.py | python | upload | (request) | return JsonResponse(res) | [] | def upload(request):
# Handle file upload
if request.method == "POST" and "file" in request.FILES:
file = request.FILES["file"]
model_file = ModelFile(name=str(file), file=file)
model_file.save()
# Redirect to the document list after POST
res = {
"status": "... | [
"def",
"upload",
"(",
"request",
")",
":",
"# Handle file upload",
"if",
"request",
".",
"method",
"==",
"\"POST\"",
"and",
"\"file\"",
"in",
"request",
".",
"FILES",
":",
"file",
"=",
"request",
".",
"FILES",
"[",
"\"file\"",
"]",
"model_file",
"=",
"Mode... | https://github.com/facebook/FAI-PEP/blob/632918e8b4025044b67eb24aff57027e84836995/ailab/file_storage/views.py#L11-L27 | |||
flaskbb/flaskbb | de13a37fcb713b9c627632210ab9a7bb980d591f | flaskbb/cli/translations.py | python | compile_translation | (is_all, plugin) | Compiles the translations. | Compiles the translations. | [
"Compiles",
"the",
"translations",
"."
] | def compile_translation(is_all, plugin):
"""Compiles the translations."""
if plugin is not None:
validate_plugin(plugin)
click.secho("[+] Compiling language files for plugin {}..."
.format(plugin), fg="cyan")
compile_plugin_translations(plugin)
else:
click... | [
"def",
"compile_translation",
"(",
"is_all",
",",
"plugin",
")",
":",
"if",
"plugin",
"is",
"not",
"None",
":",
"validate_plugin",
"(",
"plugin",
")",
"click",
".",
"secho",
"(",
"\"[+] Compiling language files for plugin {}...\"",
".",
"format",
"(",
"plugin",
... | https://github.com/flaskbb/flaskbb/blob/de13a37fcb713b9c627632210ab9a7bb980d591f/flaskbb/cli/translations.py#L67-L76 | ||
graphbrain/graphbrain | 96cb902d9e22d8dc8c2110ff3176b9aafdeba444 | graphbrain/patterns.py | python | PatternCounter.count | (self, edge) | [] | def count(self, edge):
if not edge.is_atom():
if self._matches_expansions(edge):
for pattern in self._edge2patterns(edge):
self.patterns[hedge(pattern)] += 1
if self.count_subedges:
for subedge in edge:
self.count(su... | [
"def",
"count",
"(",
"self",
",",
"edge",
")",
":",
"if",
"not",
"edge",
".",
"is_atom",
"(",
")",
":",
"if",
"self",
".",
"_matches_expansions",
"(",
"edge",
")",
":",
"for",
"pattern",
"in",
"self",
".",
"_edge2patterns",
"(",
"edge",
")",
":",
"... | https://github.com/graphbrain/graphbrain/blob/96cb902d9e22d8dc8c2110ff3176b9aafdeba444/graphbrain/patterns.py#L118-L125 | ||||
uccser/cs-unplugged | f83593f872792e71a9fab3f2d77a0f489205926b | csunplugged/config/views.py | python | get_release_and_commit | (request) | return JsonResponse({
"VERSION_NUMBER": __version__,
"GIT_SHA": settings.GIT_SHA,
}) | Return JSON containing the version number and Git commit hash. | Return JSON containing the version number and Git commit hash. | [
"Return",
"JSON",
"containing",
"the",
"version",
"number",
"and",
"Git",
"commit",
"hash",
"."
] | def get_release_and_commit(request):
"""Return JSON containing the version number and Git commit hash."""
return JsonResponse({
"VERSION_NUMBER": __version__,
"GIT_SHA": settings.GIT_SHA,
}) | [
"def",
"get_release_and_commit",
"(",
"request",
")",
":",
"return",
"JsonResponse",
"(",
"{",
"\"VERSION_NUMBER\"",
":",
"__version__",
",",
"\"GIT_SHA\"",
":",
"settings",
".",
"GIT_SHA",
",",
"}",
")"
] | https://github.com/uccser/cs-unplugged/blob/f83593f872792e71a9fab3f2d77a0f489205926b/csunplugged/config/views.py#L11-L16 | |
elastic/elasticsearch-py | 6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb | elasticsearch/_sync/client/security.py | python | SecurityClient.invalidate_token | (
self,
*,
error_trace: Optional[bool] = None,
filter_path: Optional[Union[List[str], str]] = None,
human: Optional[bool] = None,
pretty: Optional[bool] = None,
realm_name: Optional[Any] = None,
refresh_token: Optional[str] = None,
token: Optional[... | return self._perform_request("DELETE", __target, headers=__headers, body=__body) | Invalidates one or more access tokens or refresh tokens.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html>`_
:param realm_name:
:param refresh_token:
:param token:
:param username: | Invalidates one or more access tokens or refresh tokens. | [
"Invalidates",
"one",
"or",
"more",
"access",
"tokens",
"or",
"refresh",
"tokens",
"."
] | def invalidate_token(
self,
*,
error_trace: Optional[bool] = None,
filter_path: Optional[Union[List[str], str]] = None,
human: Optional[bool] = None,
pretty: Optional[bool] = None,
realm_name: Optional[Any] = None,
refresh_token: Optional[str] = None,
... | [
"def",
"invalidate_token",
"(",
"self",
",",
"*",
",",
"error_trace",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
",",
"filter_path",
":",
"Optional",
"[",
"Union",
"[",
"List",
"[",
"str",
"]",
",",
"str",
"]",
"]",
"=",
"None",
",",
"human",
... | https://github.com/elastic/elasticsearch-py/blob/6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb/elasticsearch/_sync/client/security.py#L1347-L1393 | |
ring04h/weakfilescan | b1a3066e3fdcd60b8ecf635526f49cb5ad603064 | libs/requests/models.py | python | RequestEncodingMixin.path_url | (self) | return ''.join(url) | Build the path URL to use. | Build the path URL to use. | [
"Build",
"the",
"path",
"URL",
"to",
"use",
"."
] | def path_url(self):
"""Build the path URL to use."""
url = []
p = urlsplit(self.url)
path = p.path
if not path:
path = '/'
url.append(path)
query = p.query
if query:
url.append('?')
url.append(query)
return... | [
"def",
"path_url",
"(",
"self",
")",
":",
"url",
"=",
"[",
"]",
"p",
"=",
"urlsplit",
"(",
"self",
".",
"url",
")",
"path",
"=",
"p",
".",
"path",
"if",
"not",
"path",
":",
"path",
"=",
"'/'",
"url",
".",
"append",
"(",
"path",
")",
"query",
... | https://github.com/ring04h/weakfilescan/blob/b1a3066e3fdcd60b8ecf635526f49cb5ad603064/libs/requests/models.py#L54-L72 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/_backport/tarfile.py | python | TarFile.bz2open | (cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs) | return t | Open bzip2 compressed tar archive name for reading or writing.
Appending is not allowed. | Open bzip2 compressed tar archive name for reading or writing.
Appending is not allowed. | [
"Open",
"bzip2",
"compressed",
"tar",
"archive",
"name",
"for",
"reading",
"or",
"writing",
".",
"Appending",
"is",
"not",
"allowed",
"."
] | def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
"""Open bzip2 compressed tar archive name for reading or writing.
Appending is not allowed.
"""
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'.")
try:
... | [
"def",
"bz2open",
"(",
"cls",
",",
"name",
",",
"mode",
"=",
"\"r\"",
",",
"fileobj",
"=",
"None",
",",
"compresslevel",
"=",
"9",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"mode",
")",
">",
"1",
"or",
"mode",
"not",
"in",
"\"rw\"",
... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/_backport/tarfile.py#L1829-L1852 | |
williballenthin/python-registry | 11e857623469dd28ed14519a08d2db7c8228ca0c | Registry/Registry.py | python | Registry.hive_name | (self) | return self._regf.hive_name() | Returns the internal file name | Returns the internal file name | [
"Returns",
"the",
"internal",
"file",
"name"
] | def hive_name(self):
"""Returns the internal file name"""
return self._regf.hive_name() | [
"def",
"hive_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_regf",
".",
"hive_name",
"(",
")"
] | https://github.com/williballenthin/python-registry/blob/11e857623469dd28ed14519a08d2db7c8228ca0c/Registry/Registry.py#L401-L403 | |
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/threading.py | python | Barrier.reset | (self) | Reset the barrier to the initial state.
Any threads currently waiting will get the BrokenBarrier exception
raised. | Reset the barrier to the initial state. | [
"Reset",
"the",
"barrier",
"to",
"the",
"initial",
"state",
"."
] | def reset(self):
"""Reset the barrier to the initial state.
Any threads currently waiting will get the BrokenBarrier exception
raised.
"""
with self._cond:
if self._count > 0:
if self._state == 0:
#reset the barrier, waking up thr... | [
"def",
"reset",
"(",
"self",
")",
":",
"with",
"self",
".",
"_cond",
":",
"if",
"self",
".",
"_count",
">",
"0",
":",
"if",
"self",
".",
"_state",
"==",
"0",
":",
"#reset the barrier, waking up threads",
"self",
".",
"_state",
"=",
"-",
"1",
"elif",
... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/threading.py#L659-L677 | ||
SCons/scons | 309f0234d1d9cc76955818be47c5c722f577dac6 | SCons/Node/Python.py | python | Value.get_csig | (self, calc=None) | return contents | Because we're a Python value node and don't have a real
timestamp, we get to ignore the calculator and just use the
value contents.
Returns string. Ideally string of hex digits. (Not bytes) | Because we're a Python value node and don't have a real
timestamp, we get to ignore the calculator and just use the
value contents. | [
"Because",
"we",
"re",
"a",
"Python",
"value",
"node",
"and",
"don",
"t",
"have",
"a",
"real",
"timestamp",
"we",
"get",
"to",
"ignore",
"the",
"calculator",
"and",
"just",
"use",
"the",
"value",
"contents",
"."
] | def get_csig(self, calc=None):
"""Because we're a Python value node and don't have a real
timestamp, we get to ignore the calculator and just use the
value contents.
Returns string. Ideally string of hex digits. (Not bytes)
"""
try:
return self.ninfo.csig
... | [
"def",
"get_csig",
"(",
"self",
",",
"calc",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"ninfo",
".",
"csig",
"except",
"AttributeError",
":",
"pass",
"contents",
"=",
"self",
".",
"get_text_contents",
"(",
")",
"self",
".",
"get_ninfo",
... | https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/Node/Python.py#L149-L164 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/_weakrefset.py | python | WeakSet.__gt__ | (self, other) | return self.data > set(map(ref, other)) | [] | def __gt__(self, other):
return self.data > set(map(ref, other)) | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"data",
">",
"set",
"(",
"map",
"(",
"ref",
",",
"other",
")",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/_weakrefset.py#L171-L172 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_pvc.py | python | PersistentVolumeClaim.find_access_mode | (self, inc_mode) | return index | find a user | find a user | [
"find",
"a",
"user"
] | def find_access_mode(self, inc_mode):
''' find a user '''
index = None
try:
index = self.access_modes.index(inc_mode)
except ValueError as _:
return index
return index | [
"def",
"find_access_mode",
"(",
"self",
",",
"inc_mode",
")",
":",
"index",
"=",
"None",
"try",
":",
"index",
"=",
"self",
".",
"access_modes",
".",
"index",
"(",
"inc_mode",
")",
"except",
"ValueError",
"as",
"_",
":",
"return",
"index",
"return",
"inde... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_pvc.py#L1684-L1692 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/imghdr.py | python | test_tiff | (h, f) | TIFF (can be in Motorola or Intel byte order) | TIFF (can be in Motorola or Intel byte order) | [
"TIFF",
"(",
"can",
"be",
"in",
"Motorola",
"or",
"Intel",
"byte",
"order",
")"
] | def test_tiff(h, f):
"""TIFF (can be in Motorola or Intel byte order)"""
if h[:2] in (b'MM', b'II'):
return 'tiff' | [
"def",
"test_tiff",
"(",
"h",
",",
"f",
")",
":",
"if",
"h",
"[",
":",
"2",
"]",
"in",
"(",
"b'MM'",
",",
"b'II'",
")",
":",
"return",
"'tiff'"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/imghdr.py#L57-L60 | ||
aleju/imgaug | 0101108d4fed06bc5056c4a03e2bcb0216dac326 | imgaug/augmenters/geometric.py | python | WithPolarWarping._warp_polygons_ | (cls, psois) | return cls._warp_cbaois_(psois) | [] | def _warp_polygons_(cls, psois):
return cls._warp_cbaois_(psois) | [
"def",
"_warp_polygons_",
"(",
"cls",
",",
"psois",
")",
":",
"return",
"cls",
".",
"_warp_cbaois_",
"(",
"psois",
")"
] | https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/geometric.py#L5515-L5516 | |||
tahoe-lafs/tahoe-lafs | 766a53b5208c03c45ca0a98e97eee76870276aa1 | src/allmydata/interfaces.py | python | IDirectoryNode.set_nodes | (entries, overwrite=True) | Add multiple children to a directory node. Takes a dict mapping
unicode childname to (child_node, metdata) tuples. If metdata=None,
the original metadata is left unmodified. Returns a Deferred that
fires (with this dirnode) when the operation finishes. This is
equivalent to calling set_n... | Add multiple children to a directory node. Takes a dict mapping
unicode childname to (child_node, metdata) tuples. If metdata=None,
the original metadata is left unmodified. Returns a Deferred that
fires (with this dirnode) when the operation finishes. This is
equivalent to calling set_n... | [
"Add",
"multiple",
"children",
"to",
"a",
"directory",
"node",
".",
"Takes",
"a",
"dict",
"mapping",
"unicode",
"childname",
"to",
"(",
"child_node",
"metdata",
")",
"tuples",
".",
"If",
"metdata",
"=",
"None",
"the",
"original",
"metadata",
"is",
"left",
... | def set_nodes(entries, overwrite=True):
"""Add multiple children to a directory node. Takes a dict mapping
unicode childname to (child_node, metdata) tuples. If metdata=None,
the original metadata is left unmodified. Returns a Deferred that
fires (with this dirnode) when the operation fi... | [
"def",
"set_nodes",
"(",
"entries",
",",
"overwrite",
"=",
"True",
")",
":"
] | https://github.com/tahoe-lafs/tahoe-lafs/blob/766a53b5208c03c45ca0a98e97eee76870276aa1/src/allmydata/interfaces.py#L1420-L1426 | ||
eirannejad/pyRevit | 49c0b7eb54eb343458ce1365425e6552d0c47d44 | site-packages/urllib3/connectionpool.py | python | HTTPConnectionPool._make_request | (self, conn, method, url, timeout=_Default, chunked=False,
**httplib_request_kw) | return httplib_response | Perform a request on a given urllib connection object taken from our
pool.
:param conn:
a connection from one of our connection pools
:param timeout:
Socket timeout in seconds for the request. This can be a
float or integer, which will set the same timeout v... | Perform a request on a given urllib connection object taken from our
pool. | [
"Perform",
"a",
"request",
"on",
"a",
"given",
"urllib",
"connection",
"object",
"taken",
"from",
"our",
"pool",
"."
] | def _make_request(self, conn, method, url, timeout=_Default, chunked=False,
**httplib_request_kw):
"""
Perform a request on a given urllib connection object taken from our
pool.
:param conn:
a connection from one of our connection pools
:param ... | [
"def",
"_make_request",
"(",
"self",
",",
"conn",
",",
"method",
",",
"url",
",",
"timeout",
"=",
"_Default",
",",
"chunked",
"=",
"False",
",",
"*",
"*",
"httplib_request_kw",
")",
":",
"self",
".",
"num_requests",
"+=",
"1",
"timeout_obj",
"=",
"self",... | https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/urllib3/connectionpool.py#L322-L405 | |
mvillalba/python-ant | 5937964fdd091bb65ff6169a7a947c66acc51344 | src/ant/core/message.py | python | Message.getSize | (self) | return len(self.getPayload()) + 4 | [] | def getSize(self):
return len(self.getPayload()) + 4 | [
"def",
"getSize",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"getPayload",
"(",
")",
")",
"+",
"4"
] | https://github.com/mvillalba/python-ant/blob/5937964fdd091bb65ff6169a7a947c66acc51344/src/ant/core/message.py#L69-L70 | |||
wrye-bash/wrye-bash | d495c47cfdb44475befa523438a40c4419cb386f | Mopy/bash/bolt.py | python | Path.getNorm | (str_or_path) | return os.path.normpath(str_or_path) | Return the normpath for specified basename/Path object. | Return the normpath for specified basename/Path object. | [
"Return",
"the",
"normpath",
"for",
"specified",
"basename",
"/",
"Path",
"object",
"."
] | def getNorm(str_or_path):
# type: (str|bytes|Path) -> str
"""Return the normpath for specified basename/Path object."""
if isinstance(str_or_path, Path): return str_or_path._s
elif not str_or_path: return u'' # and not maybe b''
elif isinstance(str_or_path, bytes): str_or_path = ... | [
"def",
"getNorm",
"(",
"str_or_path",
")",
":",
"# type: (str|bytes|Path) -> str",
"if",
"isinstance",
"(",
"str_or_path",
",",
"Path",
")",
":",
"return",
"str_or_path",
".",
"_s",
"elif",
"not",
"str_or_path",
":",
"return",
"u''",
"# and not maybe b''",
"elif",... | https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/bolt.py#L507-L513 | |
chrismaddalena/ODIN | 03fb0044fe658df4d67ffbb8223060958537f17e | lib/reporter.py | python | Reporter.create_lookalike_table | (self,client,domain) | Record lookalike domains and the threat feed results for each domain.
Parameters:
client The name of the target organization
domain The domain name to use for the typo-squatting checks | Record lookalike domains and the threat feed results for each domain. | [
"Record",
"lookalike",
"domains",
"and",
"the",
"threat",
"feed",
"results",
"for",
"each",
"domain",
"."
] | def create_lookalike_table(self,client,domain):
"""Record lookalike domains and the threat feed results for each domain.
Parameters:
client The name of the target organization
domain The domain name to use for the typo-squatting checks
"""
lookalike_results = s... | [
"def",
"create_lookalike_table",
"(",
"self",
",",
"client",
",",
"domain",
")",
":",
"lookalike_results",
"=",
"self",
".",
"lookalike_toolkit",
".",
"run_domain_twister",
"(",
"domain",
")",
"if",
"lookalike_results",
":",
"# Record each typosquatted domain",
"for",... | https://github.com/chrismaddalena/ODIN/blob/03fb0044fe658df4d67ffbb8223060958537f17e/lib/reporter.py#L917-L988 | ||
anchore/anchore-engine | bb18b70e0cbcad58beb44cd439d00067d8f7ea8b | anchore_engine/services/policy_engine/engine/policy/gates/npms.py | python | NpmCheckGate.prepare_context | (self, image_obj, context) | return context | Prep the npm names and versions
:rtype:
:param image_obj:
:param context:
:return: | Prep the npm names and versions
:rtype:
:param image_obj:
:param context:
:return: | [
"Prep",
"the",
"npm",
"names",
"and",
"versions",
":",
"rtype",
":",
":",
"param",
"image_obj",
":",
":",
"param",
"context",
":",
":",
"return",
":"
] | def prepare_context(self, image_obj, context):
"""
Prep the npm names and versions
:rtype:
:param image_obj:
:param context:
:return:
"""
db_npms = image_obj.get_packages_by_type("npm")
if not db_npms:
return context
# context... | [
"def",
"prepare_context",
"(",
"self",
",",
"image_obj",
",",
"context",
")",
":",
"db_npms",
"=",
"image_obj",
".",
"get_packages_by_type",
"(",
"\"npm\"",
")",
"if",
"not",
"db_npms",
":",
"return",
"context",
"# context.data[NPM_LISTING_KEY] = {p.name: p.versions_j... | https://github.com/anchore/anchore-engine/blob/bb18b70e0cbcad58beb44cd439d00067d8f7ea8b/anchore_engine/services/policy_engine/engine/policy/gates/npms.py#L204-L235 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/core/exprtools.py | python | Factors.__init__ | (self, factors=None) | Initialize Factors from dict or expr.
Examples
========
>>> from sympy.core.exprtools import Factors
>>> from sympy.abc import x
>>> from sympy import I
>>> e = 2*x**3
>>> Factors(e)
Factors({2: 1, x: 3})
>>> Factors(e.as_powers_dict())
F... | Initialize Factors from dict or expr. | [
"Initialize",
"Factors",
"from",
"dict",
"or",
"expr",
"."
] | def __init__(self, factors=None): # Factors
"""Initialize Factors from dict or expr.
Examples
========
>>> from sympy.core.exprtools import Factors
>>> from sympy.abc import x
>>> from sympy import I
>>> e = 2*x**3
>>> Factors(e)
Factors({2: 1, ... | [
"def",
"__init__",
"(",
"self",
",",
"factors",
"=",
"None",
")",
":",
"# Factors",
"if",
"isinstance",
"(",
"factors",
",",
"(",
"SYMPY_INTS",
",",
"float",
")",
")",
":",
"factors",
"=",
"S",
"(",
"factors",
")",
"if",
"isinstance",
"(",
"factors",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/core/exprtools.py#L292-L405 | ||
Azure/azure-linux-extensions | a42ef718c746abab2b3c6a21da87b29e76364558 | OSPatching/azure/storage/blobservice.py | python | BlobService.list_blobs | (self, container_name, prefix=None, marker=None,
maxresults=None, include=None, delimiter=None) | return _parse_blob_enum_results_list(response) | Returns the list of blobs under the specified container.
container_name: Name of existing container.
prefix:
Optional. Filters the results to return only blobs whose names
begin with the specified prefix.
marker:
Optional. A string value that identifies the p... | Returns the list of blobs under the specified container. | [
"Returns",
"the",
"list",
"of",
"blobs",
"under",
"the",
"specified",
"container",
"."
] | def list_blobs(self, container_name, prefix=None, marker=None,
maxresults=None, include=None, delimiter=None):
'''
Returns the list of blobs under the specified container.
container_name: Name of existing container.
prefix:
Optional. Filters the results to... | [
"def",
"list_blobs",
"(",
"self",
",",
"container_name",
",",
"prefix",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"maxresults",
"=",
"None",
",",
"include",
"=",
"None",
",",
"delimiter",
"=",
"None",
")",
":",
"_validate_not_none",
"(",
"'container_na... | https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/OSPatching/azure/storage/blobservice.py#L421-L487 | |
kbandla/ImmunityDebugger | 2abc03fb15c8f3ed0914e1175c4d8933977c73e3 | 1.85/Libs/debugtypes.py | python | Module.getEntry | (self) | Get Entry from module
@rtype: DWORD
@return: Entry | Get Entry from module | [
"Get",
"Entry",
"from",
"module"
] | def getEntry(self):
"""
Get Entry from module
@rtype: DWORD
@return: Entry
"""
try:
return self.modDict['entry'][0]
except KeyError:
return None | [
"def",
"getEntry",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"modDict",
"[",
"'entry'",
"]",
"[",
"0",
"]",
"except",
"KeyError",
":",
"return",
"None"
] | https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.85/Libs/debugtypes.py#L375-L385 | ||
wbond/package_control | cfaaeb57612023e3679ecb7f8cd7ceac9f57990d | package_control/ca_certs.py | python | print_cert_subject | (cert, reason) | :param cert:
The asn1crypto.x509.Certificate object
:param reason:
None if being exported, or a unicode string of the reason not being
exported | :param cert:
The asn1crypto.x509.Certificate object | [
":",
"param",
"cert",
":",
"The",
"asn1crypto",
".",
"x509",
".",
"Certificate",
"object"
] | def print_cert_subject(cert, reason):
"""
:param cert:
The asn1crypto.x509.Certificate object
:param reason:
None if being exported, or a unicode string of the reason not being
exported
"""
if reason is None:
console_write(
u'''
Exported cert... | [
"def",
"print_cert_subject",
"(",
"cert",
",",
"reason",
")",
":",
"if",
"reason",
"is",
"None",
":",
"console_write",
"(",
"u'''\n Exported certificate: %s\n '''",
",",
"cert",
".",
"subject",
".",
"human_friendly",
")",
"else",
":",
"console_... | https://github.com/wbond/package_control/blob/cfaaeb57612023e3679ecb7f8cd7ceac9f57990d/package_control/ca_certs.py#L94-L117 | ||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/lib2to3/refactor.py | python | RefactoringTool.log_error | (self, msg, *args, **kwds) | Called when an error occurs. | Called when an error occurs. | [
"Called",
"when",
"an",
"error",
"occurs",
"."
] | def log_error(self, msg, *args, **kwds):
"""Called when an error occurs."""
raise | [
"def",
"log_error",
"(",
"self",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"raise"
] | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib2to3/refactor.py#L261-L263 | ||
beancount/beancount | cb3526a1af95b3b5be70347470c381b5a86055fe | beancount/plugins/commodity_attr.py | python | validate_commodity_attr | (entries, unused_options_map, config_str) | return entries, errors | Check that all Commodity directives have a valid attribute.
Args:
entries: A list of directives.
unused_options_map: An options map.
config_str: A configuration string.
Returns:
A list of new errors, if any were found. | Check that all Commodity directives have a valid attribute. | [
"Check",
"that",
"all",
"Commodity",
"directives",
"have",
"a",
"valid",
"attribute",
"."
] | def validate_commodity_attr(entries, unused_options_map, config_str):
"""Check that all Commodity directives have a valid attribute.
Args:
entries: A list of directives.
unused_options_map: An options map.
config_str: A configuration string.
Returns:
A list of new errors, if any wer... | [
"def",
"validate_commodity_attr",
"(",
"entries",
",",
"unused_options_map",
",",
"config_str",
")",
":",
"errors",
"=",
"[",
"]",
"# pylint: disable=eval-used",
"config_obj",
"=",
"eval",
"(",
"config_str",
",",
"{",
"}",
",",
"{",
"}",
")",
"if",
"not",
"i... | https://github.com/beancount/beancount/blob/cb3526a1af95b3b5be70347470c381b5a86055fe/beancount/plugins/commodity_attr.py#L31-L71 | |
slackapi/python-slack-sdk | 2dee6656ffacb7de0c29bb2a6c2b51ec6b5dbce7 | slack_sdk/models/dialogs/__init__.py | python | DialogBuilder.text_area | (
self,
*,
name: str,
label: str,
optional: bool = False,
placeholder: Optional[str] = None,
hint: Optional[str] = None,
value: Optional[str] = None,
min_length: int = 0,
max_length: int = 3000,
subtype: Optional[str] = None,
) | return self | A textarea is a multi-line plain text editing control. You've likely
encountered these on the world wide web. Use this element if you want a
relatively long answer from users. The element UI provides a remaining
character count to the max_length you have set or the default,
3000.
... | A textarea is a multi-line plain text editing control. You've likely
encountered these on the world wide web. Use this element if you want a
relatively long answer from users. The element UI provides a remaining
character count to the max_length you have set or the default,
3000. | [
"A",
"textarea",
"is",
"a",
"multi",
"-",
"line",
"plain",
"text",
"editing",
"control",
".",
"You",
"ve",
"likely",
"encountered",
"these",
"on",
"the",
"world",
"wide",
"web",
".",
"Use",
"this",
"element",
"if",
"you",
"want",
"a",
"relatively",
"long... | def text_area(
self,
*,
name: str,
label: str,
optional: bool = False,
placeholder: Optional[str] = None,
hint: Optional[str] = None,
value: Optional[str] = None,
min_length: int = 0,
max_length: int = 3000,
subtype: Optional[str] =... | [
"def",
"text_area",
"(",
"self",
",",
"*",
",",
"name",
":",
"str",
",",
"label",
":",
"str",
",",
"optional",
":",
"bool",
"=",
"False",
",",
"placeholder",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"hint",
":",
"Optional",
"[",
"str",
... | https://github.com/slackapi/python-slack-sdk/blob/2dee6656ffacb7de0c29bb2a6c2b51ec6b5dbce7/slack_sdk/models/dialogs/__init__.py#L570-L623 | |
FrancoisSchnell/GPicSync | 07d7c4b7da44e4e6665abb94bbb9ef6da0e779d1 | src/gpicsync-GUI.py | python | GUI.__init__ | (self,parent, title) | Initialize the main frame | Initialize the main frame | [
"Initialize",
"the",
"main",
"frame"
] | def __init__(self,parent, title):
"""Initialize the main frame"""
global bkg
wx.Frame.__init__(self, parent, wx.ID_ANY, title="GPicSync",size=(1000,600))
favicon = wx.Icon('gpicsync.ico', wx.BITMAP_TYPE_ICO, 16, 16)
wx.Frame.SetIcon(self, favicon)
self.tcam_l="00:00:00"... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"title",
")",
":",
"global",
"bkg",
"wx",
".",
"Frame",
".",
"__init__",
"(",
"self",
",",
"parent",
",",
"wx",
".",
"ID_ANY",
",",
"title",
"=",
"\"GPicSync\"",
",",
"size",
"=",
"(",
"1000",
","... | https://github.com/FrancoisSchnell/GPicSync/blob/07d7c4b7da44e4e6665abb94bbb9ef6da0e779d1/src/gpicsync-GUI.py#L84-L534 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | apache/datadog_checks/apache/config_models/defaults.py | python | instance_auth_type | (field, value) | return 'basic' | [] | def instance_auth_type(field, value):
return 'basic' | [
"def",
"instance_auth_type",
"(",
"field",
",",
"value",
")",
":",
"return",
"'basic'"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/apache/datadog_checks/apache/config_models/defaults.py#L37-L38 | |||
AndrewAnnex/SpiceyPy | 9f8b626338f119bacd39ef2ba94a6f71bd6341c0 | src/spiceypy/spiceypy.py | python | pjelpl | (elin: Ellipse, plane: Plane) | return elout | Project an ellipse onto a plane, orthogonally.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pjelpl_c.html
:param elin: A SPICE ellipse to be projected.
:param plane: A plane onto which elin is to be projected.
:return: A SPICE ellipse resulting from the projection. | Project an ellipse onto a plane, orthogonally. | [
"Project",
"an",
"ellipse",
"onto",
"a",
"plane",
"orthogonally",
"."
] | def pjelpl(elin: Ellipse, plane: Plane) -> Ellipse:
"""
Project an ellipse onto a plane, orthogonally.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pjelpl_c.html
:param elin: A SPICE ellipse to be projected.
:param plane: A plane onto which elin is to be projected.
:return: A SPICE... | [
"def",
"pjelpl",
"(",
"elin",
":",
"Ellipse",
",",
"plane",
":",
"Plane",
")",
"->",
"Ellipse",
":",
"assert",
"isinstance",
"(",
"elin",
",",
"stypes",
".",
"Ellipse",
")",
"assert",
"isinstance",
"(",
"plane",
",",
"stypes",
".",
"Plane",
")",
"elout... | https://github.com/AndrewAnnex/SpiceyPy/blob/9f8b626338f119bacd39ef2ba94a6f71bd6341c0/src/spiceypy/spiceypy.py#L9760-L9774 | |
openai/iaf | ad33fe4872bf6e4b4f387e709a625376bb8b0d9d | tf_train.py | python | run | (hps) | [] | def run(hps):
with tf.variable_scope("model") as vs:
x = get_inputs(hps.dataset, "train", hps.batch_size * FLAGS.num_gpus, hps.image_size)
hps.num_gpus = 1
init_x = x[:hps.batch_size, :, :, :]
init_model = CVAE1(hps, "init", init_x)
vs.reuse_variables()
hps.num_gpus... | [
"def",
"run",
"(",
"hps",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"model\"",
")",
"as",
"vs",
":",
"x",
"=",
"get_inputs",
"(",
"hps",
".",
"dataset",
",",
"\"train\"",
",",
"hps",
".",
"batch_size",
"*",
"FLAGS",
".",
"num_gpus",
",",
... | https://github.com/openai/iaf/blob/ad33fe4872bf6e4b4f387e709a625376bb8b0d9d/tf_train.py#L222-L290 | ||||
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/sqlalchemy/sql/compiler.py | python | Compiled.__init__ | (self, dialect, statement, bind=None,
compile_kwargs=util.immutabledict()) | Construct a new ``Compiled`` object.
:param dialect: ``Dialect`` to compile against.
:param statement: ``ClauseElement`` to be compiled.
:param bind: Optional Engine or Connection to compile this
statement against.
:param compile_kwargs: additional kwargs that will be
... | Construct a new ``Compiled`` object. | [
"Construct",
"a",
"new",
"Compiled",
"object",
"."
] | def __init__(self, dialect, statement, bind=None,
compile_kwargs=util.immutabledict()):
"""Construct a new ``Compiled`` object.
:param dialect: ``Dialect`` to compile against.
:param statement: ``ClauseElement`` to be compiled.
:param bind: Optional Engine or Connectio... | [
"def",
"__init__",
"(",
"self",
",",
"dialect",
",",
"statement",
",",
"bind",
"=",
"None",
",",
"compile_kwargs",
"=",
"util",
".",
"immutabledict",
"(",
")",
")",
":",
"self",
".",
"dialect",
"=",
"dialect",
"self",
".",
"bind",
"=",
"bind",
"if",
... | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/sql/compiler.py#L174-L197 | ||
NervanaSystems/ngraph-python | ac032c83c7152b615a9ad129d54d350f9d6a2986 | ngraph/transformers/gpu/float_ew2.py | python | _generate_kernel_args | (ops, axes_mapping, dims, ctx) | return (args, arg_desc, params) | Generates a list of parameters which need to be passed to the CUDA kernel
at runtime along with strings to represent them in C
Argument order for kernels is standardized:
1. Tensor shape (max shape)
2. Tensor inputs/outputs pointers in the order op1_arg1, op1_arg2, op1_out,
op2_arg1,...
2a.... | Generates a list of parameters which need to be passed to the CUDA kernel
at runtime along with strings to represent them in C | [
"Generates",
"a",
"list",
"of",
"parameters",
"which",
"need",
"to",
"be",
"passed",
"to",
"the",
"CUDA",
"kernel",
"at",
"runtime",
"along",
"with",
"strings",
"to",
"represent",
"them",
"in",
"C"
] | def _generate_kernel_args(ops, axes_mapping, dims, ctx):
"""
Generates a list of parameters which need to be passed to the CUDA kernel
at runtime along with strings to represent them in C
Argument order for kernels is standardized:
1. Tensor shape (max shape)
2. Tensor inputs/outputs pointers i... | [
"def",
"_generate_kernel_args",
"(",
"ops",
",",
"axes_mapping",
",",
"dims",
",",
"ctx",
")",
":",
"# List arguments to kernel",
"args",
"=",
"[",
"\"unsigned int shapea\"",
"]",
"arg_desc",
"=",
"\"I\"",
"params",
"=",
"[",
"axes_mapping",
"[",
"0",
"]",
"["... | https://github.com/NervanaSystems/ngraph-python/blob/ac032c83c7152b615a9ad129d54d350f9d6a2986/ngraph/transformers/gpu/float_ew2.py#L987-L1079 | |
robinhood/faust | 01b4c0ad8390221db71751d80001b0fd879291e2 | faust/types/settings/settings.py | python | Settings.producer_request_timeout | (self) | Producer request timeout.
Timeout for producer operations.
This is set high by default, as this is also the time when
producer batches expire and will no longer be retried. | Producer request timeout. | [
"Producer",
"request",
"timeout",
"."
] | def producer_request_timeout(self) -> float:
"""Producer request timeout.
Timeout for producer operations.
This is set high by default, as this is also the time when
producer batches expire and will no longer be retried.
""" | [
"def",
"producer_request_timeout",
"(",
"self",
")",
"->",
"float",
":"
] | https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/types/settings/settings.py#L1326-L1332 | ||
turicas/brasil.io | f1c371fe828a090510259a5027b49e2e651936b4 | traffic_control/models.py | python | BlockRequestQuerySet.from_hours_ago | (self, hours) | return self.filter(created_at__gte=timezone.now() - datetime.timedelta(hours=hours)) | [] | def from_hours_ago(self, hours):
return self.filter(created_at__gte=timezone.now() - datetime.timedelta(hours=hours)) | [
"def",
"from_hours_ago",
"(",
"self",
",",
"hours",
")",
":",
"return",
"self",
".",
"filter",
"(",
"created_at__gte",
"=",
"timezone",
".",
"now",
"(",
")",
"-",
"datetime",
".",
"timedelta",
"(",
"hours",
"=",
"hours",
")",
")"
] | https://github.com/turicas/brasil.io/blob/f1c371fe828a090510259a5027b49e2e651936b4/traffic_control/models.py#L10-L11 | |||
RiotGames/cloud-inquisitor | 29a26c705381fdba3538b4efedb25b9e09b387ed | backend/cloud_inquisitor/schema/base.py | python | AuditLog.log | (cls, event=None, actor=None, data=None) | Generate and insert a new event
Args:
event (str): Action performed
actor (str): Actor (user or subsystem) triggering the event
data (dict): Any extra data necessary for describing the event
Returns:
`None` | Generate and insert a new event | [
"Generate",
"and",
"insert",
"a",
"new",
"event"
] | def log(cls, event=None, actor=None, data=None):
"""Generate and insert a new event
Args:
event (str): Action performed
actor (str): Actor (user or subsystem) triggering the event
data (dict): Any extra data necessary for describing the event
Returns:
... | [
"def",
"log",
"(",
"cls",
",",
"event",
"=",
"None",
",",
"actor",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"from",
"cloud_inquisitor",
".",
"log",
"import",
"auditlog",
"auditlog",
"(",
"event",
"=",
"event",
",",
"actor",
"=",
"actor",
",",... | https://github.com/RiotGames/cloud-inquisitor/blob/29a26c705381fdba3538b4efedb25b9e09b387ed/backend/cloud_inquisitor/schema/base.py#L422-L435 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/_abcoll.py | python | Sequence.__reversed__ | (self) | [] | def __reversed__(self):
for i in reversed(range(len(self))):
yield self[i] | [
"def",
"__reversed__",
"(",
"self",
")",
":",
"for",
"i",
"in",
"reversed",
"(",
"range",
"(",
"len",
"(",
"self",
")",
")",
")",
":",
"yield",
"self",
"[",
"i",
"]"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/_abcoll.py#L555-L557 | ||||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/calendar.py | python | Calendar.itermonthdates | (self, year, month) | Return an iterator for one month. The iterator will yield datetime.date
values and will always iterate through complete weeks, so it will yield
dates outside the specified month. | Return an iterator for one month. The iterator will yield datetime.date
values and will always iterate through complete weeks, so it will yield
dates outside the specified month. | [
"Return",
"an",
"iterator",
"for",
"one",
"month",
".",
"The",
"iterator",
"will",
"yield",
"datetime",
".",
"date",
"values",
"and",
"will",
"always",
"iterate",
"through",
"complete",
"weeks",
"so",
"it",
"will",
"yield",
"dates",
"outside",
"the",
"specif... | def itermonthdates(self, year, month):
"""
Return an iterator for one month. The iterator will yield datetime.date
values and will always iterate through complete weeks, so it will yield
dates outside the specified month.
"""
for y, m, d in self.itermonthdays3(year, month... | [
"def",
"itermonthdates",
"(",
"self",
",",
"year",
",",
"month",
")",
":",
"for",
"y",
",",
"m",
",",
"d",
"in",
"self",
".",
"itermonthdays3",
"(",
"year",
",",
"month",
")",
":",
"yield",
"datetime",
".",
"date",
"(",
"y",
",",
"m",
",",
"d",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/calendar.py#L173-L180 | ||
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/orm/nodes/data/structure.py | python | StructureData.get_cell_volume | (self) | return calc_cell_volume(self.cell) | Returns the cell volume in Angstrom^3.
:return: a float. | Returns the cell volume in Angstrom^3. | [
"Returns",
"the",
"cell",
"volume",
"in",
"Angstrom^3",
"."
] | def get_cell_volume(self):
"""
Returns the cell volume in Angstrom^3.
:return: a float.
"""
return calc_cell_volume(self.cell) | [
"def",
"get_cell_volume",
"(",
"self",
")",
":",
"return",
"calc_cell_volume",
"(",
"self",
".",
"cell",
")"
] | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/nodes/data/structure.py#L1755-L1761 | |
zaxlct/imooc-django | daf1ced745d3d21989e8191b658c293a511b37fd | extra_apps/xadmin/plugins/xversion.py | python | RecoverView.init_request | (self, version_id) | [] | def init_request(self, version_id):
if not self.has_change_permission() and not self.has_add_permission():
raise PermissionDenied
self.version = get_object_or_404(Version, pk=version_id)
self.org_obj = self.version._object_version.object
self.prepare_form() | [
"def",
"init_request",
"(",
"self",
",",
"version_id",
")",
":",
"if",
"not",
"self",
".",
"has_change_permission",
"(",
")",
"and",
"not",
"self",
".",
"has_add_permission",
"(",
")",
":",
"raise",
"PermissionDenied",
"self",
".",
"version",
"=",
"get_objec... | https://github.com/zaxlct/imooc-django/blob/daf1ced745d3d21989e8191b658c293a511b37fd/extra_apps/xadmin/plugins/xversion.py#L450-L457 | ||||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/logging/__init__.py | python | getLoggerClass | () | return _loggerClass | Return the class to be used when instantiating a logger. | Return the class to be used when instantiating a logger. | [
"Return",
"the",
"class",
"to",
"be",
"used",
"when",
"instantiating",
"a",
"logger",
"."
] | def getLoggerClass():
"""
Return the class to be used when instantiating a logger.
"""
return _loggerClass | [
"def",
"getLoggerClass",
"(",
")",
":",
"return",
"_loggerClass"
] | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/logging/__init__.py#L972-L977 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/templatetags/l10n.py | python | LocalizeNode.__repr__ | (self) | return "<LocalizeNode>" | [] | def __repr__(self):
return "<LocalizeNode>" | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"<LocalizeNode>\""
] | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/templatetags/l10n.py#L31-L32 | |||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-35/fabmetheus_utilities/miscellaneous/nophead/vector3.py | python | Vector3.__rmul__ | (self, other) | return Vector3( self.x * other, self.y * other, self.z * other ) | Get a new Vector3 by multiplying each component of this one. | Get a new Vector3 by multiplying each component of this one. | [
"Get",
"a",
"new",
"Vector3",
"by",
"multiplying",
"each",
"component",
"of",
"this",
"one",
"."
] | def __rmul__(self, other):
"Get a new Vector3 by multiplying each component of this one."
return Vector3( self.x * other, self.y * other, self.z * other ) | [
"def",
"__rmul__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Vector3",
"(",
"self",
".",
"x",
"*",
"other",
",",
"self",
".",
"y",
"*",
"other",
",",
"self",
".",
"z",
"*",
"other",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/fabmetheus_utilities/miscellaneous/nophead/vector3.py#L157-L159 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/matexpr.py | python | MatrixExpr.rows | (self) | return self.shape[0] | [] | def rows(self):
return self.shape[0] | [
"def",
"rows",
"(",
"self",
")",
":",
"return",
"self",
".",
"shape",
"[",
"0",
"]"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/matexpr.py#L140-L141 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/polynomial/legendre.py | python | legdiv | (c1, c2) | Divide one Legendre series by another.
Returns the quotient-with-remainder of two Legendre series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1, c2 : array... | Divide one Legendre series by another. | [
"Divide",
"one",
"Legendre",
"series",
"by",
"another",
"."
] | def legdiv(c1, c2):
"""
Divide one Legendre series by another.
Returns the quotient-with-remainder of two Legendre series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``P_0 + 2*P_1 + 3*P_2``.
Parameters
... | [
"def",
"legdiv",
"(",
"c1",
",",
"c2",
")",
":",
"# c1, c2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"if",
"c2",
"[",
"-",
"1",
"]",
"==",
"0",
":",
"raise",
"ZeroDivisionErr... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/polynomial/legendre.py#L560-L625 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListItem.IsFooterChecked | (self) | return self._footerChecked | Returns whether the footer item is checked or not. | Returns whether the footer item is checked or not. | [
"Returns",
"whether",
"the",
"footer",
"item",
"is",
"checked",
"or",
"not",
"."
] | def IsFooterChecked(self):
""" Returns whether the footer item is checked or not. """
return self._footerChecked | [
"def",
"IsFooterChecked",
"(",
"self",
")",
":",
"return",
"self",
".",
"_footerChecked"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/ultimatelistctrl.py#L2134-L2137 | |
scikit-learn-contrib/DESlib | 64260ae7c6dd745ef0003cc6322c9f829c807708 | deslib/des/des_clustering.py | python | DESClustering._preprocess_clusters | (self) | Preprocess the competence as well as the average diversity of each
base classifier for each specific cluster.
This process makes the test routines faster, since the ensemble of
classifiers of each cluster is already predefined.
The class attributes Accuracy_cluster_ and diversity_clust... | Preprocess the competence as well as the average diversity of each
base classifier for each specific cluster. | [
"Preprocess",
"the",
"competence",
"as",
"well",
"as",
"the",
"average",
"diversity",
"of",
"each",
"base",
"classifier",
"for",
"each",
"specific",
"cluster",
"."
] | def _preprocess_clusters(self):
"""Preprocess the competence as well as the average diversity of each
base classifier for each specific cluster.
This process makes the test routines faster, since the ensemble of
classifiers of each cluster is already predefined.
The class attri... | [
"def",
"_preprocess_clusters",
"(",
"self",
")",
":",
"labels",
"=",
"self",
".",
"clustering_",
".",
"predict",
"(",
"self",
".",
"DSEL_data_",
")",
"for",
"cluster_index",
"in",
"range",
"(",
"self",
".",
"clustering_",
".",
"n_clusters",
")",
":",
"# Ge... | https://github.com/scikit-learn-contrib/DESlib/blob/64260ae7c6dd745ef0003cc6322c9f829c807708/deslib/des/des_clustering.py#L187-L234 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/compiler/transformer.py | python | Transformer.if_stmt | (self, nodelist) | return If(tests, elseNode, lineno=nodelist[0][2]) | [] | def if_stmt(self, nodelist):
# if: test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
tests = []
for i in range(0, len(nodelist) - 3, 4):
testNode = self.com_node(nodelist[i + 1])
suiteNode = self.com_node(nodelist[i + 3])
tests.append((testNode, suite... | [
"def",
"if_stmt",
"(",
"self",
",",
"nodelist",
")",
":",
"# if: test ':' suite ('elif' test ':' suite)* ['else' ':' suite]",
"tests",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"nodelist",
")",
"-",
"3",
",",
"4",
")",
":",
"test... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/compiler/transformer.py#L506-L519 | |||
linkedin/kafka-tools | 0d98bbefc1105851b7b7203de4f6c68d9c097730 | kafka/tools/client.py | python | Client._send_all_brokers | (self, request) | return self._send_some_brokers(requests) | Sends a request to all brokers. The responses are returned mapped to the broker that
they were retrieved from
Args:
request (BaseRequest): A valid request object that inherits from BaseRequest
Returns:
dict (int -> BaseResponse): A map of broker IDs to response instance... | Sends a request to all brokers. The responses are returned mapped to the broker that
they were retrieved from | [
"Sends",
"a",
"request",
"to",
"all",
"brokers",
".",
"The",
"responses",
"are",
"returned",
"mapped",
"to",
"the",
"broker",
"that",
"they",
"were",
"retrieved",
"from"
] | def _send_all_brokers(self, request):
"""
Sends a request to all brokers. The responses are returned mapped to the broker that
they were retrieved from
Args:
request (BaseRequest): A valid request object that inherits from BaseRequest
Returns:
dict (int ... | [
"def",
"_send_all_brokers",
"(",
"self",
",",
"request",
")",
":",
"requests",
"=",
"{",
"}",
"for",
"broker_id",
"in",
"self",
".",
"cluster",
".",
"brokers",
":",
"if",
"self",
".",
"cluster",
".",
"brokers",
"[",
"broker_id",
"]",
".",
"hostname",
"... | https://github.com/linkedin/kafka-tools/blob/0d98bbefc1105851b7b7203de4f6c68d9c097730/kafka/tools/client.py#L490-L506 | |
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | setuptools/dist.py | python | Distribution._finalize_setup_keywords | (self) | [] | def _finalize_setup_keywords(self):
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
value = getattr(self, ep.name, None)
if value is not None:
ep.require(installer=self.fetch_build_egg)
ep.load()(self, ep.name, value) | [
"def",
"_finalize_setup_keywords",
"(",
"self",
")",
":",
"for",
"ep",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"'distutils.setup_keywords'",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"ep",
".",
"name",
",",
"None",
")",
"if",
"value"... | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/dist.py#L853-L858 | ||||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.py | python | Manifest._exclude_pattern | (self, pattern, anchor=True, prefix=None,
is_regex=False) | return found | Remove strings (presumably filenames) from 'files' that match
'pattern'.
Other parameters are the same as for 'include_pattern()', above.
The list 'self.files' is modified in place. Return True if files are
found.
This API is public to allow e.g. exclusion of SCM subdirs, e.g. ... | Remove strings (presumably filenames) from 'files' that match
'pattern'. | [
"Remove",
"strings",
"(",
"presumably",
"filenames",
")",
"from",
"files",
"that",
"match",
"pattern",
"."
] | def _exclude_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Remove strings (presumably filenames) from 'files' that match
'pattern'.
Other parameters are the same as for 'include_pattern()', above.
The list 'self.files' is modified in place... | [
"def",
"_exclude_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"False",
")",
":",
"found",
"=",
"False",
"pattern_re",
"=",
"self",
".",
"_translate_pattern",
"(",
"pattern",
",",
"an... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.py#L290-L308 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/stringold.py | python | upper | (s) | return s.upper() | upper(s) -> string
Return a copy of the string s converted to uppercase. | upper(s) -> string | [
"upper",
"(",
"s",
")",
"-",
">",
"string"
] | def upper(s):
"""upper(s) -> string
Return a copy of the string s converted to uppercase.
"""
return s.upper() | [
"def",
"upper",
"(",
"s",
")",
":",
"return",
"s",
".",
"upper",
"(",
")"
] | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/stringold.py#L55-L61 | |
python-zk/kazoo | f585d605eea0a37a08aae95a8cc259b80da2ecf0 | kazoo/client.py | python | KazooClient.connected | (self) | return self._live.is_set() | Returns whether the Zookeeper connection has been
established. | Returns whether the Zookeeper connection has been
established. | [
"Returns",
"whether",
"the",
"Zookeeper",
"connection",
"has",
"been",
"established",
"."
] | def connected(self):
"""Returns whether the Zookeeper connection has been
established."""
return self._live.is_set() | [
"def",
"connected",
"(",
"self",
")",
":",
"return",
"self",
".",
"_live",
".",
"is_set",
"(",
")"
] | https://github.com/python-zk/kazoo/blob/f585d605eea0a37a08aae95a8cc259b80da2ecf0/kazoo/client.py#L426-L429 | |
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/jarfile.py | python | ReadManifest | (jar_file_name) | Read and parse the manifest out of the given jar.
Args:
jar_file_name: the name of the jar from which the manifest is to be read.
Returns:
A parsed Manifest object, or None if the jar has no manifest.
Raises:
IOError: if the jar does not exist or cannot be read. | Read and parse the manifest out of the given jar. | [
"Read",
"and",
"parse",
"the",
"manifest",
"out",
"of",
"the",
"given",
"jar",
"."
] | def ReadManifest(jar_file_name):
"""Read and parse the manifest out of the given jar.
Args:
jar_file_name: the name of the jar from which the manifest is to be read.
Returns:
A parsed Manifest object, or None if the jar has no manifest.
Raises:
IOError: if the jar does not exist or cannot be read... | [
"def",
"ReadManifest",
"(",
"jar_file_name",
")",
":",
"with",
"zipfile",
".",
"ZipFile",
"(",
"jar_file_name",
")",
"as",
"jar",
":",
"try",
":",
"manifest_string",
"=",
"jar",
".",
"read",
"(",
"_MANIFEST_NAME",
")",
"except",
"KeyError",
":",
"return",
... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/jarfile.py#L70-L87 | ||
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/pip/pip/_vendor/distlib/resources.py | python | finder | (package) | return result | Return a resource finder for a package.
:param package: The name of the package.
:return: A :class:`ResourceFinder` instance for the package. | Return a resource finder for a package.
:param package: The name of the package.
:return: A :class:`ResourceFinder` instance for the package. | [
"Return",
"a",
"resource",
"finder",
"for",
"a",
"package",
".",
":",
"param",
"package",
":",
"The",
"name",
"of",
"the",
"package",
".",
":",
"return",
":",
"A",
":",
"class",
":",
"ResourceFinder",
"instance",
"for",
"the",
"package",
"."
] | def finder(package):
"""
Return a resource finder for a package.
:param package: The name of the package.
:return: A :class:`ResourceFinder` instance for the package.
"""
if package in _finder_cache:
result = _finder_cache[package]
else:
if package not in sys.modules:
... | [
"def",
"finder",
"(",
"package",
")",
":",
"if",
"package",
"in",
"_finder_cache",
":",
"result",
"=",
"_finder_cache",
"[",
"package",
"]",
"else",
":",
"if",
"package",
"not",
"in",
"sys",
".",
"modules",
":",
"__import__",
"(",
"package",
")",
"module... | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/pip/_vendor/distlib/resources.py#L305-L327 | |
cheind/pytorch-blender | ef35c5b3eec884515d4f343671a8a3337b8aa1fb | pkg_blender/blendtorch/btb/signal.py | python | Signal.invoke | (self, *args, **kwargs) | Invoke the signal.
Params
------
*args: optional
Positional arguments to send to all callbacks
**kwargs: optional
Keyword arguments to send to all callbacks | Invoke the signal. | [
"Invoke",
"the",
"signal",
"."
] | def invoke(self, *args, **kwargs):
'''Invoke the signal.
Params
------
*args: optional
Positional arguments to send to all callbacks
**kwargs: optional
Keyword arguments to send to all callbacks
'''
for s in self.slots:
s(*args... | [
"def",
"invoke",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"s",
"in",
"self",
".",
"slots",
":",
"s",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/cheind/pytorch-blender/blob/ef35c5b3eec884515d4f343671a8a3337b8aa1fb/pkg_blender/blendtorch/btb/signal.py#L43-L54 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/distro.py | python | LinuxDistribution._parse_os_release_content | (lines) | return props | Parse the lines of an os-release file.
Parameters:
* lines: Iterable through the lines in the os-release file.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A dictionary containing all information items. | Parse the lines of an os-release file. | [
"Parse",
"the",
"lines",
"of",
"an",
"os",
"-",
"release",
"file",
"."
] | def _parse_os_release_content(lines):
"""
Parse the lines of an os-release file.
Parameters:
* lines: Iterable through the lines in the os-release file.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A ... | [
"def",
"_parse_os_release_content",
"(",
"lines",
")",
":",
"props",
"=",
"{",
"}",
"lexer",
"=",
"shlex",
".",
"shlex",
"(",
"lines",
",",
"posix",
"=",
"True",
")",
"lexer",
".",
"whitespace_split",
"=",
"True",
"# The shlex module defines its `wordchars` vari... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/distro.py#L849-L906 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_internal/vcs/git.py | python | Git.__init__ | (self, url=None, *args, **kwargs) | [] | def __init__(self, url=None, *args, **kwargs):
# Works around an apparent Git bug
# (see https://article.gmane.org/gmane.comp.version-control.git/146500)
if url:
scheme, netloc, path, query, fragment = urlsplit(url)
if scheme.endswith('file'):
initial_sla... | [
"def",
"__init__",
"(",
"self",
",",
"url",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Works around an apparent Git bug",
"# (see https://article.gmane.org/gmane.comp.version-control.git/146500)",
"if",
"url",
":",
"scheme",
",",
"netloc",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_internal/vcs/git.py#L43-L62 | ||||
pyeve/cerberus | 8765b317442c002a84e556bd5d9677b868e6deb2 | cerberus/errors.py | python | BaseErrorHandler.__init__ | (self, *args, **kwargs) | Optionally initialize a new instance. | Optionally initialize a new instance. | [
"Optionally",
"initialize",
"a",
"new",
"instance",
"."
] | def __init__(self, *args, **kwargs):
"""Optionally initialize a new instance."""
pass | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | https://github.com/pyeve/cerberus/blob/8765b317442c002a84e556bd5d9677b868e6deb2/cerberus/errors.py#L372-L374 | ||
datacenter/acitoolkit | 629b84887dd0f0183b81efc8adb16817f985541a | applications/cableplan/cableplan.py | python | CpPort.__eq__ | (self, other) | compares the content of the port list and returns true if they are the same. The comparison is case insensitive. | compares the content of the port list and returns true if they are the same. The comparison is case insensitive. | [
"compares",
"the",
"content",
"of",
"the",
"port",
"list",
"and",
"returns",
"true",
"if",
"they",
"are",
"the",
"same",
".",
"The",
"comparison",
"is",
"case",
"insensitive",
"."
] | def __eq__(self, other):
""" compares the content of the port list and returns true if they are the same. The comparison is case insensitive.
"""
if not self.ports and not other.ports:
return True
elif not self.ports and other.ports:
return False
elif se... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"self",
".",
"ports",
"and",
"not",
"other",
".",
"ports",
":",
"return",
"True",
"elif",
"not",
"self",
".",
"ports",
"and",
"other",
".",
"ports",
":",
"return",
"False",
"elif",
... | https://github.com/datacenter/acitoolkit/blob/629b84887dd0f0183b81efc8adb16817f985541a/applications/cableplan/cableplan.py#L770-L792 | ||
sqall01/alertR | e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13 | managerClientDatabase/lib/globalData/systemData.py | python | SystemData.get_managers_by_node_id | (self, node_id: int) | return result | Gets Manager objects corresponding to given node id.
:param node_id:
:return: | Gets Manager objects corresponding to given node id.
:param node_id:
:return: | [
"Gets",
"Manager",
"objects",
"corresponding",
"to",
"given",
"node",
"id",
".",
":",
"param",
"node_id",
":",
":",
"return",
":"
] | def get_managers_by_node_id(self, node_id: int) -> List[ManagerObjManager]:
"""
Gets Manager objects corresponding to given node id.
:param node_id:
:return:
"""
result = []
node = self.get_node_by_id(node_id)
if node is None or node.nodeType != "manager":... | [
"def",
"get_managers_by_node_id",
"(",
"self",
",",
"node_id",
":",
"int",
")",
"->",
"List",
"[",
"ManagerObjManager",
"]",
":",
"result",
"=",
"[",
"]",
"node",
"=",
"self",
".",
"get_node_by_id",
"(",
"node_id",
")",
"if",
"node",
"is",
"None",
"or",
... | https://github.com/sqall01/alertR/blob/e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13/managerClientDatabase/lib/globalData/systemData.py#L457-L472 | |
vericast/spylon-kernel | 2d0ddf2aca1b91738f938b72a500c20293e3156c | versioneer.py | python | render_pep440_post | (pieces) | return rendered | TAG[.postDISTANCE[.dev0]+gHEX] .
The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
but you shouldn't be releasing software with -dirty anyways.
Exceptions:
1: no tags. 0.postDISTANCE[.dev0] | TAG[.postDISTANCE[.dev0]+gHEX] . | [
"TAG",
"[",
".",
"postDISTANCE",
"[",
".",
"dev0",
"]",
"+",
"gHEX",
"]",
"."
] | def render_pep440_post(pieces):
"""TAG[.postDISTANCE[.dev0]+gHEX] .
The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
but you shouldn't be releasing software with -dirty anyways.
Exceptions:
1: no tags. 0.postDISTANCE[... | [
"def",
"render_pep440_post",
"(",
"pieces",
")",
":",
"if",
"pieces",
"[",
"\"closest-tag\"",
"]",
":",
"rendered",
"=",
"pieces",
"[",
"\"closest-tag\"",
"]",
"if",
"pieces",
"[",
"\"distance\"",
"]",
"or",
"pieces",
"[",
"\"dirty\"",
"]",
":",
"rendered",
... | https://github.com/vericast/spylon-kernel/blob/2d0ddf2aca1b91738f938b72a500c20293e3156c/versioneer.py#L1273-L1297 | |
KhronosGroup/NNEF-Tools | c913758ca687dab8cb7b49e8f1556819a2d0ca25 | nnef_tools/model/graph.py | python | Graph.__repr__ | (self) | return self.name if self.name is not None else _hex_id(self) | [] | def __repr__(self):
return self.name if self.name is not None else _hex_id(self) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"name",
"if",
"self",
".",
"name",
"is",
"not",
"None",
"else",
"_hex_id",
"(",
"self",
")"
] | https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/model/graph.py#L428-L429 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_service.py | python | OCService.get | (self) | return result | return service information | return service information | [
"return",
"service",
"information"
] | def get(self):
'''return service information '''
result = self._get(self.kind, self.config.name)
if result['returncode'] == 0:
self.service = Service(content=result['results'][0])
result['clusterip'] = self.service.get('spec.clusterIP')
elif 'services \"%s\" not f... | [
"def",
"get",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"kind",
",",
"self",
".",
"config",
".",
"name",
")",
"if",
"result",
"[",
"'returncode'",
"]",
"==",
"0",
":",
"self",
".",
"service",
"=",
"Service",
"("... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_service.py#L1769-L1782 | |
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/symmetry/analyzer.py | python | SpacegroupAnalyzer.__init__ | (self, structure, symprec=0.01, angle_tolerance=5.0) | Args:
structure (Structure/IStructure): Structure to find symmetry
symprec (float): Tolerance for symmetry finding. Defaults to 0.01,
which is fairly strict and works well for properly refined
structures with atoms in the proper symmetry coordinates. For
... | Args:
structure (Structure/IStructure): Structure to find symmetry
symprec (float): Tolerance for symmetry finding. Defaults to 0.01,
which is fairly strict and works well for properly refined
structures with atoms in the proper symmetry coordinates. For
... | [
"Args",
":",
"structure",
"(",
"Structure",
"/",
"IStructure",
")",
":",
"Structure",
"to",
"find",
"symmetry",
"symprec",
"(",
"float",
")",
":",
"Tolerance",
"for",
"symmetry",
"finding",
".",
"Defaults",
"to",
"0",
".",
"01",
"which",
"is",
"fairly",
... | def __init__(self, structure, symprec=0.01, angle_tolerance=5.0):
"""
Args:
structure (Structure/IStructure): Structure to find symmetry
symprec (float): Tolerance for symmetry finding. Defaults to 0.01,
which is fairly strict and works well for properly refined
... | [
"def",
"__init__",
"(",
"self",
",",
"structure",
",",
"symprec",
"=",
"0.01",
",",
"angle_tolerance",
"=",
"5.0",
")",
":",
"self",
".",
"_symprec",
"=",
"symprec",
"self",
".",
"_angle_tol",
"=",
"angle_tolerance",
"self",
".",
"_structure",
"=",
"struct... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/symmetry/analyzer.py#L42-L87 | ||
amanusk/s-tui | d7a9ee4efbfc6f56b373a16dcd578881c534b2ce | s_tui/sources/freq_source.py | python | FreqSource.__init__ | (self) | [] | def __init__(self):
self.is_available = True
if (not hasattr(psutil, "cpu_freq") and
psutil.cpu_freq()):
self.is_available = False
logging.debug("cpu_freq is not available from psutil")
return
Source.__init__(self)
self.name = 'Freque... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"is_available",
"=",
"True",
"if",
"(",
"not",
"hasattr",
"(",
"psutil",
",",
"\"cpu_freq\"",
")",
"and",
"psutil",
".",
"cpu_freq",
"(",
")",
")",
":",
"self",
".",
"is_available",
"=",
"False",
... | https://github.com/amanusk/s-tui/blob/d7a9ee4efbfc6f56b373a16dcd578881c534b2ce/s_tui/sources/freq_source.py#L29-L60 | ||||
zhang-can/ECO-pytorch | 355c3866b35cdaa5d451263c1f3291c150e22eeb | tf_model_zoo/models/neural_gpu/neural_gpu_trainer.py | python | multi_test | (l, model, sess, task, nprint, batch_size, offset=None,
ensemble=None) | return errors, seq_err | Run multiple tests at lower batch size to save memory. | Run multiple tests at lower batch size to save memory. | [
"Run",
"multiple",
"tests",
"at",
"lower",
"batch",
"size",
"to",
"save",
"memory",
"."
] | def multi_test(l, model, sess, task, nprint, batch_size, offset=None,
ensemble=None):
"""Run multiple tests at lower batch size to save memory."""
errors, seq_err = 0.0, 0.0
to_print = nprint
low_batch = FLAGS.low_batch_size
low_batch = min(low_batch, batch_size)
for mstep in xrange(batch_siz... | [
"def",
"multi_test",
"(",
"l",
",",
"model",
",",
"sess",
",",
"task",
",",
"nprint",
",",
"batch_size",
",",
"offset",
"=",
"None",
",",
"ensemble",
"=",
"None",
")",
":",
"errors",
",",
"seq_err",
"=",
"0.0",
",",
"0.0",
"to_print",
"=",
"nprint",
... | https://github.com/zhang-can/ECO-pytorch/blob/355c3866b35cdaa5d451263c1f3291c150e22eeb/tf_model_zoo/models/neural_gpu/neural_gpu_trainer.py#L192-L215 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/taskrouter/v1/workspace/activity.py | python | ActivityInstance._proxy | (self) | return self._context | Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: ActivityContext for this ActivityInstance
:rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext | Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context | [
"Generate",
"an",
"instance",
"context",
"for",
"the",
"instance",
"the",
"context",
"is",
"capable",
"of",
"performing",
"various",
"actions",
".",
"All",
"instance",
"actions",
"are",
"proxied",
"to",
"the",
"context"
] | def _proxy(self):
"""
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: ActivityContext for this ActivityInstance
:rtype: twilio.rest.taskrouter.v1.workspace.activity.Ac... | [
"def",
"_proxy",
"(",
"self",
")",
":",
"if",
"self",
".",
"_context",
"is",
"None",
":",
"self",
".",
"_context",
"=",
"ActivityContext",
"(",
"self",
".",
"_version",
",",
"workspace_sid",
"=",
"self",
".",
"_solution",
"[",
"'workspace_sid'",
"]",
","... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/taskrouter/v1/workspace/activity.py#L323-L337 | |
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/pkgutil.py | python | get_importer | (path_item) | return importer | Retrieve a PEP 302 importer for the given path item
The returned importer is cached in sys.path_importer_cache
if it was newly created by a path hook.
If there is no importer, a wrapper around the basic import
machinery is returned. This wrapper is never inserted into
the importer cache (None is i... | Retrieve a PEP 302 importer for the given path item | [
"Retrieve",
"a",
"PEP",
"302",
"importer",
"for",
"the",
"given",
"path",
"item"
] | def get_importer(path_item):
"""Retrieve a PEP 302 importer for the given path item
The returned importer is cached in sys.path_importer_cache
if it was newly created by a path hook.
If there is no importer, a wrapper around the basic import
machinery is returned. This wrapper is never inserted in... | [
"def",
"get_importer",
"(",
"path_item",
")",
":",
"try",
":",
"importer",
"=",
"sys",
".",
"path_importer_cache",
"[",
"path_item",
"]",
"except",
"KeyError",
":",
"for",
"path_hook",
"in",
"sys",
".",
"path_hooks",
":",
"try",
":",
"importer",
"=",
"path... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/pkgutil.py#L366-L397 | |
dark-lbp/isf | 5228865757fd48f26970da5217a4c88d81f6597e | icssploit/clients/base.py | python | Base.get_description | (self) | return type(self).__name__ | :rtype: str
:return: the description of the object. by default only prints the object type. | :rtype: str
:return: the description of the object. by default only prints the object type. | [
":",
"rtype",
":",
"str",
":",
"return",
":",
"the",
"description",
"of",
"the",
"object",
".",
"by",
"default",
"only",
"prints",
"the",
"object",
"type",
"."
] | def get_description(self):
'''
:rtype: str
:return: the description of the object. by default only prints the object type.
'''
return type(self).__name__ | [
"def",
"get_description",
"(",
"self",
")",
":",
"return",
"type",
"(",
"self",
")",
".",
"__name__"
] | https://github.com/dark-lbp/isf/blob/5228865757fd48f26970da5217a4c88d81f6597e/icssploit/clients/base.py#L60-L65 | |
21dotco/two1-python | 4e833300fd5a58363e3104ed4c097631e5d296d3 | two1/wallet/two1_wallet.py | python | Two1Wallet.spread_utxos | (self, threshold, num_addresses, accounts=[]) | return txids | Spreads out UTXOs >= threshold satoshis to a set
of new change addresses.
Args:
threshold (int): UTXO value must be >= to this value (in satoshis).
num_addresses (int): Number of addresses to spread out the
matching UTXOs over. This must be > 1 and <= 100.
... | Spreads out UTXOs >= threshold satoshis to a set
of new change addresses. | [
"Spreads",
"out",
"UTXOs",
">",
"=",
"threshold",
"satoshis",
"to",
"a",
"set",
"of",
"new",
"change",
"addresses",
"."
] | def spread_utxos(self, threshold, num_addresses, accounts=[]):
""" Spreads out UTXOs >= threshold satoshis to a set
of new change addresses.
Args:
threshold (int): UTXO value must be >= to this value (in satoshis).
num_addresses (int): Number of addresses to spread out t... | [
"def",
"spread_utxos",
"(",
"self",
",",
"threshold",
",",
"num_addresses",
",",
"accounts",
"=",
"[",
"]",
")",
":",
"# Limit the number of spreading addresses so that we don't",
"# create unnecessarily large transactions",
"if",
"num_addresses",
"<",
"1",
"or",
"num_add... | https://github.com/21dotco/two1-python/blob/4e833300fd5a58363e3104ed4c097631e5d296d3/two1/wallet/two1_wallet.py#L1511-L1590 | |
nate-parrott/Flashlight | c3a7c7278a1cccf8918e7543faffc68e863ff5ab | PluginDirectories/1/calendar.bundle/jinja2/filters.py | python | do_title | (s) | return ''.join(rv) | Return a titlecased version of the value. I.e. words will start with
uppercase letters, all remaining characters are lowercase. | Return a titlecased version of the value. I.e. words will start with
uppercase letters, all remaining characters are lowercase. | [
"Return",
"a",
"titlecased",
"version",
"of",
"the",
"value",
".",
"I",
".",
"e",
".",
"words",
"will",
"start",
"with",
"uppercase",
"letters",
"all",
"remaining",
"characters",
"are",
"lowercase",
"."
] | def do_title(s):
"""Return a titlecased version of the value. I.e. words will start with
uppercase letters, all remaining characters are lowercase.
"""
rv = []
for item in re.compile(r'([-\s]+)(?u)').split(s):
if not item:
continue
rv.append(item[0].upper() + item[1:].low... | [
"def",
"do_title",
"(",
"s",
")",
":",
"rv",
"=",
"[",
"]",
"for",
"item",
"in",
"re",
".",
"compile",
"(",
"r'([-\\s]+)(?u)'",
")",
".",
"split",
"(",
"s",
")",
":",
"if",
"not",
"item",
":",
"continue",
"rv",
".",
"append",
"(",
"item",
"[",
... | https://github.com/nate-parrott/Flashlight/blob/c3a7c7278a1cccf8918e7543faffc68e863ff5ab/PluginDirectories/1/calendar.bundle/jinja2/filters.py#L181-L190 | |
equalitie/learn2ban | d45420c9d2eea2c81972c778a96a2ca42b318b6f | src/train2ban.py | python | Train2Ban.add_to_malicious_ips | (self, bad_ip_list) | Get a list of ips that the user knows they are malicious
and add them to _malicious_ip_list
INPUT:
bad_ip_list: the ip list of strs to be indicated as 1 in training
target | Get a list of ips that the user knows they are malicious
and add them to _malicious_ip_list | [
"Get",
"a",
"list",
"of",
"ips",
"that",
"the",
"user",
"knows",
"they",
"are",
"malicious",
"and",
"add",
"them",
"to",
"_malicious_ip_list"
] | def add_to_malicious_ips(self, bad_ip_list):
"""
Get a list of ips that the user knows they are malicious
and add them to _malicious_ip_list
INPUT:
bad_ip_list: the ip list of strs to be indicated as 1 in training
target
"""
self._malicious_ip_list.... | [
"def",
"add_to_malicious_ips",
"(",
"self",
",",
"bad_ip_list",
")",
":",
"self",
".",
"_malicious_ip_list",
".",
"extend",
"(",
"bad_ip_list",
")"
] | https://github.com/equalitie/learn2ban/blob/d45420c9d2eea2c81972c778a96a2ca42b318b6f/src/train2ban.py#L259-L268 | ||
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/analysis/eos.py | python | EOSBase._initial_guess | (self) | return e0, b0, b1, v0 | Quadratic fit to get an initial guess for the parameters.
Returns:
tuple: (e0, b0, b1, v0) | Quadratic fit to get an initial guess for the parameters. | [
"Quadratic",
"fit",
"to",
"get",
"an",
"initial",
"guess",
"for",
"the",
"parameters",
"."
] | def _initial_guess(self):
"""
Quadratic fit to get an initial guess for the parameters.
Returns:
tuple: (e0, b0, b1, v0)
"""
a, b, c = np.polyfit(self.volumes, self.energies, 2)
self.eos_params = [a, b, c]
v0 = -b / (2 * a)
e0 = a * (v0 ** 2)... | [
"def",
"_initial_guess",
"(",
"self",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"np",
".",
"polyfit",
"(",
"self",
".",
"volumes",
",",
"self",
".",
"energies",
",",
"2",
")",
"self",
".",
"eos_params",
"=",
"[",
"a",
",",
"b",
",",
"c",
"]",
"... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/eos.py#L51-L71 | |
dbrgn/RPLCD | e651d9cfc0e24e1ad47fe63cf50d3fec0d751c61 | RPLCD/lcd.py | python | BaseCharLCD.cr | (self) | Write a carriage return (``\\r``) character to the LCD. | Write a carriage return (``\\r``) character to the LCD. | [
"Write",
"a",
"carriage",
"return",
"(",
"\\\\",
"r",
")",
"character",
"to",
"the",
"LCD",
"."
] | def cr(self): # type: () -> None
"""Write a carriage return (``\\r``) character to the LCD."""
self.write_string('\r') | [
"def",
"cr",
"(",
"self",
")",
":",
"# type: () -> None",
"self",
".",
"write_string",
"(",
"'\\r'",
")"
] | https://github.com/dbrgn/RPLCD/blob/e651d9cfc0e24e1ad47fe63cf50d3fec0d751c61/RPLCD/lcd.py#L438-L440 | ||
althonos/pronto | 6f778cd90b120a26e67eac2b94cc5b8694c4d517 | pronto/entity/__init__.py | python | Entity.add_synonym | (
self,
description: str,
scope: Optional[str] = None,
type: Optional[SynonymType] = None,
xrefs: Optional[Iterable[Xref]] = None,
) | return Synonym(self._ontology(), data) | Add a new synonym to the current entity.
Arguments:
description (`str`): The alternate definition of the entity, or a
related human-readable synonym.
scope (`str` or `None`): An optional synonym scope. Must be either
**EXACT**, **RELATED**, **BROAD** or *... | Add a new synonym to the current entity. | [
"Add",
"a",
"new",
"synonym",
"to",
"the",
"current",
"entity",
"."
] | def add_synonym(
self,
description: str,
scope: Optional[str] = None,
type: Optional[SynonymType] = None,
xrefs: Optional[Iterable[Xref]] = None,
) -> Synonym:
"""Add a new synonym to the current entity.
Arguments:
description (`str`): The alterna... | [
"def",
"add_synonym",
"(",
"self",
",",
"description",
":",
"str",
",",
"scope",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"type",
":",
"Optional",
"[",
"SynonymType",
"]",
"=",
"None",
",",
"xrefs",
":",
"Optional",
"[",
"Iterable",
"[",
"... | https://github.com/althonos/pronto/blob/6f778cd90b120a26e67eac2b94cc5b8694c4d517/pronto/entity/__init__.py#L510-L548 | |
scrapinghub/frontera | 84f9e1034d2868447db88e865596c0fbb32e70f6 | frontera/utils/url.py | python | parse_domain_from_url_fast | (url) | return result.netloc, result.hostname, result.scheme, "", "", "" | Extract domain info from a passed url, without analyzing subdomains and tld | Extract domain info from a passed url, without analyzing subdomains and tld | [
"Extract",
"domain",
"info",
"from",
"a",
"passed",
"url",
"without",
"analyzing",
"subdomains",
"and",
"tld"
] | def parse_domain_from_url_fast(url):
"""
Extract domain info from a passed url, without analyzing subdomains and tld
"""
result = parse_url(url)
return result.netloc, result.hostname, result.scheme, "", "", "" | [
"def",
"parse_domain_from_url_fast",
"(",
"url",
")",
":",
"result",
"=",
"parse_url",
"(",
"url",
")",
"return",
"result",
".",
"netloc",
",",
"result",
".",
"hostname",
",",
"result",
".",
"scheme",
",",
"\"\"",
",",
"\"\"",
",",
"\"\""
] | https://github.com/scrapinghub/frontera/blob/84f9e1034d2868447db88e865596c0fbb32e70f6/frontera/utils/url.py#L39-L44 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/idlelib/ColorDelegator.py | python | ColorDelegator.delete | (self, index1, index2=None) | [] | def delete(self, index1, index2=None):
index1 = self.index(index1)
self.delegate.delete(index1, index2)
self.notify_range(index1) | [
"def",
"delete",
"(",
"self",
",",
"index1",
",",
"index2",
"=",
"None",
")",
":",
"index1",
"=",
"self",
".",
"index",
"(",
"index1",
")",
"self",
".",
"delegate",
".",
"delete",
"(",
"index1",
",",
"index2",
")",
"self",
".",
"notify_range",
"(",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/idlelib/ColorDelegator.py#L83-L86 | ||||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/templates/SHARE/config.py | python | NeedResponseLineReportRepresent.__call__ | (self, record_ids) | return output | Represent record_ids (custom)
Args:
record_ids: need_response_line record IDs
Returns:
JSON-serializable dict {recordID: representation} | Represent record_ids (custom) | [
"Represent",
"record_ids",
"(",
"custom",
")"
] | def __call__(self, record_ids):
"""
Represent record_ids (custom)
Args:
record_ids: need_response_line record IDs
Returns:
JSON-serializable dict {recordID: representation}
"""
# Represent the location IDs
resource = ... | [
"def",
"__call__",
"(",
"self",
",",
"record_ids",
")",
":",
"# Represent the location IDs",
"resource",
"=",
"current",
".",
"s3db",
".",
"resource",
"(",
"\"need_response_line\"",
",",
"id",
"=",
"record_ids",
",",
")",
"rows",
"=",
"resource",
".",
"select"... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/SHARE/config.py#L2504-L2536 | |
google/yapf | b49a261870870e91fe693b1b871a4afbd7af7bd6 | yapf/yapflib/reformatter.py | python | _LineContainsPylintDisableLineTooLong | (line) | return re.search(r'\bpylint:\s+disable=line-too-long\b', line.last.value) | Return true if there is a "pylint: disable=line-too-long" comment. | Return true if there is a "pylint: disable=line-too-long" comment. | [
"Return",
"true",
"if",
"there",
"is",
"a",
"pylint",
":",
"disable",
"=",
"line",
"-",
"too",
"-",
"long",
"comment",
"."
] | def _LineContainsPylintDisableLineTooLong(line):
"""Return true if there is a "pylint: disable=line-too-long" comment."""
return re.search(r'\bpylint:\s+disable=line-too-long\b', line.last.value) | [
"def",
"_LineContainsPylintDisableLineTooLong",
"(",
"line",
")",
":",
"return",
"re",
".",
"search",
"(",
"r'\\bpylint:\\s+disable=line-too-long\\b'",
",",
"line",
".",
"last",
".",
"value",
")"
] | https://github.com/google/yapf/blob/b49a261870870e91fe693b1b871a4afbd7af7bd6/yapf/yapflib/reformatter.py#L232-L234 | |
largelymfs/topical_word_embeddings | 1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6 | TWE-3/gensim/corpora/indexedcorpus.py | python | IndexedCorpus.__init__ | (self, fname, index_fname=None) | Initialize this abstract base class, by loading a previously saved index
from `index_fname` (or `fname.index` if `index_fname` is not set).
This index will allow subclasses to support the `corpus[docno]` syntax
(random access to document #`docno` in O(1)).
>>> # save corpus in SvmLightC... | Initialize this abstract base class, by loading a previously saved index
from `index_fname` (or `fname.index` if `index_fname` is not set).
This index will allow subclasses to support the `corpus[docno]` syntax
(random access to document #`docno` in O(1)). | [
"Initialize",
"this",
"abstract",
"base",
"class",
"by",
"loading",
"a",
"previously",
"saved",
"index",
"from",
"index_fname",
"(",
"or",
"fname",
".",
"index",
"if",
"index_fname",
"is",
"not",
"set",
")",
".",
"This",
"index",
"will",
"allow",
"subclasses... | def __init__(self, fname, index_fname=None):
"""
Initialize this abstract base class, by loading a previously saved index
from `index_fname` (or `fname.index` if `index_fname` is not set).
This index will allow subclasses to support the `corpus[docno]` syntax
(random access to do... | [
"def",
"__init__",
"(",
"self",
",",
"fname",
",",
"index_fname",
"=",
"None",
")",
":",
"try",
":",
"if",
"index_fname",
"is",
"None",
":",
"index_fname",
"=",
"fname",
"+",
"'.index'",
"self",
".",
"index",
"=",
"utils",
".",
"unpickle",
"(",
"index_... | https://github.com/largelymfs/topical_word_embeddings/blob/1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6/TWE-3/gensim/corpora/indexedcorpus.py#L29-L52 | ||
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/qark/qark/lib/blessings/__init__.py | python | Terminal.location | (self, x=None, y=None) | Return a context manager for temporarily moving the cursor.
Move the cursor to a certain position on entry, let you print stuff
there, then return the cursor to its original position::
term = Terminal()
with term.location(2, 5):
print 'Hello, world!'
... | Return a context manager for temporarily moving the cursor. | [
"Return",
"a",
"context",
"manager",
"for",
"temporarily",
"moving",
"the",
"cursor",
"."
] | def location(self, x=None, y=None):
"""Return a context manager for temporarily moving the cursor.
Move the cursor to a certain position on entry, let you print stuff
there, then return the cursor to its original position::
term = Terminal()
with term.location(2, 5):
... | [
"def",
"location",
"(",
"self",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
")",
":",
"# Save position and move to the requested column, row, or both:",
"self",
".",
"stream",
".",
"write",
"(",
"self",
".",
"save",
")",
"if",
"x",
"is",
"not",
"None",
"... | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/qark/qark/lib/blessings/__init__.py#L244-L275 | ||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/returns/estimators.py | python | AdvantageEstimator._evaluate | (self) | return self.returns | Evaluate the estimator / return.
Returns:
torch.Tensor: the computed returns. | Evaluate the estimator / return. | [
"Evaluate",
"the",
"estimator",
"/",
"return",
"."
] | def _evaluate(self):
"""Evaluate the estimator / return.
Returns:
torch.Tensor: the computed returns.
"""
# get values from storage if present. If not, evaluate the value based on the states.
if self._value in self.storage:
values = self.storage[self._va... | [
"def",
"_evaluate",
"(",
"self",
")",
":",
"# get values from storage if present. If not, evaluate the value based on the states.",
"if",
"self",
".",
"_value",
"in",
"self",
".",
"storage",
":",
"values",
"=",
"self",
".",
"storage",
"[",
"self",
".",
"_value",
"]"... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/returns/estimators.py#L468-L503 | |
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/config/password_auth_providers.py | python | PasswordAuthProviderConfig.read_config | (self, config, **kwargs) | Parses the old password auth providers config. The config format looks like this:
password_providers:
# Example config for an LDAP auth provider
- module: "ldap_auth_provider.LdapAuthProvider"
config:
enabled: true
uri: "ldap://ldap.example.com:3... | Parses the old password auth providers config. The config format looks like this: | [
"Parses",
"the",
"old",
"password",
"auth",
"providers",
"config",
".",
"The",
"config",
"format",
"looks",
"like",
"this",
":"
] | def read_config(self, config, **kwargs):
"""Parses the old password auth providers config. The config format looks like this:
password_providers:
# Example config for an LDAP auth provider
- module: "ldap_auth_provider.LdapAuthProvider"
config:
enabled:... | [
"def",
"read_config",
"(",
"self",
",",
"config",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"password_providers",
":",
"List",
"[",
"Tuple",
"[",
"Type",
",",
"Any",
"]",
"]",
"=",
"[",
"]",
"providers",
"=",
"[",
"]",
"# We want to be backwards ... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/config/password_auth_providers.py#L27-L74 | ||
bmuller/kademlia | cf55e658cf4bb162041be8f9d465602723a387ad | kademlia/network.py | python | Server.save_state | (self, fname) | Save the state of this node (the alpha/ksize/id/immediate neighbors)
to a cache file with the given fname. | Save the state of this node (the alpha/ksize/id/immediate neighbors)
to a cache file with the given fname. | [
"Save",
"the",
"state",
"of",
"this",
"node",
"(",
"the",
"alpha",
"/",
"ksize",
"/",
"id",
"/",
"immediate",
"neighbors",
")",
"to",
"a",
"cache",
"file",
"with",
"the",
"given",
"fname",
"."
] | def save_state(self, fname):
"""
Save the state of this node (the alpha/ksize/id/immediate neighbors)
to a cache file with the given fname.
"""
log.info("Saving state to %s", fname)
data = {
'ksize': self.ksize,
'alpha': self.alpha,
'id... | [
"def",
"save_state",
"(",
"self",
",",
"fname",
")",
":",
"log",
".",
"info",
"(",
"\"Saving state to %s\"",
",",
"fname",
")",
"data",
"=",
"{",
"'ksize'",
":",
"self",
".",
"ksize",
",",
"'alpha'",
":",
"self",
".",
"alpha",
",",
"'id'",
":",
"self... | https://github.com/bmuller/kademlia/blob/cf55e658cf4bb162041be8f9d465602723a387ad/kademlia/network.py#L195-L211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.