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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mne-tools/mne-python | f90b303ce66a8415e64edd4605b09ac0179c1ebf | mne/io/bti/read.py | python | read_float_matrix | (fid, rows, cols) | return _unpack_matrix(fid, rows, cols, dtype='>f4',
out_dtype=np.float32) | Read 32bit float matrix from bti file. | Read 32bit float matrix from bti file. | [
"Read",
"32bit",
"float",
"matrix",
"from",
"bti",
"file",
"."
] | def read_float_matrix(fid, rows, cols):
"""Read 32bit float matrix from bti file."""
return _unpack_matrix(fid, rows, cols, dtype='>f4',
out_dtype=np.float32) | [
"def",
"read_float_matrix",
"(",
"fid",
",",
"rows",
",",
"cols",
")",
":",
"return",
"_unpack_matrix",
"(",
"fid",
",",
"rows",
",",
"cols",
",",
"dtype",
"=",
"'>f4'",
",",
"out_dtype",
"=",
"np",
".",
"float32",
")"
] | https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/io/bti/read.py#L96-L99 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/contrib/gis/db/models/lookups.py | python | DistanceLookupBase.process_rhs | (self, compiler, connection) | return (rhs, params) | [] | def process_rhs(self, compiler, connection):
if not isinstance(self.rhs, (tuple, list)) or not 2 <= len(self.rhs) <= 4:
raise ValueError("2, 3, or 4-element tuple required for '%s' lookup." % self.lookup_name)
elif len(self.rhs) == 4 and not self.rhs[3] == 'spheroid':
raise Value... | [
"def",
"process_rhs",
"(",
"self",
",",
"compiler",
",",
"connection",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"rhs",
",",
"(",
"tuple",
",",
"list",
")",
")",
"or",
"not",
"2",
"<=",
"len",
"(",
"self",
".",
"rhs",
")",
"<=",
"4",... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/contrib/gis/db/models/lookups.py#L420-L445 | |||
yandex/yandex-tank | b41bcc04396c4ed46fc8b28a261197320854fd33 | yandextank/plugins/DataUploader/cli.py | python | check_log | (log_name) | [] | def check_log(log_name):
assert os.path.exists(log_name), \
'Data log {} not found\n'.format(log_name) + \
'JsonReport plugin should be enabled when launching Yandex-tank' | [
"def",
"check_log",
"(",
"log_name",
")",
":",
"assert",
"os",
".",
"path",
".",
"exists",
"(",
"log_name",
")",
",",
"'Data log {} not found\\n'",
".",
"format",
"(",
"log_name",
")",
"+",
"'JsonReport plugin should be enabled when launching Yandex-tank'"
] | https://github.com/yandex/yandex-tank/blob/b41bcc04396c4ed46fc8b28a261197320854fd33/yandextank/plugins/DataUploader/cli.py#L64-L67 | ||||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/wireless/v1/sim/__init__.py | python | SimInstance.data_sessions | (self) | return self._proxy.data_sessions | Access the data_sessions
:returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList
:rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList | Access the data_sessions | [
"Access",
"the",
"data_sessions"
] | def data_sessions(self):
"""
Access the data_sessions
:returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList
:rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList
"""
return self._proxy.data_sessions | [
"def",
"data_sessions",
"(",
"self",
")",
":",
"return",
"self",
".",
"_proxy",
".",
"data_sessions"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/wireless/v1/sim/__init__.py#L711-L718 | |
nltk/nltk_contrib | c9da2c29777ca9df650740145f1f4a375ccac961 | nltk_contrib/tiger/query/ast_utils.py | python | create_vardef | (name, expression, var_type=ast.VariableTypes.NodeIdentifier,
container_type=ast.ContainerTypes.Single) | return ast.VariableDefinition(ast.Variable(name, var_type, container_type), expression) | Creates a new `VariableDefinition` of a variable `name` and a RHS `expression`.
*Parameters*:
* `name`: the name of the variable
* `expression`: the expression which is assigned to the variable
* `var_type`: the type of the variable, a member of `nltk_contrib.tiger.query.ast.VariableTypes`
... | Creates a new `VariableDefinition` of a variable `name` and a RHS `expression`.
*Parameters*:
* `name`: the name of the variable
* `expression`: the expression which is assigned to the variable
* `var_type`: the type of the variable, a member of `nltk_contrib.tiger.query.ast.VariableTypes`
... | [
"Creates",
"a",
"new",
"VariableDefinition",
"of",
"a",
"variable",
"name",
"and",
"a",
"RHS",
"expression",
".",
"*",
"Parameters",
"*",
":",
"*",
"name",
":",
"the",
"name",
"of",
"the",
"variable",
"*",
"expression",
":",
"the",
"expression",
"which",
... | def create_vardef(name, expression, var_type=ast.VariableTypes.NodeIdentifier,
container_type=ast.ContainerTypes.Single):
"""Creates a new `VariableDefinition` of a variable `name` and a RHS `expression`.
*Parameters*:
* `name`: the name of the variable
* `expression`: the expr... | [
"def",
"create_vardef",
"(",
"name",
",",
"expression",
",",
"var_type",
"=",
"ast",
".",
"VariableTypes",
".",
"NodeIdentifier",
",",
"container_type",
"=",
"ast",
".",
"ContainerTypes",
".",
"Single",
")",
":",
"return",
"ast",
".",
"VariableDefinition",
"("... | https://github.com/nltk/nltk_contrib/blob/c9da2c29777ca9df650740145f1f4a375ccac961/nltk_contrib/tiger/query/ast_utils.py#L29-L39 | |
xuehy/pytorch-maddpg | b7c1acf027a64a492eee6ab1c304ed3b8e69b5c4 | pursuit/waterworld.py | python | MAWaterWorld._caught | (self, is_colliding_N1_N2, n_coop) | return is_caught_cN2, who_caught_cN1 | Checke whether collision results in catching the object
This is because you need `n_coop` agents to collide with the object to actually catch it | Checke whether collision results in catching the object | [
"Checke",
"whether",
"collision",
"results",
"in",
"catching",
"the",
"object"
] | def _caught(self, is_colliding_N1_N2, n_coop):
""" Checke whether collision results in catching the object
This is because you need `n_coop` agents to collide with the object to actually catch it
"""
# number of N1 colliding with given N2
n_collisions_N2 = is_colliding_N1_N2.sum... | [
"def",
"_caught",
"(",
"self",
",",
"is_colliding_N1_N2",
",",
"n_coop",
")",
":",
"# number of N1 colliding with given N2",
"n_collisions_N2",
"=",
"is_colliding_N1_N2",
".",
"sum",
"(",
"axis",
"=",
"0",
")",
"is_caught_cN2",
"=",
"np",
".",
"where",
"(",
"n_c... | https://github.com/xuehy/pytorch-maddpg/blob/b7c1acf027a64a492eee6ab1c304ed3b8e69b5c4/pursuit/waterworld.py#L180-L193 | |
dragonfly/dragonfly | a579b5eadf452e23b07d4caf27b402703b0012b7 | dragonfly/opt/ga_optimiser.py | python | GAOptimiser._add_data_to_model | (self, qinfos) | Update the optimisation model. | Update the optimisation model. | [
"Update",
"the",
"optimisation",
"model",
"."
] | def _add_data_to_model(self, qinfos):
""" Update the optimisation model. """
pass | [
"def",
"_add_data_to_model",
"(",
"self",
",",
"qinfos",
")",
":",
"pass"
] | https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/opt/ga_optimiser.py#L62-L64 | ||
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_vendor/html5lib/treebuilders/base.py | python | Node.reparentChildren | (self, newParent) | Move all the children of the current node to newParent.
This is needed so that trees that don't store text as nodes move the
text in the correct way
:arg newParent: the node to move all this node's children to | Move all the children of the current node to newParent.
This is needed so that trees that don't store text as nodes move the
text in the correct way | [
"Move",
"all",
"the",
"children",
"of",
"the",
"current",
"node",
"to",
"newParent",
".",
"This",
"is",
"needed",
"so",
"that",
"trees",
"that",
"don",
"t",
"store",
"text",
"as",
"nodes",
"move",
"the",
"text",
"in",
"the",
"correct",
"way"
] | def reparentChildren(self, newParent):
"""Move all the children of the current node to newParent.
This is needed so that trees that don't store text as nodes move the
text in the correct way
:arg newParent: the node to move all this node's children to
"""
# XXX - should... | [
"def",
"reparentChildren",
"(",
"self",
",",
"newParent",
")",
":",
"# XXX - should this method be made more general?",
"for",
"child",
"in",
"self",
".",
"childNodes",
":",
"newParent",
".",
"appendChild",
"(",
"child",
")",
"self",
".",
"childNodes",
"=",
"[",
... | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/html5lib/treebuilders/base.py#L97-L108 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/home_connect/binary_sensor.py | python | HomeConnectBinarySensor.__init__ | (self, device, desc, sensor_type, device_class=None) | Initialize the entity. | Initialize the entity. | [
"Initialize",
"the",
"entity",
"."
] | def __init__(self, device, desc, sensor_type, device_class=None):
"""Initialize the entity."""
super().__init__(device, desc)
self._state = None
self._device_class = device_class
self._type = sensor_type
if self._type == "door":
self._update_key = BSH_DOOR_STA... | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"desc",
",",
"sensor_type",
",",
"device_class",
"=",
"None",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
",",
"desc",
")",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_device... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/home_connect/binary_sensor.py#L46-L63 | ||
readthedocs/readthedocs.org | 0852d7c10d725d954d3e9a93513171baa1116d9f | readthedocs/search/faceted_search.py | python | RTDFacetedSearch._is_advanced_query | (self, query) | return not tokens.isdisjoint(query_tokens) | Check if query looks like to be using the syntax from a simple query string.
.. note::
We don't check if the syntax is valid.
The tokens used aren't very common in a normal query, so checking if
the query contains any of them should be enough to determinate if
it's ... | Check if query looks like to be using the syntax from a simple query string. | [
"Check",
"if",
"query",
"looks",
"like",
"to",
"be",
"using",
"the",
"syntax",
"from",
"a",
"simple",
"query",
"string",
"."
] | def _is_advanced_query(self, query):
"""
Check if query looks like to be using the syntax from a simple query string.
.. note::
We don't check if the syntax is valid.
The tokens used aren't very common in a normal query, so checking if
the query contains any of... | [
"def",
"_is_advanced_query",
"(",
"self",
",",
"query",
")",
":",
"tokens",
"=",
"{",
"'+'",
",",
"'|'",
",",
"'-'",
",",
"'\"'",
",",
"'*'",
",",
"'('",
",",
"')'",
",",
"'~'",
"}",
"query_tokens",
"=",
"set",
"(",
"query",
")",
"return",
"not",
... | https://github.com/readthedocs/readthedocs.org/blob/0852d7c10d725d954d3e9a93513171baa1116d9f/readthedocs/search/faceted_search.py#L201-L218 | |
computationalprivacy/bandicoot | 86e5f192a67dff690a06f28ed2f7b1ffdd141efb | bandicoot/io.py | python | read_orange | (user_id, records_path, antennas_path=None,
attributes_path=None, recharges_path=None, network=False,
describe=True, warnings=True, errors=False) | return user | Load user records from a CSV file in *orange* format:
``call_record_type;basic_service;user_msisdn;call_partner_identity;datetime;call_duration;longitude;latitude``
``basic_service`` takes one of the following values:
- 11: telephony;
- 12: emergency calls;
- 21: short message (in)
- 22: shor... | Load user records from a CSV file in *orange* format: | [
"Load",
"user",
"records",
"from",
"a",
"CSV",
"file",
"in",
"*",
"orange",
"*",
"format",
":"
] | def read_orange(user_id, records_path, antennas_path=None,
attributes_path=None, recharges_path=None, network=False,
describe=True, warnings=True, errors=False):
"""
Load user records from a CSV file in *orange* format:
``call_record_type;basic_service;user_msisdn;call_partn... | [
"def",
"read_orange",
"(",
"user_id",
",",
"records_path",
",",
"antennas_path",
"=",
"None",
",",
"attributes_path",
"=",
"None",
",",
"recharges_path",
"=",
"None",
",",
"network",
"=",
"False",
",",
"describe",
"=",
"True",
",",
"warnings",
"=",
"True",
... | https://github.com/computationalprivacy/bandicoot/blob/86e5f192a67dff690a06f28ed2f7b1ffdd141efb/bandicoot/io.py#L607-L721 | |
conda/conda-build | 2a19925f2b2ca188f80ffa625cd783e7d403793f | conda_build/utils.py | python | sort_list_in_nested_structure | (dictionary, omissions='') | Recurse through a nested dictionary and sort any lists that are found.
If the list that is found contains anything but strings, it is skipped
as we can't compare lists containing different types. The omissions argument
allows for certain sections of the dictionary to be omitted from sorting. | Recurse through a nested dictionary and sort any lists that are found. | [
"Recurse",
"through",
"a",
"nested",
"dictionary",
"and",
"sort",
"any",
"lists",
"that",
"are",
"found",
"."
] | def sort_list_in_nested_structure(dictionary, omissions=''):
"""Recurse through a nested dictionary and sort any lists that are found.
If the list that is found contains anything but strings, it is skipped
as we can't compare lists containing different types. The omissions argument
allows for certain s... | [
"def",
"sort_list_in_nested_structure",
"(",
"dictionary",
",",
"omissions",
"=",
"''",
")",
":",
"for",
"field",
",",
"value",
"in",
"dictionary",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"for",
"key",
"in",
... | https://github.com/conda/conda-build/blob/2a19925f2b2ca188f80ffa625cd783e7d403793f/conda_build/utils.py#L1805-L1832 | ||
galaxyproject/galaxy | 4c03520f05062e0f4a1b3655dc0b7452fda69943 | lib/tool_shed/metadata/repository_metadata_manager.py | python | RepositoryMetadataManager.new_tool_dependency_metadata_required | (self, repository_metadata) | Compare the last saved metadata for each tool dependency in the repository with the new
metadata in self.metadata_dict to determine if a new repository_metadata table record is
required or if the last saved metadata record can be updated for tool_dependencies instead. | Compare the last saved metadata for each tool dependency in the repository with the new
metadata in self.metadata_dict to determine if a new repository_metadata table record is
required or if the last saved metadata record can be updated for tool_dependencies instead. | [
"Compare",
"the",
"last",
"saved",
"metadata",
"for",
"each",
"tool",
"dependency",
"in",
"the",
"repository",
"with",
"the",
"new",
"metadata",
"in",
"self",
".",
"metadata_dict",
"to",
"determine",
"if",
"a",
"new",
"repository_metadata",
"table",
"record",
... | def new_tool_dependency_metadata_required(self, repository_metadata):
"""
Compare the last saved metadata for each tool dependency in the repository with the new
metadata in self.metadata_dict to determine if a new repository_metadata table record is
required or if the last saved metadat... | [
"def",
"new_tool_dependency_metadata_required",
"(",
"self",
",",
"repository_metadata",
")",
":",
"if",
"repository_metadata",
":",
"metadata",
"=",
"repository_metadata",
".",
"metadata",
"if",
"metadata",
":",
"if",
"'tool_dependencies'",
"in",
"metadata",
":",
"sa... | https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/tool_shed/metadata/repository_metadata_manager.py#L671-L718 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/keystoneng.py | python | project_create | (auth=None, **kwargs) | return cloud.create_project(**kwargs) | Create a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_create name=project1
salt '*' keystoneng.project_create name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_create name=project3 enabled=False description='my project3' | Create a project | [
"Create",
"a",
"project"
] | def project_create(auth=None, **kwargs):
"""
Create a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_create name=project1
salt '*' keystoneng.project_create name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_create name=... | [
"def",
"project_create",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_openstack_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"keep_name",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/keystoneng.py#L235-L249 | |
Tencent/PocketFlow | 53b82cba5a34834400619e7c335a23995d45c2a6 | learners/uniform_quantization/utils.py | python | UniformQuantization.__safe_check | (self) | TODO: Check the name of bucket_type, the value of bucket_size | TODO: Check the name of bucket_type, the value of bucket_size | [
"TODO",
":",
"Check",
"the",
"name",
"of",
"bucket_type",
"the",
"value",
"of",
"bucket_size"
] | def __safe_check(self):
""" TODO: Check the name of bucket_type, the value of bucket_size """
if self.bucket_size < 0:
raise ValueError("Bucket size must be a postive integer")
if self.bucket_type != 'split' and self.bucket_type != 'channel':
raise ValueError("Unrecognized bucket type, must be ... | [
"def",
"__safe_check",
"(",
"self",
")",
":",
"if",
"self",
".",
"bucket_size",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"Bucket size must be a postive integer\"",
")",
"if",
"self",
".",
"bucket_type",
"!=",
"'split'",
"and",
"self",
".",
"bucket_type",
"... | https://github.com/Tencent/PocketFlow/blob/53b82cba5a34834400619e7c335a23995d45c2a6/learners/uniform_quantization/utils.py#L291-L297 | ||
david8862/keras-YOLOv3-model-set | e9f0f94109430973525219e66eeafe8a2f51363d | common/yolo_postprocess_np.py | python | yolo_decode | (prediction, anchors, num_classes, input_shape, scale_x_y=None, use_softmax=False) | return np.concatenate([box_xy, box_wh, objectness, class_scores], axis=2) | Decode final layer features to bounding box parameters. | Decode final layer features to bounding box parameters. | [
"Decode",
"final",
"layer",
"features",
"to",
"bounding",
"box",
"parameters",
"."
] | def yolo_decode(prediction, anchors, num_classes, input_shape, scale_x_y=None, use_softmax=False):
'''Decode final layer features to bounding box parameters.'''
batch_size = np.shape(prediction)[0]
num_anchors = len(anchors)
grid_shape = np.shape(prediction)[1:3]
#check if stride on height & width ... | [
"def",
"yolo_decode",
"(",
"prediction",
",",
"anchors",
",",
"num_classes",
",",
"input_shape",
",",
"scale_x_y",
"=",
"None",
",",
"use_softmax",
"=",
"False",
")",
":",
"batch_size",
"=",
"np",
".",
"shape",
"(",
"prediction",
")",
"[",
"0",
"]",
"num... | https://github.com/david8862/keras-YOLOv3-model-set/blob/e9f0f94109430973525219e66eeafe8a2f51363d/common/yolo_postprocess_np.py#L9-L67 | |
beetbox/beets | 2fea53c34dd505ba391cb345424e0613901c8025 | beetsplug/bucket.py | python | complete_year_spans | (spans) | Set the `to` value of spans if empty and sort them chronologically. | Set the `to` value of spans if empty and sort them chronologically. | [
"Set",
"the",
"to",
"value",
"of",
"spans",
"if",
"empty",
"and",
"sort",
"them",
"chronologically",
"."
] | def complete_year_spans(spans):
"""Set the `to` value of spans if empty and sort them chronologically.
"""
spans.sort(key=lambda x: x['from'])
for (x, y) in pairwise(spans):
if 'to' not in x:
x['to'] = y['from'] - 1
if spans and 'to' not in spans[-1]:
spans[-1]['to'] = da... | [
"def",
"complete_year_spans",
"(",
"spans",
")",
":",
"spans",
".",
"sort",
"(",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"'from'",
"]",
")",
"for",
"(",
"x",
",",
"y",
")",
"in",
"pairwise",
"(",
"spans",
")",
":",
"if",
"'to'",
"not",
"in",
... | https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beetsplug/bucket.py#L76-L84 | ||
c0rv4x/project-black | 2d3df00ba1b1453c99ec5a247793a74e11adba2a | black/workers/dirsearch/dirsearch_ext/thirdparty/requests/auth.py | python | _basic_auth_str | (username, password) | return authstr | Returns a Basic Auth string. | Returns a Basic Auth string. | [
"Returns",
"a",
"Basic",
"Auth",
"string",
"."
] | def _basic_auth_str(username, password):
"""Returns a Basic Auth string."""
authstr = 'Basic ' + to_native_string(
b64encode(('%s:%s' % (username, password)).encode('latin1')).strip()
)
return authstr | [
"def",
"_basic_auth_str",
"(",
"username",
",",
"password",
")",
":",
"authstr",
"=",
"'Basic '",
"+",
"to_native_string",
"(",
"b64encode",
"(",
"(",
"'%s:%s'",
"%",
"(",
"username",
",",
"password",
")",
")",
".",
"encode",
"(",
"'latin1'",
")",
")",
"... | https://github.com/c0rv4x/project-black/blob/2d3df00ba1b1453c99ec5a247793a74e11adba2a/black/workers/dirsearch/dirsearch_ext/thirdparty/requests/auth.py#L26-L33 | |
scrapinghub/spidermon | f2b21e45e70796f583bbb97f39b823c31d242b17 | spidermon/results/monitor.py | python | MonitorResult.monitors_passed_action_results | (self) | return self._step_monitors_passed.all_items | [] | def monitors_passed_action_results(self):
return self._step_monitors_passed.all_items | [
"def",
"monitors_passed_action_results",
"(",
"self",
")",
":",
"return",
"self",
".",
"_step_monitors_passed",
".",
"all_items"
] | https://github.com/scrapinghub/spidermon/blob/f2b21e45e70796f583bbb97f39b823c31d242b17/spidermon/results/monitor.py#L57-L58 | |||
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extractAutumnpondreflectionWordpressCom.py | python | extractAutumnpondreflectionWordpressCom | (item) | return False | Parser for 'autumnpondreflection.wordpress.com' | Parser for 'autumnpondreflection.wordpress.com' | [
"Parser",
"for",
"autumnpondreflection",
".",
"wordpress",
".",
"com"
] | def extractAutumnpondreflectionWordpressCom(item):
'''
Parser for 'autumnpondreflection.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('tgp', 'The Grand Princess', ... | [
"def",
"extractAutumnpondreflectionWordpressCom",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"\"previ... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractAutumnpondreflectionWordpressCom.py#L1-L21 | |
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/geometry/polygon.py | python | RegularPolygon.angles | (self) | return ret | Returns a dictionary with keys, the vertices of the Polygon,
and values, the interior angle at each vertex.
Examples
========
>>> from sympy import RegularPolygon, Point
>>> r = RegularPolygon(Point(0, 0), 5, 3)
>>> r.angles
{Point2D(-5/2, -5*sqrt(3)/2): pi/3,
... | Returns a dictionary with keys, the vertices of the Polygon,
and values, the interior angle at each vertex. | [
"Returns",
"a",
"dictionary",
"with",
"keys",
"the",
"vertices",
"of",
"the",
"Polygon",
"and",
"values",
"the",
"interior",
"angle",
"at",
"each",
"vertex",
"."
] | def angles(self):
"""
Returns a dictionary with keys, the vertices of the Polygon,
and values, the interior angle at each vertex.
Examples
========
>>> from sympy import RegularPolygon, Point
>>> r = RegularPolygon(Point(0, 0), 5, 3)
>>> r.angles
... | [
"def",
"angles",
"(",
"self",
")",
":",
"ret",
"=",
"{",
"}",
"ang",
"=",
"self",
".",
"interior_angle",
"for",
"v",
"in",
"self",
".",
"vertices",
":",
"ret",
"[",
"v",
"]",
"=",
"ang",
"return",
"ret"
] | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/geometry/polygon.py#L1821-L1840 | |
svinota/pyroute2 | d320acd67067206b4217bb862afdae23bcb55266 | pyroute2.ipdb/pr2modules/ipdb/routes.py | python | MPLSRoute.make_key | (cls, msg) | return ret | Construct from a netlink message a key that can be used
to locate the route in the table | Construct from a netlink message a key that can be used
to locate the route in the table | [
"Construct",
"from",
"a",
"netlink",
"message",
"a",
"key",
"that",
"can",
"be",
"used",
"to",
"locate",
"the",
"route",
"in",
"the",
"table"
] | def make_key(cls, msg):
'''
Construct from a netlink message a key that can be used
to locate the route in the table
'''
ret = None
if isinstance(msg, nlmsg):
ret = msg.get_attr('RTA_DST')
elif isinstance(msg, dict):
ret = msg.get('dst', No... | [
"def",
"make_key",
"(",
"cls",
",",
"msg",
")",
":",
"ret",
"=",
"None",
"if",
"isinstance",
"(",
"msg",
",",
"nlmsg",
")",
":",
"ret",
"=",
"msg",
".",
"get_attr",
"(",
"'RTA_DST'",
")",
"elif",
"isinstance",
"(",
"msg",
",",
"dict",
")",
":",
"... | https://github.com/svinota/pyroute2/blob/d320acd67067206b4217bb862afdae23bcb55266/pyroute2.ipdb/pr2modules/ipdb/routes.py#L781-L795 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/html5lib/serializer.py | python | serialize | (input, tree="etree", encoding=None, **serializer_opts) | return s.render(walker(input), encoding) | [] | def serialize(input, tree="etree", encoding=None, **serializer_opts):
# XXX: Should we cache this?
walker = treewalkers.getTreeWalker(tree)
s = HTMLSerializer(**serializer_opts)
return s.render(walker(input), encoding) | [
"def",
"serialize",
"(",
"input",
",",
"tree",
"=",
"\"etree\"",
",",
"encoding",
"=",
"None",
",",
"*",
"*",
"serializer_opts",
")",
":",
"# XXX: Should we cache this?",
"walker",
"=",
"treewalkers",
".",
"getTreeWalker",
"(",
"tree",
")",
"s",
"=",
"HTMLSe... | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/html5lib/serializer.py#L74-L78 | |||
twitter/zktraffic | 82db04d9aafa13f694d4f5c7265069db42c0307c | zktraffic/omni/omni_sniffer.py | python | OmniSniffer._is_packet_fle_initial | (self, packet) | return True | [] | def _is_packet_fle_initial(self, packet):
data = get_ip_packet(packet.load).data.data
proto, offset = read_long(data, 0)
if proto != FLE.Initial.PROTO_VER: return False
server_id, offset = read_long(data, offset)
if server_id < 0: return False
election_addr, offset = read_string(data, offset)... | [
"def",
"_is_packet_fle_initial",
"(",
"self",
",",
"packet",
")",
":",
"data",
"=",
"get_ip_packet",
"(",
"packet",
".",
"load",
")",
".",
"data",
".",
"data",
"proto",
",",
"offset",
"=",
"read_long",
"(",
"data",
",",
"0",
")",
"if",
"proto",
"!=",
... | https://github.com/twitter/zktraffic/blob/82db04d9aafa13f694d4f5c7265069db42c0307c/zktraffic/omni/omni_sniffer.py#L177-L192 | |||
snarfed/granary | ab085de2aef0cff8ac31a99b5e21443a249e8419 | granary/mastodon.py | python | Mastodon.status_url | (self, id) | return urllib.parse.urljoin(self.instance, f'/web/statuses/{id}') | Returns the local instance URL for a status with a given id. | Returns the local instance URL for a status with a given id. | [
"Returns",
"the",
"local",
"instance",
"URL",
"for",
"a",
"status",
"with",
"a",
"given",
"id",
"."
] | def status_url(self, id):
"""Returns the local instance URL for a status with a given id."""
return urllib.parse.urljoin(self.instance, f'/web/statuses/{id}') | [
"def",
"status_url",
"(",
"self",
",",
"id",
")",
":",
"return",
"urllib",
".",
"parse",
".",
"urljoin",
"(",
"self",
".",
"instance",
",",
"f'/web/statuses/{id}'",
")"
] | https://github.com/snarfed/granary/blob/ab085de2aef0cff8ac31a99b5e21443a249e8419/granary/mastodon.py#L750-L752 | |
GNS3/gns3-gui | da8adbaa18ab60e053af2a619efd468f4c8950f3 | gns3/modules/builtin/pages/cloud_configuration_page.py | python | CloudConfigurationPage._loadNetworkInterfaces | (self, interfaces) | Loads Ethernet and TAP interfaces. | Loads Ethernet and TAP interfaces. | [
"Loads",
"Ethernet",
"and",
"TAP",
"interfaces",
"."
] | def _loadNetworkInterfaces(self, interfaces):
"""
Loads Ethernet and TAP interfaces.
"""
self.uiEthernetComboBox.clear()
index = 0
for interface in interfaces:
if interface["type"] == "ethernet" and not interface["special"]:
self.uiEthernetCom... | [
"def",
"_loadNetworkInterfaces",
"(",
"self",
",",
"interfaces",
")",
":",
"self",
".",
"uiEthernetComboBox",
".",
"clear",
"(",
")",
"index",
"=",
"0",
"for",
"interface",
"in",
"interfaces",
":",
"if",
"interface",
"[",
"\"type\"",
"]",
"==",
"\"ethernet\"... | https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/modules/builtin/pages/cloud_configuration_page.py#L385-L403 | ||
YosaiProject/yosai | 7f96aa6b837ceae9bf3d7387cd7e35f5ab032575 | yosai/core/mgt/mgt.py | python | NativeSecurityManager.save | (self, subject) | Saves the subject's state to a persistent location for future reference.
This implementation merely delegates saving to the internal subject_store. | Saves the subject's state to a persistent location for future reference.
This implementation merely delegates saving to the internal subject_store. | [
"Saves",
"the",
"subject",
"s",
"state",
"to",
"a",
"persistent",
"location",
"for",
"future",
"reference",
".",
"This",
"implementation",
"merely",
"delegates",
"saving",
"to",
"the",
"internal",
"subject_store",
"."
] | def save(self, subject):
"""
Saves the subject's state to a persistent location for future reference.
This implementation merely delegates saving to the internal subject_store.
"""
self.subject_store.save(subject) | [
"def",
"save",
"(",
"self",
",",
"subject",
")",
":",
"self",
".",
"subject_store",
".",
"save",
"(",
"subject",
")"
] | https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/core/mgt/mgt.py#L723-L728 | ||
prody/ProDy | b24bbf58aa8fffe463c8548ae50e3955910e5b7f | prody/ensemble/conformation.py | python | Conformation.getDeviations | (self) | Returns deviations from the ensemble reference coordinates.
Deviations are calculated for (selected) atoms. | Returns deviations from the ensemble reference coordinates.
Deviations are calculated for (selected) atoms. | [
"Returns",
"deviations",
"from",
"the",
"ensemble",
"reference",
"coordinates",
".",
"Deviations",
"are",
"calculated",
"for",
"(",
"selected",
")",
"atoms",
"."
] | def getDeviations(self):
"""Returns deviations from the ensemble reference coordinates.
Deviations are calculated for (selected) atoms."""
ensemble = self._ensemble
if ensemble._confs is None:
return None
indices = ensemble._indices
if indices is None:
... | [
"def",
"getDeviations",
"(",
"self",
")",
":",
"ensemble",
"=",
"self",
".",
"_ensemble",
"if",
"ensemble",
".",
"_confs",
"is",
"None",
":",
"return",
"None",
"indices",
"=",
"ensemble",
".",
"_indices",
"if",
"indices",
"is",
"None",
":",
"return",
"en... | https://github.com/prody/ProDy/blob/b24bbf58aa8fffe463c8548ae50e3955910e5b7f/prody/ensemble/conformation.py#L122-L134 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/crypto/block_cipher/miniaes.py | python | MiniAES.encrypt | (self, P, key) | return ciphertext | r"""
Use Phan's Mini-AES to encrypt the plaintext ``P`` with the secret
key ``key``. Both ``P`` and ``key`` must be `2 \times 2` matrices
over the finite field `\GF{2^4}`. Let `\gamma` denote the
operation of nibble-sub, `\pi` denote shift-row, `\theta` denote
mix-column, and `\s... | r"""
Use Phan's Mini-AES to encrypt the plaintext ``P`` with the secret
key ``key``. Both ``P`` and ``key`` must be `2 \times 2` matrices
over the finite field `\GF{2^4}`. Let `\gamma` denote the
operation of nibble-sub, `\pi` denote shift-row, `\theta` denote
mix-column, and `\s... | [
"r",
"Use",
"Phan",
"s",
"Mini",
"-",
"AES",
"to",
"encrypt",
"the",
"plaintext",
"P",
"with",
"the",
"secret",
"key",
"key",
".",
"Both",
"P",
"and",
"key",
"must",
"be",
"2",
"\\",
"times",
"2",
"matrices",
"over",
"the",
"finite",
"field",
"\\",
... | def encrypt(self, P, key):
r"""
Use Phan's Mini-AES to encrypt the plaintext ``P`` with the secret
key ``key``. Both ``P`` and ``key`` must be `2 \times 2` matrices
over the finite field `\GF{2^4}`. Let `\gamma` denote the
operation of nibble-sub, `\pi` denote shift-row, `\theta`... | [
"def",
"encrypt",
"(",
"self",
",",
"P",
",",
"key",
")",
":",
"if",
"not",
"isinstance",
"(",
"P",
",",
"Matrix_dense",
")",
"or",
"not",
"(",
"P",
".",
"base_ring",
"(",
")",
".",
"order",
"(",
")",
"==",
"16",
"and",
"P",
".",
"base_ring",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/crypto/block_cipher/miniaes.py#L740-L899 | |
dtmilano/AndroidViewClient | 421b86e3f1a57683557fc0173951cd0332ab43f4 | src/com/dtmilano/android/adb/adbclient.py | python | AdbClient.startActivity | (self, component=None, flags=None, uri=None, package=None) | Starts an Activity.
If package is specified instead of component the corresponding MAIN activity for the package
will be resolved and used. | Starts an Activity.
If package is specified instead of component the corresponding MAIN activity for the package
will be resolved and used. | [
"Starts",
"an",
"Activity",
".",
"If",
"package",
"is",
"specified",
"instead",
"of",
"component",
"the",
"corresponding",
"MAIN",
"activity",
"for",
"the",
"package",
"will",
"be",
"resolved",
"and",
"used",
"."
] | def startActivity(self, component=None, flags=None, uri=None, package=None):
"""
Starts an Activity.
If package is specified instead of component the corresponding MAIN activity for the package
will be resolved and used.
"""
self.__checkTransport()
cmd = 'am start... | [
"def",
"startActivity",
"(",
"self",
",",
"component",
"=",
"None",
",",
"flags",
"=",
"None",
",",
"uri",
"=",
"None",
",",
"package",
"=",
"None",
")",
":",
"self",
".",
"__checkTransport",
"(",
")",
"cmd",
"=",
"'am start'",
"if",
"package",
"and",
... | https://github.com/dtmilano/AndroidViewClient/blob/421b86e3f1a57683557fc0173951cd0332ab43f4/src/com/dtmilano/android/adb/adbclient.py#L787-L811 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/coretype/tree.py | python | TreeNode.convert_to_ultrametric | (self, tree_length=None, strategy='balanced') | .. versionadded: 2.1
Converts a tree into ultrametric topology (all leaves must have
the same distance to root). Note that, for visual inspection
of ultrametric trees, node.img_style["size"] should be set to
0. | .. versionadded: 2.1 | [
"..",
"versionadded",
":",
"2",
".",
"1"
] | def convert_to_ultrametric(self, tree_length=None, strategy='balanced'):
"""
.. versionadded: 2.1
Converts a tree into ultrametric topology (all leaves must have
the same distance to root). Note that, for visual inspection
of ultrametric trees, node.img_style["size"] should be s... | [
"def",
"convert_to_ultrametric",
"(",
"self",
",",
"tree_length",
"=",
"None",
",",
"strategy",
"=",
"'balanced'",
")",
":",
"# Could something like this replace the old algorithm?",
"#most_distant_leaf, tree_length = self.get_farthest_leaf()",
"#for leaf in self:",
"# d = leaf.... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/coretype/tree.py#L2084-L2129 | ||
spotify/luigi | c3b66f4a5fa7eaa52f9a72eb6704b1049035c789 | luigi/task_register.py | python | Register._missing_task_msg | (cls, task_name) | [] | def _missing_task_msg(cls, task_name):
weighted_tasks = [(Register._editdistance(task_name, task_name_2), task_name_2) for task_name_2 in cls.task_names()]
ordered_tasks = sorted(weighted_tasks, key=lambda pair: pair[0])
candidates = [task for (dist, task) in ordered_tasks if dist <= 5 and dist ... | [
"def",
"_missing_task_msg",
"(",
"cls",
",",
"task_name",
")",
":",
"weighted_tasks",
"=",
"[",
"(",
"Register",
".",
"_editdistance",
"(",
"task_name",
",",
"task_name_2",
")",
",",
"task_name_2",
")",
"for",
"task_name_2",
"in",
"cls",
".",
"task_names",
"... | https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/task_register.py#L215-L222 | ||||
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/html5lib/_inputstream.py | python | lookupEncoding | (encoding) | Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding. | Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding. | [
"Return",
"the",
"python",
"codec",
"name",
"corresponding",
"to",
"an",
"encoding",
"or",
"None",
"if",
"the",
"string",
"doesn",
"t",
"correspond",
"to",
"a",
"valid",
"encoding",
"."
] | def lookupEncoding(encoding):
"""Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding."""
if isinstance(encoding, binary_type):
try:
encoding = encoding.decode("ascii")
except UnicodeDecodeError:
return... | [
"def",
"lookupEncoding",
"(",
"encoding",
")",
":",
"if",
"isinstance",
"(",
"encoding",
",",
"binary_type",
")",
":",
"try",
":",
"encoding",
"=",
"encoding",
".",
"decode",
"(",
"\"ascii\"",
")",
"except",
"UnicodeDecodeError",
":",
"return",
"None",
"if",... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/html5lib/_inputstream.py#L908-L923 | ||
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/nqg/model/induction/induction_utils.py | python | _example_to_rule | (source_str, target_str) | return qcfg_rule.QCFGRule(
tuple(source_str.split()), tuple(target_str.split()), arity=0) | Convert (source, target) example to a QCFGRule. | Convert (source, target) example to a QCFGRule. | [
"Convert",
"(",
"source",
"target",
")",
"example",
"to",
"a",
"QCFGRule",
"."
] | def _example_to_rule(source_str, target_str):
"""Convert (source, target) example to a QCFGRule."""
return qcfg_rule.QCFGRule(
tuple(source_str.split()), tuple(target_str.split()), arity=0) | [
"def",
"_example_to_rule",
"(",
"source_str",
",",
"target_str",
")",
":",
"return",
"qcfg_rule",
".",
"QCFGRule",
"(",
"tuple",
"(",
"source_str",
".",
"split",
"(",
")",
")",
",",
"tuple",
"(",
"target_str",
".",
"split",
"(",
")",
")",
",",
"arity",
... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/nqg/model/induction/induction_utils.py#L229-L232 | |
daoluan/decode-Django | d46a858b45b56de48b0355f50dd9e45402d04cfd | Django-1.5.1/django/views/i18n.py | python | null_javascript_catalog | (request, domain=None, packages=None) | return http.HttpResponse(''.join(src), 'text/javascript') | Returns "identity" versions of the JavaScript i18n functions -- i.e.,
versions that don't actually do anything. | Returns "identity" versions of the JavaScript i18n functions -- i.e.,
versions that don't actually do anything. | [
"Returns",
"identity",
"versions",
"of",
"the",
"JavaScript",
"i18n",
"functions",
"--",
"i",
".",
"e",
".",
"versions",
"that",
"don",
"t",
"actually",
"do",
"anything",
"."
] | def null_javascript_catalog(request, domain=None, packages=None):
"""
Returns "identity" versions of the JavaScript i18n functions -- i.e.,
versions that don't actually do anything.
"""
src = [NullSource, InterPolate, LibFormatHead, get_formats(), LibFormatFoot]
return http.HttpResponse(''.join(... | [
"def",
"null_javascript_catalog",
"(",
"request",
",",
"domain",
"=",
"None",
",",
"packages",
"=",
"None",
")",
":",
"src",
"=",
"[",
"NullSource",
",",
"InterPolate",
",",
"LibFormatHead",
",",
"get_formats",
"(",
")",
",",
"LibFormatFoot",
"]",
"return",
... | https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/views/i18n.py#L165-L171 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/crystals/kirillov_reshetikhin.py | python | KR_type_C.classical_decomposition | (self) | return CrystalOfTableaux(self.cartan_type().classical(),
shapes=horizontal_dominoes_removed(self.r(), self.s())) | r"""
Return the classical crystal underlying the Kirillov-Reshetikhin
crystal of type `C_n^{(1)}`.
It is given by `B^{r,s} \cong \bigoplus_{\Lambda} B(\Lambda)`,
where `\Lambda` are weights obtained from a rectangle of width `s`
and height `r` by removing horizontal dominoes. He... | r"""
Return the classical crystal underlying the Kirillov-Reshetikhin
crystal of type `C_n^{(1)}`. | [
"r",
"Return",
"the",
"classical",
"crystal",
"underlying",
"the",
"Kirillov",
"-",
"Reshetikhin",
"crystal",
"of",
"type",
"C_n^",
"{",
"(",
"1",
")",
"}",
"."
] | def classical_decomposition(self):
r"""
Return the classical crystal underlying the Kirillov-Reshetikhin
crystal of type `C_n^{(1)}`.
It is given by `B^{r,s} \cong \bigoplus_{\Lambda} B(\Lambda)`,
where `\Lambda` are weights obtained from a rectangle of width `s`
and hei... | [
"def",
"classical_decomposition",
"(",
"self",
")",
":",
"return",
"CrystalOfTableaux",
"(",
"self",
".",
"cartan_type",
"(",
")",
".",
"classical",
"(",
")",
",",
"shapes",
"=",
"horizontal_dominoes_removed",
"(",
"self",
".",
"r",
"(",
")",
",",
"self",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/crystals/kirillov_reshetikhin.py#L1319-L1336 | |
brechtm/rinohtype | d03096f9b1b0ba2d821a25356d84dc6d3028c96c | src/rinoh/text.py | python | StyledText.y_offset | (self, container) | return offset | Vertical baseline offset (up is positive). | Vertical baseline offset (up is positive). | [
"Vertical",
"baseline",
"offset",
"(",
"up",
"is",
"positive",
")",
"."
] | def y_offset(self, container):
"""Vertical baseline offset (up is positive)."""
offset = (self.parent.y_offset(container)
if hasattr(self.parent, 'y_offset') else 0)
if self.is_script(container):
position = self.get_style('position', container)
offset +=... | [
"def",
"y_offset",
"(",
"self",
",",
"container",
")",
":",
"offset",
"=",
"(",
"self",
".",
"parent",
".",
"y_offset",
"(",
"container",
")",
"if",
"hasattr",
"(",
"self",
".",
"parent",
",",
"'y_offset'",
")",
"else",
"0",
")",
"if",
"self",
".",
... | https://github.com/brechtm/rinohtype/blob/d03096f9b1b0ba2d821a25356d84dc6d3028c96c/src/rinoh/text.py#L300-L307 | |
cbrgm/telegram-robot-rss | 58fe98de427121fdc152c8df0721f1891174e6c9 | venv/lib/python2.7/site-packages/setuptools/command/build_py.py | python | build_py.check_package | (self, package, package_dir) | return init_py | Check namespace packages' __init__ for declare_namespace | Check namespace packages' __init__ for declare_namespace | [
"Check",
"namespace",
"packages",
"__init__",
"for",
"declare_namespace"
] | def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
return self.packages_checked[package]
except KeyError:
pass
init_py = orig.build_py.check_package(self, package, package_dir)
self.packages_... | [
"def",
"check_package",
"(",
"self",
",",
"package",
",",
"package_dir",
")",
":",
"try",
":",
"return",
"self",
".",
"packages_checked",
"[",
"package",
"]",
"except",
"KeyError",
":",
"pass",
"init_py",
"=",
"orig",
".",
"build_py",
".",
"check_package",
... | https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/setuptools/command/build_py.py#L156-L184 | |
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/parser/rdp/orders/primary.py | python | MultiScrBlt.__init__ | (self, ctx: PrimaryContext) | [] | def __init__(self, ctx: PrimaryContext):
self.ctx = ctx
self.nLeftRect = 0
self.nTopRect = 0
self.nWidth = 0
self.nHeight = 0
self.bRop = 0
self.nXSrc = 0
self.nYSrc = 0
self.numRectangles = 0
self.cbData = 0
self.rectangles = [] | [
"def",
"__init__",
"(",
"self",
",",
"ctx",
":",
"PrimaryContext",
")",
":",
"self",
".",
"ctx",
"=",
"ctx",
"self",
".",
"nLeftRect",
"=",
"0",
"self",
".",
"nTopRect",
"=",
"0",
"self",
".",
"nWidth",
"=",
"0",
"self",
".",
"nHeight",
"=",
"0",
... | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/parser/rdp/orders/primary.py#L724-L736 | ||||
airbnb/streamalert | 26cf1d08432ca285fd4f7410511a6198ca104bbb | streamalert/shared/lookup_tables/core.py | python | LookupTablesCore.get | (self, table_name, key, default=None) | return self.get_table(table_name).get(key, default) | Syntax sugar for get_table().get()
Params:
table_name (str)
key (str)
default (mixed)
Returns:
mixed | Syntax sugar for get_table().get() | [
"Syntax",
"sugar",
"for",
"get_table",
"()",
".",
"get",
"()"
] | def get(self, table_name, key, default=None):
"""
Syntax sugar for get_table().get()
Params:
table_name (str)
key (str)
default (mixed)
Returns:
mixed
"""
return self.get_table(table_name).get(key, default) | [
"def",
"get",
"(",
"self",
",",
"table_name",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"return",
"self",
".",
"get_table",
"(",
"table_name",
")",
".",
"get",
"(",
"key",
",",
"default",
")"
] | https://github.com/airbnb/streamalert/blob/26cf1d08432ca285fd4f7410511a6198ca104bbb/streamalert/shared/lookup_tables/core.py#L141-L153 | |
wangheda/youtube-8m | 07e54b387ee027cb58b0c14f5eb7c88cfa516d58 | youtube-8m-wangheda/eval_util.py | python | EvaluationMetrics.clear | (self) | Clear the evaluation metrics and reset the EvaluationMetrics object. | Clear the evaluation metrics and reset the EvaluationMetrics object. | [
"Clear",
"the",
"evaluation",
"metrics",
"and",
"reset",
"the",
"EvaluationMetrics",
"object",
"."
] | def clear(self):
"""Clear the evaluation metrics and reset the EvaluationMetrics object."""
self.sum_hit_at_one = 0.0
self.sum_perr = 0.0
self.sum_loss = 0.0
self.map_calculator.clear()
self.global_ap_calculator.clear()
self.num_examples = 0 | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"sum_hit_at_one",
"=",
"0.0",
"self",
".",
"sum_perr",
"=",
"0.0",
"self",
".",
"sum_loss",
"=",
"0.0",
"self",
".",
"map_calculator",
".",
"clear",
"(",
")",
"self",
".",
"global_ap_calculator",
".",
... | https://github.com/wangheda/youtube-8m/blob/07e54b387ee027cb58b0c14f5eb7c88cfa516d58/youtube-8m-wangheda/eval_util.py#L247-L254 | ||
jaywink/socialhome | c3178b044936a5c57a502ab6ed2b4f43c8e076ca | socialhome/contrib/sites/migrations/0002_set_site_domain_and_name.py | python | update_site_forward | (apps, schema_editor) | Set site domain and name. | Set site domain and name. | [
"Set",
"site",
"domain",
"and",
"name",
"."
] | def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID,
defaults={
"domain": "socialhome.network",
"name": "Socialhome"
}
) | [
"def",
"update_site_forward",
"(",
"apps",
",",
"schema_editor",
")",
":",
"Site",
"=",
"apps",
".",
"get_model",
"(",
"\"sites\"",
",",
"\"Site\"",
")",
"Site",
".",
"objects",
".",
"update_or_create",
"(",
"id",
"=",
"settings",
".",
"SITE_ID",
",",
"def... | https://github.com/jaywink/socialhome/blob/c3178b044936a5c57a502ab6ed2b4f43c8e076ca/socialhome/contrib/sites/migrations/0002_set_site_domain_and_name.py#L14-L23 | ||
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/mail/maildir.py | python | MaildirMailbox.appendMessage | (self, txt) | return result | Appends a message into the mailbox.
@param txt: A C{str} or file-like object giving the message to append.
@return: A L{Deferred} which fires when the message has been appended to
the mailbox. | Appends a message into the mailbox. | [
"Appends",
"a",
"message",
"into",
"the",
"mailbox",
"."
] | def appendMessage(self, txt):
"""
Appends a message into the mailbox.
@param txt: A C{str} or file-like object giving the message to append.
@return: A L{Deferred} which fires when the message has been appended to
the mailbox.
"""
task = self.AppendFactory(s... | [
"def",
"appendMessage",
"(",
"self",
",",
"txt",
")",
":",
"task",
"=",
"self",
".",
"AppendFactory",
"(",
"self",
",",
"txt",
")",
"result",
"=",
"task",
".",
"defer",
"task",
".",
"startUp",
"(",
")",
"return",
"result"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/mail/maildir.py#L344-L356 | |
wangheda/youtube-8m | 07e54b387ee027cb58b0c14f5eb7c88cfa516d58 | youtube-8m-zhangteng/frame_level_models.py | python | LstmMultiscale3Model.rnn_standard | (self, model_input, lstm_size, num_frames,sub_scope="", **unused_params) | return state_out | Creates a model which uses a stack of LSTMs to represent the video.
Args:
model_input: A 'batch_size' x 'max_frames' x 'num_features' matrix of
input features.
vocab_size: The number of classes in the dataset.
num_frames: A vector of length 'batch' which ind... | Creates a model which uses a stack of LSTMs to represent the video. | [
"Creates",
"a",
"model",
"which",
"uses",
"a",
"stack",
"of",
"LSTMs",
"to",
"represent",
"the",
"video",
"."
] | def rnn_standard(self, model_input, lstm_size, num_frames,sub_scope="", **unused_params):
"""Creates a model which uses a stack of LSTMs to represent the video.
Args:
model_input: A 'batch_size' x 'max_frames' x 'num_features' matrix of
input features.
vocab_s... | [
"def",
"rnn_standard",
"(",
"self",
",",
"model_input",
",",
"lstm_size",
",",
"num_frames",
",",
"sub_scope",
"=",
"\"\"",
",",
"*",
"*",
"unused_params",
")",
":",
"## Batch normalize the input",
"stacked_lstm",
"=",
"tf",
".",
"contrib",
".",
"rnn",
".",
... | https://github.com/wangheda/youtube-8m/blob/07e54b387ee027cb58b0c14f5eb7c88cfa516d58/youtube-8m-zhangteng/frame_level_models.py#L3523-L3554 | |
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/logging/observers.py | python | MCSLogger.onPDUReceived | (self, pdu: MCSPDU) | [] | def onPDUReceived(self, pdu: MCSPDU):
if pdu.header in [MCSPDUType.SEND_DATA_REQUEST, MCSPDUType.SEND_DATA_INDICATION]:
self.log.debug("Received %(type)s", {"type": pdu.header})
else:
self.logPDU(pdu)
super().onPDUReceived(pdu) | [
"def",
"onPDUReceived",
"(",
"self",
",",
"pdu",
":",
"MCSPDU",
")",
":",
"if",
"pdu",
".",
"header",
"in",
"[",
"MCSPDUType",
".",
"SEND_DATA_REQUEST",
",",
"MCSPDUType",
".",
"SEND_DATA_INDICATION",
"]",
":",
"self",
".",
"log",
".",
"debug",
"(",
"\"R... | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/logging/observers.py#L53-L59 | ||||
RaRe-Technologies/gensim | 8b8203d8df354673732dff635283494a33d0d422 | gensim/models/word2vec.py | python | Word2Vec.score | (self, sentences, total_sentences=int(1e6), chunksize=100, queue_factor=2, report_delay=1) | return sentence_scores[:sentence_count] | Score the log probability for a sequence of sentences.
This does not change the fitted model in any way (see :meth:`~gensim.models.word2vec.Word2Vec.train` for that).
Gensim has currently only implemented score for the hierarchical softmax scheme,
so you need to have run word2vec with `hs=1` an... | Score the log probability for a sequence of sentences.
This does not change the fitted model in any way (see :meth:`~gensim.models.word2vec.Word2Vec.train` for that). | [
"Score",
"the",
"log",
"probability",
"for",
"a",
"sequence",
"of",
"sentences",
".",
"This",
"does",
"not",
"change",
"the",
"fitted",
"model",
"in",
"any",
"way",
"(",
"see",
":",
"meth",
":",
"~gensim",
".",
"models",
".",
"word2vec",
".",
"Word2Vec",... | def score(self, sentences, total_sentences=int(1e6), chunksize=100, queue_factor=2, report_delay=1):
"""Score the log probability for a sequence of sentences.
This does not change the fitted model in any way (see :meth:`~gensim.models.word2vec.Word2Vec.train` for that).
Gensim has currently onl... | [
"def",
"score",
"(",
"self",
",",
"sentences",
",",
"total_sentences",
"=",
"int",
"(",
"1e6",
")",
",",
"chunksize",
"=",
"100",
",",
"queue_factor",
"=",
"2",
",",
"report_delay",
"=",
"1",
")",
":",
"logger",
".",
"info",
"(",
"\"scoring sentences wit... | https://github.com/RaRe-Technologies/gensim/blob/8b8203d8df354673732dff635283494a33d0d422/gensim/models/word2vec.py#L1679-L1806 | |
chapmanb/bcbb | dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027 | nextgen/bcbio/variation/genotype.py | python | haplotype_caller | (align_bam, ref_file, config, dbsnp=None,
region=None, out_file=None) | return out_file | Call variation with GATK's HaplotypeCaller.
This requires the full non open-source version of GATK. | Call variation with GATK's HaplotypeCaller. | [
"Call",
"variation",
"with",
"GATK",
"s",
"HaplotypeCaller",
"."
] | def haplotype_caller(align_bam, ref_file, config, dbsnp=None,
region=None, out_file=None):
"""Call variation with GATK's HaplotypeCaller.
This requires the full non open-source version of GATK.
"""
broad_runner, params, out_file = \
_shared_gatk_call_prep(align_bams, ref_... | [
"def",
"haplotype_caller",
"(",
"align_bam",
",",
"ref_file",
",",
"config",
",",
"dbsnp",
"=",
"None",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"broad_runner",
",",
"params",
",",
"out_file",
"=",
"_shared_gatk_call_prep",
"(",
... | https://github.com/chapmanb/bcbb/blob/dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027/nextgen/bcbio/variation/genotype.py#L81-L100 | |
onaio/onadata | 89ad16744e8f247fb748219476f6ac295869a95f | onadata/libs/serializers/metadata_serializer.py | python | MetaDataSerializer.get_content_object | (self, validated_data) | Returns the validated 'xform' or 'project' or 'instance' ids being
linked to the metadata. | Returns the validated 'xform' or 'project' or 'instance' ids being
linked to the metadata. | [
"Returns",
"the",
"validated",
"xform",
"or",
"project",
"or",
"instance",
"ids",
"being",
"linked",
"to",
"the",
"metadata",
"."
] | def get_content_object(self, validated_data):
"""
Returns the validated 'xform' or 'project' or 'instance' ids being
linked to the metadata.
"""
if validated_data:
return (validated_data.get('xform') or
validated_data.get('project') or
... | [
"def",
"get_content_object",
"(",
"self",
",",
"validated_data",
")",
":",
"if",
"validated_data",
":",
"return",
"(",
"validated_data",
".",
"get",
"(",
"'xform'",
")",
"or",
"validated_data",
".",
"get",
"(",
"'project'",
")",
"or",
"validated_data",
".",
... | https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/libs/serializers/metadata_serializer.py#L211-L220 | ||
ntalekt/homeassistant | 8fb6da881564430a3324125ddc2bd43cb7c8680f | custom_components/hacs/operational/setup_actions/categories.py | python | _setup_extra_stores | () | Set up extra stores in HACS if enabled in Home Assistant. | Set up extra stores in HACS if enabled in Home Assistant. | [
"Set",
"up",
"extra",
"stores",
"in",
"HACS",
"if",
"enabled",
"in",
"Home",
"Assistant",
"."
] | def _setup_extra_stores():
"""Set up extra stores in HACS if enabled in Home Assistant."""
hacs = get_hacs()
hacs.log.debug("Starting setup task: Extra stores")
hacs.common.categories = set()
for category in ELEMENT_TYPES:
enable_category(hacs, HacsCategory(category))
if HacsCategory.PY... | [
"def",
"_setup_extra_stores",
"(",
")",
":",
"hacs",
"=",
"get_hacs",
"(",
")",
"hacs",
".",
"log",
".",
"debug",
"(",
"\"Starting setup task: Extra stores\"",
")",
"hacs",
".",
"common",
".",
"categories",
"=",
"set",
"(",
")",
"for",
"category",
"in",
"E... | https://github.com/ntalekt/homeassistant/blob/8fb6da881564430a3324125ddc2bd43cb7c8680f/custom_components/hacs/operational/setup_actions/categories.py#L8-L30 | ||
halcy/Mastodon.py | e9d2c3d53f7b1d371e5dc5bf47e5fe335b698c85 | mastodon/Mastodon.py | python | Mastodon.timeline_home | (self, max_id=None, min_id=None, since_id=None, limit=None) | return self.timeline('home', max_id=max_id, min_id=min_id,
since_id=since_id, limit=limit) | Fetch the logged-in users home timeline (i.e. followed users and self).
Returns a list of `toot dicts`_. | Fetch the logged-in users home timeline (i.e. followed users and self). | [
"Fetch",
"the",
"logged",
"-",
"in",
"users",
"home",
"timeline",
"(",
"i",
".",
"e",
".",
"followed",
"users",
"and",
"self",
")",
"."
] | def timeline_home(self, max_id=None, min_id=None, since_id=None, limit=None):
"""
Fetch the logged-in users home timeline (i.e. followed users and self).
Returns a list of `toot dicts`_.
"""
return self.timeline('home', max_id=max_id, min_id=min_id,
... | [
"def",
"timeline_home",
"(",
"self",
",",
"max_id",
"=",
"None",
",",
"min_id",
"=",
"None",
",",
"since_id",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"return",
"self",
".",
"timeline",
"(",
"'home'",
",",
"max_id",
"=",
"max_id",
",",
"min_... | https://github.com/halcy/Mastodon.py/blob/e9d2c3d53f7b1d371e5dc5bf47e5fe335b698c85/mastodon/Mastodon.py#L737-L744 | |
darxtrix/ptop | 653e969c9ac865e38b7235aa5d656b36ac1f9e0d | ptop/statistics/statistics.py | python | Statistics.generate | (self) | Generate the stats using the plugins list periodically | Generate the stats using the plugins list periodically | [
"Generate",
"the",
"stats",
"using",
"the",
"plugins",
"list",
"periodically"
] | def generate(self):
'''
Generate the stats using the plugins list periodically
'''
for sensor in self.plugins:
# update the sensors value periodically
job = ThreadJob(sensor.update,self.stop_event,self.sensor_refresh_rates[sensor]/1000)
job.start() | [
"def",
"generate",
"(",
"self",
")",
":",
"for",
"sensor",
"in",
"self",
".",
"plugins",
":",
"# update the sensors value periodically",
"job",
"=",
"ThreadJob",
"(",
"sensor",
".",
"update",
",",
"self",
".",
"stop_event",
",",
"self",
".",
"sensor_refresh_ra... | https://github.com/darxtrix/ptop/blob/653e969c9ac865e38b7235aa5d656b36ac1f9e0d/ptop/statistics/statistics.py#L29-L36 | ||
cleverhans-lab/cleverhans | e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d | cleverhans_v3.1.0/examples/RL-attack/train.py | python | parse_args | () | return parser.parse_args() | [] | def parse_args():
parser = argparse.ArgumentParser("DQN experiments for Atari games")
# Environment
parser.add_argument("--env", type=str, default="Pong", help="name of the game")
parser.add_argument("--seed", type=int, default=42, help="which seed to use")
# Core DQN parameters
parser.add_argum... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"\"DQN experiments for Atari games\"",
")",
"# Environment",
"parser",
".",
"add_argument",
"(",
"\"--env\"",
",",
"type",
"=",
"str",
",",
"default",
"=",
"\"Pong\"",
","... | https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans_v3.1.0/examples/RL-attack/train.py#L35-L154 | |||
plastex/plastex | af1628719b50cf25fbe80f16a3e100d566e9bc32 | plasTeX/__init__.py | python | Macro.postParse | (self, tex) | Do operations that must be done immediately after parsing arguments
Required Arguments:
tex -- the TeX instance containing the current context | Do operations that must be done immediately after parsing arguments | [
"Do",
"operations",
"that",
"must",
"be",
"done",
"immediately",
"after",
"parsing",
"arguments"
] | def postParse(self, tex):
"""
Do operations that must be done immediately after parsing arguments
Required Arguments:
tex -- the TeX instance containing the current context
"""
if self.counter:
try: secnumdepth = self.config['document']['sec-num-depth']
... | [
"def",
"postParse",
"(",
"self",
",",
"tex",
")",
":",
"if",
"self",
".",
"counter",
":",
"try",
":",
"secnumdepth",
"=",
"self",
".",
"config",
"[",
"'document'",
"]",
"[",
"'sec-num-depth'",
"]",
"except",
":",
"secnumdepth",
"=",
"10",
"if",
"secnum... | https://github.com/plastex/plastex/blob/af1628719b50cf25fbe80f16a3e100d566e9bc32/plasTeX/__init__.py#L570-L583 | ||
spl0k/supysonic | 62bad3b9878a1d22cf040f25dab0fa28a252ba38 | supysonic/config.py | python | IniConfig.__init__ | (self, paths) | [] | def __init__(self, paths):
super().__init__()
parser = RawConfigParser()
parser.read(paths)
for section in parser.sections():
options = {k: self.__try_parse(v) for k, v in parser.items(section)}
section = section.upper()
if hasattr(self, section):
... | [
"def",
"__init__",
"(",
"self",
",",
"paths",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"parser",
"=",
"RawConfigParser",
"(",
")",
"parser",
".",
"read",
"(",
"paths",
")",
"for",
"section",
"in",
"parser",
".",
"sections",
"(",
")",
... | https://github.com/spl0k/supysonic/blob/62bad3b9878a1d22cf040f25dab0fa28a252ba38/supysonic/config.py#L67-L80 | ||||
playframework/play1 | 0ecac3bc2421ae2dbec27a368bf671eda1c9cba5 | python/Lib/codecs.py | python | StreamReaderWriter.__init__ | (self, stream, Reader, Writer, errors='strict') | Creates a StreamReaderWriter instance.
stream must be a Stream-like object.
Reader, Writer must be factory functions or classes
providing the StreamReader, StreamWriter interface resp.
Error handling is done in the same way as defined for the
StreamWriter/R... | Creates a StreamReaderWriter instance. | [
"Creates",
"a",
"StreamReaderWriter",
"instance",
"."
] | def __init__(self, stream, Reader, Writer, errors='strict'):
""" Creates a StreamReaderWriter instance.
stream must be a Stream-like object.
Reader, Writer must be factory functions or classes
providing the StreamReader, StreamWriter interface resp.
Error hand... | [
"def",
"__init__",
"(",
"self",
",",
"stream",
",",
"Reader",
",",
"Writer",
",",
"errors",
"=",
"'strict'",
")",
":",
"self",
".",
"stream",
"=",
"stream",
"self",
".",
"reader",
"=",
"Reader",
"(",
"stream",
",",
"errors",
")",
"self",
".",
"writer... | https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/codecs.py#L666-L682 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_route.py | python | Yedit.separator | (self, inc_sep) | setter method for separator | setter method for separator | [
"setter",
"method",
"for",
"separator"
] | def separator(self, inc_sep):
''' setter method for separator '''
self._separator = inc_sep | [
"def",
"separator",
"(",
"self",
",",
"inc_sep",
")",
":",
"self",
".",
"_separator",
"=",
"inc_sep"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_route.py#L233-L235 | ||
vispy/vispy | 26256fdc2574259dd227022fbce0767cae4e244b | vispy/gloo/gl/pyopengl2.py | python | _patch | () | Monkey-patch pyopengl to fix a bug in glBufferSubData. | Monkey-patch pyopengl to fix a bug in glBufferSubData. | [
"Monkey",
"-",
"patch",
"pyopengl",
"to",
"fix",
"a",
"bug",
"in",
"glBufferSubData",
"."
] | def _patch():
"""Monkey-patch pyopengl to fix a bug in glBufferSubData."""
import sys
from OpenGL import GL
if sys.version_info > (3,):
buffersubdatafunc = GL.glBufferSubData
if hasattr(buffersubdatafunc, 'wrapperFunction'):
buffersubdatafunc = buffersubdatafunc.wrapperFuncti... | [
"def",
"_patch",
"(",
")",
":",
"import",
"sys",
"from",
"OpenGL",
"import",
"GL",
"if",
"sys",
".",
"version_info",
">",
"(",
"3",
",",
")",
":",
"buffersubdatafunc",
"=",
"GL",
".",
"glBufferSubData",
"if",
"hasattr",
"(",
"buffersubdatafunc",
",",
"'w... | https://github.com/vispy/vispy/blob/26256fdc2574259dd227022fbce0767cae4e244b/vispy/gloo/gl/pyopengl2.py#L18-L34 | ||
rucio/rucio | 6d0d358e04f5431f0b9a98ae40f31af0ddff4833 | lib/rucio/core/permission/generic_multi_vo.py | python | perm_approve_rule | (issuer, kwargs) | return False | Checks if an issuer can approve a replication rule.
:param issuer: Account identifier which issues the command.
:param kwargs: List of arguments for the action.
:returns: True if account is allowed to call the API call, otherwise False | Checks if an issuer can approve a replication rule. | [
"Checks",
"if",
"an",
"issuer",
"can",
"approve",
"a",
"replication",
"rule",
"."
] | def perm_approve_rule(issuer, kwargs):
"""
Checks if an issuer can approve a replication rule.
:param issuer: Account identifier which issues the command.
:param kwargs: List of arguments for the action.
:returns: True if account is allowed to call the API call, otherwise False
"""
if _is_r... | [
"def",
"perm_approve_rule",
"(",
"issuer",
",",
"kwargs",
")",
":",
"if",
"_is_root",
"(",
"issuer",
")",
"or",
"has_account_attribute",
"(",
"account",
"=",
"issuer",
",",
"key",
"=",
"'admin'",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/core/permission/generic_multi_vo.py#L478-L488 | |
DataBiosphere/toil | 2e148eee2114ece8dcc3ec8a83f36333266ece0d | src/toil/lib/retry.py | python | get_error_message | (e: Exception) | Get the error message string from a Boto 2 or 3 error, or compatible types.
Note that error message conditions also chack more than this; this function
does not fall back to the traceback for incompatible types. | Get the error message string from a Boto 2 or 3 error, or compatible types. | [
"Get",
"the",
"error",
"message",
"string",
"from",
"a",
"Boto",
"2",
"or",
"3",
"error",
"or",
"compatible",
"types",
"."
] | def get_error_message(e: Exception) -> str:
"""
Get the error message string from a Boto 2 or 3 error, or compatible types.
Note that error message conditions also chack more than this; this function
does not fall back to the traceback for incompatible types.
"""
if hasattr(e, 'error_message') ... | [
"def",
"get_error_message",
"(",
"e",
":",
"Exception",
")",
"->",
"str",
":",
"if",
"hasattr",
"(",
"e",
",",
"'error_message'",
")",
"and",
"isinstance",
"(",
"e",
".",
"error_message",
",",
"str",
")",
":",
"# A Boto 2 error",
"return",
"e",
".",
"err... | https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/src/toil/lib/retry.py#L349-L367 | ||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/setuptools/setuptools/_vendor/packaging/version.py | python | _BaseVersion.__lt__ | (self, other) | return self._compare(other, lambda s, o: s < o) | [] | def __lt__(self, other):
return self._compare(other, lambda s, o: s < o) | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"_compare",
"(",
"other",
",",
"lambda",
"s",
",",
"o",
":",
"s",
"<",
"o",
")"
] | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/setuptools/_vendor/packaging/version.py#L43-L44 | |||
otsaloma/gaupol | 6dec7826654d223c71a8d3279dcd967e95c46714 | gaupol/dialogs/spell_check.py | python | SpellCheckDialog._on_join_back_button_clicked | (self, *args) | Join the current word with the previous. | Join the current word with the previous. | [
"Join",
"the",
"current",
"word",
"with",
"the",
"previous",
"."
] | def _on_join_back_button_clicked(self, *args):
"""Join the current word with the previous."""
self._navigator.join_with_previous()
self._proceed() | [
"def",
"_on_join_back_button_clicked",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"_navigator",
".",
"join_with_previous",
"(",
")",
"self",
".",
"_proceed",
"(",
")"
] | https://github.com/otsaloma/gaupol/blob/6dec7826654d223c71a8d3279dcd967e95c46714/gaupol/dialogs/spell_check.py#L166-L169 | ||
deanishe/zothero | 5b057ef080ee730d82d5dd15e064d2a4730c2b11 | src/lib/workflow/workflow.py | python | Workflow.open_cachedir | (self) | Open the workflow's :attr:`cachedir` in Finder. | Open the workflow's :attr:`cachedir` in Finder. | [
"Open",
"the",
"workflow",
"s",
":",
"attr",
":",
"cachedir",
"in",
"Finder",
"."
] | def open_cachedir(self):
"""Open the workflow's :attr:`cachedir` in Finder."""
subprocess.call(['open', self.cachedir]) | [
"def",
"open_cachedir",
"(",
"self",
")",
":",
"subprocess",
".",
"call",
"(",
"[",
"'open'",
",",
"self",
".",
"cachedir",
"]",
")"
] | https://github.com/deanishe/zothero/blob/5b057ef080ee730d82d5dd15e064d2a4730c2b11/src/lib/workflow/workflow.py#L2644-L2646 | ||
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/python27/1.0/lib/difflib.py | python | SequenceMatcher.ratio | (self) | return _calculate_ratio(matches, len(self.a) + len(self.b)) | Return a measure of the sequences' similarity (float in [0,1]).
Where T is the total number of elements in both sequences, and
M is the number of matches, this is 2.0*M / T.
Note that this is 1 if the sequences are identical, and 0 if
they have nothing in common.
.ratio() is ex... | Return a measure of the sequences' similarity (float in [0,1]). | [
"Return",
"a",
"measure",
"of",
"the",
"sequences",
"similarity",
"(",
"float",
"in",
"[",
"0",
"1",
"]",
")",
"."
] | def ratio(self):
"""Return a measure of the sequences' similarity (float in [0,1]).
Where T is the total number of elements in both sequences, and
M is the number of matches, this is 2.0*M / T.
Note that this is 1 if the sequences are identical, and 0 if
they have nothing in com... | [
"def",
"ratio",
"(",
"self",
")",
":",
"matches",
"=",
"reduce",
"(",
"lambda",
"sum",
",",
"triple",
":",
"sum",
"+",
"triple",
"[",
"-",
"1",
"]",
",",
"self",
".",
"get_matching_blocks",
"(",
")",
",",
"0",
")",
"return",
"_calculate_ratio",
"(",
... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/difflib.py#L634-L658 | |
aaronportnoy/toolbag | 2d39457a7617b2f334d203d8c8cf88a5a25ef1fa | toolbag/agent/dbg/envi/registers.py | python | RegisterContext.setRegisterSnap | (self, snap) | Use this to bulk restore the register state.
NOTE: This may only be used under the assumption that the
RegisterContext has been initialized the same way
(like context switches in tracers, or emulaction snaps) | Use this to bulk restore the register state. | [
"Use",
"this",
"to",
"bulk",
"restore",
"the",
"register",
"state",
"."
] | def setRegisterSnap(self, snap):
"""
Use this to bulk restore the register state.
NOTE: This may only be used under the assumption that the
RegisterContext has been initialized the same way
(like context switches in tracers, or emulaction snaps)
"""
s... | [
"def",
"setRegisterSnap",
"(",
"self",
",",
"snap",
")",
":",
"self",
".",
"_rctx_vals",
"=",
"list",
"(",
"snap",
")"
] | https://github.com/aaronportnoy/toolbag/blob/2d39457a7617b2f334d203d8c8cf88a5a25ef1fa/toolbag/agent/dbg/envi/registers.py#L30-L38 | ||
bcbio/bcbio-nextgen | c80f9b6b1be3267d1f981b7035e3b72441d258f2 | bcbio/cwl/workflow.py | python | _get_variable | (vid, variables) | Retrieve an input variable from our existing pool of options. | Retrieve an input variable from our existing pool of options. | [
"Retrieve",
"an",
"input",
"variable",
"from",
"our",
"existing",
"pool",
"of",
"options",
"."
] | def _get_variable(vid, variables):
"""Retrieve an input variable from our existing pool of options.
"""
if isinstance(vid, six.string_types):
vid = get_base_id(vid)
else:
vid = _get_string_vid(vid)
for v in variables:
if vid == get_base_id(v["id"]):
return copy.de... | [
"def",
"_get_variable",
"(",
"vid",
",",
"variables",
")",
":",
"if",
"isinstance",
"(",
"vid",
",",
"six",
".",
"string_types",
")",
":",
"vid",
"=",
"get_base_id",
"(",
"vid",
")",
"else",
":",
"vid",
"=",
"_get_string_vid",
"(",
"vid",
")",
"for",
... | https://github.com/bcbio/bcbio-nextgen/blob/c80f9b6b1be3267d1f981b7035e3b72441d258f2/bcbio/cwl/workflow.py#L280-L290 | ||
lsbardel/python-stdnet | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 | stdnet/utils/fallbacks/_collections.py | python | OrderedDict.clear | (self) | [] | def clear(self):
self.__end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.__map = {} # key --> [key, prev, next]
dict.clear(self) | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"__end",
"=",
"end",
"=",
"[",
"]",
"end",
"+=",
"[",
"None",
",",
"end",
",",
"end",
"]",
"# sentinel node for doubly linked list",
"self",
".",
"__map",
"=",
"{",
"}",
"# key --> [key, prev, next]",
"... | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/fallbacks/_collections.py#L23-L27 | ||||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | __builtin__.py | python | set.intersection_update | (self, *other) | Update a set with the intersection of itself and other collections.
:type other: collections.Iterable[T]
:rtype: None | Update a set with the intersection of itself and other collections. | [
"Update",
"a",
"set",
"with",
"the",
"intersection",
"of",
"itself",
"and",
"other",
"collections",
"."
] | def intersection_update(self, *other):
"""Update a set with the intersection of itself and other collections.
:type other: collections.Iterable[T]
:rtype: None
"""
pass | [
"def",
"intersection_update",
"(",
"self",
",",
"*",
"other",
")",
":",
"pass"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/__builtin__.py#L2327-L2333 | ||
onaio/onadata | 89ad16744e8f247fb748219476f6ac295869a95f | onadata/libs/utils/export_builder.py | python | ExportBuilder.to_zipped_sav | (self, path, data, *args, **kwargs) | [] | def to_zipped_sav(self, path, data, *args, **kwargs):
total_records = kwargs.get('total_records')
def write_row(row, csv_writer, fields):
# replace character for osm fields
fields = [field.replace(':', '_') for field in fields]
sav_writer.writerow(
[e... | [
"def",
"to_zipped_sav",
"(",
"self",
",",
"path",
",",
"data",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"total_records",
"=",
"kwargs",
".",
"get",
"(",
"'total_records'",
")",
"def",
"write_row",
"(",
"row",
",",
"csv_writer",
",",
"fields... | https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/libs/utils/export_builder.py#L1192-L1267 | ||||
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/ec2/elb/loadbalancer.py | python | LoadBalancer.disable_cross_zone_load_balancing | (self) | return success | Turns off CrossZone Load Balancing for this ELB.
:rtype: bool
:return: True if successful, False if not. | Turns off CrossZone Load Balancing for this ELB. | [
"Turns",
"off",
"CrossZone",
"Load",
"Balancing",
"for",
"this",
"ELB",
"."
] | def disable_cross_zone_load_balancing(self):
"""
Turns off CrossZone Load Balancing for this ELB.
:rtype: bool
:return: True if successful, False if not.
"""
success = self.connection.modify_lb_attribute(
self.name, 'crossZoneLoadBalancing', False)
if... | [
"def",
"disable_cross_zone_load_balancing",
"(",
"self",
")",
":",
"success",
"=",
"self",
".",
"connection",
".",
"modify_lb_attribute",
"(",
"self",
".",
"name",
",",
"'crossZoneLoadBalancing'",
",",
"False",
")",
"if",
"success",
"and",
"self",
".",
"_attribu... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/ec2/elb/loadbalancer.py#L250-L261 | |
OpenMDAO/OpenMDAO-Framework | f2e37b7de3edeaaeb2d251b375917adec059db9b | openmdao.main/src/openmdao/main/interfaces.py | python | IContainer.contains | (path) | Return True if the child specified by the given dotted path
name is contained in this Container. | Return True if the child specified by the given dotted path
name is contained in this Container. | [
"Return",
"True",
"if",
"the",
"child",
"specified",
"by",
"the",
"given",
"dotted",
"path",
"name",
"is",
"contained",
"in",
"this",
"Container",
"."
] | def contains(path):
"""Return True if the child specified by the given dotted path
name is contained in this Container.
""" | [
"def",
"contains",
"(",
"path",
")",
":"
] | https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.main/src/openmdao/main/interfaces.py#L50-L53 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/rfc822.py | python | Message.__setitem__ | (self, name, value) | Set the value of a header.
Note: This is not a perfect inversion of __getitem__, because any
changed headers get stuck at the end of the raw-headers list rather
than where the altered header was. | Set the value of a header. | [
"Set",
"the",
"value",
"of",
"a",
"header",
"."
] | def __setitem__(self, name, value):
"""Set the value of a header.
Note: This is not a perfect inversion of __getitem__, because any
changed headers get stuck at the end of the raw-headers list rather
than where the altered header was.
"""
del self[name] # Won't fail if i... | [
"def",
"__setitem__",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"del",
"self",
"[",
"name",
"]",
"# Won't fail if it doesn't exist",
"self",
".",
"dict",
"[",
"name",
".",
"lower",
"(",
")",
"]",
"=",
"value",
"text",
"=",
"name",
"+",
"\": \""... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/rfc822.py#L390-L401 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/utils/jinja.py | python | ensure_sequence_filter | (data) | return data | Ensure sequenced data.
**sequence**
ensure that parsed data is a sequence
.. code-block:: jinja
{% set my_string = "foo" %}
{% set my_list = ["bar", ] %}
{% set my_dict = {"baz": "qux"} %}
{{ my_string|sequence|first }}
{{ my_list|sequence|first }}
{{... | Ensure sequenced data. | [
"Ensure",
"sequenced",
"data",
"."
] | def ensure_sequence_filter(data):
"""
Ensure sequenced data.
**sequence**
ensure that parsed data is a sequence
.. code-block:: jinja
{% set my_string = "foo" %}
{% set my_list = ["bar", ] %}
{% set my_dict = {"baz": "qux"} %}
{{ my_string|sequence|first }}
... | [
"def",
"ensure_sequence_filter",
"(",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"(",
"list",
",",
"tuple",
",",
"set",
",",
"dict",
")",
")",
":",
"return",
"[",
"data",
"]",
"return",
"data"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/utils/jinja.py#L287-L316 | |
modoboa/modoboa | 9065b7a5679fee149fc6f6f0e1760699c194cf89 | modoboa/core/apps.py | python | load_core_settings | () | Load core settings.
This function must be manually called (see :file:`urls.py`) in
order to load base settings. | Load core settings. | [
"Load",
"core",
"settings",
"."
] | def load_core_settings():
"""Load core settings.
This function must be manually called (see :file:`urls.py`) in
order to load base settings.
"""
from modoboa.parameters import tools as param_tools
from . import app_settings
from .api.v2 import serializers
param_tools.registry.add(
... | [
"def",
"load_core_settings",
"(",
")",
":",
"from",
"modoboa",
".",
"parameters",
"import",
"tools",
"as",
"param_tools",
"from",
".",
"import",
"app_settings",
"from",
".",
"api",
".",
"v2",
"import",
"serializers",
"param_tools",
".",
"registry",
".",
"add",... | https://github.com/modoboa/modoboa/blob/9065b7a5679fee149fc6f6f0e1760699c194cf89/modoboa/core/apps.py#L8-L23 | ||
django-oscar/django-oscar-accounts | 8a6dc3b42306979779f048b4d3ed0a9fd4a2f794 | src/oscar_accounts/core.py | python | redemptions_account | () | return Account.objects.get(name=names.REDEMPTIONS) | [] | def redemptions_account():
return Account.objects.get(name=names.REDEMPTIONS) | [
"def",
"redemptions_account",
"(",
")",
":",
"return",
"Account",
".",
"objects",
".",
"get",
"(",
"name",
"=",
"names",
".",
"REDEMPTIONS",
")"
] | https://github.com/django-oscar/django-oscar-accounts/blob/8a6dc3b42306979779f048b4d3ed0a9fd4a2f794/src/oscar_accounts/core.py#L8-L9 | |||
python/mypy | 17850b3bd77ae9efb5d21f656c4e4e05ac48d894 | mypy/memprofile.py | python | find_recursive_objects | (objs: List[object]) | Find additional objects referenced by objs and append them to objs.
We use this since gc.get_objects() does not return objects without pointers
in them such as strings. | Find additional objects referenced by objs and append them to objs. | [
"Find",
"additional",
"objects",
"referenced",
"by",
"objs",
"and",
"append",
"them",
"to",
"objs",
"."
] | def find_recursive_objects(objs: List[object]) -> None:
"""Find additional objects referenced by objs and append them to objs.
We use this since gc.get_objects() does not return objects without pointers
in them such as strings.
"""
seen = set(id(o) for o in objs)
def visit(o: object) -> None:
... | [
"def",
"find_recursive_objects",
"(",
"objs",
":",
"List",
"[",
"object",
"]",
")",
"->",
"None",
":",
"seen",
"=",
"set",
"(",
"id",
"(",
"o",
")",
"for",
"o",
"in",
"objs",
")",
"def",
"visit",
"(",
"o",
":",
"object",
")",
"->",
"None",
":",
... | https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/memprofile.py#L91-L119 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py | python | Tagger.tag | (self, **kwargs) | Add tags to the timer.
Arguments:
**kwargs: Each keyword is treated as a tag name, and the
value of the argument is the tag value. | Add tags to the timer. | [
"Add",
"tags",
"to",
"the",
"timer",
"."
] | def tag(self, **kwargs):
"""
Add tags to the timer.
Arguments:
**kwargs: Each keyword is treated as a tag name, and the
value of the argument is the tag value.
"""
self.added_tags.extend(list(kwargs.items())) | [
"def",
"tag",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"added_tags",
".",
"extend",
"(",
"list",
"(",
"kwargs",
".",
"items",
"(",
")",
")",
")"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py#L74-L82 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/customtreectrl.py | python | GenericTreeItem.SetHeight | (self, h) | Sets the item's height. Used internally.
:param integer `h`: an integer specifying the item's height, in pixels. | Sets the item's height. Used internally. | [
"Sets",
"the",
"item",
"s",
"height",
".",
"Used",
"internally",
"."
] | def SetHeight(self, h):
"""
Sets the item's height. Used internally.
:param integer `h`: an integer specifying the item's height, in pixels.
"""
self._height = h | [
"def",
"SetHeight",
"(",
"self",
",",
"h",
")",
":",
"self",
".",
"_height",
"=",
"h"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/customtreectrl.py#L1972-L1979 | ||
privacyidea/privacyidea | 9490c12ddbf77a34ac935b082d09eb583dfafa2c | privacyidea/lib/eventhandler/base.py | python | BaseEventHandler.check_condition | (self, options) | return True | Check if all conditions are met and if the action should be executed.
The the conditions are met, we return "True"
:return: True | Check if all conditions are met and if the action should be executed.
The the conditions are met, we return "True"
:return: True | [
"Check",
"if",
"all",
"conditions",
"are",
"met",
"and",
"if",
"the",
"action",
"should",
"be",
"executed",
".",
"The",
"the",
"conditions",
"are",
"met",
"we",
"return",
"True",
":",
"return",
":",
"True"
] | def check_condition(self, options):
"""
Check if all conditions are met and if the action should be executed.
The the conditions are met, we return "True"
:return: True
"""
g = options.get("g")
request = options.get("request")
response = options.get("respo... | [
"def",
"check_condition",
"(",
"self",
",",
"options",
")",
":",
"g",
"=",
"options",
".",
"get",
"(",
"\"g\"",
")",
"request",
"=",
"options",
".",
"get",
"(",
"\"request\"",
")",
"response",
"=",
"options",
".",
"get",
"(",
"\"response\"",
")",
"e_ha... | https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/lib/eventhandler/base.py#L364-L604 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/core/common.py | python | _lcd_dtypes | (a_dtype, b_dtype) | return np.object | return the lcd dtype to hold these types | return the lcd dtype to hold these types | [
"return",
"the",
"lcd",
"dtype",
"to",
"hold",
"these",
"types"
] | def _lcd_dtypes(a_dtype, b_dtype):
""" return the lcd dtype to hold these types """
if is_datetime64_dtype(a_dtype) or is_datetime64_dtype(b_dtype):
return _NS_DTYPE
elif is_timedelta64_dtype(a_dtype) or is_timedelta64_dtype(b_dtype):
return _TD_DTYPE
elif is_complex_dtype(a_dtype):
... | [
"def",
"_lcd_dtypes",
"(",
"a_dtype",
",",
"b_dtype",
")",
":",
"if",
"is_datetime64_dtype",
"(",
"a_dtype",
")",
"or",
"is_datetime64_dtype",
"(",
"b_dtype",
")",
":",
"return",
"_NS_DTYPE",
"elif",
"is_timedelta64_dtype",
"(",
"a_dtype",
")",
"or",
"is_timedel... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/core/common.py#L1328-L1353 | |
alibaba/iOSSecAudit | f94ed3254263f3382f374e3f05afae8a1fe79f20 | lib/taskutil.py | python | TaskUtil.resign_ipa | (self, ipa_path, entitlements_path, mobileprovision_path, identity, sign_file=None) | [] | def resign_ipa(self, ipa_path, entitlements_path, mobileprovision_path, identity, sign_file=None):
""""""
G.log(G.INFO, 'Starting resign ipa file')
new_ipa_path = LocalUtils().resign_ipa(os.path.abspath(os.path.expanduser(ipa_path)),
os.path.... | [
"def",
"resign_ipa",
"(",
"self",
",",
"ipa_path",
",",
"entitlements_path",
",",
"mobileprovision_path",
",",
"identity",
",",
"sign_file",
"=",
"None",
")",
":",
"G",
".",
"log",
"(",
"G",
".",
"INFO",
",",
"'Starting resign ipa file'",
")",
"new_ipa_path",
... | https://github.com/alibaba/iOSSecAudit/blob/f94ed3254263f3382f374e3f05afae8a1fe79f20/lib/taskutil.py#L1152-L1166 | ||||
briis/unifiprotect | 578427a79974ddfec397d3d9e4c2a4a425e965b5 | custom_components/unifiprotect/entity.py | python | ProtectDeviceEntity.async_update | (self) | Update the entity.
Only used by the generic entity update service. | Update the entity. | [
"Update",
"the",
"entity",
"."
] | async def async_update(self) -> None:
"""Update the entity.
Only used by the generic entity update service.
"""
await self.data.async_refresh() | [
"async",
"def",
"async_update",
"(",
"self",
")",
"->",
"None",
":",
"await",
"self",
".",
"data",
".",
"async_refresh",
"(",
")"
] | https://github.com/briis/unifiprotect/blob/578427a79974ddfec397d3d9e4c2a4a425e965b5/custom_components/unifiprotect/entity.py#L130-L135 | ||
dmlc/gluon-cv | 709bc139919c02f7454cb411311048be188cde64 | gluoncv/data/transforms/presets/rcnn.py | python | transform_test | (imgs, short=600, max_size=1000, mean=(0.485, 0.456, 0.406),
std=(0.229, 0.224, 0.225)) | return tensors, origs | A util function to transform all images to tensors as network input by applying
normalizations. This function support 1 NDArray or iterable of NDArrays.
Parameters
----------
imgs : NDArray or iterable of NDArray
Image(s) to be transformed.
short : int, optional, default is 600
Resi... | A util function to transform all images to tensors as network input by applying
normalizations. This function support 1 NDArray or iterable of NDArrays. | [
"A",
"util",
"function",
"to",
"transform",
"all",
"images",
"to",
"tensors",
"as",
"network",
"input",
"by",
"applying",
"normalizations",
".",
"This",
"function",
"support",
"1",
"NDArray",
"or",
"iterable",
"of",
"NDArrays",
"."
] | def transform_test(imgs, short=600, max_size=1000, mean=(0.485, 0.456, 0.406),
std=(0.229, 0.224, 0.225)):
"""A util function to transform all images to tensors as network input by applying
normalizations. This function support 1 NDArray or iterable of NDArrays.
Parameters
----------... | [
"def",
"transform_test",
"(",
"imgs",
",",
"short",
"=",
"600",
",",
"max_size",
"=",
"1000",
",",
"mean",
"=",
"(",
"0.485",
",",
"0.456",
",",
"0.406",
")",
",",
"std",
"=",
"(",
"0.229",
",",
"0.224",
",",
"0.225",
")",
")",
":",
"if",
"isinst... | https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/gluoncv/data/transforms/presets/rcnn.py#L19-L63 | |
suavecode/SUAVE | 4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5 | trunk/SUAVE/Components/Energy/Cooling/Cryocooler.py | python | Cryocooler.energy_calc | (self, cooling_power, cryo_temp, amb_temp) | return [input_power, mass] | Calculate the power required by the cryocooler based on the cryocooler type, the required cooling power, and the temperature conditions.
Assumptions:
Based on mass data for Cryomech cryocoolers as per the datasheets for ground based non-massreduced coolers available via the cryomech website: https://ww... | Calculate the power required by the cryocooler based on the cryocooler type, the required cooling power, and the temperature conditions.
Assumptions:
Based on mass data for Cryomech cryocoolers as per the datasheets for ground based non-massreduced coolers available via the cryomech website: https://ww... | [
"Calculate",
"the",
"power",
"required",
"by",
"the",
"cryocooler",
"based",
"on",
"the",
"cryocooler",
"type",
"the",
"required",
"cooling",
"power",
"and",
"the",
"temperature",
"conditions",
".",
"Assumptions",
":",
"Based",
"on",
"mass",
"data",
"for",
"Cr... | def energy_calc(self, cooling_power, cryo_temp, amb_temp):
""" Calculate the power required by the cryocooler based on the cryocooler type, the required cooling power, and the temperature conditions.
Assumptions:
Based on mass data for Cryomech cryocoolers as per the datasheets for ground base... | [
"def",
"energy_calc",
"(",
"self",
",",
"cooling_power",
",",
"cryo_temp",
",",
"amb_temp",
")",
":",
"# Prevent unrealistic temperature changes.",
"if",
"np",
".",
"amin",
"(",
"cryo_temp",
")",
"<",
"1.",
":",
"cryo_temp",
"=",
"np",
".",
"maximum",
"(",
"... | https://github.com/suavecode/SUAVE/blob/4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5/trunk/SUAVE/Components/Energy/Cooling/Cryocooler.py#L37-L141 | |
VITA-Group/FasterSeg | 478b0265eb9ab626cfbe503ad16d2452878b38cc | search/loss.py | python | FocalLoss.forward | (self, input_, target) | [] | def forward(self, input_, target):
cross_entropy = super().forward(input_, target)
# Temporarily mask out ignore index to '0' for valid gather-indices input.
# This won't contribute final loss as the cross_entropy contribution
# for these would be zero.
target = target * (target ... | [
"def",
"forward",
"(",
"self",
",",
"input_",
",",
"target",
")",
":",
"cross_entropy",
"=",
"super",
"(",
")",
".",
"forward",
"(",
"input_",
",",
"target",
")",
"# Temporarily mask out ignore index to '0' for valid gather-indices input.",
"# This won't contribute fina... | https://github.com/VITA-Group/FasterSeg/blob/478b0265eb9ab626cfbe503ad16d2452878b38cc/search/loss.py#L40-L50 | ||||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | src/outwiker/gui/controls/ultimatelistctrl.py | python | UltimateListMainWindow.OnChildFocus | (self, event) | Handles the ``wx.EVT_CHILD_FOCUS`` event for :class:`UltimateListMainWindow`.
:param `event`: a :class:`ChildFocusEvent` event to be processed.
.. note::
This method is intentionally empty to prevent the default handler in
:class:`ScrolledWindow` from needlessly scrolling the wi... | Handles the ``wx.EVT_CHILD_FOCUS`` event for :class:`UltimateListMainWindow`. | [
"Handles",
"the",
"wx",
".",
"EVT_CHILD_FOCUS",
"event",
"for",
":",
"class",
":",
"UltimateListMainWindow",
"."
] | def OnChildFocus(self, event):
"""
Handles the ``wx.EVT_CHILD_FOCUS`` event for :class:`UltimateListMainWindow`.
:param `event`: a :class:`ChildFocusEvent` event to be processed.
.. note::
This method is intentionally empty to prevent the default handler in
:clas... | [
"def",
"OnChildFocus",
"(",
"self",
",",
"event",
")",
":",
"# Do nothing here. This prevents the default handler in wx.ScrolledWindow",
"# from needlessly scrolling the window when the edit control is",
"# dismissed. See ticket #9563.",
"pass"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L7277-L7295 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py | python | Standard_Suite_Events.quit | (self, _object, _attributes={}, **_arguments) | quit: Quit an application.
Required argument: the object for the command
Keyword argument saving: Specifies whether changes should be saved before quitting.
Keyword argument _attributes: AppleEvent attribute dictionary | quit: Quit an application.
Required argument: the object for the command
Keyword argument saving: Specifies whether changes should be saved before quitting.
Keyword argument _attributes: AppleEvent attribute dictionary | [
"quit",
":",
"Quit",
"an",
"application",
".",
"Required",
"argument",
":",
"the",
"object",
"for",
"the",
"command",
"Keyword",
"argument",
"saving",
":",
"Specifies",
"whether",
"changes",
"should",
"be",
"saved",
"before",
"quitting",
".",
"Keyword",
"argum... | def quit(self, _object, _attributes={}, **_arguments):
"""quit: Quit an application.
Required argument: the object for the command
Keyword argument saving: Specifies whether changes should be saved before quitting.
Keyword argument _attributes: AppleEvent attribute dictionary
"""... | [
"def",
"quit",
"(",
"self",
",",
"_object",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'aevt'",
"_subcode",
"=",
"'quit'",
"aetools",
".",
"keysubst",
"(",
"_arguments",
",",
"self",
".",
"_argmap_quit",
")... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py#L258-L278 | ||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3cfg.py | python | S3Config.get_L10n_pootle_password | (self) | return self.L10n.get("pootle_password", False) | Password for Pootle server | Password for Pootle server | [
"Password",
"for",
"Pootle",
"server"
] | def get_L10n_pootle_password(self):
""" Password for Pootle server """
return self.L10n.get("pootle_password", False) | [
"def",
"get_L10n_pootle_password",
"(",
"self",
")",
":",
"return",
"self",
".",
"L10n",
".",
"get",
"(",
"\"pootle_password\"",
",",
"False",
")"
] | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3cfg.py#L2058-L2060 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/shutil.py | python | get_archive_formats | () | return formats | Returns a list of supported formats for archiving and unarchiving.
Each element of the returned sequence is a tuple (name, description) | Returns a list of supported formats for archiving and unarchiving. | [
"Returns",
"a",
"list",
"of",
"supported",
"formats",
"for",
"archiving",
"and",
"unarchiving",
"."
] | def get_archive_formats():
"""Returns a list of supported formats for archiving and unarchiving.
Each element of the returned sequence is a tuple (name, description)
"""
formats = [(name, registry[2]) for name, registry in
_ARCHIVE_FORMATS.items()]
formats.sort()
return formats | [
"def",
"get_archive_formats",
"(",
")",
":",
"formats",
"=",
"[",
"(",
"name",
",",
"registry",
"[",
"2",
"]",
")",
"for",
"name",
",",
"registry",
"in",
"_ARCHIVE_FORMATS",
".",
"items",
"(",
")",
"]",
"formats",
".",
"sort",
"(",
")",
"return",
"fo... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/shutil.py#L469-L477 | |
pydoit/doit | cf7edfbe73fafebd1b2a6f1d3be8b69fde41383d | doit/cmd_base.py | python | DoitCmdBase.get_options | (self) | return [CmdOption(opt) for opt in opt_list] | from base class - merge base_options, loader_options and cmd_options | from base class - merge base_options, loader_options and cmd_options | [
"from",
"base",
"class",
"-",
"merge",
"base_options",
"loader_options",
"and",
"cmd_options"
] | def get_options(self):
"""from base class - merge base_options, loader_options and cmd_options
"""
opt_list = (self.base_options + self.loader.cmd_options +
self.cmd_options)
return [CmdOption(opt) for opt in opt_list] | [
"def",
"get_options",
"(",
"self",
")",
":",
"opt_list",
"=",
"(",
"self",
".",
"base_options",
"+",
"self",
".",
"loader",
".",
"cmd_options",
"+",
"self",
".",
"cmd_options",
")",
"return",
"[",
"CmdOption",
"(",
"opt",
")",
"for",
"opt",
"in",
"opt_... | https://github.com/pydoit/doit/blob/cf7edfbe73fafebd1b2a6f1d3be8b69fde41383d/doit/cmd_base.py#L477-L482 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/stringold.py | python | rindex | (s, *args) | return _apply(s.rindex, args) | rindex(s, sub [,start [,end]]) -> int
Like rfind but raises ValueError when the substring is not found. | rindex(s, sub [,start [,end]]) -> int | [
"rindex",
"(",
"s",
"sub",
"[",
"start",
"[",
"end",
"]]",
")",
"-",
">",
"int"
] | def rindex(s, *args):
"""rindex(s, sub [,start [,end]]) -> int
Like rfind but raises ValueError when the substring is not found.
"""
return _apply(s.rindex, args) | [
"def",
"rindex",
"(",
"s",
",",
"*",
"args",
")",
":",
"return",
"_apply",
"(",
"s",
".",
"rindex",
",",
"args",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/stringold.py#L145-L151 | |
openstack/oslo.messaging | 5d165cc713a98dbd650e9e6295d7966ce2919935 | oslo_messaging/_drivers/base.py | python | BaseDriver.listen | (self, target, batch_size, batch_timeout) | Construct a listener for the given target. The listener may be
either a :py:class:`Listener` or :py:class:`PollStyleListener`
depending on the driver's preference. This method is used by the RPC
server.
The driver must create subscriptions to the address provided in
*target*. ... | Construct a listener for the given target. The listener may be
either a :py:class:`Listener` or :py:class:`PollStyleListener`
depending on the driver's preference. This method is used by the RPC
server. | [
"Construct",
"a",
"listener",
"for",
"the",
"given",
"target",
".",
"The",
"listener",
"may",
"be",
"either",
"a",
":",
"py",
":",
"class",
":",
"Listener",
"or",
":",
"py",
":",
"class",
":",
"PollStyleListener",
"depending",
"on",
"the",
"driver",
"s",... | def listen(self, target, batch_size, batch_timeout):
"""Construct a listener for the given target. The listener may be
either a :py:class:`Listener` or :py:class:`PollStyleListener`
depending on the driver's preference. This method is used by the RPC
server.
The driver must cr... | [
"def",
"listen",
"(",
"self",
",",
"target",
",",
"batch_size",
",",
"batch_timeout",
")",
":"
] | https://github.com/openstack/oslo.messaging/blob/5d165cc713a98dbd650e9e6295d7966ce2919935/oslo_messaging/_drivers/base.py#L497-L543 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/index.py | python | PackageFinder._find_url_name | (self, index_url, url_name, req) | return None | Finds the true URL name of a package, when the given name isn't quite correct.
This is usually used to implement case-insensitivity. | Finds the true URL name of a package, when the given name isn't quite correct.
This is usually used to implement case-insensitivity. | [
"Finds",
"the",
"true",
"URL",
"name",
"of",
"a",
"package",
"when",
"the",
"given",
"name",
"isn",
"t",
"quite",
"correct",
".",
"This",
"is",
"usually",
"used",
"to",
"implement",
"case",
"-",
"insensitivity",
"."
] | def _find_url_name(self, index_url, url_name, req):
"""Finds the true URL name of a package, when the given name isn't quite correct.
This is usually used to implement case-insensitivity."""
if not index_url.url.endswith('/'):
# Vaguely part of the PyPI API... weird but true.
... | [
"def",
"_find_url_name",
"(",
"self",
",",
"index_url",
",",
"url_name",
",",
"req",
")",
":",
"if",
"not",
"index_url",
".",
"url",
".",
"endswith",
"(",
"'/'",
")",
":",
"# Vaguely part of the PyPI API... weird but true.",
"## FIXME: bad to modify this?",
"index_u... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/index.py#L354-L371 | |
kensho-technologies/graphql-compiler | 4318443b7b2512a059f3616112bfc40bbf8eec06 | graphql_compiler/schema_generation/graphql_schema.py | python | _get_fields_for_class | (
schema_graph, graphql_types, field_type_overrides, hidden_classes, cls_name
) | return result | Return a dict from field name to GraphQL field type, for the specified graph class. | Return a dict from field name to GraphQL field type, for the specified graph class. | [
"Return",
"a",
"dict",
"from",
"field",
"name",
"to",
"GraphQL",
"field",
"type",
"for",
"the",
"specified",
"graph",
"class",
"."
] | def _get_fields_for_class(
schema_graph, graphql_types, field_type_overrides, hidden_classes, cls_name
):
"""Return a dict from field name to GraphQL field type, for the specified graph class."""
properties = schema_graph.get_element_by_class_name(cls_name).properties
# Add leaf GraphQL fields (class p... | [
"def",
"_get_fields_for_class",
"(",
"schema_graph",
",",
"graphql_types",
",",
"field_type_overrides",
",",
"hidden_classes",
",",
"cls_name",
")",
":",
"properties",
"=",
"schema_graph",
".",
"get_element_by_class_name",
"(",
"cls_name",
")",
".",
"properties",
"# A... | https://github.com/kensho-technologies/graphql-compiler/blob/4318443b7b2512a059f3616112bfc40bbf8eec06/graphql_compiler/schema_generation/graphql_schema.py#L91-L185 | |
santi-pdp/pase | 2a41e63e54fa8673efd12c16cdcdd5ad4f0f125e | pase/transforms.py | python | Additive.apply_IRS | (self, data, srate, nbits) | return data_filtered | Apply telephone handset BW [300, 3200] Hz | Apply telephone handset BW [300, 3200] Hz | [
"Apply",
"telephone",
"handset",
"BW",
"[",
"300",
"3200",
"]",
"Hz"
] | def apply_IRS(self, data, srate, nbits):
""" Apply telephone handset BW [300, 3200] Hz """
raise NotImplementedError('Under construction!')
from pyfftw.interfaces import scipy_fftpack as fftw
n = data.shape[0]
# find next pow of 2 which is greater or eq to n
pow_of_2 = 2 ... | [
"def",
"apply_IRS",
"(",
"self",
",",
"data",
",",
"srate",
",",
"nbits",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Under construction!'",
")",
"from",
"pyfftw",
".",
"interfaces",
"import",
"scipy_fftpack",
"as",
"fftw",
"n",
"=",
"data",
".",
"shape... | https://github.com/santi-pdp/pase/blob/2a41e63e54fa8673efd12c16cdcdd5ad4f0f125e/pase/transforms.py#L1869-L1910 | |
pyeve/eve-sqlalchemy | d5c8081457a32a35a1abd6cee4bfa9420f4e05af | eve_sqlalchemy/parser.py | python | parse | (expression, model) | return v.sqla_query | Given a python-like conditional statement, returns the equivalent
SQLAlchemy-like query expression. Conditional and boolean operators
(==, <=, >=, !=, >, <) are supported. | Given a python-like conditional statement, returns the equivalent
SQLAlchemy-like query expression. Conditional and boolean operators
(==, <=, >=, !=, >, <) are supported. | [
"Given",
"a",
"python",
"-",
"like",
"conditional",
"statement",
"returns",
"the",
"equivalent",
"SQLAlchemy",
"-",
"like",
"query",
"expression",
".",
"Conditional",
"and",
"boolean",
"operators",
"(",
"==",
"<",
"=",
">",
"=",
"!",
"=",
">",
"<",
")",
... | def parse(expression, model):
"""
Given a python-like conditional statement, returns the equivalent
SQLAlchemy-like query expression. Conditional and boolean operators
(==, <=, >=, !=, >, <) are supported.
"""
v = SQLAVisitor(model)
try:
parsed_expr = ast.parse(expression)
except... | [
"def",
"parse",
"(",
"expression",
",",
"model",
")",
":",
"v",
"=",
"SQLAVisitor",
"(",
"model",
")",
"try",
":",
"parsed_expr",
"=",
"ast",
".",
"parse",
"(",
"expression",
")",
"except",
"SyntaxError",
":",
"raise",
"ParseError",
"(",
"\"Can't parse exp... | https://github.com/pyeve/eve-sqlalchemy/blob/d5c8081457a32a35a1abd6cee4bfa9420f4e05af/eve_sqlalchemy/parser.py#L128-L141 | |
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/clipboard.py | python | Provider.text_available | (self) | return False | Check if clipboard with text is available. | Check if clipboard with text is available. | [
"Check",
"if",
"clipboard",
"with",
"text",
"is",
"available",
"."
] | def text_available(self):
"""Check if clipboard with text is available."""
return False | [
"def",
"text_available",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/clipboard.py#L100-L102 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/lib2to3/fixes/fix_urllib.py | python | build_pattern | () | [] | def build_pattern():
bare = set()
for old_module, changes in MAPPING.items():
for change in changes:
new_module, members = change
members = alternates(members)
yield """import_name< 'import' (module=%r
| dotted_as_names< any* module=%... | [
"def",
"build_pattern",
"(",
")",
":",
"bare",
"=",
"set",
"(",
")",
"for",
"old_module",
",",
"changes",
"in",
"MAPPING",
".",
"items",
"(",
")",
":",
"for",
"change",
"in",
"changes",
":",
"new_module",
",",
"members",
"=",
"change",
"members",
"=",
... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/lib2to3/fixes/fix_urllib.py#L48-L68 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/plat-mac/Carbon/Dragconst.py | python | FOUR_CHAR_CODE | (x) | return x | [] | def FOUR_CHAR_CODE(x): return x | [
"def",
"FOUR_CHAR_CODE",
"(",
"x",
")",
":",
"return",
"x"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-mac/Carbon/Dragconst.py#L3-L3 | |||
hakril/PythonForWindows | 61e027a678d5b87aa64fcf8a37a6661a86236589 | windows/native_exec/simple_x64.py | python | BitArray.from_int | (cls, size, x) | return cls(size, bin(x)[2:]) | [] | def from_int(cls, size, x):
if x < 0:
x = x & ((2 ** size) - 1)
return cls(size, bin(x)[2:]) | [
"def",
"from_int",
"(",
"cls",
",",
"size",
",",
"x",
")",
":",
"if",
"x",
"<",
"0",
":",
"x",
"=",
"x",
"&",
"(",
"(",
"2",
"**",
"size",
")",
"-",
"1",
")",
"return",
"cls",
"(",
"size",
",",
"bin",
"(",
"x",
")",
"[",
"2",
":",
"]",
... | https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/native_exec/simple_x64.py#L79-L82 | |||
KhronosGroup/OpenXR-SDK-Source | 76756e2e7849b15466d29bee7d80cada92865550 | external/python/jinja2/filters.py | python | ignore_case | (value) | return value.lower() if isinstance(value, string_types) else value | For use as a postprocessor for :func:`make_attrgetter`. Converts strings
to lowercase and returns other types as-is. | For use as a postprocessor for :func:`make_attrgetter`. Converts strings
to lowercase and returns other types as-is. | [
"For",
"use",
"as",
"a",
"postprocessor",
"for",
":",
"func",
":",
"make_attrgetter",
".",
"Converts",
"strings",
"to",
"lowercase",
"and",
"returns",
"other",
"types",
"as",
"-",
"is",
"."
] | def ignore_case(value):
"""For use as a postprocessor for :func:`make_attrgetter`. Converts strings
to lowercase and returns other types as-is."""
return value.lower() if isinstance(value, string_types) else value | [
"def",
"ignore_case",
"(",
"value",
")",
":",
"return",
"value",
".",
"lower",
"(",
")",
"if",
"isinstance",
"(",
"value",
",",
"string_types",
")",
"else",
"value"
] | https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/76756e2e7849b15466d29bee7d80cada92865550/external/python/jinja2/filters.py#L56-L59 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.