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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mrlesmithjr/Ansible | d44f0dc0d942bdf3bf7334b307e6048f0ee16e36 | roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | Environment.can_add | (self, dist) | return (self.python is None or dist.py_version is None
or dist.py_version == self.python) \
and compatible_platforms(dist.platform, self.platform) | Is distribution `dist` acceptable for this environment?
The distribution must match the platform and python version
requirements specified when this environment was created, or False
is returned. | Is distribution `dist` acceptable for this environment? | [
"Is",
"distribution",
"dist",
"acceptable",
"for",
"this",
"environment?"
] | def can_add(self, dist):
"""Is distribution `dist` acceptable for this environment?
The distribution must match the platform and python version
requirements specified when this environment was created, or False
is returned.
"""
return (self.python is None or dist.py_vers... | [
"def",
"can_add",
"(",
"self",
",",
"dist",
")",
":",
"return",
"(",
"self",
".",
"python",
"is",
"None",
"or",
"dist",
".",
"py_version",
"is",
"None",
"or",
"dist",
".",
"py_version",
"==",
"self",
".",
"python",
")",
"and",
"compatible_platforms",
"... | https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1053-L1062 | |
getting-things-gnome/gtg | 4b02c43744b32a00facb98174f04ec5953bd055d | GTG/gtk/backends/configurepanel.py | python | ConfigurePanel.refresh_sync_status | (self, sender=False, data=False) | Signal callback function, called when a backend state
(enabled/disabled) changes. Refreshes this view.
@param sender: not used, here only for signal callback compatibility
@param data: not used, here only for signal callback compatibility | Signal callback function, called when a backend state
(enabled/disabled) changes. Refreshes this view. | [
"Signal",
"callback",
"function",
"called",
"when",
"a",
"backend",
"state",
"(",
"enabled",
"/",
"disabled",
")",
"changes",
".",
"Refreshes",
"this",
"view",
"."
] | def refresh_sync_status(self, sender=False, data=False):
"""Signal callback function, called when a backend state
(enabled/disabled) changes. Refreshes this view.
@param sender: not used, here only for signal callback compatibility
@param data: not used, here only for signal callback co... | [
"def",
"refresh_sync_status",
"(",
"self",
",",
"sender",
"=",
"False",
",",
"data",
"=",
"False",
")",
":",
"self",
".",
"refresh_sync_button",
"(",
")",
"self",
".",
"refresh_sync_status_label",
"(",
")"
] | https://github.com/getting-things-gnome/gtg/blob/4b02c43744b32a00facb98174f04ec5953bd055d/GTG/gtk/backends/configurepanel.py#L162-L170 | ||
Qirky/FoxDot | 76318f9630bede48ff3994146ed644affa27bfa4 | FoxDot/lib/Patterns/Sequences.py | python | PShuf | (seq) | return Pattern(seq).shuffle() | PShuf(seq) -> Returns a shuffled version of seq | PShuf(seq) -> Returns a shuffled version of seq | [
"PShuf",
"(",
"seq",
")",
"-",
">",
"Returns",
"a",
"shuffled",
"version",
"of",
"seq"
] | def PShuf(seq):
''' PShuf(seq) -> Returns a shuffled version of seq'''
return Pattern(seq).shuffle() | [
"def",
"PShuf",
"(",
"seq",
")",
":",
"return",
"Pattern",
"(",
"seq",
")",
".",
"shuffle",
"(",
")"
] | https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/Patterns/Sequences.py#L116-L118 | |
kipoi/models | 992a7149e64a4e7ee3c3ab5bad397f2e9e7e27a4 | MaxEntScan/gtf_utils.py | python | Transcript.__init__ | (self, chrom, strand, start, stop, tran_id, tran_name="*",
biotype="*") | a general purpose transcript object with the basic information. | a general purpose transcript object with the basic information. | [
"a",
"general",
"purpose",
"transcript",
"object",
"with",
"the",
"basic",
"information",
"."
] | def __init__(self, chrom, strand, start, stop, tran_id, tran_name="*",
biotype="*"):
"""a general purpose transcript object with the basic information.
"""
self.chrom = chrom
self.strand = strand
self.start = int(start)
self.stop = int(stop)
self.... | [
"def",
"__init__",
"(",
"self",
",",
"chrom",
",",
"strand",
",",
"start",
",",
"stop",
",",
"tran_id",
",",
"tran_name",
"=",
"\"*\"",
",",
"biotype",
"=",
"\"*\"",
")",
":",
"self",
".",
"chrom",
"=",
"chrom",
"self",
".",
"strand",
"=",
"strand",
... | https://github.com/kipoi/models/blob/992a7149e64a4e7ee3c3ab5bad397f2e9e7e27a4/MaxEntScan/gtf_utils.py#L13-L28 | ||
zzzeek/sqlalchemy | fc5c54fcd4d868c2a4c7ac19668d72f506fe821e | lib/sqlalchemy/sql/schema.py | python | Table.to_metadata | (
self,
metadata,
schema=RETAIN_SCHEMA,
referred_schema_fn=None,
name=None,
) | return self._schema_item_copy(table) | Return a copy of this :class:`_schema.Table` associated with a
different :class:`_schema.MetaData`.
E.g.::
m1 = MetaData()
user = Table('user', m1, Column('id', Integer, primary_key=True))
m2 = MetaData()
user_copy = user.to_metadata(m2)
.. ve... | Return a copy of this :class:`_schema.Table` associated with a
different :class:`_schema.MetaData`. | [
"Return",
"a",
"copy",
"of",
"this",
":",
"class",
":",
"_schema",
".",
"Table",
"associated",
"with",
"a",
"different",
":",
"class",
":",
"_schema",
".",
"MetaData",
"."
] | def to_metadata(
self,
metadata,
schema=RETAIN_SCHEMA,
referred_schema_fn=None,
name=None,
):
"""Return a copy of this :class:`_schema.Table` associated with a
different :class:`_schema.MetaData`.
E.g.::
m1 = MetaData()
user ... | [
"def",
"to_metadata",
"(",
"self",
",",
"metadata",
",",
"schema",
"=",
"RETAIN_SCHEMA",
",",
"referred_schema_fn",
"=",
"None",
",",
"name",
"=",
"None",
",",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"self",
".",
"name",
"if",
"schema",... | https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/sql/schema.py#L995-L1137 | |
adamcaudill/yawast | 5e9e7a37831c030530adb971925ee135e9bfcafb | yawast/external/spinner.py | python | Spinner.__init__ | (self, delay=None) | [] | def __init__(self, delay=None):
self.spinner_generator = self.spinning_cursor()
if delay and float(delay):
self.delay = delay | [
"def",
"__init__",
"(",
"self",
",",
"delay",
"=",
"None",
")",
":",
"self",
".",
"spinner_generator",
"=",
"self",
".",
"spinning_cursor",
"(",
")",
"if",
"delay",
"and",
"float",
"(",
"delay",
")",
":",
"self",
".",
"delay",
"=",
"delay"
] | https://github.com/adamcaudill/yawast/blob/5e9e7a37831c030530adb971925ee135e9bfcafb/yawast/external/spinner.py#L21-L24 | ||||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/functions/elementary/complexes.py | python | sign._eval_derivative | (self, x) | [] | def _eval_derivative(self, x):
if self.args[0].is_real:
from sympy.functions.special.delta_functions import DiracDelta
return 2 * Derivative(self.args[0], x, evaluate=True) \
* DiracDelta(self.args[0])
elif self.args[0].is_imaginary:
from sympy.functio... | [
"def",
"_eval_derivative",
"(",
"self",
",",
"x",
")",
":",
"if",
"self",
".",
"args",
"[",
"0",
"]",
".",
"is_real",
":",
"from",
"sympy",
".",
"functions",
".",
"special",
".",
"delta_functions",
"import",
"DiracDelta",
"return",
"2",
"*",
"Derivative"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/functions/elementary/complexes.py#L280-L288 | ||||
aws/chalice | de872630a9097b6657274dae9417522cf7aa8efd | chalice/awsclient.py | python | TypedAWSClient.get_function_policy | (self, function_name) | Return the function policy for a lambda function.
This function will extract the policy string as a json document
and return the json.loads(...) version of the policy. | Return the function policy for a lambda function. | [
"Return",
"the",
"function",
"policy",
"for",
"a",
"lambda",
"function",
"."
] | def get_function_policy(self, function_name):
# type: (str) -> Dict[str, Any]
"""Return the function policy for a lambda function.
This function will extract the policy string as a json document
and return the json.loads(...) version of the policy.
"""
client = self._cl... | [
"def",
"get_function_policy",
"(",
"self",
",",
"function_name",
")",
":",
"# type: (str) -> Dict[str, Any]",
"client",
"=",
"self",
".",
"_client",
"(",
"'lambda'",
")",
"try",
":",
"policy",
"=",
"client",
".",
"get_policy",
"(",
"FunctionName",
"=",
"function... | https://github.com/aws/chalice/blob/de872630a9097b6657274dae9417522cf7aa8efd/chalice/awsclient.py#L1168-L1181 | ||
microsoft/nni | 31f11f51249660930824e888af0d4e022823285c | examples/trials/systems_auto_tuning/opevo/src/algorithms/gbfs.py | python | G_BFS.generate_parameters | (self, parameter_id, **kwargs) | Method which provides one set of hyper-parameters.
Override of the abstract method in :class:`~nni.tuner.Tuner`. | Method which provides one set of hyper-parameters. | [
"Method",
"which",
"provides",
"one",
"set",
"of",
"hyper",
"-",
"parameters",
"."
] | def generate_parameters(self, parameter_id, **kwargs):
"""Method which provides one set of hyper-parameters.
Override of the abstract method in :class:`~nni.tuner.Tuner`.
"""
if self.serve_list:
self.wait_dict[parameter_id] = self.serve_list.pop()
return self.wai... | [
"def",
"generate_parameters",
"(",
"self",
",",
"parameter_id",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"serve_list",
":",
"self",
".",
"wait_dict",
"[",
"parameter_id",
"]",
"=",
"self",
".",
"serve_list",
".",
"pop",
"(",
")",
"return",
... | https://github.com/microsoft/nni/blob/31f11f51249660930824e888af0d4e022823285c/examples/trials/systems_auto_tuning/opevo/src/algorithms/gbfs.py#L236-L246 | ||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/db/migrations/operations/models.py | python | RemoveIndex.deconstruct | (self) | return (
self.__class__.__name__,
[],
kwargs,
) | [] | def deconstruct(self):
kwargs = {
'model_name': self.model_name,
'name': self.name,
}
return (
self.__class__.__name__,
[],
kwargs,
) | [
"def",
"deconstruct",
"(",
"self",
")",
":",
"kwargs",
"=",
"{",
"'model_name'",
":",
"self",
".",
"model_name",
",",
"'name'",
":",
"self",
".",
"name",
",",
"}",
"return",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"[",
"]",
",",
"kwargs"... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/migrations/operations/models.py#L843-L852 | |||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/django/db/models/sql/where.py | python | Constraint.__getstate__ | (self) | return obj_dict | Save the state of the Constraint for pickling.
Fields aren't necessarily pickleable, because they can have
callable default values. So, instead of pickling the field
store a reference so we can restore it manually | Save the state of the Constraint for pickling. | [
"Save",
"the",
"state",
"of",
"the",
"Constraint",
"for",
"pickling",
"."
] | def __getstate__(self):
"""Save the state of the Constraint for pickling.
Fields aren't necessarily pickleable, because they can have
callable default values. So, instead of pickling the field
store a reference so we can restore it manually
"""
obj_dict = self.__dict__.c... | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"obj_dict",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"if",
"self",
".",
"field",
":",
"obj_dict",
"[",
"'model'",
"]",
"=",
"self",
".",
"field",
".",
"model",
"obj_dict",
"[",
"'field_name'",
... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/db/models/sql/where.py#L313-L325 | |
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | example/pyctp2/md/save_agent.py | python | TSaveAgent.__init__ | (self,contract_manager,relative_path) | [] | def __init__(self,contract_manager,relative_path):
SaveAgent.__init__(self,contract_manager,relative_path)
threading.Thread.__init__(self)
self._queue = queue.Queue()
self._lock = threading.Lock() | [
"def",
"__init__",
"(",
"self",
",",
"contract_manager",
",",
"relative_path",
")",
":",
"SaveAgent",
".",
"__init__",
"(",
"self",
",",
"contract_manager",
",",
"relative_path",
")",
"threading",
".",
"Thread",
".",
"__init__",
"(",
"self",
")",
"self",
"."... | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/pyctp2/md/save_agent.py#L181-L185 | ||||
ShreyAmbesh/Traffic-Rule-Violation-Detection-System | ae0c327ce014ce6a427da920b5798a0d4bbf001e | utils/dataset_util.py | python | read_examples_list | (path) | return [line.strip().split(' ')[0] for line in lines] | Read list of training or validation examples.
The file is assumed to contain a single example per line where the first
token in the line is an identifier that allows us to find the image and
annotation xml for that example.
For example, the line:
xyz 3
would allow us to find files xyz.jpg and xyz.xml (the... | Read list of training or validation examples. | [
"Read",
"list",
"of",
"training",
"or",
"validation",
"examples",
"."
] | def read_examples_list(path):
"""Read list of training or validation examples.
The file is assumed to contain a single example per line where the first
token in the line is an identifier that allows us to find the image and
annotation xml for that example.
For example, the line:
xyz 3
would allow us to ... | [
"def",
"read_examples_list",
"(",
"path",
")",
":",
"with",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"path",
")",
"as",
"fid",
":",
"lines",
"=",
"fid",
".",
"readlines",
"(",
")",
"return",
"[",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
"... | https://github.com/ShreyAmbesh/Traffic-Rule-Violation-Detection-System/blob/ae0c327ce014ce6a427da920b5798a0d4bbf001e/utils/dataset_util.py#L41-L60 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/mpmath/matrices/matrices.py | python | _matrix.tolist | (self) | return [[self[i,j] for j in range(self.__cols)] for i in range(self.__rows)] | Convert the matrix to a nested list. | Convert the matrix to a nested list. | [
"Convert",
"the",
"matrix",
"to",
"a",
"nested",
"list",
"."
] | def tolist(self):
"""
Convert the matrix to a nested list.
"""
return [[self[i,j] for j in range(self.__cols)] for i in range(self.__rows)] | [
"def",
"tolist",
"(",
"self",
")",
":",
"return",
"[",
"[",
"self",
"[",
"i",
",",
"j",
"]",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"__cols",
")",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"__rows",
")",
"]"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/mpmath/matrices/matrices.py#L394-L398 | |
ambujraj/hacktoberfest2018 | 53df2cac8b3404261131a873352ec4f2ffa3544d | MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/ipaddress.py | python | IPv6Address.is_global | (self) | return not self.is_private | Test if this address is allocated for public networks.
Returns:
A boolean, true if the address is not reserved per
iana-ipv6-special-registry. | Test if this address is allocated for public networks. | [
"Test",
"if",
"this",
"address",
"is",
"allocated",
"for",
"public",
"networks",
"."
] | def is_global(self):
"""Test if this address is allocated for public networks.
Returns:
A boolean, true if the address is not reserved per
iana-ipv6-special-registry.
"""
return not self.is_private | [
"def",
"is_global",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"is_private"
] | https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/ipaddress.py#L2102-L2110 | |
rwightman/pytorch-image-models | ccfeb06936549f19c453b7f1f27e8e632cfbe1c2 | timm/models/swin_transformer.py | python | swin_large_patch4_window7_224_in22k | (pretrained=False, **kwargs) | return _create_swin_transformer('swin_large_patch4_window7_224_in22k', pretrained=pretrained, **model_kwargs) | Swin-L @ 224x224, trained ImageNet-22k | Swin-L | [
"Swin",
"-",
"L"
] | def swin_large_patch4_window7_224_in22k(pretrained=False, **kwargs):
""" Swin-L @ 224x224, trained ImageNet-22k
"""
model_kwargs = dict(
patch_size=4, window_size=7, embed_dim=192, depths=(2, 2, 18, 2), num_heads=(6, 12, 24, 48), **kwargs)
return _create_swin_transformer('swin_large_patch4_windo... | [
"def",
"swin_large_patch4_window7_224_in22k",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model_kwargs",
"=",
"dict",
"(",
"patch_size",
"=",
"4",
",",
"window_size",
"=",
"7",
",",
"embed_dim",
"=",
"192",
",",
"depths",
"=",
"(",... | https://github.com/rwightman/pytorch-image-models/blob/ccfeb06936549f19c453b7f1f27e8e632cfbe1c2/timm/models/swin_transformer.py#L651-L656 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/db/models/query.py | python | EmptyQuerySet.extra | (self, select=None, where=None, params=None, tables=None,
order_by=None, select_params=None) | return self | Always returns EmptyQuerySet. | Always returns EmptyQuerySet. | [
"Always",
"returns",
"EmptyQuerySet",
"."
] | def extra(self, select=None, where=None, params=None, tables=None,
order_by=None, select_params=None):
"""
Always returns EmptyQuerySet.
"""
assert self.query.can_filter(), \
"Cannot change a query once a slice has been taken"
return self | [
"def",
"extra",
"(",
"self",
",",
"select",
"=",
"None",
",",
"where",
"=",
"None",
",",
"params",
"=",
"None",
",",
"tables",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"select_params",
"=",
"None",
")",
":",
"assert",
"self",
".",
"query",
"... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/db/models/query.py#L1274-L1281 | |
sdispater/orator | 0666e522be914db285b6936e3c36801fc1a9c2e7 | orator/dbal/index.py | python | Index._add_column | (self, column) | Adds a new column.
:param column: The column to add
:type column: str | Adds a new column. | [
"Adds",
"a",
"new",
"column",
"."
] | def _add_column(self, column):
"""
Adds a new column.
:param column: The column to add
:type column: str
"""
self._columns[column] = Identifier(column) | [
"def",
"_add_column",
"(",
"self",
",",
"column",
")",
":",
"self",
".",
"_columns",
"[",
"column",
"]",
"=",
"Identifier",
"(",
"column",
")"
] | https://github.com/sdispater/orator/blob/0666e522be914db285b6936e3c36801fc1a9c2e7/orator/dbal/index.py#L50-L57 | ||
linkchecker/linkchecker | d1078ed8480e5cfc4264d0dbf026b45b45aede4d | linkcheck/parser/sitemap.py | python | XmlTagUrlParser.__init__ | (self, tag) | Initialize the parser. | Initialize the parser. | [
"Initialize",
"the",
"parser",
"."
] | def __init__(self, tag):
"""Initialize the parser."""
self.tag = tag
self.parser = ParserCreate()
self.parser.buffer_text = True
self.parser.StartElementHandler = self.start_element
self.parser.EndElementHandler = self.end_element
self.parser.CharacterDataHandler ... | [
"def",
"__init__",
"(",
"self",
",",
"tag",
")",
":",
"self",
".",
"tag",
"=",
"tag",
"self",
".",
"parser",
"=",
"ParserCreate",
"(",
")",
"self",
".",
"parser",
".",
"buffer_text",
"=",
"True",
"self",
".",
"parser",
".",
"StartElementHandler",
"=",
... | https://github.com/linkchecker/linkchecker/blob/d1078ed8480e5cfc4264d0dbf026b45b45aede4d/linkcheck/parser/sitemap.py#L27-L34 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/nn/hetero_nn/backend/hetero_nn_model.py | python | HeteroNNKerasHostModel.predict | (self, x) | [] | def predict(self, x):
guest_bottom_output = self.bottom_model.predict(x)
self.interactive_model.forward(guest_bottom_output, train=False) | [
"def",
"predict",
"(",
"self",
",",
"x",
")",
":",
"guest_bottom_output",
"=",
"self",
".",
"bottom_model",
".",
"predict",
"(",
"x",
")",
"self",
".",
"interactive_model",
".",
"forward",
"(",
"guest_bottom_output",
",",
"train",
"=",
"False",
")"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/nn/hetero_nn/backend/hetero_nn_model.py#L422-L424 | ||||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/models/gaussian.py | python | Gaussian.map | (self, data, mean_prior, covariance_prior) | r"""
Maximum a posteriori estimation (MAP).
.. math:: \max_theta p(X | \theta) p(\theta)
where :math:`\theta` is the set of parameters, which in this case are the mean and covariance matrix,
i.e. :math:`\theta = \{ \mu, \Sigma \}`, and :math:`X` represents the data set.
Args:
... | r"""
Maximum a posteriori estimation (MAP). | [
"r",
"Maximum",
"a",
"posteriori",
"estimation",
"(",
"MAP",
")",
"."
] | def map(self, data, mean_prior, covariance_prior):
r"""
Maximum a posteriori estimation (MAP).
.. math:: \max_theta p(X | \theta) p(\theta)
where :math:`\theta` is the set of parameters, which in this case are the mean and covariance matrix,
i.e. :math:`\theta = \{ \mu, \Sigma ... | [
"def",
"map",
"(",
"self",
",",
"data",
",",
"mean_prior",
",",
"covariance_prior",
")",
":",
"pass"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/models/gaussian.py#L1070-L1087 | ||
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/Options.py | python | shallExplainImports | () | return options is not None and options.explain_imports | :returns: bool derived from ``--explain-imports`` | :returns: bool derived from ``--explain-imports`` | [
":",
"returns",
":",
"bool",
"derived",
"from",
"--",
"explain",
"-",
"imports"
] | def shallExplainImports():
""":returns: bool derived from ``--explain-imports``"""
return options is not None and options.explain_imports | [
"def",
"shallExplainImports",
"(",
")",
":",
"return",
"options",
"is",
"not",
"None",
"and",
"options",
".",
"explain_imports"
] | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/Options.py#L1044-L1046 | |
bakwc/PySyncObj | 012aeb1b34be7b98f3b5c33e735836a9fc0c4cba | pysyncobj/transport.py | python | TCPTransport.destroy | (self) | Destroy this transport | Destroy this transport | [
"Destroy",
"this",
"transport"
] | def destroy(self):
"""
Destroy this transport
"""
self.setOnMessageReceivedCallback(None)
self.setOnNodeConnectedCallback(None)
self.setOnNodeDisconnectedCallback(None)
self.setOnReadonlyNodeConnectedCallback(None)
self.setOnReadonlyNodeDisconnectedCallba... | [
"def",
"destroy",
"(",
"self",
")",
":",
"self",
".",
"setOnMessageReceivedCallback",
"(",
"None",
")",
"self",
".",
"setOnNodeConnectedCallback",
"(",
"None",
")",
"self",
".",
"setOnNodeDisconnectedCallback",
"(",
"None",
")",
"self",
".",
"setOnReadonlyNodeConn... | https://github.com/bakwc/PySyncObj/blob/012aeb1b34be7b98f3b5c33e735836a9fc0c4cba/pysyncobj/transport.py#L570-L586 | ||
AndroBugs/AndroBugs_Framework | 7fd3a2cb1cf65a9af10b7ed2129701d4451493fe | tools/modified/androguard/core/bytecodes/dvm.py | python | ClassDataItem.get_methods | (self) | return [ x for x in self.direct_methods ] + [ x for x in self.virtual_methods ] | Return direct and virtual methods
:rtype: a list of :class:`EncodedMethod` objects | Return direct and virtual methods | [
"Return",
"direct",
"and",
"virtual",
"methods"
] | def get_methods(self):
"""
Return direct and virtual methods
:rtype: a list of :class:`EncodedMethod` objects
"""
return [ x for x in self.direct_methods ] + [ x for x in self.virtual_methods ] | [
"def",
"get_methods",
"(",
"self",
")",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"direct_methods",
"]",
"+",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"virtual_methods",
"]"
] | https://github.com/AndroBugs/AndroBugs_Framework/blob/7fd3a2cb1cf65a9af10b7ed2129701d4451493fe/tools/modified/androguard/core/bytecodes/dvm.py#L3108-L3114 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/core/reshape/concat.py | python | concat | (
objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
axis: Axis = 0,
join: str = "outer",
ignore_index: bool = False,
keys=None,
levels=None,
names=None,
verify_integrity: bool = False,
sort: bool = False,
copy: bool = True,
) | return op.get_result() | Concatenate pandas objects along a particular axis with optional set logic
along the other axes.
Can also add a layer of hierarchical indexing on the concatenation axis,
which may be useful if the labels are the same (or overlapping) on
the passed axis number.
Parameters
----------
objs : ... | Concatenate pandas objects along a particular axis with optional set logic
along the other axes. | [
"Concatenate",
"pandas",
"objects",
"along",
"a",
"particular",
"axis",
"with",
"optional",
"set",
"logic",
"along",
"the",
"other",
"axes",
"."
] | def concat(
objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
axis: Axis = 0,
join: str = "outer",
ignore_index: bool = False,
keys=None,
levels=None,
names=None,
verify_integrity: bool = False,
sort: bool = False,
copy: bool = True,
) -> DataFrame | Series:
"""
Conca... | [
"def",
"concat",
"(",
"objs",
":",
"Iterable",
"[",
"NDFrame",
"]",
"|",
"Mapping",
"[",
"Hashable",
",",
"NDFrame",
"]",
",",
"axis",
":",
"Axis",
"=",
"0",
",",
"join",
":",
"str",
"=",
"\"outer\"",
",",
"ignore_index",
":",
"bool",
"=",
"False",
... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/reshape/concat.py#L143-L359 | |
tartiflette/tartiflette | e292c28ed4fa279ecedb8980fc3741965bd28c87 | tartiflette/language/ast/values.py | python | EnumValueNode.__eq__ | (self, other: Any) | return self is other or (
isinstance(other, EnumValueNode)
and self.value == other.value
and self.location == other.location
) | Returns True if `other` instance is identical to `self`.
:param other: object instance to compare to `self`
:type other: Any
:return: whether or not `other` is identical to `self`
:rtype: bool | Returns True if `other` instance is identical to `self`.
:param other: object instance to compare to `self`
:type other: Any
:return: whether or not `other` is identical to `self`
:rtype: bool | [
"Returns",
"True",
"if",
"other",
"instance",
"is",
"identical",
"to",
"self",
".",
":",
"param",
"other",
":",
"object",
"instance",
"to",
"compare",
"to",
"self",
":",
"type",
"other",
":",
"Any",
":",
"return",
":",
"whether",
"or",
"not",
"other",
... | def __eq__(self, other: Any) -> bool:
"""
Returns True if `other` instance is identical to `self`.
:param other: object instance to compare to `self`
:type other: Any
:return: whether or not `other` is identical to `self`
:rtype: bool
"""
return self is ot... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
":",
"Any",
")",
"->",
"bool",
":",
"return",
"self",
"is",
"other",
"or",
"(",
"isinstance",
"(",
"other",
",",
"EnumValueNode",
")",
"and",
"self",
".",
"value",
"==",
"other",
".",
"value",
"and",
"self"... | https://github.com/tartiflette/tartiflette/blob/e292c28ed4fa279ecedb8980fc3741965bd28c87/tartiflette/language/ast/values.py#L90-L102 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/reports/forms.py | python | RunForm.save | (self, *args, **kwargs) | return run | [] | def save(self, *args, **kwargs):
request = kwargs.get('request')
if request:
del kwargs['request']
run = super(RunForm, self).save(*args, **kwargs)
if request:
run.creator = request.user
run.creator_username = request.user.username
run.save()
... | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"request",
"=",
"kwargs",
".",
"get",
"(",
"'request'",
")",
"if",
"request",
":",
"del",
"kwargs",
"[",
"'request'",
"]",
"run",
"=",
"super",
"(",
"RunForm",
",",
... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/reports/forms.py#L109-L120 | |||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/chop.py | python | ChopSkein.addExtraTopLayerIfNecessary | ( self, carving, layerThickness, rotatedBoundaryLayers ) | Add extra top layer if necessary. | Add extra top layer if necessary. | [
"Add",
"extra",
"top",
"layer",
"if",
"necessary",
"."
] | def addExtraTopLayerIfNecessary( self, carving, layerThickness, rotatedBoundaryLayers ):
"Add extra top layer if necessary."
topRotatedBoundaryLayer = rotatedBoundaryLayers[-1]
cuttingSafeHeight = topRotatedBoundaryLayer.z + 0.5001 * layerThickness
if cuttingSafeHeight > carving.getCarveCornerMaximum().z:
re... | [
"def",
"addExtraTopLayerIfNecessary",
"(",
"self",
",",
"carving",
",",
"layerThickness",
",",
"rotatedBoundaryLayers",
")",
":",
"topRotatedBoundaryLayer",
"=",
"rotatedBoundaryLayers",
"[",
"-",
"1",
"]",
"cuttingSafeHeight",
"=",
"topRotatedBoundaryLayer",
".",
"z",
... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/chop.py#L196-L203 | ||
dmlc/gluon-cv | 709bc139919c02f7454cb411311048be188cde64 | gluoncv/model_zoo/rcnn/rcnn.py | python | RCNN.hybrid_forward | (self, F, x, width, height) | Not implemented yet. | Not implemented yet. | [
"Not",
"implemented",
"yet",
"."
] | def hybrid_forward(self, F, x, width, height):
"""Not implemented yet."""
raise NotImplementedError | [
"def",
"hybrid_forward",
"(",
"self",
",",
"F",
",",
"x",
",",
"width",
",",
"height",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/gluoncv/model_zoo/rcnn/rcnn.py#L250-L252 | ||
praetorian-inc/pentestly | 93d1b398e30572fc8661cf5f4d4245b8969d7552 | recon/core/framework.py | python | Framework.show_schema | (self) | Displays the database schema | Displays the database schema | [
"Displays",
"the",
"database",
"schema"
] | def show_schema(self):
'''Displays the database schema'''
tables = self.get_tables()
for table in tables:
columns = self.get_columns(table)
self.table(columns, title=table) | [
"def",
"show_schema",
"(",
"self",
")",
":",
"tables",
"=",
"self",
".",
"get_tables",
"(",
")",
"for",
"table",
"in",
"tables",
":",
"columns",
"=",
"self",
".",
"get_columns",
"(",
"table",
")",
"self",
".",
"table",
"(",
"columns",
",",
"title",
"... | https://github.com/praetorian-inc/pentestly/blob/93d1b398e30572fc8661cf5f4d4245b8969d7552/recon/core/framework.py#L580-L585 | ||
yongzhuo/Macropodus | 1d7b8f9938cb8b6d7744e9caabc3eb41c8891283 | macropodus/tookit/trie_tree/trie_tree.py | python | TrieTree.add_keywords_from_list | (self, keywords) | 新增关键词s, 格式为list
:param keyword: list, 构建的关键词
:return: None | 新增关键词s, 格式为list
:param keyword: list, 构建的关键词
:return: None | [
"新增关键词s",
"格式为list",
":",
"param",
"keyword",
":",
"list",
"构建的关键词",
":",
"return",
":",
"None"
] | def add_keywords_from_list(self, keywords):
"""
新增关键词s, 格式为list
:param keyword: list, 构建的关键词
:return: None
"""
for keyword in keywords:
self.add_keyword(keyword) | [
"def",
"add_keywords_from_list",
"(",
"self",
",",
"keywords",
")",
":",
"for",
"keyword",
"in",
"keywords",
":",
"self",
".",
"add_keyword",
"(",
"keyword",
")"
] | https://github.com/yongzhuo/Macropodus/blob/1d7b8f9938cb8b6d7744e9caabc3eb41c8891283/macropodus/tookit/trie_tree/trie_tree.py#L68-L75 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/tornado/database.py | python | Connection.executemany | (self, query, parameters) | return self.executemany_lastrowid(query, parameters) | Executes the given query against all the given param sequences.
We return the lastrowid from the query. | Executes the given query against all the given param sequences. | [
"Executes",
"the",
"given",
"query",
"against",
"all",
"the",
"given",
"param",
"sequences",
"."
] | def executemany(self, query, parameters):
"""Executes the given query against all the given param sequences.
We return the lastrowid from the query.
"""
return self.executemany_lastrowid(query, parameters) | [
"def",
"executemany",
"(",
"self",
",",
"query",
",",
"parameters",
")",
":",
"return",
"self",
".",
"executemany_lastrowid",
"(",
"query",
",",
"parameters",
")"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tornado/database.py#L160-L165 | |
scrapy/scrapy | b04cfa48328d5d5749dca6f50fa34e0cfc664c89 | scrapy/commands/parse.py | python | Command.max_level | (self) | return max(max_items, max_requests) | [] | def max_level(self):
max_items, max_requests = 0, 0
if self.items:
max_items = max(self.items)
if self.requests:
max_requests = max(self.requests)
return max(max_items, max_requests) | [
"def",
"max_level",
"(",
"self",
")",
":",
"max_items",
",",
"max_requests",
"=",
"0",
",",
"0",
"if",
"self",
".",
"items",
":",
"max_items",
"=",
"max",
"(",
"self",
".",
"items",
")",
"if",
"self",
".",
"requests",
":",
"max_requests",
"=",
"max",... | https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/commands/parse.py#L59-L65 | |||
facebookresearch/mmf | fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f | mmf/utils/m4c_evaluators.py | python | STVQAAccuracyEvaluator.__init__ | (self) | [] | def __init__(self):
self.answer_processor = EvalAIAnswerProcessor() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"answer_processor",
"=",
"EvalAIAnswerProcessor",
"(",
")"
] | https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/utils/m4c_evaluators.py#L259-L260 | ||||
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/tasks/car/builder_lib.py | python | ModelBuilderBase._SeqOnKey | (self, name, key, *subs) | return self._SeqToKey(name, key, self._GetValue('get_{}'.format(key), key),
*subs) | Sequential layers operating on a specific key only. | Sequential layers operating on a specific key only. | [
"Sequential",
"layers",
"operating",
"on",
"a",
"specific",
"key",
"only",
"."
] | def _SeqOnKey(self, name, key, *subs):
"""Sequential layers operating on a specific key only."""
return self._SeqToKey(name, key, self._GetValue('get_{}'.format(key), key),
*subs) | [
"def",
"_SeqOnKey",
"(",
"self",
",",
"name",
",",
"key",
",",
"*",
"subs",
")",
":",
"return",
"self",
".",
"_SeqToKey",
"(",
"name",
",",
"key",
",",
"self",
".",
"_GetValue",
"(",
"'get_{}'",
".",
"format",
"(",
"key",
")",
",",
"key",
")",
",... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/tasks/car/builder_lib.py#L673-L676 | |
Yukinoshita47/Yuki-Chan-The-Auto-Pentest | bea1af4e1d544eadc166f728be2f543ea10af191 | Module/dnsrecon/lib/dnshelper.py | python | DnsHelper.get_txt | (self, target=None) | return txt_record | Function for TXT Record resolving returns the string. | Function for TXT Record resolving returns the string. | [
"Function",
"for",
"TXT",
"Record",
"resolving",
"returns",
"the",
"string",
"."
] | def get_txt(self, target=None):
"""
Function for TXT Record resolving returns the string.
"""
txt_record = []
if target is None:
target = self._domain
try:
answers = self._res.query(target, 'TXT')
for rdata in answers:
s... | [
"def",
"get_txt",
"(",
"self",
",",
"target",
"=",
"None",
")",
":",
"txt_record",
"=",
"[",
"]",
"if",
"target",
"is",
"None",
":",
"target",
"=",
"self",
".",
"_domain",
"try",
":",
"answers",
"=",
"self",
".",
"_res",
".",
"query",
"(",
"target"... | https://github.com/Yukinoshita47/Yuki-Chan-The-Auto-Pentest/blob/bea1af4e1d544eadc166f728be2f543ea10af191/Module/dnsrecon/lib/dnshelper.py#L241-L256 | |
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py | python | LegacyMetadata.write_file | (self, fileobject, skip_unknown=False) | Write the PKG-INFO format data to a file object. | Write the PKG-INFO format data to a file object. | [
"Write",
"the",
"PKG",
"-",
"INFO",
"format",
"data",
"to",
"a",
"file",
"object",
"."
] | def write_file(self, fileobject, skip_unknown=False):
"""Write the PKG-INFO format data to a file object."""
self.set_metadata_version()
for field in _version2fieldlist(self['Metadata-Version']):
values = self.get(field)
if skip_unknown and values in ('UNKNOWN', [], ['UN... | [
"def",
"write_file",
"(",
"self",
",",
"fileobject",
",",
"skip_unknown",
"=",
"False",
")",
":",
"self",
".",
"set_metadata_version",
"(",
")",
"for",
"field",
"in",
"_version2fieldlist",
"(",
"self",
"[",
"'Metadata-Version'",
"]",
")",
":",
"values",
"=",... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py#L368-L391 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/PIL/ImageFont.py | python | FreeTypeFont.getoffset | (self, text) | return self.font.getsize(text)[1] | [] | def getoffset(self, text):
return self.font.getsize(text)[1] | [
"def",
"getoffset",
"(",
"self",
",",
"text",
")",
":",
"return",
"self",
".",
"font",
".",
"getsize",
"(",
"text",
")",
"[",
"1",
"]"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/PIL/ImageFont.py#L160-L161 | |||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | contrib/tools/sqldata_from_path.py | python | usage | (error_msg=None) | [] | def usage(error_msg=None):
if error_msg:
print(error_msg)
print("sqldata_from_path PATH")
print("")
print("PATH filestore or HTTP path")
print("""
Prints out an SQL statement that can be used in an SQL shell against
an sqlstore database to return the calendar or address data for the
provi... | [
"def",
"usage",
"(",
"error_msg",
"=",
"None",
")",
":",
"if",
"error_msg",
":",
"print",
"(",
"error_msg",
")",
"print",
"(",
"\"sqldata_from_path PATH\"",
")",
"print",
"(",
"\"\"",
")",
"print",
"(",
"\"PATH filestore or HTTP path\"",
")",
"print",
"(",
... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/contrib/tools/sqldata_from_path.py#L29-L45 | ||||
internetarchive/openlibrary | 33b9b005ecb0adeda690c67952f5ae5f1fe3a8d8 | scripts/solr_builder/solr_builder/index_subjects.py | python | index_subjects | (
subject_type: Literal['subject', 'person', 'place', 'time'],
offset=0,
limit=1,
solr_base_url='http://solr:8983/solr/openlibrary',
skip_id_check=False,
) | return len(docs) | :return: Returns number of rows added | :return: Returns number of rows added | [
":",
"return",
":",
"Returns",
"number",
"of",
"rows",
"added"
] | async def index_subjects(
subject_type: Literal['subject', 'person', 'place', 'time'],
offset=0,
limit=1,
solr_base_url='http://solr:8983/solr/openlibrary',
skip_id_check=False,
):
"""
:return: Returns number of rows added
"""
print(json.dumps({'event': 'starting', 'offset': offset})... | [
"async",
"def",
"index_subjects",
"(",
"subject_type",
":",
"Literal",
"[",
"'subject'",
",",
"'person'",
",",
"'place'",
",",
"'time'",
"]",
",",
"offset",
"=",
"0",
",",
"limit",
"=",
"1",
",",
"solr_base_url",
"=",
"'http://solr:8983/solr/openlibrary'",
","... | https://github.com/internetarchive/openlibrary/blob/33b9b005ecb0adeda690c67952f5ae5f1fe3a8d8/scripts/solr_builder/solr_builder/index_subjects.py#L13-L67 | |
windelbouwman/ppci | 915c069e0667042c085ec42c78e9e3c9a5295324 | ppci/format/hunk/writer.py | python | Writer.write_header | (self, hunk_sizes) | Write a header hunk | Write a header hunk | [
"Write",
"a",
"header",
"hunk"
] | def write_header(self, hunk_sizes):
""" Write a header hunk """
self.write_u32(enums.HUNK_HEADER)
self.write_string("")
first_hunk = last_hunk = 0
self.write_u32(1) # table size
self.write_u32(first_hunk)
self.write_u32(last_hunk)
for hunk_size in hunk_si... | [
"def",
"write_header",
"(",
"self",
",",
"hunk_sizes",
")",
":",
"self",
".",
"write_u32",
"(",
"enums",
".",
"HUNK_HEADER",
")",
"self",
".",
"write_string",
"(",
"\"\"",
")",
"first_hunk",
"=",
"last_hunk",
"=",
"0",
"self",
".",
"write_u32",
"(",
"1",... | https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/format/hunk/writer.py#L32-L41 | ||
gammapy/gammapy | 735b25cd5bbed35e2004d633621896dcd5295e8b | gammapy/estimators/map/core.py | python | FluxMaps.ts_scan | (self) | return self.stat_scan - np.expand_dims(self.stat.data, 2) | ts scan (`Map`) | ts scan (`Map`) | [
"ts",
"scan",
"(",
"Map",
")"
] | def ts_scan(self):
"""ts scan (`Map`)"""
return self.stat_scan - np.expand_dims(self.stat.data, 2) | [
"def",
"ts_scan",
"(",
"self",
")",
":",
"return",
"self",
".",
"stat_scan",
"-",
"np",
".",
"expand_dims",
"(",
"self",
".",
"stat",
".",
"data",
",",
"2",
")"
] | https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/estimators/map/core.py#L480-L482 | |
pkumza/LibRadar | 2fa3891123e5fd97d631fbe14bf029714c328ca3 | LibRadar/job_dispatching.py | python | DexExtractorWrapper.execute | (self) | [] | def execute(self):
logger.info("Process %s is running" % self.p_name)
while True:
try:
self.app_path = self.queue.get(block=True, timeout=QUEUE_TIME_OUT)
except: # multiprocessing.Manager().Queue.Empty:
break
logger.debug("Process %s is... | [
"def",
"execute",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Process %s is running\"",
"%",
"self",
".",
"p_name",
")",
"while",
"True",
":",
"try",
":",
"self",
".",
"app_path",
"=",
"self",
".",
"queue",
".",
"get",
"(",
"block",
"=",
"T... | https://github.com/pkumza/LibRadar/blob/2fa3891123e5fd97d631fbe14bf029714c328ca3/LibRadar/job_dispatching.py#L64-L99 | ||||
bachya/smart-home | 536b989e0d7057c7a8a65b2ac9bbffd4b826cce7 | hass/settings/custom_components/hacs/operational/setup.py | python | async_startup_wrapper_for_yaml | (_=None) | Startup wrapper for yaml config. | Startup wrapper for yaml config. | [
"Startup",
"wrapper",
"for",
"yaml",
"config",
"."
] | async def async_startup_wrapper_for_yaml(_=None):
"""Startup wrapper for yaml config."""
hacs = get_hacs()
try:
startup_result = await async_hacs_startup()
except AIOGitHubAPIException:
startup_result = False
if not startup_result:
hacs.log.info("Could not setup HACS, trying ... | [
"async",
"def",
"async_startup_wrapper_for_yaml",
"(",
"_",
"=",
"None",
")",
":",
"hacs",
"=",
"get_hacs",
"(",
")",
"try",
":",
"startup_result",
"=",
"await",
"async_hacs_startup",
"(",
")",
"except",
"AIOGitHubAPIException",
":",
"startup_result",
"=",
"Fals... | https://github.com/bachya/smart-home/blob/536b989e0d7057c7a8a65b2ac9bbffd4b826cce7/hass/settings/custom_components/hacs/operational/setup.py#L133-L144 | ||
playframework/play1 | 0ecac3bc2421ae2dbec27a368bf671eda1c9cba5 | python/Lib/sysconfig.py | python | get_config_h_filename | () | return os.path.join(inc_dir, 'pyconfig.h') | Returns the path of pyconfig.h. | Returns the path of pyconfig.h. | [
"Returns",
"the",
"path",
"of",
"pyconfig",
".",
"h",
"."
] | def get_config_h_filename():
"""Returns the path of pyconfig.h."""
if _PYTHON_BUILD:
if os.name == "nt":
inc_dir = os.path.join(_PROJECT_BASE, "PC")
else:
inc_dir = _PROJECT_BASE
else:
inc_dir = get_path('platinclude')
return os.path.join(inc_dir, 'pyconfi... | [
"def",
"get_config_h_filename",
"(",
")",
":",
"if",
"_PYTHON_BUILD",
":",
"if",
"os",
".",
"name",
"==",
"\"nt\"",
":",
"inc_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_PROJECT_BASE",
",",
"\"PC\"",
")",
"else",
":",
"inc_dir",
"=",
"_PROJECT_BASE... | https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/sysconfig.py#L404-L413 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/python-openid/openid/extensions/sreg.py | python | SRegResponse.items | (self) | return self.data.items() | All of the data values in this simple registration response | All of the data values in this simple registration response | [
"All",
"of",
"the",
"data",
"values",
"in",
"this",
"simple",
"registration",
"response"
] | def items(self):
"""All of the data values in this simple registration response
"""
return self.data.items() | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"self",
".",
"data",
".",
"items",
"(",
")"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/python-openid/openid/extensions/sreg.py#L489-L492 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/enum.py | python | IntFlag.__invert__ | (self) | return result | [] | def __invert__(self):
result = self.__class__(~self._value_)
return result | [
"def",
"__invert__",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"__class__",
"(",
"~",
"self",
".",
"_value_",
")",
"return",
"result"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/enum.py#L847-L849 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/partition_algebra.py | python | SetPartitionsRk_k._repr_ | (self) | return SetPartitionsAk_k._repr_(self) + " with at most 1 positive and negative entry in each block" | TESTS::
sage: SetPartitionsRk(3)
Set partitions of {1, ..., 3, -1, ..., -3} with at most 1 positive and negative entry in each block | TESTS:: | [
"TESTS",
"::"
] | def _repr_(self):
"""
TESTS::
sage: SetPartitionsRk(3)
Set partitions of {1, ..., 3, -1, ..., -3} with at most 1 positive and negative entry in each block
"""
return SetPartitionsAk_k._repr_(self) + " with at most 1 positive and negative entry in each block" | [
"def",
"_repr_",
"(",
"self",
")",
":",
"return",
"SetPartitionsAk_k",
".",
"_repr_",
"(",
"self",
")",
"+",
"\" with at most 1 positive and negative entry in each block\""
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/partition_algebra.py#L1175-L1182 | |
pytorch/botorch | f85fb8ff36d21e21bdb881d107982fb6d5d78704 | botorch/acquisition/knowledge_gradient.py | python | qKnowledgeGradient.get_augmented_q_batch_size | (self, q: int) | return q + self.num_fantasies | r"""Get augmented q batch size for one-shot optimization.
Args:
q: The number of candidates to consider jointly.
Returns:
The augmented size for one-shot optimization (including variables
parameterizing the fantasy solutions). | r"""Get augmented q batch size for one-shot optimization. | [
"r",
"Get",
"augmented",
"q",
"batch",
"size",
"for",
"one",
"-",
"shot",
"optimization",
"."
] | def get_augmented_q_batch_size(self, q: int) -> int:
r"""Get augmented q batch size for one-shot optimization.
Args:
q: The number of candidates to consider jointly.
Returns:
The augmented size for one-shot optimization (including variables
parameterizing th... | [
"def",
"get_augmented_q_batch_size",
"(",
"self",
",",
"q",
":",
"int",
")",
"->",
"int",
":",
"return",
"q",
"+",
"self",
".",
"num_fantasies"
] | https://github.com/pytorch/botorch/blob/f85fb8ff36d21e21bdb881d107982fb6d5d78704/botorch/acquisition/knowledge_gradient.py#L262-L272 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/beanstalk/layer1.py | python | Layer1.list_available_solution_stacks | (self) | return self._get_response('ListAvailableSolutionStacks', params={}) | Returns a list of the available solution stack names. | Returns a list of the available solution stack names. | [
"Returns",
"a",
"list",
"of",
"the",
"available",
"solution",
"stack",
"names",
"."
] | def list_available_solution_stacks(self):
"""Returns a list of the available solution stack names."""
return self._get_response('ListAvailableSolutionStacks', params={}) | [
"def",
"list_available_solution_stacks",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_response",
"(",
"'ListAvailableSolutionStacks'",
",",
"params",
"=",
"{",
"}",
")"
] | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/beanstalk/layer1.py#L754-L756 | |
X-DataInitiative/tick | bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48 | tick/hawkes/inference/hawkes_conditional_law.py | python | HawkesConditionalLaw.get_kernel_norms | (self) | return np.array(self.kernels_norms) | Computes kernel norms. This makes our learner compliant with
`tick.plot.plot_hawkes_kernel_norms` API
Returns
-------
norms : `np.ndarray`, shape=(n_nodes, n_nodes)
2d array in which each entry i, j corresponds to the norm of
kernel i, j | Computes kernel norms. This makes our learner compliant with
`tick.plot.plot_hawkes_kernel_norms` API | [
"Computes",
"kernel",
"norms",
".",
"This",
"makes",
"our",
"learner",
"compliant",
"with",
"tick",
".",
"plot",
".",
"plot_hawkes_kernel_norms",
"API"
] | def get_kernel_norms(self):
"""Computes kernel norms. This makes our learner compliant with
`tick.plot.plot_hawkes_kernel_norms` API
Returns
-------
norms : `np.ndarray`, shape=(n_nodes, n_nodes)
2d array in which each entry i, j corresponds to the norm of
... | [
"def",
"get_kernel_norms",
"(",
"self",
")",
":",
"# we need to convert it to a numpy array",
"return",
"np",
".",
"array",
"(",
"self",
".",
"kernels_norms",
")"
] | https://github.com/X-DataInitiative/tick/blob/bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48/tick/hawkes/inference/hawkes_conditional_law.py#L1157-L1168 | |
architv/soccer-cli | 04932b677eed1fef032eaccffebabfcaeec2d48b | soccer/writers.py | python | Csv.team_scores | (self, team_scores, time) | Store output of team scores to a CSV file | Store output of team scores to a CSV file | [
"Store",
"output",
"of",
"team",
"scores",
"to",
"a",
"CSV",
"file"
] | def team_scores(self, team_scores, time):
"""Store output of team scores to a CSV file"""
headers = ['Date', 'Home Team Name', 'Home Team Goals',
'Away Team Goals', 'Away Team Name']
result = [headers]
result.extend([score["utcDate"].split('T')[0],
... | [
"def",
"team_scores",
"(",
"self",
",",
"team_scores",
",",
"time",
")",
":",
"headers",
"=",
"[",
"'Date'",
",",
"'Home Team Name'",
",",
"'Home Team Goals'",
",",
"'Away Team Goals'",
",",
"'Away Team Name'",
"]",
"result",
"=",
"[",
"headers",
"]",
"result"... | https://github.com/architv/soccer-cli/blob/04932b677eed1fef032eaccffebabfcaeec2d48b/soccer/writers.py#L230-L242 | ||
hackappcom/iloot | 9362ac94dbb77a611e654f0622c89cb7ad31ed8a | util/bplist.py | python | BPListWriter.binary | (self) | return self.data | binary -> string
Generates bplist | binary -> string | [
"binary",
"-",
">",
"string"
] | def binary(self):
'''binary -> string
Generates bplist
'''
self.data = 'bplist00'
# TODO: flatten objects and count max length size
# TODO: write objects and save offsets
# TODO: write offsets
# TODO: write metadata
return self.data | [
"def",
"binary",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"'bplist00'",
"# TODO: flatten objects and count max length size",
"# TODO: write objects and save offsets",
"# TODO: write offsets",
"# TODO: write metadata",
"return",
"self",
".",
"data"
] | https://github.com/hackappcom/iloot/blob/9362ac94dbb77a611e654f0622c89cb7ad31ed8a/util/bplist.py#L13-L28 | |
tensorflow/datasets | 2e496976d7d45550508395fb2f35cf958c8a3414 | tensorflow_datasets/d4rl/dataset_utils.py | python | read_d4rl_dataset | (file_path: str) | Reads a D4RL dataset and returns the dataset as a dictionary. | Reads a D4RL dataset and returns the dataset as a dictionary. | [
"Reads",
"a",
"D4RL",
"dataset",
"and",
"returns",
"the",
"dataset",
"as",
"a",
"dictionary",
"."
] | def read_d4rl_dataset(file_path: str):
"""Reads a D4RL dataset and returns the dataset as a dictionary."""
with gfile.GFile(file_path, 'rb') as f:
with h5py.File(f, 'r') as dataset_file:
dataset_dict = {}
for k in _get_dataset_keys(dataset_file):
try:
# first try loading as an arra... | [
"def",
"read_d4rl_dataset",
"(",
"file_path",
":",
"str",
")",
":",
"with",
"gfile",
".",
"GFile",
"(",
"file_path",
",",
"'rb'",
")",
"as",
"f",
":",
"with",
"h5py",
".",
"File",
"(",
"f",
",",
"'r'",
")",
"as",
"dataset_file",
":",
"dataset_dict",
... | https://github.com/tensorflow/datasets/blob/2e496976d7d45550508395fb2f35cf958c8a3414/tensorflow_datasets/d4rl/dataset_utils.py#L230-L242 | ||
postlund/pyatv | 4ed1f5539f37d86d80272663d1f2ea34a6c41ec4 | pyatv/protocols/companion/server_auth.py | python | CompanionServerAuth.send_to_client | (self, frame_type: FrameType, data: object) | Send data to client device (iOS). | Send data to client device (iOS). | [
"Send",
"data",
"to",
"client",
"device",
"(",
"iOS",
")",
"."
] | def send_to_client(self, frame_type: FrameType, data: object) -> None:
"""Send data to client device (iOS).""" | [
"def",
"send_to_client",
"(",
"self",
",",
"frame_type",
":",
"FrameType",
",",
"data",
":",
"object",
")",
"->",
"None",
":"
] | https://github.com/postlund/pyatv/blob/4ed1f5539f37d86d80272663d1f2ea34a6c41ec4/pyatv/protocols/companion/server_auth.py#L232-L233 | ||
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/ptn/metrics.py | python | add_image_pred_metrics | (
inputs, outputs, num_views, upscale_factor) | return names_to_values, names_to_updates | Computes the image prediction metrics.
Args:
inputs: Input dictionary of the deep rotator model (model_rotator.py).
outputs: Output dictionary of the deep rotator model (model_rotator.py).
num_views: An integer scalar representing the total number
of different viewpoints for each object in the data... | Computes the image prediction metrics. | [
"Computes",
"the",
"image",
"prediction",
"metrics",
"."
] | def add_image_pred_metrics(
inputs, outputs, num_views, upscale_factor):
"""Computes the image prediction metrics.
Args:
inputs: Input dictionary of the deep rotator model (model_rotator.py).
outputs: Output dictionary of the deep rotator model (model_rotator.py).
num_views: An integer scalar repre... | [
"def",
"add_image_pred_metrics",
"(",
"inputs",
",",
"outputs",
",",
"num_views",
",",
"upscale_factor",
")",
":",
"names_to_values",
"=",
"dict",
"(",
")",
"names_to_updates",
"=",
"dict",
"(",
")",
"for",
"k",
"in",
"xrange",
"(",
"num_views",
")",
":",
... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/ptn/metrics.py#L28-L54 | |
duo-labs/isthislegit | 5d51fd2e0fe070cacd1ee169ca8a371a72e005ef | dashboard/lib/flanker/mime/message/part.py | python | MimePart.content_encoding | (self) | return self.headers.get(
'Content-Transfer-Encoding', WithParams('7bit')) | [] | def content_encoding(self):
return self.headers.get(
'Content-Transfer-Encoding', WithParams('7bit')) | [
"def",
"content_encoding",
"(",
"self",
")",
":",
"return",
"self",
".",
"headers",
".",
"get",
"(",
"'Content-Transfer-Encoding'",
",",
"WithParams",
"(",
"'7bit'",
")",
")"
] | https://github.com/duo-labs/isthislegit/blob/5d51fd2e0fe070cacd1ee169ca8a371a72e005ef/dashboard/lib/flanker/mime/message/part.py#L440-L442 | |||
sz128/slot_filling_and_intent_detection_of_SLU | 40f334417a93bcfd4bb3da2cf043ab13973ae695 | models/optimization.py | python | BertAdam.step | (self, closure=None) | return loss | Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss. | Performs a single optimization step. | [
"Performs",
"a",
"single",
"optimization",
"step",
"."
] | def step(self, closure=None):
"""Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss.
"""
loss = None
if closure is not None:
loss = closure()
for... | [
"def",
"step",
"(",
"self",
",",
"closure",
"=",
"None",
")",
":",
"loss",
"=",
"None",
"if",
"closure",
"is",
"not",
"None",
":",
"loss",
"=",
"closure",
"(",
")",
"for",
"group",
"in",
"self",
".",
"param_groups",
":",
"for",
"p",
"in",
"group",
... | https://github.com/sz128/slot_filling_and_intent_detection_of_SLU/blob/40f334417a93bcfd4bb3da2cf043ab13973ae695/models/optimization.py#L237-L302 | |
PaddlePaddle/PARL | 5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96 | examples/tutorials/parl2_dygraph/lesson3/homework/dqn_mountaincar/agent.py | python | Agent.learn | (self, obs, act, reward, next_obs, terminal) | return loss.numpy()[0] | 根据训练数据更新一次模型参数 | 根据训练数据更新一次模型参数 | [
"根据训练数据更新一次模型参数"
] | def learn(self, obs, act, reward, next_obs, terminal):
""" 根据训练数据更新一次模型参数
"""
if self.global_step % self.update_target_steps == 0:
self.alg.sync_target()
self.global_step += 1
act = np.expand_dims(act, axis=-1)
reward = np.expand_dims(reward, axis=-1)
... | [
"def",
"learn",
"(",
"self",
",",
"obs",
",",
"act",
",",
"reward",
",",
"next_obs",
",",
"terminal",
")",
":",
"if",
"self",
".",
"global_step",
"%",
"self",
".",
"update_target_steps",
"==",
"0",
":",
"self",
".",
"alg",
".",
"sync_target",
"(",
")... | https://github.com/PaddlePaddle/PARL/blob/5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96/examples/tutorials/parl2_dygraph/lesson3/homework/dqn_mountaincar/agent.py#L54-L71 | |
NervanaSystems/neon | 8c3fb8a93b4a89303467b25817c60536542d08bd | neon/layers/recurrent.py | python | interpret_in_shape | (xshape) | return (nin, nsteps) | Helper function to interpret the tensor layout of preceding layer for input
to a recurrent layer. Handles non-recurrent, recurrent, and local layers | Helper function to interpret the tensor layout of preceding layer for input
to a recurrent layer. Handles non-recurrent, recurrent, and local layers | [
"Helper",
"function",
"to",
"interpret",
"the",
"tensor",
"layout",
"of",
"preceding",
"layer",
"for",
"input",
"to",
"a",
"recurrent",
"layer",
".",
"Handles",
"non",
"-",
"recurrent",
"recurrent",
"and",
"local",
"layers"
] | def interpret_in_shape(xshape):
"""
Helper function to interpret the tensor layout of preceding layer for input
to a recurrent layer. Handles non-recurrent, recurrent, and local layers
"""
if isinstance(xshape, int):
nin, nsteps = xshape, 1
else:
if len(xshape) == 2:
... | [
"def",
"interpret_in_shape",
"(",
"xshape",
")",
":",
"if",
"isinstance",
"(",
"xshape",
",",
"int",
")",
":",
"nin",
",",
"nsteps",
"=",
"xshape",
",",
"1",
"else",
":",
"if",
"len",
"(",
"xshape",
")",
"==",
"2",
":",
"nin",
",",
"nsteps",
"=",
... | https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/neon/layers/recurrent.py#L35-L48 | |
pubref/rules_protobuf | 99043441e3c473809f633f5ad049945606124b60 | examples/helloworld/python/greeter_server.py | python | _GreeterServer.await_termination | (self) | server.start() doesn't block so we explicitly block here unless someone keyboard-exits us.
:return: | server.start() doesn't block so we explicitly block here unless someone keyboard-exits us.
:return: | [
"server",
".",
"start",
"()",
"doesn",
"t",
"block",
"so",
"we",
"explicitly",
"block",
"here",
"unless",
"someone",
"keyboard",
"-",
"exits",
"us",
".",
":",
"return",
":"
] | def await_termination(self):
"""
server.start() doesn't block so we explicitly block here unless someone keyboard-exits us.
:return:
"""
try:
while True:
time.sleep(_ONE_DAY_IN_SECONDS)
except KeyboardInterrupt:
self.server.stop(0)
... | [
"def",
"await_termination",
"(",
"self",
")",
":",
"try",
":",
"while",
"True",
":",
"time",
".",
"sleep",
"(",
"_ONE_DAY_IN_SECONDS",
")",
"except",
"KeyboardInterrupt",
":",
"self",
".",
"server",
".",
"stop",
"(",
"0",
")",
"pass"
] | https://github.com/pubref/rules_protobuf/blob/99043441e3c473809f633f5ad049945606124b60/examples/helloworld/python/greeter_server.py#L57-L67 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/_pyio.py | python | TextIOBase.encoding | (self) | return None | Subclasses should override. | Subclasses should override. | [
"Subclasses",
"should",
"override",
"."
] | def encoding(self):
"""Subclasses should override."""
return None | [
"def",
"encoding",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/_pyio.py#L1345-L1347 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/dynamic/maps/singular.py | python | SingularMap.__init__ | (self, config) | [] | def __init__(self, config):
DynamicMap.__init__(self, config) | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"DynamicMap",
".",
"__init__",
"(",
"self",
",",
"config",
")"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/dynamic/maps/singular.py#L28-L29 | ||||
fkie/multimaster_fkie | 3d23df29d25d71a75c66bbd3cc6e9cbb255724d8 | fkie_node_manager_daemon/src/fkie_node_manager_daemon/screen.py | python | get_active_screens | (nodename='') | return result | Returns the dictionary (session name: node name) with all compatible screen names. If the session is set to
an empty string all screens will be returned.
:param str nodename: the name of the node.
:return: On empty nodename returns all screen.
:rtype: {str: [str]} | Returns the dictionary (session name: node name) with all compatible screen names. If the session is set to
an empty string all screens will be returned. | [
"Returns",
"the",
"dictionary",
"(",
"session",
"name",
":",
"node",
"name",
")",
"with",
"all",
"compatible",
"screen",
"names",
".",
"If",
"the",
"session",
"is",
"set",
"to",
"an",
"empty",
"string",
"all",
"screens",
"will",
"be",
"returned",
"."
] | def get_active_screens(nodename=''):
'''
Returns the dictionary (session name: node name) with all compatible screen names. If the session is set to
an empty string all screens will be returned.
:param str nodename: the name of the node.
:return: On empty nodename returns all screen.
:rtype: {s... | [
"def",
"get_active_screens",
"(",
"nodename",
"=",
"''",
")",
":",
"result",
"=",
"{",
"}",
"starttime",
"=",
"time",
".",
"time",
"(",
")",
"ps",
"=",
"SupervisedPopen",
"(",
"[",
"SCREEN",
",",
"'-ls'",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"... | https://github.com/fkie/multimaster_fkie/blob/3d23df29d25d71a75c66bbd3cc6e9cbb255724d8/fkie_node_manager_daemon/src/fkie_node_manager_daemon/screen.py#L114-L144 | |
jupyterhub/repo2docker | a37a205c0e8a59240933d20c1c4fb80767e71db2 | repo2docker/app.py | python | Repo2Docker.start_container | (self) | return container | Start docker container from built image
Returns running container | Start docker container from built image | [
"Start",
"docker",
"container",
"from",
"built",
"image"
] | def start_container(self):
"""Start docker container from built image
Returns running container
"""
client = self.get_engine()
docker_host = os.environ.get("DOCKER_HOST")
if docker_host:
host_name = urlparse(docker_host).hostname
else:
ho... | [
"def",
"start_container",
"(",
"self",
")",
":",
"client",
"=",
"self",
".",
"get_engine",
"(",
")",
"docker_host",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"DOCKER_HOST\"",
")",
"if",
"docker_host",
":",
"host_name",
"=",
"urlparse",
"(",
"docker_hos... | https://github.com/jupyterhub/repo2docker/blob/a37a205c0e8a59240933d20c1c4fb80767e71db2/repo2docker/app.py#L577-L645 | |
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/RetinaNet/keras-retinanet/keras_retinanet/models/resnet.py | python | download_imagenet | (backbone) | return keras.applications.imagenet_utils.get_file(
filename,
resource,
cache_subdir='models',
md5_hash=checksum
) | [] | def download_imagenet(backbone):
validate_backbone(backbone)
backbone = int(backbone.replace('resnet', ''))
filename = resnet_filename.format(backbone)
resource = resnet_resource.format(backbone)
if backbone == 50:
checksum = '3e9f4e4f77bbe2c9bec13b53ee1c2319'
elif backbone == 101:
... | [
"def",
"download_imagenet",
"(",
"backbone",
")",
":",
"validate_backbone",
"(",
"backbone",
")",
"backbone",
"=",
"int",
"(",
"backbone",
".",
"replace",
"(",
"'resnet'",
",",
"''",
")",
")",
"filename",
"=",
"resnet_filename",
".",
"format",
"(",
"backbone... | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/RetinaNet/keras-retinanet/keras_retinanet/models/resnet.py#L33-L52 | |||
microsoft/ptvsd | 99c8513921021d2cc7cd82e132b65c644c256768 | src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/search.py | python | BytePattern.__len__ | (self) | return self.length | Returns the exact length of the pattern.
@see: L{Pattern.__len__} | Returns the exact length of the pattern. | [
"Returns",
"the",
"exact",
"length",
"of",
"the",
"pattern",
"."
] | def __len__(self):
"""
Returns the exact length of the pattern.
@see: L{Pattern.__len__}
"""
return self.length | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"self",
".",
"length"
] | https://github.com/microsoft/ptvsd/blob/99c8513921021d2cc7cd82e132b65c644c256768/src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/search.py#L193-L199 | |
j-min/Adversarial_Video_Summary | 25c7955f44c5a770dc41d4f2c2829dd77f5aa13e | layers/summarizer.py | python | dLSTM.__init__ | (self, input_size=2048, hidden_size=2048, num_layers=2) | Decoder LSTM | Decoder LSTM | [
"Decoder",
"LSTM"
] | def __init__(self, input_size=2048, hidden_size=2048, num_layers=2):
"""Decoder LSTM"""
super().__init__()
self.lstm_cell = StackedLSTMCell(num_layers, input_size, hidden_size)
self.out = nn.Linear(hidden_size, input_size) | [
"def",
"__init__",
"(",
"self",
",",
"input_size",
"=",
"2048",
",",
"hidden_size",
"=",
"2048",
",",
"num_layers",
"=",
"2",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"lstm_cell",
"=",
"StackedLSTMCell",
"(",
"num_layers",
"... | https://github.com/j-min/Adversarial_Video_Summary/blob/25c7955f44c5a770dc41d4f2c2829dd77f5aa13e/layers/summarizer.py#L63-L68 | ||
tanghaibao/jcvi | 5e720870c0928996f8b77a38208106ff0447ccb6 | jcvi/variation/deconvolute.py | python | split | (args) | %prog split barcodefile fastqfile1 ..
Deconvolute fastq files into subsets of fastq reads, based on the barcodes
in the barcodefile, which is a two-column file like:
ID01 AGTCCAG
Input fastqfiles can be several files. Output files are ID01.fastq,
ID02.fastq, one file per line in barcodefile.
... | %prog split barcodefile fastqfile1 .. | [
"%prog",
"split",
"barcodefile",
"fastqfile1",
".."
] | def split(args):
"""
%prog split barcodefile fastqfile1 ..
Deconvolute fastq files into subsets of fastq reads, based on the barcodes
in the barcodefile, which is a two-column file like:
ID01 AGTCCAG
Input fastqfiles can be several files. Output files are ID01.fastq,
ID02.fastq, one file p... | [
"def",
"split",
"(",
"args",
")",
":",
"p",
"=",
"OptionParser",
"(",
"split",
".",
"__doc__",
")",
"p",
".",
"set_outdir",
"(",
"outdir",
"=",
"\"deconv\"",
")",
"p",
".",
"add_option",
"(",
"\"--nocheckprefix\"",
",",
"default",
"=",
"False",
",",
"a... | https://github.com/tanghaibao/jcvi/blob/5e720870c0928996f8b77a38208106ff0447ccb6/jcvi/variation/deconvolute.py#L129-L227 | ||
dieseldev/diesel | 8d48371fce0b79d6631053594bce06e4b9628499 | diesel/protocols/redis.py | python | RedisClient.publish | (self, channel, message) | return resp | Publish a message on the given channel.
Returns the number of clients that received the message. | Publish a message on the given channel. | [
"Publish",
"a",
"message",
"on",
"the",
"given",
"channel",
"."
] | def publish(self, channel, message):
'''Publish a message on the given channel.
Returns the number of clients that received the message.
'''
self._send('PUBLISH', channel, message)
resp = self._get_response()
return resp | [
"def",
"publish",
"(",
"self",
",",
"channel",
",",
"message",
")",
":",
"self",
".",
"_send",
"(",
"'PUBLISH'",
",",
"channel",
",",
"message",
")",
"resp",
"=",
"self",
".",
"_get_response",
"(",
")",
"return",
"resp"
] | https://github.com/dieseldev/diesel/blob/8d48371fce0b79d6631053594bce06e4b9628499/diesel/protocols/redis.py#L733-L740 | |
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/lib/scapy/fields.py | python | StrField.getfield | (self, pkt, s) | [] | def getfield(self, pkt, s):
if self.remain == 0:
return "",self.m2i(pkt, s)
else:
return s[-self.remain:],self.m2i(pkt, s[:-self.remain]) | [
"def",
"getfield",
"(",
"self",
",",
"pkt",
",",
"s",
")",
":",
"if",
"self",
".",
"remain",
"==",
"0",
":",
"return",
"\"\"",
",",
"self",
".",
"m2i",
"(",
"pkt",
",",
"s",
")",
"else",
":",
"return",
"s",
"[",
"-",
"self",
".",
"remain",
":... | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/fields.py#L336-L340 | ||||
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | apps/analyzer/classifier.py | python | Classifier.totalcount | (self) | return categories['sum'] | [] | def totalcount(self):
categories = Category.objects.filter(user=self.user, feed=self.feed).aggregate(sum=Sum('count'))
return categories['sum'] | [
"def",
"totalcount",
"(",
"self",
")",
":",
"categories",
"=",
"Category",
".",
"objects",
".",
"filter",
"(",
"user",
"=",
"self",
".",
"user",
",",
"feed",
"=",
"self",
".",
"feed",
")",
".",
"aggregate",
"(",
"sum",
"=",
"Sum",
"(",
"'count'",
"... | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/analyzer/classifier.py#L70-L72 | |||
plotly/arduino-api | 38ee5b191682532ebee908ceafbc67692730d39c | plotly_yun/Linino/plotly/graph_objs/graph_objs.py | python | PlotlyTrace.to_string | (self, level=0, indent=4, eol='\n', pretty=True, max_chars=80) | return string | Returns a formatted string showing graph_obj constructors.
Example:
print obj.to_string()
Keyword arguments:
level (default = 0) -- set number of indentations to start with
indent (default = 4) -- set indentation amount
eol (default = '\n') -- set end of line chara... | Returns a formatted string showing graph_obj constructors. | [
"Returns",
"a",
"formatted",
"string",
"showing",
"graph_obj",
"constructors",
"."
] | def to_string(self, level=0, indent=4, eol='\n', pretty=True, max_chars=80):
"""Returns a formatted string showing graph_obj constructors.
Example:
print obj.to_string()
Keyword arguments:
level (default = 0) -- set number of indentations to start with
indent (defa... | [
"def",
"to_string",
"(",
"self",
",",
"level",
"=",
"0",
",",
"indent",
"=",
"4",
",",
"eol",
"=",
"'\\n'",
",",
"pretty",
"=",
"True",
",",
"max_chars",
"=",
"80",
")",
":",
"self",
".",
"to_graph_objs",
"(",
")",
"if",
"self",
".",
"__class__",
... | https://github.com/plotly/arduino-api/blob/38ee5b191682532ebee908ceafbc67692730d39c/plotly_yun/Linino/plotly/graph_objs/graph_objs.py#L863-L893 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/ipaddress.py | python | _BaseV6.max_prefixlen | (self) | return self._max_prefixlen | [] | def max_prefixlen(self):
return self._max_prefixlen | [
"def",
"max_prefixlen",
"(",
"self",
")",
":",
"return",
"self",
".",
"_max_prefixlen"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/ipaddress.py#L1867-L1868 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/_internal/django/core/handlers/base.py | python | get_script_name | (environ) | return force_unicode(environ.get('SCRIPT_NAME', u'')) | Returns the equivalent of the HTTP request's SCRIPT_NAME environment
variable. If Apache mod_rewrite has been used, returns what would have been
the script name prior to any rewriting (so it's the script name as seen
from the client's perspective), unless DJANGO_USE_POST_REWRITE is set (to
anything). | Returns the equivalent of the HTTP request's SCRIPT_NAME environment
variable. If Apache mod_rewrite has been used, returns what would have been
the script name prior to any rewriting (so it's the script name as seen
from the client's perspective), unless DJANGO_USE_POST_REWRITE is set (to
anything). | [
"Returns",
"the",
"equivalent",
"of",
"the",
"HTTP",
"request",
"s",
"SCRIPT_NAME",
"environment",
"variable",
".",
"If",
"Apache",
"mod_rewrite",
"has",
"been",
"used",
"returns",
"what",
"would",
"have",
"been",
"the",
"script",
"name",
"prior",
"to",
"any",... | def get_script_name(environ):
"""
Returns the equivalent of the HTTP request's SCRIPT_NAME environment
variable. If Apache mod_rewrite has been used, returns what would have been
the script name prior to any rewriting (so it's the script name as seen
from the client's perspective), unless DJANGO_USE... | [
"def",
"get_script_name",
"(",
"environ",
")",
":",
"from",
"google",
".",
"appengine",
".",
"_internal",
".",
"django",
".",
"conf",
"import",
"settings",
"if",
"settings",
".",
"FORCE_SCRIPT_NAME",
"is",
"not",
"None",
":",
"return",
"force_unicode",
"(",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/_internal/django/core/handlers/base.py#L197-L219 | |
ellmetha/django-machina | b38e3fdee9b5f7ea7f6ef980f764c563b67f719a | machina/apps/forum_conversation/views.py | python | TopicUpdateView.get_controlled_object | (self) | return self.get_topic().first_post | Returns the controlled object. | Returns the controlled object. | [
"Returns",
"the",
"controlled",
"object",
"."
] | def get_controlled_object(self):
""" Returns the controlled object. """
return self.get_topic().first_post | [
"def",
"get_controlled_object",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_topic",
"(",
")",
".",
"first_post"
] | https://github.com/ellmetha/django-machina/blob/b38e3fdee9b5f7ea7f6ef980f764c563b67f719a/machina/apps/forum_conversation/views.py#L609-L611 | |
fkie/multimaster_fkie | 3d23df29d25d71a75c66bbd3cc6e9cbb255724d8 | fkie_master_discovery/src/fkie_master_discovery/master_info.py | python | TopicInfo.publisherNodes | (self, name) | Append a new publishing node to this topic. | Append a new publishing node to this topic. | [
"Append",
"a",
"new",
"publishing",
"node",
"to",
"this",
"topic",
"."
] | def publisherNodes(self, name):
'''
Append a new publishing node to this topic.
'''
try:
if isinstance(name, list):
del self._publisherNodes
self._publisherNodes = name
else:
self._publisherNodes.index(name)
... | [
"def",
"publisherNodes",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"name",
",",
"list",
")",
":",
"del",
"self",
".",
"_publisherNodes",
"self",
".",
"_publisherNodes",
"=",
"name",
"else",
":",
"self",
".",
"_publisherNode... | https://github.com/fkie/multimaster_fkie/blob/3d23df29d25d71a75c66bbd3cc6e9cbb255724d8/fkie_master_discovery/src/fkie_master_discovery/master_info.py#L333-L344 | ||
inkandswitch/livebook | 93c8d467734787366ad084fc3566bf5cbe249c51 | public/pypyjs/modules/plistlib.py | python | readPlistFromResource | (path, restype='plst', resid=0) | return readPlistFromString(plistData) | Read plst resource from the resource fork of path. | Read plst resource from the resource fork of path. | [
"Read",
"plst",
"resource",
"from",
"the",
"resource",
"fork",
"of",
"path",
"."
] | def readPlistFromResource(path, restype='plst', resid=0):
"""Read plst resource from the resource fork of path.
"""
warnings.warnpy3k("In 3.x, readPlistFromResource is removed.",
stacklevel=2)
from Carbon.File import FSRef, FSGetResourceForkName
from Carbon.Files import fsRdPer... | [
"def",
"readPlistFromResource",
"(",
"path",
",",
"restype",
"=",
"'plst'",
",",
"resid",
"=",
"0",
")",
":",
"warnings",
".",
"warnpy3k",
"(",
"\"In 3.x, readPlistFromResource is removed.\"",
",",
"stacklevel",
"=",
"2",
")",
"from",
"Carbon",
".",
"File",
"i... | https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/plistlib.py#L114-L127 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/enum34-1.1.6/enum/__init__.py | python | EnumMeta._get_mixins_ | (bases) | return member_type, first_enum | Returns the type for creating enum members, and the first inherited
enum class.
bases: the tuple of bases that was given to __new__ | Returns the type for creating enum members, and the first inherited
enum class. | [
"Returns",
"the",
"type",
"for",
"creating",
"enum",
"members",
"and",
"the",
"first",
"inherited",
"enum",
"class",
"."
] | def _get_mixins_(bases):
"""Returns the type for creating enum members, and the first inherited
enum class.
bases: the tuple of bases that was given to __new__
"""
if not bases or Enum is None:
return object, Enum
# double check that we are not subclassing... | [
"def",
"_get_mixins_",
"(",
"bases",
")",
":",
"if",
"not",
"bases",
"or",
"Enum",
"is",
"None",
":",
"return",
"object",
",",
"Enum",
"# double check that we are not subclassing a class with existing",
"# enumeration members; while we're at it, see if any other data",
"# typ... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/enum34-1.1.6/enum/__init__.py#L484-L527 | |
Dman95/SASM | 7e3ae6da1c219a68e26d38939338567e5c27151a | Windows/MinGW64/opt/lib/python2.7/encodings/unicode_internal.py | python | IncrementalDecoder.decode | (self, input, final=False) | return codecs.unicode_internal_decode(input, self.errors)[0] | [] | def decode(self, input, final=False):
return codecs.unicode_internal_decode(input, self.errors)[0] | [
"def",
"decode",
"(",
"self",
",",
"input",
",",
"final",
"=",
"False",
")",
":",
"return",
"codecs",
".",
"unicode_internal_decode",
"(",
"input",
",",
"self",
".",
"errors",
")",
"[",
"0",
"]"
] | https://github.com/Dman95/SASM/blob/7e3ae6da1c219a68e26d38939338567e5c27151a/Windows/MinGW64/opt/lib/python2.7/encodings/unicode_internal.py#L25-L26 | |||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/werkzeug/wsgi.py | python | responder | (f) | return update_wrapper(lambda *a: f(*a)(*a[-2:]), f) | Marks a function as responder. Decorate a function with it and it
will automatically call the return value as WSGI application.
Example::
@responder
def application(environ, start_response):
return Response('Hello World!') | Marks a function as responder. Decorate a function with it and it
will automatically call the return value as WSGI application. | [
"Marks",
"a",
"function",
"as",
"responder",
".",
"Decorate",
"a",
"function",
"with",
"it",
"and",
"it",
"will",
"automatically",
"call",
"the",
"return",
"value",
"as",
"WSGI",
"application",
"."
] | def responder(f):
"""Marks a function as responder. Decorate a function with it and it
will automatically call the return value as WSGI application.
Example::
@responder
def application(environ, start_response):
return Response('Hello World!')
"""
return update_wrapper... | [
"def",
"responder",
"(",
"f",
")",
":",
"return",
"update_wrapper",
"(",
"lambda",
"*",
"a",
":",
"f",
"(",
"*",
"a",
")",
"(",
"*",
"a",
"[",
"-",
"2",
":",
"]",
")",
",",
"f",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/werkzeug/wsgi.py#L30-L40 | |
whyliam/whyliam.workflows.youdao | 2dfa7f1de56419dab1c2e70c1a27e5e13ba25a5c | urllib3/packages/rfc3986/parseresult.py | python | ParseResultBytes.authority | (self) | return self.reference.authority.encode(self.encoding) | Return the normalized authority. | Return the normalized authority. | [
"Return",
"the",
"normalized",
"authority",
"."
] | def authority(self):
"""Return the normalized authority."""
return self.reference.authority.encode(self.encoding) | [
"def",
"authority",
"(",
"self",
")",
":",
"return",
"self",
".",
"reference",
".",
"authority",
".",
"encode",
"(",
"self",
".",
"encoding",
")"
] | https://github.com/whyliam/whyliam.workflows.youdao/blob/2dfa7f1de56419dab1c2e70c1a27e5e13ba25a5c/urllib3/packages/rfc3986/parseresult.py#L348-L350 | |
ethereum/trinity | 6383280c5044feb06695ac2f7bc1100b7bcf4fe0 | trinity/sync/common/headers.py | python | HeaderMeatSyncer.__init__ | (
self,
chain: AsyncChainAPI,
peer_pool: BaseChainPeerPool,
stitcher: HeaderStitcher) | [] | def __init__(
self,
chain: AsyncChainAPI,
peer_pool: BaseChainPeerPool,
stitcher: HeaderStitcher) -> None:
self.logger = get_logger('trinity.sync.common.headers.SkeletonSyncer')
self._chain = chain
self._stitcher = stitcher
max_pending_fill... | [
"def",
"__init__",
"(",
"self",
",",
"chain",
":",
"AsyncChainAPI",
",",
"peer_pool",
":",
"BaseChainPeerPool",
",",
"stitcher",
":",
"HeaderStitcher",
")",
"->",
"None",
":",
"self",
".",
"logger",
"=",
"get_logger",
"(",
"'trinity.sync.common.headers.SkeletonSyn... | https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/trinity/sync/common/headers.py#L610-L630 | ||||
lbryio/torba | 190304344c0ff68f8a24cf50272307a11bf7f62b | torba/rpc/jsonrpc.py | python | JSONRPC.message_to_item | (cls, message) | Translate an unframed received message and return an
(item, request_id) pair.
The item can be a Request, Notification, Response or a list.
A JSON RPC error response is returned as an RPCError inside a
Response object.
If a Batch is returned, request_id is an iterable of reques... | Translate an unframed received message and return an
(item, request_id) pair. | [
"Translate",
"an",
"unframed",
"received",
"message",
"and",
"return",
"an",
"(",
"item",
"request_id",
")",
"pair",
"."
] | def message_to_item(cls, message):
"""Translate an unframed received message and return an
(item, request_id) pair.
The item can be a Request, Notification, Response or a list.
A JSON RPC error response is returned as an RPCError inside a
Response object.
If a Batch is... | [
"def",
"message_to_item",
"(",
"cls",
",",
"message",
")",
":",
"payload",
"=",
"cls",
".",
"_message_to_payload",
"(",
"message",
")",
"if",
"isinstance",
"(",
"payload",
",",
"dict",
")",
":",
"if",
"'method'",
"in",
"payload",
":",
"return",
"cls",
".... | https://github.com/lbryio/torba/blob/190304344c0ff68f8a24cf50272307a11bf7f62b/torba/rpc/jsonrpc.py#L247-L280 | ||
doraemonext/wechat-python-sdk | bf6f6f3d4a5440feb73a51937059d7feddc335a0 | wechat_sdk/core/conf.py | python | WechatConf.access_token | (self) | return self.__access_token | 获取当前 access token 值, 本方法会自行维护 access token 有效性 | 获取当前 access token 值, 本方法会自行维护 access token 有效性 | [
"获取当前",
"access",
"token",
"值",
"本方法会自行维护",
"access",
"token",
"有效性"
] | def access_token(self):
""" 获取当前 access token 值, 本方法会自行维护 access token 有效性 """
self._check_appid_appsecret()
if callable(self.__access_token_getfunc):
self.__access_token, self.__access_token_expires_at = self.__access_token_getfunc()
if self.__access_token:
now... | [
"def",
"access_token",
"(",
"self",
")",
":",
"self",
".",
"_check_appid_appsecret",
"(",
")",
"if",
"callable",
"(",
"self",
".",
"__access_token_getfunc",
")",
":",
"self",
".",
"__access_token",
",",
"self",
".",
"__access_token_expires_at",
"=",
"self",
".... | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/core/conf.py#L144-L157 | |
PyAr/fades | 40a4cda535b2af6e141bdd68d6cfaab217eabe44 | fades/helpers.py | python | _ScriptDownloader._download_raw | (self, url=None) | return resp.read().decode("utf8") | Download content from URL directly. | Download content from URL directly. | [
"Download",
"content",
"from",
"URL",
"directly",
"."
] | def _download_raw(self, url=None):
"""Download content from URL directly."""
if url is None:
url = self.url
req = request.Request(url, headers=self.HEADERS_PLAIN)
resp = request.urlopen(req)
# check if the response url is different than the original one; in this case... | [
"def",
"_download_raw",
"(",
"self",
",",
"url",
"=",
"None",
")",
":",
"if",
"url",
"is",
"None",
":",
"url",
"=",
"self",
".",
"url",
"req",
"=",
"request",
".",
"Request",
"(",
"url",
",",
"headers",
"=",
"self",
".",
"HEADERS_PLAIN",
")",
"resp... | https://github.com/PyAr/fades/blob/40a4cda535b2af6e141bdd68d6cfaab217eabe44/fades/helpers.py#L299-L318 | |
exodrifter/unity-python | bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d | Lib/fpformat.py | python | unexpo | (intpart, fraction, expo) | return intpart, fraction | Remove the exponent by changing intpart and fraction. | Remove the exponent by changing intpart and fraction. | [
"Remove",
"the",
"exponent",
"by",
"changing",
"intpart",
"and",
"fraction",
"."
] | def unexpo(intpart, fraction, expo):
"""Remove the exponent by changing intpart and fraction."""
if expo > 0: # Move the point left
f = len(fraction)
intpart, fraction = intpart + fraction[:expo], fraction[expo:]
if expo > f:
intpart = intpart + '0'*(expo-f)
elif expo < 0... | [
"def",
"unexpo",
"(",
"intpart",
",",
"fraction",
",",
"expo",
")",
":",
"if",
"expo",
">",
"0",
":",
"# Move the point left",
"f",
"=",
"len",
"(",
"fraction",
")",
"intpart",
",",
"fraction",
"=",
"intpart",
"+",
"fraction",
"[",
":",
"expo",
"]",
... | https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/fpformat.py#L51-L63 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/connectors/mxodbc.py | python | MxODBCConnector.on_connect | (self) | return connect | [] | def on_connect(self):
def connect(conn):
conn.stringformat = self.dbapi.MIXED_STRINGFORMAT
conn.datetimeformat = self.dbapi.PYDATETIME_DATETIMEFORMAT
conn.decimalformat = self.dbapi.DECIMAL_DECIMALFORMAT
conn.errorhandler = self._error_handler()
return con... | [
"def",
"on_connect",
"(",
"self",
")",
":",
"def",
"connect",
"(",
"conn",
")",
":",
"conn",
".",
"stringformat",
"=",
"self",
".",
"dbapi",
".",
"MIXED_STRINGFORMAT",
"conn",
".",
"datetimeformat",
"=",
"self",
".",
"dbapi",
".",
"PYDATETIME_DATETIMEFORMAT"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/connectors/mxodbc.py#L65-L71 | |||
plone/Products.CMFPlone | 83137764e3e7e4fe60d03c36dfc6ba9c7c543324 | Products/CMFPlone/browser/interfaces.py | python | ISitemapView.createSiteMap | () | Create the site map data structure | Create the site map data structure | [
"Create",
"the",
"site",
"map",
"data",
"structure"
] | def createSiteMap():
"""Create the site map data structure""" | [
"def",
"createSiteMap",
"(",
")",
":"
] | https://github.com/plone/Products.CMFPlone/blob/83137764e3e7e4fe60d03c36dfc6ba9c7c543324/Products/CMFPlone/browser/interfaces.py#L185-L186 | ||
r0x0r/pywebview | 7641414db75542958d1d1158b903576aafebd47c | webview/platforms/cocoa.py | python | BrowserView._add_view_menu | (self) | Create a default View menu that shows 'Enter Full Screen'. | Create a default View menu that shows 'Enter Full Screen'. | [
"Create",
"a",
"default",
"View",
"menu",
"that",
"shows",
"Enter",
"Full",
"Screen",
"."
] | def _add_view_menu(self):
"""
Create a default View menu that shows 'Enter Full Screen'.
"""
mainMenu = self.app.mainMenu()
# Create an View menu and make it a submenu of the main menu
viewMenu = AppKit.NSMenu.alloc().init()
viewMenu.setTitle_(self.localization["... | [
"def",
"_add_view_menu",
"(",
"self",
")",
":",
"mainMenu",
"=",
"self",
".",
"app",
".",
"mainMenu",
"(",
")",
"# Create an View menu and make it a submenu of the main menu",
"viewMenu",
"=",
"AppKit",
".",
"NSMenu",
".",
"alloc",
"(",
")",
".",
"init",
"(",
... | https://github.com/r0x0r/pywebview/blob/7641414db75542958d1d1158b903576aafebd47c/webview/platforms/cocoa.py#L658-L673 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/physics/quantum/spin.py | python | couple | (expr, jcoupling_list=None) | return expr | Couple a tensor product of spin states
This function can be used to couple an uncoupled tensor product of spin
states. All of the eigenstates to be coupled must be of the same class. It
will return a linear combination of eigenstates that are subclasses of
CoupledSpinState determined by Clebsch-Gordan ... | Couple a tensor product of spin states | [
"Couple",
"a",
"tensor",
"product",
"of",
"spin",
"states"
] | def couple(expr, jcoupling_list=None):
""" Couple a tensor product of spin states
This function can be used to couple an uncoupled tensor product of spin
states. All of the eigenstates to be coupled must be of the same class. It
will return a linear combination of eigenstates that are subclasses of
... | [
"def",
"couple",
"(",
"expr",
",",
"jcoupling_list",
"=",
"None",
")",
":",
"a",
"=",
"expr",
".",
"atoms",
"(",
"TensorProduct",
")",
"for",
"tp",
"in",
"a",
":",
"# Allow other tensor products to be in expression",
"if",
"not",
"all",
"(",
"[",
"isinstance... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/physics/quantum/spin.py#L1787-L1854 | |
thomasweng15/E.V.E. | e3bea3e45d0c549eccc6824c9cadbcc6980545f6 | brain/brain.py | python | Brain.shutdown | (self) | Close the E.V.E. program. | Close the E.V.E. program. | [
"Close",
"the",
"E",
".",
"V",
".",
"E",
".",
"program",
"."
] | def shutdown(self):
"""Close the E.V.E. program."""
# TODO turn into local wav file
self.speaker.say("E.V.E. will shut down now. Goodbye!")
sys.exit('+++++++++++++++++++++ E.V.E. HAS SHUTDOWN ++++++++++++++++++++') | [
"def",
"shutdown",
"(",
"self",
")",
":",
"# TODO turn into local wav file",
"self",
".",
"speaker",
".",
"say",
"(",
"\"E.V.E. will shut down now. Goodbye!\"",
")",
"sys",
".",
"exit",
"(",
"'+++++++++++++++++++++ E.V.E. HAS SHUTDOWN ++++++++++++++++++++'",
")"
] | https://github.com/thomasweng15/E.V.E./blob/e3bea3e45d0c549eccc6824c9cadbcc6980545f6/brain/brain.py#L170-L174 | ||
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/_osx_support.py | python | customize_config_vars | (_config_vars) | return _config_vars | Customize Python build configuration variables.
Called internally from sysconfig with a mutable mapping
containing name/value pairs parsed from the configured
makefile used to build this interpreter. Returns
the mapping updated as needed to reflect the environment
in which the interpreter is runni... | Customize Python build configuration variables. | [
"Customize",
"Python",
"build",
"configuration",
"variables",
"."
] | def customize_config_vars(_config_vars):
"""Customize Python build configuration variables.
Called internally from sysconfig with a mutable mapping
containing name/value pairs parsed from the configured
makefile used to build this interpreter. Returns
the mapping updated as needed to reflect the e... | [
"def",
"customize_config_vars",
"(",
"_config_vars",
")",
":",
"if",
"not",
"_supports_universal_builds",
"(",
")",
":",
"# On Mac OS X before 10.4, check if -arch and -isysroot",
"# are in CFLAGS or LDFLAGS and remove them if they are.",
"# This is needed when building extensions on a 1... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/_osx_support.py#L368-L406 | |
stanfordnlp/stanza | e44d1c88340e33bf9813e6f5a6bd24387eefc4b2 | stanza/models/common/doc.py | python | Sentence.build_dependencies | (self) | Build the dependency graph for this sentence. Each dependency graph entry is
a list of (head, deprel, word). | Build the dependency graph for this sentence. Each dependency graph entry is
a list of (head, deprel, word). | [
"Build",
"the",
"dependency",
"graph",
"for",
"this",
"sentence",
".",
"Each",
"dependency",
"graph",
"entry",
"is",
"a",
"list",
"of",
"(",
"head",
"deprel",
"word",
")",
"."
] | def build_dependencies(self):
""" Build the dependency graph for this sentence. Each dependency graph entry is
a list of (head, deprel, word).
"""
self.dependencies = []
for word in self.words:
if word.head == 0:
# make a word for the ROOT
... | [
"def",
"build_dependencies",
"(",
"self",
")",
":",
"self",
".",
"dependencies",
"=",
"[",
"]",
"for",
"word",
"in",
"self",
".",
"words",
":",
"if",
"word",
".",
"head",
"==",
"0",
":",
"# make a word for the ROOT",
"word_entry",
"=",
"{",
"ID",
":",
... | https://github.com/stanfordnlp/stanza/blob/e44d1c88340e33bf9813e6f5a6bd24387eefc4b2/stanza/models/common/doc.py#L542-L556 | ||
zzzeek/alembic | 9b01e5fa7178333f2e78ee0fc1322112307b51dd | alembic/script/revision.py | python | Revision._is_real_base | (self) | return self.down_revision is None and self.dependencies is None | Return True if this :class:`.Revision` is a "real" base revision,
e.g. that it has no dependencies either. | Return True if this :class:`.Revision` is a "real" base revision,
e.g. that it has no dependencies either. | [
"Return",
"True",
"if",
"this",
":",
"class",
":",
".",
"Revision",
"is",
"a",
"real",
"base",
"revision",
"e",
".",
"g",
".",
"that",
"it",
"has",
"no",
"dependencies",
"either",
"."
] | def _is_real_base(self) -> bool:
"""Return True if this :class:`.Revision` is a "real" base revision,
e.g. that it has no dependencies either."""
# we use self.dependencies here because this is called up
# in initialization where _real_dependencies isn't set up
# yet
ret... | [
"def",
"_is_real_base",
"(",
"self",
")",
"->",
"bool",
":",
"# we use self.dependencies here because this is called up",
"# in initialization where _real_dependencies isn't set up",
"# yet",
"return",
"self",
".",
"down_revision",
"is",
"None",
"and",
"self",
".",
"dependenc... | https://github.com/zzzeek/alembic/blob/9b01e5fa7178333f2e78ee0fc1322112307b51dd/alembic/script/revision.py#L1601-L1608 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/tools/dev_appserver.py | python | CreateRequestHandler | (root_path,
login_url,
static_caching=True,
default_partition=None,
interactive_console=True,
secret_hash='xxx') | return DevAppServerRequestHandler | Creates a new BaseHTTPRequestHandler sub-class.
This class will be used with the Python BaseHTTPServer module's HTTP server.
Python's built-in HTTP server does not support passing context information
along to instances of its request handlers. This function gets around that
by creating a sub-class of the hand... | Creates a new BaseHTTPRequestHandler sub-class. | [
"Creates",
"a",
"new",
"BaseHTTPRequestHandler",
"sub",
"-",
"class",
"."
] | def CreateRequestHandler(root_path,
login_url,
static_caching=True,
default_partition=None,
interactive_console=True,
secret_hash='xxx'):
"""Creates a new BaseHTTPRequestHandler sub-class.
T... | [
"def",
"CreateRequestHandler",
"(",
"root_path",
",",
"login_url",
",",
"static_caching",
"=",
"True",
",",
"default_partition",
"=",
"None",
",",
"interactive_console",
"=",
"True",
",",
"secret_hash",
"=",
"'xxx'",
")",
":",
"application_module_dict",
"=",
"Setu... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/tools/dev_appserver.py#L2701-L3137 | |
Pylons/webob | 259230aa2b8b9cf675c996e157c5cf021c256059 | src/webob/multidict.py | python | MultiDict.view_list | (cls, lst) | return obj | Create a multidict that is a view on the given list | Create a multidict that is a view on the given list | [
"Create",
"a",
"multidict",
"that",
"is",
"a",
"view",
"on",
"the",
"given",
"list"
] | def view_list(cls, lst):
"""
Create a multidict that is a view on the given list
"""
if not isinstance(lst, list):
raise TypeError(
"%s.view_list(obj) takes only actual list objects, not %r"
% (cls.__name__, lst)
)
obj = cl... | [
"def",
"view_list",
"(",
"cls",
",",
"lst",
")",
":",
"if",
"not",
"isinstance",
"(",
"lst",
",",
"list",
")",
":",
"raise",
"TypeError",
"(",
"\"%s.view_list(obj) takes only actual list objects, not %r\"",
"%",
"(",
"cls",
".",
"__name__",
",",
"lst",
")",
... | https://github.com/Pylons/webob/blob/259230aa2b8b9cf675c996e157c5cf021c256059/src/webob/multidict.py#L41-L54 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/asyncio/sslproto.py | python | _SSLProtocolTransport._protocol_paused | (self) | return self._ssl_protocol._transport._protocol_paused | [] | def _protocol_paused(self):
# Required for sendfile fallback pause_writing/resume_writing logic
return self._ssl_protocol._transport._protocol_paused | [
"def",
"_protocol_paused",
"(",
"self",
")",
":",
"# Required for sendfile fallback pause_writing/resume_writing logic",
"return",
"self",
".",
"_ssl_protocol",
".",
"_transport",
".",
"_protocol_paused"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/asyncio/sslproto.py#L372-L374 | |||
aboSamoor/polyglot | 9b93b2ecbb9ba1f638c56b92665336e93230646a | polyglot/downloader.py | python | Collection.__init__ | (self, id, children, name=None, **kw) | A unique identifier for this collection. | A unique identifier for this collection. | [
"A",
"unique",
"identifier",
"for",
"this",
"collection",
"."
] | def __init__(self, id, children, name=None, **kw):
self.id = id
"""A unique identifier for this collection."""
self.name = name or id
"""A string name for this collection."""
self.children = children
"""A list of the ``Collections`` or ``Packages`` directly
contained by this collection.... | [
"def",
"__init__",
"(",
"self",
",",
"id",
",",
"children",
",",
"name",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"id",
"=",
"id",
"self",
".",
"name",
"=",
"name",
"or",
"id",
"\"\"\"A string name for this collection.\"\"\"",
"self",
"... | https://github.com/aboSamoor/polyglot/blob/9b93b2ecbb9ba1f638c56b92665336e93230646a/polyglot/downloader.py#L232-L248 | ||
joschabach/micropsi2 | 74a2642d20da9da1d64acc5e4c11aeabee192a27 | micropsi_core/world/island/png.py | python | Reader.chunks | (self) | Return an iterator that will yield each chunk as a
(*chunktype*, *content*) pair. | Return an iterator that will yield each chunk as a
(*chunktype*, *content*) pair. | [
"Return",
"an",
"iterator",
"that",
"will",
"yield",
"each",
"chunk",
"as",
"a",
"(",
"*",
"chunktype",
"*",
"*",
"content",
"*",
")",
"pair",
"."
] | def chunks(self):
"""Return an iterator that will yield each chunk as a
(*chunktype*, *content*) pair.
"""
while True:
t,v = self.chunk()
yield t,v
if t == 'IEND':
break | [
"def",
"chunks",
"(",
"self",
")",
":",
"while",
"True",
":",
"t",
",",
"v",
"=",
"self",
".",
"chunk",
"(",
")",
"yield",
"t",
",",
"v",
"if",
"t",
"==",
"'IEND'",
":",
"break"
] | https://github.com/joschabach/micropsi2/blob/74a2642d20da9da1d64acc5e4c11aeabee192a27/micropsi_core/world/island/png.py#L1429-L1438 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.