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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
django/django | 0a17666045de6739ae1c2ac695041823d5f827f7 | django/core/mail/message.py | python | EmailMessage.recipients | (self) | return [email for email in (self.to + self.cc + self.bcc) if email] | Return a list of all recipients of the email (includes direct
addressees as well as Cc and Bcc entries). | Return a list of all recipients of the email (includes direct
addressees as well as Cc and Bcc entries). | [
"Return",
"a",
"list",
"of",
"all",
"recipients",
"of",
"the",
"email",
"(",
"includes",
"direct",
"addressees",
"as",
"well",
"as",
"Cc",
"and",
"Bcc",
"entries",
")",
"."
] | def recipients(self):
"""
Return a list of all recipients of the email (includes direct
addressees as well as Cc and Bcc entries).
"""
return [email for email in (self.to + self.cc + self.bcc) if email] | [
"def",
"recipients",
"(",
"self",
")",
":",
"return",
"[",
"email",
"for",
"email",
"in",
"(",
"self",
".",
"to",
"+",
"self",
".",
"cc",
"+",
"self",
".",
"bcc",
")",
"if",
"email",
"]"
] | https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/core/mail/message.py#L271-L276 | |
googlearchive/simian | fb9c43946ff7ba29be417068d6447cfc0adfe9ef | src/simian/mac/admin/misc.py | python | Misc._DisplayLongestUptime | (self) | Displays a report of machines with longest uptime. | Displays a report of machines with longest uptime. | [
"Displays",
"a",
"report",
"of",
"machines",
"with",
"longest",
"uptime",
"."
] | def _DisplayLongestUptime(self):
"""Displays a report of machines with longest uptime."""
query = models.Computer.AllActive().order('-uptime')
computers = self.Paginate(query, admin.DEFAULT_COMPUTER_FETCH_LIMIT)
values = {'computers': computers, 'report_type': 'uptime', 'cached': False}
self.Render(... | [
"def",
"_DisplayLongestUptime",
"(",
"self",
")",
":",
"query",
"=",
"models",
".",
"Computer",
".",
"AllActive",
"(",
")",
".",
"order",
"(",
"'-uptime'",
")",
"computers",
"=",
"self",
".",
"Paginate",
"(",
"query",
",",
"admin",
".",
"DEFAULT_COMPUTER_F... | https://github.com/googlearchive/simian/blob/fb9c43946ff7ba29be417068d6447cfc0adfe9ef/src/simian/mac/admin/misc.py#L162-L167 | ||
glue-viz/glue | 840b4c1364b0fa63bf67c914540c93dd71df41e1 | glue/core/roi.py | python | CategoricalROI.defined | (self) | return self.categories is not None | Returns True if the ROI is defined | Returns True if the ROI is defined | [
"Returns",
"True",
"if",
"the",
"ROI",
"is",
"defined"
] | def defined(self):
""" Returns True if the ROI is defined """
return self.categories is not None | [
"def",
"defined",
"(",
"self",
")",
":",
"return",
"self",
".",
"categories",
"is",
"not",
"None"
] | https://github.com/glue-viz/glue/blob/840b4c1364b0fa63bf67c914540c93dd71df41e1/glue/core/roi.py#L1585-L1587 | |
fsspec/filesystem_spec | 76da18cf5a9697f480e5a0f6d1013d71676af131 | fsspec/spec.py | python | AbstractFileSystem.cp | (self, path1, path2, **kwargs) | return self.copy(path1, path2, **kwargs) | Alias of `AbstractFileSystem.copy`. | Alias of `AbstractFileSystem.copy`. | [
"Alias",
"of",
"AbstractFileSystem",
".",
"copy",
"."
] | def cp(self, path1, path2, **kwargs):
"""Alias of `AbstractFileSystem.copy`."""
return self.copy(path1, path2, **kwargs) | [
"def",
"cp",
"(",
"self",
",",
"path1",
",",
"path2",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"copy",
"(",
"path1",
",",
"path2",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/fsspec/filesystem_spec/blob/76da18cf5a9697f480e5a0f6d1013d71676af131/fsspec/spec.py#L1204-L1206 | |
marcelotduarte/cx_Freeze | 861fe381d6a17fe71792bdf2d9cac7f0ea59e894 | cx_Freeze/darwintools.py | python | DarwinFile.__init__ | (
self,
path: Union[str, Path],
referencing_file: Optional["DarwinFile"] = None,
strict: bool = False,
) | :param path: The original path of the DarwinFile
(before copying into app)
:param referencing_file: DarwinFile object representing the referencing
source file
:param strict: Do not make guesses about rpath resolution. If the
load does not resolve, throw an Exception. | :param path: The original path of the DarwinFile
(before copying into app)
:param referencing_file: DarwinFile object representing the referencing
source file
:param strict: Do not make guesses about rpath resolution. If the
load does not resolve, throw an Exception. | [
":",
"param",
"path",
":",
"The",
"original",
"path",
"of",
"the",
"DarwinFile",
"(",
"before",
"copying",
"into",
"app",
")",
":",
"param",
"referencing_file",
":",
"DarwinFile",
"object",
"representing",
"the",
"referencing",
"source",
"file",
":",
"param",
... | def __init__(
self,
path: Union[str, Path],
referencing_file: Optional["DarwinFile"] = None,
strict: bool = False,
):
"""
:param path: The original path of the DarwinFile
(before copying into app)
:param referencing_file: DarwinFile object representing... | [
"def",
"__init__",
"(",
"self",
",",
"path",
":",
"Union",
"[",
"str",
",",
"Path",
"]",
",",
"referencing_file",
":",
"Optional",
"[",
"\"DarwinFile\"",
"]",
"=",
"None",
",",
"strict",
":",
"bool",
"=",
"False",
",",
")",
":",
"self",
".",
"path",
... | https://github.com/marcelotduarte/cx_Freeze/blob/861fe381d6a17fe71792bdf2d9cac7f0ea59e894/cx_Freeze/darwintools.py#L77-L151 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/optparse.py | python | Option.get_opt_string | (self) | [] | def get_opt_string(self):
if self._long_opts:
return self._long_opts[0]
else:
return self._short_opts[0] | [
"def",
"get_opt_string",
"(",
"self",
")",
":",
"if",
"self",
".",
"_long_opts",
":",
"return",
"self",
".",
"_long_opts",
"[",
"0",
"]",
"else",
":",
"return",
"self",
".",
"_short_opts",
"[",
"0",
"]"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/optparse.py#L752-L756 | ||||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/lib2to3/pytree.py | python | WildcardPattern.__init__ | (self, content=None, min=0, max=HUGE, name=None) | Initializer.
Args:
content: optional sequence of subsequences of patterns;
if absent, matches one node;
if present, each subsequence is an alternative [*]
min: optional minimum number of times to match, default 0
max: optional maximu... | Initializer. | [
"Initializer",
"."
] | def __init__(self, content=None, min=0, max=HUGE, name=None):
"""
Initializer.
Args:
content: optional sequence of subsequences of patterns;
if absent, matches one node;
if present, each subsequence is an alternative [*]
min: opt... | [
"def",
"__init__",
"(",
"self",
",",
"content",
"=",
"None",
",",
"min",
"=",
"0",
",",
"max",
"=",
"HUGE",
",",
"name",
"=",
"None",
")",
":",
"assert",
"0",
"<=",
"min",
"<=",
"max",
"<=",
"HUGE",
",",
"(",
"min",
",",
"max",
")",
"if",
"co... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/lib2to3/pytree.py#L619-L652 | ||
mahmoud/boltons | 270e974975984f662f998c8f6eb0ebebd964de82 | boltons/tableutils.py | python | ListInputType.check_type | (self, obj) | return isinstance(obj, MutableSequence) | [] | def check_type(self, obj):
return isinstance(obj, MutableSequence) | [
"def",
"check_type",
"(",
"self",
",",
"obj",
")",
":",
"return",
"isinstance",
"(",
"obj",
",",
"MutableSequence",
")"
] | https://github.com/mahmoud/boltons/blob/270e974975984f662f998c8f6eb0ebebd964de82/boltons/tableutils.py#L185-L186 | |||
nipy/nibabel | 4703f4d8e32be4cec30e829c2d93ebe54759bb62 | nibabel/imageglobals.py | python | LoggingOutputSuppressor.__exit__ | (self, exc, value, tb) | [] | def __exit__(self, exc, value, tb):
for handler in self.orig_handlers:
logger.addHandler(handler) | [
"def",
"__exit__",
"(",
"self",
",",
"exc",
",",
"value",
",",
"tb",
")",
":",
"for",
"handler",
"in",
"self",
".",
"orig_handlers",
":",
"logger",
".",
"addHandler",
"(",
"handler",
")"
] | https://github.com/nipy/nibabel/blob/4703f4d8e32be4cec30e829c2d93ebe54759bb62/nibabel/imageglobals.py#L60-L62 | ||||
apple/coremltools | 141a83af482fcbdd5179807c9eaff9a7999c2c49 | coremltools/converters/onnx/_operators_nd.py | python | _convert_nonzero | (builder, node, graph, err) | convert to CoreML Where Non Zero Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4002 | convert to CoreML Where Non Zero Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4002 | [
"convert",
"to",
"CoreML",
"Where",
"Non",
"Zero",
"Layer",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"apple",
"/",
"coremltools",
"/",
"blob",
"/",
"655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492",
"/",
"mlmodel",
"/",
"format",
"/",
"NeuralNetwork",
".",... | def _convert_nonzero(builder, node, graph, err):
"""
convert to CoreML Where Non Zero Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4002
"""
load_input_constants(builder, node, graph, err)
builder.add_where_nonzero(
... | [
"def",
"_convert_nonzero",
"(",
"builder",
",",
"node",
",",
"graph",
",",
"err",
")",
":",
"load_input_constants",
"(",
"builder",
",",
"node",
",",
"graph",
",",
"err",
")",
"builder",
".",
"add_where_nonzero",
"(",
"name",
"=",
"node",
".",
"name",
",... | https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/coremltools/converters/onnx/_operators_nd.py#L1788-L1796 | ||
hildogjr/KiCost | 227f246d8c0f5dab145390d15c94ee2c3d6c790c | kicost/spreadsheet.py | python | add_dist_to_worksheet | (ss, logger, columns_global, start_row, start_col, unit_cost_row, total_cost_row, part_ref_col, part_qty_col, dist, parts) | return start_col + num_cols | Add distributor-specific part data to the spreadsheet. | Add distributor-specific part data to the spreadsheet. | [
"Add",
"distributor",
"-",
"specific",
"part",
"data",
"to",
"the",
"spreadsheet",
"."
] | def add_dist_to_worksheet(ss, logger, columns_global, start_row, start_col, unit_cost_row, total_cost_row, part_ref_col, part_qty_col, dist, parts):
'''Add distributor-specific part data to the spreadsheet.'''
info = get_distributor_info(dist)
order = info.order
label = info.label.name
logger.log(D... | [
"def",
"add_dist_to_worksheet",
"(",
"ss",
",",
"logger",
",",
"columns_global",
",",
"start_row",
",",
"start_col",
",",
"unit_cost_row",
",",
"total_cost_row",
",",
"part_ref_col",
",",
"part_qty_col",
",",
"dist",
",",
"parts",
")",
":",
"info",
"=",
"get_d... | https://github.com/hildogjr/KiCost/blob/227f246d8c0f5dab145390d15c94ee2c3d6c790c/kicost/spreadsheet.py#L919-L1302 | |
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/trans/models/unit.py | python | Unit.run_checks | (self, propagate: Optional[bool] = None) | Update checks for this unit. | Update checks for this unit. | [
"Update",
"checks",
"for",
"this",
"unit",
"."
] | def run_checks(self, propagate: Optional[bool] = None): # noqa: C901
"""Update checks for this unit."""
needs_propagate = bool(propagate)
src = self.get_source_plurals()
tgt = self.get_target_plurals()
old_checks = self.all_checks_names
create = []
if self.tra... | [
"def",
"run_checks",
"(",
"self",
",",
"propagate",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
")",
":",
"# noqa: C901",
"needs_propagate",
"=",
"bool",
"(",
"propagate",
")",
"src",
"=",
"self",
".",
"get_source_plurals",
"(",
")",
"tgt",
"=",
"sel... | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/trans/models/unit.py#L1123-L1215 | ||
ioflo/ioflo | 177ac656d7c4ff801aebb0d8b401db365a5248ce | ioflo/aio/http/clienting.py | python | Respondent.reinit | (self,
redirectable=None,
**kwa) | Reinitialize Instance
See super class
redirectable means allow redirection | Reinitialize Instance
See super class
redirectable means allow redirection | [
"Reinitialize",
"Instance",
"See",
"super",
"class",
"redirectable",
"means",
"allow",
"redirection"
] | def reinit(self,
redirectable=None,
**kwa):
"""
Reinitialize Instance
See super class
redirectable means allow redirection
"""
super(Respondent, self).reinit(**kwa)
if redirectable is not None:
self.redirectable = True if ... | [
"def",
"reinit",
"(",
"self",
",",
"redirectable",
"=",
"None",
",",
"*",
"*",
"kwa",
")",
":",
"super",
"(",
"Respondent",
",",
"self",
")",
".",
"reinit",
"(",
"*",
"*",
"kwa",
")",
"if",
"redirectable",
"is",
"not",
"None",
":",
"self",
".",
"... | https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/aio/http/clienting.py#L334-L348 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/rest_framework/pagination.py | python | PageNumberPagination.get_html_context | (self) | return {
'previous_url': self.get_previous_link(),
'next_url': self.get_next_link(),
'page_links': page_links
} | [] | def get_html_context(self):
base_url = self.request.build_absolute_uri()
def page_number_to_url(page_number):
if page_number == 1:
return remove_query_param(base_url, self.page_query_param)
else:
return replace_query_param(base_url, self.page_quer... | [
"def",
"get_html_context",
"(",
"self",
")",
":",
"base_url",
"=",
"self",
".",
"request",
".",
"build_absolute_uri",
"(",
")",
"def",
"page_number_to_url",
"(",
"page_number",
")",
":",
"if",
"page_number",
"==",
"1",
":",
"return",
"remove_query_param",
"(",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/rest_framework/pagination.py#L265-L283 | |||
joxeankoret/pyew | 8eb3e49a9bf57c0787fa79ecae0671129ef3f2e8 | vstruct/constants/__init__.py | python | VSConstResolver.revLookup | (self, const) | return self.rev_lookup.get(const) | Lookup the possible names of a constant based on
modules added with constAddModule() | Lookup the possible names of a constant based on
modules added with constAddModule() | [
"Lookup",
"the",
"possible",
"names",
"of",
"a",
"constant",
"based",
"on",
"modules",
"added",
"with",
"constAddModule",
"()"
] | def revLookup(self, const):
'''
Lookup the possible names of a constant based on
modules added with constAddModule()
'''
return self.rev_lookup.get(const) | [
"def",
"revLookup",
"(",
"self",
",",
"const",
")",
":",
"return",
"self",
".",
"rev_lookup",
".",
"get",
"(",
"const",
")"
] | https://github.com/joxeankoret/pyew/blob/8eb3e49a9bf57c0787fa79ecae0671129ef3f2e8/vstruct/constants/__init__.py#L30-L35 | |
tobegit3hub/deep_image_model | 8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e | java_predict_client/src/main/proto/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py | python | _DNNLinearCombinedBaseEstimator.dnn_bias_ | (self) | return (self._dnn_model.get_bias(model_dir=self._model_dir) +
[self._get_centered_bias_value()]) | Returns bias of deep neural network part. | Returns bias of deep neural network part. | [
"Returns",
"bias",
"of",
"deep",
"neural",
"network",
"part",
"."
] | def dnn_bias_(self):
"""Returns bias of deep neural network part."""
if not self._enable_centered_bias:
return self._dnn_model.get_bias(model_dir=self._model_dir)
return (self._dnn_model.get_bias(model_dir=self._model_dir) +
[self._get_centered_bias_value()]) | [
"def",
"dnn_bias_",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_enable_centered_bias",
":",
"return",
"self",
".",
"_dnn_model",
".",
"get_bias",
"(",
"model_dir",
"=",
"self",
".",
"_model_dir",
")",
"return",
"(",
"self",
".",
"_dnn_model",
".",
... | https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py#L194-L199 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/contrib/gis/gdal/geometries.py | python | OGRGeometry.num_coords | (self) | return self.point_count | Alais for `point_count`. | Alais for `point_count`. | [
"Alais",
"for",
"point_count",
"."
] | def num_coords(self):
"Alais for `point_count`."
return self.point_count | [
"def",
"num_coords",
"(",
"self",
")",
":",
"return",
"self",
".",
"point_count"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/contrib/gis/gdal/geometries.py#L238-L240 | |
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | py3.9/multiprocess/process.py | python | BaseProcess.authkey | (self, authkey) | Set authorization key of process | Set authorization key of process | [
"Set",
"authorization",
"key",
"of",
"process"
] | def authkey(self, authkey):
'''
Set authorization key of process
'''
self._config['authkey'] = AuthenticationString(authkey) | [
"def",
"authkey",
"(",
"self",
",",
"authkey",
")",
":",
"self",
".",
"_config",
"[",
"'authkey'",
"]",
"=",
"AuthenticationString",
"(",
"authkey",
")"
] | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.9/multiprocess/process.py#L218-L222 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/xmlrpc/client.py | python | _MultiCallMethod.__init__ | (self, call_list, name) | [] | def __init__(self, call_list, name):
self.__call_list = call_list
self.__name = name | [
"def",
"__init__",
"(",
"self",
",",
"call_list",
",",
"name",
")",
":",
"self",
".",
"__call_list",
"=",
"call_list",
"self",
".",
"__name",
"=",
"name"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/xmlrpc/client.py#L809-L811 | ||||
williamgilpin/pypdb | 9a501d4650ddd9b3ac0a10ff28b83642fbe2ef68 | pypdb/pypdb.py | python | find_results_gen | (search_term, field='title') | Return a generator of the results returned by a search of
the protein data bank. This generator is used internally.
Parameters
----------
search_term : str
The search keyword
field : str
The type of information to record about each entry
Examples
--------
>>> result_... | Return a generator of the results returned by a search of
the protein data bank. This generator is used internally. | [
"Return",
"a",
"generator",
"of",
"the",
"results",
"returned",
"by",
"a",
"search",
"of",
"the",
"protein",
"data",
"bank",
".",
"This",
"generator",
"is",
"used",
"internally",
"."
] | def find_results_gen(search_term, field='title'):
'''
Return a generator of the results returned by a search of
the protein data bank. This generator is used internally.
Parameters
----------
search_term : str
The search keyword
field : str
The type of information to recor... | [
"def",
"find_results_gen",
"(",
"search_term",
",",
"field",
"=",
"'title'",
")",
":",
"search_result_ids",
"=",
"Query",
"(",
"search_term",
")",
".",
"search",
"(",
")",
"all_titles",
"=",
"[",
"]",
"for",
"pdb_id",
"in",
"search_result_ids",
":",
"result"... | https://github.com/williamgilpin/pypdb/blob/9a501d4650ddd9b3ac0a10ff28b83642fbe2ef68/pypdb/pypdb.py#L777-L810 | ||
aosp-mirror/platform_development | 10d2ee6c3d6e0ffafadb170b4557b38f81824799 | vndk/tools/sourcedr/blueprint/blueprint.py | python | fill_module_namespaces | (root_bp, modules) | return modules | Collect soong_namespace definition and set a `_namespace` property to
each module definitions. | Collect soong_namespace definition and set a `_namespace` property to
each module definitions. | [
"Collect",
"soong_namespace",
"definition",
"and",
"set",
"a",
"_namespace",
"property",
"to",
"each",
"module",
"definitions",
"."
] | def fill_module_namespaces(root_bp, modules):
"""Collect soong_namespace definition and set a `_namespace` property to
each module definitions."""
# Collect all namespaces
rootdir = os.path.dirname(os.path.abspath(root_bp))
namespaces = {rootdir}
for ident, attrs in modules:
if ident ==... | [
"def",
"fill_module_namespaces",
"(",
"root_bp",
",",
"modules",
")",
":",
"# Collect all namespaces",
"rootdir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"root_bp",
")",
")",
"namespaces",
"=",
"{",
"rootdir",
"... | https://github.com/aosp-mirror/platform_development/blob/10d2ee6c3d6e0ffafadb170b4557b38f81824799/vndk/tools/sourcedr/blueprint/blueprint.py#L974-L999 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/utils/text/dateformat.py | python | DateFormatter.hour_12_hour_clock | (self) | return self._time_now.strftime("%I") | [] | def hour_12_hour_clock(self):
return self._time_now.strftime("%I") | [
"def",
"hour_12_hour_clock",
"(",
"self",
")",
":",
"return",
"self",
".",
"_time_now",
".",
"strftime",
"(",
"\"%I\"",
")"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/utils/text/dateformat.py#L75-L76 | |||
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_internal/locations/__init__.py | python | _deduplicated | (v1: str, v2: str) | return [v1, v2] | Deduplicate values from a list. | Deduplicate values from a list. | [
"Deduplicate",
"values",
"from",
"a",
"list",
"."
] | def _deduplicated(v1: str, v2: str) -> List[str]:
"""Deduplicate values from a list."""
if v1 == v2:
return [v1]
return [v1, v2] | [
"def",
"_deduplicated",
"(",
"v1",
":",
"str",
",",
"v2",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"v1",
"==",
"v2",
":",
"return",
"[",
"v1",
"]",
"return",
"[",
"v1",
",",
"v2",
"]"
] | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_internal/locations/__init__.py#L458-L462 | |
conan-io/conan | 28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8 | conans/client/build/compiler_flags.py | python | architecture_flag | (settings) | return "" | returns flags specific to the target architecture and compiler | returns flags specific to the target architecture and compiler | [
"returns",
"flags",
"specific",
"to",
"the",
"target",
"architecture",
"and",
"compiler"
] | def architecture_flag(settings):
"""
returns flags specific to the target architecture and compiler
"""
compiler = settings.get_safe("compiler")
compiler_base = settings.get_safe("compiler.base")
arch = settings.get_safe("arch")
the_os = settings.get_safe("os")
subsystem = settings.get_s... | [
"def",
"architecture_flag",
"(",
"settings",
")",
":",
"compiler",
"=",
"settings",
".",
"get_safe",
"(",
"\"compiler\"",
")",
"compiler_base",
"=",
"settings",
".",
"get_safe",
"(",
"\"compiler.base\"",
")",
"arch",
"=",
"settings",
".",
"get_safe",
"(",
"\"a... | https://github.com/conan-io/conan/blob/28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8/conans/client/build/compiler_flags.py#L37-L78 | |
deanishe/alfred-fixum | 34cc2232789af5373befcffe8cd50536c88b20bf | src/workflow/workflow.py | python | Workflow.version | (self) | return self._version | Return the version of the workflow.
.. versionadded:: 1.9.10
Get the workflow version from environment variable,
the ``update_settings`` dict passed on
instantiation, the ``version`` file located in the workflow's
root directory or ``info.plist``. Return ``None`` if none
... | Return the version of the workflow. | [
"Return",
"the",
"version",
"of",
"the",
"workflow",
"."
] | def version(self):
"""Return the version of the workflow.
.. versionadded:: 1.9.10
Get the workflow version from environment variable,
the ``update_settings`` dict passed on
instantiation, the ``version`` file located in the workflow's
root directory or ``info.plist``. ... | [
"def",
"version",
"(",
"self",
")",
":",
"if",
"self",
".",
"_version",
"is",
"UNSET",
":",
"version",
"=",
"None",
"# environment variable has priority",
"if",
"self",
".",
"alfred_env",
".",
"get",
"(",
"'workflow_version'",
")",
":",
"version",
"=",
"self... | https://github.com/deanishe/alfred-fixum/blob/34cc2232789af5373befcffe8cd50536c88b20bf/src/workflow/workflow.py#L1134-L1179 | |
jwkvam/bowtie | 220cd41367a70f2e206db846278cb7b6fd3649eb | bowtie/feedback/message.py | python | loading | (content) | Load message.
Parameters
----------
content : str
Message to show user. | Load message. | [
"Load",
"message",
"."
] | def loading(content):
"""Load message.
Parameters
----------
content : str
Message to show user.
"""
_message(func_name(), content) | [
"def",
"loading",
"(",
"content",
")",
":",
"_message",
"(",
"func_name",
"(",
")",
",",
"content",
")"
] | https://github.com/jwkvam/bowtie/blob/220cd41367a70f2e206db846278cb7b6fd3649eb/bowtie/feedback/message.py#L83-L92 | ||
rcorcs/NatI | fdf014f4292afdc95250add7b6658468043228e1 | en/parser/nltk_lite/parse/cfg.py | python | Nonterminal.__div__ | (self, rhs) | return Nonterminal('%s/%s' % (self._symbol, rhs._symbol)) | @return: A new nonterminal whose symbol is C{M{A}/M{B}}, where
C{M{A}} is the symbol for this nonterminal, and C{M{B}}
is the symbol for rhs.
@rtype: L{Nonterminal}
@param rhs: The nonterminal used to form the right hand side
of the new nonterminal.
@type rhs:... | [] | def __div__(self, rhs):
"""
@return: A new nonterminal whose symbol is C{M{A}/M{B}}, where
C{M{A}} is the symbol for this nonterminal, and C{M{B}}
is the symbol for rhs.
@rtype: L{Nonterminal}
@param rhs: The nonterminal used to form the right hand side
... | [
"def",
"__div__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"Nonterminal",
"(",
"'%s/%s'",
"%",
"(",
"self",
".",
"_symbol",
",",
"rhs",
".",
"_symbol",
")",
")"
] | https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/parser/nltk_lite/parse/cfg.py#L164-L174 | ||
sqlalchemy/sqlalchemy | eb716884a4abcabae84a6aaba105568e925b7d27 | lib/sqlalchemy/pool/base.py | python | _ConnectionFairy.cursor | (self, *args, **kwargs) | return self.dbapi_connection.cursor(*args, **kwargs) | Return a new DBAPI cursor for the underlying connection.
This method is a proxy for the ``connection.cursor()`` DBAPI
method. | Return a new DBAPI cursor for the underlying connection. | [
"Return",
"a",
"new",
"DBAPI",
"cursor",
"for",
"the",
"underlying",
"connection",
"."
] | def cursor(self, *args, **kwargs):
"""Return a new DBAPI cursor for the underlying connection.
This method is a proxy for the ``connection.cursor()`` DBAPI
method.
"""
return self.dbapi_connection.cursor(*args, **kwargs) | [
"def",
"cursor",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"dbapi_connection",
".",
"cursor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/pool/base.py#L1242-L1249 | |
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/analyses/decompiler/structured_codegen/c.py | python | CBinaryOp._c_repr_chunks_logicalor | (self) | [] | def _c_repr_chunks_logicalor(self):
yield from self._c_repr_chunks(" || ") | [
"def",
"_c_repr_chunks_logicalor",
"(",
"self",
")",
":",
"yield",
"from",
"self",
".",
"_c_repr_chunks",
"(",
"\" || \"",
")"
] | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/decompiler/structured_codegen/c.py#L1360-L1361 | ||||
mozilla/mozillians | bd5da47fef01e4e09d3bb8cb0799735bdfbeb3f9 | mozillians/users/managers.py | python | UserProfileQuerySet.privacy_level | (self, level=MOZILLIANS) | return self.all() | Set privacy level for query set. | Set privacy level for query set. | [
"Set",
"privacy",
"level",
"for",
"query",
"set",
"."
] | def privacy_level(self, level=MOZILLIANS):
"""Set privacy level for query set."""
self._privacy_level = level
return self.all() | [
"def",
"privacy_level",
"(",
"self",
",",
"level",
"=",
"MOZILLIANS",
")",
":",
"self",
".",
"_privacy_level",
"=",
"level",
"return",
"self",
".",
"all",
"(",
")"
] | https://github.com/mozilla/mozillians/blob/bd5da47fef01e4e09d3bb8cb0799735bdfbeb3f9/mozillians/users/managers.py#L90-L93 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/frontends/stream/data_structures.py | python | StreamDataset._set_units | (self) | [] | def _set_units(self):
self.field_units = self.stream_handler.field_units | [
"def",
"_set_units",
"(",
"self",
")",
":",
"self",
".",
"field_units",
"=",
"self",
".",
"stream_handler",
".",
"field_units"
] | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/frontends/stream/data_structures.py#L323-L324 | ||||
exodrifter/unity-python | bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d | Lib/telnetlib.py | python | Telnet.process_rawq | (self) | Transfer from raw queue to cooked queue.
Set self.eof when connection is closed. Don't block unless in
the midst of an IAC sequence. | Transfer from raw queue to cooked queue. | [
"Transfer",
"from",
"raw",
"queue",
"to",
"cooked",
"queue",
"."
] | def process_rawq(self):
"""Transfer from raw queue to cooked queue.
Set self.eof when connection is closed. Don't block unless in
the midst of an IAC sequence.
"""
buf = ['', '']
try:
while self.rawq:
c = self.rawq_getchar()
... | [
"def",
"process_rawq",
"(",
"self",
")",
":",
"buf",
"=",
"[",
"''",
",",
"''",
"]",
"try",
":",
"while",
"self",
".",
"rawq",
":",
"c",
"=",
"self",
".",
"rawq_getchar",
"(",
")",
"if",
"not",
"self",
".",
"iacseq",
":",
"if",
"c",
"==",
"theN... | https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/telnetlib.py#L474-L544 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/homekit/util.py | python | get_persist_fullpath_for_entry_id | (hass: HomeAssistant, entry_id: str) | return hass.config.path(STORAGE_DIR, get_persist_filename_for_entry_id(entry_id)) | Determine the path to the homekit state file. | Determine the path to the homekit state file. | [
"Determine",
"the",
"path",
"to",
"the",
"homekit",
"state",
"file",
"."
] | def get_persist_fullpath_for_entry_id(hass: HomeAssistant, entry_id: str):
"""Determine the path to the homekit state file."""
return hass.config.path(STORAGE_DIR, get_persist_filename_for_entry_id(entry_id)) | [
"def",
"get_persist_fullpath_for_entry_id",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry_id",
":",
"str",
")",
":",
"return",
"hass",
".",
"config",
".",
"path",
"(",
"STORAGE_DIR",
",",
"get_persist_filename_for_entry_id",
"(",
"entry_id",
")",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/homekit/util.py#L411-L413 | |
LMFDB/lmfdb | 6cf48a4c18a96e6298da6ae43f587f96845bcb43 | lmfdb/backend/table.py | python | PostgresTable.restore_constraint | (self, name, suffix="") | Restore a specified constraint using the meta_constraints table.
INPUT:
- ``name`` -- the name of the constraint
- ``suffix`` -- a string such as "_tmp" or "_old1" to be appended to the names in the ALTER TABLE statement. | Restore a specified constraint using the meta_constraints table. | [
"Restore",
"a",
"specified",
"constraint",
"using",
"the",
"meta_constraints",
"table",
"."
] | def restore_constraint(self, name, suffix=""):
"""
Restore a specified constraint using the meta_constraints table.
INPUT:
- ``name`` -- the name of the constraint
- ``suffix`` -- a string such as "_tmp" or "_old1" to be appended to the names in the ALTER TABLE statement.
... | [
"def",
"restore_constraint",
"(",
"self",
",",
"name",
",",
"suffix",
"=",
"\"\"",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"with",
"DelayCommit",
"(",
"self",
",",
"silence",
"=",
"True",
")",
":",
"type",
",",
"columns",
",",
"check_fun... | https://github.com/LMFDB/lmfdb/blob/6cf48a4c18a96e6298da6ae43f587f96845bcb43/lmfdb/backend/table.py#L811-L827 | ||
hakril/PythonForWindows | 61e027a678d5b87aa64fcf8a37a6661a86236589 | windows/utils/winutils.py | python | EAInfo.__iter__ | (self) | [] | def __iter__(self):
while self:
yield self
self = self.next | [
"def",
"__iter__",
"(",
"self",
")",
":",
"while",
"self",
":",
"yield",
"self",
"self",
"=",
"self",
".",
"next"
] | https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/utils/winutils.py#L388-L391 | ||||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/deconz/deconz_event.py | python | DeconzEvent.async_update_callback | (self) | Fire the event if reason is that state is updated. | Fire the event if reason is that state is updated. | [
"Fire",
"the",
"event",
"if",
"reason",
"is",
"that",
"state",
"is",
"updated",
"."
] | def async_update_callback(self):
"""Fire the event if reason is that state is updated."""
if (
self.gateway.ignore_state_updates
or "state" not in self._device.changed_keys
):
return
data = {
CONF_ID: self.event_id,
CONF_UNIQUE... | [
"def",
"async_update_callback",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"gateway",
".",
"ignore_state_updates",
"or",
"\"state\"",
"not",
"in",
"self",
".",
"_device",
".",
"changed_keys",
")",
":",
"return",
"data",
"=",
"{",
"CONF_ID",
":",
"self"... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/deconz/deconz_event.py#L113-L139 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib_pypy/cffi/_pycparser/plyparser.py | python | parameterized | (*params) | return decorate | Decorator to create parameterized rules.
Parameterized rule methods must be named starting with 'p_' and contain
'xxx', and their docstrings may contain 'xxx' and 'yyy'. These will be
replaced by the given parameter tuples. For example, ``p_xxx_rule()`` with
docstring 'xxx_rule : yyy' when decorated w... | Decorator to create parameterized rules. | [
"Decorator",
"to",
"create",
"parameterized",
"rules",
"."
] | def parameterized(*params):
""" Decorator to create parameterized rules.
Parameterized rule methods must be named starting with 'p_' and contain
'xxx', and their docstrings may contain 'xxx' and 'yyy'. These will be
replaced by the given parameter tuples. For example, ``p_xxx_rule()`` with
docstrin... | [
"def",
"parameterized",
"(",
"*",
"params",
")",
":",
"def",
"decorate",
"(",
"rule_func",
")",
":",
"rule_func",
".",
"_params",
"=",
"params",
"return",
"rule_func",
"return",
"decorate"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib_pypy/cffi/_pycparser/plyparser.py#L70-L83 | |
boston-dynamics/spot-sdk | 5ffa12e6943a47323c7279d86e30346868755f52 | python/bosdyn-client/src/bosdyn/client/estop.py | python | EstopEndpoint.to_proto | (self) | Return estop_pb2.EstopEndpoint based on current member variables. | Return estop_pb2.EstopEndpoint based on current member variables. | [
"Return",
"estop_pb2",
".",
"EstopEndpoint",
"based",
"on",
"current",
"member",
"variables",
"."
] | def to_proto(self):
"""Return estop_pb2.EstopEndpoint based on current member variables."""
t_seconds = int(self.estop_timeout)
t_nanos = int((self.estop_timeout - t_seconds) * 1e9)
if self.estop_cut_power_timeout is None:
return estop_pb2.EstopEndpoint(role=self.role, name=s... | [
"def",
"to_proto",
"(",
"self",
")",
":",
"t_seconds",
"=",
"int",
"(",
"self",
".",
"estop_timeout",
")",
"t_nanos",
"=",
"int",
"(",
"(",
"self",
".",
"estop_timeout",
"-",
"t_seconds",
")",
"*",
"1e9",
")",
"if",
"self",
".",
"estop_cut_power_timeout"... | https://github.com/boston-dynamics/spot-sdk/blob/5ffa12e6943a47323c7279d86e30346868755f52/python/bosdyn-client/src/bosdyn/client/estop.py#L407-L421 | ||
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | openWrt/files/usr/lib/python2.7/site-packages/tornado/ioloop.py | python | IOLoop.handle_callback_exception | (self, callback) | This method is called whenever a callback run by the `IOLoop`
throws an exception.
By default simply logs the exception as an error. Subclasses
may override this method to customize reporting of exceptions.
The exception itself is not passed explicitly, but is available
in `sy... | This method is called whenever a callback run by the `IOLoop`
throws an exception. | [
"This",
"method",
"is",
"called",
"whenever",
"a",
"callback",
"run",
"by",
"the",
"IOLoop",
"throws",
"an",
"exception",
"."
] | def handle_callback_exception(self, callback):
"""This method is called whenever a callback run by the `IOLoop`
throws an exception.
By default simply logs the exception as an error. Subclasses
may override this method to customize reporting of exceptions.
The exception itself... | [
"def",
"handle_callback_exception",
"(",
"self",
",",
"callback",
")",
":",
"app_log",
".",
"error",
"(",
"\"Exception in callback %r\"",
",",
"callback",
",",
"exc_info",
"=",
"True",
")"
] | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/tornado/ioloop.py#L457-L467 | ||
eg4000/SKU110K_CVPR19 | 1fb83d6d0e5fd0fef8d53d25940ebd6f8d027020 | object_detector_retinanet/keras_retinanet/bin/train_iou.py | python | makedirs | (path) | [] | def makedirs(path):
# Intended behavior: try to create the directory,
# pass if the directory exists already, fails otherwise.
# Meant for Python 2.7/3.n compatibility.
try:
os.makedirs(path)
except OSError:
if not os.path.isdir(path):
raise | [
"def",
"makedirs",
"(",
"path",
")",
":",
"# Intended behavior: try to create the directory,",
"# pass if the directory exists already, fails otherwise.",
"# Meant for Python 2.7/3.n compatibility.",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
":",... | https://github.com/eg4000/SKU110K_CVPR19/blob/1fb83d6d0e5fd0fef8d53d25940ebd6f8d027020/object_detector_retinanet/keras_retinanet/bin/train_iou.py#L53-L61 | ||||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Doc/docutils/parsers/rst/directives/__init__.py | python | positive_int_list | (argument) | return [positive_int(entry) for entry in entries] | Converts a space- or comma-separated list of values into a Python list
of integers.
(Directive option conversion function.)
Raises ValueError for non-positive-integer values. | Converts a space- or comma-separated list of values into a Python list
of integers.
(Directive option conversion function.) | [
"Converts",
"a",
"space",
"-",
"or",
"comma",
"-",
"separated",
"list",
"of",
"values",
"into",
"a",
"Python",
"list",
"of",
"integers",
".",
"(",
"Directive",
"option",
"conversion",
"function",
".",
")"
] | def positive_int_list(argument):
"""
Converts a space- or comma-separated list of values into a Python list
of integers.
(Directive option conversion function.)
Raises ValueError for non-positive-integer values.
"""
if ',' in argument:
entries = argument.split(',')
else:
... | [
"def",
"positive_int_list",
"(",
"argument",
")",
":",
"if",
"','",
"in",
"argument",
":",
"entries",
"=",
"argument",
".",
"split",
"(",
"','",
")",
"else",
":",
"entries",
"=",
"argument",
".",
"split",
"(",
")",
"return",
"[",
"positive_int",
"(",
"... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Doc/docutils/parsers/rst/directives/__init__.py#L312-L324 | |
nedbat/coveragepy | d004b18a1ad59ec89b89c96c03a789a55cc51693 | coverage/execfile.py | python | PyRunner._prepare2 | (self) | Do more preparation to run Python code.
Includes finding the module to run and adjusting sys.argv[0].
This method is allowed to import code. | Do more preparation to run Python code. | [
"Do",
"more",
"preparation",
"to",
"run",
"Python",
"code",
"."
] | def _prepare2(self):
"""Do more preparation to run Python code.
Includes finding the module to run and adjusting sys.argv[0].
This method is allowed to import code.
"""
if self.as_module:
self.modulename = self.arg0
pathname, self.package, self.spec = fi... | [
"def",
"_prepare2",
"(",
"self",
")",
":",
"if",
"self",
".",
"as_module",
":",
"self",
".",
"modulename",
"=",
"self",
".",
"arg0",
"pathname",
",",
"self",
".",
"package",
",",
"self",
".",
"spec",
"=",
"find_module",
"(",
"self",
".",
"modulename",
... | https://github.com/nedbat/coveragepy/blob/d004b18a1ad59ec89b89c96c03a789a55cc51693/coverage/execfile.py#L115-L155 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/export/views/utils.py | python | ODataFeedMixin.new_export_instance | (self) | return export_instance | [] | def new_export_instance(self):
export_instance = self.export_instance_cls.get(self.export_id)
export_instance._id = None
export_instance._rev = None
return export_instance | [
"def",
"new_export_instance",
"(",
"self",
")",
":",
"export_instance",
"=",
"self",
".",
"export_instance_cls",
".",
"get",
"(",
"self",
".",
"export_id",
")",
"export_instance",
".",
"_id",
"=",
"None",
"export_instance",
".",
"_rev",
"=",
"None",
"return",
... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/export/views/utils.py#L240-L244 | |||
google-research/pegasus | 649a5978e45a078e1574ed01c92fc12d3aa05f7f | pegasus/params/estimator_utils.py | python | _load_vars_from_checkpoint | (use_tpu, init_checkpoint) | return scaffold_fn | load variables from initial checkpoints.
Args:
use_tpu: bool whether to use tpu.
init_checkpoint: path of checkpoint containing variables to be initialized.
Returns:
scaffold_fn: The scaffold_fn used by tpu estimator spec. If use_tpu=False,
this is set to None. | load variables from initial checkpoints. | [
"load",
"variables",
"from",
"initial",
"checkpoints",
"."
] | def _load_vars_from_checkpoint(use_tpu, init_checkpoint):
"""load variables from initial checkpoints.
Args:
use_tpu: bool whether to use tpu.
init_checkpoint: path of checkpoint containing variables to be initialized.
Returns:
scaffold_fn: The scaffold_fn used by tpu estimator spec. If use_tpu=False... | [
"def",
"_load_vars_from_checkpoint",
"(",
"use_tpu",
",",
"init_checkpoint",
")",
":",
"if",
"not",
"init_checkpoint",
":",
"return",
"None",
"tvars",
"=",
"tf",
".",
"trainable_variables",
"(",
")",
"(",
"assignment_map",
",",
"initialized_variable_names",
")",
"... | https://github.com/google-research/pegasus/blob/649a5978e45a078e1574ed01c92fc12d3aa05f7f/pegasus/params/estimator_utils.py#L176-L213 | |
fablabnbg/inkscape-silhouette | e0ad65115b4b2b0a5b60dfecd9a3ca03ec1d6bec | silhouette/pyusb-1.0.2/usb/libloader.py | python | load_locate_library | (candidates, cygwin_lib, name,
win_cls=None, cygwin_cls=None, others_cls=None,
find_library=None, check_symbols=None) | Locates and loads a library.
Returns: the loaded library
arguments:
* candidates -- candidates list for locate_library()
* cygwin_lib -- name of the cygwin library
* name -- lib identifier (for logging). Defaults to None.
* win_cls -- class that is used to instantiate the ... | Locates and loads a library. | [
"Locates",
"and",
"loads",
"a",
"library",
"."
] | def load_locate_library(candidates, cygwin_lib, name,
win_cls=None, cygwin_cls=None, others_cls=None,
find_library=None, check_symbols=None):
"""Locates and loads a library.
Returns: the loaded library
arguments:
* candidates -- candidates list for lo... | [
"def",
"load_locate_library",
"(",
"candidates",
",",
"cygwin_lib",
",",
"name",
",",
"win_cls",
"=",
"None",
",",
"cygwin_cls",
"=",
"None",
",",
"others_cls",
"=",
"None",
",",
"find_library",
"=",
"None",
",",
"check_symbols",
"=",
"None",
")",
":",
"if... | https://github.com/fablabnbg/inkscape-silhouette/blob/e0ad65115b4b2b0a5b60dfecd9a3ca03ec1d6bec/silhouette/pyusb-1.0.2/usb/libloader.py#L130-L190 | ||
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/visualization/volume_rendering/old_camera.py | python | MosaicCamera._setup_box_properties | (self, width, center, unit_vectors) | [] | def _setup_box_properties(self, width, center, unit_vectors):
owidth = deepcopy(width)
self.width = width
self.origin = (
self.center
- 0.5 * self.nimx * self.width[0] * self.orienter.unit_vectors[0]
- 0.5 * self.nimy * self.width[1] * self.orienter.unit_vecto... | [
"def",
"_setup_box_properties",
"(",
"self",
",",
"width",
",",
"center",
",",
"unit_vectors",
")",
":",
"owidth",
"=",
"deepcopy",
"(",
"width",
")",
"self",
".",
"width",
"=",
"width",
"self",
".",
"origin",
"=",
"(",
"self",
".",
"center",
"-",
"0.5... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/visualization/volume_rendering/old_camera.py#L1897-L1930 | ||||
phonopy/phonopy | 816586d0ba8177482ecf40e52f20cbdee2260d51 | phonopy/cui/settings.py | python | PhonopySettings.set_min_frequency | (self, val) | Set min_frequency. | Set min_frequency. | [
"Set",
"min_frequency",
"."
] | def set_min_frequency(self, val):
"""Set min_frequency."""
self._v["min_frequency"] = val | [
"def",
"set_min_frequency",
"(",
"self",
",",
"val",
")",
":",
"self",
".",
"_v",
"[",
"\"min_frequency\"",
"]",
"=",
"val"
] | https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/cui/settings.py#L1268-L1270 | ||
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/setuptools/pkg_resources/__init__.py | python | _rebuild_mod_path | (orig_path, package_name, module) | Rebuild module.__path__ ensuring that all entries are ordered
corresponding to their sys.path order | Rebuild module.__path__ ensuring that all entries are ordered
corresponding to their sys.path order | [
"Rebuild",
"module",
".",
"__path__",
"ensuring",
"that",
"all",
"entries",
"are",
"ordered",
"corresponding",
"to",
"their",
"sys",
".",
"path",
"order"
] | def _rebuild_mod_path(orig_path, package_name, module):
"""
Rebuild module.__path__ ensuring that all entries are ordered
corresponding to their sys.path order
"""
sys_path = [_normalize_cached(p) for p in sys.path]
def safe_sys_path_index(entry):
"""
Workaround for #520 and #51... | [
"def",
"_rebuild_mod_path",
"(",
"orig_path",
",",
"package_name",
",",
"module",
")",
":",
"sys_path",
"=",
"[",
"_normalize_cached",
"(",
"p",
")",
"for",
"p",
"in",
"sys",
".",
"path",
"]",
"def",
"safe_sys_path_index",
"(",
"entry",
")",
":",
"\"\"\"\n... | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/setuptools/pkg_resources/__init__.py#L2062-L2088 | ||
OUCMachineLearning/OUCML | 5b54337d7c0316084cb1a74befda2bba96137d4a | One_Day_One_GAN/day13/cyclegan/models.py | python | ResidualBlock.__init__ | (self, in_features) | [] | def __init__(self, in_features):
super(ResidualBlock, self).__init__()
self.block = nn.Sequential(
nn.ReflectionPad2d(1),
nn.Conv2d(in_features, in_features, 3),
nn.InstanceNorm2d(in_features),
nn.ReLU(inplace=True),
nn.ReflectionPad2d(1),
... | [
"def",
"__init__",
"(",
"self",
",",
"in_features",
")",
":",
"super",
"(",
"ResidualBlock",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"block",
"=",
"nn",
".",
"Sequential",
"(",
"nn",
".",
"ReflectionPad2d",
"(",
"1",
")",
",",
"nn",... | https://github.com/OUCMachineLearning/OUCML/blob/5b54337d7c0316084cb1a74befda2bba96137d4a/One_Day_One_GAN/day13/cyclegan/models.py#L23-L34 | ||||
alpacahq/alpaca-backtrader-api | 475bb54b8b16506092eb97df5a7cb1d05f0b86be | sample/strategy_multiple_datas.py | python | SmaCross1.notify_store | (self, msg, *args, **kwargs) | [] | def notify_store(self, msg, *args, **kwargs):
super().notify_store(msg, *args, **kwargs)
self.log(msg) | [
"def",
"notify_store",
"(",
"self",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"notify_store",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"log",
"(",
"msg",
")"
] | https://github.com/alpacahq/alpaca-backtrader-api/blob/475bb54b8b16506092eb97df5a7cb1d05f0b86be/sample/strategy_multiple_datas.py#L42-L44 | ||||
Blizzard/heroprotocol | 3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c | heroprotocol/versions/protocol61872.py | python | decode_replay_attributes_events | (contents) | return attributes | Decodes and yields each attribute from the contents byte string. | Decodes and yields each attribute from the contents byte string. | [
"Decodes",
"and",
"yields",
"each",
"attribute",
"from",
"the",
"contents",
"byte",
"string",
"."
] | def decode_replay_attributes_events(contents):
"""Decodes and yields each attribute from the contents byte string."""
buffer = BitPackedBuffer(contents, 'little')
attributes = {}
if not buffer.done():
attributes['source'] = buffer.read_bits(8)
attributes['mapNamespace'] = buffer.read_bit... | [
"def",
"decode_replay_attributes_events",
"(",
"contents",
")",
":",
"buffer",
"=",
"BitPackedBuffer",
"(",
"contents",
",",
"'little'",
")",
"attributes",
"=",
"{",
"}",
"if",
"not",
"buffer",
".",
"done",
"(",
")",
":",
"attributes",
"[",
"'source'",
"]",
... | https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol61872.py#L451-L471 | |
shapely/shapely | 9258e6dd4dcca61699d69c2a5853a486b132ed86 | shapely/predicates.py | python | is_missing | (geometry, **kwargs) | return lib.is_missing(geometry, **kwargs) | Returns True if the object is not a geometry (None)
Parameters
----------
geometry : any object or array_like
**kwargs
For other keyword-only arguments, see the
`NumPy ufunc docs <https://numpy.org/doc/stable/reference/ufuncs.html#ufuncs-kwargs>`_.
See also
--------
is_geom... | Returns True if the object is not a geometry (None) | [
"Returns",
"True",
"if",
"the",
"object",
"is",
"not",
"a",
"geometry",
"(",
"None",
")"
] | def is_missing(geometry, **kwargs):
"""Returns True if the object is not a geometry (None)
Parameters
----------
geometry : any object or array_like
**kwargs
For other keyword-only arguments, see the
`NumPy ufunc docs <https://numpy.org/doc/stable/reference/ufuncs.html#ufuncs-kwargs... | [
"def",
"is_missing",
"(",
"geometry",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"lib",
".",
"is_missing",
"(",
"geometry",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/shapely/shapely/blob/9258e6dd4dcca61699d69c2a5853a486b132ed86/shapely/predicates.py#L193-L220 | |
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py | python | PoolManager.connection_from_context | (self, request_context) | return self.connection_from_pool_key(pool_key) | Get a :class:`ConnectionPool` based on the request context.
``request_context`` must at least contain the ``scheme`` key and its
value must be a key in ``key_fn_by_scheme`` instance variable. | Get a :class:`ConnectionPool` based on the request context. | [
"Get",
"a",
":",
"class",
":",
"ConnectionPool",
"based",
"on",
"the",
"request",
"context",
"."
] | def connection_from_context(self, request_context):
"""
Get a :class:`ConnectionPool` based on the request context.
``request_context`` must at least contain the ``scheme`` key and its
value must be a key in ``key_fn_by_scheme`` instance variable.
"""
scheme = request_co... | [
"def",
"connection_from_context",
"(",
"self",
",",
"request_context",
")",
":",
"scheme",
"=",
"request_context",
"[",
"'scheme'",
"]",
".",
"lower",
"(",
")",
"pool_key_constructor",
"=",
"self",
".",
"key_fn_by_scheme",
"[",
"scheme",
"]",
"pool_key",
"=",
... | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py#L182-L193 | |
markj3d/Red9_StudioPack | 1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919 | core/Red9_AnimationUtils.py | python | MirrorHierarchy.makeSymmetrical | (self, nodes=None, mode='Anim', primeAxis='Left') | similar to the mirrorData except this is designed to take the data from an object in
one side of the mirrorDict and pass that data to the opposite matching node, thus
making the anim/pose symmetrical according to the mirror setups.
Really useful for facial setups!
:param nodes: optional... | similar to the mirrorData except this is designed to take the data from an object in
one side of the mirrorDict and pass that data to the opposite matching node, thus
making the anim/pose symmetrical according to the mirror setups.
Really useful for facial setups! | [
"similar",
"to",
"the",
"mirrorData",
"except",
"this",
"is",
"designed",
"to",
"take",
"the",
"data",
"from",
"an",
"object",
"in",
"one",
"side",
"of",
"the",
"mirrorDict",
"and",
"pass",
"that",
"data",
"to",
"the",
"opposite",
"matching",
"node",
"thus... | def makeSymmetrical(self, nodes=None, mode='Anim', primeAxis='Left'):
'''
similar to the mirrorData except this is designed to take the data from an object in
one side of the mirrorDict and pass that data to the opposite matching node, thus
making the anim/pose symmetrical according to t... | [
"def",
"makeSymmetrical",
"(",
"self",
",",
"nodes",
"=",
"None",
",",
"mode",
"=",
"'Anim'",
",",
"primeAxis",
"=",
"'Left'",
")",
":",
"self",
".",
"getMirrorSets",
"(",
"nodes",
")",
"if",
"not",
"self",
".",
"indexednodes",
":",
"raise",
"IOError",
... | https://github.com/markj3d/Red9_StudioPack/blob/1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919/core/Red9_AnimationUtils.py#L5048-L5095 | ||
mayank93/Twitter-Sentiment-Analysis | f095c6ca6bf69787582b5dabb140fefaf278eb37 | front-end/web2py/gluon/decoder.py | python | autoDetectXMLEncoding | (buffer) | return encoding | buffer -> encoding_name
The buffer should be at least 4 bytes long.
Returns None if encoding cannot be detected.
Note that encoding_name might not have an installed
decoder (e.g. EBCDIC) | buffer -> encoding_name
The buffer should be at least 4 bytes long.
Returns None if encoding cannot be detected.
Note that encoding_name might not have an installed
decoder (e.g. EBCDIC) | [
"buffer",
"-",
">",
"encoding_name",
"The",
"buffer",
"should",
"be",
"at",
"least",
"4",
"bytes",
"long",
".",
"Returns",
"None",
"if",
"encoding",
"cannot",
"be",
"detected",
".",
"Note",
"that",
"encoding_name",
"might",
"not",
"have",
"an",
"installed",
... | def autoDetectXMLEncoding(buffer):
""" buffer -> encoding_name
The buffer should be at least 4 bytes long.
Returns None if encoding cannot be detected.
Note that encoding_name might not have an installed
decoder (e.g. EBCDIC)
"""
# a more efficient implementation would not decode... | [
"def",
"autoDetectXMLEncoding",
"(",
"buffer",
")",
":",
"# a more efficient implementation would not decode the whole",
"# buffer at once but otherwise we'd have to decode a character at",
"# a time looking for the quote character...that's a pain",
"encoding",
"=",
"\"utf_8\"",
"# according... | https://github.com/mayank93/Twitter-Sentiment-Analysis/blob/f095c6ca6bf69787582b5dabb140fefaf278eb37/front-end/web2py/gluon/decoder.py#L23-L70 | |
hirofumi0810/neural_sp | b91877c6d2a11f06026480ab422176274d88cbf2 | neural_sp/datasets/lm.py | python | Dataset.__iter__ | (self) | return self | Generate each mini-batch.
Returns:
ys (np.ndarray): target labels in the main task of size `[B, bptt]`
is_new_epoch (bool): flag for the end of the current epoch | Generate each mini-batch. | [
"Generate",
"each",
"mini",
"-",
"batch",
"."
] | def __iter__(self):
"""Generate each mini-batch.
Returns:
ys (np.ndarray): target labels in the main task of size `[B, bptt]`
is_new_epoch (bool): flag for the end of the current epoch
"""
return self | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/hirofumi0810/neural_sp/blob/b91877c6d2a11f06026480ab422176274d88cbf2/neural_sp/datasets/lm.py#L144-L152 | |
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/idlelib/configHelpSourceEdit.py | python | GetHelpSourceDialog.MenuOk | (self) | return menuOk | Simple validity check for a sensible menu item name | Simple validity check for a sensible menu item name | [
"Simple",
"validity",
"check",
"for",
"a",
"sensible",
"menu",
"item",
"name"
] | def MenuOk(self):
"""Simple validity check for a sensible menu item name"""
menuOk = True
menu = self.menu.get()
menu.strip()
if not menu:
tkMessageBox.showerror(title='Menu Item Error', message='No menu item specified', parent=self)
self.entryMenu.focus_s... | [
"def",
"MenuOk",
"(",
"self",
")",
":",
"menuOk",
"=",
"True",
"menu",
"=",
"self",
".",
"menu",
".",
"get",
"(",
")",
"menu",
".",
"strip",
"(",
")",
"if",
"not",
"menu",
":",
"tkMessageBox",
".",
"showerror",
"(",
"title",
"=",
"'Menu Item Error'",... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/idlelib/configHelpSourceEdit.py#L94-L107 | |
haiwen/seahub | e92fcd44e3e46260597d8faa9347cb8222b8b10d | seahub/base/templatetags/seahub_tags.py | python | short_email | (email) | Return short email which is the string before '@'. | Return short email which is the string before ' | [
"Return",
"short",
"email",
"which",
"is",
"the",
"string",
"before"
] | def short_email(email):
"""
Return short email which is the string before '@'.
"""
idx = email.find('@')
if idx <= 0:
return email
else:
return email[:idx] | [
"def",
"short_email",
"(",
"email",
")",
":",
"idx",
"=",
"email",
".",
"find",
"(",
"'@'",
")",
"if",
"idx",
"<=",
"0",
":",
"return",
"email",
"else",
":",
"return",
"email",
"[",
":",
"idx",
"]"
] | https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/base/templatetags/seahub_tags.py#L429-L437 | ||
shmilylty/OneForAll | 48591142a641e80f8a64ab215d11d06b696702d7 | common/utils.py | python | save_to_db | (name, data, module) | Save request results to database
:param str name: table name
:param list data: data to be saved
:param str module: module name | Save request results to database | [
"Save",
"request",
"results",
"to",
"database"
] | def save_to_db(name, data, module):
"""
Save request results to database
:param str name: table name
:param list data: data to be saved
:param str module: module name
"""
db = Database()
db.drop_table(name)
db.create_table(name)
db.save_db(name, data, module)
db.close() | [
"def",
"save_to_db",
"(",
"name",
",",
"data",
",",
"module",
")",
":",
"db",
"=",
"Database",
"(",
")",
"db",
".",
"drop_table",
"(",
"name",
")",
"db",
".",
"create_table",
"(",
"name",
")",
"db",
".",
"save_db",
"(",
"name",
",",
"data",
",",
... | https://github.com/shmilylty/OneForAll/blob/48591142a641e80f8a64ab215d11d06b696702d7/common/utils.py#L227-L239 | ||
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/pickletools.py | python | read_unicodestring4 | (f) | r"""
>>> import io
>>> s = 'abcd\uabcd'
>>> enc = s.encode('utf-8')
>>> enc
b'abcd\xea\xaf\x8d'
>>> n = bytes([len(enc), 0, 0, 0]) # little-endian 4-byte length
>>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk'))
>>> s == t
True
>>> read_unicodestring4(io.BytesIO(n + enc... | r"""
>>> import io
>>> s = 'abcd\uabcd'
>>> enc = s.encode('utf-8')
>>> enc
b'abcd\xea\xaf\x8d'
>>> n = bytes([len(enc), 0, 0, 0]) # little-endian 4-byte length
>>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk'))
>>> s == t
True | [
"r",
">>>",
"import",
"io",
">>>",
"s",
"=",
"abcd",
"\\",
"uabcd",
">>>",
"enc",
"=",
"s",
".",
"encode",
"(",
"utf",
"-",
"8",
")",
">>>",
"enc",
"b",
"abcd",
"\\",
"xea",
"\\",
"xaf",
"\\",
"x8d",
">>>",
"n",
"=",
"bytes",
"(",
"[",
"len",... | def read_unicodestring4(f):
r"""
>>> import io
>>> s = 'abcd\uabcd'
>>> enc = s.encode('utf-8')
>>> enc
b'abcd\xea\xaf\x8d'
>>> n = bytes([len(enc), 0, 0, 0]) # little-endian 4-byte length
>>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk'))
>>> s == t
True
>>> read_u... | [
"def",
"read_unicodestring4",
"(",
"f",
")",
":",
"n",
"=",
"read_uint4",
"(",
"f",
")",
"assert",
"n",
">=",
"0",
"if",
"n",
">",
"sys",
".",
"maxsize",
":",
"raise",
"ValueError",
"(",
"\"unicodestring4 byte count > sys.maxsize: %d\"",
"%",
"n",
")",
"da... | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/pickletools.py#L633-L659 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/slim/nets/mobilenet_v1_eval.py | python | build_model | () | return g, eval_ops | Build the mobilenet_v1 model for evaluation.
Returns:
g: graph with rewrites after insertion of quantization ops and batch norm
folding.
eval_ops: eval ops for inference.
variables_to_restore: List of variables to restore from checkpoint. | Build the mobilenet_v1 model for evaluation. | [
"Build",
"the",
"mobilenet_v1",
"model",
"for",
"evaluation",
"."
] | def build_model():
"""Build the mobilenet_v1 model for evaluation.
Returns:
g: graph with rewrites after insertion of quantization ops and batch norm
folding.
eval_ops: eval ops for inference.
variables_to_restore: List of variables to restore from checkpoint.
"""
g = tf.Graph()
with g.as_def... | [
"def",
"build_model",
"(",
")",
":",
"g",
"=",
"tf",
".",
"Graph",
"(",
")",
"with",
"g",
".",
"as_default",
"(",
")",
":",
"inputs",
",",
"labels",
"=",
"imagenet_input",
"(",
"is_training",
"=",
"False",
")",
"scope",
"=",
"mobilenet_v1",
".",
"mob... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/slim/nets/mobilenet_v1_eval.py#L108-L135 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/pair/raw.py | python | IRawPacketProtocol.datagramReceived | () | An IP datagram has been received. Parse and process it. | An IP datagram has been received. Parse and process it. | [
"An",
"IP",
"datagram",
"has",
"been",
"received",
".",
"Parse",
"and",
"process",
"it",
"."
] | def datagramReceived():
"""
An IP datagram has been received. Parse and process it.
""" | [
"def",
"datagramReceived",
"(",
")",
":"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/pair/raw.py#L32-L35 | ||
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | portia_examle/lib/python2.7/site-packages/setuptools/command/egg_info.py | python | FileList.global_exclude | (self, pattern) | return self._remove_files(match.match) | Exclude all files anywhere that match the pattern. | Exclude all files anywhere that match the pattern. | [
"Exclude",
"all",
"files",
"anywhere",
"that",
"match",
"the",
"pattern",
"."
] | def global_exclude(self, pattern):
"""
Exclude all files anywhere that match the pattern.
"""
match = translate_pattern(os.path.join('**', pattern))
return self._remove_files(match.match) | [
"def",
"global_exclude",
"(",
"self",
",",
"pattern",
")",
":",
"match",
"=",
"translate_pattern",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'**'",
",",
"pattern",
")",
")",
"return",
"self",
".",
"_remove_files",
"(",
"match",
".",
"match",
")"
] | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/setuptools/command/egg_info.py#L465-L470 | |
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/lib/pyxmpp/jabber/disco.py | python | DiscoInfo.get_node | (self) | return node.decode("utf-8") | Get the node address of the `DiscoInfo` object.
:return: the node name.
:returntype: `unicode` | Get the node address of the `DiscoInfo` object. | [
"Get",
"the",
"node",
"address",
"of",
"the",
"DiscoInfo",
"object",
"."
] | def get_node(self):
"""Get the node address of the `DiscoInfo` object.
:return: the node name.
:returntype: `unicode`"""
node=self.xmlnode.prop("node")
if not node:
return None
return node.decode("utf-8") | [
"def",
"get_node",
"(",
"self",
")",
":",
"node",
"=",
"self",
".",
"xmlnode",
".",
"prop",
"(",
"\"node\"",
")",
"if",
"not",
"node",
":",
"return",
"None",
"return",
"node",
".",
"decode",
"(",
"\"utf-8\"",
")"
] | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/lib/pyxmpp/jabber/disco.py#L597-L606 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/text.py | python | Text.set_y | (self, y) | Set the *y* position of the text
ACCEPTS: float | Set the *y* position of the text | [
"Set",
"the",
"*",
"y",
"*",
"position",
"of",
"the",
"text"
] | def set_y(self, y):
"""
Set the *y* position of the text
ACCEPTS: float
"""
self._y = y | [
"def",
"set_y",
"(",
"self",
",",
"y",
")",
":",
"self",
".",
"_y",
"=",
"y"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/text.py#L942-L948 | ||
SmallVagetable/machine_learning_python | a9cc8074adf91567407a5cb70a4c17b64f299fbc | em/gmm.py | python | GMM.scale_data | (self) | [] | def scale_data(self):
for d in range(self.D):
max_ = self.X[:, d].max()
min_ = self.X[:, d].min()
self.X[:, d] = (self.X[:, d] - min_) / (max_ - min_)
self.xj_mean = np.mean(self.X, axis=0)
self.xj_s = np.sqrt(np.var(self.X, axis=0)) | [
"def",
"scale_data",
"(",
"self",
")",
":",
"for",
"d",
"in",
"range",
"(",
"self",
".",
"D",
")",
":",
"max_",
"=",
"self",
".",
"X",
"[",
":",
",",
"d",
"]",
".",
"max",
"(",
")",
"min_",
"=",
"self",
".",
"X",
"[",
":",
",",
"d",
"]",
... | https://github.com/SmallVagetable/machine_learning_python/blob/a9cc8074adf91567407a5cb70a4c17b64f299fbc/em/gmm.py#L78-L84 | ||||
mckinziebrandon/DeepChatModels | 4fef8a6ce00d92235a2fb0e427d2ec60833022d2 | chatbot/dynamic_models.py | python | DynamicBot.step | (self, forward_only=False) | Run one step of the model, which can mean 1 of the following:
1. forward_only == False.
- This means we are training.
- We do a forward and a backward pass.
2. self.is_chatting.
- We are running a user's input sentence to generate a response.
... | Run one step of the model, which can mean 1 of the following:
1. forward_only == False.
- This means we are training.
- We do a forward and a backward pass.
2. self.is_chatting.
- We are running a user's input sentence to generate a response.
... | [
"Run",
"one",
"step",
"of",
"the",
"model",
"which",
"can",
"mean",
"1",
"of",
"the",
"following",
":",
"1",
".",
"forward_only",
"==",
"False",
".",
"-",
"This",
"means",
"we",
"are",
"training",
".",
"-",
"We",
"do",
"a",
"forward",
"and",
"a",
"... | def step(self, forward_only=False):
"""Run one step of the model, which can mean 1 of the following:
1. forward_only == False.
- This means we are training.
- We do a forward and a backward pass.
2. self.is_chatting.
- We are running a user'... | [
"def",
"step",
"(",
"self",
",",
"forward_only",
"=",
"False",
")",
":",
"if",
"not",
"forward_only",
":",
"fetches",
"=",
"[",
"self",
".",
"merged",
",",
"self",
".",
"loss",
",",
"self",
".",
"train_op",
"]",
"summaries",
",",
"step_loss",
",",
"_... | https://github.com/mckinziebrandon/DeepChatModels/blob/4fef8a6ce00d92235a2fb0e427d2ec60833022d2/chatbot/dynamic_models.py#L210-L252 | ||
aws/aws-parallelcluster | f1fe5679a01c524e7ea904c329bd6d17318c6cd9 | cli/src/pcluster/api/models/describe_image_response_content.py | python | DescribeImageResponseContent.creation_time | (self) | return self._creation_time | Gets the creation_time of this DescribeImageResponseContent.
Timestamp representing the image creation time.
:return: The creation_time of this DescribeImageResponseContent.
:rtype: datetime | Gets the creation_time of this DescribeImageResponseContent. | [
"Gets",
"the",
"creation_time",
"of",
"this",
"DescribeImageResponseContent",
"."
] | def creation_time(self):
"""Gets the creation_time of this DescribeImageResponseContent.
Timestamp representing the image creation time.
:return: The creation_time of this DescribeImageResponseContent.
:rtype: datetime
"""
return self._creation_time | [
"def",
"creation_time",
"(",
"self",
")",
":",
"return",
"self",
".",
"_creation_time"
] | https://github.com/aws/aws-parallelcluster/blob/f1fe5679a01c524e7ea904c329bd6d17318c6cd9/cli/src/pcluster/api/models/describe_image_response_content.py#L265-L273 | |
HunterMcGushion/hyperparameter_hunter | 28b1d48e01a993818510811b82a677e0a7a232b2 | hyperparameter_hunter/utils/general_utils.py | python | to_snake_case | (s) | return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower() | Convert a string to snake-case format
Parameters
----------
s: String
String to convert to snake-case
Returns
-------
String
Snake-case formatted string
Notes
-----
Adapted from https://gist.github.com/jaytaylor/3660565
Examples
--------
>>> to_snake_c... | Convert a string to snake-case format | [
"Convert",
"a",
"string",
"to",
"snake",
"-",
"case",
"format"
] | def to_snake_case(s):
"""Convert a string to snake-case format
Parameters
----------
s: String
String to convert to snake-case
Returns
-------
String
Snake-case formatted string
Notes
-----
Adapted from https://gist.github.com/jaytaylor/3660565
Examples
... | [
"def",
"to_snake_case",
"(",
"s",
")",
":",
"s1",
"=",
"re",
".",
"sub",
"(",
"\"(.)([A-Z][a-z]+)\"",
",",
"r\"\\1_\\2\"",
",",
"s",
")",
"return",
"re",
".",
"sub",
"(",
"\"([a-z0-9])([A-Z])\"",
",",
"r\"\\1_\\2\"",
",",
"s1",
")",
".",
"lower",
"(",
... | https://github.com/HunterMcGushion/hyperparameter_hunter/blob/28b1d48e01a993818510811b82a677e0a7a232b2/hyperparameter_hunter/utils/general_utils.py#L111-L142 | |
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/datastore/datastore_pbs.py | python | _EntityConverter.__v1_integer_property | (self, entity, name, value, indexed) | Populates a single-integer-valued v1 Property.
Args:
entity: the entity to populate
name: the name of the property to populate
value: the integer value of the property
indexed: whether the value should be indexed | Populates a single-integer-valued v1 Property. | [
"Populates",
"a",
"single",
"-",
"integer",
"-",
"valued",
"v1",
"Property",
"."
] | def __v1_integer_property(self, entity, name, value, indexed):
"""Populates a single-integer-valued v1 Property.
Args:
entity: the entity to populate
name: the name of the property to populate
value: the integer value of the property
indexed: whether the value should be indexed
"""
... | [
"def",
"__v1_integer_property",
"(",
"self",
",",
"entity",
",",
"name",
",",
"value",
",",
"indexed",
")",
":",
"v1_value",
"=",
"entity",
".",
"properties",
"[",
"name",
"]",
"v1_value",
".",
"exclude_from_indexes",
"=",
"not",
"indexed",
"v1_value",
".",
... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/datastore/datastore_pbs.py#L1371-L1382 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/telnetlib.py | python | Telnet.__init__ | (self, host=None, port=0,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT) | Constructor.
When called without arguments, create an unconnected instance.
With a hostname argument, it connects the instance; port number
and timeout are optional. | Constructor. | [
"Constructor",
"."
] | def __init__(self, host=None, port=0,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
"""Constructor.
When called without arguments, create an unconnected instance.
With a hostname argument, it connects the instance; port number
and timeout are optional.
"""
se... | [
"def",
"__init__",
"(",
"self",
",",
"host",
"=",
"None",
",",
"port",
"=",
"0",
",",
"timeout",
"=",
"socket",
".",
"_GLOBAL_DEFAULT_TIMEOUT",
")",
":",
"self",
".",
"debuglevel",
"=",
"DEBUGLEVEL",
"self",
".",
"host",
"=",
"host",
"self",
".",
"port... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/telnetlib.py#L192-L215 | ||
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/contrib/gis/geoip2/base.py | python | GeoIP2.__init__ | (self, path=None, cache=0, country=None, city=None) | Initialize the GeoIP object. No parameters are required to use default
settings. Keyword arguments may be passed in to customize the locations
of the GeoIP datasets.
* path: Base directory to where GeoIP data is located or the full path
to where the city or country data files (*.mmd... | Initialize the GeoIP object. No parameters are required to use default
settings. Keyword arguments may be passed in to customize the locations
of the GeoIP datasets. | [
"Initialize",
"the",
"GeoIP",
"object",
".",
"No",
"parameters",
"are",
"required",
"to",
"use",
"default",
"settings",
".",
"Keyword",
"arguments",
"may",
"be",
"passed",
"in",
"to",
"customize",
"the",
"locations",
"of",
"the",
"GeoIP",
"datasets",
"."
] | def __init__(self, path=None, cache=0, country=None, city=None):
"""
Initialize the GeoIP object. No parameters are required to use default
settings. Keyword arguments may be passed in to customize the locations
of the GeoIP datasets.
* path: Base directory to where GeoIP data i... | [
"def",
"__init__",
"(",
"self",
",",
"path",
"=",
"None",
",",
"cache",
"=",
"0",
",",
"country",
"=",
"None",
",",
"city",
"=",
"None",
")",
":",
"# Checking the given cache option.",
"if",
"cache",
"in",
"self",
".",
"cache_options",
":",
"self",
".",
... | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/contrib/gis/geoip2/base.py#L46-L116 | ||
jazzband/django-axes | 3fbf7c55ece0f5bf3a9e699cb939f6981acf1375 | axes/helpers.py | python | is_client_ip_address_whitelisted | (request) | return False | Check if the given request refers to a whitelisted IP. | Check if the given request refers to a whitelisted IP. | [
"Check",
"if",
"the",
"given",
"request",
"refers",
"to",
"a",
"whitelisted",
"IP",
"."
] | def is_client_ip_address_whitelisted(request):
"""
Check if the given request refers to a whitelisted IP.
"""
if settings.AXES_NEVER_LOCKOUT_WHITELIST and is_ip_address_in_whitelist(
request.axes_ip_address
):
return True
if settings.AXES_ONLY_WHITELIST and is_ip_address_in_whi... | [
"def",
"is_client_ip_address_whitelisted",
"(",
"request",
")",
":",
"if",
"settings",
".",
"AXES_NEVER_LOCKOUT_WHITELIST",
"and",
"is_ip_address_in_whitelist",
"(",
"request",
".",
"axes_ip_address",
")",
":",
"return",
"True",
"if",
"settings",
".",
"AXES_ONLY_WHITELI... | https://github.com/jazzband/django-axes/blob/3fbf7c55ece0f5bf3a9e699cb939f6981acf1375/axes/helpers.py#L433-L448 | |
binaryage/drydrop | 2f27e15befd247255d89f9120eeee44851b82c4a | dryapp/pygments/scanner.py | python | Scanner.scan | (self, pattern) | return True | Scan the text for the given pattern and update pos/match
and related fields. The return value is a boolen that
indicates if the pattern matched. The matched value is
stored on the instance as ``match``, the last value is
stored as ``last``. ``start_pos`` is the position of the
po... | Scan the text for the given pattern and update pos/match
and related fields. The return value is a boolen that
indicates if the pattern matched. The matched value is
stored on the instance as ``match``, the last value is
stored as ``last``. ``start_pos`` is the position of the
po... | [
"Scan",
"the",
"text",
"for",
"the",
"given",
"pattern",
"and",
"update",
"pos",
"/",
"match",
"and",
"related",
"fields",
".",
"The",
"return",
"value",
"is",
"a",
"boolen",
"that",
"indicates",
"if",
"the",
"pattern",
"matched",
".",
"The",
"matched",
... | def scan(self, pattern):
"""
Scan the text for the given pattern and update pos/match
and related fields. The return value is a boolen that
indicates if the pattern matched. The matched value is
stored on the instance as ``match``, the last value is
stored as ``last``. ``... | [
"def",
"scan",
"(",
"self",
",",
"pattern",
")",
":",
"if",
"self",
".",
"eos",
":",
"raise",
"EndOfText",
"(",
")",
"if",
"pattern",
"not",
"in",
"self",
".",
"_re_cache",
":",
"self",
".",
"_re_cache",
"[",
"pattern",
"]",
"=",
"re",
".",
"compil... | https://github.com/binaryage/drydrop/blob/2f27e15befd247255d89f9120eeee44851b82c4a/dryapp/pygments/scanner.py#L72-L93 | |
mdn/django-locallibrary-tutorial | 10c2d6a1bef68bc2c0e83f3d3d71d437148ed06e | catalog/models.py | python | Book.get_absolute_url | (self) | return reverse('book-detail', args=[str(self.id)]) | Returns the url to access a particular book instance. | Returns the url to access a particular book instance. | [
"Returns",
"the",
"url",
"to",
"access",
"a",
"particular",
"book",
"instance",
"."
] | def get_absolute_url(self):
"""Returns the url to access a particular book instance."""
return reverse('book-detail', args=[str(self.id)]) | [
"def",
"get_absolute_url",
"(",
"self",
")",
":",
"return",
"reverse",
"(",
"'book-detail'",
",",
"args",
"=",
"[",
"str",
"(",
"self",
".",
"id",
")",
"]",
")"
] | https://github.com/mdn/django-locallibrary-tutorial/blob/10c2d6a1bef68bc2c0e83f3d3d71d437148ed06e/catalog/models.py#L55-L57 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/controller_service_referencing_component_dto.py | python | ControllerServiceReferencingComponentDTO.__eq__ | (self, other) | return self.__dict__ == other.__dict__ | Returns true if both objects are equal | Returns true if both objects are equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"equal"
] | def __eq__(self, other):
"""
Returns true if both objects are equal
"""
if not isinstance(other, ControllerServiceReferencingComponentDTO):
return False
return self.__dict__ == other.__dict__ | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ControllerServiceReferencingComponentDTO",
")",
":",
"return",
"False",
"return",
"self",
".",
"__dict__",
"==",
"other",
".",
"__dict__"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/controller_service_referencing_component_dto.py#L426-L433 | |
ansible/galaxy | e0e4b909171ddc6ca40f0ef2f7d4dce5680777ce | galaxy/api/githubapi.py | python | GithubAPI.user_namespaces | (self) | return result | Return a list of user namespaces | Return a list of user namespaces | [
"Return",
"a",
"list",
"of",
"user",
"namespaces"
] | def user_namespaces(self):
""" Return a list of user namespaces """
result = []
try:
gh_user = self.client.get_user()
source = {
'name': gh_user.login,
'description': gh_user.bio,
'provider': self.provider_name.lower(),
... | [
"def",
"user_namespaces",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"try",
":",
"gh_user",
"=",
"self",
".",
"client",
".",
"get_user",
"(",
")",
"source",
"=",
"{",
"'name'",
":",
"gh_user",
".",
"login",
",",
"'description'",
":",
"gh_user",
... | https://github.com/ansible/galaxy/blob/e0e4b909171ddc6ca40f0ef2f7d4dce5680777ce/galaxy/api/githubapi.py#L67-L105 | |
mit-han-lab/data-efficient-gans | 6858275f08f43a33026844c8c2ac4e703e8a07ba | DiffAugment-biggan-cifar/layers.py | python | SNLinear.forward | (self, x) | return F.linear(x, self.W_(), self.bias) | [] | def forward(self, x):
return F.linear(x, self.W_(), self.bias) | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"return",
"F",
".",
"linear",
"(",
"x",
",",
"self",
".",
"W_",
"(",
")",
",",
"self",
".",
"bias",
")"
] | https://github.com/mit-han-lab/data-efficient-gans/blob/6858275f08f43a33026844c8c2ac4e703e8a07ba/DiffAugment-biggan-cifar/layers.py#L122-L123 | |||
jeffball55/rop_compiler | 27cfba9149a7d854425b5c42c7f383a22be72b49 | pyrop/rop_compiler/enum.py | python | BitmaskEnum.is_set | (cls, bitmask, bit) | return (bitmask & (1 << bit)) != 0 | Tests if a particular bit is set in a bitmask | Tests if a particular bit is set in a bitmask | [
"Tests",
"if",
"a",
"particular",
"bit",
"is",
"set",
"in",
"a",
"bitmask"
] | def is_set(cls, bitmask, bit):
"""Tests if a particular bit is set in a bitmask"""
return (bitmask & (1 << bit)) != 0 | [
"def",
"is_set",
"(",
"cls",
",",
"bitmask",
",",
"bit",
")",
":",
"return",
"(",
"bitmask",
"&",
"(",
"1",
"<<",
"bit",
")",
")",
"!=",
"0"
] | https://github.com/jeffball55/rop_compiler/blob/27cfba9149a7d854425b5c42c7f383a22be72b49/pyrop/rop_compiler/enum.py#L107-L109 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pandas/core/frame.py | python | DataFrame.transpose | (self, *args, **kwargs) | return super(DataFrame, self).transpose(1, 0, **kwargs) | Transpose index and columns | Transpose index and columns | [
"Transpose",
"index",
"and",
"columns"
] | def transpose(self, *args, **kwargs):
"""Transpose index and columns"""
nv.validate_transpose(args, dict())
return super(DataFrame, self).transpose(1, 0, **kwargs) | [
"def",
"transpose",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nv",
".",
"validate_transpose",
"(",
"args",
",",
"dict",
"(",
")",
")",
"return",
"super",
"(",
"DataFrame",
",",
"self",
")",
".",
"transpose",
"(",
"1",
",",
... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/core/frame.py#L1835-L1838 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/preview/understand/assistant/field_type/field_value.py | python | FieldValueInstance.field_type_sid | (self) | return self._properties['field_type_sid'] | :returns: The unique ID of the Field Type associated with this Field Value.
:rtype: unicode | :returns: The unique ID of the Field Type associated with this Field Value.
:rtype: unicode | [
":",
"returns",
":",
"The",
"unique",
"ID",
"of",
"the",
"Field",
"Type",
"associated",
"with",
"this",
"Field",
"Value",
".",
":",
"rtype",
":",
"unicode"
] | def field_type_sid(self):
"""
:returns: The unique ID of the Field Type associated with this Field Value.
:rtype: unicode
"""
return self._properties['field_type_sid'] | [
"def",
"field_type_sid",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'field_type_sid'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/understand/assistant/field_type/field_value.py#L375-L380 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_openshift_3.2/library/oadm_registry.py | python | Utils.find_result | (results, _name) | return rval | Find the specified result by name | Find the specified result by name | [
"Find",
"the",
"specified",
"result",
"by",
"name"
] | def find_result(results, _name):
''' Find the specified result by name'''
rval = None
for result in results:
if result.has_key('metadata') and result['metadata']['name'] == _name:
rval = result
break
return rval | [
"def",
"find_result",
"(",
"results",
",",
"_name",
")",
":",
"rval",
"=",
"None",
"for",
"result",
"in",
"results",
":",
"if",
"result",
".",
"has_key",
"(",
"'metadata'",
")",
"and",
"result",
"[",
"'metadata'",
"]",
"[",
"'name'",
"]",
"==",
"_name"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oadm_registry.py#L334-L342 | |
bdcht/amoco | dac8e00b862eb6d87cc88dddd1e5316c67c1d798 | amoco/cas/expressions.py | python | exp.zeroextend | (self, size) | return self.extend(False, size) | zero extend expression to given size | zero extend expression to given size | [
"zero",
"extend",
"expression",
"to",
"given",
"size"
] | def zeroextend(self, size):
"zero extend expression to given size"
return self.extend(False, size) | [
"def",
"zeroextend",
"(",
"self",
",",
"size",
")",
":",
"return",
"self",
".",
"extend",
"(",
"False",
",",
"size",
")"
] | https://github.com/bdcht/amoco/blob/dac8e00b862eb6d87cc88dddd1e5316c67c1d798/amoco/cas/expressions.py#L248-L250 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/unifi/sensor.py | python | UniFiBandwidthSensor.name | (self) | return f"{super().name} {self.TYPE.upper()}" | Return the name of the client. | Return the name of the client. | [
"Return",
"the",
"name",
"of",
"the",
"client",
"."
] | def name(self) -> str:
"""Return the name of the client."""
return f"{super().name} {self.TYPE.upper()}" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{super().name} {self.TYPE.upper()}\""
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/unifi/sensor.py#L99-L101 | |
Zulko/picnic.py | 80be50fedc7288def69879c2bc050a7038a3fa4f | picnic/picnic.py | python | copy_file | (name,dst = None, replace=None) | Copy a file in the files/ subfolder at the given destination
(see usage below) and change some stuff in the file
name: file or path to file. The file copied will be files/name
dst: name of the destination file (relative to working dir)
changes: a dict of what to replace in the file, e.g.
{ ... | Copy a file in the files/ subfolder at the given destination
(see usage below) and change some stuff in the file
name: file or path to file. The file copied will be files/name
dst: name of the destination file (relative to working dir)
changes: a dict of what to replace in the file, e.g.
{ ... | [
"Copy",
"a",
"file",
"in",
"the",
"files",
"/",
"subfolder",
"at",
"the",
"given",
"destination",
"(",
"see",
"usage",
"below",
")",
"and",
"change",
"some",
"stuff",
"in",
"the",
"file",
"name",
":",
"file",
"or",
"path",
"to",
"file",
".",
"The",
"... | def copy_file(name,dst = None, replace=None):
"""
Copy a file in the files/ subfolder at the given destination
(see usage below) and change some stuff in the file
name: file or path to file. The file copied will be files/name
dst: name of the destination file (relative to working dir)
chang... | [
"def",
"copy_file",
"(",
"name",
",",
"dst",
"=",
"None",
",",
"replace",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"list",
")",
":",
"name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"*",
"name",
")",
"if",
"isinstance",
"(",
... | https://github.com/Zulko/picnic.py/blob/80be50fedc7288def69879c2bc050a7038a3fa4f/picnic/picnic.py#L38-L62 | ||
wummel/linkchecker | c2ce810c3fb00b895a841a7be6b2e78c64e7b042 | third_party/dnspython/dns/rdtypes/ANY/NSEC.py | python | NSEC.choose_relativity | (self, origin = None, relativize = True) | [] | def choose_relativity(self, origin = None, relativize = True):
self.next = self.next.choose_relativity(origin, relativize) | [
"def",
"choose_relativity",
"(",
"self",
",",
"origin",
"=",
"None",
",",
"relativize",
"=",
"True",
")",
":",
"self",
".",
"next",
"=",
"self",
".",
"next",
".",
"choose_relativity",
"(",
"origin",
",",
"relativize",
")"
] | https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/rdtypes/ANY/NSEC.py#L124-L125 | ||||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/distutils/msvc9compiler.py | python | normalize_and_reduce_paths | (paths) | return reduced_paths | Return a list of normalized paths with duplicates removed.
The current order of paths is maintained. | Return a list of normalized paths with duplicates removed. | [
"Return",
"a",
"list",
"of",
"normalized",
"paths",
"with",
"duplicates",
"removed",
"."
] | def normalize_and_reduce_paths(paths):
"""Return a list of normalized paths with duplicates removed.
The current order of paths is maintained.
"""
# Paths are normalized so things like: /a and /a/ aren't both preserved.
reduced_paths = []
for p in paths:
np = os.path.normpath(p)
... | [
"def",
"normalize_and_reduce_paths",
"(",
"paths",
")",
":",
"# Paths are normalized so things like: /a and /a/ aren't both preserved.",
"reduced_paths",
"=",
"[",
"]",
"for",
"p",
"in",
"paths",
":",
"np",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"p",
")",
... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/distutils/msvc9compiler.py#L192-L204 | |
JimmXinu/FanFicFare | bc149a2deb2636320fe50a3e374af6eef8f61889 | included_dependencies/brotlidecpy/decode.py | python | MetaBlockLength.__init__ | (self) | [] | def __init__(self):
self.meta_block_length = 0
self.input_end = 0
self.is_uncompressed = 0
self.is_metadata = False | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"meta_block_length",
"=",
"0",
"self",
".",
"input_end",
"=",
"0",
"self",
".",
"is_uncompressed",
"=",
"0",
"self",
".",
"is_metadata",
"=",
"False"
] | https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/brotlidecpy/decode.py#L60-L64 | ||||
mbeyeler/opencv-python-blueprints | 15d7c3d7a06703caee74c5590f76c81b9345acbc | chapter3/chapter3.py | python | FeatureMatchingLayout._init_custom_layout | (self) | Initializes feature matching class | Initializes feature matching class | [
"Initializes",
"feature",
"matching",
"class"
] | def _init_custom_layout(self):
"""Initializes feature matching class"""
self.matching = FeatureMatching(train_image='salinger.jpg') | [
"def",
"_init_custom_layout",
"(",
"self",
")",
":",
"self",
".",
"matching",
"=",
"FeatureMatching",
"(",
"train_image",
"=",
"'salinger.jpg'",
")"
] | https://github.com/mbeyeler/opencv-python-blueprints/blob/15d7c3d7a06703caee74c5590f76c81b9345acbc/chapter3/chapter3.py#L27-L29 | ||
mathics/Mathics | 318e06dea8f1c70758a50cb2f95c9900150e3a68 | mathics/session.py | python | set_settings_value | (definitions: Definitions, setting_name: str, value) | return definitions.set_ownvalue(setting_name, value) | Set a Mathics Settings` with name "setting_name" from definitions to value
"value". | Set a Mathics Settings` with name "setting_name" from definitions to value
"value". | [
"Set",
"a",
"Mathics",
"Settings",
"with",
"name",
"setting_name",
"from",
"definitions",
"to",
"value",
"value",
"."
] | def set_settings_value(definitions: Definitions, setting_name: str, value):
"""Set a Mathics Settings` with name "setting_name" from definitions to value
"value".
"""
return definitions.set_ownvalue(setting_name, value) | [
"def",
"set_settings_value",
"(",
"definitions",
":",
"Definitions",
",",
"setting_name",
":",
"str",
",",
"value",
")",
":",
"return",
"definitions",
".",
"set_ownvalue",
"(",
"setting_name",
",",
"value",
")"
] | https://github.com/mathics/Mathics/blob/318e06dea8f1c70758a50cb2f95c9900150e3a68/mathics/session.py#L43-L47 | |
ConsenSys/mythril | d00152f8e4d925c7749d63b533152a937e1dd516 | mythril/analysis/module/modules/arbitrary_jump.py | python | ArbitraryJump.reset_module | (self) | Resets the module by clearing everything
:return: | Resets the module by clearing everything
:return: | [
"Resets",
"the",
"module",
"by",
"clearing",
"everything",
":",
"return",
":"
] | def reset_module(self):
"""
Resets the module by clearing everything
:return:
"""
super().reset_module() | [
"def",
"reset_module",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"reset_module",
"(",
")"
] | https://github.com/ConsenSys/mythril/blob/d00152f8e4d925c7749d63b533152a937e1dd516/mythril/analysis/module/modules/arbitrary_jump.py#L25-L30 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/TrendMicroDeepSecurity/Integrations/TrendMicroDeepSecurity/TrendMicroDeepSecurity.py | python | modify_policy_command | (client: Client, policy_id: int, overrides: bool, name: Optional[str],
parent_id: Optional[int], description: Optional[str], recommendation_scan_mode: Optional[str],
auto_requires_update: Optional[str]) | return CommandResults(outputs_prefix="TrendMicro.Policies", outputs_key_field="ID", outputs=response,
readable_output=markdown, raw_response=response) | Modify a certain policy.
Args:
client (Client): The Trend Micro API client.
policy_id (int): The ID of the policy to modify.
overrides (bool): Show only overrides defined for the current policy.
name (Optional[str]): The name of the policy.
parent_id (Optional[int]): The ID ... | Modify a certain policy. | [
"Modify",
"a",
"certain",
"policy",
"."
] | def modify_policy_command(client: Client, policy_id: int, overrides: bool, name: Optional[str],
parent_id: Optional[int], description: Optional[str], recommendation_scan_mode: Optional[str],
auto_requires_update: Optional[str]) -> CommandResults:
"""
Modify a ... | [
"def",
"modify_policy_command",
"(",
"client",
":",
"Client",
",",
"policy_id",
":",
"int",
",",
"overrides",
":",
"bool",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
",",
"parent_id",
":",
"Optional",
"[",
"int",
"]",
",",
"description",
":",
"Option... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/TrendMicroDeepSecurity/Integrations/TrendMicroDeepSecurity/TrendMicroDeepSecurity.py#L1485-L1512 | |
MarioVilas/winappdbg | 975a088ac54253d0bdef39fe831e82f24b4c11f6 | winappdbg/interactive.py | python | ConsoleDebugger.do_bl | (self, arg) | bl - list the breakpoints for the current process
bl * - list the breakpoints for all processes
[~process] bl - list the breakpoints for the given process
bl <process> [process...] - list the breakpoints for each given process | bl - list the breakpoints for the current process
bl * - list the breakpoints for all processes
[~process] bl - list the breakpoints for the given process
bl <process> [process...] - list the breakpoints for each given process | [
"bl",
"-",
"list",
"the",
"breakpoints",
"for",
"the",
"current",
"process",
"bl",
"*",
"-",
"list",
"the",
"breakpoints",
"for",
"all",
"processes",
"[",
"~process",
"]",
"bl",
"-",
"list",
"the",
"breakpoints",
"for",
"the",
"given",
"process",
"bl",
"... | def do_bl(self, arg):
"""
bl - list the breakpoints for the current process
bl * - list the breakpoints for all processes
[~process] bl - list the breakpoints for the given process
bl <process> [process...] - list the breakpoints for each given process
"""
debug =... | [
"def",
"do_bl",
"(",
"self",
",",
"arg",
")",
":",
"debug",
"=",
"self",
".",
"debug",
"if",
"arg",
"==",
"'*'",
":",
"if",
"self",
".",
"cmdprefix",
":",
"raise",
"CmdError",
"(",
"\"prefix not supported\"",
")",
"targets",
"=",
"debug",
".",
"get_deb... | https://github.com/MarioVilas/winappdbg/blob/975a088ac54253d0bdef39fe831e82f24b4c11f6/winappdbg/interactive.py#L1658-L1716 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/treeview/qt4_gui.py | python | _GUI.on_actionShow_newick_triggered | (self) | [] | def on_actionShow_newick_triggered(self):
d = NewickDialog(self.scene.tree)
d._conf = _show_newick.Ui_Newick()
d._conf.setupUi(d)
d.update_newick()
d.exec_() | [
"def",
"on_actionShow_newick_triggered",
"(",
"self",
")",
":",
"d",
"=",
"NewickDialog",
"(",
"self",
".",
"scene",
".",
"tree",
")",
"d",
".",
"_conf",
"=",
"_show_newick",
".",
"Ui_Newick",
"(",
")",
"d",
".",
"_conf",
".",
"setupUi",
"(",
"d",
")",... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/treeview/qt4_gui.py#L329-L334 | ||||
ShuangXieIrene/ssds.pytorch | b5ec682a42c923afe964205b21448e9f141d55bc | ssds/modeling/nets/regnet.py | python | RegNetX016 | (outputs, **kwargs) | return model | s1-4: {72, 168, 408, 912} | s1-4: {72, 168, 408, 912} | [
"s1",
"-",
"4",
":",
"{",
"72",
"168",
"408",
"912",
"}"
] | def RegNetX016(outputs, **kwargs):
""" s1-4: {72, 168, 408, 912} """
model = RegNet(
w_a=34.01,
w_0=80,
w_m=2.25,
d=18,
group_w=24,
bot_mul=1,
outputs=outputs,
url=base_url + model_urls["RegNetX016"],
**kwargs
)
return model | [
"def",
"RegNetX016",
"(",
"outputs",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"RegNet",
"(",
"w_a",
"=",
"34.01",
",",
"w_0",
"=",
"80",
",",
"w_m",
"=",
"2.25",
",",
"d",
"=",
"18",
",",
"group_w",
"=",
"24",
",",
"bot_mul",
"=",
"1",
... | https://github.com/ShuangXieIrene/ssds.pytorch/blob/b5ec682a42c923afe964205b21448e9f141d55bc/ssds/modeling/nets/regnet.py#L371-L384 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/crystals/fully_commutative_stable_grothendieck.py | python | _check_decreasing_hecke_factorization | (t) | Check if ``t`` is a suitable data type for a decreasing factorization in a 0-Hecke monoid.
EXAMPLES::
sage: from sage.combinat.crystals.fully_commutative_stable_grothendieck import _check_decreasing_hecke_factorization
sage: _check_decreasing_hecke_factorization([[3, 2], [2, 1], [4]])
sage... | Check if ``t`` is a suitable data type for a decreasing factorization in a 0-Hecke monoid. | [
"Check",
"if",
"t",
"is",
"a",
"suitable",
"data",
"type",
"for",
"a",
"decreasing",
"factorization",
"in",
"a",
"0",
"-",
"Hecke",
"monoid",
"."
] | def _check_decreasing_hecke_factorization(t):
"""
Check if ``t`` is a suitable data type for a decreasing factorization in a 0-Hecke monoid.
EXAMPLES::
sage: from sage.combinat.crystals.fully_commutative_stable_grothendieck import _check_decreasing_hecke_factorization
sage: _check_decreasi... | [
"def",
"_check_decreasing_hecke_factorization",
"(",
"t",
")",
":",
"if",
"not",
"isinstance",
"(",
"t",
",",
"DecreasingHeckeFactorization",
")",
":",
"if",
"not",
"isinstance",
"(",
"t",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"raise",
"ValueError",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/crystals/fully_commutative_stable_grothendieck.py#L746-L777 | ||
censys/censys-python | 9528f6b600215e59e1762bbe65216437c859f877 | censys/asm/clouds.py | python | format_since_date | (since: Since) | return since | Formats since date as ISO 8601 format.
Args:
since (Since): Date.
Returns:
str: ISO 8601 formatted date string. | Formats since date as ISO 8601 format. | [
"Formats",
"since",
"date",
"as",
"ISO",
"8601",
"format",
"."
] | def format_since_date(since: Since) -> str:
"""Formats since date as ISO 8601 format.
Args:
since (Since): Date.
Returns:
str: ISO 8601 formatted date string.
"""
if isinstance(since, (datetime.date, datetime.datetime)):
return since.strftime("%Y-%m-%d")
return since | [
"def",
"format_since_date",
"(",
"since",
":",
"Since",
")",
"->",
"str",
":",
"if",
"isinstance",
"(",
"since",
",",
"(",
"datetime",
".",
"date",
",",
"datetime",
".",
"datetime",
")",
")",
":",
"return",
"since",
".",
"strftime",
"(",
"\"%Y-%m-%d\"",
... | https://github.com/censys/censys-python/blob/9528f6b600215e59e1762bbe65216437c859f877/censys/asm/clouds.py#L10-L21 | |
manubot/manubot | 7a2a2df1a803420a15d9aeac712c6640a8b6b388 | manubot/cite/csl_item.py | python | CSL_Item.set_date | (
self,
date: Union[None, str, datetime.date, datetime.datetime],
variable: str = "issued",
) | return self | date: date either as a string (in the form YYYY, YYYY-MM, or YYYY-MM-DD)
or as a Python date object (datetime.date or datetime.datetime).
variable: which variable to assign the date to. | date: date either as a string (in the form YYYY, YYYY-MM, or YYYY-MM-DD)
or as a Python date object (datetime.date or datetime.datetime).
variable: which variable to assign the date to. | [
"date",
":",
"date",
"either",
"as",
"a",
"string",
"(",
"in",
"the",
"form",
"YYYY",
"YYYY",
"-",
"MM",
"or",
"YYYY",
"-",
"MM",
"-",
"DD",
")",
"or",
"as",
"a",
"Python",
"date",
"object",
"(",
"datetime",
".",
"date",
"or",
"datetime",
".",
"d... | def set_date(
self,
date: Union[None, str, datetime.date, datetime.datetime],
variable: str = "issued",
) -> "CSL_Item":
"""
date: date either as a string (in the form YYYY, YYYY-MM, or YYYY-MM-DD)
or as a Python date object (datetime.date or datetime.datetime).
... | [
"def",
"set_date",
"(",
"self",
",",
"date",
":",
"Union",
"[",
"None",
",",
"str",
",",
"datetime",
".",
"date",
",",
"datetime",
".",
"datetime",
"]",
",",
"variable",
":",
"str",
"=",
"\"issued\"",
",",
")",
"->",
"\"CSL_Item\"",
":",
"date_parts",
... | https://github.com/manubot/manubot/blob/7a2a2df1a803420a15d9aeac712c6640a8b6b388/manubot/cite/csl_item.py#L153-L166 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/sunburst/_domain.py | python | Domain.row | (self) | return self["row"] | If there is a layout grid, use the domain for this row in the
grid for this sunburst trace .
The 'row' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
... | If there is a layout grid, use the domain for this row in the
grid for this sunburst trace .
The 'row' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807] | [
"If",
"there",
"is",
"a",
"layout",
"grid",
"use",
"the",
"domain",
"for",
"this",
"row",
"in",
"the",
"grid",
"for",
"this",
"sunburst",
"trace",
".",
"The",
"row",
"property",
"is",
"a",
"integer",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"... | def row(self):
"""
If there is a layout grid, use the domain for this row in the
grid for this sunburst trace .
The 'row' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
... | [
"def",
"row",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"row\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/sunburst/_domain.py#L38-L51 | |
Ericsson/codechecker | c4e43f62dc3acbf71d3109b337db7c97f7852f43 | analyzer/codechecker_analyzer/analysis_manager.py | python | prepare_check | (action, analyzer_config, output_dir, checker_labels,
skip_handler, statistics_data, disable_ctu=False) | return source_analyzer, rh | Construct the source analyzer and result handler. | Construct the source analyzer and result handler. | [
"Construct",
"the",
"source",
"analyzer",
"and",
"result",
"handler",
"."
] | def prepare_check(action, analyzer_config, output_dir, checker_labels,
skip_handler, statistics_data, disable_ctu=False):
""" Construct the source analyzer and result handler. """
# Create a source analyzer.
source_analyzer = \
analyzer_types.construct_analyzer(action,
... | [
"def",
"prepare_check",
"(",
"action",
",",
"analyzer_config",
",",
"output_dir",
",",
"checker_labels",
",",
"skip_handler",
",",
"statistics_data",
",",
"disable_ctu",
"=",
"False",
")",
":",
"# Create a source analyzer.",
"source_analyzer",
"=",
"analyzer_types",
"... | https://github.com/Ericsson/codechecker/blob/c4e43f62dc3acbf71d3109b337db7c97f7852f43/analyzer/codechecker_analyzer/analysis_manager.py#L171-L220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.