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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/reminders/views.py | python | KeywordsListView.total | (self) | return Keyword.get_by_domain(self.domain).count() | [] | def total(self):
return Keyword.get_by_domain(self.domain).count() | [
"def",
"total",
"(",
"self",
")",
":",
"return",
"Keyword",
".",
"get_by_domain",
"(",
"self",
".",
"domain",
")",
".",
"count",
"(",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reminders/views.py#L272-L273 | |||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/extensions/interface.py | python | ExtensionPoint.extend | (self, impl=None, *, domains=None) | return _extend if impl is None else _extend(impl) | [] | def extend(self, impl=None, *, domains=None):
def _extend(impl):
if self.manager.locked:
raise ExtensionError(
"Late extension definition. Extensions must be defined before setup is complete"
)
if not callable(impl):
ra... | [
"def",
"extend",
"(",
"self",
",",
"impl",
"=",
"None",
",",
"*",
",",
"domains",
"=",
"None",
")",
":",
"def",
"_extend",
"(",
"impl",
")",
":",
"if",
"self",
".",
"manager",
".",
"locked",
":",
"raise",
"ExtensionError",
"(",
"\"Late extension defini... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/extensions/interface.py#L72-L90 | |||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/ota/admin.py | python | MobileRecoveryMeasureAdmin.save_model | (self, request, obj, form, change) | [] | def save_model(self, request, obj, form, change):
obj.username = request.user.username
super(MobileRecoveryMeasureAdmin, self).save_model(request, obj, form, change)
get_recovery_measures_cached.clear(obj.domain, obj.app_id) | [
"def",
"save_model",
"(",
"self",
",",
"request",
",",
"obj",
",",
"form",
",",
"change",
")",
":",
"obj",
".",
"username",
"=",
"request",
".",
"user",
".",
"username",
"super",
"(",
"MobileRecoveryMeasureAdmin",
",",
"self",
")",
".",
"save_model",
"("... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/ota/admin.py#L61-L64 | ||||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/symtable.py | python | Symbol.is_free | (self) | return bool(self.__scope == FREE) | Return *True* if a referenced symbol is
not assigned to. | Return *True* if a referenced symbol is
not assigned to. | [
"Return",
"*",
"True",
"*",
"if",
"a",
"referenced",
"symbol",
"is",
"not",
"assigned",
"to",
"."
] | def is_free(self):
"""Return *True* if a referenced symbol is
not assigned to.
"""
return bool(self.__scope == FREE) | [
"def",
"is_free",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"__scope",
"==",
"FREE",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/symtable.py#L273-L277 | |
Autodesk/molecular-design-toolkit | 5f45a47fea21d3603899a6366cb163024f0e2ec4 | moldesign/interfaces/openmm.py | python | topology_to_mol | (topo, name=None, positions=None, velocities=None, assign_bond_orders=True) | return newmol | Convert an OpenMM topology object into an MDT molecule.
Args:
topo (simtk.openmm.app.topology.Topology): topology to convert
name (str): name to assign to molecule
positions (list): simtk list of atomic positions
velocities (list): simtk list of atomic velocities
assign_bond... | Convert an OpenMM topology object into an MDT molecule. | [
"Convert",
"an",
"OpenMM",
"topology",
"object",
"into",
"an",
"MDT",
"molecule",
"."
] | def topology_to_mol(topo, name=None, positions=None, velocities=None, assign_bond_orders=True):
""" Convert an OpenMM topology object into an MDT molecule.
Args:
topo (simtk.openmm.app.topology.Topology): topology to convert
name (str): name to assign to molecule
positions (list): simtk... | [
"def",
"topology_to_mol",
"(",
"topo",
",",
"name",
"=",
"None",
",",
"positions",
"=",
"None",
",",
"velocities",
"=",
"None",
",",
"assign_bond_orders",
"=",
"True",
")",
":",
"from",
"simtk",
"import",
"unit",
"as",
"stku",
"# Atoms",
"atommap",
"=",
... | https://github.com/Autodesk/molecular-design-toolkit/blob/5f45a47fea21d3603899a6366cb163024f0e2ec4/moldesign/interfaces/openmm.py#L223-L302 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/mlab.py | python | ispower2 | (n) | Returns the log base 2 of *n* if *n* is a power of 2, zero otherwise.
Note the potential ambiguity if *n* == 1: 2**0 == 1, interpret accordingly. | Returns the log base 2 of *n* if *n* is a power of 2, zero otherwise. | [
"Returns",
"the",
"log",
"base",
"2",
"of",
"*",
"n",
"*",
"if",
"*",
"n",
"*",
"is",
"a",
"power",
"of",
"2",
"zero",
"otherwise",
"."
] | def ispower2(n):
"""
Returns the log base 2 of *n* if *n* is a power of 2, zero otherwise.
Note the potential ambiguity if *n* == 1: 2**0 == 1, interpret accordingly.
"""
bin_n = binary_repr(n)[1:]
if '1' in bin_n:
return 0
else:
return len(bin_n) | [
"def",
"ispower2",
"(",
"n",
")",
":",
"bin_n",
"=",
"binary_repr",
"(",
"n",
")",
"[",
"1",
":",
"]",
"if",
"'1'",
"in",
"bin_n",
":",
"return",
"0",
"else",
":",
"return",
"len",
"(",
"bin_n",
")"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/mlab.py#L2263-L2274 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_replication_controller.py | python | V1ReplicationController.kind | (self, kind) | Sets the kind of this V1ReplicationController.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#typ... | Sets the kind of this V1ReplicationController.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#typ... | [
"Sets",
"the",
"kind",
"of",
"this",
"V1ReplicationController",
".",
"Kind",
"is",
"a",
"string",
"value",
"representing",
"the",
"REST",
"resource",
"this",
"object",
"represents",
".",
"Servers",
"may",
"infer",
"this",
"from",
"the",
"endpoint",
"the",
"cli... | def kind(self, kind):
"""
Sets the kind of this V1ReplicationController.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community... | [
"def",
"kind",
"(",
"self",
",",
"kind",
")",
":",
"self",
".",
"_kind",
"=",
"kind"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_replication_controller.py#L90-L99 | ||
earthgecko/skyline | 12754424de72593e29eb21009fb1ae3f07f3abff | skyline/analyzer_dev/analyzer_dev.py | python | AnalyzerDev.spawn_alerter_process | (self, alert, metric, context) | Spawn a process to trigger an alert.
This is used by smtp alerters so that matplotlib objects are cleared
down and the alerter cannot create a memory leak in this manner and
plt.savefig keeps the object in memory until the process terminates.
Seeing as data is being surfaced and process... | Spawn a process to trigger an alert. | [
"Spawn",
"a",
"process",
"to",
"trigger",
"an",
"alert",
"."
] | def spawn_alerter_process(self, alert, metric, context):
"""
Spawn a process to trigger an alert.
This is used by smtp alerters so that matplotlib objects are cleared
down and the alerter cannot create a memory leak in this manner and
plt.savefig keeps the object in memory until... | [
"def",
"spawn_alerter_process",
"(",
"self",
",",
"alert",
",",
"metric",
",",
"context",
")",
":",
"trigger_alert",
"(",
"alert",
",",
"metric",
",",
"context",
")"
] | https://github.com/earthgecko/skyline/blob/12754424de72593e29eb21009fb1ae3f07f3abff/skyline/analyzer_dev/analyzer_dev.py#L138-L159 | ||
vmware-archive/vsphere-storage-for-docker | 96d2ce72457047af4ef05cb0a8794cf623803865 | esx_service/utils/threadutils.py | python | get_local_storage | () | return threading.local() | Return a thread local storage object | Return a thread local storage object | [
"Return",
"a",
"thread",
"local",
"storage",
"object"
] | def get_local_storage():
"""Return a thread local storage object"""
return threading.local() | [
"def",
"get_local_storage",
"(",
")",
":",
"return",
"threading",
".",
"local",
"(",
")"
] | https://github.com/vmware-archive/vsphere-storage-for-docker/blob/96d2ce72457047af4ef05cb0a8794cf623803865/esx_service/utils/threadutils.py#L111-L113 | |
unknown-horizons/unknown-horizons | 7397fb333006d26c3d9fe796c7bd9cb8c3b43a49 | horizons/network/networkinterface.py | python | NetworkInterface.network_data_changed | (self) | Call in case constants like client address or client port changed.
@throws RuntimeError in case of invalid data or an NetworkException forwarded from connect | Call in case constants like client address or client port changed. | [
"Call",
"in",
"case",
"constants",
"like",
"client",
"address",
"or",
"client",
"port",
"changed",
"."
] | def network_data_changed(self):
"""Call in case constants like client address or client port changed.
@throws RuntimeError in case of invalid data or an NetworkException forwarded from connect
"""
if self.is_connected:
self.disconnect()
self._setup_client() | [
"def",
"network_data_changed",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_connected",
":",
"self",
".",
"disconnect",
"(",
")",
"self",
".",
"_setup_client",
"(",
")"
] | https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/network/networkinterface.py#L154-L161 | ||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/storage/memory_mixins/paged_memory/pages/cooperation.py | python | CooperationBase._zero_objects | (cls, addr, size, **kwargs) | Like decompose objects, but with a size to zero-fill instead of explicit data | Like decompose objects, but with a size to zero-fill instead of explicit data | [
"Like",
"decompose",
"objects",
"but",
"with",
"a",
"size",
"to",
"zero",
"-",
"fill",
"instead",
"of",
"explicit",
"data"
] | def _zero_objects(cls, addr, size, **kwargs):
"""
Like decompose objects, but with a size to zero-fill instead of explicit data
"""
pass | [
"def",
"_zero_objects",
"(",
"cls",
",",
"addr",
",",
"size",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/storage/memory_mixins/paged_memory/pages/cooperation.py#L29-L33 | ||
codeforamerica/glossary-bot | 98bfac31e6878e6ac9293682c79f6dddc301472c | migrations/env.py | python | run_migrations_online | () | Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context. | Run migrations in 'online' mode. | [
"Run",
"migrations",
"in",
"online",
"mode",
"."
] | def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
engine = engine_from_config(
config.get_section(config.config_ini_section),
prefix='sqlalchemy.',
... | [
"def",
"run_migrations_online",
"(",
")",
":",
"engine",
"=",
"engine_from_config",
"(",
"config",
".",
"get_section",
"(",
"config",
".",
"config_ini_section",
")",
",",
"prefix",
"=",
"'sqlalchemy.'",
",",
"poolclass",
"=",
"pool",
".",
"NullPool",
")",
"con... | https://github.com/codeforamerica/glossary-bot/blob/98bfac31e6878e6ac9293682c79f6dddc301472c/migrations/env.py#L45-L67 | ||
Emptyset110/dHydra | 8ec44994ff4dda8bf1ec40e38dd068b757945933 | dHydra/Worker/Web/Web.py | python | Web.__init__ | (self, port=5000, **kwargs) | [] | def __init__(self, port=5000, **kwargs):
super().__init__(**kwargs) # You ae not supposed to change THIS
self.port = port | [
"def",
"__init__",
"(",
"self",
",",
"port",
"=",
"5000",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")",
"# You ae not supposed to change THIS",
"self",
".",
"port",
"=",
"port"
] | https://github.com/Emptyset110/dHydra/blob/8ec44994ff4dda8bf1ec40e38dd068b757945933/dHydra/Worker/Web/Web.py#L6-L8 | ||||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/core/files/uploadhandler.py | python | TemporaryFileUploadHandler.new_file | (self, file_name, *args, **kwargs) | Create the file object to append to as data is coming in. | Create the file object to append to as data is coming in. | [
"Create",
"the",
"file",
"object",
"to",
"append",
"to",
"as",
"data",
"is",
"coming",
"in",
"."
] | def new_file(self, file_name, *args, **kwargs):
"""
Create the file object to append to as data is coming in.
"""
super(TemporaryFileUploadHandler, self).new_file(file_name, *args, **kwargs)
self.file = TemporaryUploadedFile(self.file_name, self.content_type, 0, self.charset) | [
"def",
"new_file",
"(",
"self",
",",
"file_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"TemporaryFileUploadHandler",
",",
"self",
")",
".",
"new_file",
"(",
"file_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"s... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/core/files/uploadhandler.py#L130-L135 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/pkg_resources/__init__.py | python | MarkerEvaluation.evaluate_marker | (cls, text, extra=None) | return cls.interpret(parser.expr(text).totuple(1)[1]) | Evaluate a PEP 426 environment marker on CPython 2.4+.
Return a boolean indicating the marker result in this environment.
Raise SyntaxError if marker is invalid.
This implementation uses the 'parser' module, which is not implemented
on
Jython and has been superseded by the 'ast'... | Evaluate a PEP 426 environment marker on CPython 2.4+.
Return a boolean indicating the marker result in this environment.
Raise SyntaxError if marker is invalid. | [
"Evaluate",
"a",
"PEP",
"426",
"environment",
"marker",
"on",
"CPython",
"2",
".",
"4",
"+",
".",
"Return",
"a",
"boolean",
"indicating",
"the",
"marker",
"result",
"in",
"this",
"environment",
".",
"Raise",
"SyntaxError",
"if",
"marker",
"is",
"invalid",
... | def evaluate_marker(cls, text, extra=None):
"""
Evaluate a PEP 426 environment marker on CPython 2.4+.
Return a boolean indicating the marker result in this environment.
Raise SyntaxError if marker is invalid.
This implementation uses the 'parser' module, which is not implemente... | [
"def",
"evaluate_marker",
"(",
"cls",
",",
"text",
",",
"extra",
"=",
"None",
")",
":",
"return",
"cls",
".",
"interpret",
"(",
"parser",
".",
"expr",
"(",
"text",
")",
".",
"totuple",
"(",
"1",
")",
"[",
"1",
"]",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/pkg_resources/__init__.py#L1500-L1511 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/mailbox.py | python | _singlefileMailbox.flush | (self) | Write any pending changes to disk. | Write any pending changes to disk. | [
"Write",
"any",
"pending",
"changes",
"to",
"disk",
"."
] | def flush(self):
"""Write any pending changes to disk."""
if not self._pending:
if self._pending_sync:
# Messages have only been added, so syncing the file
# is enough.
_sync_flush(self._file)
self._pending_sync = False
... | [
"def",
"flush",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_pending",
":",
"if",
"self",
".",
"_pending_sync",
":",
"# Messages have only been added, so syncing the file",
"# is enough.",
"_sync_flush",
"(",
"self",
".",
"_file",
")",
"self",
".",
"_pendi... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/mailbox.py#L640-L706 | ||
cortex-lab/phy | 9a330b9437a3d0b40a37a201d147224e6e7fb462 | phy/plot/gloo/texture.py | python | TextureCube._deactivate | (self) | Deactivate texture on GPU | Deactivate texture on GPU | [
"Deactivate",
"texture",
"on",
"GPU"
] | def _deactivate(self):
""" Deactivate texture on GPU """
log.log(5, "GPU: Deactivate texture cube")
gl.glBindTexture(self._target, 0)
gl.glDisable(gl.GL_TEXTURE_CUBE_MAP) | [
"def",
"_deactivate",
"(",
"self",
")",
":",
"log",
".",
"log",
"(",
"5",
",",
"\"GPU: Deactivate texture cube\"",
")",
"gl",
".",
"glBindTexture",
"(",
"self",
".",
"_target",
",",
"0",
")",
"gl",
".",
"glDisable",
"(",
"gl",
".",
"GL_TEXTURE_CUBE_MAP",
... | https://github.com/cortex-lab/phy/blob/9a330b9437a3d0b40a37a201d147224e6e7fb462/phy/plot/gloo/texture.py#L463-L468 | ||
gaasedelen/lighthouse | 7245a2d2c4e84351cd259ed81dafa4263167909a | plugins/lighthouse/painting/painter.py | python | DatabasePainter._rebase_database | (self) | return True | Rebase the active database paint.
TODO/XXX: there may be some edgecases where painting can be wrong if
a rebase occurs while the painter is running. | Rebase the active database paint. | [
"Rebase",
"the",
"active",
"database",
"paint",
"."
] | def _rebase_database(self):
"""
Rebase the active database paint.
TODO/XXX: there may be some edgecases where painting can be wrong if
a rebase occurs while the painter is running.
"""
db_metadata = self.director.metadata
instructions = db_metadata.inst... | [
"def",
"_rebase_database",
"(",
"self",
")",
":",
"db_metadata",
"=",
"self",
".",
"director",
".",
"metadata",
"instructions",
"=",
"db_metadata",
".",
"instructions",
"nodes",
"=",
"viewvalues",
"(",
"db_metadata",
".",
"nodes",
")",
"# a rebase has not occurred... | https://github.com/gaasedelen/lighthouse/blob/7245a2d2c4e84351cd259ed81dafa4263167909a/plugins/lighthouse/painting/painter.py#L532-L556 | |
openstack/python-glanceclient | b4c3be8aac5a09a6d47b0168ddbd33a2a4298294 | glanceclient/v2/images.py | python | Controller.data | (self, image_id, do_checksum=True, allow_md5_fallback=False) | return utils.IterableWithLength(body, content_length), resp | Retrieve data of an image.
When do_checksum is enabled, validation proceeds as follows:
1. if the image has a 'os_hash_value' property, the algorithm
specified in the image's 'os_hash_algo' property will be used
to validate against the 'os_hash_value' value. If the
sp... | Retrieve data of an image. | [
"Retrieve",
"data",
"of",
"an",
"image",
"."
] | def data(self, image_id, do_checksum=True, allow_md5_fallback=False):
"""Retrieve data of an image.
When do_checksum is enabled, validation proceeds as follows:
1. if the image has a 'os_hash_value' property, the algorithm
specified in the image's 'os_hash_algo' property will be use... | [
"def",
"data",
"(",
"self",
",",
"image_id",
",",
"do_checksum",
"=",
"True",
",",
"allow_md5_fallback",
"=",
"False",
")",
":",
"if",
"do_checksum",
":",
"# doing this first to prevent race condition if image record",
"# is deleted during the image download",
"url",
"=",... | https://github.com/openstack/python-glanceclient/blob/b4c3be8aac5a09a6d47b0168ddbd33a2a4298294/glanceclient/v2/images.py#L219-L289 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/beat.py | python | Scheduler.__init__ | (self, app, schedule=None, max_interval=None,
Producer=None, lazy=False, sync_every_tasks=None, **kwargs) | [] | def __init__(self, app, schedule=None, max_interval=None,
Producer=None, lazy=False, sync_every_tasks=None, **kwargs):
self.app = app
self.data = maybe_evaluate({} if schedule is None else schedule)
self.max_interval = (max_interval or
app.conf.beat_... | [
"def",
"__init__",
"(",
"self",
",",
"app",
",",
"schedule",
"=",
"None",
",",
"max_interval",
"=",
"None",
",",
"Producer",
"=",
"None",
",",
"lazy",
"=",
"False",
",",
"sync_every_tasks",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/beat.py#L191-L204 | ||||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/_deprecate/frame.py | python | FrameRef.__contains__ | (self, name) | return name in self._frame | Return whether the column name exists. | Return whether the column name exists. | [
"Return",
"whether",
"the",
"column",
"name",
"exists",
"."
] | def __contains__(self, name):
"""Return whether the column name exists."""
return name in self._frame | [
"def",
"__contains__",
"(",
"self",
",",
"name",
")",
":",
"return",
"name",
"in",
"self",
".",
"_frame"
] | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/_deprecate/frame.py#L630-L632 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/contrib/sessions/backends/signed_cookies.py | python | SessionStore.delete | (self, session_key=None) | To delete, we clear the session key and the underlying data structure
and set the modified flag so that the cookie is set on the client for
the current request. | To delete, we clear the session key and the underlying data structure
and set the modified flag so that the cookie is set on the client for
the current request. | [
"To",
"delete",
"we",
"clear",
"the",
"session",
"key",
"and",
"the",
"underlying",
"data",
"structure",
"and",
"set",
"the",
"modified",
"flag",
"so",
"that",
"the",
"cookie",
"is",
"set",
"on",
"the",
"client",
"for",
"the",
"current",
"request",
"."
] | def delete(self, session_key=None):
"""
To delete, we clear the session key and the underlying data structure
and set the modified flag so that the cookie is set on the client for
the current request.
"""
self._session_key = ''
self._session_cache = {}
sel... | [
"def",
"delete",
"(",
"self",
",",
"session_key",
"=",
"None",
")",
":",
"self",
".",
"_session_key",
"=",
"''",
"self",
".",
"_session_cache",
"=",
"{",
"}",
"self",
".",
"modified",
"=",
"True"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/sessions/backends/signed_cookies.py#L65-L73 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/options.py | python | OptionParser.items | (self) | return [(opt.name, opt.value()) for name, opt in self._options.items()] | An iterable of (name, value) pairs.
.. versionadded:: 3.1 | An iterable of (name, value) pairs. | [
"An",
"iterable",
"of",
"(",
"name",
"value",
")",
"pairs",
"."
] | def items(self) -> Iterable[Tuple[str, Any]]:
"""An iterable of (name, value) pairs.
.. versionadded:: 3.1
"""
return [(opt.name, opt.value()) for name, opt in self._options.items()] | [
"def",
"items",
"(",
"self",
")",
"->",
"Iterable",
"[",
"Tuple",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"[",
"(",
"opt",
".",
"name",
",",
"opt",
".",
"value",
"(",
")",
")",
"for",
"name",
",",
"opt",
"in",
"self",
".",
"_options",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/options.py#L166-L171 | |
gwpy/gwpy | 82becd78d166a32985cb657a54d0d39f6a207739 | gwpy/utils/sphinx/ex2rst.py | python | create_parser | () | return parser | [] | def create_parser():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"infile",
type=Path,
metavar="example.py",
help="python file to convert",
)
parser.add_argument(
"outfile",
type=Path,
metavar="example.rst",
na... | [
"def",
"create_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
")",
"parser",
".",
"add_argument",
"(",
"\"infile\"",
",",
"type",
"=",
"Path",
",",
"metavar",
"=",
"\"example.py\"",
",",
"help",
... | https://github.com/gwpy/gwpy/blob/82becd78d166a32985cb657a54d0d39f6a207739/gwpy/utils/sphinx/ex2rst.py#L143-L158 | |||
projectatomic/atomicapp | fba5cbb0a42b79418ac85ab93036a4404b92a431 | atomicapp/utils.py | python | Utils.getUserHome | () | return home | Finds the home directory of the user running the application.
If runnning within a container, the root dir must be passed as
a volume.
Ex. docker run -v /:/host -e SUDO_USER -e USER foobar | Finds the home directory of the user running the application.
If runnning within a container, the root dir must be passed as
a volume.
Ex. docker run -v /:/host -e SUDO_USER -e USER foobar | [
"Finds",
"the",
"home",
"directory",
"of",
"the",
"user",
"running",
"the",
"application",
".",
"If",
"runnning",
"within",
"a",
"container",
"the",
"root",
"dir",
"must",
"be",
"passed",
"as",
"a",
"volume",
".",
"Ex",
".",
"docker",
"run",
"-",
"v",
... | def getUserHome():
"""
Finds the home directory of the user running the application.
If runnning within a container, the root dir must be passed as
a volume.
Ex. docker run -v /:/host -e SUDO_USER -e USER foobar
"""
logger.debug("Finding the users home directory")... | [
"def",
"getUserHome",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"\"Finding the users home directory\"",
")",
"user",
"=",
"Utils",
".",
"getUserName",
"(",
")",
"incontainer",
"=",
"Utils",
".",
"inContainer",
"(",
")",
"# Check to see if we are running in a conta... | https://github.com/projectatomic/atomicapp/blob/fba5cbb0a42b79418ac85ab93036a4404b92a431/atomicapp/utils.py#L458-L488 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/compat/_inspect.py | python | getargs | (co) | return args, varargs, varkw | Get information about the arguments accepted by a code object.
Three things are returned: (args, varargs, varkw), where 'args' is
a list of argument names (possibly containing nested lists), and
'varargs' and 'varkw' are the names of the * and ** arguments or None. | Get information about the arguments accepted by a code object. | [
"Get",
"information",
"about",
"the",
"arguments",
"accepted",
"by",
"a",
"code",
"object",
"."
] | def getargs(co):
"""Get information about the arguments accepted by a code object.
Three things are returned: (args, varargs, varkw), where 'args' is
a list of argument names (possibly containing nested lists), and
'varargs' and 'varkw' are the names of the * and ** arguments or None.
"""
if ... | [
"def",
"getargs",
"(",
"co",
")",
":",
"if",
"not",
"iscode",
"(",
"co",
")",
":",
"raise",
"TypeError",
"(",
"'arg is not a code object'",
")",
"nargs",
"=",
"co",
".",
"co_argcount",
"names",
"=",
"co",
".",
"co_varnames",
"args",
"=",
"list",
"(",
"... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/compat/_inspect.py#L67-L96 | |
nosmokingbandit/Watcher3 | 0217e75158b563bdefc8e01c3be7620008cf3977 | core/searchresults.py | python | import_quality | () | return profile | Creates quality profile for imported releases
Creates import profile that mimics the base profile, but it incapable
of removing releases.
Returns dict | Creates quality profile for imported releases | [
"Creates",
"quality",
"profile",
"for",
"imported",
"releases"
] | def import_quality():
''' Creates quality profile for imported releases
Creates import profile that mimics the base profile, but it incapable
of removing releases.
Returns dict
'''
profile = core.config.base_profile
profile['ignoredwords'] = ''
profile['requiredwords'] = ''
f... | [
"def",
"import_quality",
"(",
")",
":",
"profile",
"=",
"core",
".",
"config",
".",
"base_profile",
"profile",
"[",
"'ignoredwords'",
"]",
"=",
"''",
"profile",
"[",
"'requiredwords'",
"]",
"=",
"''",
"for",
"i",
"in",
"profile",
"[",
"'Sources'",
"]",
"... | https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/core/searchresults.py#L419-L435 | |
Blueqat/Blueqat | b676f30489b71767419fd20503403d290d4950b5 | blueqat/circuit.py | python | _GateWrapper.__str__ | (self) | return self.op_type.lowername + args_str | [] | def __str__(self) -> str:
if self.params:
args_str = str(self.params)
else:
args_str = ""
if self.options:
args_str += str(self.options)
return self.op_type.lowername + args_str | [
"def",
"__str__",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"params",
":",
"args_str",
"=",
"str",
"(",
"self",
".",
"params",
")",
"else",
":",
"args_str",
"=",
"\"\"",
"if",
"self",
".",
"options",
":",
"args_str",
"+=",
"str",
"(",
... | https://github.com/Blueqat/Blueqat/blob/b676f30489b71767419fd20503403d290d4950b5/blueqat/circuit.py#L261-L268 | |||
xingyizhou/CenterNet | 2b7692c377c6686fb35e473dac2de6105eed62c6 | src/tools/voc_eval_lib/datasets/pascal_voc.py | python | pascal_voc.gt_roidb | (self) | return gt_roidb | Return the database of ground-truth regions of interest.
This function loads/saves from/to a cache file to speed up future calls. | Return the database of ground-truth regions of interest. | [
"Return",
"the",
"database",
"of",
"ground",
"-",
"truth",
"regions",
"of",
"interest",
"."
] | def gt_roidb(self):
"""
Return the database of ground-truth regions of interest.
This function loads/saves from/to a cache file to speed up future calls.
"""
cache_file = os.path.join(self.cache_path, self.name + '_gt_roidb.pkl')
if os.path.exists(cache_file):
with open(cache_file, 'rb') ... | [
"def",
"gt_roidb",
"(",
"self",
")",
":",
"cache_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"cache_path",
",",
"self",
".",
"name",
"+",
"'_gt_roidb.pkl'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"cache_file",
")",
":",
... | https://github.com/xingyizhou/CenterNet/blob/2b7692c377c6686fb35e473dac2de6105eed62c6/src/tools/voc_eval_lib/datasets/pascal_voc.py#L98-L120 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | redisdb/datadog_checks/redisdb/config_models/defaults.py | python | instance_min_collection_interval | (field, value) | return 15 | [] | def instance_min_collection_interval(field, value):
return 15 | [
"def",
"instance_min_collection_interval",
"(",
"field",
",",
"value",
")",
":",
"return",
"15"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/redisdb/datadog_checks/redisdb/config_models/defaults.py#L45-L46 | |||
yaksok/yaksok | 73f14863d04f054eef2926f25a091f72f60352a5 | yaksok/yacc.py | python | p_logic_or_expr | (t) | logic_or_expr : logic_or_expr OR logic_and_expr
| logic_and_expr | logic_or_expr : logic_or_expr OR logic_and_expr
| logic_and_expr | [
"logic_or_expr",
":",
"logic_or_expr",
"OR",
"logic_and_expr",
"|",
"logic_and_expr"
] | def p_logic_or_expr(t):
'''logic_or_expr : logic_or_expr OR logic_and_expr
| logic_and_expr'''
if len(t) == 4:
if isinstance(t[1], ast.BoolOp) and isinstance(t[1].op, ast.Or):
t[0] = t[1]
t[0].values.append(t[3])
else:
or_ast = ast.Or()
... | [
"def",
"p_logic_or_expr",
"(",
"t",
")",
":",
"if",
"len",
"(",
"t",
")",
"==",
"4",
":",
"if",
"isinstance",
"(",
"t",
"[",
"1",
"]",
",",
"ast",
".",
"BoolOp",
")",
"and",
"isinstance",
"(",
"t",
"[",
"1",
"]",
".",
"op",
",",
"ast",
".",
... | https://github.com/yaksok/yaksok/blob/73f14863d04f054eef2926f25a091f72f60352a5/yaksok/yacc.py#L475-L490 | ||
robhagemans/pcbasic | c3a043b46af66623a801e18a38175be077251ada | pcbasic/basic/machine.py | python | Memory.def_usr_ | (self, args) | DEF USR: Define machine language function. | DEF USR: Define machine language function. | [
"DEF",
"USR",
":",
"Define",
"machine",
"language",
"function",
"."
] | def def_usr_(self, args):
"""DEF USR: Define machine language function."""
usr, addr = args
addr = values.to_integer(addr, unsigned=True)
logging.warning('DEF USR statement not implemented') | [
"def",
"def_usr_",
"(",
"self",
",",
"args",
")",
":",
"usr",
",",
"addr",
"=",
"args",
"addr",
"=",
"values",
".",
"to_integer",
"(",
"addr",
",",
"unsigned",
"=",
"True",
")",
"logging",
".",
"warning",
"(",
"'DEF USR statement not implemented'",
")"
] | https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/machine.py#L394-L398 | ||
tav/pylibs | 3c16b843681f54130ee6a022275289cadb2f2a69 | docutils/parsers/rst/directives/__init__.py | python | choice | (argument, values) | Directive option utility function, supplied to enable options whose
argument must be a member of a finite set of possible values (must be
lower case). A custom conversion function must be written to use it. For
example::
from docutils.parsers.rst import directives
def yesno(argument):
... | Directive option utility function, supplied to enable options whose
argument must be a member of a finite set of possible values (must be
lower case). A custom conversion function must be written to use it. For
example:: | [
"Directive",
"option",
"utility",
"function",
"supplied",
"to",
"enable",
"options",
"whose",
"argument",
"must",
"be",
"a",
"member",
"of",
"a",
"finite",
"set",
"of",
"possible",
"values",
"(",
"must",
"be",
"lower",
"case",
")",
".",
"A",
"custom",
"con... | def choice(argument, values):
"""
Directive option utility function, supplied to enable options whose
argument must be a member of a finite set of possible values (must be
lower case). A custom conversion function must be written to use it. For
example::
from docutils.parsers.rst import d... | [
"def",
"choice",
"(",
"argument",
",",
"values",
")",
":",
"try",
":",
"value",
"=",
"argument",
".",
"lower",
"(",
")",
".",
"strip",
"(",
")",
"except",
"AttributeError",
":",
"raise",
"ValueError",
"(",
"'must supply an argument; choose from %s'",
"%",
"f... | https://github.com/tav/pylibs/blob/3c16b843681f54130ee6a022275289cadb2f2a69/docutils/parsers/rst/directives/__init__.py#L367-L391 | ||
sdaps/sdaps | 51d1072185223f5e48512661e2c1e8399d63e876 | sdaps/gui/widget_buddies.py | python | QObject.make_heading | (self, title) | return vbox | [] | def make_heading(self, title):
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
vbox.set_margin_top(12)
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
label = Gtk.Label()
label.set_markup('<b>%s %s</b>' % (self.obj.id_str(), markup_escape_text(title)))
label.s... | [
"def",
"make_heading",
"(",
"self",
",",
"title",
")",
":",
"vbox",
"=",
"Gtk",
".",
"Box",
"(",
"orientation",
"=",
"Gtk",
".",
"Orientation",
".",
"VERTICAL",
")",
"vbox",
".",
"set_margin_top",
"(",
"12",
")",
"hbox",
"=",
"Gtk",
".",
"Box",
"(",
... | https://github.com/sdaps/sdaps/blob/51d1072185223f5e48512661e2c1e8399d63e876/sdaps/gui/widget_buddies.py#L163-L198 | |||
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | src/Song.py | python | Song.userLongDescription | (self) | [] | def userLongDescription(self):
data = dict(self.metadata)
mainKeys = ["artist","title"]
for key in mainKeys:
data[key] = data.get(key, "").strip()
# TODO ...
data = sorted() | [
"def",
"userLongDescription",
"(",
"self",
")",
":",
"data",
"=",
"dict",
"(",
"self",
".",
"metadata",
")",
"mainKeys",
"=",
"[",
"\"artist\"",
",",
"\"title\"",
"]",
"for",
"key",
"in",
"mainKeys",
":",
"data",
"[",
"key",
"]",
"=",
"data",
".",
"g... | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/src/Song.py#L253-L259 | ||||
Epistimio/orion | 732e739d99561020dbe620760acf062ade746006 | src/orion/storage/base.py | python | BaseStorageProtocol.retrieve_result | (self, trial, *args, **kwargs) | Fetch the result from a given medium (file, db, socket, etc..) for a given trial and
insert it into the trial object | Fetch the result from a given medium (file, db, socket, etc..) for a given trial and
insert it into the trial object | [
"Fetch",
"the",
"result",
"from",
"a",
"given",
"medium",
"(",
"file",
"db",
"socket",
"etc",
"..",
")",
"for",
"a",
"given",
"trial",
"and",
"insert",
"it",
"into",
"the",
"trial",
"object"
] | def retrieve_result(self, trial, *args, **kwargs):
"""Fetch the result from a given medium (file, db, socket, etc..) for a given trial and
insert it into the trial object
"""
raise NotImplementedError() | [
"def",
"retrieve_result",
"(",
"self",
",",
"trial",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/Epistimio/orion/blob/732e739d99561020dbe620760acf062ade746006/src/orion/storage/base.py#L317-L321 | ||
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/orm/nodes/node.py | python | Node.store | (self, with_transaction: bool = True) | return self | Store the node in the database while saving its attributes and repository directory.
After being called attributes cannot be changed anymore! Instead, extras can be changed only AFTER calling
this store() function.
:note: After successful storage, those links that are in the cache, and for whi... | Store the node in the database while saving its attributes and repository directory. | [
"Store",
"the",
"node",
"in",
"the",
"database",
"while",
"saving",
"its",
"attributes",
"and",
"repository",
"directory",
"."
] | def store(self, with_transaction: bool = True) -> 'Node': # pylint: disable=arguments-differ
"""Store the node in the database while saving its attributes and repository directory.
After being called attributes cannot be changed anymore! Instead, extras can be changed only AFTER calling
this s... | [
"def",
"store",
"(",
"self",
",",
"with_transaction",
":",
"bool",
"=",
"True",
")",
"->",
"'Node'",
":",
"# pylint: disable=arguments-differ",
"from",
"aiida",
".",
"manage",
".",
"caching",
"import",
"get_use_cache",
"if",
"not",
"self",
".",
"is_stored",
":... | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/nodes/node.py#L682-L724 | |
maoschanz/drawing | d4a69258570c7a120817484eaadac1145dedb62d | src/optionsbars/classic/optionsbar_color_popover.py | python | OptionsBarClassicColorPopover._update_nav_box | (self, *args) | Update the visibility of navigation controls ('back to the palette'
and 'always use this editor'). | Update the visibility of navigation controls ('back to the palette'
and 'always use this editor'). | [
"Update",
"the",
"visibility",
"of",
"navigation",
"controls",
"(",
"back",
"to",
"the",
"palette",
"and",
"always",
"use",
"this",
"editor",
")",
"."
] | def _update_nav_box(self, *args):
"""Update the visibility of navigation controls ('back to the palette'
and 'always use this editor')."""
self.editor_box.set_visible(self.color_widget.props.show_editor) | [
"def",
"_update_nav_box",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"editor_box",
".",
"set_visible",
"(",
"self",
".",
"color_widget",
".",
"props",
".",
"show_editor",
")"
] | https://github.com/maoschanz/drawing/blob/d4a69258570c7a120817484eaadac1145dedb62d/src/optionsbars/classic/optionsbar_color_popover.py#L255-L258 | ||
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | write_tinfo_bitfield_value | (*args) | return _idaapi.write_tinfo_bitfield_value(*args) | write_tinfo_bitfield_value(typid, dst, v, bitoff) -> uint64 | write_tinfo_bitfield_value(typid, dst, v, bitoff) -> uint64 | [
"write_tinfo_bitfield_value",
"(",
"typid",
"dst",
"v",
"bitoff",
")",
"-",
">",
"uint64"
] | def write_tinfo_bitfield_value(*args):
"""
write_tinfo_bitfield_value(typid, dst, v, bitoff) -> uint64
"""
return _idaapi.write_tinfo_bitfield_value(*args) | [
"def",
"write_tinfo_bitfield_value",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"write_tinfo_bitfield_value",
"(",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L29991-L29995 | |
tdryer/hangups | f0b37be1d46e71b30337227d7c46192cc726dcb4 | hangups/client.py | python | Client.remove_user | (self, remove_user_request) | return response | Remove a participant from a group conversation. | Remove a participant from a group conversation. | [
"Remove",
"a",
"participant",
"from",
"a",
"group",
"conversation",
"."
] | async def remove_user(self, remove_user_request):
"""Remove a participant from a group conversation."""
response = hangouts_pb2.RemoveUserResponse()
await self._pb_request('conversations/removeuser',
remove_user_request, response)
return response | [
"async",
"def",
"remove_user",
"(",
"self",
",",
"remove_user_request",
")",
":",
"response",
"=",
"hangouts_pb2",
".",
"RemoveUserResponse",
"(",
")",
"await",
"self",
".",
"_pb_request",
"(",
"'conversations/removeuser'",
",",
"remove_user_request",
",",
"response... | https://github.com/tdryer/hangups/blob/f0b37be1d46e71b30337227d7c46192cc726dcb4/hangups/client.py#L563-L568 | |
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | py3.2/multiprocess/sharedctypes.py | python | Value | (typecode_or_type, *args, lock=None) | return synchronized(obj, lock) | Return a synchronization wrapper for a Value | Return a synchronization wrapper for a Value | [
"Return",
"a",
"synchronization",
"wrapper",
"for",
"a",
"Value"
] | def Value(typecode_or_type, *args, lock=None):
'''
Return a synchronization wrapper for a Value
'''
obj = RawValue(typecode_or_type, *args)
if lock is False:
return obj
if lock in (True, None):
lock = RLock()
if not hasattr(lock, 'acquire'):
raise AttributeError("'%r'... | [
"def",
"Value",
"(",
"typecode_or_type",
",",
"*",
"args",
",",
"lock",
"=",
"None",
")",
":",
"obj",
"=",
"RawValue",
"(",
"typecode_or_type",
",",
"*",
"args",
")",
"if",
"lock",
"is",
"False",
":",
"return",
"obj",
"if",
"lock",
"in",
"(",
"True",... | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.2/multiprocess/sharedctypes.py#L92-L103 | |
click-contrib/click-completion | 5d665333536cf9f4ae1146729142aba53be9817d | click_completion/lib.py | python | double_quote | (s) | return '"' + s.replace('"', '"\'"\'"') + '"' | Escape a string with double quotes in order to be parsed as a single element by shlex
Parameters
----------
s : str
The string to quote
Returns
-------
str
The quoted string | Escape a string with double quotes in order to be parsed as a single element by shlex | [
"Escape",
"a",
"string",
"with",
"double",
"quotes",
"in",
"order",
"to",
"be",
"parsed",
"as",
"a",
"single",
"element",
"by",
"shlex"
] | def double_quote(s):
"""Escape a string with double quotes in order to be parsed as a single element by shlex
Parameters
----------
s : str
The string to quote
Returns
-------
str
The quoted string
"""
if not s:
return '""'
if find_unsafe(s) is None:
... | [
"def",
"double_quote",
"(",
"s",
")",
":",
"if",
"not",
"s",
":",
"return",
"'\"\"'",
"if",
"find_unsafe",
"(",
"s",
")",
"is",
"None",
":",
"return",
"s",
"# use double quotes, and put double quotes into single quotes",
"# the string $\"b is then quoted as \"$\"'\"'\"b... | https://github.com/click-contrib/click-completion/blob/5d665333536cf9f4ae1146729142aba53be9817d/click_completion/lib.py#L39-L59 | |
Perlence/PyGuitarPro | e599b1c1c483e16eb158affd3c7097c514e5642b | guitarpro/gp3.py | python | GP3File.toStrokeValue | (self, value) | Unpack stroke value.
Stroke value maps to:
- *1*: hundred twenty-eighth
- *2*: sixty-fourth
- *3*: thirty-second
- *4*: sixteenth
- *5*: eighth
- *6*: quarter | Unpack stroke value. | [
"Unpack",
"stroke",
"value",
"."
] | def toStrokeValue(self, value):
"""Unpack stroke value.
Stroke value maps to:
- *1*: hundred twenty-eighth
- *2*: sixty-fourth
- *3*: thirty-second
- *4*: sixteenth
- *5*: eighth
- *6*: quarter
"""
if value == 1:
return gp.Dur... | [
"def",
"toStrokeValue",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"==",
"1",
":",
"return",
"gp",
".",
"Duration",
".",
"hundredTwentyEighth",
"elif",
"value",
"==",
"2",
":",
"return",
"gp",
".",
"Duration",
".",
"sixtyFourth",
"elif",
"value"... | https://github.com/Perlence/PyGuitarPro/blob/e599b1c1c483e16eb158affd3c7097c514e5642b/guitarpro/gp3.py#L736-L761 | ||
karanchahal/distiller | a17ec06cbeafcdd2aea19d7c7663033c951392f5 | models/cifar10/vgg.py | python | VGG._make_layers | (self, cfg) | return nn.Sequential(*layers) | [] | def _make_layers(self, cfg):
layers = []
in_channels = 3
for x in cfg:
if x == 'M':
layers += [nn.MaxPool2d(kernel_size=2, stride=2)]
else:
layers += [nn.Conv2d(in_channels, x, kernel_size=3, padding=1),
nn.BatchN... | [
"def",
"_make_layers",
"(",
"self",
",",
"cfg",
")",
":",
"layers",
"=",
"[",
"]",
"in_channels",
"=",
"3",
"for",
"x",
"in",
"cfg",
":",
"if",
"x",
"==",
"'M'",
":",
"layers",
"+=",
"[",
"nn",
".",
"MaxPool2d",
"(",
"kernel_size",
"=",
"2",
",",... | https://github.com/karanchahal/distiller/blob/a17ec06cbeafcdd2aea19d7c7663033c951392f5/models/cifar10/vgg.py#L26-L38 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/algebras/quatalg/quaternion_algebra.py | python | QuaternionFractionalIdeal_rational.multiply_by_conjugate | (self, J) | return R.ideal(basis, check=False) | Return product of self and the conjugate Jbar of `J`.
INPUT:
- ``J`` -- a quaternion ideal.
OUTPUT: a quaternionic fractional ideal.
EXAMPLES::
sage: R = BrandtModule(3,5).right_ideals()
sage: R[0].multiply_by_conjugate(R[1])
Fractional ideal (8 +... | Return product of self and the conjugate Jbar of `J`. | [
"Return",
"product",
"of",
"self",
"and",
"the",
"conjugate",
"Jbar",
"of",
"J",
"."
] | def multiply_by_conjugate(self, J):
"""
Return product of self and the conjugate Jbar of `J`.
INPUT:
- ``J`` -- a quaternion ideal.
OUTPUT: a quaternionic fractional ideal.
EXAMPLES::
sage: R = BrandtModule(3,5).right_ideals()
sage: R[0].multi... | [
"def",
"multiply_by_conjugate",
"(",
"self",
",",
"J",
")",
":",
"Jbar",
"=",
"[",
"b",
".",
"conjugate",
"(",
")",
"for",
"b",
"in",
"J",
".",
"basis",
"(",
")",
"]",
"gens",
"=",
"[",
"a",
"*",
"b",
"for",
"a",
"in",
"self",
".",
"basis",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/algebras/quatalg/quaternion_algebra.py#L2535-L2557 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/future/backports/email/message.py | python | Message.__getitem__ | (self, name) | return self.get(name) | Get a header value.
Return None if the header is missing instead of raising an exception.
Note that if the header appeared multiple times, exactly which
occurrence gets returned is undefined. Use get_all() to get all
the values matching a header field name. | Get a header value. | [
"Get",
"a",
"header",
"value",
"."
] | def __getitem__(self, name):
"""Get a header value.
Return None if the header is missing instead of raising an exception.
Note that if the header appeared multiple times, exactly which
occurrence gets returned is undefined. Use get_all() to get all
the values matching a header... | [
"def",
"__getitem__",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"get",
"(",
"name",
")"
] | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/future/backports/email/message.py#L337-L346 | |
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/expressions.py | python | Expr.__ne__ | (self, other) | [] | def __ne__(self, other):
if isinstance(other, Expr):
comp = ast.Compare(
left=self._expr, ops=[ast.NotEq()], comparators=[other._expr]
)
return Expr(comp, istrue=self is other)
elif other is not None:
comp = ast.Compare(
lef... | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"Expr",
")",
":",
"comp",
"=",
"ast",
".",
"Compare",
"(",
"left",
"=",
"self",
".",
"_expr",
",",
"ops",
"=",
"[",
"ast",
".",
"NotEq",
"(",
")",
"]",... | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/expressions.py#L189-L203 | ||||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/__pypy__/interp_magic.py | python | newlist_hint | (space, sizehint) | return space.newlist_hint(sizehint) | Create a new empty list that has an underlying storage of length sizehint | Create a new empty list that has an underlying storage of length sizehint | [
"Create",
"a",
"new",
"empty",
"list",
"that",
"has",
"an",
"underlying",
"storage",
"of",
"length",
"sizehint"
] | def newlist_hint(space, sizehint):
""" Create a new empty list that has an underlying storage of length sizehint """
return space.newlist_hint(sizehint) | [
"def",
"newlist_hint",
"(",
"space",
",",
"sizehint",
")",
":",
"return",
"space",
".",
"newlist_hint",
"(",
"sizehint",
")"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/__pypy__/interp_magic.py#L125-L127 | |
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/mutagen/asf/_objects.py | python | BaseObject.__init__ | (self) | [] | def __init__(self):
self.objects = []
self.data = b"" | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"objects",
"=",
"[",
"]",
"self",
".",
"data",
"=",
"b\"\""
] | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/mutagen/asf/_objects.py#L26-L28 | ||||
google/caliban | 56f96e7e05b1d33ebdebc01620dc867f7ec54df3 | caliban/config/experiment.py | python | _tupleize_compound_item | (k: Union[Tuple, str], v: Any) | converts a JSON-input compound key/value pair into a dictionary of tuples | converts a JSON-input compound key/value pair into a dictionary of tuples | [
"converts",
"a",
"JSON",
"-",
"input",
"compound",
"key",
"/",
"value",
"pair",
"into",
"a",
"dictionary",
"of",
"tuples"
] | def _tupleize_compound_item(k: Union[Tuple, str], v: Any) -> Dict:
""" converts a JSON-input compound key/value pair into a dictionary of tuples """
if _is_compound_key(k):
return {_tupleize_compound_key(k): _tupleize_compound_value(v)}
else:
return {k: v} | [
"def",
"_tupleize_compound_item",
"(",
"k",
":",
"Union",
"[",
"Tuple",
",",
"str",
"]",
",",
"v",
":",
"Any",
")",
"->",
"Dict",
":",
"if",
"_is_compound_key",
"(",
"k",
")",
":",
"return",
"{",
"_tupleize_compound_key",
"(",
"k",
")",
":",
"_tupleize... | https://github.com/google/caliban/blob/56f96e7e05b1d33ebdebc01620dc867f7ec54df3/caliban/config/experiment.py#L90-L95 | ||
nmcspadden/ProfileSigner | b591c51c1a5a8e47da322b0f1f1fa6fb1c8692db | profile_signer.py | python | writePlist | (dataObject, filepath) | Write 'rootObject' as a plist to filepath. | Write 'rootObject' as a plist to filepath. | [
"Write",
"rootObject",
"as",
"a",
"plist",
"to",
"filepath",
"."
] | def writePlist(dataObject, filepath):
'''
Write 'rootObject' as a plist to filepath.
'''
plistData, error = (
NSPropertyListSerialization.
dataFromPropertyList_format_errorDescription_(
dataObject, NSPropertyListXMLFormat_v1_0, None))
if plistData is None:
if erro... | [
"def",
"writePlist",
"(",
"dataObject",
",",
"filepath",
")",
":",
"plistData",
",",
"error",
"=",
"(",
"NSPropertyListSerialization",
".",
"dataFromPropertyList_format_errorDescription_",
"(",
"dataObject",
",",
"NSPropertyListXMLFormat_v1_0",
",",
"None",
")",
")",
... | https://github.com/nmcspadden/ProfileSigner/blob/b591c51c1a5a8e47da322b0f1f1fa6fb1c8692db/profile_signer.py#L64-L83 | ||
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | skeinforge_application/skeinforge_plugins/craft_plugins/hop.py | python | HopSkein.__init__ | (self) | Initialize | Initialize | [
"Initialize"
] | def __init__(self):
'Initialize'
self.distanceFeedRate = gcodec.DistanceFeedRate()
self.extruderActive = False
self.feedRateMinute = 961.0
self.hopHeight = 0.4
self.hopDistance = self.hopHeight
self.justDeactivated = False
self.layerCount = settings.LayerCount()
self.lineIndex = 0
self.lines = None
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"distanceFeedRate",
"=",
"gcodec",
".",
"DistanceFeedRate",
"(",
")",
"self",
".",
"extruderActive",
"=",
"False",
"self",
".",
"feedRateMinute",
"=",
"961.0",
"self",
".",
"hopHeight",
"=",
"0.4",
"se... | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/hop.py#L110-L121 | ||
crits/crits_services | c7abf91f1865d913cffad4b966599da204f8ae43 | pdf2txt_service/__init__.py | python | pdf2txtService.get_config_details | (config) | return {'pdf2txt_path': config['pdf2txt_path'],
'antiword_path': config['antiword_path']} | [] | def get_config_details(config):
return {'pdf2txt_path': config['pdf2txt_path'],
'antiword_path': config['antiword_path']} | [
"def",
"get_config_details",
"(",
"config",
")",
":",
"return",
"{",
"'pdf2txt_path'",
":",
"config",
"[",
"'pdf2txt_path'",
"]",
",",
"'antiword_path'",
":",
"config",
"[",
"'antiword_path'",
"]",
"}"
] | https://github.com/crits/crits_services/blob/c7abf91f1865d913cffad4b966599da204f8ae43/pdf2txt_service/__init__.py#L85-L87 | |||
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/SearchKippt/alp/request/requests/utils.py | python | to_key_val_list | (value) | return list(value) | Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,
::
>>> to_key_val_list([('key', 'val')])
[('key', 'val')]
>>> to_key_val_list({'key': 'val'})
[('key', 'val')]
>>> to_key_val_list('string')
Val... | Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g., | [
"Take",
"an",
"object",
"and",
"test",
"to",
"see",
"if",
"it",
"can",
"be",
"represented",
"as",
"a",
"dictionary",
".",
"If",
"it",
"can",
"be",
"return",
"a",
"list",
"of",
"tuples",
"e",
".",
"g",
"."
] | def to_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,
::
>>> to_key_val_list([('key', 'val')])
[('key', 'val')]
>>> to_key_val_list({'key': 'val'})
[('key', 'val')]
>>> to... | [
"def",
"to_key_val_list",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"(",
"str",
",",
"bytes",
",",
"bool",
",",
"int",
")",
")",
":",
"raise",
"ValueError",
"(",
"'cannot encode o... | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/SearchKippt/alp/request/requests/utils.py#L118-L140 | |
rspivak/lsbasi | 07e1a14516156a21ebe2d82e0bae4bba5ad73dd6 | part17/spi.py | python | Lexer.advance | (self) | Advance the `pos` pointer and set the `current_char` variable. | Advance the `pos` pointer and set the `current_char` variable. | [
"Advance",
"the",
"pos",
"pointer",
"and",
"set",
"the",
"current_char",
"variable",
"."
] | def advance(self):
"""Advance the `pos` pointer and set the `current_char` variable."""
if self.current_char == '\n':
self.lineno += 1
self.column = 0
self.pos += 1
if self.pos > len(self.text) - 1:
self.current_char = None # Indicates end of input
... | [
"def",
"advance",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_char",
"==",
"'\\n'",
":",
"self",
".",
"lineno",
"+=",
"1",
"self",
".",
"column",
"=",
"0",
"self",
".",
"pos",
"+=",
"1",
"if",
"self",
".",
"pos",
">",
"len",
"(",
"self",
... | https://github.com/rspivak/lsbasi/blob/07e1a14516156a21ebe2d82e0bae4bba5ad73dd6/part17/spi.py#L149-L160 | ||
veusz/veusz | 5a1e2af5f24df0eb2a2842be51f2997c4999c7fb | veusz/widgets/axis.py | python | AutoRange.adjustPlottedRange | (self, plottedrange, adjustmin, adjustmax, log, doc) | Adjust plotted range list given settings.
plottedrange: [minval, maxval]
adjustmin/adjustmax: bool whether to adjust
log: is log axis
doc: Document object | Adjust plotted range list given settings.
plottedrange: [minval, maxval]
adjustmin/adjustmax: bool whether to adjust
log: is log axis
doc: Document object | [
"Adjust",
"plotted",
"range",
"list",
"given",
"settings",
".",
"plottedrange",
":",
"[",
"minval",
"maxval",
"]",
"adjustmin",
"/",
"adjustmax",
":",
"bool",
"whether",
"to",
"adjust",
"log",
":",
"is",
"log",
"axis",
"doc",
":",
"Document",
"object"
] | def adjustPlottedRange(self, plottedrange, adjustmin, adjustmax, log, doc):
"""Adjust plotted range list given settings.
plottedrange: [minval, maxval]
adjustmin/adjustmax: bool whether to adjust
log: is log axis
doc: Document object
"""
rng = self.val
if ... | [
"def",
"adjustPlottedRange",
"(",
"self",
",",
"plottedrange",
",",
"adjustmin",
",",
"adjustmax",
",",
"log",
",",
"doc",
")",
":",
"rng",
"=",
"self",
".",
"val",
"if",
"rng",
"==",
"'exact'",
":",
"pass",
"elif",
"rng",
"==",
"'next-tick'",
":",
"pa... | https://github.com/veusz/veusz/blob/5a1e2af5f24df0eb2a2842be51f2997c4999c7fb/veusz/widgets/axis.py#L288-L324 | ||
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/mpl_toolkits/axes_grid1/axes_rgb.py | python | make_rgb_axes | (ax, pad=0.01, axes_class=None, **kwargs) | return ax_rgb | Parameters
----------
pad : float
Fraction of the axes height. | Parameters
----------
pad : float
Fraction of the axes height. | [
"Parameters",
"----------",
"pad",
":",
"float",
"Fraction",
"of",
"the",
"axes",
"height",
"."
] | def make_rgb_axes(ax, pad=0.01, axes_class=None, **kwargs):
"""
Parameters
----------
pad : float
Fraction of the axes height.
"""
divider = make_axes_locatable(ax)
pad_size = pad * Size.AxesY(ax)
xsize = ((1-2*pad)/3) * Size.AxesX(ax)
ysize = ((1-2*pad)/3) * Size.AxesY(ax... | [
"def",
"make_rgb_axes",
"(",
"ax",
",",
"pad",
"=",
"0.01",
",",
"axes_class",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"divider",
"=",
"make_axes_locatable",
"(",
"ax",
")",
"pad_size",
"=",
"pad",
"*",
"Size",
".",
"AxesY",
"(",
"ax",
")",
... | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/mpl_toolkits/axes_grid1/axes_rgb.py#L7-L53 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/ipykernel/datapub.py | python | publish_data | (data) | publish a data_message on the IOPub channel
Parameters
----------
data : dict
The data to be published. Think of it as a namespace. | publish a data_message on the IOPub channel | [
"publish",
"a",
"data_message",
"on",
"the",
"IOPub",
"channel"
] | def publish_data(data):
"""publish a data_message on the IOPub channel
Parameters
----------
data : dict
The data to be published. Think of it as a namespace.
"""
warnings.warn("ipykernel.datapub is deprecated. It has moved to ipyparallel.datapub", DeprecationWarning)
from ipy... | [
"def",
"publish_data",
"(",
"data",
")",
":",
"warnings",
".",
"warn",
"(",
"\"ipykernel.datapub is deprecated. It has moved to ipyparallel.datapub\"",
",",
"DeprecationWarning",
")",
"from",
"ipykernel",
".",
"zmqshell",
"import",
"ZMQInteractiveShell",
"ZMQInteractiveShell"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/ipykernel/datapub.py#L50-L62 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/density.py | python | Density.doit | (self, **hints) | return Add(*terms) | Expand the density operator into an outer product format.
Examples
=========
>>> from sympy.physics.quantum.state import Ket
>>> from sympy.physics.quantum.density import Density
>>> from sympy.physics.quantum.operator import Operator
>>> A = Operator('A')
>>> d... | Expand the density operator into an outer product format. | [
"Expand",
"the",
"density",
"operator",
"into",
"an",
"outer",
"product",
"format",
"."
] | def doit(self, **hints):
"""Expand the density operator into an outer product format.
Examples
=========
>>> from sympy.physics.quantum.state import Ket
>>> from sympy.physics.quantum.density import Density
>>> from sympy.physics.quantum.operator import Operator
... | [
"def",
"doit",
"(",
"self",
",",
"*",
"*",
"hints",
")",
":",
"terms",
"=",
"[",
"]",
"for",
"(",
"state",
",",
"prob",
")",
"in",
"self",
".",
"args",
":",
"state",
"=",
"state",
".",
"expand",
"(",
")",
"# needed to break up (a+b)*c",
"if",
"(",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/density.py#L149-L176 | |
bayespy/bayespy | 0e6e6130c888a4295cc9421d61d4ad27b2960ebb | bayespy/inference/vmp/vmp.py | python | VB.optimize | (self, *nodes, maxiter=10, verbose=True, method='fletcher-reeves',
riemannian=True, collapsed=None, tol=None) | Optimize nodes using Riemannian conjugate gradient | Optimize nodes using Riemannian conjugate gradient | [
"Optimize",
"nodes",
"using",
"Riemannian",
"conjugate",
"gradient"
] | def optimize(self, *nodes, maxiter=10, verbose=True, method='fletcher-reeves',
riemannian=True, collapsed=None, tol=None):
"""
Optimize nodes using Riemannian conjugate gradient
"""
method = method.lower()
if collapsed is None:
collapsed = []
... | [
"def",
"optimize",
"(",
"self",
",",
"*",
"nodes",
",",
"maxiter",
"=",
"10",
",",
"verbose",
"=",
"True",
",",
"method",
"=",
"'fletcher-reeves'",
",",
"riemannian",
"=",
"True",
",",
"collapsed",
"=",
"None",
",",
"tol",
"=",
"None",
")",
":",
"met... | https://github.com/bayespy/bayespy/blob/0e6e6130c888a4295cc9421d61d4ad27b2960ebb/bayespy/inference/vmp/vmp.py#L477-L612 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32comext/axdebug/gateways.py | python | RemoteDebugApplicationEvents.OnLeaveBreakPoint | (self, rdat) | rdat -- PyIRemoteDebugApplicationThread | rdat -- PyIRemoteDebugApplicationThread | [
"rdat",
"--",
"PyIRemoteDebugApplicationThread"
] | def OnLeaveBreakPoint(self, rdat):
"""rdat -- PyIRemoteDebugApplicationThread
"""
RaiseNotImpl("OnLeaveBreakPoint") | [
"def",
"OnLeaveBreakPoint",
"(",
"self",
",",
"rdat",
")",
":",
"RaiseNotImpl",
"(",
"\"OnLeaveBreakPoint\"",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32comext/axdebug/gateways.py#L385-L388 | ||
alteryx/featuretools | d59e11082962f163540fd6e185901f65c506326a | docs/notebook_cleaner.py | python | _check_python_version | (notebook, default_version) | return True | [] | def _check_python_version(notebook, default_version):
with open(notebook, "r") as f:
source = json.load(f)
if source["metadata"]["language_info"]["version"] != default_version:
return False
return True | [
"def",
"_check_python_version",
"(",
"notebook",
",",
"default_version",
")",
":",
"with",
"open",
"(",
"notebook",
",",
"\"r\"",
")",
"as",
"f",
":",
"source",
"=",
"json",
".",
"load",
"(",
"f",
")",
"if",
"source",
"[",
"\"metadata\"",
"]",
"[",
"\"... | https://github.com/alteryx/featuretools/blob/d59e11082962f163540fd6e185901f65c506326a/docs/notebook_cleaner.py#L47-L52 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/IPython/core/ultratb.py | python | getargs | (co) | return inspect.Arguments(args, varargs, varkw) | Get information about the arguments accepted by a code object.
Three things are returned: (args, varargs, varkw), where 'args' is
a list of argument names (possibly containing nested lists), and
'varargs' and 'varkw' are the names of the * and ** arguments or None. | Get information about the arguments accepted by a code object. | [
"Get",
"information",
"about",
"the",
"arguments",
"accepted",
"by",
"a",
"code",
"object",
"."
] | def getargs(co):
"""Get information about the arguments accepted by a code object.
Three things are returned: (args, varargs, varkw), where 'args' is
a list of argument names (possibly containing nested lists), and
'varargs' and 'varkw' are the names of the * and ** arguments or None."""
if not isc... | [
"def",
"getargs",
"(",
"co",
")",
":",
"if",
"not",
"iscode",
"(",
"co",
")",
":",
"raise",
"TypeError",
"(",
"'{!r} is not a code object'",
".",
"format",
"(",
"co",
")",
")",
"nargs",
"=",
"co",
".",
"co_argcount",
"names",
"=",
"co",
".",
"co_varnam... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/IPython/core/ultratb.py#L238-L297 | |
randy3k/SendCode | 6775b40613bb4911ba0499ff8a600c41f48a62c2 | code_sender/winauto.py | python | enum_child_windows | (hwnd, callback) | [] | def enum_child_windows(hwnd, callback):
proc = EnumChildWindowsProc(callback)
EnumChildWindows(hwnd, proc, 0) | [
"def",
"enum_child_windows",
"(",
"hwnd",
",",
"callback",
")",
":",
"proc",
"=",
"EnumChildWindowsProc",
"(",
"callback",
")",
"EnumChildWindows",
"(",
"hwnd",
",",
"proc",
",",
"0",
")"
] | https://github.com/randy3k/SendCode/blob/6775b40613bb4911ba0499ff8a600c41f48a62c2/code_sender/winauto.py#L94-L96 | ||||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cherrypy/__init__.py | python | _ThreadLocalProxy.__nonzero__ | (self) | return bool(child) | [] | def __nonzero__(self):
child = getattr(serving, self.__attrname__)
return bool(child) | [
"def",
"__nonzero__",
"(",
"self",
")",
":",
"child",
"=",
"getattr",
"(",
"serving",
",",
"self",
".",
"__attrname__",
")",
"return",
"bool",
"(",
"child",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cherrypy/__init__.py#L264-L266 | |||
profusion/sgqlc | 465a5e800f8b408ceafe25cde45ee0bde4912482 | sgqlc/codegen/operation.py | python | Variable.__repr__ | (self) | return 'sgqlc.types.Variable(%r)' % (self.name,) | [] | def __repr__(self):
return 'sgqlc.types.Variable(%r)' % (self.name,) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'sgqlc.types.Variable(%r)'",
"%",
"(",
"self",
".",
"name",
",",
")"
] | https://github.com/profusion/sgqlc/blob/465a5e800f8b408ceafe25cde45ee0bde4912482/sgqlc/codegen/operation.py#L47-L48 | |||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py | python | IPv6Address.is_link_local | (self) | return self in self._constants._linklocal_network | Test if the address is reserved for link-local.
Returns:
A boolean, True if the address is reserved per RFC 4291. | Test if the address is reserved for link-local. | [
"Test",
"if",
"the",
"address",
"is",
"reserved",
"for",
"link",
"-",
"local",
"."
] | def is_link_local(self):
"""Test if the address is reserved for link-local.
Returns:
A boolean, True if the address is reserved per RFC 4291.
"""
return self in self._constants._linklocal_network | [
"def",
"is_link_local",
"(",
"self",
")",
":",
"return",
"self",
"in",
"self",
".",
"_constants",
".",
"_linklocal_network"
] | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py#L2074-L2081 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py | python | Iface.get_delegation_token | (self, token_owner, renewer_kerberos_principal_name) | Parameters:
- token_owner
- renewer_kerberos_principal_name | Parameters:
- token_owner
- renewer_kerberos_principal_name | [
"Parameters",
":",
"-",
"token_owner",
"-",
"renewer_kerberos_principal_name"
] | def get_delegation_token(self, token_owner, renewer_kerberos_principal_name):
"""
Parameters:
- token_owner
- renewer_kerberos_principal_name
"""
pass | [
"def",
"get_delegation_token",
"(",
"self",
",",
"token_owner",
",",
"renewer_kerberos_principal_name",
")",
":",
"pass"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py#L1091-L1098 | ||
adamcaudill/EquationGroupLeak | 52fa871c89008566c27159bd48f2a8641260c984 | windows/fuzzbunch/pyreadline/modes/basemode.py | python | BaseMode.backward_delete_word | (self, e) | Delete the character behind the cursor. A numeric argument means
to kill the characters instead of deleting them. | Delete the character behind the cursor. A numeric argument means
to kill the characters instead of deleting them. | [
"Delete",
"the",
"character",
"behind",
"the",
"cursor",
".",
"A",
"numeric",
"argument",
"means",
"to",
"kill",
"the",
"characters",
"instead",
"of",
"deleting",
"them",
"."
] | def backward_delete_word(self, e): # (Control-Rubout)
'''Delete the character behind the cursor. A numeric argument means
to kill the characters instead of deleting them.'''
self.l_buffer.backward_delete_word(self.argument_reset) | [
"def",
"backward_delete_word",
"(",
"self",
",",
"e",
")",
":",
"# (Control-Rubout)",
"self",
".",
"l_buffer",
".",
"backward_delete_word",
"(",
"self",
".",
"argument_reset",
")"
] | https://github.com/adamcaudill/EquationGroupLeak/blob/52fa871c89008566c27159bd48f2a8641260c984/windows/fuzzbunch/pyreadline/modes/basemode.py#L358-L361 | ||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py-rest/gluon/compileapp.py | python | LOAD | (c=None, f='index', args=None, vars=None,
extension=None, target=None, ajax=False, ajax_trap=False,
url=None, user_signature=False, timeout=None, times=1,
content='loading...', post_vars=Storage(), **attr) | LOADs a component into the action's document
Args:
c(str): controller
f(str): function
args(tuple or list): arguments
vars(dict): vars
extension(str): extension
target(str): id of the target
ajax(bool): True to enable AJAX bahaviour
ajax_trap(bool): T... | LOADs a component into the action's document | [
"LOADs",
"a",
"component",
"into",
"the",
"action",
"s",
"document"
] | def LOAD(c=None, f='index', args=None, vars=None,
extension=None, target=None, ajax=False, ajax_trap=False,
url=None, user_signature=False, timeout=None, times=1,
content='loading...', post_vars=Storage(), **attr):
""" LOADs a component into the action's document
Args:
c(str... | [
"def",
"LOAD",
"(",
"c",
"=",
"None",
",",
"f",
"=",
"'index'",
",",
"args",
"=",
"None",
",",
"vars",
"=",
"None",
",",
"extension",
"=",
"None",
",",
"target",
"=",
"None",
",",
"ajax",
"=",
"False",
",",
"ajax_trap",
"=",
"False",
",",
"url",
... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py-rest/gluon/compileapp.py#L127-L245 | ||
ioflo/ioflo | 177ac656d7c4ff801aebb0d8b401db365a5248ce | ioflo/base/registering.py | python | Registrar.Retrieve | (cls, name = '') | return cls.Names.get(name, None) | Retrieves object in registry with name
return object with name or False if no object by name | Retrieves object in registry with name | [
"Retrieves",
"object",
"in",
"registry",
"with",
"name"
] | def Retrieve(cls, name = ''):
"""Retrieves object in registry with name
return object with name or False if no object by name
"""
return cls.Names.get(name, None) | [
"def",
"Retrieve",
"(",
"cls",
",",
"name",
"=",
"''",
")",
":",
"return",
"cls",
".",
"Names",
".",
"get",
"(",
"name",
",",
"None",
")"
] | https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/base/registering.py#L114-L119 | |
kellyjonbrazil/jc | e6900e2000bf265dfcfc09ffbfda39e9238661af | jc/parsers/tracepath.py | python | _process | (proc_data) | return proc_data | Final processing to conform to the schema.
Parameters:
proc_data: (Dictionary) raw structured data to process
Returns:
Dictionary. Structured data to conform to the schema. | Final processing to conform to the schema. | [
"Final",
"processing",
"to",
"conform",
"to",
"the",
"schema",
"."
] | def _process(proc_data):
"""
Final processing to conform to the schema.
Parameters:
proc_data: (Dictionary) raw structured data to process
Returns:
Dictionary. Structured data to conform to the schema.
"""
# convert ints and floats
int_list = ['pmtu', 'forward_hops', 'r... | [
"def",
"_process",
"(",
"proc_data",
")",
":",
"# convert ints and floats",
"int_list",
"=",
"[",
"'pmtu'",
",",
"'forward_hops'",
",",
"'return_hops'",
",",
"'ttl'",
",",
"'asymmetric_difference'",
"]",
"float_list",
"=",
"[",
"'reply_ms'",
"]",
"for",
"key",
"... | https://github.com/kellyjonbrazil/jc/blob/e6900e2000bf265dfcfc09ffbfda39e9238661af/jc/parsers/tracepath.py#L148-L178 | |
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/projects/pavlovia.py | python | PavloviaProject.commit | (self, message) | Commits the staged changes | Commits the staged changes | [
"Commits",
"the",
"staged",
"changes"
] | def commit(self, message):
"""Commits the staged changes"""
self.repo.git.commit('-m', message)
time.sleep(0.1)
# then get a new copy of the repo
self.repo = git.Repo(self.localRoot) | [
"def",
"commit",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"repo",
".",
"git",
".",
"commit",
"(",
"'-m'",
",",
"message",
")",
"time",
".",
"sleep",
"(",
"0.1",
")",
"# then get a new copy of the repo",
"self",
".",
"repo",
"=",
"git",
".",
... | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/projects/pavlovia.py#L968-L973 | ||
nicolargo/glances | 00c65933ae1d0ebd3e72dc30fc3c215a83dfaae2 | glances/plugins/glances_wifi.py | python | Plugin.update_views | (self) | Update stats views. | Update stats views. | [
"Update",
"stats",
"views",
"."
] | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics information
# Alert on signal thresholds
for i in self.stats:
self.views[i[self.get_key()]]['signal']['decoration'] = self.get_aler... | [
"def",
"update_views",
"(",
"self",
")",
":",
"# Call the father's method",
"super",
"(",
"Plugin",
",",
"self",
")",
".",
"update_views",
"(",
")",
"# Add specifics information",
"# Alert on signal thresholds",
"for",
"i",
"in",
"self",
".",
"stats",
":",
"self",... | https://github.com/nicolargo/glances/blob/00c65933ae1d0ebd3e72dc30fc3c215a83dfaae2/glances/plugins/glances_wifi.py#L153-L164 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/mailbox.py | python | Mailbox.lock | (self) | Lock the mailbox. | Lock the mailbox. | [
"Lock",
"the",
"mailbox",
"."
] | def lock(self):
"""Lock the mailbox."""
raise NotImplementedError('Method must be implemented by subclass') | [
"def",
"lock",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Method must be implemented by subclass'",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/mailbox.py#L185-L187 | ||
eg4000/SKU110K_CVPR19 | 1fb83d6d0e5fd0fef8d53d25940ebd6f8d027020 | object_detector_retinanet/keras_retinanet/backend/tensorflow_backend.py | python | top_k | (*args, **kwargs) | return tensorflow.nn.top_k(*args, **kwargs) | See https://www.tensorflow.org/versions/master/api_docs/python/tf/nn/top_k . | See https://www.tensorflow.org/versions/master/api_docs/python/tf/nn/top_k . | [
"See",
"https",
":",
"//",
"www",
".",
"tensorflow",
".",
"org",
"/",
"versions",
"/",
"master",
"/",
"api_docs",
"/",
"python",
"/",
"tf",
"/",
"nn",
"/",
"top_k",
"."
] | def top_k(*args, **kwargs):
""" See https://www.tensorflow.org/versions/master/api_docs/python/tf/nn/top_k .
"""
return tensorflow.nn.top_k(*args, **kwargs) | [
"def",
"top_k",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"tensorflow",
".",
"nn",
".",
"top_k",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/eg4000/SKU110K_CVPR19/blob/1fb83d6d0e5fd0fef8d53d25940ebd6f8d027020/object_detector_retinanet/keras_retinanet/backend/tensorflow_backend.py#L32-L35 | |
airbnb/streamalert | 26cf1d08432ca285fd4f7410511a6198ca104bbb | streamalert/scheduled_queries/container/container.py | python | ServiceContainer.get_parameter | (self, parameter_name) | return self._parameters[parameter_name] | Returns a parameter registered in the service container | Returns a parameter registered in the service container | [
"Returns",
"a",
"parameter",
"registered",
"in",
"the",
"service",
"container"
] | def get_parameter(self, parameter_name):
"""Returns a parameter registered in the service container"""
if parameter_name not in self._parameters:
raise ValueError('ServiceContainer no such parameter: "{}"'.format(parameter_name))
return self._parameters[parameter_name] | [
"def",
"get_parameter",
"(",
"self",
",",
"parameter_name",
")",
":",
"if",
"parameter_name",
"not",
"in",
"self",
".",
"_parameters",
":",
"raise",
"ValueError",
"(",
"'ServiceContainer no such parameter: \"{}\"'",
".",
"format",
"(",
"parameter_name",
")",
")",
... | https://github.com/airbnb/streamalert/blob/26cf1d08432ca285fd4f7410511a6198ca104bbb/streamalert/scheduled_queries/container/container.py#L41-L46 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/optimize/_optimize.py | python | golden | (func, args=(), brack=None, tol=_epsilon,
full_output=0, maxiter=5000) | Return the minimum of a function of one variable using golden section
method.
Given a function of one variable and a possible bracketing interval,
return the minimum of the function isolated to a fractional precision of
tol.
Parameters
----------
func : callable func(x,*args)
Objec... | Return the minimum of a function of one variable using golden section
method. | [
"Return",
"the",
"minimum",
"of",
"a",
"function",
"of",
"one",
"variable",
"using",
"golden",
"section",
"method",
"."
] | def golden(func, args=(), brack=None, tol=_epsilon,
full_output=0, maxiter=5000):
"""
Return the minimum of a function of one variable using golden section
method.
Given a function of one variable and a possible bracketing interval,
return the minimum of the function isolated to a fracti... | [
"def",
"golden",
"(",
"func",
",",
"args",
"=",
"(",
")",
",",
"brack",
"=",
"None",
",",
"tol",
"=",
"_epsilon",
",",
"full_output",
"=",
"0",
",",
"maxiter",
"=",
"5000",
")",
":",
"options",
"=",
"{",
"'xtol'",
":",
"tol",
",",
"'maxiter'",
":... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/optimize/_optimize.py#L2533-L2597 | ||
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/applelink.py | python | _applelib_versioned_lib_soname | (env, libnode, version, prefix, suffix, name_func) | return soname | For libnode='/optional/dir/libfoo.X.Y.Z.dylib' it returns 'libfoo.X.dylib | For libnode='/optional/dir/libfoo.X.Y.Z.dylib' it returns 'libfoo.X.dylib | [
"For",
"libnode",
"=",
"/",
"optional",
"/",
"dir",
"/",
"libfoo",
".",
"X",
".",
"Y",
".",
"Z",
".",
"dylib",
"it",
"returns",
"libfoo",
".",
"X",
".",
"dylib"
] | def _applelib_versioned_lib_soname(env, libnode, version, prefix, suffix, name_func):
"""For libnode='/optional/dir/libfoo.X.Y.Z.dylib' it returns 'libfoo.X.dylib'"""
Verbose = False
if Verbose:
print("_applelib_versioned_lib_soname: version={!r}".format(version))
name = name_func(env, libnode, ... | [
"def",
"_applelib_versioned_lib_soname",
"(",
"env",
",",
"libnode",
",",
"version",
",",
"prefix",
",",
"suffix",
",",
"name_func",
")",
":",
"Verbose",
"=",
"False",
"if",
"Verbose",
":",
"print",
"(",
"\"_applelib_versioned_lib_soname: version={!r}\"",
".",
"fo... | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/applelink.py#L63-L76 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/asymptotic/growth_group.py | python | MonomialGrowthElement.__pow__ | (self, exponent) | return self.parent()._create_element_in_extension_(
self.exponent * strip_symbolic(exponent)) | r"""
Calculate the power of this growth element to the given ``exponent``.
INPUT:
- ``exponent`` -- a number. This can be anything that is a
valid right hand side of ``*`` with elements of the
parent's base.
OUTPUT:
The result of this exponentiation, a :cl... | r"""
Calculate the power of this growth element to the given ``exponent``. | [
"r",
"Calculate",
"the",
"power",
"of",
"this",
"growth",
"element",
"to",
"the",
"given",
"exponent",
"."
] | def __pow__(self, exponent):
r"""
Calculate the power of this growth element to the given ``exponent``.
INPUT:
- ``exponent`` -- a number. This can be anything that is a
valid right hand side of ``*`` with elements of the
parent's base.
OUTPUT:
The... | [
"def",
"__pow__",
"(",
"self",
",",
"exponent",
")",
":",
"from",
".",
"misc",
"import",
"strip_symbolic",
"return",
"self",
".",
"parent",
"(",
")",
".",
"_create_element_in_extension_",
"(",
"self",
".",
"exponent",
"*",
"strip_symbolic",
"(",
"exponent",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/asymptotic/growth_group.py#L3039-L3076 | |
vaexio/vaex | 6c1571f4f1ac030eb7128c1b35b2ccbb5dd29cac | packages/vaex-core/vaex/column.py | python | ColumnIndexed.index | (column, indices, direct_indices_map=None, masked=False) | Creates a new column indexed by indices which avoids nested indices
:param df: Dataframe where column comes from
:param column: Column object or numpy array
:param name: name of column
:param indices: ndarray with indices which rows to take
:param direct_indices_map: cache of th... | Creates a new column indexed by indices which avoids nested indices | [
"Creates",
"a",
"new",
"column",
"indexed",
"by",
"indices",
"which",
"avoids",
"nested",
"indices"
] | def index(column, indices, direct_indices_map=None, masked=False):
"""Creates a new column indexed by indices which avoids nested indices
:param df: Dataframe where column comes from
:param column: Column object or numpy array
:param name: name of column
:param indices: ndarray ... | [
"def",
"index",
"(",
"column",
",",
"indices",
",",
"direct_indices_map",
"=",
"None",
",",
"masked",
"=",
"False",
")",
":",
"direct_indices_map",
"=",
"direct_indices_map",
"if",
"direct_indices_map",
"is",
"not",
"None",
"else",
"{",
"}",
"if",
"isinstance"... | https://github.com/vaexio/vaex/blob/6c1571f4f1ac030eb7128c1b35b2ccbb5dd29cac/packages/vaex-core/vaex/column.py#L302-L325 | ||
nschaetti/EchoTorch | cba209c49e0fda73172d2e853b85c747f9f5117e | echotorch/data/datasets/EchoDataset.py | python | EchoDataset.data | (self) | Get the whole dataset (according to init parameters)
@return: The Torch Tensor | Get the whole dataset (according to init parameters) | [
"Get",
"the",
"whole",
"dataset",
"(",
"according",
"to",
"init",
"parameters",
")"
] | def data(self) -> Union[torch.Tensor, List]:
"""
Get the whole dataset (according to init parameters)
@return: The Torch Tensor
"""
raise Exception("data not implemented") | [
"def",
"data",
"(",
"self",
")",
"->",
"Union",
"[",
"torch",
".",
"Tensor",
",",
"List",
"]",
":",
"raise",
"Exception",
"(",
"\"data not implemented\"",
")"
] | https://github.com/nschaetti/EchoTorch/blob/cba209c49e0fda73172d2e853b85c747f9f5117e/echotorch/data/datasets/EchoDataset.py#L87-L92 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/site-packages/Crypto/Cipher/blockalgo.py | python | BlockAlgo.decrypt | (self, ciphertext) | return self._cipher.decrypt(ciphertext) | Decrypt data with the key and the parameters set at initialization.
The cipher object is stateful; decryption of a long block
of data can be broken up in two or more calls to `decrypt()`.
That is, the statement:
>>> c.decrypt(a) + c.decrypt(b)
is always... | Decrypt data with the key and the parameters set at initialization.
The cipher object is stateful; decryption of a long block
of data can be broken up in two or more calls to `decrypt()`.
That is, the statement:
>>> c.decrypt(a) + c.decrypt(b) | [
"Decrypt",
"data",
"with",
"the",
"key",
"and",
"the",
"parameters",
"set",
"at",
"initialization",
".",
"The",
"cipher",
"object",
"is",
"stateful",
";",
"decryption",
"of",
"a",
"long",
"block",
"of",
"data",
"can",
"be",
"broken",
"up",
"in",
"two",
"... | def decrypt(self, ciphertext):
"""Decrypt data with the key and the parameters set at initialization.
The cipher object is stateful; decryption of a long block
of data can be broken up in two or more calls to `decrypt()`.
That is, the statement:
>>> c.de... | [
"def",
"decrypt",
"(",
"self",
",",
"ciphertext",
")",
":",
"if",
"self",
".",
"mode",
"==",
"MODE_OPENPGP",
":",
"padding_length",
"=",
"(",
"self",
".",
"block_size",
"-",
"len",
"(",
"ciphertext",
")",
"%",
"self",
".",
"block_size",
")",
"%",
"self... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/site-packages/Crypto/Cipher/blockalgo.py#L246-L295 | |
ym2011/POC-EXP | 206b22d3a6b2a172359678df33bbc5b2ad04b6c3 | Joomla/batch detection/hackUtils-master/bs4/element.py | python | Tag.__setitem__ | (self, key, value) | Setting tag[key] sets the value of the 'key' attribute for the
tag. | Setting tag[key] sets the value of the 'key' attribute for the
tag. | [
"Setting",
"tag",
"[",
"key",
"]",
"sets",
"the",
"value",
"of",
"the",
"key",
"attribute",
"for",
"the",
"tag",
"."
] | def __setitem__(self, key, value):
"""Setting tag[key] sets the value of the 'key' attribute for the
tag."""
self.attrs[key] = value | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"attrs",
"[",
"key",
"]",
"=",
"value"
] | https://github.com/ym2011/POC-EXP/blob/206b22d3a6b2a172359678df33bbc5b2ad04b6c3/Joomla/batch detection/hackUtils-master/bs4/element.py#L922-L925 | ||
Azure/azure-cli | 6c1b085a0910c6c2139006fcbd8ade44006eb6dd | tools/automation/verify/verify_module_load_times.py | python | mean | (data) | return sum(data)/float(n) | Return the sample arithmetic mean of data. | Return the sample arithmetic mean of data. | [
"Return",
"the",
"sample",
"arithmetic",
"mean",
"of",
"data",
"."
] | def mean(data):
"""Return the sample arithmetic mean of data."""
n = len(data)
if n < 1:
raise ValueError('len < 1')
return sum(data)/float(n) | [
"def",
"mean",
"(",
"data",
")",
":",
"n",
"=",
"len",
"(",
"data",
")",
"if",
"n",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"'len < 1'",
")",
"return",
"sum",
"(",
"data",
")",
"/",
"float",
"(",
"n",
")"
] | https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/tools/automation/verify/verify_module_load_times.py#L30-L35 | |
i3visio/osrframework | e02a6e9b1346ab5a01244c0d19bcec8232bf1a37 | osrframework/thirdparties/pipl_com/checkInfo.py | python | checkInfo | (email=None, username=None, api_key=None) | return results | Method that checks if the given hash is stored in the pipl.com website.
:param email: queries to be launched.
:param api_key: api_key to be used in pipl.com. If not provided, the API key will be searched in the config_api_keys.py file.
:return: Python structure for the Json received. It has... | Method that checks if the given hash is stored in the pipl.com website. | [
"Method",
"that",
"checks",
"if",
"the",
"given",
"hash",
"is",
"stored",
"in",
"the",
"pipl",
".",
"com",
"website",
"."
] | def checkInfo(email=None, username=None, api_key=None):
'''
Method that checks if the given hash is stored in the pipl.com website.
:param email: queries to be launched.
:param api_key: api_key to be used in pipl.com. If not provided, the API key will be searched in the config_api_keys.py f... | [
"def",
"checkInfo",
"(",
"email",
"=",
"None",
",",
"username",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"# This is for i3visio",
"if",
"api_key",
"is",
"None",
":",
"#api_key = raw_input(\"Insert the API KEY here:\\t\")",
"allKeys",
"=",
"config_api_keys... | https://github.com/i3visio/osrframework/blob/e02a6e9b1346ab5a01244c0d19bcec8232bf1a37/osrframework/thirdparties/pipl_com/checkInfo.py#L30-L65 | |
spender-sandbox/cuckoo-modified | eb93ef3d41b8fee51b4330306dcd315d8101e021 | modules/machinery/vsphere.py | python | vSphere._initialize_check | (self) | Runs checks against virtualization software when a machine manager
is initialized.
@raise CuckooCriticalError: if a misconfiguration or unsupported state
is found. | Runs checks against virtualization software when a machine manager
is initialized. | [
"Runs",
"checks",
"against",
"virtualization",
"software",
"when",
"a",
"machine",
"manager",
"is",
"initialized",
"."
] | def _initialize_check(self):
"""Runs checks against virtualization software when a machine manager
is initialized.
@raise CuckooCriticalError: if a misconfiguration or unsupported state
is found.
"""
self.connect_opts = {}
if self.opti... | [
"def",
"_initialize_check",
"(",
"self",
")",
":",
"self",
".",
"connect_opts",
"=",
"{",
"}",
"if",
"self",
".",
"options",
".",
"vsphere",
".",
"host",
":",
"self",
".",
"connect_opts",
"[",
"\"host\"",
"]",
"=",
"self",
".",
"options",
".",
"vsphere... | https://github.com/spender-sandbox/cuckoo-modified/blob/eb93ef3d41b8fee51b4330306dcd315d8101e021/modules/machinery/vsphere.py#L53-L128 | ||
docker-archive/docker-registry | f93b432d3fc7befa508ab27a590e6d0f78c86401 | docker_registry/images.py | python | put_image_json | (image_id) | return toolkit.response() | [] | def put_image_json(image_id):
data = None
try:
# Note(dmp): unicode patch
data = json.loads(flask.request.data.decode('utf8'))
except ValueError:
pass
if not data or not isinstance(data, dict):
return toolkit.api_error('Invalid JSON')
if 'id' not in data:
retu... | [
"def",
"put_image_json",
"(",
"image_id",
")",
":",
"data",
"=",
"None",
"try",
":",
"# Note(dmp): unicode patch",
"data",
"=",
"json",
".",
"loads",
"(",
"flask",
".",
"request",
".",
"data",
".",
"decode",
"(",
"'utf8'",
")",
")",
"except",
"ValueError",... | https://github.com/docker-archive/docker-registry/blob/f93b432d3fc7befa508ab27a590e6d0f78c86401/docker_registry/images.py#L334-L376 | |||
liuyubobobo/Play-with-Linear-Algebra | e86175adb908b03756618fbeeeadb448a3551321 | 09-Vector-Space-Dimension-and-Four-Subspaces/08-Implement-Rank-of-Matrix/playLA/Vector.py | python | Vector.norm | (self) | return math.sqrt(sum(e**2 for e in self)) | 返回向量的模 | 返回向量的模 | [
"返回向量的模"
] | def norm(self):
"""返回向量的模"""
return math.sqrt(sum(e**2 for e in self)) | [
"def",
"norm",
"(",
"self",
")",
":",
"return",
"math",
".",
"sqrt",
"(",
"sum",
"(",
"e",
"**",
"2",
"for",
"e",
"in",
"self",
")",
")"
] | https://github.com/liuyubobobo/Play-with-Linear-Algebra/blob/e86175adb908b03756618fbeeeadb448a3551321/09-Vector-Space-Dimension-and-Four-Subspaces/08-Implement-Rank-of-Matrix/playLA/Vector.py#L29-L31 | |
suurjaak/Skyperious | 6a4f264dbac8d326c2fa8aeb5483dbca987860bf | skyperious/support.py | python | FeedbackDialog.OnToggleFullScreen | (self, event) | Handler for toggling screenshot size from fullscreen to window. | Handler for toggling screenshot size from fullscreen to window. | [
"Handler",
"for",
"toggling",
"screenshot",
"size",
"from",
"fullscreen",
"to",
"window",
"."
] | def OnToggleFullScreen(self, event):
"""Handler for toggling screenshot size from fullscreen to window."""
self.SetScreenshot(take_screenshot(self.cb_fullscreen.Value)) | [
"def",
"OnToggleFullScreen",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"SetScreenshot",
"(",
"take_screenshot",
"(",
"self",
".",
"cb_fullscreen",
".",
"Value",
")",
")"
] | https://github.com/suurjaak/Skyperious/blob/6a4f264dbac8d326c2fa8aeb5483dbca987860bf/skyperious/support.py#L378-L380 | ||
tBuLi/symfit | 3bcb66fbbe518f65a1339d6c62be715da4d77398 | symfit/core/models.py | python | HessianModel.hessian | (self) | return [[[sympy.diff(partial_dv, param) for param in self.params]
for partial_dv in comp] for comp in self.jacobian] | :return: Hessian filled with the symbolic expressions for all the
second order partial derivatives. Partial derivatives are taken with
respect to the Parameter's, not the independent Variable's. | :return: Hessian filled with the symbolic expressions for all the
second order partial derivatives. Partial derivatives are taken with
respect to the Parameter's, not the independent Variable's. | [
":",
"return",
":",
"Hessian",
"filled",
"with",
"the",
"symbolic",
"expressions",
"for",
"all",
"the",
"second",
"order",
"partial",
"derivatives",
".",
"Partial",
"derivatives",
"are",
"taken",
"with",
"respect",
"to",
"the",
"Parameter",
"s",
"not",
"the",
... | def hessian(self):
"""
:return: Hessian filled with the symbolic expressions for all the
second order partial derivatives. Partial derivatives are taken with
respect to the Parameter's, not the independent Variable's.
"""
return [[[sympy.diff(partial_dv, param) fo... | [
"def",
"hessian",
"(",
"self",
")",
":",
"return",
"[",
"[",
"[",
"sympy",
".",
"diff",
"(",
"partial_dv",
",",
"param",
")",
"for",
"param",
"in",
"self",
".",
"params",
"]",
"for",
"partial_dv",
"in",
"comp",
"]",
"for",
"comp",
"in",
"self",
"."... | https://github.com/tBuLi/symfit/blob/3bcb66fbbe518f65a1339d6c62be715da4d77398/symfit/core/models.py#L925-L932 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/napalm_mod.py | python | alive | (**kwargs) | return salt.utils.napalm.call(
napalm_device, "is_alive", **{} # pylint: disable=undefined-variable
) | Returns the alive status of the connection layer.
The output is a dictionary under the usual dictionary
output of the NAPALM modules.
CLI Example:
.. code-block:: bash
salt '*' napalm.alive
Output Example:
.. code-block:: yaml
result: True
out:
is_alive:... | Returns the alive status of the connection layer.
The output is a dictionary under the usual dictionary
output of the NAPALM modules. | [
"Returns",
"the",
"alive",
"status",
"of",
"the",
"connection",
"layer",
".",
"The",
"output",
"is",
"a",
"dictionary",
"under",
"the",
"usual",
"dictionary",
"output",
"of",
"the",
"NAPALM",
"modules",
"."
] | def alive(**kwargs): # pylint: disable=unused-argument
"""
Returns the alive status of the connection layer.
The output is a dictionary under the usual dictionary
output of the NAPALM modules.
CLI Example:
.. code-block:: bash
salt '*' napalm.alive
Output Example:
.. code-b... | [
"def",
"alive",
"(",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"return",
"salt",
".",
"utils",
".",
"napalm",
".",
"call",
"(",
"napalm_device",
",",
"\"is_alive\"",
",",
"*",
"*",
"{",
"}",
"# pylint: disable=undefined-variable",
")"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/napalm_mod.py#L170-L193 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/bdf/bdf_interface/pybdf.py | python | BDFInputPy._validate_open_file | (self, bdf_filename: Union[str, StringIO],
bdf_filename_inc: str,
check: bool=True) | checks that the file doesn't have obvious errors
- hasn't been used
- not a directory
- is a file
Parameters
----------
bdf_filename : str
the current bdf filename
bdf_filename_inc : str
the next bdf filename
check : bool; default... | checks that the file doesn't have obvious errors
- hasn't been used
- not a directory
- is a file | [
"checks",
"that",
"the",
"file",
"doesn",
"t",
"have",
"obvious",
"errors",
"-",
"hasn",
"t",
"been",
"used",
"-",
"not",
"a",
"directory",
"-",
"is",
"a",
"file"
] | def _validate_open_file(self, bdf_filename: Union[str, StringIO],
bdf_filename_inc: str,
check: bool=True) -> None:
"""
checks that the file doesn't have obvious errors
- hasn't been used
- not a directory
- is a file
... | [
"def",
"_validate_open_file",
"(",
"self",
",",
"bdf_filename",
":",
"Union",
"[",
"str",
",",
"StringIO",
"]",
",",
"bdf_filename_inc",
":",
"str",
",",
"check",
":",
"bool",
"=",
"True",
")",
"->",
"None",
":",
"if",
"check",
":",
"if",
"not",
"os",
... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/bdf_interface/pybdf.py#L677-L721 | ||
geopython/OWSLib | 414375413c9e2bab33a2d09608ab209875ce6daf | owslib/util.py | python | cleanup_namespaces | (element) | Remove unused namespaces from an element | Remove unused namespaces from an element | [
"Remove",
"unused",
"namespaces",
"from",
"an",
"element"
] | def cleanup_namespaces(element):
""" Remove unused namespaces from an element """
if etree.__name__ == 'lxml.etree':
etree.cleanup_namespaces(element)
return element
else:
return etree.fromstring(etree.tostring(element)) | [
"def",
"cleanup_namespaces",
"(",
"element",
")",
":",
"if",
"etree",
".",
"__name__",
"==",
"'lxml.etree'",
":",
"etree",
".",
"cleanup_namespaces",
"(",
"element",
")",
"return",
"element",
"else",
":",
"return",
"etree",
".",
"fromstring",
"(",
"etree",
"... | https://github.com/geopython/OWSLib/blob/414375413c9e2bab33a2d09608ab209875ce6daf/owslib/util.py#L278-L284 | ||
solarwinds/orionsdk-python | 97168451ddbc68db1773717f592a42f78be0eefe | orionsdk/solarwinds.py | python | SolarWinds.does_dependency_exist | (self, dependency_name) | Checks to see if a SolarWinds dependency exists with the given name. Calls the get_dependency_id method of
the class and uses the returned value to determine whether or not the dependency exists.
Args:
dependency_name(string): A dependency name which should equal the name used ... | Checks to see if a SolarWinds dependency exists with the given name. Calls the get_dependency_id method of
the class and uses the returned value to determine whether or not the dependency exists. | [
"Checks",
"to",
"see",
"if",
"a",
"SolarWinds",
"dependency",
"exists",
"with",
"the",
"given",
"name",
".",
"Calls",
"the",
"get_dependency_id",
"method",
"of",
"the",
"class",
"and",
"uses",
"the",
"returned",
"value",
"to",
"determine",
"whether",
"or",
"... | def does_dependency_exist(self, dependency_name):
""" Checks to see if a SolarWinds dependency exists with the given name. Calls the get_dependency_id method of
the class and uses the returned value to determine whether or not the dependency exists.
Args:
dependency_nam... | [
"def",
"does_dependency_exist",
"(",
"self",
",",
"dependency_name",
")",
":",
"if",
"self",
".",
"get_dependency_id",
"(",
"dependency_name",
")",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | https://github.com/solarwinds/orionsdk-python/blob/97168451ddbc68db1773717f592a42f78be0eefe/orionsdk/solarwinds.py#L582-L599 | ||
nathanlopez/Stitch | 8e22e91c94237959c02d521aab58dc7e3d994cea | Application/stitch_cmd.py | python | stitch_server.complete_ls | (self, text, line, begidx, endidx) | return find_path(text, line, begidx, endidx, dir_only = True) | [] | def complete_ls(self, text, line, begidx, endidx):
return find_path(text, line, begidx, endidx, dir_only = True) | [
"def",
"complete_ls",
"(",
"self",
",",
"text",
",",
"line",
",",
"begidx",
",",
"endidx",
")",
":",
"return",
"find_path",
"(",
"text",
",",
"line",
",",
"begidx",
",",
"endidx",
",",
"dir_only",
"=",
"True",
")"
] | https://github.com/nathanlopez/Stitch/blob/8e22e91c94237959c02d521aab58dc7e3d994cea/Application/stitch_cmd.py#L458-L459 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/worker/control.py | python | control_command | (**kwargs) | return Panel.register(type='control', **kwargs) | [] | def control_command(**kwargs):
return Panel.register(type='control', **kwargs) | [
"def",
"control_command",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"Panel",
".",
"register",
"(",
"type",
"=",
"'control'",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/worker/control.py#L73-L74 | |||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/freezer.py | python | _remove_extra_packages | (frozen_pkgs, ret, **kwargs) | Remove extra packages and update the ret dict | Remove extra packages and update the ret dict | [
"Remove",
"extra",
"packages",
"and",
"update",
"the",
"ret",
"dict"
] | def _remove_extra_packages(frozen_pkgs, ret, **kwargs):
"""Remove extra packages and update the ret dict"""
pkgs = __salt__["pkg.list_pkgs"](**kwargs)
extra_pkgs = set(pkgs) - set(frozen_pkgs)
for pkg in extra_pkgs:
try:
__salt__["pkg.remove"](name=pkg, **kwargs)
ret["pkg... | [
"def",
"_remove_extra_packages",
"(",
"frozen_pkgs",
",",
"ret",
",",
"*",
"*",
"kwargs",
")",
":",
"pkgs",
"=",
"__salt__",
"[",
"\"pkg.list_pkgs\"",
"]",
"(",
"*",
"*",
"kwargs",
")",
"extra_pkgs",
"=",
"set",
"(",
"pkgs",
")",
"-",
"set",
"(",
"froz... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/freezer.py#L204-L216 | ||
stellargraph/stellargraph | 3c2c8c18ab4c5c16660f350d8e23d7dc39e738de | stellargraph/mapper/sequences.py | python | LinkSequence.on_epoch_end | (self) | Shuffle all link IDs at the end of each epoch | Shuffle all link IDs at the end of each epoch | [
"Shuffle",
"all",
"link",
"IDs",
"at",
"the",
"end",
"of",
"each",
"epoch"
] | def on_epoch_end(self):
"""
Shuffle all link IDs at the end of each epoch
"""
self.indices = list(range(self.data_size))
if self.shuffle:
self._rs.shuffle(self.indices) | [
"def",
"on_epoch_end",
"(",
"self",
")",
":",
"self",
".",
"indices",
"=",
"list",
"(",
"range",
"(",
"self",
".",
"data_size",
")",
")",
"if",
"self",
".",
"shuffle",
":",
"self",
".",
"_rs",
".",
"shuffle",
"(",
"self",
".",
"indices",
")"
] | https://github.com/stellargraph/stellargraph/blob/3c2c8c18ab4c5c16660f350d8e23d7dc39e738de/stellargraph/mapper/sequences.py#L245-L251 | ||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3cfg.py | python | S3Config.get_supply_shipping_code | (self) | return self.supply.get("shipping_code") | Custom shipping code generator (REQ, WB, GRN etc)
- function(prefix, site_id, field) | Custom shipping code generator (REQ, WB, GRN etc)
- function(prefix, site_id, field) | [
"Custom",
"shipping",
"code",
"generator",
"(",
"REQ",
"WB",
"GRN",
"etc",
")",
"-",
"function",
"(",
"prefix",
"site_id",
"field",
")"
] | def get_supply_shipping_code(self):
"""
Custom shipping code generator (REQ, WB, GRN etc)
- function(prefix, site_id, field)
"""
return self.supply.get("shipping_code") | [
"def",
"get_supply_shipping_code",
"(",
"self",
")",
":",
"return",
"self",
".",
"supply",
".",
"get",
"(",
"\"shipping_code\"",
")"
] | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3cfg.py#L6171-L6176 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.