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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/db/models/fields/__init__.py | python | Field.value_from_object | (self, obj) | return getattr(obj, self.attname) | Returns the value of this field in the given model instance. | Returns the value of this field in the given model instance. | [
"Returns",
"the",
"value",
"of",
"this",
"field",
"in",
"the",
"given",
"model",
"instance",
"."
] | def value_from_object(self, obj):
"""
Returns the value of this field in the given model instance.
"""
return getattr(obj, self.attname) | [
"def",
"value_from_object",
"(",
"self",
",",
"obj",
")",
":",
"return",
"getattr",
"(",
"obj",
",",
"self",
".",
"attname",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/db/models/fields/__init__.py#L489-L493 | |
lyft/cartography | 921a790d686c679ab5d8936b07e167fd424ee8d6 | cartography/intel/okta/users.py | python | _load_okta_users | (
neo4j_session: neo4j.Session, okta_org_id: str, user_list: List[Dict],
okta_update_tag: int,
) | Load Okta user information into the graph
:param neo4j_session: session with neo4j server
:param okta_org_id: oktat organization id
:param user_list: list of users
:param okta_update_tag: The timestamp value to set our new Neo4j resources with
:return: Nothing | Load Okta user information into the graph
:param neo4j_session: session with neo4j server
:param okta_org_id: oktat organization id
:param user_list: list of users
:param okta_update_tag: The timestamp value to set our new Neo4j resources with
:return: Nothing | [
"Load",
"Okta",
"user",
"information",
"into",
"the",
"graph",
":",
"param",
"neo4j_session",
":",
"session",
"with",
"neo4j",
"server",
":",
"param",
"okta_org_id",
":",
"oktat",
"organization",
"id",
":",
"param",
"user_list",
":",
"list",
"of",
"users",
"... | def _load_okta_users(
neo4j_session: neo4j.Session, okta_org_id: str, user_list: List[Dict],
okta_update_tag: int,
) -> None:
"""
Load Okta user information into the graph
:param neo4j_session: session with neo4j server
:param okta_org_id: oktat organization id
:param user_list: list of user... | [
"def",
"_load_okta_users",
"(",
"neo4j_session",
":",
"neo4j",
".",
"Session",
",",
"okta_org_id",
":",
"str",
",",
"user_list",
":",
"List",
"[",
"Dict",
"]",
",",
"okta_update_tag",
":",
"int",
",",
")",
"->",
"None",
":",
"ingest_statement",
"=",
"\"\"\... | https://github.com/lyft/cartography/blob/921a790d686c679ab5d8936b07e167fd424ee8d6/cartography/intel/okta/users.py#L120-L170 | ||
pydicom/pynetdicom | f57d8214c82b63c8e76638af43ce331f584a80fa | pynetdicom/presentation.py | python | PresentationContext.context_id | (self, value: Optional[int]) | Set the context's *ID* parameter.
Parameters
----------
value : int
An odd integer between 1 and 255 (inclusive). | Set the context's *ID* parameter. | [
"Set",
"the",
"context",
"s",
"*",
"ID",
"*",
"parameter",
"."
] | def context_id(self, value: Optional[int]) -> None:
"""Set the context's *ID* parameter.
Parameters
----------
value : int
An odd integer between 1 and 255 (inclusive).
"""
if value is not None and (not 1 <= value <= 255 or value % 2 == 0):
raise ... | [
"def",
"context_id",
"(",
"self",
",",
"value",
":",
"Optional",
"[",
"int",
"]",
")",
"->",
"None",
":",
"if",
"value",
"is",
"not",
"None",
"and",
"(",
"not",
"1",
"<=",
"value",
"<=",
"255",
"or",
"value",
"%",
"2",
"==",
"0",
")",
":",
"rai... | https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/presentation.py#L338-L351 | ||
frerich/clcache | cae73d8255d78db8ba11e23c51fd2c9a89e7475b | clcache/__main__.py | python | CompilerArtifactsRepository.removeEntry | (self, keyToBeRemoved) | [] | def removeEntry(self, keyToBeRemoved):
compilerArtifactsDir = self.section(keyToBeRemoved).cacheEntryDir(keyToBeRemoved)
rmtree(compilerArtifactsDir, ignore_errors=True) | [
"def",
"removeEntry",
"(",
"self",
",",
"keyToBeRemoved",
")",
":",
"compilerArtifactsDir",
"=",
"self",
".",
"section",
"(",
"keyToBeRemoved",
")",
".",
"cacheEntryDir",
"(",
"keyToBeRemoved",
")",
"rmtree",
"(",
"compilerArtifactsDir",
",",
"ignore_errors",
"=",... | https://github.com/frerich/clcache/blob/cae73d8255d78db8ba11e23c51fd2c9a89e7475b/clcache/__main__.py#L423-L425 | ||||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | tokumx/datadog_checks/tokumx/vendor/bson/son.py | python | SON.to_dict | (self) | return transform_value(dict(self)) | Convert a SON document to a normal Python dictionary instance.
This is trickier than just *dict(...)* because it needs to be
recursive. | Convert a SON document to a normal Python dictionary instance. | [
"Convert",
"a",
"SON",
"document",
"to",
"a",
"normal",
"Python",
"dictionary",
"instance",
"."
] | def to_dict(self):
"""Convert a SON document to a normal Python dictionary instance.
This is trickier than just *dict(...)* because it needs to be
recursive.
"""
def transform_value(value):
if isinstance(value, list):
return [transform_value(v) for v... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"def",
"transform_value",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"return",
"[",
"transform_value",
"(",
"v",
")",
"for",
"v",
"in",
"value",
"]",
"elif",
"isinstance",
... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/tokumx/datadog_checks/tokumx/vendor/bson/son.py#L220-L237 | |
pallets/jinja | 077b7918a7642ff6742fe48a32e54d7875140894 | src/jinja2/utils.py | python | pass_eval_context | (f: F) | return f | Pass the :class:`~jinja2.nodes.EvalContext` as the first argument
to the decorated function when called while rendering a template.
See :ref:`eval-context`.
Can be used on functions, filters, and tests.
If only ``EvalContext.environment`` is needed, use
:func:`pass_environment`.
.. versionadd... | Pass the :class:`~jinja2.nodes.EvalContext` as the first argument
to the decorated function when called while rendering a template.
See :ref:`eval-context`. | [
"Pass",
"the",
":",
"class",
":",
"~jinja2",
".",
"nodes",
".",
"EvalContext",
"as",
"the",
"first",
"argument",
"to",
"the",
"decorated",
"function",
"when",
"called",
"while",
"rendering",
"a",
"template",
".",
"See",
":",
"ref",
":",
"eval",
"-",
"con... | def pass_eval_context(f: F) -> F:
"""Pass the :class:`~jinja2.nodes.EvalContext` as the first argument
to the decorated function when called while rendering a template.
See :ref:`eval-context`.
Can be used on functions, filters, and tests.
If only ``EvalContext.environment`` is needed, use
:fu... | [
"def",
"pass_eval_context",
"(",
"f",
":",
"F",
")",
"->",
"F",
":",
"f",
".",
"jinja_pass_arg",
"=",
"_PassArg",
".",
"eval_context",
"# type: ignore",
"return",
"f"
] | https://github.com/pallets/jinja/blob/077b7918a7642ff6742fe48a32e54d7875140894/src/jinja2/utils.py#L46-L60 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/orm/interfaces.py | python | PropComparator.has | (self, criterion=None, **kwargs) | return self.operate(PropComparator.has_op, criterion, **kwargs) | r"""Return true if this element references a member which meets the
given criterion.
The usual implementation of ``has()`` is
:meth:`.RelationshipProperty.Comparator.has`.
:param criterion: an optional ClauseElement formulated against the
member class' table or attributes.
... | r"""Return true if this element references a member which meets the
given criterion. | [
"r",
"Return",
"true",
"if",
"this",
"element",
"references",
"a",
"member",
"which",
"meets",
"the",
"given",
"criterion",
"."
] | def has(self, criterion=None, **kwargs):
r"""Return true if this element references a member which meets the
given criterion.
The usual implementation of ``has()`` is
:meth:`.RelationshipProperty.Comparator.has`.
:param criterion: an optional ClauseElement formulated against th... | [
"def",
"has",
"(",
"self",
",",
"criterion",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"operate",
"(",
"PropComparator",
".",
"has_op",
",",
"criterion",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/orm/interfaces.py#L458-L474 | |
hugapi/hug | 8b5ac00632543addfdcecc326d0475a685a0cba7 | examples/on_startup.py | python | test | () | return data | Returns all stored data | Returns all stored data | [
"Returns",
"all",
"stored",
"data"
] | def test():
"""Returns all stored data"""
return data | [
"def",
"test",
"(",
")",
":",
"return",
"data"
] | https://github.com/hugapi/hug/blob/8b5ac00632543addfdcecc326d0475a685a0cba7/examples/on_startup.py#L21-L23 | |
qutip/qutip | 52d01da181a21b810c3407812c670f35fdc647e8 | qutip/superoperator.py | python | vector_to_operator | (op) | return Qobj(
sp_reshape(op.data.T, shape[::-1]).T,
dims=dims, shape=shape, copy=False,
) | Create a matrix representation given a quantum operator in vector form.
The passed object should have a ``Qobj.type`` of 'operator-ket'; this
function is not designed for general-purpose matrix reshaping.
Parameters
----------
op : Qobj or QobjEvo
Quantum operator in column-stacked-vector f... | Create a matrix representation given a quantum operator in vector form.
The passed object should have a ``Qobj.type`` of 'operator-ket'; this
function is not designed for general-purpose matrix reshaping. | [
"Create",
"a",
"matrix",
"representation",
"given",
"a",
"quantum",
"operator",
"in",
"vector",
"form",
".",
"The",
"passed",
"object",
"should",
"have",
"a",
"Qobj",
".",
"type",
"of",
"operator",
"-",
"ket",
";",
"this",
"function",
"is",
"not",
"designe... | def vector_to_operator(op):
"""
Create a matrix representation given a quantum operator in vector form.
The passed object should have a ``Qobj.type`` of 'operator-ket'; this
function is not designed for general-purpose matrix reshaping.
Parameters
----------
op : Qobj or QobjEvo
Qua... | [
"def",
"vector_to_operator",
"(",
"op",
")",
":",
"if",
"isinstance",
"(",
"op",
",",
"QobjEvo",
")",
":",
"return",
"op",
".",
"apply",
"(",
"vector_to_operator",
")",
"if",
"not",
"op",
".",
"isoperket",
":",
"raise",
"ValueError",
"(",
"\"only valid for... | https://github.com/qutip/qutip/blob/52d01da181a21b810c3407812c670f35fdc647e8/qutip/superoperator.py#L249-L279 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/stats/_mstats_basic.py | python | normaltest | (a, axis=0) | return NormaltestResult(k2, distributions.chi2.sf(k2, 2)) | Tests whether a sample differs from a normal distribution.
Parameters
----------
a : array_like
The array containing the data to be tested.
axis : int or None, optional
Axis along which to compute test. Default is 0. If None,
compute over the whole array `a`.
Returns
--... | Tests whether a sample differs from a normal distribution. | [
"Tests",
"whether",
"a",
"sample",
"differs",
"from",
"a",
"normal",
"distribution",
"."
] | def normaltest(a, axis=0):
"""
Tests whether a sample differs from a normal distribution.
Parameters
----------
a : array_like
The array containing the data to be tested.
axis : int or None, optional
Axis along which to compute test. Default is 0. If None,
compute over t... | [
"def",
"normaltest",
"(",
"a",
",",
"axis",
"=",
"0",
")",
":",
"a",
",",
"axis",
"=",
"_chk_asarray",
"(",
"a",
",",
"axis",
")",
"s",
",",
"_",
"=",
"skewtest",
"(",
"a",
",",
"axis",
")",
"k",
",",
"_",
"=",
"kurtosistest",
"(",
"a",
",",
... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/stats/_mstats_basic.py#L2868-L2898 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py | python | FillSkein.addGridLinePoints | ( self, begin, end, gridPoints, gridRotationAngle, offset, y ) | Add the segments of one line of a grid to the infill. | Add the segments of one line of a grid to the infill. | [
"Add",
"the",
"segments",
"of",
"one",
"line",
"of",
"a",
"grid",
"to",
"the",
"infill",
"."
] | def addGridLinePoints( self, begin, end, gridPoints, gridRotationAngle, offset, y ):
'Add the segments of one line of a grid to the infill.'
if self.gridRadius == 0.0:
return
gridXStep = int(math.floor((begin) / self.gridXStepSize)) - 3
gridXOffset = offset + self.gridXStepSize * float(gridXStep)
while gri... | [
"def",
"addGridLinePoints",
"(",
"self",
",",
"begin",
",",
"end",
",",
"gridPoints",
",",
"gridRotationAngle",
",",
"offset",
",",
"y",
")",
":",
"if",
"self",
".",
"gridRadius",
"==",
"0.0",
":",
"return",
"gridXStep",
"=",
"int",
"(",
"math",
".",
"... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py#L1048-L1060 | ||
pydicom/pynetdicom | f57d8214c82b63c8e76638af43ce331f584a80fa | pynetdicom/apps/common.py | python | ElementPath.update | (self, ds) | return ds | Return a pydicom Dataset after updating it.
Parameters
----------
ds : pydicom.dataset.Dataset
The dataset to update.
Returns
-------
pydicom.dataset.Dataset
The updated dataset. | Return a pydicom Dataset after updating it. | [
"Return",
"a",
"pydicom",
"Dataset",
"after",
"updating",
"it",
"."
] | def update(self, ds):
"""Return a pydicom Dataset after updating it.
Parameters
----------
ds : pydicom.dataset.Dataset
The dataset to update.
Returns
-------
pydicom.dataset.Dataset
The updated dataset.
"""
if self.tag no... | [
"def",
"update",
"(",
"self",
",",
"ds",
")",
":",
"if",
"self",
".",
"tag",
"not",
"in",
"ds",
":",
"# Add new element or sequence to dataset",
"if",
"self",
".",
"is_sequence",
":",
"# Add new SequenceElement with no items",
"ds",
".",
"add_new",
"(",
"self",
... | https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/apps/common.py#L314-L367 | |
feeluown/FeelUOwn | ec104689add09c351e6ca4133a5d0632294b3784 | mpv.py | python | MPV.prepare_and_wait_for_event | (self, *event_types, cond=lambda evt: True) | Context manager that waits for the indicated event(s) like wait_for_event after running. If cond is given,
waits until cond(event) is true. Raises a ShutdownError if the core is shutdown while waiting. This also happens
when 'shutdown' is in event_types.
Compared to wait_for_event this handles t... | Context manager that waits for the indicated event(s) like wait_for_event after running. If cond is given,
waits until cond(event) is true. Raises a ShutdownError if the core is shutdown while waiting. This also happens
when 'shutdown' is in event_types.
Compared to wait_for_event this handles t... | [
"Context",
"manager",
"that",
"waits",
"for",
"the",
"indicated",
"event",
"(",
"s",
")",
"like",
"wait_for_event",
"after",
"running",
".",
"If",
"cond",
"is",
"given",
"waits",
"until",
"cond",
"(",
"event",
")",
"is",
"true",
".",
"Raises",
"a",
"Shut... | def prepare_and_wait_for_event(self, *event_types, cond=lambda evt: True):
"""Context manager that waits for the indicated event(s) like wait_for_event after running. If cond is given,
waits until cond(event) is true. Raises a ShutdownError if the core is shutdown while waiting. This also happens
... | [
"def",
"prepare_and_wait_for_event",
"(",
"self",
",",
"*",
"event_types",
",",
"cond",
"=",
"lambda",
"evt",
":",
"True",
")",
":",
"sema",
"=",
"threading",
".",
"Semaphore",
"(",
"value",
"=",
"0",
")",
"@",
"self",
".",
"event_callback",
"(",
"'shutd... | https://github.com/feeluown/FeelUOwn/blob/ec104689add09c351e6ca4133a5d0632294b3784/mpv.py#L983-L1011 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/click_view_service/transports/grpc.py | python | ClickViewServiceGrpcTransport.grpc_channel | (self) | return self._grpc_channel | Return the channel designed to connect to this service. | Return the channel designed to connect to this service. | [
"Return",
"the",
"channel",
"designed",
"to",
"connect",
"to",
"this",
"service",
"."
] | def grpc_channel(self) -> grpc.Channel:
"""Return the channel designed to connect to this service.
"""
return self._grpc_channel | [
"def",
"grpc_channel",
"(",
"self",
")",
"->",
"grpc",
".",
"Channel",
":",
"return",
"self",
".",
"_grpc_channel"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/click_view_service/transports/grpc.py#L210-L213 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/nftables.py | python | insert | (table="filter", chain=None, position=None, rule=None, family="ipv4") | return ret | Insert a rule into the specified table & chain, at the specified position.
If position is not specified, rule will be inserted in first position.
This function accepts a rule in a standard nftables command format,
starting with the chain. Trying to force users to adapt to a new
method of creat... | Insert a rule into the specified table & chain, at the specified position. | [
"Insert",
"a",
"rule",
"into",
"the",
"specified",
"table",
"&",
"chain",
"at",
"the",
"specified",
"position",
"."
] | def insert(table="filter", chain=None, position=None, rule=None, family="ipv4"):
"""
Insert a rule into the specified table & chain, at the specified position.
If position is not specified, rule will be inserted in first position.
This function accepts a rule in a standard nftables command format,
... | [
"def",
"insert",
"(",
"table",
"=",
"\"filter\"",
",",
"chain",
"=",
"None",
",",
"position",
"=",
"None",
",",
"rule",
"=",
"None",
",",
"family",
"=",
"\"ipv4\"",
")",
":",
"ret",
"=",
"{",
"\"comment\"",
":",
"\"Failed to insert rule {} to table {}.\"",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/nftables.py#L934-L1016 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/tempfile.py | python | TemporaryDirectory.__init__ | (self, suffix=None, prefix=None, dir=None,
ignore_cleanup_errors=False) | [] | def __init__(self, suffix=None, prefix=None, dir=None,
ignore_cleanup_errors=False):
self.name = mkdtemp(suffix, prefix, dir)
self._ignore_cleanup_errors = ignore_cleanup_errors
self._finalizer = _weakref.finalize(
self, self._cleanup, self.name,
warn_mes... | [
"def",
"__init__",
"(",
"self",
",",
"suffix",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"dir",
"=",
"None",
",",
"ignore_cleanup_errors",
"=",
"False",
")",
":",
"self",
".",
"name",
"=",
"mkdtemp",
"(",
"suffix",
",",
"prefix",
",",
"dir",
")",... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/tempfile.py#L794-L801 | ||||
wandb/client | 3963364d8112b7dedb928fa423b6878ea1b467d9 | wandb/apis/normalize.py | python | normalize_exceptions | (func) | return wrapper | Function decorator for catching common errors and re-raising as wandb.Error | Function decorator for catching common errors and re-raising as wandb.Error | [
"Function",
"decorator",
"for",
"catching",
"common",
"errors",
"and",
"re",
"-",
"raising",
"as",
"wandb",
".",
"Error"
] | def normalize_exceptions(func):
"""Function decorator for catching common errors and re-raising as wandb.Error"""
@wraps(func)
def wrapper(*args, **kwargs):
message = "Whoa, you found a bug."
try:
return func(*args, **kwargs)
except requests.HTTPError as err:
... | [
"def",
"normalize_exceptions",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"message",
"=",
"\"Whoa, you found a bug.\"",
"try",
":",
"return",
"func",
"(",
"*",
"args",
"... | https://github.com/wandb/client/blob/3963364d8112b7dedb928fa423b6878ea1b467d9/wandb/apis/normalize.py#L17-L64 | |
tensorforce/tensorforce | 085a62bd37e0fdfd05691db29edeb2e1714ffbda | tensorforce/agents/agent.py | python | Agent.tracked_tensors | (self) | return self.model.tracked_tensors() | Returns the current value of all tracked tensors (as specified by "tracking" agent
argument). Note that not all tensors change at every timestep.
Returns:
dict[values]: Dictionary containing the current value of all tracked tensors. | Returns the current value of all tracked tensors (as specified by "tracking" agent
argument). Note that not all tensors change at every timestep. | [
"Returns",
"the",
"current",
"value",
"of",
"all",
"tracked",
"tensors",
"(",
"as",
"specified",
"by",
"tracking",
"agent",
"argument",
")",
".",
"Note",
"that",
"not",
"all",
"tensors",
"change",
"at",
"every",
"timestep",
"."
] | def tracked_tensors(self):
"""
Returns the current value of all tracked tensors (as specified by "tracking" agent
argument). Note that not all tensors change at every timestep.
Returns:
dict[values]: Dictionary containing the current value of all tracked tensors.
"""... | [
"def",
"tracked_tensors",
"(",
"self",
")",
":",
"return",
"self",
".",
"model",
".",
"tracked_tensors",
"(",
")"
] | https://github.com/tensorforce/tensorforce/blob/085a62bd37e0fdfd05691db29edeb2e1714ffbda/tensorforce/agents/agent.py#L364-L372 | |
kennethreitz-archive/requests3 | 69eb662703b40db58fdc6c095d0fe130c56649bb | requests3/core/_http/_sync/response.py | python | HTTPResponse.data | (self) | [] | def data(self):
# For backwords-compat with earlier urllib3 0.4 and earlier.
if self._body is not None:
return self._body
if self._fp:
return self.read(cache_content=True) | [
"def",
"data",
"(",
"self",
")",
":",
"# For backwords-compat with earlier urllib3 0.4 and earlier.",
"if",
"self",
".",
"_body",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_body",
"if",
"self",
".",
"_fp",
":",
"return",
"self",
".",
"read",
"(",
"ca... | https://github.com/kennethreitz-archive/requests3/blob/69eb662703b40db58fdc6c095d0fe130c56649bb/requests3/core/_http/_sync/response.py#L165-L171 | ||||
AI-ON/Multitask-and-Transfer-Learning | 31e0798d436e314ddbc64c4a6b935df1b2160e50 | AMTLB/amtlb/transfer_benchmark.py | python | BenchmarkResult.record_game | (self, game_name, round) | [] | def record_game(self, game_name, round):
self.games.append((game_name, round)) | [
"def",
"record_game",
"(",
"self",
",",
"game_name",
",",
"round",
")",
":",
"self",
".",
"games",
".",
"append",
"(",
"(",
"game_name",
",",
"round",
")",
")"
] | https://github.com/AI-ON/Multitask-and-Transfer-Learning/blob/31e0798d436e314ddbc64c4a6b935df1b2160e50/AMTLB/amtlb/transfer_benchmark.py#L38-L39 | ||||
elastic/detection-rules | fd824d1fd5404c00eadb0251c8eb4f71af52a6d5 | detection_rules/rule_validators.py | python | KQLValidator.validate | (self, data: QueryRuleData, meta: RuleMeta) | Static method to validate the query, called from the parent which contains [metadata] information. | Static method to validate the query, called from the parent which contains [metadata] information. | [
"Static",
"method",
"to",
"validate",
"the",
"query",
"called",
"from",
"the",
"parent",
"which",
"contains",
"[",
"metadata",
"]",
"information",
"."
] | def validate(self, data: QueryRuleData, meta: RuleMeta) -> None:
"""Static method to validate the query, called from the parent which contains [metadata] information."""
ast = self.ast
if meta.query_schema_validation is False or meta.maturity == "deprecated":
# syntax only, which is... | [
"def",
"validate",
"(",
"self",
",",
"data",
":",
"QueryRuleData",
",",
"meta",
":",
"RuleMeta",
")",
"->",
"None",
":",
"ast",
"=",
"self",
".",
"ast",
"if",
"meta",
".",
"query_schema_validation",
"is",
"False",
"or",
"meta",
".",
"maturity",
"==",
"... | https://github.com/elastic/detection-rules/blob/fd824d1fd5404c00eadb0251c8eb4f71af52a6d5/detection_rules/rule_validators.py#L31-L60 | ||
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/Shared/multiprocessing/util.py | python | is_exiting | () | return _exiting or _exiting is None | Returns true if the process is shutting down | Returns true if the process is shutting down | [
"Returns",
"true",
"if",
"the",
"process",
"is",
"shutting",
"down"
] | def is_exiting():
'''
Returns true if the process is shutting down
'''
return _exiting or _exiting is None | [
"def",
"is_exiting",
"(",
")",
":",
"return",
"_exiting",
"or",
"_exiting",
"is",
"None"
] | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Shared/multiprocessing/util.py#L286-L290 | |
invesalius/invesalius3 | 0616d3e73bfe0baf7525877dbf6acab697395eb9 | invesalius/utils.py | python | debug | (error_str) | Redirects output to file, or to the terminal
This should be used in the place of "print" | Redirects output to file, or to the terminal
This should be used in the place of "print" | [
"Redirects",
"output",
"to",
"file",
"or",
"to",
"the",
"terminal",
"This",
"should",
"be",
"used",
"in",
"the",
"place",
"of",
"print"
] | def debug(error_str):
"""
Redirects output to file, or to the terminal
This should be used in the place of "print"
"""
from invesalius.session import Session
session = Session()
#if session.debug:
print(error_str) | [
"def",
"debug",
"(",
"error_str",
")",
":",
"from",
"invesalius",
".",
"session",
"import",
"Session",
"session",
"=",
"Session",
"(",
")",
"#if session.debug:",
"print",
"(",
"error_str",
")"
] | https://github.com/invesalius/invesalius3/blob/0616d3e73bfe0baf7525877dbf6acab697395eb9/invesalius/utils.py#L74-L82 | ||
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/microphone.py | python | AudioCapture.reset | (self, log=True) | Restores to fresh state, ready to record again | Restores to fresh state, ready to record again | [
"Restores",
"to",
"fresh",
"state",
"ready",
"to",
"record",
"again"
] | def reset(self, log=True):
"""Restores to fresh state, ready to record again
"""
if log and self.autoLog:
msg = '%s: resetting at %.3f'
logging.exp(msg % (self.loggingId, core.getTime()))
self.__init__(name=self.name, saveDir=self.saveDir) | [
"def",
"reset",
"(",
"self",
",",
"log",
"=",
"True",
")",
":",
"if",
"log",
"and",
"self",
".",
"autoLog",
":",
"msg",
"=",
"'%s: resetting at %.3f'",
"logging",
".",
"exp",
"(",
"msg",
"%",
"(",
"self",
".",
"loggingId",
",",
"core",
".",
"getTime"... | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/microphone.py#L215-L221 | ||
toxygen-project/toxygen | 0a54012cf5ee72434b923bcde7d8f1a4e575ce2f | toxygen/callbacks.py | python | call_state | (toxav, friend_number, mask, user_data) | New call state | New call state | [
"New",
"call",
"state"
] | def call_state(toxav, friend_number, mask, user_data):
"""
New call state
"""
print(friend_number, mask)
if mask == TOXAV_FRIEND_CALL_STATE['FINISHED'] or mask == TOXAV_FRIEND_CALL_STATE['ERROR']:
invoke_in_main_thread(Profile.get_instance().stop_call, friend_number, True)
else:
... | [
"def",
"call_state",
"(",
"toxav",
",",
"friend_number",
",",
"mask",
",",
"user_data",
")",
":",
"print",
"(",
"friend_number",
",",
"mask",
")",
"if",
"mask",
"==",
"TOXAV_FRIEND_CALL_STATE",
"[",
"'FINISHED'",
"]",
"or",
"mask",
"==",
"TOXAV_FRIEND_CALL_STA... | https://github.com/toxygen-project/toxygen/blob/0a54012cf5ee72434b923bcde7d8f1a4e575ce2f/toxygen/callbacks.py#L295-L303 | ||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/logutils/queue.py | python | QueueListener.__init__ | (self, queue, *handlers) | Initialise an instance with the specified queue and
handlers. | Initialise an instance with the specified queue and
handlers. | [
"Initialise",
"an",
"instance",
"with",
"the",
"specified",
"queue",
"and",
"handlers",
"."
] | def __init__(self, queue, *handlers):
"""
Initialise an instance with the specified queue and
handlers.
"""
self.queue = queue
self.handlers = handlers
self._stop = threading.Event()
self._thread = None | [
"def",
"__init__",
"(",
"self",
",",
"queue",
",",
"*",
"handlers",
")",
":",
"self",
".",
"queue",
"=",
"queue",
"self",
".",
"handlers",
"=",
"handlers",
"self",
".",
"_stop",
"=",
"threading",
".",
"Event",
"(",
")",
"self",
".",
"_thread",
"=",
... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/logutils/queue.py#L112-L120 | ||
stuartlangridge/ColourPicker | dec8f144918aa7964aaf86a346161beb7e997f09 | pick/__main__.py | python | Main.sizeit | (self, w, h) | [] | def sizeit(self, w, h):
self.w.resize(w, h) | [
"def",
"sizeit",
"(",
"self",
",",
"w",
",",
"h",
")",
":",
"self",
".",
"w",
".",
"resize",
"(",
"w",
",",
"h",
")"
] | https://github.com/stuartlangridge/ColourPicker/blob/dec8f144918aa7964aaf86a346161beb7e997f09/pick/__main__.py#L388-L389 | ||||
steveKapturowski/tensorflow-rl | 6dc58da69bad0349a646cfc94ea9c5d1eada8351 | utils/cts.py | python | Estimator.update | (self, symbol) | return log_prob | Updates our count for the given symbol. | Updates our count for the given symbol. | [
"Updates",
"our",
"count",
"for",
"the",
"given",
"symbol",
"."
] | def update(self, symbol):
"""Updates our count for the given symbol."""
log_prob = math.log(self.prob(symbol))
self.counts[symbol] = (
self.counts.get(symbol, self._model.symbol_prior) + 1.0)
self.count_total += 1.0
return log_prob | [
"def",
"update",
"(",
"self",
",",
"symbol",
")",
":",
"log_prob",
"=",
"math",
".",
"log",
"(",
"self",
".",
"prob",
"(",
"symbol",
")",
")",
"self",
".",
"counts",
"[",
"symbol",
"]",
"=",
"(",
"self",
".",
"counts",
".",
"get",
"(",
"symbol",
... | https://github.com/steveKapturowski/tensorflow-rl/blob/6dc58da69bad0349a646cfc94ea9c5d1eada8351/utils/cts.py#L72-L78 | |
pretix/pretix | 96f694cf61345f54132cd26cdeb07d5d11b34232 | src/pretix/presale/views/cart.py | python | get_or_create_cart_id | (request, create=True) | return new_id | This method returns the cart ID in use for this request or creates a new cart ID if required.
Before pretix 1.8.0, the user's session cookie was used as the cart ID in the database.
With the cart session data isolation introduced in 1.8.0 (see cart_session()) this changed
drastically. Now, a different rand... | This method returns the cart ID in use for this request or creates a new cart ID if required. | [
"This",
"method",
"returns",
"the",
"cart",
"ID",
"in",
"use",
"for",
"this",
"request",
"or",
"creates",
"a",
"new",
"cart",
"ID",
"if",
"required",
"."
] | def get_or_create_cart_id(request, create=True):
"""
This method returns the cart ID in use for this request or creates a new cart ID if required.
Before pretix 1.8.0, the user's session cookie was used as the cart ID in the database.
With the cart session data isolation introduced in 1.8.0 (see cart_s... | [
"def",
"get_or_create_cart_id",
"(",
"request",
",",
"create",
"=",
"True",
")",
":",
"session_keyname",
"=",
"'current_cart_event_{}'",
".",
"format",
"(",
"request",
".",
"event",
".",
"pk",
")",
"prefix",
"=",
"''",
"if",
"request",
".",
"resolver_match",
... | https://github.com/pretix/pretix/blob/96f694cf61345f54132cd26cdeb07d5d11b34232/src/pretix/presale/views/cart.py#L280-L384 | |
faucetsdn/ryu | 537f35f4b2bc634ef05e3f28373eb5e24609f989 | ryu/cmd/of_config_cli.py | python | Cmd.do_get | (self, line) | get <peer>
eg. get sw1 | get <peer>
eg. get sw1 | [
"get",
"<peer",
">",
"eg",
".",
"get",
"sw1"
] | def do_get(self, line):
"""get <peer>
eg. get sw1
"""
def f(p, args):
print(p.get())
self._request(line, f) | [
"def",
"do_get",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"print",
"(",
"p",
".",
"get",
"(",
")",
")",
"self",
".",
"_request",
"(",
"line",
",",
"f",
")"
] | https://github.com/faucetsdn/ryu/blob/537f35f4b2bc634ef05e3f28373eb5e24609f989/ryu/cmd/of_config_cli.py#L143-L151 | ||
kvesteri/sqlalchemy-utils | 850d0ea5a8a84c0529d175ee41b9036bea597119 | sqlalchemy_utils/functions/foreign_keys.py | python | dependent_objects | (obj, foreign_keys=None) | return chain | Return a :class:`~sqlalchemy_utils.query_chain.QueryChain` that iterates
through all dependent objects for given SQLAlchemy object.
Consider a User object is referenced in various articles and also in
various orders. Getting all these dependent objects is as easy as::
from sqlalchemy_utils import ... | Return a :class:`~sqlalchemy_utils.query_chain.QueryChain` that iterates
through all dependent objects for given SQLAlchemy object. | [
"Return",
"a",
":",
"class",
":",
"~sqlalchemy_utils",
".",
"query_chain",
".",
"QueryChain",
"that",
"iterates",
"through",
"all",
"dependent",
"objects",
"for",
"given",
"SQLAlchemy",
"object",
"."
] | def dependent_objects(obj, foreign_keys=None):
"""
Return a :class:`~sqlalchemy_utils.query_chain.QueryChain` that iterates
through all dependent objects for given SQLAlchemy object.
Consider a User object is referenced in various articles and also in
various orders. Getting all these dependent obj... | [
"def",
"dependent_objects",
"(",
"obj",
",",
"foreign_keys",
"=",
"None",
")",
":",
"if",
"foreign_keys",
"is",
"None",
":",
"foreign_keys",
"=",
"get_referencing_foreign_keys",
"(",
"obj",
")",
"session",
"=",
"object_session",
"(",
"obj",
")",
"chain",
"=",
... | https://github.com/kvesteri/sqlalchemy-utils/blob/850d0ea5a8a84c0529d175ee41b9036bea597119/sqlalchemy_utils/functions/foreign_keys.py#L192-L286 | |
modoboa/modoboa | 9065b7a5679fee149fc6f6f0e1760699c194cf89 | modoboa/admin/models/mailbox.py | python | MailboxManager.get_for_admin | (self, admin, squery=None) | return self.get_queryset().select_related().filter(qf) | Return the mailboxes that belong to this admin.
The result will contain the mailboxes defined for each domain that
user can see.
:param string squery: a search query
:return: a list of ``Mailbox`` objects | Return the mailboxes that belong to this admin. | [
"Return",
"the",
"mailboxes",
"that",
"belong",
"to",
"this",
"admin",
"."
] | def get_for_admin(self, admin, squery=None):
"""Return the mailboxes that belong to this admin.
The result will contain the mailboxes defined for each domain that
user can see.
:param string squery: a search query
:return: a list of ``Mailbox`` objects
"""
qf = ... | [
"def",
"get_for_admin",
"(",
"self",
",",
"admin",
",",
"squery",
"=",
"None",
")",
":",
"qf",
"=",
"None",
"if",
"squery",
"is",
"not",
"None",
":",
"if",
"\"@\"",
"in",
"squery",
":",
"parts",
"=",
"squery",
".",
"split",
"(",
"\"@\"",
")",
"addr... | https://github.com/modoboa/modoboa/blob/9065b7a5679fee149fc6f6f0e1760699c194cf89/modoboa/admin/models/mailbox.py#L54-L85 | |
IDArlingTeam/IDArling | d15b9b7c8bdeb992c569efcc49adf7642bb82cdf | idarling/shared/packets.py | python | PacketDeferred.add_errback | (self, errback) | return self | Register an errback for this deferred. | Register an errback for this deferred. | [
"Register",
"an",
"errback",
"for",
"this",
"deferred",
"."
] | def add_errback(self, errback):
"""Register an errback for this deferred."""
self._errback = errback
return self | [
"def",
"add_errback",
"(",
"self",
",",
"errback",
")",
":",
"self",
".",
"_errback",
"=",
"errback",
"return",
"self"
] | https://github.com/IDArlingTeam/IDArling/blob/d15b9b7c8bdeb992c569efcc49adf7642bb82cdf/idarling/shared/packets.py#L194-L197 | |
GitGuardian/ggshield | 94a1fa0f6402cd1df2dd3dbc5b932862e85f99e5 | ggshield/output/text/message.py | python | leak_message_located | (
flat_matches_dict: Dict[int, List[Match]],
lines: List[Line],
padding: int,
offset: int,
nb_lines: int,
clip_long_lines: bool = False,
) | return leak_msg.getvalue() | Display leak message of an incident with location in content.
:param lines: The lines list
:param line_index: The last index in the line
:param detector_line: The list of detectors object in the line
:param padding: The line padding
:param offset: The offset due to the line display | Display leak message of an incident with location in content. | [
"Display",
"leak",
"message",
"of",
"an",
"incident",
"with",
"location",
"in",
"content",
"."
] | def leak_message_located(
flat_matches_dict: Dict[int, List[Match]],
lines: List[Line],
padding: int,
offset: int,
nb_lines: int,
clip_long_lines: bool = False,
) -> str:
"""
Display leak message of an incident with location in content.
:param lines: The lines list
:param line_i... | [
"def",
"leak_message_located",
"(",
"flat_matches_dict",
":",
"Dict",
"[",
"int",
",",
"List",
"[",
"Match",
"]",
"]",
",",
"lines",
":",
"List",
"[",
"Line",
"]",
",",
"padding",
":",
"int",
",",
"offset",
":",
"int",
",",
"nb_lines",
":",
"int",
",... | https://github.com/GitGuardian/ggshield/blob/94a1fa0f6402cd1df2dd3dbc5b932862e85f99e5/ggshield/output/text/message.py#L19-L125 | |
mathics/Mathics | 318e06dea8f1c70758a50cb2f95c9900150e3a68 | mathics/builtin/files_io/importexport.py | python | ImportString.apply_elements | (self, data, elements, evaluation, options={}) | return self._import(
None, determine_filetype, elements, evaluation, options, data=data
) | ImportString[data_, elements_List?(AllTrue[#, NotOptionQ]&), OptionsPattern[]] | ImportString[data_, elements_List?(AllTrue[#, NotOptionQ]&), OptionsPattern[]] | [
"ImportString",
"[",
"data_",
"elements_List?",
"(",
"AllTrue",
"[",
"#",
"NotOptionQ",
"]",
"&",
")",
"OptionsPattern",
"[]",
"]"
] | def apply_elements(self, data, elements, evaluation, options={}):
"ImportString[data_, elements_List?(AllTrue[#, NotOptionQ]&), OptionsPattern[]]"
if not (isinstance(data, String)):
evaluation.message("ImportString", "string", data)
return SymbolFailed
path = data.get_str... | [
"def",
"apply_elements",
"(",
"self",
",",
"data",
",",
"elements",
",",
"evaluation",
",",
"options",
"=",
"{",
"}",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"data",
",",
"String",
")",
")",
":",
"evaluation",
".",
"message",
"(",
"\"ImportStrin... | https://github.com/mathics/Mathics/blob/318e06dea8f1c70758a50cb2f95c9900150e3a68/mathics/builtin/files_io/importexport.py#L1611-L1650 | |
gdraheim/docker-systemctl-replacement | 9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c | docker_mirror.py | python | DockerMirrorPackagesRepo.host_system_image | (self) | return "" | returns the docker image name which corresponds to the
operating system distribution of the host system. This
image name is the key for the other mirror functions. | returns the docker image name which corresponds to the
operating system distribution of the host system. This
image name is the key for the other mirror functions. | [
"returns",
"the",
"docker",
"image",
"name",
"which",
"corresponds",
"to",
"the",
"operating",
"system",
"distribution",
"of",
"the",
"host",
"system",
".",
"This",
"image",
"name",
"is",
"the",
"key",
"for",
"the",
"other",
"mirror",
"functions",
"."
] | def host_system_image(self):
""" returns the docker image name which corresponds to the
operating system distribution of the host system. This
image name is the key for the other mirror functions. """
distro, version = self.detect_etc_image("/etc")
logg.info(":%s:%s host... | [
"def",
"host_system_image",
"(",
"self",
")",
":",
"distro",
",",
"version",
"=",
"self",
".",
"detect_etc_image",
"(",
"\"/etc\"",
")",
"logg",
".",
"info",
"(",
"\":%s:%s host system image detected\"",
",",
"distro",
",",
"version",
")",
"if",
"distro",
"and... | https://github.com/gdraheim/docker-systemctl-replacement/blob/9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c/docker_mirror.py#L80-L88 | |
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/solvers/yices.py | python | init | () | [] | def init():
if not getattr(init, 'initialized', False):
yicespy.yices_init()
init.initialized = True | [
"def",
"init",
"(",
")",
":",
"if",
"not",
"getattr",
"(",
"init",
",",
"'initialized'",
",",
"False",
")",
":",
"yicespy",
".",
"yices_init",
"(",
")",
"init",
".",
"initialized",
"=",
"True"
] | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/solvers/yices.py#L44-L47 | ||||
openstack/solum | 93f8cc562d3c2ea0ab3af4061c07348e61f30806 | solum/common/trace_data.py | python | TraceData.__init__ | (self) | Initialize class storage. | Initialize class storage. | [
"Initialize",
"class",
"storage",
"."
] | def __init__(self):
"""Initialize class storage."""
self.request_id = "<not set>"
self._auto_clear = False
self._user_data = {}
self._support_data = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"request_id",
"=",
"\"<not set>\"",
"self",
".",
"_auto_clear",
"=",
"False",
"self",
".",
"_user_data",
"=",
"{",
"}",
"self",
".",
"_support_data",
"=",
"{",
"}"
] | https://github.com/openstack/solum/blob/93f8cc562d3c2ea0ab3af4061c07348e61f30806/solum/common/trace_data.py#L33-L38 | ||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | calendarserver/tools/tables.py | python | Table.setData | (self, table) | [] | def setData(self, table):
self.hasTitles = True
self.headers.append(table[0])
self.rows = table[1:]
self._getMaxColumnCount() | [
"def",
"setData",
"(",
"self",
",",
"table",
")",
":",
"self",
".",
"hasTitles",
"=",
"True",
"self",
".",
"headers",
".",
"append",
"(",
"table",
"[",
"0",
"]",
")",
"self",
".",
"rows",
"=",
"table",
"[",
"1",
":",
"]",
"self",
".",
"_getMaxCol... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tools/tables.py#L68-L73 | ||||
nerdvegas/rez | d392c65bf63b4bca8106f938cec49144ba54e770 | src/rez/vendor/pydot/pydot.py | python | Graph.get_simplify | (self) | return self.obj_dict['simplify'] | Get whether to simplify or not.
Refer to set_simplify for more information. | Get whether to simplify or not. | [
"Get",
"whether",
"to",
"simplify",
"or",
"not",
"."
] | def get_simplify(self):
"""Get whether to simplify or not.
Refer to set_simplify for more information.
"""
return self.obj_dict['simplify'] | [
"def",
"get_simplify",
"(",
"self",
")",
":",
"return",
"self",
".",
"obj_dict",
"[",
"'simplify'",
"]"
] | https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/vendor/pydot/pydot.py#L1030-L1036 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/galgebra/ga.py | python | MV.reduce_basis_loop | (blst) | return True | blst is a list of integers [i_{1},...,i_{r}] representing the geometric
product of r basis vectors a_{{i_1}}*...*a_{{i_r}}. reduce_basis_loop
searches along the list [i_{1},...,i_{r}] untill it finds i_{j} == i_{j+1}
and in this case contracts the list, or if i_{j} > i_{j+1} it revises
... | blst is a list of integers [i_{1},...,i_{r}] representing the geometric
product of r basis vectors a_{{i_1}}*...*a_{{i_r}}. reduce_basis_loop
searches along the list [i_{1},...,i_{r}] untill it finds i_{j} == i_{j+1}
and in this case contracts the list, or if i_{j} > i_{j+1} it revises
... | [
"blst",
"is",
"a",
"list",
"of",
"integers",
"[",
"i_",
"{",
"1",
"}",
"...",
"i_",
"{",
"r",
"}",
"]",
"representing",
"the",
"geometric",
"product",
"of",
"r",
"basis",
"vectors",
"a_",
"{{",
"i_1",
"}}",
"*",
"...",
"*",
"a_",
"{{",
"i_r",
"}}... | def reduce_basis_loop(blst):
"""
blst is a list of integers [i_{1},...,i_{r}] representing the geometric
product of r basis vectors a_{{i_1}}*...*a_{{i_r}}. reduce_basis_loop
searches along the list [i_{1},...,i_{r}] untill it finds i_{j} == i_{j+1}
and in this case contracts th... | [
"def",
"reduce_basis_loop",
"(",
"blst",
")",
":",
"nblst",
"=",
"len",
"(",
"blst",
")",
"# number of basis vectors",
"if",
"nblst",
"<=",
"1",
":",
"return",
"True",
"# a scalar or vector is already reduced",
"jstep",
"=",
"1",
"while",
"jstep",
"<",
"nblst",
... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/galgebra/ga.py#L1232-L1274 | |
horazont/aioxmpp | c701e6399c90a6bb9bec0349018a03bd7b644cde | aioxmpp/cache.py | python | LRUDict._test_consistency | (self) | return (_length(self.__root) == len(self.__links) and
_has_consistent_links(self.__root, self.__links)) | This method is only used for testing to assert that the operations
leave the LRUDict in a valid state. | This method is only used for testing to assert that the operations
leave the LRUDict in a valid state. | [
"This",
"method",
"is",
"only",
"used",
"for",
"testing",
"to",
"assert",
"that",
"the",
"operations",
"leave",
"the",
"LRUDict",
"in",
"a",
"valid",
"state",
"."
] | def _test_consistency(self):
"""
This method is only used for testing to assert that the operations
leave the LRUDict in a valid state.
"""
return (_length(self.__root) == len(self.__links) and
_has_consistent_links(self.__root, self.__links)) | [
"def",
"_test_consistency",
"(",
"self",
")",
":",
"return",
"(",
"_length",
"(",
"self",
".",
"__root",
")",
"==",
"len",
"(",
"self",
".",
"__links",
")",
"and",
"_has_consistent_links",
"(",
"self",
".",
"__root",
",",
"self",
".",
"__links",
")",
"... | https://github.com/horazont/aioxmpp/blob/c701e6399c90a6bb9bec0349018a03bd7b644cde/aioxmpp/cache.py#L112-L118 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/threading.py | python | Thread.name | (self) | return self._name | A string used for identification purposes only.
It has no semantics. Multiple threads may be given the same name. The
initial name is set by the constructor. | A string used for identification purposes only. | [
"A",
"string",
"used",
"for",
"identification",
"purposes",
"only",
"."
] | def name(self):
"""A string used for identification purposes only.
It has no semantics. Multiple threads may be given the same name. The
initial name is set by the constructor.
"""
assert self._initialized, "Thread.__init__() not called"
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_initialized",
",",
"\"Thread.__init__() not called\"",
"return",
"self",
".",
"_name"
] | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/threading.py#L1075-L1083 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/xsser/XSSer/main.py | python | xsser.run | (self, opts=None) | Run xsser. | Run xsser. | [
"Run",
"xsser",
"."
] | def run(self, opts=None):
"""
Run xsser.
"""
self._landing = False
for reporter in self._reporters:
reporter.start_attack()
if opts:
options = self.create_options(opts)
self.set_options(options)
if not self.mothership and not s... | [
"def",
"run",
"(",
"self",
",",
"opts",
"=",
"None",
")",
":",
"self",
".",
"_landing",
"=",
"False",
"for",
"reporter",
"in",
"self",
".",
"_reporters",
":",
"reporter",
".",
"start_attack",
"(",
")",
"if",
"opts",
":",
"options",
"=",
"self",
".",
... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/xsser/XSSer/main.py#L1378-L1501 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py | python | FormalPolyhedraModule.__classcall__ | (cls, base_ring, dimension, basis, category=None) | return super(FormalPolyhedraModule, cls).__classcall__(cls,
base_ring=base_ring,
dimension=dimension,
basis=basis,
... | r"""
Normalize the arguments for caching.
TESTS::
sage: from sage.geometry.polyhedron.modules.formal_polyhedra_module import FormalPolyhedraModule
sage: FormalPolyhedraModule(QQ, 1, ()) is FormalPolyhedraModule(QQ, 1, [])
True | r"""
Normalize the arguments for caching. | [
"r",
"Normalize",
"the",
"arguments",
"for",
"caching",
"."
] | def __classcall__(cls, base_ring, dimension, basis, category=None):
r"""
Normalize the arguments for caching.
TESTS::
sage: from sage.geometry.polyhedron.modules.formal_polyhedra_module import FormalPolyhedraModule
sage: FormalPolyhedraModule(QQ, 1, ()) is FormalPolyhed... | [
"def",
"__classcall__",
"(",
"cls",
",",
"base_ring",
",",
"dimension",
",",
"basis",
",",
"category",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"basis",
",",
"list",
")",
":",
"basis",
"=",
"tuple",
"(",
"basis",
")",
"if",
"category",
"is",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py#L74-L92 | |
NVIDIA-AI-IOT/torch2trt | 2732b35ac4dbe3d6e93cd74910af4e4729f1d93b | examples/contrib/quantization_aware_training/models/resnet.py | python | wide_resnet50_2 | (pretrained=False, progress=True, **kwargs) | return _resnet('wide_resnet50_2', Bottleneck, [3, 4, 6, 3],
pretrained, progress, **kwargs) | r"""Wide ResNet-50-2 model from
`"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_
The model is the same as ResNet except for the bottleneck number of channels
which is twice larger in every block. The number of channels in outer 1x1
convolutions is the same, e.g. last block in ResNet-5... | r"""Wide ResNet-50-2 model from
`"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_ | [
"r",
"Wide",
"ResNet",
"-",
"50",
"-",
"2",
"model",
"from",
"Wide",
"Residual",
"Networks",
"<https",
":",
"//",
"arxiv",
".",
"org",
"/",
"pdf",
"/",
"1605",
".",
"07146",
".",
"pdf",
">",
"_"
] | def wide_resnet50_2(pretrained=False, progress=True, **kwargs):
r"""Wide ResNet-50-2 model from
`"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_
The model is the same as ResNet except for the bottleneck number of channels
which is twice larger in every block. The number of channels in... | [
"def",
"wide_resnet50_2",
"(",
"pretrained",
"=",
"False",
",",
"progress",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'width_per_group'",
"]",
"=",
"64",
"*",
"2",
"return",
"_resnet",
"(",
"'wide_resnet50_2'",
",",
"Bottleneck",
",",... | https://github.com/NVIDIA-AI-IOT/torch2trt/blob/2732b35ac4dbe3d6e93cd74910af4e4729f1d93b/examples/contrib/quantization_aware_training/models/resnet.py#L311-L326 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/core/grr_response_core/lib/interpolation.py | python | Substitution.__init__ | (self, var_config: VarConfig, scope_config: ScopeConfig) | Initializes the substitution environment.
Args:
var_config: A configuration (concrete values) of pattern variables.
scope_config: A configuration (concrete values) of pattern scopes. | Initializes the substitution environment. | [
"Initializes",
"the",
"substitution",
"environment",
"."
] | def __init__(self, var_config: VarConfig, scope_config: ScopeConfig):
"""Initializes the substitution environment.
Args:
var_config: A configuration (concrete values) of pattern variables.
scope_config: A configuration (concrete values) of pattern scopes.
"""
self._substs = {}
self._var... | [
"def",
"__init__",
"(",
"self",
",",
"var_config",
":",
"VarConfig",
",",
"scope_config",
":",
"ScopeConfig",
")",
":",
"self",
".",
"_substs",
"=",
"{",
"}",
"self",
".",
"_var_config",
"=",
"var_config",
"self",
".",
"_scope_config",
"=",
"scope_config",
... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/core/grr_response_core/lib/interpolation.py#L28-L46 | ||
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | openWrt/files/usr/lib/python2.7/site-packages/tornado/gen.py | python | engine | (func) | return wrapper | Callback-oriented decorator for asynchronous generators.
This is an older interface; for new code that does not need to be
compatible with versions of Tornado older than 3.0 the
`coroutine` decorator is recommended instead.
This decorator is similar to `coroutine`, except it does not
return a `.Fu... | Callback-oriented decorator for asynchronous generators. | [
"Callback",
"-",
"oriented",
"decorator",
"for",
"asynchronous",
"generators",
"."
] | def engine(func):
"""Callback-oriented decorator for asynchronous generators.
This is an older interface; for new code that does not need to be
compatible with versions of Tornado older than 3.0 the
`coroutine` decorator is recommended instead.
This decorator is similar to `coroutine`, except it d... | [
"def",
"engine",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"runner",
"=",
"None",
"def",
"handle_exception",
"(",
"typ",
",",
"value",
",",
"tb",
... | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/tornado/gen.py#L110-L162 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/mechanize/_useragent.py | python | UserAgentBase.set_handle_refresh | (self, handle, max_time=None, honor_time=True) | Set whether to handle HTTP Refresh headers. | Set whether to handle HTTP Refresh headers. | [
"Set",
"whether",
"to",
"handle",
"HTTP",
"Refresh",
"headers",
"."
] | def set_handle_refresh(self, handle, max_time=None, honor_time=True):
"""Set whether to handle HTTP Refresh headers."""
self._set_handler("_refresh", handle, constructor_kwds=
{"max_time": max_time, "honor_time": honor_time}) | [
"def",
"set_handle_refresh",
"(",
"self",
",",
"handle",
",",
"max_time",
"=",
"None",
",",
"honor_time",
"=",
"True",
")",
":",
"self",
".",
"_set_handler",
"(",
"\"_refresh\"",
",",
"handle",
",",
"constructor_kwds",
"=",
"{",
"\"max_time\"",
":",
"max_tim... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/mechanize/_useragent.py#L249-L252 | ||
NVIDIA/NeMo | 5b0c0b4dec12d87d3cd960846de4105309ce938e | scripts/dataset_processing/get_hi-mia_data.py | python | __maybe_download_file | (destination: str, source: str) | return destination | Downloads source to destination if it doesn't exist.
If exists, skips download
Args:
destination: local filepath
source: url of resource
Returns: | Downloads source to destination if it doesn't exist.
If exists, skips download
Args:
destination: local filepath
source: url of resource | [
"Downloads",
"source",
"to",
"destination",
"if",
"it",
"doesn",
"t",
"exist",
".",
"If",
"exists",
"skips",
"download",
"Args",
":",
"destination",
":",
"local",
"filepath",
"source",
":",
"url",
"of",
"resource"
] | def __maybe_download_file(destination: str, source: str):
"""
Downloads source to destination if it doesn't exist.
If exists, skips download
Args:
destination: local filepath
source: url of resource
Returns:
"""
source = URL[source]
if not os.path.exists(destination) an... | [
"def",
"__maybe_download_file",
"(",
"destination",
":",
"str",
",",
"source",
":",
"str",
")",
":",
"source",
"=",
"URL",
"[",
"source",
"]",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"destination",
")",
"and",
"not",
"os",
".",
"path",
".... | https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/scripts/dataset_processing/get_hi-mia_data.py#L66-L91 | |
heynemann/pyccuracy | 0bbe3bcff4d13a6501bf77d5af9457f6a1491ab6 | pyccuracy/django/management/commands/pyccuracy.py | python | Command.locate_resource_dirs | (self, complement, pattern="*.*", recursive=True, apps=[]) | return dirs | [] | def locate_resource_dirs(self, complement, pattern="*.*", recursive=True, apps=[]):
dirs = []
for app in settings.INSTALLED_APPS:
fromlist = ""
if len(app.split("."))>1:
fromlist = ".".join(app.split(".")[1:])
if app.startswith('django'):
... | [
"def",
"locate_resource_dirs",
"(",
"self",
",",
"complement",
",",
"pattern",
"=",
"\"*.*\"",
",",
"recursive",
"=",
"True",
",",
"apps",
"=",
"[",
"]",
")",
":",
"dirs",
"=",
"[",
"]",
"for",
"app",
"in",
"settings",
".",
"INSTALLED_APPS",
":",
"from... | https://github.com/heynemann/pyccuracy/blob/0bbe3bcff4d13a6501bf77d5af9457f6a1491ab6/pyccuracy/django/management/commands/pyccuracy.py#L31-L54 | |||
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/astroprint/plugin/services/camera.py | python | CameraService.peerSession | (self,data,sendResponse) | [] | def peerSession(self,data,sendResponse):
action = data['action']
if data and 'sessionId' in data:
sessionId = data['sessionId']
if action == 'init_peer_session':
#Initialize the peer session
if cameraManager().startLocalVideoSession(sessionId):
sendResponse({'success': 'no-error'})
else:
... | [
"def",
"peerSession",
"(",
"self",
",",
"data",
",",
"sendResponse",
")",
":",
"action",
"=",
"data",
"[",
"'action'",
"]",
"if",
"data",
"and",
"'sessionId'",
"in",
"data",
":",
"sessionId",
"=",
"data",
"[",
"'sessionId'",
"]",
"if",
"action",
"==",
... | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/astroprint/plugin/services/camera.py#L71-L95 | ||||
brian-team/brian2 | c212a57cb992b766786b5769ebb830ff12d8a8ad | brian2/spatialneuron/morphology.py | python | Morphology.length | (self) | The length of each compartment in this section. | The length of each compartment in this section. | [
"The",
"length",
"of",
"each",
"compartment",
"in",
"this",
"section",
"."
] | def length(self):
"""
The length of each compartment in this section.
"""
raise NotImplementedError() | [
"def",
"length",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/brian-team/brian2/blob/c212a57cb992b766786b5769ebb830ff12d8a8ad/brian2/spatialneuron/morphology.py#L723-L727 | ||
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/protocols/amp.py | python | BinaryBoxProtocol._unlockFromSwitch | (self) | Unlock this locked binary protocol so that further boxes may be sent
again. This is used after an attempt to switch protocols has failed
for some reason. | Unlock this locked binary protocol so that further boxes may be sent
again. This is used after an attempt to switch protocols has failed
for some reason. | [
"Unlock",
"this",
"locked",
"binary",
"protocol",
"so",
"that",
"further",
"boxes",
"may",
"be",
"sent",
"again",
".",
"This",
"is",
"used",
"after",
"an",
"attempt",
"to",
"switch",
"protocols",
"has",
"failed",
"for",
"some",
"reason",
"."
] | def _unlockFromSwitch(self):
"""
Unlock this locked binary protocol so that further boxes may be sent
again. This is used after an attempt to switch protocols has failed
for some reason.
"""
if self.innerProtocol is not None:
raise ProtocolSwitched("Protocol ... | [
"def",
"_unlockFromSwitch",
"(",
"self",
")",
":",
"if",
"self",
".",
"innerProtocol",
"is",
"not",
"None",
":",
"raise",
"ProtocolSwitched",
"(",
"\"Protocol already switched. Cannot unlock.\"",
")",
"self",
".",
"_locked",
"=",
"False"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/protocols/amp.py#L2267-L2275 | ||
debian-calibre/calibre | 020fc81d3936a64b2ac51459ecb796666ab6a051 | src/calibre/ebooks/pdf/reflow.py | python | Page.second_pass | (self) | Locate paragraph boundaries in each column | Locate paragraph boundaries in each column | [
"Locate",
"paragraph",
"boundaries",
"in",
"each",
"column"
] | def second_pass(self):
'Locate paragraph boundaries in each column'
for region in self.regions:
region.collect_stats()
region.linearize() | [
"def",
"second_pass",
"(",
"self",
")",
":",
"for",
"region",
"in",
"self",
".",
"regions",
":",
"region",
".",
"collect_stats",
"(",
")",
"region",
".",
"linearize",
"(",
")"
] | https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/ebooks/pdf/reflow.py#L612-L616 | ||
Bigpig4396/Multi-Agent-Reinforcement-Learning-Environment | 4f8b7adba04aa8b577669377029de9232438296c | env_Rescue/Python3/maze.py | python | Maze.solve | (self, position=(0,0)) | return False | Uses backtracking to solve maze | Uses backtracking to solve maze | [
"Uses",
"backtracking",
"to",
"solve",
"maze"
] | def solve(self, position=(0,0)):
''' Uses backtracking to solve maze'''
if self.is_done():
return True
for direction in [self.LEFT, self.RIGHT, self.UP, self.DOWN]:
# try a move, move will return false if no portal of backward progress
if self.move(direction):
# after move, set new test positi... | [
"def",
"solve",
"(",
"self",
",",
"position",
"=",
"(",
"0",
",",
"0",
")",
")",
":",
"if",
"self",
".",
"is_done",
"(",
")",
":",
"return",
"True",
"for",
"direction",
"in",
"[",
"self",
".",
"LEFT",
",",
"self",
".",
"RIGHT",
",",
"self",
"."... | https://github.com/Bigpig4396/Multi-Agent-Reinforcement-Learning-Environment/blob/4f8b7adba04aa8b577669377029de9232438296c/env_Rescue/Python3/maze.py#L352-L367 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/rings.py | python | PolyRing.index | (self, gen) | return i | Compute index of ``gen`` in ``self.gens``. | Compute index of ``gen`` in ``self.gens``. | [
"Compute",
"index",
"of",
"gen",
"in",
"self",
".",
"gens",
"."
] | def index(self, gen):
"""Compute index of ``gen`` in ``self.gens``. """
if gen is None:
i = 0
elif isinstance(gen, int):
i = gen
if 0 <= i and i < self.ngens:
pass
elif -self.ngens <= i and i <= -1:
i = -i - 1
... | [
"def",
"index",
"(",
"self",
",",
"gen",
")",
":",
"if",
"gen",
"is",
"None",
":",
"i",
"=",
"0",
"elif",
"isinstance",
"(",
"gen",
",",
"int",
")",
":",
"i",
"=",
"gen",
"if",
"0",
"<=",
"i",
"and",
"i",
"<",
"self",
".",
"ngens",
":",
"pa... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/rings.py#L372-L398 | |
kozec/syncthing-gtk | 01eeeb9ed485232e145bf39d90142832e1c9751e | syncthing_gtk/daemon.py | python | Daemon._parse_dev_n_folders | (self, config) | Parses devices and folders from configuration and emits
associated events. | Parses devices and folders from configuration and emits
associated events. | [
"Parses",
"devices",
"and",
"folders",
"from",
"configuration",
"and",
"emits",
"associated",
"events",
"."
] | def _parse_dev_n_folders(self, config):
"""
Parses devices and folders from configuration and emits
associated events.
"""
# Pre-parse folders to detect unused devices
device_folders = {}
for r in config["folders"]:
rid = r["id"]
for n in r["devices"]:
nid = n["deviceID"]
if not nid in devic... | [
"def",
"_parse_dev_n_folders",
"(",
"self",
",",
"config",
")",
":",
"# Pre-parse folders to detect unused devices",
"device_folders",
"=",
"{",
"}",
"for",
"r",
"in",
"config",
"[",
"\"folders\"",
"]",
":",
"rid",
"=",
"r",
"[",
"\"id\"",
"]",
"for",
"n",
"... | https://github.com/kozec/syncthing-gtk/blob/01eeeb9ed485232e145bf39d90142832e1c9751e/syncthing_gtk/daemon.py#L409-L436 | ||
RobotLocomotion/pytorch-dense-correspondence | 76bf6499c325ad136a094fb341158a90eaa31d53 | dense_correspondence/correspondence_tools/correspondence_augmentation.py | python | flip_vertical | (images, uv_pixel_positions) | return mutated_images, mutated_uv_pixel_positions | Fip the images and the pixel positions vertically (flip up/down)
See random_image_and_indices_mutation() for documentation of args and return types. | Fip the images and the pixel positions vertically (flip up/down) | [
"Fip",
"the",
"images",
"and",
"the",
"pixel",
"positions",
"vertically",
"(",
"flip",
"up",
"/",
"down",
")"
] | def flip_vertical(images, uv_pixel_positions):
"""
Fip the images and the pixel positions vertically (flip up/down)
See random_image_and_indices_mutation() for documentation of args and return types.
"""
mutated_images = [ImageOps.flip(image) for image in images]
v_pixel_positions = uv_pixel_p... | [
"def",
"flip_vertical",
"(",
"images",
",",
"uv_pixel_positions",
")",
":",
"mutated_images",
"=",
"[",
"ImageOps",
".",
"flip",
"(",
"image",
")",
"for",
"image",
"in",
"images",
"]",
"v_pixel_positions",
"=",
"uv_pixel_positions",
"[",
"1",
"]",
"mutated_v_p... | https://github.com/RobotLocomotion/pytorch-dense-correspondence/blob/76bf6499c325ad136a094fb341158a90eaa31d53/dense_correspondence/correspondence_tools/correspondence_augmentation.py#L59-L70 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/models/userprofile.py | python | UserProfile.modify_consumer_name | (self, token_key, consumer_name) | Modify consumer name of an existing token key.
:param token_key: The key of the token to be deleted.
:type token_key: string
:param consumer_name: Name of the token consumer.
:type consumer_name: string
:raises: `django.http.Http404` | Modify consumer name of an existing token key. | [
"Modify",
"consumer",
"name",
"of",
"an",
"existing",
"token",
"key",
"."
] | def modify_consumer_name(self, token_key, consumer_name):
"""Modify consumer name of an existing token key.
:param token_key: The key of the token to be deleted.
:type token_key: string
:param consumer_name: Name of the token consumer.
:type consumer_name: string
:raises... | [
"def",
"modify_consumer_name",
"(",
"self",
",",
"token_key",
",",
"consumer_name",
")",
":",
"token",
"=",
"get_object_or_404",
"(",
"Token",
",",
"user",
"=",
"self",
".",
"user",
",",
"token_type",
"=",
"Token",
".",
"ACCESS",
",",
"key",
"=",
"token_ke... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/models/userprofile.py#L153-L167 | ||
dongrixinyu/JioNLP | 2c5b11439915891f0f24955b7de4f637f38a4b44 | jionlp/dictionary/dictionary_loader.py | python | negative_words_loader | () | return res | 加载否定词典 negative_words.txt | 加载否定词典 negative_words.txt | [
"加载否定词典",
"negative_words",
".",
"txt"
] | def negative_words_loader():
""" 加载否定词典 negative_words.txt """
res = read_file_by_line(os.path.join(
GRAND_DIR_PATH, 'dictionary/negative_words.txt'))
return res | [
"def",
"negative_words_loader",
"(",
")",
":",
"res",
"=",
"read_file_by_line",
"(",
"os",
".",
"path",
".",
"join",
"(",
"GRAND_DIR_PATH",
",",
"'dictionary/negative_words.txt'",
")",
")",
"return",
"res"
] | https://github.com/dongrixinyu/JioNLP/blob/2c5b11439915891f0f24955b7de4f637f38a4b44/jionlp/dictionary/dictionary_loader.py#L209-L214 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/distlib/_backport/tarfile.py | python | TarFile.makefile | (self, tarinfo, targetpath) | Make a file called targetpath. | Make a file called targetpath. | [
"Make",
"a",
"file",
"called",
"targetpath",
"."
] | def makefile(self, tarinfo, targetpath):
"""Make a file called targetpath.
"""
source = self.fileobj
source.seek(tarinfo.offset_data)
target = bltn_open(targetpath, "wb")
if tarinfo.sparse is not None:
for offset, size in tarinfo.sparse:
target... | [
"def",
"makefile",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"source",
"=",
"self",
".",
"fileobj",
"source",
".",
"seek",
"(",
"tarinfo",
".",
"offset_data",
")",
"target",
"=",
"bltn_open",
"(",
"targetpath",
",",
"\"wb\"",
")",
"if",
... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/distlib/_backport/tarfile.py#L2296-L2310 | ||
openrazer/openrazer | 1615f8516e8014bad7f78c781c91e6529679718f | daemon/openrazer_daemon/dbus_services/dbus_methods/all.py | python | get_device_type_keyboard | (self) | return 'keyboard' | Get the device's type
:return: 'keyboard'
:rtype: str | Get the device's type | [
"Get",
"the",
"device",
"s",
"type"
] | def get_device_type_keyboard(self):
"""
Get the device's type
:return: 'keyboard'
:rtype: str
"""
self.logger.debug("DBus call get_device_type")
return 'keyboard' | [
"def",
"get_device_type_keyboard",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"DBus call get_device_type\"",
")",
"return",
"'keyboard'"
] | https://github.com/openrazer/openrazer/blob/1615f8516e8014bad7f78c781c91e6529679718f/daemon/openrazer_daemon/dbus_services/dbus_methods/all.py#L105-L113 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/gdata/tlslite/utils/RSAKey.py | python | RSAKey.hashAndVerify | (self, sigBytes, bytes) | return self.verify(sigBytes, prefixedHashBytes) | Hash and verify the passed-in bytes with the signature.
This verifies a PKCS1-SHA1 signature on the passed-in data.
@type sigBytes: L{array.array} of unsigned bytes
@param sigBytes: A PKCS1-SHA1 signature.
@type bytes: str or L{array.array} of unsigned bytes
@param bytes: The ... | Hash and verify the passed-in bytes with the signature. | [
"Hash",
"and",
"verify",
"the",
"passed",
"-",
"in",
"bytes",
"with",
"the",
"signature",
"."
] | def hashAndVerify(self, sigBytes, bytes):
"""Hash and verify the passed-in bytes with the signature.
This verifies a PKCS1-SHA1 signature on the passed-in data.
@type sigBytes: L{array.array} of unsigned bytes
@param sigBytes: A PKCS1-SHA1 signature.
@type bytes: str or L{arra... | [
"def",
"hashAndVerify",
"(",
"self",
",",
"sigBytes",
",",
"bytes",
")",
":",
"if",
"not",
"isinstance",
"(",
"bytes",
",",
"type",
"(",
"\"\"",
")",
")",
":",
"bytes",
"=",
"bytesToString",
"(",
"bytes",
")",
"hashBytes",
"=",
"stringToBytes",
"(",
"s... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/gdata/tlslite/utils/RSAKey.py#L81-L99 | |
lutris/lutris | 66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a | lutris/util/wine/wine.py | python | get_lutris_wine_versions | () | return versions | Return the list of wine versions installed by lutris | Return the list of wine versions installed by lutris | [
"Return",
"the",
"list",
"of",
"wine",
"versions",
"installed",
"by",
"lutris"
] | def get_lutris_wine_versions():
"""Return the list of wine versions installed by lutris"""
versions = []
if system.path_exists(WINE_DIR):
dirs = version_sort(os.listdir(WINE_DIR), reverse=True)
for dirname in dirs:
if is_version_installed(dirname):
versions.append... | [
"def",
"get_lutris_wine_versions",
"(",
")",
":",
"versions",
"=",
"[",
"]",
"if",
"system",
".",
"path_exists",
"(",
"WINE_DIR",
")",
":",
"dirs",
"=",
"version_sort",
"(",
"os",
".",
"listdir",
"(",
"WINE_DIR",
")",
",",
"reverse",
"=",
"True",
")",
... | https://github.com/lutris/lutris/blob/66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a/lutris/util/wine/wine.py#L165-L173 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/misc/repr.py | python | coeff_repr | (c, is_latex=False) | return s | r"""
String representing coefficients in a linear combination.
INPUT:
- ``c`` -- a coefficient (i.e., an element of a ring)
OUTPUT:
A string
EXAMPLES::
sage: from sage.misc.repr import coeff_repr
sage: coeff_repr(QQ(1/2))
'1/2'
sage: coeff_repr(-x^2)
... | r"""
String representing coefficients in a linear combination. | [
"r",
"String",
"representing",
"coefficients",
"in",
"a",
"linear",
"combination",
"."
] | def coeff_repr(c, is_latex=False):
r"""
String representing coefficients in a linear combination.
INPUT:
- ``c`` -- a coefficient (i.e., an element of a ring)
OUTPUT:
A string
EXAMPLES::
sage: from sage.misc.repr import coeff_repr
sage: coeff_repr(QQ(1/2))
'1/2'... | [
"def",
"coeff_repr",
"(",
"c",
",",
"is_latex",
"=",
"False",
")",
":",
"if",
"not",
"is_latex",
":",
"try",
":",
"return",
"c",
".",
"_coeff_repr",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"if",
"isinstance",
"(",
"c",
",",
"(",
"int",
","... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/misc/repr.py#L6-L46 | |
WooYun/TangScan | f4fd60228ec09ad10bd3dd3ef3b67e58bcdd4aa5 | tangscan/thirdparty/requests/exceptions.py | python | RequestException.__init__ | (self, *args, **kwargs) | Initialize RequestException with `request` and `response` objects. | Initialize RequestException with `request` and `response` objects. | [
"Initialize",
"RequestException",
"with",
"request",
"and",
"response",
"objects",
"."
] | def __init__(self, *args, **kwargs):
"""
Initialize RequestException with `request` and `response` objects.
"""
response = kwargs.pop('response', None)
self.response = response
self.request = kwargs.pop('request', None)
if (response is not None and not self.reques... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"kwargs",
".",
"pop",
"(",
"'response'",
",",
"None",
")",
"self",
".",
"response",
"=",
"response",
"self",
".",
"request",
"=",
"kwargs",
".",
"... | https://github.com/WooYun/TangScan/blob/f4fd60228ec09ad10bd3dd3ef3b67e58bcdd4aa5/tangscan/thirdparty/requests/exceptions.py#L17-L27 | ||
fooying/3102 | 0faee38c30b2e24154f41e68457cfd8f7a61c040 | thirdparty/requests/adapters.py | python | HTTPAdapter.get_connection | (self, url, proxies=None) | return conn | Returns a urllib3 connection for the given URL. This should not be
called from user code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param url: The URL to connect to.
:param proxies: (optional) A Requests-style dictionary of p... | Returns a urllib3 connection for the given URL. This should not be
called from user code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`. | [
"Returns",
"a",
"urllib3",
"connection",
"for",
"the",
"given",
"URL",
".",
"This",
"should",
"not",
"be",
"called",
"from",
"user",
"code",
"and",
"is",
"only",
"exposed",
"for",
"use",
"when",
"subclassing",
"the",
":",
"class",
":",
"HTTPAdapter",
"<req... | def get_connection(self, url, proxies=None):
"""Returns a urllib3 connection for the given URL. This should not be
called from user code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param url: The URL to connect to.
:pa... | [
"def",
"get_connection",
"(",
"self",
",",
"url",
",",
"proxies",
"=",
"None",
")",
":",
"proxies",
"=",
"proxies",
"or",
"{",
"}",
"proxy",
"=",
"proxies",
".",
"get",
"(",
"urlparse",
"(",
"url",
".",
"lower",
"(",
")",
")",
".",
"scheme",
")",
... | https://github.com/fooying/3102/blob/0faee38c30b2e24154f41e68457cfd8f7a61c040/thirdparty/requests/adapters.py#L232-L253 | |
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3/s3translate.py | python | Strings.export_file | (self, langfile, modlist, filelist, filetype, all_template_flag) | Function to get the strings by module(s)/file(s), merge with
those strings from existing w2p language file which are already
translated and call the "write_xls()" method if the
default filetype "xls" is chosen. If "po" is chosen, then the
write_po()" method is called. | Function to get the strings by module(s)/file(s), merge with
those strings from existing w2p language file which are already
translated and call the "write_xls()" method if the
default filetype "xls" is chosen. If "po" is chosen, then the
write_po()" method is called. | [
"Function",
"to",
"get",
"the",
"strings",
"by",
"module",
"(",
"s",
")",
"/",
"file",
"(",
"s",
")",
"merge",
"with",
"those",
"strings",
"from",
"existing",
"w2p",
"language",
"file",
"which",
"are",
"already",
"translated",
"and",
"call",
"the",
"writ... | def export_file(self, langfile, modlist, filelist, filetype, all_template_flag):
"""
Function to get the strings by module(s)/file(s), merge with
those strings from existing w2p language file which are already
translated and call the "write_xls()" method if the
de... | [
"def",
"export_file",
"(",
"self",
",",
"langfile",
",",
"modlist",
",",
"filelist",
",",
"filetype",
",",
"all_template_flag",
")",
":",
"request",
"=",
"current",
".",
"request",
"settings",
"=",
"current",
".",
"deployment_settings",
"folder",
"=",
"request... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3translate.py#L1038-L1150 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/plot/animate.py | python | Animation.png | (self, dir=None) | return dir | r"""
Render PNG images of the frames in this animation, saving them
in ``dir``. Return the absolute path to that directory. If
the frames have been previously rendered and ``dir`` is
``None``, just return the directory in which they are stored.
When ``dir`` is other than ``Non... | r"""
Render PNG images of the frames in this animation, saving them
in ``dir``. Return the absolute path to that directory. If
the frames have been previously rendered and ``dir`` is
``None``, just return the directory in which they are stored. | [
"r",
"Render",
"PNG",
"images",
"of",
"the",
"frames",
"in",
"this",
"animation",
"saving",
"them",
"in",
"dir",
".",
"Return",
"the",
"absolute",
"path",
"to",
"that",
"directory",
".",
"If",
"the",
"frames",
"have",
"been",
"previously",
"rendered",
"and... | def png(self, dir=None):
r"""
Render PNG images of the frames in this animation, saving them
in ``dir``. Return the absolute path to that directory. If
the frames have been previously rendered and ``dir`` is
``None``, just return the directory in which they are stored.
... | [
"def",
"png",
"(",
"self",
",",
"dir",
"=",
"None",
")",
":",
"if",
"dir",
"is",
"None",
":",
"try",
":",
"return",
"self",
".",
"_png_dir",
"except",
"AttributeError",
":",
"pass",
"dir",
"=",
"tmp_dir",
"(",
")",
"i",
"=",
"0",
"for",
"frame",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/plot/animate.py#L432-L472 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/gdata/src/atom/service.py | python | AtomService.Put | (self, data, uri, extra_headers=None, url_params=None,
escape_params=True, content_type='application/atom+xml') | return self.request('PUT', uri, data=data, headers=extra_headers,
url_params=url_params) | Updates an entry at the given URI.
Args:
data: string, ElementTree._Element, or xml_wrapper.ElementWrapper The
XML containing the updated data.
uri: string A URI indicating entry to which the update will be applied.
Example: '/base/feeds/items/ITEM-ID'
extra_headers: ... | Updates an entry at the given URI.
Args:
data: string, ElementTree._Element, or xml_wrapper.ElementWrapper The
XML containing the updated data.
uri: string A URI indicating entry to which the update will be applied.
Example: '/base/feeds/items/ITEM-ID'
extra_headers: ... | [
"Updates",
"an",
"entry",
"at",
"the",
"given",
"URI",
".",
"Args",
":",
"data",
":",
"string",
"ElementTree",
".",
"_Element",
"or",
"xml_wrapper",
".",
"ElementWrapper",
"The",
"XML",
"containing",
"the",
"updated",
"data",
".",
"uri",
":",
"string",
"A"... | def Put(self, data, uri, extra_headers=None, url_params=None,
escape_params=True, content_type='application/atom+xml'):
"""Updates an entry at the given URI.
Args:
data: string, ElementTree._Element, or xml_wrapper.ElementWrapper The
XML containing the updated data.
ur... | [
"def",
"Put",
"(",
"self",
",",
"data",
",",
"uri",
",",
"extra_headers",
"=",
"None",
",",
"url_params",
"=",
"None",
",",
"escape_params",
"=",
"True",
",",
"content_type",
"=",
"'application/atom+xml'",
")",
":",
"if",
"extra_headers",
"is",
"None",
":"... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/atom/service.py#L261-L291 | |
mlrun/mlrun | 4c120719d64327a34b7ee1ab08fb5e01b258b00a | mlrun/frameworks/pytorch/callbacks_handler.py | python | CallbacksHandler.on_scheduler_step_end | (self, callbacks: List[str] = None) | return self._run_callbacks(
method_name=_CallbackInterface.ON_SCHEDULER_STEP_END,
callbacks=self._parse_names(names=callbacks),
) | Call the 'on_scheduler_step_end' method of every callback in the callbacks list. If the list is 'None'
(not given), all callbacks will be called.
:param callbacks: The callbacks names to use. If 'None', all of the callbacks will be used.
:return: True if all of the callbacks called returned Tr... | Call the 'on_scheduler_step_end' method of every callback in the callbacks list. If the list is 'None'
(not given), all callbacks will be called. | [
"Call",
"the",
"on_scheduler_step_end",
"method",
"of",
"every",
"callback",
"in",
"the",
"callbacks",
"list",
".",
"If",
"the",
"list",
"is",
"None",
"(",
"not",
"given",
")",
"all",
"callbacks",
"will",
"be",
"called",
"."
] | def on_scheduler_step_end(self, callbacks: List[str] = None) -> bool:
"""
Call the 'on_scheduler_step_end' method of every callback in the callbacks list. If the list is 'None'
(not given), all callbacks will be called.
:param callbacks: The callbacks names to use. If 'None', all of the... | [
"def",
"on_scheduler_step_end",
"(",
"self",
",",
"callbacks",
":",
"List",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_run_callbacks",
"(",
"method_name",
"=",
"_CallbackInterface",
".",
"ON_SCHEDULER_STEP_END",
",",
"callba... | https://github.com/mlrun/mlrun/blob/4c120719d64327a34b7ee1ab08fb5e01b258b00a/mlrun/frameworks/pytorch/callbacks_handler.py#L594-L606 | |
GoogleCloudPlatform/deploymentmanager-samples | 9cc562d7d048a9890572587ca299816c0cd3bb38 | examples/v2/step_by_step_guide/step7_use_environment_variables/python/compute-engine-template.py | python | GenerateConfig | (unused_context) | return {'resources': resources} | Creates the Compute Engine with multiple templates. | Creates the Compute Engine with multiple templates. | [
"Creates",
"the",
"Compute",
"Engine",
"with",
"multiple",
"templates",
"."
] | def GenerateConfig(unused_context):
"""Creates the Compute Engine with multiple templates."""
resources = [{
'name': 'the-first-vm',
'type': 'vm-template.py',
'properties': {
'machineType': 'f1-micro',
'zone': 'us-central1-f',
'network': NETWORK_NAME
}
}, {
... | [
"def",
"GenerateConfig",
"(",
"unused_context",
")",
":",
"resources",
"=",
"[",
"{",
"'name'",
":",
"'the-first-vm'",
",",
"'type'",
":",
"'vm-template.py'",
",",
"'properties'",
":",
"{",
"'machineType'",
":",
"'f1-micro'",
",",
"'zone'",
":",
"'us-central1-f'... | https://github.com/GoogleCloudPlatform/deploymentmanager-samples/blob/9cc562d7d048a9890572587ca299816c0cd3bb38/examples/v2/step_by_step_guide/step7_use_environment_variables/python/compute-engine-template.py#L20-L49 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/aui/auibook.py | python | AuiTabContainer.GetIdxFromWindow | (self, wnd) | return wx.NOT_FOUND | Returns the tab index based on the window `wnd` associated with it.
:param `wnd`: an instance of :class:`wx.Window`. | Returns the tab index based on the window `wnd` associated with it. | [
"Returns",
"the",
"tab",
"index",
"based",
"on",
"the",
"window",
"wnd",
"associated",
"with",
"it",
"."
] | def GetIdxFromWindow(self, wnd):
"""
Returns the tab index based on the window `wnd` associated with it.
:param `wnd`: an instance of :class:`wx.Window`.
"""
for indx, page in enumerate(self._pages):
if page.window == wnd:
return indx
return... | [
"def",
"GetIdxFromWindow",
"(",
"self",
",",
"wnd",
")",
":",
"for",
"indx",
",",
"page",
"in",
"enumerate",
"(",
"self",
".",
"_pages",
")",
":",
"if",
"page",
".",
"window",
"==",
"wnd",
":",
"return",
"indx",
"return",
"wx",
".",
"NOT_FOUND"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/aui/auibook.py#L1232-L1243 | |
pyannote/pyannote-video | 5aded79c52cf20a05d1e1f236b9bdd0fb3baa738 | scripts/pyannote-face.py | python | pairwise | (iterable) | return zip(a, a) | s -> (s0,s1), (s2,s3), (s4, s5), ... | s -> (s0,s1), (s2,s3), (s4, s5), ... | [
"s",
"-",
">",
"(",
"s0",
"s1",
")",
"(",
"s2",
"s3",
")",
"(",
"s4",
"s5",
")",
"..."
] | def pairwise(iterable):
"s -> (s0,s1), (s2,s3), (s4, s5), ..."
a = iter(iterable)
return zip(a, a) | [
"def",
"pairwise",
"(",
"iterable",
")",
":",
"a",
"=",
"iter",
"(",
"iterable",
")",
"return",
"zip",
"(",
"a",
",",
"a",
")"
] | https://github.com/pyannote/pyannote-video/blob/5aded79c52cf20a05d1e1f236b9bdd0fb3baa738/scripts/pyannote-face.py#L178-L181 | |
pymc-devs/pymc | 38867dd19e96afb0ceccc8ccd74a9795f118dfe3 | pymc/variational/updates.py | python | adagrad | (loss_or_grads=None, params=None, learning_rate=1.0, epsilon=1e-6) | return updates | Adagrad updates
Scale learning rates by dividing with the square root of accumulated
squared gradients. See [1]_ for further description.
Parameters
----------
loss_or_grads: symbolic expression or list of expressions
A scalar loss expression, or a list of gradient expressions
params: ... | Adagrad updates | [
"Adagrad",
"updates"
] | def adagrad(loss_or_grads=None, params=None, learning_rate=1.0, epsilon=1e-6):
"""Adagrad updates
Scale learning rates by dividing with the square root of accumulated
squared gradients. See [1]_ for further description.
Parameters
----------
loss_or_grads: symbolic expression or list of expres... | [
"def",
"adagrad",
"(",
"loss_or_grads",
"=",
"None",
",",
"params",
"=",
"None",
",",
"learning_rate",
"=",
"1.0",
",",
"epsilon",
"=",
"1e-6",
")",
":",
"if",
"loss_or_grads",
"is",
"None",
"and",
"params",
"is",
"None",
":",
"return",
"partial",
"(",
... | https://github.com/pymc-devs/pymc/blob/38867dd19e96afb0ceccc8ccd74a9795f118dfe3/pymc/variational/updates.py#L468-L544 | |
truenas/middleware | b11ec47d6340324f5a32287ffb4012e5d709b934 | src/middlewared/middlewared/plugins/pool.py | python | PoolService.online | (self, oid, options) | return True | Online a disk from pool of id `id`.
`label` is the vdev guid or device name.
.. examples(websocket)::
Online ZFS device.
:::javascript
{
"id": "6841f242-840a-11e6-a437-00e04d680384",
"msg": "method",
"method": "pool.on... | Online a disk from pool of id `id`. | [
"Online",
"a",
"disk",
"from",
"pool",
"of",
"id",
"id",
"."
] | async def online(self, oid, options):
"""
Online a disk from pool of id `id`.
`label` is the vdev guid or device name.
.. examples(websocket)::
Online ZFS device.
:::javascript
{
"id": "6841f242-840a-11e6-a437-00e04d680384",
... | [
"async",
"def",
"online",
"(",
"self",
",",
"oid",
",",
"options",
")",
":",
"pool",
"=",
"await",
"self",
".",
"get_instance",
"(",
"oid",
")",
"verrors",
"=",
"ValidationErrors",
"(",
")",
"found",
"=",
"await",
"self",
".",
"middleware",
".",
"call"... | https://github.com/truenas/middleware/blob/b11ec47d6340324f5a32287ffb4012e5d709b934/src/middlewared/middlewared/plugins/pool.py#L1147-L1184 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/github/GitRelease.py | python | GitRelease.url | (self) | return self._url.value | :type: string | :type: string | [
":",
"type",
":",
"string"
] | def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._url.value | [
"def",
"url",
"(",
"self",
")",
":",
"self",
".",
"_completeIfNotSet",
"(",
"self",
".",
"_url",
")",
"return",
"self",
".",
"_url",
".",
"value"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/github/GitRelease.py#L138-L143 | |
johntruckenbrodt/pyroSAR | efac51134ba42d20120b259f968afe5a4ddcc46a | pyroSAR/gamma/parser_demo.py | python | par_ASF_RSAT_SS | (CEOS_leader, CEOS_data, GRD_par, GRD, logpath=None, outdir=None, shellscript=None) | | ISP parameter file for ASF Radarsat-1 SCANSAR images
| Copyright 2004, Gamma Remote Sensing, v1.0 27-Aug-2004 clw/uw
Parameters
----------
CEOS_leader:
(input) CEOS leader file (Radarsat-1 SCANSAR)
CEOS_data:
(input) CEOS data file (Radarsat-1 SCANSAR)
GRD_par:
(output... | | ISP parameter file for ASF Radarsat-1 SCANSAR images
| Copyright 2004, Gamma Remote Sensing, v1.0 27-Aug-2004 clw/uw | [
"|",
"ISP",
"parameter",
"file",
"for",
"ASF",
"Radarsat",
"-",
"1",
"SCANSAR",
"images",
"|",
"Copyright",
"2004",
"Gamma",
"Remote",
"Sensing",
"v1",
".",
"0",
"27",
"-",
"Aug",
"-",
"2004",
"clw",
"/",
"uw"
] | def par_ASF_RSAT_SS(CEOS_leader, CEOS_data, GRD_par, GRD, logpath=None, outdir=None, shellscript=None):
"""
| ISP parameter file for ASF Radarsat-1 SCANSAR images
| Copyright 2004, Gamma Remote Sensing, v1.0 27-Aug-2004 clw/uw
Parameters
----------
CEOS_leader:
(input) CEOS leader file ... | [
"def",
"par_ASF_RSAT_SS",
"(",
"CEOS_leader",
",",
"CEOS_data",
",",
"GRD_par",
",",
"GRD",
",",
"logpath",
"=",
"None",
",",
"outdir",
"=",
"None",
",",
"shellscript",
"=",
"None",
")",
":",
"process",
"(",
"[",
"'/usr/local/GAMMA_SOFTWARE-20180703/ISP/bin/par_... | https://github.com/johntruckenbrodt/pyroSAR/blob/efac51134ba42d20120b259f968afe5a4ddcc46a/pyroSAR/gamma/parser_demo.py#L2591-L2614 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scatter/marker/_colorbar.py | python | ColorBar.bgcolor | (self) | return self["bgcolor"] | Sets the color of padded area.
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
... | Sets the color of padded area.
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
... | [
"Sets",
"the",
"color",
"of",
"padded",
"area",
".",
"The",
"bgcolor",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0000",
")",
"-",
"An",
"rgb",
"/",
"rgba",
... | def bgcolor(self):
"""
Sets the color of padded area.
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva str... | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatter/marker/_colorbar.py#L64-L114 | |
facelessuser/BracketHighlighter | 223ffd4ceafd58686503e3328934c039e959a88c | bh_swapping.py | python | SwapBrackets.wrap | (self, wrap_entry) | Setup for wrapping. | Setup for wrapping. | [
"Setup",
"for",
"wrapping",
"."
] | def wrap(self, wrap_entry):
"""Setup for wrapping."""
if wrap_entry < 0:
return
self._style = ["inline"]
self.brackets = self._brackets[wrap_entry]
self.wrap_brackets(0) | [
"def",
"wrap",
"(",
"self",
",",
"wrap_entry",
")",
":",
"if",
"wrap_entry",
"<",
"0",
":",
"return",
"self",
".",
"_style",
"=",
"[",
"\"inline\"",
"]",
"self",
".",
"brackets",
"=",
"self",
".",
"_brackets",
"[",
"wrap_entry",
"]",
"self",
".",
"wr... | https://github.com/facelessuser/BracketHighlighter/blob/223ffd4ceafd58686503e3328934c039e959a88c/bh_swapping.py#L19-L28 | ||
OmkarPathak/pygorithm | be35813729a0151da1ac9ba013453a61ffa249b8 | pygorithm/geometry/extrapolated_intersection.py | python | calculate_one_moving_one_stationary_distancelimit | (poly1, poly1_offset, poly1_velocity, poly2, poly2_offset, max_distance) | Determine if the moving polygon will intersect the stationary polygon
within some distance.
This is a step up, and very similar to the actual problem many any-angle
pathfinding algorithms run into. Given two polygons, 1 moving and 1
stationary, determine if the first polygon will intersect the s... | Determine if the moving polygon will intersect the stationary polygon
within some distance.
This is a step up, and very similar to the actual problem many any-angle
pathfinding algorithms run into. Given two polygons, 1 moving and 1
stationary, determine if the first polygon will intersect the s... | [
"Determine",
"if",
"the",
"moving",
"polygon",
"will",
"intersect",
"the",
"stationary",
"polygon",
"within",
"some",
"distance",
".",
"This",
"is",
"a",
"step",
"up",
"and",
"very",
"similar",
"to",
"the",
"actual",
"problem",
"many",
"any",
"-",
"angle",
... | def calculate_one_moving_one_stationary_distancelimit(poly1, poly1_offset, poly1_velocity, poly2, poly2_offset, max_distance):
"""
Determine if the moving polygon will intersect the stationary polygon
within some distance.
This is a step up, and very similar to the actual problem many any-angle
... | [
"def",
"calculate_one_moving_one_stationary_distancelimit",
"(",
"poly1",
",",
"poly1_offset",
",",
"poly1_velocity",
",",
"poly2",
",",
"poly2_offset",
",",
"max_distance",
")",
":",
"pass"
] | https://github.com/OmkarPathak/pygorithm/blob/be35813729a0151da1ac9ba013453a61ffa249b8/pygorithm/geometry/extrapolated_intersection.py#L91-L116 | ||
zhaoyingjun/TensorFlow-Coding | 1ff292e5d659aa98e7bf6d9cc3986ef07ac2ca81 | lessonTwo/chinese_seq2seq_chatbot/execute.py | python | create_model | (session, forward_only) | return model | Create model and initialize or load parameters | Create model and initialize or load parameters | [
"Create",
"model",
"and",
"initialize",
"or",
"load",
"parameters"
] | def create_model(session, forward_only):
"""Create model and initialize or load parameters"""
model = seq2seq_model.Seq2SeqModel( gConfig['enc_vocab_size'], gConfig['dec_vocab_size'], _buckets, gConfig['layer_size'], gConfig['num_layers'], gConfig['max_gradient_norm'], gConfig['batch_size'], gConfig['learning_rate... | [
"def",
"create_model",
"(",
"session",
",",
"forward_only",
")",
":",
"model",
"=",
"seq2seq_model",
".",
"Seq2SeqModel",
"(",
"gConfig",
"[",
"'enc_vocab_size'",
"]",
",",
"gConfig",
"[",
"'dec_vocab_size'",
"]",
",",
"_buckets",
",",
"gConfig",
"[",
"'layer_... | https://github.com/zhaoyingjun/TensorFlow-Coding/blob/1ff292e5d659aa98e7bf6d9cc3986ef07ac2ca81/lessonTwo/chinese_seq2seq_chatbot/execute.py#L91-L108 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/requests/models.py | python | Response.apparent_encoding | (self) | return chardet.detect(self.content)['encoding'] | The apparent encoding, provided by the chardet library | The apparent encoding, provided by the chardet library | [
"The",
"apparent",
"encoding",
"provided",
"by",
"the",
"chardet",
"library"
] | def apparent_encoding(self):
"""The apparent encoding, provided by the chardet library"""
return chardet.detect(self.content)['encoding'] | [
"def",
"apparent_encoding",
"(",
"self",
")",
":",
"return",
"chardet",
".",
"detect",
"(",
"self",
".",
"content",
")",
"[",
"'encoding'",
"]"
] | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/requests/models.py#L669-L671 | |
facebookarchive/sparts | c03df928677444ad638d10fa96f4144ca4d644e1 | sparts/tasks/file.py | python | DirectoryWatcherTask.stat | (self, path) | return os.stat(path) | Wrapper for making unittesting/mocking easier | Wrapper for making unittesting/mocking easier | [
"Wrapper",
"for",
"making",
"unittesting",
"/",
"mocking",
"easier"
] | def stat(self, path):
"""Wrapper for making unittesting/mocking easier"""
return os.stat(path) | [
"def",
"stat",
"(",
"self",
",",
"path",
")",
":",
"return",
"os",
".",
"stat",
"(",
"path",
")"
] | https://github.com/facebookarchive/sparts/blob/c03df928677444ad638d10fa96f4144ca4d644e1/sparts/tasks/file.py#L95-L97 | |
ma1co/Sony-PMCA-RE | d4da4882e4d59b35f59e4ac919a866e2daf4bbdd | pmca/usb/sony.py | python | SonyExtCmdCamera.getMultiWifiAPInfo | (self) | Returns the live streaming multi access point configuration | Returns the live streaming multi access point configuration | [
"Returns",
"the",
"live",
"streaming",
"multi",
"access",
"point",
"configuration"
] | def getMultiWifiAPInfo(self):
"""Returns the live streaming multi access point configuration"""
for ap in self._parseAPs(BytesIO(self._sendCommand(self.SONY_CMD_NetworkServiceInfo_GetMultiWifiAPInfo))):
yield ap | [
"def",
"getMultiWifiAPInfo",
"(",
"self",
")",
":",
"for",
"ap",
"in",
"self",
".",
"_parseAPs",
"(",
"BytesIO",
"(",
"self",
".",
"_sendCommand",
"(",
"self",
".",
"SONY_CMD_NetworkServiceInfo_GetMultiWifiAPInfo",
")",
")",
")",
":",
"yield",
"ap"
] | https://github.com/ma1co/Sony-PMCA-RE/blob/d4da4882e4d59b35f59e4ac919a866e2daf4bbdd/pmca/usb/sony.py#L402-L405 | ||
Net-ng/kansha | 85b5816da126b1c7098707c98f217d8b2e524ff2 | kansha/card_addons/vote/models.py | python | DataVote.has_voted | (cls, card, user) | return cls.get_vote(card, user) is not None | Return if a user has voted for a given card
In:
- ``card`` -- DataCard instance
- ``user`` -- DataUser instance
Return:
- True if a vote is found, False otherwise | Return if a user has voted for a given card | [
"Return",
"if",
"a",
"user",
"has",
"voted",
"for",
"a",
"given",
"card"
] | def has_voted(cls, card, user):
'''Return if a user has voted for a given card
In:
- ``card`` -- DataCard instance
- ``user`` -- DataUser instance
Return:
- True if a vote is found, False otherwise
'''
return cls.get_vote(card, user) is not No... | [
"def",
"has_voted",
"(",
"cls",
",",
"card",
",",
"user",
")",
":",
"return",
"cls",
".",
"get_vote",
"(",
"card",
",",
"user",
")",
"is",
"not",
"None"
] | https://github.com/Net-ng/kansha/blob/85b5816da126b1c7098707c98f217d8b2e524ff2/kansha/card_addons/vote/models.py#L46-L55 | |
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/sdb.py | python | SessionStorage.get_assertion | (self, cid) | return self.assertion[cid] | [] | def get_assertion(self, cid):
return self.assertion[cid] | [
"def",
"get_assertion",
"(",
"self",
",",
"cid",
")",
":",
"return",
"self",
".",
"assertion",
"[",
"cid",
"]"
] | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/sdb.py#L34-L35 | |||
roytseng-tw/Detectron.pytorch | 1b1c4ba58428b7277a45b0dce6cc1bce3744b86a | lib/modeling/fast_rcnn_heads.py | python | fast_rcnn_outputs._init_weights | (self) | [] | def _init_weights(self):
init.normal_(self.cls_score.weight, std=0.01)
init.constant_(self.cls_score.bias, 0)
init.normal_(self.bbox_pred.weight, std=0.001)
init.constant_(self.bbox_pred.bias, 0) | [
"def",
"_init_weights",
"(",
"self",
")",
":",
"init",
".",
"normal_",
"(",
"self",
".",
"cls_score",
".",
"weight",
",",
"std",
"=",
"0.01",
")",
"init",
".",
"constant_",
"(",
"self",
".",
"cls_score",
".",
"bias",
",",
"0",
")",
"init",
".",
"no... | https://github.com/roytseng-tw/Detectron.pytorch/blob/1b1c4ba58428b7277a45b0dce6cc1bce3744b86a/lib/modeling/fast_rcnn_heads.py#L23-L27 | ||||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/conch/ssh/connection.py | python | SSHConnection.sendExtendedData | (self, channel, dataType, data) | Send extended data to a channel. This should not normally be used:
instead use channel.writeExtendedData(data, dataType) as it manages
the window automatically.
@type channel: subclass of L{SSHChannel}
@type dataType: C{int}
@type data: C{str} | Send extended data to a channel. This should not normally be used:
instead use channel.writeExtendedData(data, dataType) as it manages
the window automatically. | [
"Send",
"extended",
"data",
"to",
"a",
"channel",
".",
"This",
"should",
"not",
"normally",
"be",
"used",
":",
"instead",
"use",
"channel",
".",
"writeExtendedData",
"(",
"data",
"dataType",
")",
"as",
"it",
"manages",
"the",
"window",
"automatically",
"."
] | def sendExtendedData(self, channel, dataType, data):
"""
Send extended data to a channel. This should not normally be used:
instead use channel.writeExtendedData(data, dataType) as it manages
the window automatically.
@type channel: subclass of L{SSHChannel}
@type data... | [
"def",
"sendExtendedData",
"(",
"self",
",",
"channel",
",",
"dataType",
",",
"data",
")",
":",
"if",
"channel",
".",
"localClosed",
":",
"return",
"# we're already closed",
"self",
".",
"transport",
".",
"sendPacket",
"(",
"MSG_CHANNEL_EXTENDED_DATA",
",",
"str... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/conch/ssh/connection.py#L473-L487 | ||
kamens/gae_bingo | f5285b9ad17dde72991fe123f23095520a554cbf | instance_cache.py | python | increment | (key, expiry=DEFAULT_CACHING_TIME) | Increments key (setting the result to 1 if key isn't present).
Also resets the expiry for this key. | Increments key (setting the result to 1 if key isn't present).
Also resets the expiry for this key. | [
"Increments",
"key",
"(",
"setting",
"the",
"result",
"to",
"1",
"if",
"key",
"isn",
"t",
"present",
")",
".",
"Also",
"resets",
"the",
"expiry",
"for",
"this",
"key",
"."
] | def increment(key, expiry=DEFAULT_CACHING_TIME):
"""
Increments key (setting the result to 1 if key isn't present).
Also resets the expiry for this key.
"""
if ACTIVE is False:
return None
if expiry != None:
expiry = time.time() + int(expiry)
try:
with _CACHE_LOCK:
... | [
"def",
"increment",
"(",
"key",
",",
"expiry",
"=",
"DEFAULT_CACHING_TIME",
")",
":",
"if",
"ACTIVE",
"is",
"False",
":",
"return",
"None",
"if",
"expiry",
"!=",
"None",
":",
"expiry",
"=",
"time",
".",
"time",
"(",
")",
"+",
"int",
"(",
"expiry",
")... | https://github.com/kamens/gae_bingo/blob/f5285b9ad17dde72991fe123f23095520a554cbf/instance_cache.py#L122-L143 | ||
pynag/pynag | e72cf7ce2395263e2b3080cae0ece2b03dbbfa27 | pynag/Control/Command/autogenerated_commands.py | python | enable_svc_flap_detection | (
host_name,
service_description,
command_file=None,
timestamp=0
) | return send_command("ENABLE_SVC_FLAP_DETECTION",
command_file,
timestamp,
host_name,
service_description) | Enables flap detection for the specified service. In order for
the flap detection algorithms to be run for the service, flap
detection must be enabled on a program-wide basis as well. | Enables flap detection for the specified service. In order for
the flap detection algorithms to be run for the service, flap
detection must be enabled on a program-wide basis as well. | [
"Enables",
"flap",
"detection",
"for",
"the",
"specified",
"service",
".",
"In",
"order",
"for",
"the",
"flap",
"detection",
"algorithms",
"to",
"be",
"run",
"for",
"the",
"service",
"flap",
"detection",
"must",
"be",
"enabled",
"on",
"a",
"program",
"-",
... | def enable_svc_flap_detection(
host_name,
service_description,
command_file=None,
timestamp=0
):
"""
Enables flap detection for the specified service. In order for
the flap detection algorithms to be run for the service, flap
detection must be enabled on a program-wide basis as well.
... | [
"def",
"enable_svc_flap_detection",
"(",
"host_name",
",",
"service_description",
",",
"command_file",
"=",
"None",
",",
"timestamp",
"=",
"0",
")",
":",
"return",
"send_command",
"(",
"\"ENABLE_SVC_FLAP_DETECTION\"",
",",
"command_file",
",",
"timestamp",
",",
"hos... | https://github.com/pynag/pynag/blob/e72cf7ce2395263e2b3080cae0ece2b03dbbfa27/pynag/Control/Command/autogenerated_commands.py#L2520-L2535 | |
OpenEIT/OpenEIT | 0448694e8092361ae5ccb45fba81dee543a6244b | OpenEIT/backend/bluetooth/old/build/dlib/Adafruit_BluefruitLE/interfaces/device.py | python | Device.find_service | (self, uuid) | return None | Return the first child service found that has the specified
UUID. Will return None if no service that matches is found. | Return the first child service found that has the specified
UUID. Will return None if no service that matches is found. | [
"Return",
"the",
"first",
"child",
"service",
"found",
"that",
"has",
"the",
"specified",
"UUID",
".",
"Will",
"return",
"None",
"if",
"no",
"service",
"that",
"matches",
"is",
"found",
"."
] | def find_service(self, uuid):
"""Return the first child service found that has the specified
UUID. Will return None if no service that matches is found.
"""
for service in self.list_services():
if service.uuid == uuid:
return service
return None | [
"def",
"find_service",
"(",
"self",
",",
"uuid",
")",
":",
"for",
"service",
"in",
"self",
".",
"list_services",
"(",
")",
":",
"if",
"service",
".",
"uuid",
"==",
"uuid",
":",
"return",
"service",
"return",
"None"
] | https://github.com/OpenEIT/OpenEIT/blob/0448694e8092361ae5ccb45fba81dee543a6244b/OpenEIT/backend/bluetooth/old/build/dlib/Adafruit_BluefruitLE/interfaces/device.py#L87-L94 | |
tahoe-lafs/tahoe-lafs | 766a53b5208c03c45ca0a98e97eee76870276aa1 | src/allmydata/util/iputil.py | python | get_local_addresses_sync | () | return list(
native_str(address[native_str("addr")])
for iface_name
in interfaces()
for address
in ifaddresses(iface_name).get(socket.AF_INET, [])
) | Get locally assigned addresses as dotted-quad native strings.
:return [str]: A list of IPv4 addresses which are assigned to interfaces
on the local system. | Get locally assigned addresses as dotted-quad native strings. | [
"Get",
"locally",
"assigned",
"addresses",
"as",
"dotted",
"-",
"quad",
"native",
"strings",
"."
] | def get_local_addresses_sync():
"""
Get locally assigned addresses as dotted-quad native strings.
:return [str]: A list of IPv4 addresses which are assigned to interfaces
on the local system.
"""
return list(
native_str(address[native_str("addr")])
for iface_name
in ... | [
"def",
"get_local_addresses_sync",
"(",
")",
":",
"return",
"list",
"(",
"native_str",
"(",
"address",
"[",
"native_str",
"(",
"\"addr\"",
")",
"]",
")",
"for",
"iface_name",
"in",
"interfaces",
"(",
")",
"for",
"address",
"in",
"ifaddresses",
"(",
"iface_na... | https://github.com/tahoe-lafs/tahoe-lafs/blob/766a53b5208c03c45ca0a98e97eee76870276aa1/src/allmydata/util/iputil.py#L105-L118 | |
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/urllib3/_collections.py | python | HTTPHeaderDict.pop | (self, key, default=__marker) | D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised. | D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised. | [
"D",
".",
"pop",
"(",
"k",
"[",
"d",
"]",
")",
"-",
">",
"v",
"remove",
"specified",
"key",
"and",
"return",
"the",
"corresponding",
"value",
".",
"If",
"key",
"is",
"not",
"found",
"d",
"is",
"returned",
"if",
"given",
"otherwise",
"KeyError",
"is",... | def pop(self, key, default=__marker):
'''D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
'''
# Using the MutableMapping function directly fails due to the private marker.
# Us... | [
"def",
"pop",
"(",
"self",
",",
"key",
",",
"default",
"=",
"__marker",
")",
":",
"# Using the MutableMapping function directly fails due to the private marker.",
"# Using ordinary dict.pop would expose the internal structures.",
"# So let's reinvent the wheel.",
"try",
":",
"value... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/urllib3/_collections.py#L186-L201 | ||
adafruit/Adafruit_Python_SSD1306 | dfa8717cb7a2d8706bef5e1ed6c49763748cd1c3 | Adafruit_SSD1306/SSD1306.py | python | SSD1306Base.set_contrast | (self, contrast) | Sets the contrast of the display. Contrast should be a value between
0 and 255. | Sets the contrast of the display. Contrast should be a value between
0 and 255. | [
"Sets",
"the",
"contrast",
"of",
"the",
"display",
".",
"Contrast",
"should",
"be",
"a",
"value",
"between",
"0",
"and",
"255",
"."
] | def set_contrast(self, contrast):
"""Sets the contrast of the display. Contrast should be a value between
0 and 255."""
if contrast < 0 or contrast > 255:
raise ValueError('Contrast must be a value from 0 to 255 (inclusive).')
self.command(SSD1306_SETCONTRAST)
self.c... | [
"def",
"set_contrast",
"(",
"self",
",",
"contrast",
")",
":",
"if",
"contrast",
"<",
"0",
"or",
"contrast",
">",
"255",
":",
"raise",
"ValueError",
"(",
"'Contrast must be a value from 0 to 255 (inclusive).'",
")",
"self",
".",
"command",
"(",
"SSD1306_SETCONTRAS... | https://github.com/adafruit/Adafruit_Python_SSD1306/blob/dfa8717cb7a2d8706bef5e1ed6c49763748cd1c3/Adafruit_SSD1306/SSD1306.py#L215-L221 | ||
IntelAI/nauta | bbedb114a755cf1f43b834a58fc15fb6e3a4b291 | applications/cli/commands/common/logs_utils.py | python | save_logs_to_file | (logs_generator: Generator[LogEntry, None, None], instance_name: str,
instance_type: str) | [] | def save_logs_to_file(logs_generator: Generator[LogEntry, None, None], instance_name: str,
instance_type: str):
filename = instance_name + ".log"
confirmation_message = Texts.LOGS_STORING_CONF.format(filename=filename,
instance_name... | [
"def",
"save_logs_to_file",
"(",
"logs_generator",
":",
"Generator",
"[",
"LogEntry",
",",
"None",
",",
"None",
"]",
",",
"instance_name",
":",
"str",
",",
"instance_type",
":",
"str",
")",
":",
"filename",
"=",
"instance_name",
"+",
"\".log\"",
"confirmation_... | https://github.com/IntelAI/nauta/blob/bbedb114a755cf1f43b834a58fc15fb6e3a4b291/applications/cli/commands/common/logs_utils.py#L119-L145 | ||||
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/lobotomy/core/include/androguard/androguard/core/bytecodes/apk.py | python | APK.get_file | (self, filename) | Return the raw data of the specified filename
:rtype: string | Return the raw data of the specified filename | [
"Return",
"the",
"raw",
"data",
"of",
"the",
"specified",
"filename"
] | def get_file(self, filename):
"""
Return the raw data of the specified filename
:rtype: string
"""
try:
return self.zip.read(filename)
except KeyError:
return "" | [
"def",
"get_file",
"(",
"self",
",",
"filename",
")",
":",
"try",
":",
"return",
"self",
".",
"zip",
".",
"read",
"(",
"filename",
")",
"except",
"KeyError",
":",
"return",
"\"\""
] | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/lobotomy/core/include/androguard/androguard/core/bytecodes/apk.py#L351-L360 | ||
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | tools/compile_tf_graph.py | python | init | (config_filename, log_verbosity) | :param str config_filename: filename to config-file
:param int log_verbosity: | :param str config_filename: filename to config-file
:param int log_verbosity: | [
":",
"param",
"str",
"config_filename",
":",
"filename",
"to",
"config",
"-",
"file",
":",
"param",
"int",
"log_verbosity",
":"
] | def init(config_filename, log_verbosity):
"""
:param str config_filename: filename to config-file
:param int log_verbosity:
"""
rnn.init_better_exchook()
rnn.init_thread_join_hack()
print("Using config file %r." % config_filename)
assert os.path.exists(config_filename)
rnn.init_config(config_filename=... | [
"def",
"init",
"(",
"config_filename",
",",
"log_verbosity",
")",
":",
"rnn",
".",
"init_better_exchook",
"(",
")",
"rnn",
".",
"init_thread_join_hack",
"(",
")",
"print",
"(",
"\"Using config file %r.\"",
"%",
"config_filename",
")",
"assert",
"os",
".",
"path"... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/tools/compile_tf_graph.py#L37-L60 | ||
Xilinx/finn | d1cc9cf94f1c33354cc169c5a6517314d0e94e3b | src/finn/custom_op/fpgadataflow/lookup.py | python | Lookup.get_input_datatype | (self) | return ret | [] | def get_input_datatype(self):
ret = DataType[self.get_nodeattr("InputType")]
return ret | [
"def",
"get_input_datatype",
"(",
"self",
")",
":",
"ret",
"=",
"DataType",
"[",
"self",
".",
"get_nodeattr",
"(",
"\"InputType\"",
")",
"]",
"return",
"ret"
] | https://github.com/Xilinx/finn/blob/d1cc9cf94f1c33354cc169c5a6517314d0e94e3b/src/finn/custom_op/fpgadataflow/lookup.py#L113-L115 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.