nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/api/networking_v1beta1_api.py | python | NetworkingV1beta1Api.read_namespaced_ingress_status_with_http_info | (self, name, namespace, **kwargs) | return self.api_client.call_api(
'/apis/networking.k8s.io/v1beta1/namespaces/{namespace}/ingresses/{name}/status', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
... | read_namespaced_ingress_status # noqa: E501
read status of the specified Ingress # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.read_namespaced_ingress_status_with_http_info(name, ... | read_namespaced_ingress_status # noqa: E501 | [
"read_namespaced_ingress_status",
"#",
"noqa",
":",
"E501"
] | def read_namespaced_ingress_status_with_http_info(self, name, namespace, **kwargs): # noqa: E501
"""read_namespaced_ingress_status # noqa: E501
read status of the specified Ingress # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP requ... | [
"def",
"read_namespaced_ingress_status_with_http_info",
"(",
"self",
",",
"name",
",",
"namespace",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"local_var_params",
"=",
"locals",
"(",
")",
"all_params",
"=",
"[",
"'name'",
",",
"'namespace'",
",",
"'prett... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/networking_v1beta1_api.py#L2284-L2383 | |
pytorch/fairseq | 1575f30dd0a9f7b3c499db0b4767aa4e9f79056c | fairseq/data/audio/data_cfg.py | python | S2TDataConfig.shuffle | (self) | return self.config.get("shuffle", False) | Shuffle dataset samples before batching | Shuffle dataset samples before batching | [
"Shuffle",
"dataset",
"samples",
"before",
"batching"
] | def shuffle(self) -> bool:
"""Shuffle dataset samples before batching"""
return self.config.get("shuffle", False) | [
"def",
"shuffle",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"config",
".",
"get",
"(",
"\"shuffle\"",
",",
"False",
")"
] | https://github.com/pytorch/fairseq/blob/1575f30dd0a9f7b3c499db0b4767aa4e9f79056c/fairseq/data/audio/data_cfg.py#L56-L58 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/pickle.py | python | _Pickler._batch_setitems | (self, items) | [] | def _batch_setitems(self, items):
# Helper to batch up SETITEMS sequences; proto >= 1 only
save = self.save
write = self.write
if not self.bin:
for k, v in items:
save(k)
save(v)
write(SETITEM)
return
items... | [
"def",
"_batch_setitems",
"(",
"self",
",",
"items",
")",
":",
"# Helper to batch up SETITEMS sequences; proto >= 1 only",
"save",
"=",
"self",
".",
"save",
"write",
"=",
"self",
".",
"write",
"if",
"not",
"self",
".",
"bin",
":",
"for",
"k",
",",
"v",
"in",... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/pickle.py#L653-L686 | ||||
PanJinquan/tensorflow_models_learning | e7a2773d526e01c76fc8366868099ca3d7a819b4 | slim/datasets/build_imagenet_data.py | python | _find_human_readable_labels | (synsets, synset_to_human) | return humans | Build a list of human-readable labels.
Args:
synsets: list of strings; each string is a unique WordNet ID.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red fox, Vulpes vulpes'
Returns:
List of human-readable strings corresponding to each synset. | Build a list of human-readable labels. | [
"Build",
"a",
"list",
"of",
"human",
"-",
"readable",
"labels",
"."
] | def _find_human_readable_labels(synsets, synset_to_human):
"""Build a list of human-readable labels.
Args:
synsets: list of strings; each string is a unique WordNet ID.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red fox, Vulpes vulpes'
Returns:
List of human-readab... | [
"def",
"_find_human_readable_labels",
"(",
"synsets",
",",
"synset_to_human",
")",
":",
"humans",
"=",
"[",
"]",
"for",
"s",
"in",
"synsets",
":",
"assert",
"s",
"in",
"synset_to_human",
",",
"(",
"'Failed to find: %s'",
"%",
"s",
")",
"humans",
".",
"append... | https://github.com/PanJinquan/tensorflow_models_learning/blob/e7a2773d526e01c76fc8366868099ca3d7a819b4/slim/datasets/build_imagenet_data.py#L540-L555 | |
vchoutas/smplx | cfa54f8135ca6cb8b3588c2d893a4df7a94032ed | smplx/lbs.py | python | batch_rigid_transform | (
rot_mats: Tensor,
joints: Tensor,
parents: Tensor,
dtype=torch.float32
) | return posed_joints, rel_transforms | Applies a batch of rigid transformations to the joints
Parameters
----------
rot_mats : torch.tensor BxNx3x3
Tensor of rotation matrices
joints : torch.tensor BxNx3
Locations of joints
parents : torch.tensor BxN
The kinematic tree of each object
dtype : torch.dtype, opti... | Applies a batch of rigid transformations to the joints | [
"Applies",
"a",
"batch",
"of",
"rigid",
"transformations",
"to",
"the",
"joints"
] | def batch_rigid_transform(
rot_mats: Tensor,
joints: Tensor,
parents: Tensor,
dtype=torch.float32
) -> Tensor:
"""
Applies a batch of rigid transformations to the joints
Parameters
----------
rot_mats : torch.tensor BxNx3x3
Tensor of rotation matrices
joints : torch.tens... | [
"def",
"batch_rigid_transform",
"(",
"rot_mats",
":",
"Tensor",
",",
"joints",
":",
"Tensor",
",",
"parents",
":",
"Tensor",
",",
"dtype",
"=",
"torch",
".",
"float32",
")",
"->",
"Tensor",
":",
"joints",
"=",
"torch",
".",
"unsqueeze",
"(",
"joints",
",... | https://github.com/vchoutas/smplx/blob/cfa54f8135ca6cb8b3588c2d893a4df7a94032ed/smplx/lbs.py#L345-L401 | |
Neuraxio/Neuraxle | c5627e663ef6d50736bc6a01110afa626fffec07 | neuraxle/hyperparams/distributions.py | python | Normal.cdf | (self, x) | return norm.cdf(x, loc=self._mean, scale=self._std) | Calculate the Normal cumulative distribution value at position `x`.
:param x: value where the cumulative distribution function is evaluated.
:return: value of the cumulative distribution function. | Calculate the Normal cumulative distribution value at position `x`.
:param x: value where the cumulative distribution function is evaluated.
:return: value of the cumulative distribution function. | [
"Calculate",
"the",
"Normal",
"cumulative",
"distribution",
"value",
"at",
"position",
"x",
".",
":",
"param",
"x",
":",
"value",
"where",
"the",
"cumulative",
"distribution",
"function",
"is",
"evaluated",
".",
":",
"return",
":",
"value",
"of",
"the",
"cum... | def cdf(self, x) -> float:
"""
Calculate the Normal cumulative distribution value at position `x`.
:param x: value where the cumulative distribution function is evaluated.
:return: value of the cumulative distribution function.
"""
if self.hard_clip_min is not None and (x... | [
"def",
"cdf",
"(",
"self",
",",
"x",
")",
"->",
"float",
":",
"if",
"self",
".",
"hard_clip_min",
"is",
"not",
"None",
"and",
"(",
"x",
"<",
"self",
".",
"hard_clip_min",
")",
":",
"return",
"0.",
"if",
"self",
".",
"hard_clip_max",
"is",
"not",
"N... | https://github.com/Neuraxio/Neuraxle/blob/c5627e663ef6d50736bc6a01110afa626fffec07/neuraxle/hyperparams/distributions.py#L1170-L1194 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | deep-learning/udacity-deeplearning/Solutions/project-5/helper.py | python | _read32 | (bytestream) | return np.frombuffer(bytestream.read(4), dtype=dt)[0] | Read 32-bit integer from bytesteam
:param bytestream: A bytestream
:return: 32-bit integer | Read 32-bit integer from bytesteam
:param bytestream: A bytestream
:return: 32-bit integer | [
"Read",
"32",
"-",
"bit",
"integer",
"from",
"bytesteam",
":",
"param",
"bytestream",
":",
"A",
"bytestream",
":",
"return",
":",
"32",
"-",
"bit",
"integer"
] | def _read32(bytestream):
"""
Read 32-bit integer from bytesteam
:param bytestream: A bytestream
:return: 32-bit integer
"""
dt = np.dtype(np.uint32).newbyteorder('>')
return np.frombuffer(bytestream.read(4), dtype=dt)[0] | [
"def",
"_read32",
"(",
"bytestream",
")",
":",
"dt",
"=",
"np",
".",
"dtype",
"(",
"np",
".",
"uint32",
")",
".",
"newbyteorder",
"(",
"'>'",
")",
"return",
"np",
".",
"frombuffer",
"(",
"bytestream",
".",
"read",
"(",
"4",
")",
",",
"dtype",
"=",
... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/deep-learning/udacity-deeplearning/Solutions/project-5/helper.py#L14-L21 | |
MDudek-ICS/TRISIS-TRITON-HATMAN | 15a00af7fd1040f0430729d024427601f84886a1 | decompiled_code/library/functools.py | python | wraps | (wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES) | return partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated) | Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a conve... | Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a conve... | [
"Decorator",
"factory",
"to",
"apply",
"update_wrapper",
"()",
"to",
"a",
"wrapper",
"function",
"Returns",
"a",
"decorator",
"that",
"invokes",
"update_wrapper",
"()",
"with",
"the",
"decorated",
"function",
"as",
"the",
"wrapper",
"argument",
"and",
"the",
"ar... | def wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
"""Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remainin... | [
"def",
"wraps",
"(",
"wrapped",
",",
"assigned",
"=",
"WRAPPER_ASSIGNMENTS",
",",
"updated",
"=",
"WRAPPER_UPDATES",
")",
":",
"return",
"partial",
"(",
"update_wrapper",
",",
"wrapped",
"=",
"wrapped",
",",
"assigned",
"=",
"assigned",
",",
"updated",
"=",
... | https://github.com/MDudek-ICS/TRISIS-TRITON-HATMAN/blob/15a00af7fd1040f0430729d024427601f84886a1/decompiled_code/library/functools.py#L34-L43 | |
TabbycatDebate/tabbycat | 7cc3b2fa1cc34569501a4be10fe9234b98c65df3 | tabbycat/utils/templatetags/debate_tags.py | python | RoundURLNode.render | (self, context) | return super().render(context) | Add the round to the arguments, then render as usual. | Add the round to the arguments, then render as usual. | [
"Add",
"the",
"round",
"to",
"the",
"arguments",
"then",
"render",
"as",
"usual",
"."
] | def render(self, context):
"""Add the round to the arguments, then render as usual."""
# Similar comment as for TournamentURLNode.render()
round = self.round.resolve(context) if self.round else context['round']
tournament_slug = Variable("'" + round.tournament.slug + "'")
round_... | [
"def",
"render",
"(",
"self",
",",
"context",
")",
":",
"# Similar comment as for TournamentURLNode.render()",
"round",
"=",
"self",
".",
"round",
".",
"resolve",
"(",
"context",
")",
"if",
"self",
".",
"round",
"else",
"context",
"[",
"'round'",
"]",
"tournam... | https://github.com/TabbycatDebate/tabbycat/blob/7cc3b2fa1cc34569501a4be10fe9234b98c65df3/tabbycat/utils/templatetags/debate_tags.py#L110-L126 | |
arrayfire/arrayfire-python | 96fa9768ee02e5fb5ffcaf3d1f744c898b141637 | arrayfire/device.py | python | device_gc | () | Ask the garbage collector to free all unlocked memory | Ask the garbage collector to free all unlocked memory | [
"Ask",
"the",
"garbage",
"collector",
"to",
"free",
"all",
"unlocked",
"memory"
] | def device_gc():
"""
Ask the garbage collector to free all unlocked memory
"""
safe_call(backend.get().af_device_gc()) | [
"def",
"device_gc",
"(",
")",
":",
"safe_call",
"(",
"backend",
".",
"get",
"(",
")",
".",
"af_device_gc",
"(",
")",
")"
] | https://github.com/arrayfire/arrayfire-python/blob/96fa9768ee02e5fb5ffcaf3d1f744c898b141637/arrayfire/device.py#L341-L345 | ||
karan/HackerNewsAPI | 0e2df2e28f3a6090559eacdefdb99f4d6780ddf5 | hn/hn.py | python | HN._build_story | (self, all_rows) | return all_stories | Builds and returns a list of stories (dicts) from the passed source. | Builds and returns a list of stories (dicts) from the passed source. | [
"Builds",
"and",
"returns",
"a",
"list",
"of",
"stories",
"(",
"dicts",
")",
"from",
"the",
"passed",
"source",
"."
] | def _build_story(self, all_rows):
"""
Builds and returns a list of stories (dicts) from the passed source.
"""
# list to hold all stories
all_stories = []
for (info, detail) in all_rows:
#-- Get the into about a story --#
# split in 3 cells
... | [
"def",
"_build_story",
"(",
"self",
",",
"all_rows",
")",
":",
"# list to hold all stories",
"all_stories",
"=",
"[",
"]",
"for",
"(",
"info",
",",
"detail",
")",
"in",
"all_rows",
":",
"#-- Get the into about a story --#",
"# split in 3 cells",
"info_cells",
"=",
... | https://github.com/karan/HackerNewsAPI/blob/0e2df2e28f3a6090559eacdefdb99f4d6780ddf5/hn/hn.py#L57-L138 | |
galaxyproject/galaxy | 4c03520f05062e0f4a1b3655dc0b7452fda69943 | lib/galaxy/webapps/galaxy/api/history_contents.py | python | get_index_query_params | (
v: Optional[str] = Query( # Should this be deprecated at some point and directly use the latest version by default?
default=None,
title="Version",
description="Only `dev` value is allowed. Set it to use the latest version of this endpoint.",
example="dev",
),
dataset_detai... | return parse_index_query_params(
v=v,
dataset_details=dataset_details,
) | This function is meant to be used as a dependency to render the OpenAPI documentation
correctly | This function is meant to be used as a dependency to render the OpenAPI documentation
correctly | [
"This",
"function",
"is",
"meant",
"to",
"be",
"used",
"as",
"a",
"dependency",
"to",
"render",
"the",
"OpenAPI",
"documentation",
"correctly"
] | def get_index_query_params(
v: Optional[str] = Query( # Should this be deprecated at some point and directly use the latest version by default?
default=None,
title="Version",
description="Only `dev` value is allowed. Set it to use the latest version of this endpoint.",
example="dev"... | [
"def",
"get_index_query_params",
"(",
"v",
":",
"Optional",
"[",
"str",
"]",
"=",
"Query",
"(",
"# Should this be deprecated at some point and directly use the latest version by default?",
"default",
"=",
"None",
",",
"title",
"=",
"\"Version\"",
",",
"description",
"=",
... | https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/webapps/galaxy/api/history_contents.py#L108-L131 | |
smokeleeteveryday/CTF_WRITEUPS | 4683f0d41c92c4ed407cc3dd3b1760c68a05943f | 2015/ASISCTF/reversing/selfie/solution/selfie_descramble.py | python | descramble | (selfie) | return res | [] | def descramble(selfie):
scrambled = get_scrambled_buffer(get_hidden_elf(selfie))
#Try bruteforce approach
v9 = 1521
res = ""
for i in xrange(v9):
if not(sitoor(i)):
res += scrambled[i + 1]
return res | [
"def",
"descramble",
"(",
"selfie",
")",
":",
"scrambled",
"=",
"get_scrambled_buffer",
"(",
"get_hidden_elf",
"(",
"selfie",
")",
")",
"#Try bruteforce approach",
"v9",
"=",
"1521",
"res",
"=",
"\"\"",
"for",
"i",
"in",
"xrange",
"(",
"v9",
")",
":",
"if"... | https://github.com/smokeleeteveryday/CTF_WRITEUPS/blob/4683f0d41c92c4ed407cc3dd3b1760c68a05943f/2015/ASISCTF/reversing/selfie/solution/selfie_descramble.py#L37-L45 | |||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/google_ads_service/client.py | python | GoogleAdsServiceClient.common_billing_account_path | (billing_account: str,) | return "billingAccounts/{billing_account}".format(
billing_account=billing_account,
) | Return a fully-qualified billing_account string. | Return a fully-qualified billing_account string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"billing_account",
"string",
"."
] | def common_billing_account_path(billing_account: str,) -> str:
"""Return a fully-qualified billing_account string."""
return "billingAccounts/{billing_account}".format(
billing_account=billing_account,
) | [
"def",
"common_billing_account_path",
"(",
"billing_account",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"billingAccounts/{billing_account}\"",
".",
"format",
"(",
"billing_account",
"=",
"billing_account",
",",
")"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/google_ads_service/client.py#L2918-L2922 | |
fedora-infra/bodhi | 2b1df12d85eb2e575d8e481a3936c4f92d1fe29a | bodhi/server/validators.py | python | validate_build_tags | (request, **kwargs) | Ensure that all of the referenced builds are tagged as candidates.
Args:
request (pyramid.request.Request): The current request.
kwargs (dict): The kwargs of the related service definition. Unused. | Ensure that all of the referenced builds are tagged as candidates. | [
"Ensure",
"that",
"all",
"of",
"the",
"referenced",
"builds",
"are",
"tagged",
"as",
"candidates",
"."
] | def validate_build_tags(request, **kwargs):
"""
Ensure that all of the referenced builds are tagged as candidates.
Args:
request (pyramid.request.Request): The current request.
kwargs (dict): The kwargs of the related service definition. Unused.
"""
tag_types, tag_rels = Release.get... | [
"def",
"validate_build_tags",
"(",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"tag_types",
",",
"tag_rels",
"=",
"Release",
".",
"get_tags",
"(",
"request",
".",
"db",
")",
"edited",
"=",
"request",
".",
"validated",
".",
"get",
"(",
"'edited'",
")",
... | https://github.com/fedora-infra/bodhi/blob/2b1df12d85eb2e575d8e481a3936c4f92d1fe29a/bodhi/server/validators.py#L305-L356 | ||
fossasia/pslab-python | bb53a334b729d0956ed9f4ce6899903f3e4868ef | pslab/external/MPU925x.py | python | MPU925x.WhoAmI_AK8963 | (self) | Returns the ID fo magnetometer AK8963 if found.
It should be 0x48. | Returns the ID fo magnetometer AK8963 if found.
It should be 0x48. | [
"Returns",
"the",
"ID",
"fo",
"magnetometer",
"AK8963",
"if",
"found",
".",
"It",
"should",
"be",
"0x48",
"."
] | def WhoAmI_AK8963(self):
'''
Returns the ID fo magnetometer AK8963 if found.
It should be 0x48.
'''
self.initMagnetometer()
v = self.I2C.readBulk(self.AK8963_ADDRESS, 0, 1)[0]
if v == 0x48:
return 'AK8963 at %s' % hex(v)
else:
retur... | [
"def",
"WhoAmI_AK8963",
"(",
"self",
")",
":",
"self",
".",
"initMagnetometer",
"(",
")",
"v",
"=",
"self",
".",
"I2C",
".",
"readBulk",
"(",
"self",
".",
"AK8963_ADDRESS",
",",
"0",
",",
"1",
")",
"[",
"0",
"]",
"if",
"v",
"==",
"0x48",
":",
"re... | https://github.com/fossasia/pslab-python/blob/bb53a334b729d0956ed9f4ce6899903f3e4868ef/pslab/external/MPU925x.py#L161-L171 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/sql/crud.py | python | _append_param_insert_pk_returning | (compiler, stmt, c, values, kw) | Create a primary key expression in the INSERT statement and
possibly a RETURNING clause for it.
If the column has a Python-side default, we will create a bound
parameter for it and "pre-execute" the Python function. If
the column has a SQL expression default, or is a sequence,
we will add it direc... | Create a primary key expression in the INSERT statement and
possibly a RETURNING clause for it. | [
"Create",
"a",
"primary",
"key",
"expression",
"in",
"the",
"INSERT",
"statement",
"and",
"possibly",
"a",
"RETURNING",
"clause",
"for",
"it",
"."
] | def _append_param_insert_pk_returning(compiler, stmt, c, values, kw):
"""Create a primary key expression in the INSERT statement and
possibly a RETURNING clause for it.
If the column has a Python-side default, we will create a bound
parameter for it and "pre-execute" the Python function. If
the co... | [
"def",
"_append_param_insert_pk_returning",
"(",
"compiler",
",",
"stmt",
",",
"c",
",",
"values",
",",
"kw",
")",
":",
"if",
"c",
".",
"default",
"is",
"not",
"None",
":",
"if",
"c",
".",
"default",
".",
"is_sequence",
":",
"if",
"compiler",
".",
"dia... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/sql/crud.py#L424-L462 | ||
bigaidream-projects/drmad | a4bb6010595d956f29c5a42a095bab76a60b29eb | cpu_ver/funkyyak/scheme/core.py | python | getval | (arg, grad, localenv) | [] | def getval(arg, grad, localenv):
if isinstance(arg, tape):
arg.env['outgrad'] = kyfun((), call('add',
(call(kyfun((), grad, localenv), ()), call(arg.env['outgrad'], ()))), {})
return arg.value
else:
return arg | [
"def",
"getval",
"(",
"arg",
",",
"grad",
",",
"localenv",
")",
":",
"if",
"isinstance",
"(",
"arg",
",",
"tape",
")",
":",
"arg",
".",
"env",
"[",
"'outgrad'",
"]",
"=",
"kyfun",
"(",
"(",
")",
",",
"call",
"(",
"'add'",
",",
"(",
"call",
"(",... | https://github.com/bigaidream-projects/drmad/blob/a4bb6010595d956f29c5a42a095bab76a60b29eb/cpu_ver/funkyyak/scheme/core.py#L55-L61 | ||||
paramiko/paramiko | 88f35a537428e430f7f26eee8026715e357b55d6 | paramiko/transport.py | python | Transport.connect | (
self,
hostkey=None,
username="",
password=None,
pkey=None,
gss_host=None,
gss_auth=False,
gss_kex=False,
gss_deleg_creds=True,
gss_trust_dns=True,
) | return | Negotiate an SSH2 session, and optionally verify the server's host key
and authenticate using a password or private key. This is a shortcut
for `start_client`, `get_remote_server_key`, and
`Transport.auth_password` or `Transport.auth_publickey`. Use those
methods if you want more contr... | Negotiate an SSH2 session, and optionally verify the server's host key
and authenticate using a password or private key. This is a shortcut
for `start_client`, `get_remote_server_key`, and
`Transport.auth_password` or `Transport.auth_publickey`. Use those
methods if you want more contr... | [
"Negotiate",
"an",
"SSH2",
"session",
"and",
"optionally",
"verify",
"the",
"server",
"s",
"host",
"key",
"and",
"authenticate",
"using",
"a",
"password",
"or",
"private",
"key",
".",
"This",
"is",
"a",
"shortcut",
"for",
"start_client",
"get_remote_server_key",... | def connect(
self,
hostkey=None,
username="",
password=None,
pkey=None,
gss_host=None,
gss_auth=False,
gss_kex=False,
gss_deleg_creds=True,
gss_trust_dns=True,
):
"""
Negotiate an SSH2 session, and optionally verify the ... | [
"def",
"connect",
"(",
"self",
",",
"hostkey",
"=",
"None",
",",
"username",
"=",
"\"\"",
",",
"password",
"=",
"None",
",",
"pkey",
"=",
"None",
",",
"gss_host",
"=",
"None",
",",
"gss_auth",
"=",
"False",
",",
"gss_kex",
"=",
"False",
",",
"gss_del... | https://github.com/paramiko/paramiko/blob/88f35a537428e430f7f26eee8026715e357b55d6/paramiko/transport.py#L1266-L1392 | |
NVIDIA/flowtron | 701780103910522282336d9e014e59f345070145 | text/cleaners.py | python | transliteration_cleaners | (text) | return text | Pipeline for non-English text that transliterates to ASCII. | Pipeline for non-English text that transliterates to ASCII. | [
"Pipeline",
"for",
"non",
"-",
"English",
"text",
"that",
"transliterates",
"to",
"ASCII",
"."
] | def transliteration_cleaners(text):
'''Pipeline for non-English text that transliterates to ASCII.'''
text = convert_to_ascii(text)
text = lowercase(text)
text = collapse_whitespace(text)
return text | [
"def",
"transliteration_cleaners",
"(",
"text",
")",
":",
"text",
"=",
"convert_to_ascii",
"(",
"text",
")",
"text",
"=",
"lowercase",
"(",
"text",
")",
"text",
"=",
"collapse_whitespace",
"(",
"text",
")",
"return",
"text"
] | https://github.com/NVIDIA/flowtron/blob/701780103910522282336d9e014e59f345070145/text/cleaners.py#L106-L111 | |
dgilland/pydash | 24ad0e43b51b367d00447c45baa68c9c03ad1a52 | src/pydash/utilities.py | python | conforms | (source) | return _conforms | Creates a function that invokes the predicate properties of `source` with the corresponding
property values of a given object, returning ``True`` if all predicates return truthy, else
``False``.
Args:
source (dict|list): The object of property predicates to conform to.
Returns:
callabl... | Creates a function that invokes the predicate properties of `source` with the corresponding
property values of a given object, returning ``True`` if all predicates return truthy, else
``False``. | [
"Creates",
"a",
"function",
"that",
"invokes",
"the",
"predicate",
"properties",
"of",
"source",
"with",
"the",
"corresponding",
"property",
"values",
"of",
"a",
"given",
"object",
"returning",
"True",
"if",
"all",
"predicates",
"return",
"truthy",
"else",
"Fals... | def conforms(source):
"""
Creates a function that invokes the predicate properties of `source` with the corresponding
property values of a given object, returning ``True`` if all predicates return truthy, else
``False``.
Args:
source (dict|list): The object of property predicates to conform... | [
"def",
"conforms",
"(",
"source",
")",
":",
"def",
"_conforms",
"(",
"obj",
")",
":",
"for",
"key",
",",
"predicate",
"in",
"iterator",
"(",
"source",
")",
":",
"if",
"not",
"pyd",
".",
"has",
"(",
"obj",
",",
"key",
")",
"or",
"not",
"predicate",
... | https://github.com/dgilland/pydash/blob/24ad0e43b51b367d00447c45baa68c9c03ad1a52/src/pydash/utilities.py#L156-L190 | |
google/pytype | fa43edc95dd42ade6e3147d6580d63e778c9d506 | pytype/errors.py | python | ErrorLog.not_instantiable | (self, stack, cls) | Instantiating an abstract class. | Instantiating an abstract class. | [
"Instantiating",
"an",
"abstract",
"class",
"."
] | def not_instantiable(self, stack, cls):
"""Instantiating an abstract class."""
message = "Can't instantiate %s with abstract methods %s" % (
cls.full_name, ", ".join(sorted(cls.abstract_methods)))
self.error(stack, message) | [
"def",
"not_instantiable",
"(",
"self",
",",
"stack",
",",
"cls",
")",
":",
"message",
"=",
"\"Can't instantiate %s with abstract methods %s\"",
"%",
"(",
"cls",
".",
"full_name",
",",
"\", \"",
".",
"join",
"(",
"sorted",
"(",
"cls",
".",
"abstract_methods",
... | https://github.com/google/pytype/blob/fa43edc95dd42ade6e3147d6580d63e778c9d506/pytype/errors.py#L891-L895 | ||
fonttools/fonttools | 892322aaff6a89bea5927379ec06bc0da3dfb7df | Lib/fontTools/feaLib/ast.py | python | deviceToString | (device) | [] | def deviceToString(device):
if device is None:
return "<device NULL>"
else:
return "<device %s>" % ", ".join("%d %d" % t for t in device) | [
"def",
"deviceToString",
"(",
"device",
")",
":",
"if",
"device",
"is",
"None",
":",
"return",
"\"<device NULL>\"",
"else",
":",
"return",
"\"<device %s>\"",
"%",
"\", \"",
".",
"join",
"(",
"\"%d %d\"",
"%",
"t",
"for",
"t",
"in",
"device",
")"
] | https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/feaLib/ast.py#L80-L84 | ||||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/intesishome/climate.py | python | IntesisAC.target_temperature | (self) | return self._target_temp | Return the current setpoint temperature if unit is on. | Return the current setpoint temperature if unit is on. | [
"Return",
"the",
"current",
"setpoint",
"temperature",
"if",
"unit",
"is",
"on",
"."
] | def target_temperature(self):
"""Return the current setpoint temperature if unit is on."""
return self._target_temp | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_temp"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/intesishome/climate.py#L476-L478 | |
meetbill/zabbix_manager | 739e5b51facf19cc6bda2b50f29108f831cf833e | ZabbixTool/lib_zabbix/w_lib/zabbix_api_lib.py | python | ZabbixAPISubClass.do_request | (self, req) | return self.parent.do_request(req) | [] | def do_request(self, req):
return self.parent.do_request(req) | [
"def",
"do_request",
"(",
"self",
",",
"req",
")",
":",
"return",
"self",
".",
"parent",
".",
"do_request",
"(",
"req",
")"
] | https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/zabbix_api_lib.py#L339-L340 | |||
bashtage/linearmodels | 9256269f01ff8c5f85e65342d66149a5636661b6 | linearmodels/shared/utility.py | python | AttrDict.keys | (self) | return self.__private_dict__.keys() | Return an ordered list-like object providing a view on AD's keys | Return an ordered list-like object providing a view on AD's keys | [
"Return",
"an",
"ordered",
"list",
"-",
"like",
"object",
"providing",
"a",
"view",
"on",
"AD",
"s",
"keys"
] | def keys(self) -> AbstractSet[Any]:
"""Return an ordered list-like object providing a view on AD's keys"""
return self.__private_dict__.keys() | [
"def",
"keys",
"(",
"self",
")",
"->",
"AbstractSet",
"[",
"Any",
"]",
":",
"return",
"self",
".",
"__private_dict__",
".",
"keys",
"(",
")"
] | https://github.com/bashtage/linearmodels/blob/9256269f01ff8c5f85e65342d66149a5636661b6/linearmodels/shared/utility.py#L59-L61 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/concurrency/asynpool.py | python | AsynPool._on_soft_timeout | (self, job, soft, hard, hub) | [] | def _on_soft_timeout(self, job, soft, hard, hub):
# only used by async pool.
if hard:
self._tref_for_id[job] = hub.call_later(
hard - soft, self._on_hard_timeout, job,
)
try:
result = self._cache[job]
except KeyError:
pass ... | [
"def",
"_on_soft_timeout",
"(",
"self",
",",
"job",
",",
"soft",
",",
"hard",
",",
"hub",
")",
":",
"# only used by async pool.",
"if",
"hard",
":",
"self",
".",
"_tref_for_id",
"[",
"job",
"]",
"=",
"hub",
".",
"call_later",
"(",
"hard",
"-",
"soft",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/concurrency/asynpool.py#L514-L529 | ||||
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/sklearn/utils/validation.py | python | as_float_array | (X, copy=True, force_all_finite=True) | Converts an array-like to an array of floats
The new dtype will be np.float32 or np.float64, depending on the original
type. The function can create a copy or modify the argument depending
on the argument copy.
Parameters
----------
X : {array-like, sparse matrix}
copy : bool, optional
... | Converts an array-like to an array of floats | [
"Converts",
"an",
"array",
"-",
"like",
"to",
"an",
"array",
"of",
"floats"
] | def as_float_array(X, copy=True, force_all_finite=True):
"""Converts an array-like to an array of floats
The new dtype will be np.float32 or np.float64, depending on the original
type. The function can create a copy or modify the argument depending
on the argument copy.
Parameters
----------
... | [
"def",
"as_float_array",
"(",
"X",
",",
"copy",
"=",
"True",
",",
"force_all_finite",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"X",
",",
"np",
".",
"matrix",
")",
"or",
"(",
"not",
"isinstance",
"(",
"X",
",",
"np",
".",
"ndarray",
")",
"and... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/sklearn/utils/validation.py#L68-L101 | ||
SpamScope/spamscope | ffbfc53b9a3503ef3041cee94c6726c8b899118d | src/modules/bitmap/bitmap.py | python | BitMap.set_property_score | (self, *args) | Add to score the given properties. | Add to score the given properties. | [
"Add",
"to",
"score",
"the",
"given",
"properties",
"."
] | def set_property_score(self, *args):
"""Add to score the given properties. """
for p in args:
if p not in self.bitmap:
raise PropertyDoesNotExists(
"Property {!r} does not exists".format(p))
value = self.bitmap.get(p)
# New score... | [
"def",
"set_property_score",
"(",
"self",
",",
"*",
"args",
")",
":",
"for",
"p",
"in",
"args",
":",
"if",
"p",
"not",
"in",
"self",
".",
"bitmap",
":",
"raise",
"PropertyDoesNotExists",
"(",
"\"Property {!r} does not exists\"",
".",
"format",
"(",
"p",
")... | https://github.com/SpamScope/spamscope/blob/ffbfc53b9a3503ef3041cee94c6726c8b899118d/src/modules/bitmap/bitmap.py#L111-L122 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/oceanus/v20190422/models.py | python | CreateJobRequest.__init__ | (self) | r"""
:param Name: 作业名称,允许输入长度小于等于50个字符的中文、英文、数字、-(横线)、_(下划线)、.(点),且符号必须半角字符。注意作业名不能和现有作业同名
:type Name: str
:param JobType: 作业的类型,1 表示 SQL 作业,2 表示 JAR 作业
:type JobType: int
:param ClusterType: 集群的类型,1 表示共享集群,2 表示独享集群
:type ClusterType: int
:param ClusterId: 当 Clust... | r"""
:param Name: 作业名称,允许输入长度小于等于50个字符的中文、英文、数字、-(横线)、_(下划线)、.(点),且符号必须半角字符。注意作业名不能和现有作业同名
:type Name: str
:param JobType: 作业的类型,1 表示 SQL 作业,2 表示 JAR 作业
:type JobType: int
:param ClusterType: 集群的类型,1 表示共享集群,2 表示独享集群
:type ClusterType: int
:param ClusterId: 当 Clust... | [
"r",
":",
"param",
"Name",
":",
"作业名称,允许输入长度小于等于50个字符的中文、英文、数字、",
"-",
"(横线)、_(下划线)、",
".",
"(点),且符号必须半角字符。注意作业名不能和现有作业同名",
":",
"type",
"Name",
":",
"str",
":",
"param",
"JobType",
":",
"作业的类型,1",
"表示",
"SQL",
"作业,2",
"表示",
"JAR",
"作业",
":",
"type",
"JobType"... | def __init__(self):
r"""
:param Name: 作业名称,允许输入长度小于等于50个字符的中文、英文、数字、-(横线)、_(下划线)、.(点),且符号必须半角字符。注意作业名不能和现有作业同名
:type Name: str
:param JobType: 作业的类型,1 表示 SQL 作业,2 表示 JAR 作业
:type JobType: int
:param ClusterType: 集群的类型,1 表示共享集群,2 表示独享集群
:type ClusterType: int
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Name",
"=",
"None",
"self",
".",
"JobType",
"=",
"None",
"self",
".",
"ClusterType",
"=",
"None",
"self",
".",
"ClusterId",
"=",
"None",
"self",
".",
"CuMem",
"=",
"None",
"self",
".",
"Remark",... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/oceanus/v20190422/models.py#L133-L159 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/mhlib.py | python | Folder.getcurrent | (self) | Return the current message. Raise Error when there is none. | Return the current message. Raise Error when there is none. | [
"Return",
"the",
"current",
"message",
".",
"Raise",
"Error",
"when",
"there",
"is",
"none",
"."
] | def getcurrent(self):
"""Return the current message. Raise Error when there is none."""
seqs = self.getsequences()
try:
return max(seqs['cur'])
except (ValueError, KeyError):
raise Error, "no cur message" | [
"def",
"getcurrent",
"(",
"self",
")",
":",
"seqs",
"=",
"self",
".",
"getsequences",
"(",
")",
"try",
":",
"return",
"max",
"(",
"seqs",
"[",
"'cur'",
"]",
")",
"except",
"(",
"ValueError",
",",
"KeyError",
")",
":",
"raise",
"Error",
",",
"\"no cur... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/mhlib.py#L334-L340 | ||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/KEGG/KGML/KGML_pathway.py | python | Reaction.entry | (self) | return self._pathway.entries[self._id] | Return the Entry corresponding to this reaction. | Return the Entry corresponding to this reaction. | [
"Return",
"the",
"Entry",
"corresponding",
"to",
"this",
"reaction",
"."
] | def entry(self):
"""Return the Entry corresponding to this reaction."""
return self._pathway.entries[self._id] | [
"def",
"entry",
"(",
"self",
")",
":",
"return",
"self",
".",
"_pathway",
".",
"entries",
"[",
"self",
".",
"_id",
"]"
] | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/KEGG/KGML/KGML_pathway.py#L748-L750 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/smtpd.py | python | SMTPChannel.__conn | (self) | return self.conn | [] | def __conn(self):
warn("Access to __conn attribute on SMTPChannel is deprecated, "
"use 'conn' instead", DeprecationWarning, 2)
return self.conn | [
"def",
"__conn",
"(",
"self",
")",
":",
"warn",
"(",
"\"Access to __conn attribute on SMTPChannel is deprecated, \"",
"\"use 'conn' instead\"",
",",
"DeprecationWarning",
",",
"2",
")",
"return",
"self",
".",
"conn"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/smtpd.py#L289-L292 | |||
cea-hpc/clustershell | c421133ed4baa69e35ff76c476d4097201485344 | lib/ClusterShell/Task.py | python | Task.info | (self, info_key, def_val=None) | return self._info.get(info_key, def_val) | Return per-task information. See set_info() for a list of
reserved task info_keys. | Return per-task information. See set_info() for a list of
reserved task info_keys. | [
"Return",
"per",
"-",
"task",
"information",
".",
"See",
"set_info",
"()",
"for",
"a",
"list",
"of",
"reserved",
"task",
"info_keys",
"."
] | def info(self, info_key, def_val=None):
"""
Return per-task information. See set_info() for a list of
reserved task info_keys.
"""
return self._info.get(info_key, def_val) | [
"def",
"info",
"(",
"self",
",",
"info_key",
",",
"def_val",
"=",
"None",
")",
":",
"return",
"self",
".",
"_info",
".",
"get",
"(",
"info_key",
",",
"def_val",
")"
] | https://github.com/cea-hpc/clustershell/blob/c421133ed4baa69e35ff76c476d4097201485344/lib/ClusterShell/Task.py#L480-L485 | |
frescobaldi/frescobaldi | 301cc977fc4ba7caa3df9e4bf905212ad5d06912 | frescobaldi_app/autocomplete/harvest.py | python | schemewords | (document) | Harvests all schemewords from the document. | Harvests all schemewords from the document. | [
"Harvests",
"all",
"schemewords",
"from",
"the",
"document",
"."
] | def schemewords(document):
"""Harvests all schemewords from the document."""
for t in tokeniter.all_tokens(document):
if type(t) is ly.lex.scheme.Word:
yield t | [
"def",
"schemewords",
"(",
"document",
")",
":",
"for",
"t",
"in",
"tokeniter",
".",
"all_tokens",
"(",
"document",
")",
":",
"if",
"type",
"(",
"t",
")",
"is",
"ly",
".",
"lex",
".",
"scheme",
".",
"Word",
":",
"yield",
"t"
] | https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/autocomplete/harvest.py#L51-L55 | ||
mukund109/word-mesh | 2be945d988d661bd51afa6bd646f944c9c5d202a | wordmesh/static_wordmesh.py | python | Wordmesh.set_fontcolor | (self, by='scores', colorscale='YlOrRd',
custom_colors=None) | This function can be used to pick a metric which decides the font color
for each extracted keyword. By default, the font color is assigned
based on the score of each keyword.
Fonts can be picked by: 'random', 'scores', 'pos_tag', 'clustering_criteria'
You can also choo... | This function can be used to pick a metric which decides the font color
for each extracted keyword. By default, the font color is assigned
based on the score of each keyword.
Fonts can be picked by: 'random', 'scores', 'pos_tag', 'clustering_criteria'
You can also choo... | [
"This",
"function",
"can",
"be",
"used",
"to",
"pick",
"a",
"metric",
"which",
"decides",
"the",
"font",
"color",
"for",
"each",
"extracted",
"keyword",
".",
"By",
"default",
"the",
"font",
"color",
"is",
"assigned",
"based",
"on",
"the",
"score",
"of",
... | def set_fontcolor(self, by='scores', colorscale='YlOrRd',
custom_colors=None):
"""
This function can be used to pick a metric which decides the font color
for each extracted keyword. By default, the font color is assigned
based on the score of each keyword.
... | [
"def",
"set_fontcolor",
"(",
"self",
",",
"by",
"=",
"'scores'",
",",
"colorscale",
"=",
"'YlOrRd'",
",",
"custom_colors",
"=",
"None",
")",
":",
"if",
"custom_colors",
"is",
"not",
"None",
":",
"assert",
"len",
"(",
"custom_colors",
")",
"==",
"len",
"(... | https://github.com/mukund109/word-mesh/blob/2be945d988d661bd51afa6bd646f944c9c5d202a/wordmesh/static_wordmesh.py#L260-L341 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/sets.py | python | Set.__isub__ | (self, other) | return self | Remove all elements of another set from this set. | Remove all elements of another set from this set. | [
"Remove",
"all",
"elements",
"of",
"another",
"set",
"from",
"this",
"set",
"."
] | def __isub__(self, other):
"""Remove all elements of another set from this set."""
self._binary_sanity_check(other)
self.difference_update(other)
return self | [
"def",
"__isub__",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"_binary_sanity_check",
"(",
"other",
")",
"self",
".",
"difference_update",
"(",
"other",
")",
"return",
"self"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/sets.py#L471-L475 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/arrays/base.py | python | ExtensionArray._from_sequence | (cls, scalars, dtype=None, copy=False) | Construct a new ExtensionArray from a sequence of scalars.
Parameters
----------
scalars : Sequence
Each element will be an instance of the scalar type for this
array, ``cls.dtype.type``.
dtype : dtype, optional
Construct for this particular dtype. Th... | Construct a new ExtensionArray from a sequence of scalars. | [
"Construct",
"a",
"new",
"ExtensionArray",
"from",
"a",
"sequence",
"of",
"scalars",
"."
] | def _from_sequence(cls, scalars, dtype=None, copy=False):
"""
Construct a new ExtensionArray from a sequence of scalars.
Parameters
----------
scalars : Sequence
Each element will be an instance of the scalar type for this
array, ``cls.dtype.type``.
... | [
"def",
"_from_sequence",
"(",
"cls",
",",
"scalars",
",",
"dtype",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"raise",
"AbstractMethodError",
"(",
"cls",
")"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/arrays/base.py#L115-L134 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cherrypy/_cpreqbody.py | python | Entity.__next__ | (self) | return line | [] | def __next__(self):
line = self.readline()
if not line:
raise StopIteration
return line | [
"def",
"__next__",
"(",
"self",
")",
":",
"line",
"=",
"self",
".",
"readline",
"(",
")",
"if",
"not",
"line",
":",
"raise",
"StopIteration",
"return",
"line"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cherrypy/_cpreqbody.py#L489-L493 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/requests/models.py | python | Response.text | (self) | return content | Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
non-HTTP knowledge to m... | Content of the response, in unicode. | [
"Content",
"of",
"the",
"response",
"in",
"unicode",
"."
] | def text(self):
"""Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
... | [
"def",
"text",
"(",
"self",
")",
":",
"# Try charset from content-type",
"content",
"=",
"None",
"encoding",
"=",
"self",
".",
"encoding",
"if",
"not",
"self",
".",
"content",
":",
"return",
"str",
"(",
"''",
")",
"# Fallback to auto-detected encoding.",
"if",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/requests/models.py#L831-L866 | |
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/http/site.py | python | SynapseRequest._should_log_request | (self) | return True | Whether we should log at INFO that we processed the request. | Whether we should log at INFO that we processed the request. | [
"Whether",
"we",
"should",
"log",
"at",
"INFO",
"that",
"we",
"processed",
"the",
"request",
"."
] | def _should_log_request(self) -> bool:
"""Whether we should log at INFO that we processed the request."""
if self.path == b"/health":
return False
if self.method == b"OPTIONS":
return False
return True | [
"def",
"_should_log_request",
"(",
"self",
")",
"->",
"bool",
":",
"if",
"self",
".",
"path",
"==",
"b\"/health\"",
":",
"return",
"False",
"if",
"self",
".",
"method",
"==",
"b\"OPTIONS\"",
":",
"return",
"False",
"return",
"True"
] | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/http/site.py#L457-L465 | |
ktbyers/netmiko | 4c3732346eea1a4a608abd9e09d65eeb2f577810 | netmiko/utilities.py | python | obtain_all_devices | (
my_devices: Dict[str, Union[List[str], Dict[str, Any]]]
) | return new_devices | Dynamically create 'all' group. | Dynamically create 'all' group. | [
"Dynamically",
"create",
"all",
"group",
"."
] | def obtain_all_devices(
my_devices: Dict[str, Union[List[str], Dict[str, Any]]]
) -> Dict[str, Dict[str, Any]]:
"""Dynamically create 'all' group."""
new_devices = {}
for device_name, device_or_group in my_devices.items():
# Skip any groups
if not isinstance(device_or_group, list):
... | [
"def",
"obtain_all_devices",
"(",
"my_devices",
":",
"Dict",
"[",
"str",
",",
"Union",
"[",
"List",
"[",
"str",
"]",
",",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]... | https://github.com/ktbyers/netmiko/blob/4c3732346eea1a4a608abd9e09d65eeb2f577810/netmiko/utilities.py#L180-L189 | |
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V1.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/lockfile/pidlockfile.py | python | PIDLockFile.break_lock | (self) | Break an existing lock.
Removes the PID file if it already exists, otherwise does
nothing. | Break an existing lock. | [
"Break",
"an",
"existing",
"lock",
"."
] | def break_lock(self):
""" Break an existing lock.
Removes the PID file if it already exists, otherwise does
nothing.
"""
remove_existing_pidfile(self.path) | [
"def",
"break_lock",
"(",
"self",
")",
":",
"remove_existing_pidfile",
"(",
"self",
".",
"path",
")"
] | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V1.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/lockfile/pidlockfile.py#L108-L115 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/PIL/ImageFont.py | python | FreeTypeFont.getsize | (self, text, direction=None, features=None) | return (size[0] + offset[0], size[1] + offset[1]) | [] | def getsize(self, text, direction=None, features=None):
size, offset = self.font.getsize(text, direction, features)
return (size[0] + offset[0], size[1] + offset[1]) | [
"def",
"getsize",
"(",
"self",
",",
"text",
",",
"direction",
"=",
"None",
",",
"features",
"=",
"None",
")",
":",
"size",
",",
"offset",
"=",
"self",
".",
"font",
".",
"getsize",
"(",
"text",
",",
"direction",
",",
"features",
")",
"return",
"(",
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/PIL/ImageFont.py#L160-L162 | |||
google-research/task_adaptation | d7630d3c43ba052b5a35546b312d9454a9f2c96b | task_adaptation/data/kitti.py | python | _closest_object_distance_pp | (x) | return {"image": x["image"], "label": label} | Predict the distance to the closest object. | Predict the distance to the closest object. | [
"Predict",
"the",
"distance",
"to",
"the",
"closest",
"object",
"."
] | def _closest_object_distance_pp(x):
"""Predict the distance to the closest object."""
# Label distribution:
# Location feature contains (x, y, z) in meters w.r.t. the camera.
dist = tf.reduce_min(x["objects"]["location"][:, 2])
thrs = np.array([-100, 5.6, 8.4, 13.4, 23.4])
label = tf.reduce_max(tf.where((t... | [
"def",
"_closest_object_distance_pp",
"(",
"x",
")",
":",
"# Label distribution:",
"# Location feature contains (x, y, z) in meters w.r.t. the camera.",
"dist",
"=",
"tf",
".",
"reduce_min",
"(",
"x",
"[",
"\"objects\"",
"]",
"[",
"\"location\"",
"]",
"[",
":",
",",
"... | https://github.com/google-research/task_adaptation/blob/d7630d3c43ba052b5a35546b312d9454a9f2c96b/task_adaptation/data/kitti.py#L79-L87 | |
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/layout.py | python | LayoutScore.getSystemBeforeThis | (self, pageId, systemId) | given a pageId and systemId, get the (pageId, systemId) for the previous system.
return (None, None) if it's the first system on the first page
This test score has five systems on the first page,
three on the second, and two on the third
>>> lt = corpus.parse('demos/layoutTestMore.xml... | given a pageId and systemId, get the (pageId, systemId) for the previous system. | [
"given",
"a",
"pageId",
"and",
"systemId",
"get",
"the",
"(",
"pageId",
"systemId",
")",
"for",
"the",
"previous",
"system",
"."
] | def getSystemBeforeThis(self, pageId, systemId):
# noinspection PyShadowingNames
'''
given a pageId and systemId, get the (pageId, systemId) for the previous system.
return (None, None) if it's the first system on the first page
This test score has five systems on the first pag... | [
"def",
"getSystemBeforeThis",
"(",
"self",
",",
"pageId",
",",
"systemId",
")",
":",
"# noinspection PyShadowingNames",
"if",
"systemId",
">",
"0",
":",
"return",
"pageId",
",",
"systemId",
"-",
"1",
"else",
":",
"if",
"pageId",
"==",
"0",
":",
"return",
"... | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/layout.py#L1320-L1346 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cvm/v20170312/models.py | python | Image.__init__ | (self) | r"""
:param ImageId: 镜像ID
:type ImageId: str
:param OsName: 镜像操作系统
:type OsName: str
:param ImageType: 镜像类型
:type ImageType: str
:param CreatedTime: 镜像创建时间
:type CreatedTime: str
:param ImageName: 镜像名称
:type ImageName: str
:param Im... | r"""
:param ImageId: 镜像ID
:type ImageId: str
:param OsName: 镜像操作系统
:type OsName: str
:param ImageType: 镜像类型
:type ImageType: str
:param CreatedTime: 镜像创建时间
:type CreatedTime: str
:param ImageName: 镜像名称
:type ImageName: str
:param Im... | [
"r",
":",
"param",
"ImageId",
":",
"镜像ID",
":",
"type",
"ImageId",
":",
"str",
":",
"param",
"OsName",
":",
"镜像操作系统",
":",
"type",
"OsName",
":",
"str",
":",
"param",
"ImageType",
":",
"镜像类型",
":",
"type",
"ImageType",
":",
"str",
":",
"param",
"Crea... | def __init__(self):
r"""
:param ImageId: 镜像ID
:type ImageId: str
:param OsName: 镜像操作系统
:type OsName: str
:param ImageType: 镜像类型
:type ImageType: str
:param CreatedTime: 镜像创建时间
:type CreatedTime: str
:param ImageName: 镜像名称
:type Imag... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ImageId",
"=",
"None",
"self",
".",
"OsName",
"=",
"None",
"self",
".",
"ImageType",
"=",
"None",
"self",
".",
"CreatedTime",
"=",
"None",
"self",
".",
"ImageName",
"=",
"None",
"self",
".",
"Im... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cvm/v20170312/models.py#L3186-L3243 | ||
wagtail/wagtail | ba8207a5d82c8a1de8f5f9693a7cd07421762999 | wagtail/admin/widgets/chooser.py | python | AdminPageChooser._get_lowest_common_page_class | (self) | Return a Page class that is an ancestor for all Page classes in
``target_models``, and is also a concrete Page class itself. | Return a Page class that is an ancestor for all Page classes in
``target_models``, and is also a concrete Page class itself. | [
"Return",
"a",
"Page",
"class",
"that",
"is",
"an",
"ancestor",
"for",
"all",
"Page",
"classes",
"in",
"target_models",
"and",
"is",
"also",
"a",
"concrete",
"Page",
"class",
"itself",
"."
] | def _get_lowest_common_page_class(self):
"""
Return a Page class that is an ancestor for all Page classes in
``target_models``, and is also a concrete Page class itself.
"""
if len(self.target_models) == 1:
# Shortcut for a single page type
return self.tar... | [
"def",
"_get_lowest_common_page_class",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"target_models",
")",
"==",
"1",
":",
"# Shortcut for a single page type",
"return",
"self",
".",
"target_models",
"[",
"0",
"]",
"else",
":",
"return",
"Page"
] | https://github.com/wagtail/wagtail/blob/ba8207a5d82c8a1de8f5f9693a7cd07421762999/wagtail/admin/widgets/chooser.py#L94-L103 | ||
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/lib2to3/refactor.py | python | _get_headnode_dict | (fixer_list) | return dict(head_nodes) | Accepts a list of fixers and returns a dictionary
of head node type --> fixer list. | Accepts a list of fixers and returns a dictionary
of head node type --> fixer list. | [
"Accepts",
"a",
"list",
"of",
"fixers",
"and",
"returns",
"a",
"dictionary",
"of",
"head",
"node",
"type",
"--",
">",
"fixer",
"list",
"."
] | def _get_headnode_dict(fixer_list):
""" Accepts a list of fixers and returns a dictionary
of head node type --> fixer list. """
head_nodes = collections.defaultdict(list)
every = []
for fixer in fixer_list:
if fixer.pattern:
try:
heads = _get_head_types(fixer... | [
"def",
"_get_headnode_dict",
"(",
"fixer_list",
")",
":",
"head_nodes",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"every",
"=",
"[",
"]",
"for",
"fixer",
"in",
"fixer_list",
":",
"if",
"fixer",
".",
"pattern",
":",
"try",
":",
"heads",
"=... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/lib2to3/refactor.py#L78-L100 | |
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/storage/databases/main/profile.py | python | ProfileWorkerStore.is_subscribed_remote_profile_for_user | (self, user_id: str) | return False | Check whether we are interested in a remote user's profile. | Check whether we are interested in a remote user's profile. | [
"Check",
"whether",
"we",
"are",
"interested",
"in",
"a",
"remote",
"user",
"s",
"profile",
"."
] | async def is_subscribed_remote_profile_for_user(self, user_id: str) -> bool:
"""Check whether we are interested in a remote user's profile."""
res: Optional[str] = await self.db_pool.simple_select_one_onecol(
table="group_users",
keyvalues={"user_id": user_id},
retcol... | [
"async",
"def",
"is_subscribed_remote_profile_for_user",
"(",
"self",
",",
"user_id",
":",
"str",
")",
"->",
"bool",
":",
"res",
":",
"Optional",
"[",
"str",
"]",
"=",
"await",
"self",
".",
"db_pool",
".",
"simple_select_one_onecol",
"(",
"table",
"=",
"\"gr... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/storage/databases/main/profile.py#L120-L143 | |
mike01/pypacker | 7e98b2cb00c465f726490580761ad6261302b6a6 | pypacker/utils.py | python | get_wlan_mode | (iface) | return _MODE_STR_INT_TRANSLATE.get(found_str, WLAN_MODE_UNKNOWN) | return -- [MODE_MANAGED | MODE_MONITOR | MODE_UNKNOWN] | return -- [MODE_MANAGED | MODE_MONITOR | MODE_UNKNOWN] | [
"return",
"--",
"[",
"MODE_MANAGED",
"|",
"MODE_MONITOR",
"|",
"MODE_UNKNOWN",
"]"
] | def get_wlan_mode(iface):
"""
return -- [MODE_MANAGED | MODE_MONITOR | MODE_UNKNOWN]
"""
cmd_call = ["iwconfig", iface]
output = subprocess.check_output(cmd_call)
match = PATTERN_MODE.search(output)
found_str = match.group(1).lower()
return _MODE_STR_INT_TRANSLATE.get(found_str, WLAN_MODE_UNKNOWN) | [
"def",
"get_wlan_mode",
"(",
"iface",
")",
":",
"cmd_call",
"=",
"[",
"\"iwconfig\"",
",",
"iface",
"]",
"output",
"=",
"subprocess",
".",
"check_output",
"(",
"cmd_call",
")",
"match",
"=",
"PATTERN_MODE",
".",
"search",
"(",
"output",
")",
"found_str",
"... | https://github.com/mike01/pypacker/blob/7e98b2cb00c465f726490580761ad6261302b6a6/pypacker/utils.py#L52-L61 | |
hasanirtiza/Pedestron | 3bdcf8476edc0741f28a80dd4cb161ac532507ee | tools/crowdhuman/coco.py | python | COCO.loadRes | (self, resFile) | return res | Load result file and return a result api object.
:param resFile (str) : file name of result file
:return: res (obj) : result api object | Load result file and return a result api object.
:param resFile (str) : file name of result file
:return: res (obj) : result api object | [
"Load",
"result",
"file",
"and",
"return",
"a",
"result",
"api",
"object",
".",
":",
"param",
"resFile",
"(",
"str",
")",
":",
"file",
"name",
"of",
"result",
"file",
":",
"return",
":",
"res",
"(",
"obj",
")",
":",
"result",
"api",
"object"
] | def loadRes(self, resFile):
"""
Load result file and return a result api object.
:param resFile (str) : file name of result file
:return: res (obj) : result api object
"""
res = COCO()
res.dataset['images'] = [img for img in self.dataset['images']]
... | [
"def",
"loadRes",
"(",
"self",
",",
"resFile",
")",
":",
"res",
"=",
"COCO",
"(",
")",
"res",
".",
"dataset",
"[",
"'images'",
"]",
"=",
"[",
"img",
"for",
"img",
"in",
"self",
".",
"dataset",
"[",
"'images'",
"]",
"]",
"# print('Loading and preparing ... | https://github.com/hasanirtiza/Pedestron/blob/3bdcf8476edc0741f28a80dd4cb161ac532507ee/tools/crowdhuman/coco.py#L292-L354 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py | python | PyOpenSSLContext.set_ciphers | (self, ciphers) | [] | def set_ciphers(self, ciphers):
if isinstance(ciphers, six.text_type):
ciphers = ciphers.encode('utf-8')
self._ctx.set_cipher_list(ciphers) | [
"def",
"set_ciphers",
"(",
"self",
",",
"ciphers",
")",
":",
"if",
"isinstance",
"(",
"ciphers",
",",
"six",
".",
"text_type",
")",
":",
"ciphers",
"=",
"ciphers",
".",
"encode",
"(",
"'utf-8'",
")",
"self",
".",
"_ctx",
".",
"set_cipher_list",
"(",
"c... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py#L406-L409 | ||||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/contrib/gis/geos/mutable_list.py | python | ListMixin.sort | (self, cmp=cmp, key=None, reverse=False) | Standard list sort method | Standard list sort method | [
"Standard",
"list",
"sort",
"method"
] | def sort(self, cmp=cmp, key=None, reverse=False):
"Standard list sort method"
if key:
temp = [(key(v),v) for v in self]
temp.sort(cmp=cmp, key=lambda x: x[0], reverse=reverse)
self[:] = [v[1] for v in temp]
else:
temp = list(self)
temp.... | [
"def",
"sort",
"(",
"self",
",",
"cmp",
"=",
"cmp",
",",
"key",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"if",
"key",
":",
"temp",
"=",
"[",
"(",
"key",
"(",
"v",
")",
",",
"v",
")",
"for",
"v",
"in",
"self",
"]",
"temp",
".",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/contrib/gis/geos/mutable_list.py#L205-L214 | ||
ladybug-tools/honeybee-legacy | bd62af4862fe022801fb87dbc8794fdf1dff73a9 | src/Honeybee_Generate Average Sky.py | python | getAverageRadiationValues | (epw_file, month, hour) | return avrDirRad, avrDifRad | [] | def getAverageRadiationValues(epw_file, month, hour):
numberOfDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
dirRadCollection =[]
difRadCollection =[]
studyHours = []
for day in range(1, numberOfDays[month-1]):
studyHours.append(date2Hour(month, day, hour))
epwfile = open(... | [
"def",
"getAverageRadiationValues",
"(",
"epw_file",
",",
"month",
",",
"hour",
")",
":",
"numberOfDays",
"=",
"[",
"31",
",",
"28",
",",
"31",
",",
"30",
",",
"31",
",",
"30",
",",
"31",
",",
"31",
",",
"30",
",",
"31",
",",
"30",
",",
"31",
"... | https://github.com/ladybug-tools/honeybee-legacy/blob/bd62af4862fe022801fb87dbc8794fdf1dff73a9/src/Honeybee_Generate Average Sky.py#L65-L84 | |||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/mimetypes.py | python | MimeTypes.guess_type | (self, url, strict=True) | Guess the type of a file based on its URL.
Return value is a tuple (type, encoding) where type is None if
the type can't be guessed (no or unknown suffix) or a string
of the form type/subtype, usable for a MIME Content-type
header; and encoding is None for no encoding or the name of
... | Guess the type of a file based on its URL. | [
"Guess",
"the",
"type",
"of",
"a",
"file",
"based",
"on",
"its",
"URL",
"."
] | def guess_type(self, url, strict=True):
"""Guess the type of a file based on its URL.
Return value is a tuple (type, encoding) where type is None if
the type can't be guessed (no or unknown suffix) or a string
of the form type/subtype, usable for a MIME Content-type
header; and ... | [
"def",
"guess_type",
"(",
"self",
",",
"url",
",",
"strict",
"=",
"True",
")",
":",
"scheme",
",",
"url",
"=",
"urllib",
".",
"splittype",
"(",
"url",
")",
"if",
"scheme",
"==",
"'data'",
":",
"# syntax of data URLs:",
"# dataurl := \"data:\" [ mediatype ] [... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/mimetypes.py#L95-L155 | ||
nilearn/nilearn | 9edba4471747efacf21260bf470a346307f52706 | nilearn/externals/tempita/__init__.py | python | _Empty.__call__ | (self, *args, **kw) | return self | [] | def __call__(self, *args, **kw):
return self | [
"def",
"__call__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self"
] | https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/externals/tempita/__init__.py#L623-L624 | |||
UsergeTeam/Userge | aa0cb4b452d2887321170a52f99f8eb88d33fada | userge/plugins/utils/welcome.py | python | dowel | (msg: Message) | enable welcome message | enable welcome message | [
"enable",
"welcome",
"message"
] | async def dowel(msg: Message):
""" enable welcome message """
await raw_do(msg, 'Welcome', WELCOME_COLLECTION, WELCOME_CHATS) | [
"async",
"def",
"dowel",
"(",
"msg",
":",
"Message",
")",
":",
"await",
"raw_do",
"(",
"msg",
",",
"'Welcome'",
",",
"WELCOME_COLLECTION",
",",
"WELCOME_CHATS",
")"
] | https://github.com/UsergeTeam/Userge/blob/aa0cb4b452d2887321170a52f99f8eb88d33fada/userge/plugins/utils/welcome.py#L103-L105 | ||
apigee/henchman | 13c53c66669800aaa89f1799ac974b45ec473c3d | modules/curl/curl/requests/requests/packages/urllib3/__init__.py | python | disable_warnings | (category=exceptions.HTTPWarning) | Helper for quickly disabling all urllib3 warnings. | Helper for quickly disabling all urllib3 warnings. | [
"Helper",
"for",
"quickly",
"disabling",
"all",
"urllib3",
"warnings",
"."
] | def disable_warnings(category=exceptions.HTTPWarning):
"""
Helper for quickly disabling all urllib3 warnings.
"""
warnings.simplefilter('ignore', category) | [
"def",
"disable_warnings",
"(",
"category",
"=",
"exceptions",
".",
"HTTPWarning",
")",
":",
"warnings",
".",
"simplefilter",
"(",
"'ignore'",
",",
"category",
")"
] | https://github.com/apigee/henchman/blob/13c53c66669800aaa89f1799ac974b45ec473c3d/modules/curl/curl/requests/requests/packages/urllib3/__init__.py#L67-L71 | ||
fuzzbunch/fuzzbunch | 4b60a6c7cf9f84cf389d3fcdb9281de84ffb5802 | fuzzbunch/pyreadline/console/ironpython_console.py | python | Console.getkeypress | (self) | Return next key press event from the queue, ignoring others. | Return next key press event from the queue, ignoring others. | [
"Return",
"next",
"key",
"press",
"event",
"from",
"the",
"queue",
"ignoring",
"others",
"."
] | def getkeypress(self):
'''Return next key press event from the queue, ignoring others.'''
ck=System.ConsoleKey
while 1:
e = System.Console.ReadKey(True)
if e.Key == System.ConsoleKey.PageDown: #PageDown
self.scroll_window(12)
elif e.Key == Syst... | [
"def",
"getkeypress",
"(",
"self",
")",
":",
"ck",
"=",
"System",
".",
"ConsoleKey",
"while",
"1",
":",
"e",
"=",
"System",
".",
"Console",
".",
"ReadKey",
"(",
"True",
")",
"if",
"e",
".",
"Key",
"==",
"System",
".",
"ConsoleKey",
".",
"PageDown",
... | https://github.com/fuzzbunch/fuzzbunch/blob/4b60a6c7cf9f84cf389d3fcdb9281de84ffb5802/fuzzbunch/pyreadline/console/ironpython_console.py#L304-L318 | ||
SurrealAI/surreal | ae9e5f43bdd7d1bc6d39d0a4783b96b2c117fade | surreal/learner/ppo.py | python | PPOLearner._clip_loss | (self, obs, actions, advantages, behave_pol) | return clip_loss, stats | Computes the loss with current data. also returns a dictionary of statistics
which includes surrogate loss, clipped surrogate los, policy entropy, clip
constant
return: surreal.utils.pytorch.GPUVariable, dict
Args:
obs: batch of observations in form of (batch_size, obs_dim)
... | Computes the loss with current data. also returns a dictionary of statistics
which includes surrogate loss, clipped surrogate los, policy entropy, clip
constant
return: surreal.utils.pytorch.GPUVariable, dict
Args:
obs: batch of observations in form of (batch_size, obs_dim)
... | [
"Computes",
"the",
"loss",
"with",
"current",
"data",
".",
"also",
"returns",
"a",
"dictionary",
"of",
"statistics",
"which",
"includes",
"surrogate",
"loss",
"clipped",
"surrogate",
"los",
"policy",
"entropy",
"clip",
"constant",
"return",
":",
"surreal",
".",
... | def _clip_loss(self, obs, actions, advantages, behave_pol):
"""
Computes the loss with current data. also returns a dictionary of statistics
which includes surrogate loss, clipped surrogate los, policy entropy, clip
constant
return: surreal.utils.pytorch.GPUVariable, dict
... | [
"def",
"_clip_loss",
"(",
"self",
",",
"obs",
",",
"actions",
",",
"advantages",
",",
"behave_pol",
")",
":",
"learn_pol",
"=",
"self",
".",
"model",
".",
"forward_actor",
"(",
"obs",
",",
"self",
".",
"cells",
")",
"learn_prob",
"=",
"self",
".",
"pd"... | https://github.com/SurrealAI/surreal/blob/ae9e5f43bdd7d1bc6d39d0a4783b96b2c117fade/surreal/learner/ppo.py#L194-L225 | |
dabeaz/ply | 559a7a1feabb0853be79d4f4dd9e9e9e5ea0d08c | example/ansic/cparse.py | python | p_direct_abstract_declarator_5 | (t) | direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN | direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN | [
"direct_abstract_declarator",
":",
"LPAREN",
"parameter_type_list_opt",
"RPAREN"
] | def p_direct_abstract_declarator_5(t):
'direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN'
pass | [
"def",
"p_direct_abstract_declarator_5",
"(",
"t",
")",
":",
"pass"
] | https://github.com/dabeaz/ply/blob/559a7a1feabb0853be79d4f4dd9e9e9e5ea0d08c/example/ansic/cparse.py#L524-L526 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/webob-1.1.1/webob/response.py | python | _request_uri | (environ) | return url | Like wsgiref.url.request_uri, except eliminates :80 ports
Return the full request URI | Like wsgiref.url.request_uri, except eliminates :80 ports | [
"Like",
"wsgiref",
".",
"url",
".",
"request_uri",
"except",
"eliminates",
":",
"80",
"ports"
] | def _request_uri(environ):
"""Like wsgiref.url.request_uri, except eliminates :80 ports
Return the full request URI"""
url = environ['wsgi.url_scheme']+'://'
from urllib import quote
if environ.get('HTTP_HOST'):
url += environ['HTTP_HOST']
else:
url += environ['SERVER_NAME'] + ... | [
"def",
"_request_uri",
"(",
"environ",
")",
":",
"url",
"=",
"environ",
"[",
"'wsgi.url_scheme'",
"]",
"+",
"'://'",
"from",
"urllib",
"import",
"quote",
"if",
"environ",
".",
"get",
"(",
"'HTTP_HOST'",
")",
":",
"url",
"+=",
"environ",
"[",
"'HTTP_HOST'",... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/webob-1.1.1/webob/response.py#L1148-L1171 | |
open-io/oio-sds | 16041950b6056a55d5ce7ca77795defe6dfa6c61 | oio/directory/admin.py | python | AdminClient.has_base | (self, params, **kwargs) | return body | Ask each peer if base exists. | Ask each peer if base exists. | [
"Ask",
"each",
"peer",
"if",
"base",
"exists",
"."
] | def has_base(self, params, **kwargs):
"""
Ask each peer if base exists.
"""
_, body = self._request('POST', '/has', params=params, **kwargs)
return body | [
"def",
"has_base",
"(",
"self",
",",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"_",
",",
"body",
"=",
"self",
".",
"_request",
"(",
"'POST'",
",",
"'/has'",
",",
"params",
"=",
"params",
",",
"*",
"*",
"kwargs",
")",
"return",
"body"
] | https://github.com/open-io/oio-sds/blob/16041950b6056a55d5ce7ca77795defe6dfa6c61/oio/directory/admin.py#L175-L180 | |
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/chunk/regexp.py | python | ChunkString._verify | (self, s, verify_tags) | Check to make sure that ``s`` still corresponds to some chunked
version of ``_pieces``.
:type verify_tags: bool
:param verify_tags: Whether the individual tags should be
checked. If this is false, ``_verify`` will check to make
sure that ``_str`` encodes a chunked versi... | Check to make sure that ``s`` still corresponds to some chunked
version of ``_pieces``. | [
"Check",
"to",
"make",
"sure",
"that",
"s",
"still",
"corresponds",
"to",
"some",
"chunked",
"version",
"of",
"_pieces",
"."
] | def _verify(self, s, verify_tags):
"""
Check to make sure that ``s`` still corresponds to some chunked
version of ``_pieces``.
:type verify_tags: bool
:param verify_tags: Whether the individual tags should be
checked. If this is false, ``_verify`` will check to make... | [
"def",
"_verify",
"(",
"self",
",",
"s",
",",
"verify_tags",
")",
":",
"# Check overall form",
"if",
"not",
"ChunkString",
".",
"_VALID",
".",
"match",
"(",
"s",
")",
":",
"raise",
"ValueError",
"(",
"\"Transformation generated invalid \"",
"\"chunkstring:\\n %s\... | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/chunk/regexp.py#L107-L148 | ||
OpenShot/openshot-qt | bbd2dd040a4e2a6120791e6c65ae0ddf212cb73d | src/windows/export.py | python | Export.updateFrameRate | (self) | Callback for changing the frame rate | Callback for changing the frame rate | [
"Callback",
"for",
"changing",
"the",
"frame",
"rate"
] | def updateFrameRate(self):
"""Callback for changing the frame rate"""
# Adjust the main timeline reader
self.timeline.info.width = self.txtWidth.value()
self.timeline.info.height = self.txtHeight.value()
self.timeline.info.fps.num = self.txtFrameRateNum.value()
self.timel... | [
"def",
"updateFrameRate",
"(",
"self",
")",
":",
"# Adjust the main timeline reader",
"self",
".",
"timeline",
".",
"info",
".",
"width",
"=",
"self",
".",
"txtWidth",
".",
"value",
"(",
")",
"self",
".",
"timeline",
".",
"info",
".",
"height",
"=",
"self"... | https://github.com/OpenShot/openshot-qt/blob/bbd2dd040a4e2a6120791e6c65ae0ddf212cb73d/src/windows/export.py#L317-L340 | ||
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/street/python/vgsl_model.py | python | VGSLImageModel._AddOutputLayer | (self, prev_layer, out_dims, out_func, num_classes) | return logits, output | Add the fully-connected logits and SoftMax/Logistic output Layer.
Args:
prev_layer: Output of last layer of main network.
out_dims: Number of output dimensions, 0, 1 or 2.
out_func: Output non-linearity. 's' or 'c'=softmax, 'l'=logistic.
num_classes: Number of outputs/size of last ou... | Add the fully-connected logits and SoftMax/Logistic output Layer. | [
"Add",
"the",
"fully",
"-",
"connected",
"logits",
"and",
"SoftMax",
"/",
"Logistic",
"output",
"Layer",
"."
] | def _AddOutputLayer(self, prev_layer, out_dims, out_func, num_classes):
"""Add the fully-connected logits and SoftMax/Logistic output Layer.
Args:
prev_layer: Output of last layer of main network.
out_dims: Number of output dimensions, 0, 1 or 2.
out_func: Output non-linearity. 's' or ... | [
"def",
"_AddOutputLayer",
"(",
"self",
",",
"prev_layer",
",",
"out_dims",
",",
"out_func",
",",
"num_classes",
")",
":",
"# Reduce dimensionality appropriate to the output dimensions.",
"batch_in",
"=",
"shapes",
".",
"tensor_dim",
"(",
"prev_layer",
",",
"dim",
"=",... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/street/python/vgsl_model.py#L382-L423 | |
junyanz/BicycleGAN | 40b9d52c27b9831f56c1c7c7a6ddde8bc9149067 | util/html.py | python | HTML.get_image_dir | (self) | return self.img_dir | Return the directory that stores images | Return the directory that stores images | [
"Return",
"the",
"directory",
"that",
"stores",
"images"
] | def get_image_dir(self):
"""Return the directory that stores images"""
return self.img_dir | [
"def",
"get_image_dir",
"(",
"self",
")",
":",
"return",
"self",
".",
"img_dir"
] | https://github.com/junyanz/BicycleGAN/blob/40b9d52c27b9831f56c1c7c7a6ddde8bc9149067/util/html.py#L35-L37 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/scripts/cgat2rdf.py | python | buildParam | (**kwargs) | return param | return a parameter with default values.
Specific fields can be set by providing keyword arguments. | return a parameter with default values. | [
"return",
"a",
"parameter",
"with",
"default",
"values",
"."
] | def buildParam(**kwargs):
'''return a parameter with default values.
Specific fields can be set by providing keyword arguments.
'''
param = {}
param['label'] = "label"
param['description'] = "description"
param['rank'] = 1
param['display'] = 'show'
param['min_occurrence'] = 0
... | [
"def",
"buildParam",
"(",
"*",
"*",
"kwargs",
")",
":",
"param",
"=",
"{",
"}",
"param",
"[",
"'label'",
"]",
"=",
"\"label\"",
"param",
"[",
"'description'",
"]",
"=",
"\"description\"",
"param",
"[",
"'rank'",
"]",
"=",
"1",
"param",
"[",
"'display'"... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/scripts/cgat2rdf.py#L364-L387 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cfw/v20190904/cfw_client.py | python | CfwClient.CreateNatFwInstance | (self, request) | 创建防火墙实例
:param request: Request instance for CreateNatFwInstance.
:type request: :class:`tencentcloud.cfw.v20190904.models.CreateNatFwInstanceRequest`
:rtype: :class:`tencentcloud.cfw.v20190904.models.CreateNatFwInstanceResponse` | 创建防火墙实例 | [
"创建防火墙实例"
] | def CreateNatFwInstance(self, request):
"""创建防火墙实例
:param request: Request instance for CreateNatFwInstance.
:type request: :class:`tencentcloud.cfw.v20190904.models.CreateNatFwInstanceRequest`
:rtype: :class:`tencentcloud.cfw.v20190904.models.CreateNatFwInstanceResponse`
"""
... | [
"def",
"CreateNatFwInstance",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"CreateNatFwInstance\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"l... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cfw/v20190904/cfw_client.py#L169-L194 | ||
django-oscar/django-oscar | ffcc530844d40283b6b1552778a140536b904f5f | src/oscar/apps/shipping/repository.py | python | Repository.apply_shipping_offers | (self, basket, methods) | return [self.apply_shipping_offer(basket, method, offer)
for method in methods] | Apply shipping offers to the passed set of methods | Apply shipping offers to the passed set of methods | [
"Apply",
"shipping",
"offers",
"to",
"the",
"passed",
"set",
"of",
"methods"
] | def apply_shipping_offers(self, basket, methods):
"""
Apply shipping offers to the passed set of methods
"""
# We default to only applying the first shipping discount.
offer = basket.shipping_discounts[0]['offer']
return [self.apply_shipping_offer(basket, method, offer)
... | [
"def",
"apply_shipping_offers",
"(",
"self",
",",
"basket",
",",
"methods",
")",
":",
"# We default to only applying the first shipping discount.",
"offer",
"=",
"basket",
".",
"shipping_discounts",
"[",
"0",
"]",
"[",
"'offer'",
"]",
"return",
"[",
"self",
".",
"... | https://github.com/django-oscar/django-oscar/blob/ffcc530844d40283b6b1552778a140536b904f5f/src/oscar/apps/shipping/repository.py#L68-L75 | |
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/mail/pop3.py | python | IMailbox.getMessage | (index) | Retrieve a file-like object for a particular message.
@type index: C{int}
@param index: The number of the message to retrieve
@rtype: A file-like object
@return: A file containing the message data with lines delimited by
C{\\n}. | Retrieve a file-like object for a particular message. | [
"Retrieve",
"a",
"file",
"-",
"like",
"object",
"for",
"a",
"particular",
"message",
"."
] | def getMessage(index):
"""Retrieve a file-like object for a particular message.
@type index: C{int}
@param index: The number of the message to retrieve
@rtype: A file-like object
@return: A file containing the message data with lines delimited by
C{\\n}.
""" | [
"def",
"getMessage",
"(",
"index",
")",
":"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/mail/pop3.py#L888-L897 | ||
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/stats/_mstats_basic.py | python | trimtail | (data, proportiontocut=0.2, tail='left', inclusive=(True,True),
axis=None) | return trimr(data, limits=limits, axis=axis, inclusive=inclusive) | Trims the data by masking values from one tail.
Parameters
----------
data : array_like
Data to trim.
proportiontocut : float, optional
Percentage of trimming. If n is the number of unmasked values
before trimming, the number of values after trimming is
``(1 - proportion... | Trims the data by masking values from one tail. | [
"Trims",
"the",
"data",
"by",
"masking",
"values",
"from",
"one",
"tail",
"."
] | def trimtail(data, proportiontocut=0.2, tail='left', inclusive=(True,True),
axis=None):
"""
Trims the data by masking values from one tail.
Parameters
----------
data : array_like
Data to trim.
proportiontocut : float, optional
Percentage of trimming. If n is the nu... | [
"def",
"trimtail",
"(",
"data",
",",
"proportiontocut",
"=",
"0.2",
",",
"tail",
"=",
"'left'",
",",
"inclusive",
"=",
"(",
"True",
",",
"True",
")",
",",
"axis",
"=",
"None",
")",
":",
"tail",
"=",
"str",
"(",
"tail",
")",
".",
"lower",
"(",
")"... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/stats/_mstats_basic.py#L1795-L1834 | |
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v5_1/git/git_client_base.py | python | GitClientBase.update_pull_request_statuses | (self, patch_document, repository_id, pull_request_id, project=None) | UpdatePullRequestStatuses.
[Preview API] Update pull request statuses collection. The only supported operation type is `remove`.
:param :class:`<[JsonPatchOperation]> <azure.devops.v5_1.git.models.[JsonPatchOperation]>` patch_document: Operations to apply to the pull request statuses in JSON Patch forma... | UpdatePullRequestStatuses.
[Preview API] Update pull request statuses collection. The only supported operation type is `remove`.
:param :class:`<[JsonPatchOperation]> <azure.devops.v5_1.git.models.[JsonPatchOperation]>` patch_document: Operations to apply to the pull request statuses in JSON Patch forma... | [
"UpdatePullRequestStatuses",
".",
"[",
"Preview",
"API",
"]",
"Update",
"pull",
"request",
"statuses",
"collection",
".",
"The",
"only",
"supported",
"operation",
"type",
"is",
"remove",
".",
":",
"param",
":",
"class",
":",
"<",
"[",
"JsonPatchOperation",
"]"... | def update_pull_request_statuses(self, patch_document, repository_id, pull_request_id, project=None):
"""UpdatePullRequestStatuses.
[Preview API] Update pull request statuses collection. The only supported operation type is `remove`.
:param :class:`<[JsonPatchOperation]> <azure.devops.v5_1.git.m... | [
"def",
"update_pull_request_statuses",
"(",
"self",
",",
"patch_document",
",",
"repository_id",
",",
"pull_request_id",
",",
"project",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'pro... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/git/git_client_base.py#L2314-L2335 | ||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/cinder/cinder/openstack/common/rpc/impl_kombu.py | python | Connection._fetch_ssl_params | (self) | Handles fetching what ssl params
should be used for the connection (if any) | Handles fetching what ssl params
should be used for the connection (if any) | [
"Handles",
"fetching",
"what",
"ssl",
"params",
"should",
"be",
"used",
"for",
"the",
"connection",
"(",
"if",
"any",
")"
] | def _fetch_ssl_params(self):
"""Handles fetching what ssl params
should be used for the connection (if any)"""
ssl_params = dict()
# http://docs.python.org/library/ssl.html - ssl.wrap_socket
if self.conf.kombu_ssl_version:
ssl_params['ssl_version'] = self.conf.kombu_... | [
"def",
"_fetch_ssl_params",
"(",
"self",
")",
":",
"ssl_params",
"=",
"dict",
"(",
")",
"# http://docs.python.org/library/ssl.html - ssl.wrap_socket",
"if",
"self",
".",
"conf",
".",
"kombu_ssl_version",
":",
"ssl_params",
"[",
"'ssl_version'",
"]",
"=",
"self",
"."... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/openstack/common/rpc/impl_kombu.py#L449-L472 | ||
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/chunk.py | python | Chunk.seek | (self, pos, whence=0) | Seek to specified position into the chunk.
Default position is 0 (start of chunk).
If the file is not seekable, this will result in an error. | Seek to specified position into the chunk.
Default position is 0 (start of chunk).
If the file is not seekable, this will result in an error. | [
"Seek",
"to",
"specified",
"position",
"into",
"the",
"chunk",
".",
"Default",
"position",
"is",
"0",
"(",
"start",
"of",
"chunk",
")",
".",
"If",
"the",
"file",
"is",
"not",
"seekable",
"this",
"will",
"result",
"in",
"an",
"error",
"."
] | def seek(self, pos, whence=0):
"""Seek to specified position into the chunk.
Default position is 0 (start of chunk).
If the file is not seekable, this will result in an error.
"""
if self.closed:
raise ValueError("I/O operation on closed file")
if not self.se... | [
"def",
"seek",
"(",
"self",
",",
"pos",
",",
"whence",
"=",
"0",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"ValueError",
"(",
"\"I/O operation on closed file\"",
")",
"if",
"not",
"self",
".",
"seekable",
":",
"raise",
"OSError",
"(",
"\"canno... | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/chunk.py#L98-L115 | ||
neurolib-dev/neurolib | 8d8ed2ceb422e9a1367193495a7e2df96cf4e4a3 | neurolib/models/aln/timeIntegration.py | python | timeIntegration | (params) | return timeIntegration_njit_elementwise(
dt,
duration,
distr_delay,
filter_sigma,
Cmat,
Dmat,
c_gl,
Ke_gl,
tau_ou,
sigma_ou,
mue_ext_mean,
mui_ext_mean,
sigmae_ext,
sigmai_ext,
Ke,
Ki,
... | Sets up the parameters for time integration
Return:
rates_exc: N*L array : containing the exc. neuron rates in kHz time series of the N nodes
rates_inh: N*L array : containing the inh. neuron rates in kHz time series of the N nodes
t: L array : time in ms
mufe: ... | Sets up the parameters for time integration
Return:
rates_exc: N*L array : containing the exc. neuron rates in kHz time series of the N nodes
rates_inh: N*L array : containing the inh. neuron rates in kHz time series of the N nodes
t: L array : time in ms
mufe: ... | [
"Sets",
"up",
"the",
"parameters",
"for",
"time",
"integration",
"Return",
":",
"rates_exc",
":",
"N",
"*",
"L",
"array",
":",
"containing",
"the",
"exc",
".",
"neuron",
"rates",
"in",
"kHz",
"time",
"series",
"of",
"the",
"N",
"nodes",
"rates_inh",
":",... | def timeIntegration(params):
"""Sets up the parameters for time integration
Return:
rates_exc: N*L array : containing the exc. neuron rates in kHz time series of the N nodes
rates_inh: N*L array : containing the inh. neuron rates in kHz time series of the N nodes
t: L array... | [
"def",
"timeIntegration",
"(",
"params",
")",
":",
"dt",
"=",
"params",
"[",
"\"dt\"",
"]",
"# Time step for the Euler intergration (ms)",
"duration",
"=",
"params",
"[",
"\"duration\"",
"]",
"# imulation duration (ms)",
"RNGseed",
"=",
"params",
"[",
"\"seed\"",
"]... | https://github.com/neurolib-dev/neurolib/blob/8d8ed2ceb422e9a1367193495a7e2df96cf4e4a3/neurolib/models/aln/timeIntegration.py#L7-L312 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v6_0/pipeline_permissions/pipeline_permissions_client.py | python | PipelinePermissionsClient.update_pipeline_permisions_for_resources | (self, resource_authorizations, project) | return self._deserialize('[ResourcePipelinePermissions]', self._unwrap_collection(response)) | UpdatePipelinePermisionsForResources.
[Preview API] Batch API to authorize/unauthorize a list of definitions for a multiple resources.
:param [ResourcePipelinePermissions] resource_authorizations:
:param str project: Project ID or project name
:rtype: [ResourcePipelinePermissions] | UpdatePipelinePermisionsForResources.
[Preview API] Batch API to authorize/unauthorize a list of definitions for a multiple resources.
:param [ResourcePipelinePermissions] resource_authorizations:
:param str project: Project ID or project name
:rtype: [ResourcePipelinePermissions] | [
"UpdatePipelinePermisionsForResources",
".",
"[",
"Preview",
"API",
"]",
"Batch",
"API",
"to",
"authorize",
"/",
"unauthorize",
"a",
"list",
"of",
"definitions",
"for",
"a",
"multiple",
"resources",
".",
":",
"param",
"[",
"ResourcePipelinePermissions",
"]",
"reso... | def update_pipeline_permisions_for_resources(self, resource_authorizations, project):
"""UpdatePipelinePermisionsForResources.
[Preview API] Batch API to authorize/unauthorize a list of definitions for a multiple resources.
:param [ResourcePipelinePermissions] resource_authorizations:
:p... | [
"def",
"update_pipeline_permisions_for_resources",
"(",
"self",
",",
"resource_authorizations",
",",
"project",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_seriali... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v6_0/pipeline_permissions/pipeline_permissions_client.py#L73-L89 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/provisioningserver/drivers/power/__init__.py | python | PowerDriver.power_on | (self, system_id, context) | Implement this method for the actual implementation
of the power on command. | Implement this method for the actual implementation
of the power on command. | [
"Implement",
"this",
"method",
"for",
"the",
"actual",
"implementation",
"of",
"the",
"power",
"on",
"command",
"."
] | def power_on(self, system_id, context):
"""Implement this method for the actual implementation
of the power on command.
""" | [
"def",
"power_on",
"(",
"self",
",",
"system_id",
",",
"context",
")",
":"
] | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/provisioningserver/drivers/power/__init__.py#L275-L278 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-graalpython/_weakref.py | python | ProxyType.__gt__ | (self, other) | return _proxy_get(self) > other | [] | def __gt__(self, other):
return _proxy_get(self) > other | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"_proxy_get",
"(",
"self",
")",
">",
"other"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-graalpython/_weakref.py#L96-L97 | |||
SchrodingersGat/KiBoM | 69e0a305bc1c376cfcbb0998e29cf846284b8734 | kibom/debug.py | python | info | (*arg) | Display an info message. | Display an info message. | [
"Display",
"an",
"info",
"message",
"."
] | def info(*arg):
"""
Display an info message.
"""
global MSG_LEVEL
if MSG_LEVEL < MSG_INFO:
return
_msg(MSG_CODES[MSG_INFO], *arg) | [
"def",
"info",
"(",
"*",
"arg",
")",
":",
"global",
"MSG_LEVEL",
"if",
"MSG_LEVEL",
"<",
"MSG_INFO",
":",
"return",
"_msg",
"(",
"MSG_CODES",
"[",
"MSG_INFO",
"]",
",",
"*",
"arg",
")"
] | https://github.com/SchrodingersGat/KiBoM/blob/69e0a305bc1c376cfcbb0998e29cf846284b8734/kibom/debug.py#L71-L80 | ||
sripathikrishnan/redis-rdb-tools | 548b11ec3c81a603f5b321228d07a61a0b940159 | rdbtools/callbacks.py | python | KeyValsOnlyCallback._start_key | (self, key, length) | [] | def _start_key(self, key, length):
if not self._is_first_key_in_db:
self._out.write(b',')
self._out.write(b'\r\n')
self._is_first_key_in_db = False
self._elements_in_key = length
self._element_index = 0 | [
"def",
"_start_key",
"(",
"self",
",",
"key",
",",
"length",
")",
":",
"if",
"not",
"self",
".",
"_is_first_key_in_db",
":",
"self",
".",
"_out",
".",
"write",
"(",
"b','",
")",
"self",
".",
"_out",
".",
"write",
"(",
"b'\\r\\n'",
")",
"self",
".",
... | https://github.com/sripathikrishnan/redis-rdb-tools/blob/548b11ec3c81a603f5b321228d07a61a0b940159/rdbtools/callbacks.py#L191-L197 | ||||
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/storage/databases/main/registration.py | python | RegistrationWorkerStore.get_user_id_by_threepid | (self, medium: str, address: str) | return user_id | Returns user id from threepid
Args:
medium: threepid medium e.g. email
address: threepid address e.g. me@example.com. This must already be
in canonical form.
Returns:
The user ID or None if no user id/threepid mapping exists | Returns user id from threepid | [
"Returns",
"user",
"id",
"from",
"threepid"
] | async def get_user_id_by_threepid(self, medium: str, address: str) -> Optional[str]:
"""Returns user id from threepid
Args:
medium: threepid medium e.g. email
address: threepid address e.g. me@example.com. This must already be
in canonical form.
Returns:... | [
"async",
"def",
"get_user_id_by_threepid",
"(",
"self",
",",
"medium",
":",
"str",
",",
"address",
":",
"str",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"user_id",
"=",
"await",
"self",
".",
"db_pool",
".",
"runInteraction",
"(",
"\"get_user_id_by_threepi... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/storage/databases/main/registration.py#L854-L868 | |
worron/ACYLS | 91b68780112fb6f6d23c37b003f426dd9ad3e241 | scripts/lib/fssupport.py | python | get_svg_first | (*dirlist) | Find first SVG icon in directories | Find first SVG icon in directories | [
"Find",
"first",
"SVG",
"icon",
"in",
"directories"
] | def get_svg_first(*dirlist):
"""Find first SVG icon in directories"""
for path in dirlist:
for root, _, files in os.walk(path):
for filename in files:
if filename.endswith('.svg'):
return os.path.join(root, filename) | [
"def",
"get_svg_first",
"(",
"*",
"dirlist",
")",
":",
"for",
"path",
"in",
"dirlist",
":",
"for",
"root",
",",
"_",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"for",
"filename",
"in",
"files",
":",
"if",
"filename",
".",
"endswi... | https://github.com/worron/ACYLS/blob/91b68780112fb6f6d23c37b003f426dd9ad3e241/scripts/lib/fssupport.py#L23-L29 | ||
AnonGit90210/RamanujanMachine | 1f4f8f76e61291f4dc4a81fead4a721f21f5f943 | utils.py | python | grouper | (iterable, n, fillvalue=None) | return zip_longest(*args, fillvalue=fillvalue) | Collect data into fixed-length chunks or blocks | Collect data into fixed-length chunks or blocks | [
"Collect",
"data",
"into",
"fixed",
"-",
"length",
"chunks",
"or",
"blocks"
] | def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue) | [
"def",
"grouper",
"(",
"iterable",
",",
"n",
",",
"fillvalue",
"=",
"None",
")",
":",
"# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx\"",
"args",
"=",
"[",
"iter",
"(",
"iterable",
")",
"]",
"*",
"n",
"return",
"zip_longest",
"(",
"*",
"args",
",",
"fillvalue"... | https://github.com/AnonGit90210/RamanujanMachine/blob/1f4f8f76e61291f4dc4a81fead4a721f21f5f943/utils.py#L172-L176 | |
facetoe/zenpy | e614e973aa4d3c4c2a0b91767c2d8565f48ec717 | zenpy/lib/api.py | python | SatisfactionRatingApi.create | (self, ticket, satisfaction_rating) | return SatisfactionRatingRequest(self).post(ticket,
satisfaction_rating) | Create/update a Satisfaction Rating for a ticket.
:param ticket: Ticket object or id
:param satisfaction_rating: SatisfactionRating object. | Create/update a Satisfaction Rating for a ticket. | [
"Create",
"/",
"update",
"a",
"Satisfaction",
"Rating",
"for",
"a",
"ticket",
"."
] | def create(self, ticket, satisfaction_rating):
"""
Create/update a Satisfaction Rating for a ticket.
:param ticket: Ticket object or id
:param satisfaction_rating: SatisfactionRating object.
"""
return SatisfactionRatingRequest(self).post(ticket,
... | [
"def",
"create",
"(",
"self",
",",
"ticket",
",",
"satisfaction_rating",
")",
":",
"return",
"SatisfactionRatingRequest",
"(",
"self",
")",
".",
"post",
"(",
"ticket",
",",
"satisfaction_rating",
")"
] | https://github.com/facetoe/zenpy/blob/e614e973aa4d3c4c2a0b91767c2d8565f48ec717/zenpy/lib/api.py#L1177-L1185 | |
freqtrade/freqtrade | 13651fd3be8d5ce8dcd7c94b920bda4e00b75aca | freqtrade/optimize/hyperopt_tools.py | python | HyperoptTools.show_epoch_details | (results, total_epochs: int, print_json: bool,
no_header: bool = False, header_str: str = None) | Display details of the hyperopt result | Display details of the hyperopt result | [
"Display",
"details",
"of",
"the",
"hyperopt",
"result"
] | def show_epoch_details(results, total_epochs: int, print_json: bool,
no_header: bool = False, header_str: str = None) -> None:
"""
Display details of the hyperopt result
"""
params = results.get('params_details', {})
non_optimized = results.get('params_... | [
"def",
"show_epoch_details",
"(",
"results",
",",
"total_epochs",
":",
"int",
",",
"print_json",
":",
"bool",
",",
"no_header",
":",
"bool",
"=",
"False",
",",
"header_str",
":",
"str",
"=",
"None",
")",
"->",
"None",
":",
"params",
"=",
"results",
".",
... | https://github.com/freqtrade/freqtrade/blob/13651fd3be8d5ce8dcd7c94b920bda4e00b75aca/freqtrade/optimize/hyperopt_tools.py#L160-L191 | ||
praw-dev/praw | d1280b132f509ad115f3941fb55f13f979068377 | praw/models/inbox.py | python | Inbox.collapse | (self, items: List["praw.models.Message"]) | Mark an inbox message as collapsed.
:param items: A list containing instances of :class:`.Message`.
Requests are batched at 25 items (reddit limit).
For example, to collapse all unread Messages, try:
.. code-block:: python
from praw.models import Message
unr... | Mark an inbox message as collapsed. | [
"Mark",
"an",
"inbox",
"message",
"as",
"collapsed",
"."
] | def collapse(self, items: List["praw.models.Message"]):
"""Mark an inbox message as collapsed.
:param items: A list containing instances of :class:`.Message`.
Requests are batched at 25 items (reddit limit).
For example, to collapse all unread Messages, try:
.. code-block:: p... | [
"def",
"collapse",
"(",
"self",
",",
"items",
":",
"List",
"[",
"\"praw.models.Message\"",
"]",
")",
":",
"while",
"items",
":",
"data",
"=",
"{",
"\"id\"",
":",
"\",\"",
".",
"join",
"(",
"x",
".",
"fullname",
"for",
"x",
"in",
"items",
"[",
":",
... | https://github.com/praw-dev/praw/blob/d1280b132f509ad115f3941fb55f13f979068377/praw/models/inbox.py#L34-L61 | ||
bikalims/bika.lims | 35e4bbdb5a3912cae0b5eb13e51097c8b0486349 | bika/lims/api.py | python | get_review_status | (brain_or_object) | return get_workflow_status_of(brain_or_object, state_var="review_state") | Get the `review_state` of an object
:param brain_or_object: A single catalog brain or content object
:type brain_or_object: ATContentType/DexterityContentType/CatalogBrain
:returns: Value of the review_status variable
:rtype: String | Get the `review_state` of an object | [
"Get",
"the",
"review_state",
"of",
"an",
"object"
] | def get_review_status(brain_or_object):
"""Get the `review_state` of an object
:param brain_or_object: A single catalog brain or content object
:type brain_or_object: ATContentType/DexterityContentType/CatalogBrain
:returns: Value of the review_status variable
:rtype: String
"""
if is_brain... | [
"def",
"get_review_status",
"(",
"brain_or_object",
")",
":",
"if",
"is_brain",
"(",
"brain_or_object",
")",
":",
"return",
"brain_or_object",
".",
"review_state",
"return",
"get_workflow_status_of",
"(",
"brain_or_object",
",",
"state_var",
"=",
"\"review_state\"",
"... | https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/api.py#L769-L779 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/op2/result_objects/op2_objects.py | python | BaseScalarObject.export_to_hdf5 | (self, group, log: SimpleLogger) | exports the object to HDF5 format | exports the object to HDF5 format | [
"exports",
"the",
"object",
"to",
"HDF5",
"format"
] | def export_to_hdf5(self, group, log: SimpleLogger) -> None:
"""exports the object to HDF5 format"""
export_to_hdf5(self, group, log) | [
"def",
"export_to_hdf5",
"(",
"self",
",",
"group",
",",
"log",
":",
"SimpleLogger",
")",
"->",
"None",
":",
"export_to_hdf5",
"(",
"self",
",",
"group",
",",
"log",
")"
] | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/result_objects/op2_objects.py#L109-L111 | ||
beetbox/beets | 2fea53c34dd505ba391cb345424e0613901c8025 | beets/dbcore/db.py | python | Database.transaction | (self) | return Transaction(self) | Get a :class:`Transaction` object for interacting directly
with the underlying SQLite database. | Get a :class:`Transaction` object for interacting directly
with the underlying SQLite database. | [
"Get",
"a",
":",
"class",
":",
"Transaction",
"object",
"for",
"interacting",
"directly",
"with",
"the",
"underlying",
"SQLite",
"database",
"."
] | def transaction(self):
"""Get a :class:`Transaction` object for interacting directly
with the underlying SQLite database.
"""
return Transaction(self) | [
"def",
"transaction",
"(",
"self",
")",
":",
"return",
"Transaction",
"(",
"self",
")"
] | https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beets/dbcore/db.py#L989-L993 | |
prody/ProDy | b24bbf58aa8fffe463c8548ae50e3955910e5b7f | prody/dynamics/entropy.py | python | calcOverallNetEntropyTransfer | (model, turbo=False) | return overallNetEntropyTransfer | This function calculates the net entropy transfer for a whole structure
with a given time constant tau based on GNM. | This function calculates the net entropy transfer for a whole structure
with a given time constant tau based on GNM. | [
"This",
"function",
"calculates",
"the",
"net",
"entropy",
"transfer",
"for",
"a",
"whole",
"structure",
"with",
"a",
"given",
"time",
"constant",
"tau",
"based",
"on",
"GNM",
"."
] | def calcOverallNetEntropyTransfer(model, turbo=False):
"""This function calculates the net entropy transfer for a whole structure
with a given time constant tau based on GNM.
"""
if not isinstance(model, NMA):
raise TypeError('model must be a NMA instance')
elif model.is3d():
rais... | [
"def",
"calcOverallNetEntropyTransfer",
"(",
"model",
",",
"turbo",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"model",
",",
"NMA",
")",
":",
"raise",
"TypeError",
"(",
"'model must be a NMA instance'",
")",
"elif",
"model",
".",
"is3d",
"(",
")... | https://github.com/prody/ProDy/blob/b24bbf58aa8fffe463c8548ae50e3955910e5b7f/prody/dynamics/entropy.py#L101-L151 | |
dask/dask | c2b962fec1ba45440fe928869dc64cfe9cc36506 | dask/array/linalg.py | python | sfqr | (data, name=None) | return Q, R | Direct Short-and-Fat QR
Currently, this is a quick hack for non-tall-and-skinny matrices which
are one chunk tall and (unless they are one chunk wide) have chunks
that are wider than they are tall
Q [R_1 R_2 ...] = [A_1 A_2 ...]
it computes the factorization Q R_1 = A_1, then computes the other
... | Direct Short-and-Fat QR | [
"Direct",
"Short",
"-",
"and",
"-",
"Fat",
"QR"
] | def sfqr(data, name=None):
"""Direct Short-and-Fat QR
Currently, this is a quick hack for non-tall-and-skinny matrices which
are one chunk tall and (unless they are one chunk wide) have chunks
that are wider than they are tall
Q [R_1 R_2 ...] = [A_1 A_2 ...]
it computes the factorization Q R_... | [
"def",
"sfqr",
"(",
"data",
",",
"name",
"=",
"None",
")",
":",
"nr",
",",
"nc",
"=",
"len",
"(",
"data",
".",
"chunks",
"[",
"0",
"]",
")",
",",
"len",
"(",
"data",
".",
"chunks",
"[",
"1",
"]",
")",
"cr",
",",
"cc",
"=",
"data",
".",
"c... | https://github.com/dask/dask/blob/c2b962fec1ba45440fe928869dc64cfe9cc36506/dask/array/linalg.py#L508-L613 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | plexpy/plextv.py | python | PlexTV.get_pin | (self, pin='') | [] | def get_pin(self, pin=''):
plextv_response = self.get_plextv_pin(pin=pin,
output_format='xml')
if plextv_response:
try:
xml_head = plextv_response.getElementsByTagName('pin')
if xml_head:
pin =... | [
"def",
"get_pin",
"(",
"self",
",",
"pin",
"=",
"''",
")",
":",
"plextv_response",
"=",
"self",
".",
"get_plextv_pin",
"(",
"pin",
"=",
"pin",
",",
"output_format",
"=",
"'xml'",
")",
"if",
"plextv_response",
":",
"try",
":",
"xml_head",
"=",
"plextv_res... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/plextv.py#L208-L230 | ||||
gentoo/portage | e5be73709b1a42b40380fd336f9381452b01a723 | repoman/lib/repoman/modules/scan/ebuild/ebuild.py | python | Ebuild.__init__ | (self, **kwargs) | Class init
@param qatracker: QATracker instance
@param portdb: portdb instance
@param repo_settings: repository settings instance
@param vcs_settings: VCSSettings instance
@param checks: checks dictionary | Class init | [
"Class",
"init"
] | def __init__(self, **kwargs):
"""Class init
@param qatracker: QATracker instance
@param portdb: portdb instance
@param repo_settings: repository settings instance
@param vcs_settings: VCSSettings instance
@param checks: checks dictionary
"""
super(Ebuild,... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Ebuild",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"qatracker",
"=",
"kwargs",
".",
"get",
"(",
"\"qatracker\"",
")",
"self",
".",... | https://github.com/gentoo/portage/blob/e5be73709b1a42b40380fd336f9381452b01a723/repoman/lib/repoman/modules/scan/ebuild/ebuild.py#L23-L52 | ||
MDudek-ICS/TRISIS-TRITON-HATMAN | 15a00af7fd1040f0430729d024427601f84886a1 | decompiled_code/library/base64.py | python | decodestring | (s) | return binascii.a2b_base64(s) | Decode a string. | Decode a string. | [
"Decode",
"a",
"string",
"."
] | def decodestring(s):
"""Decode a string."""
return binascii.a2b_base64(s) | [
"def",
"decodestring",
"(",
"s",
")",
":",
"return",
"binascii",
".",
"a2b_base64",
"(",
"s",
")"
] | https://github.com/MDudek-ICS/TRISIS-TRITON-HATMAN/blob/15a00af7fd1040f0430729d024427601f84886a1/decompiled_code/library/base64.py#L290-L292 | |
cobbler/cobbler | eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc | cobbler/items/system.py | python | NetworkInterface.mac_address | (self) | return self._mac_address | mac_address property.
:getter: Returns the value for ``mac_address``.
:setter: Sets the value for the property ``mac_address``.
:return: | mac_address property. | [
"mac_address",
"property",
"."
] | def mac_address(self) -> str:
"""
mac_address property.
:getter: Returns the value for ``mac_address``.
:setter: Sets the value for the property ``mac_address``.
:return:
"""
return self._mac_address | [
"def",
"mac_address",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_mac_address"
] | https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/items/system.py#L290-L298 | |
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | openWrt/files/usr/lib/python2.7/site-packages/sockjs/tornado/session.py | python | Session.flush | (self) | Flush message queue if there's an active connection running | Flush message queue if there's an active connection running | [
"Flush",
"message",
"queue",
"if",
"there",
"s",
"an",
"active",
"connection",
"running"
] | def flush(self):
"""Flush message queue if there's an active connection running"""
self._pending_flush = False
if self.handler is None or not self.handler.active or not self.send_queue:
return
self.handler.send_pack('a[%s]' % self.send_queue)
self.send_queue = '' | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"_pending_flush",
"=",
"False",
"if",
"self",
".",
"handler",
"is",
"None",
"or",
"not",
"self",
".",
"handler",
".",
"active",
"or",
"not",
"self",
".",
"send_queue",
":",
"return",
"self",
".",
"h... | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/sockjs/tornado/session.py#L358-L366 | ||
carla-simulator/scenario_runner | f4d00d88eda4212a1e119515c96281a4be5c234e | srunner/scenarios/route_scenario.py | python | RouteScenario._update_ego_vehicle | (self) | return ego_vehicle | Set/Update the start position of the ego_vehicle | Set/Update the start position of the ego_vehicle | [
"Set",
"/",
"Update",
"the",
"start",
"position",
"of",
"the",
"ego_vehicle"
] | def _update_ego_vehicle(self):
"""
Set/Update the start position of the ego_vehicle
"""
# move ego to correct position
elevate_transform = self.route[0][0]
elevate_transform.location.z += 0.5
ego_vehicle = CarlaDataProvider.request_new_actor('vehicle.lincoln.mkz_... | [
"def",
"_update_ego_vehicle",
"(",
"self",
")",
":",
"# move ego to correct position",
"elevate_transform",
"=",
"self",
".",
"route",
"[",
"0",
"]",
"[",
"0",
"]",
"elevate_transform",
".",
"location",
".",
"z",
"+=",
"0.5",
"ego_vehicle",
"=",
"CarlaDataProvid... | https://github.com/carla-simulator/scenario_runner/blob/f4d00d88eda4212a1e119515c96281a4be5c234e/srunner/scenarios/route_scenario.py#L212-L224 | |
MegviiDetection/video_analyst | f4d1bccb1c698961fed3cb70808f1177fab13bdd | videoanalyst/optim/optimizer/optimizer_impl/utils/lr_multiply.py | python | multiply_lr | (optimizer, lr_ratios, verbose=False) | return optimizer | apply learning rate ratio for per-layer adjustment | apply learning rate ratio for per-layer adjustment | [
"apply",
"learning",
"rate",
"ratio",
"for",
"per",
"-",
"layer",
"adjustment"
] | def multiply_lr(optimizer, lr_ratios, verbose=False):
""" apply learning rate ratio for per-layer adjustment """
assert len(optimizer.param_groups) == len(lr_ratios)
for ith, (param_group,
lr_ratio) in enumerate(zip(optimizer.param_groups, lr_ratios)):
param_group['lr'] *= lr_ratio
... | [
"def",
"multiply_lr",
"(",
"optimizer",
",",
"lr_ratios",
",",
"verbose",
"=",
"False",
")",
":",
"assert",
"len",
"(",
"optimizer",
".",
"param_groups",
")",
"==",
"len",
"(",
"lr_ratios",
")",
"for",
"ith",
",",
"(",
"param_group",
",",
"lr_ratio",
")"... | https://github.com/MegviiDetection/video_analyst/blob/f4d1bccb1c698961fed3cb70808f1177fab13bdd/videoanalyst/optim/optimizer/optimizer_impl/utils/lr_multiply.py#L93-L102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.