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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
usnistgov/fipy | 6809b180b41a11de988a48655575df7e142c93b9 | fipy/meshes/topologies/gridTopology.py | python | _Grid1DTopology._localOverlappingFaceIDs | (self) | return numerix.arange(0, self.mesh.numberOfFaces) | Return the IDs of the local mesh in isolation.
Includes the IDs of faces of boundary cells.
E.g., would return [0, 1, 2, 3] for mesh A
```
A || B
------------------
0 1 2 3 |
------------------
```
.. note:: Trivial except for ... | Return the IDs of the local mesh in isolation. | [
"Return",
"the",
"IDs",
"of",
"the",
"local",
"mesh",
"in",
"isolation",
"."
] | def _localOverlappingFaceIDs(self):
"""Return the IDs of the local mesh in isolation.
Includes the IDs of faces of boundary cells.
E.g., would return [0, 1, 2, 3] for mesh A
```
A || B
------------------
0 1 2 3 |
------------------
... | [
"def",
"_localOverlappingFaceIDs",
"(",
"self",
")",
":",
"return",
"numerix",
".",
"arange",
"(",
"0",
",",
"self",
".",
"mesh",
".",
"numberOfFaces",
")"
] | https://github.com/usnistgov/fipy/blob/6809b180b41a11de988a48655575df7e142c93b9/fipy/meshes/topologies/gridTopology.py#L163-L179 | |
YosefLab/scvi-tools | f0a3ba6e11053069fd1857d2381083e5492fa8b8 | scvi/data/_datasets.py | python | annotation_simulation | (
name: str, save_path: str = "data/", run_setup_anndata: bool = True
) | return _load_annotation_simulation(
name=name, save_path=save_path, run_setup_anndata=run_setup_anndata
) | Simulated datasets for scANVI tutorials.
Parameters
----------
name
One of "1", "2", or "3"
save_path
Location to use when saving/loading the data.
run_setup_anndata
If true, runs setup_anndata() on dataset before returning
Returns
-------
AnnData with batch inf... | Simulated datasets for scANVI tutorials. | [
"Simulated",
"datasets",
"for",
"scANVI",
"tutorials",
"."
] | def annotation_simulation(
name: str, save_path: str = "data/", run_setup_anndata: bool = True
) -> anndata.AnnData:
"""
Simulated datasets for scANVI tutorials.
Parameters
----------
name
One of "1", "2", or "3"
save_path
Location to use when saving/loading the data.
ru... | [
"def",
"annotation_simulation",
"(",
"name",
":",
"str",
",",
"save_path",
":",
"str",
"=",
"\"data/\"",
",",
"run_setup_anndata",
":",
"bool",
"=",
"True",
")",
"->",
"anndata",
".",
"AnnData",
":",
"return",
"_load_annotation_simulation",
"(",
"name",
"=",
... | https://github.com/YosefLab/scvi-tools/blob/f0a3ba6e11053069fd1857d2381083e5492fa8b8/scvi/data/_datasets.py#L319-L346 | |
uuvsimulator/uuv_simulator | bfb40cb153684a0703173117b6bbf4258e8e71c5 | tools/cpplint.py | python | CheckSectionSpacing | (filename, clean_lines, class_info, linenum, error) | Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
class_info: A _ClassInfo objects.
linenum: The number ... | Checks for additional blank line issues related to sections. | [
"Checks",
"for",
"additional",
"blank",
"line",
"issues",
"related",
"to",
"sections",
"."
] | def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
"""Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance co... | [
"def",
"CheckSectionSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"class_info",
",",
"linenum",
",",
"error",
")",
":",
"# Skip checks if the class is small, where small means 25 lines or less.",
"# 25 lines seems like a good cutoff since that's the usual height of",
"# termina... | https://github.com/uuvsimulator/uuv_simulator/blob/bfb40cb153684a0703173117b6bbf4258e8e71c5/tools/cpplint.py#L1904-L1953 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/Optimize.py | python | OptimizeBuiltinCalls._handle_simple_method_dict_setdefault | (self, node, function, args, is_unbound_method) | return self._substitute_method_call(
node, function,
"__Pyx_PyDict_SetDefault", self.Pyx_PyDict_SetDefault_func_type,
'setdefault', is_unbound_method, args,
may_return_none=True,
utility_code=load_c_utility('dict_setdefault')) | Replace dict.setdefault() by calls to PyDict_GetItem() and PyDict_SetItem(). | Replace dict.setdefault() by calls to PyDict_GetItem() and PyDict_SetItem(). | [
"Replace",
"dict",
".",
"setdefault",
"()",
"by",
"calls",
"to",
"PyDict_GetItem",
"()",
"and",
"PyDict_SetItem",
"()",
"."
] | def _handle_simple_method_dict_setdefault(self, node, function, args, is_unbound_method):
"""Replace dict.setdefault() by calls to PyDict_GetItem() and PyDict_SetItem().
"""
if len(args) == 2:
args.append(ExprNodes.NoneNode(node.pos))
elif len(args) != 3:
self._er... | [
"def",
"_handle_simple_method_dict_setdefault",
"(",
"self",
",",
"node",
",",
"function",
",",
"args",
",",
"is_unbound_method",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"2",
":",
"args",
".",
"append",
"(",
"ExprNodes",
".",
"NoneNode",
"(",
"node"... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/Optimize.py#L2800-L2824 | |
cisco/mindmeld | 809c36112e9ea8019fe29d54d136ca14eb4fd8db | examples/custom_action/example_server/swagger_server/models/responder.py | python | Responder.params | (self, params: Params) | Sets the params of this Responder.
:param params: The params of this Responder.
:type params: Params | Sets the params of this Responder. | [
"Sets",
"the",
"params",
"of",
"this",
"Responder",
"."
] | def params(self, params: Params):
"""Sets the params of this Responder.
:param params: The params of this Responder.
:type params: Params
"""
self._params = params | [
"def",
"params",
"(",
"self",
",",
"params",
":",
"Params",
")",
":",
"self",
".",
"_params",
"=",
"params"
] | https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/examples/custom_action/example_server/swagger_server/models/responder.py#L123-L131 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.5/django/db/models/sql/subqueries.py | python | UpdateQuery.add_update_fields | (self, values_seq) | Turn a sequence of (field, model, value) triples into an update query.
Used by add_update_values() as well as the "fast" update path when
saving models. | Turn a sequence of (field, model, value) triples into an update query.
Used by add_update_values() as well as the "fast" update path when
saving models. | [
"Turn",
"a",
"sequence",
"of",
"(",
"field",
"model",
"value",
")",
"triples",
"into",
"an",
"update",
"query",
".",
"Used",
"by",
"add_update_values",
"()",
"as",
"well",
"as",
"the",
"fast",
"update",
"path",
"when",
"saving",
"models",
"."
] | def add_update_fields(self, values_seq):
"""
Turn a sequence of (field, model, value) triples into an update query.
Used by add_update_values() as well as the "fast" update path when
saving models.
"""
# Check that no Promise object passes to the query. Refs #10498.
... | [
"def",
"add_update_fields",
"(",
"self",
",",
"values_seq",
")",
":",
"# Check that no Promise object passes to the query. Refs #10498.",
"values_seq",
"=",
"[",
"(",
"value",
"[",
"0",
"]",
",",
"value",
"[",
"1",
"]",
",",
"force_text",
"(",
"value",
"[",
"2",... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/db/models/sql/subqueries.py#L140-L150 | ||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/swift/swift/common/middleware/formpost.py | python | FormPost._perform_subrequest | (self, orig_env, attributes, fp, key) | return substatus[0], '' | Performs the subrequest and returns the response.
:param orig_env: The WSGI environment dict; will only be used
to form a new env for the subrequest.
:param attributes: dict of the attributes of the form so far.
:param fp: The file-like object containing the request bod... | Performs the subrequest and returns the response. | [
"Performs",
"the",
"subrequest",
"and",
"returns",
"the",
"response",
"."
] | def _perform_subrequest(self, orig_env, attributes, fp, key):
"""
Performs the subrequest and returns the response.
:param orig_env: The WSGI environment dict; will only be used
to form a new env for the subrequest.
:param attributes: dict of the attributes of t... | [
"def",
"_perform_subrequest",
"(",
"self",
",",
"orig_env",
",",
"attributes",
",",
"fp",
",",
"key",
")",
":",
"if",
"not",
"key",
":",
"return",
"'401 Unauthorized'",
",",
"'invalid signature'",
"try",
":",
"max_file_size",
"=",
"int",
"(",
"attributes",
"... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/swift/swift/common/middleware/formpost.py#L399-L456 | |
dmishin/tsp-solver | e743b7c3b225cdd279fb9f906422b056e713fb5f | tsp_solver/demo/numpy2svg.py | python | Palette.at | (self, pos) | return clr_i(0), clr_i(1), clr_i(2) | Returns tuple of 3 integers. Pos is position in the palette, from 0 to 1 | Returns tuple of 3 integers. Pos is position in the palette, from 0 to 1 | [
"Returns",
"tuple",
"of",
"3",
"integers",
".",
"Pos",
"is",
"position",
"in",
"the",
"palette",
"from",
"0",
"to",
"1"
] | def at(self, pos):
"""Returns tuple of 3 integers. Pos is position in the palette, from 0 to 1"""
def clr_i( i ):
return round(np.interp( [pos],
self.x_points,
self.colors[:,i] )[0])
return clr_i(0), clr_i(1), c... | [
"def",
"at",
"(",
"self",
",",
"pos",
")",
":",
"def",
"clr_i",
"(",
"i",
")",
":",
"return",
"round",
"(",
"np",
".",
"interp",
"(",
"[",
"pos",
"]",
",",
"self",
".",
"x_points",
",",
"self",
".",
"colors",
"[",
":",
",",
"i",
"]",
")",
"... | https://github.com/dmishin/tsp-solver/blob/e743b7c3b225cdd279fb9f906422b056e713fb5f/tsp_solver/demo/numpy2svg.py#L20-L26 | |
WilmerWang/SLFCD | 312f76cec88d211e9a5f7b5f374b110919f56896 | camelyon16/bin/Evaluation_FROC.py | python | computeITCList | (evaluation_mask, resolution, level) | return Isolated_Tumor_Cells | Compute the list of labels containing Isolated Tumor Cells (ITC)
Description:
A region is considered ITC if its longest diameter is below 200µm.
As we expanded the annotations by 75µm, the major axis of the object
should be less than 275µm to be considered as ITC (Each pixel is
0.24... | Compute the list of labels containing Isolated Tumor Cells (ITC) | [
"Compute",
"the",
"list",
"of",
"labels",
"containing",
"Isolated",
"Tumor",
"Cells",
"(",
"ITC",
")"
] | def computeITCList(evaluation_mask, resolution, level):
"""Compute the list of labels containing Isolated Tumor Cells (ITC)
Description:
A region is considered ITC if its longest diameter is below 200µm.
As we expanded the annotations by 75µm, the major axis of the object
should be less... | [
"def",
"computeITCList",
"(",
"evaluation_mask",
",",
"resolution",
",",
"level",
")",
":",
"max_label",
"=",
"np",
".",
"amax",
"(",
"evaluation_mask",
")",
"properties",
"=",
"measure",
".",
"regionprops",
"(",
"evaluation_mask",
")",
"Isolated_Tumor_Cells",
"... | https://github.com/WilmerWang/SLFCD/blob/312f76cec88d211e9a5f7b5f374b110919f56896/camelyon16/bin/Evaluation_FROC.py#L40-L65 | |
googleads/googleads-python-lib | b3b42a6deedbe6eaa1c9b30183a9eae3f9e9a7ee | examples/ad_manager/v202105/adjustment_service/create_traffic_forecast_segments.py | python | main | (client) | [] | def main(client):
# Initialize the adjustment service and the network service.
adjustment_service = client.GetService('AdjustmentService', version='v202105')
network_service = client.GetService('NetworkService', version='v202105')
# Get the root ad unit id to target the whole site.
current_network = network_... | [
"def",
"main",
"(",
"client",
")",
":",
"# Initialize the adjustment service and the network service.",
"adjustment_service",
"=",
"client",
".",
"GetService",
"(",
"'AdjustmentService'",
",",
"version",
"=",
"'v202105'",
")",
"network_service",
"=",
"client",
".",
"Get... | https://github.com/googleads/googleads-python-lib/blob/b3b42a6deedbe6eaa1c9b30183a9eae3f9e9a7ee/examples/ad_manager/v202105/adjustment_service/create_traffic_forecast_segments.py#L26-L66 | ||||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/tkinter/__init__.py | python | Misc._windowingsystem | (self) | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def _windowingsystem(self):
"""Internal function."""
try:
return self._root()._windowingsystem_cached
except AttributeError:
ws = self._root()._windowingsystem_cached = \
self.tk.call('tk', 'windowingsystem')
return ws | [
"def",
"_windowingsystem",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_root",
"(",
")",
".",
"_windowingsystem_cached",
"except",
"AttributeError",
":",
"ws",
"=",
"self",
".",
"_root",
"(",
")",
".",
"_windowingsystem_cached",
"=",
"self",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/tkinter/__init__.py#L1307-L1314 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/tornado/template.py | python | _Module.__init__ | (self, expression, line) | [] | def __init__(self, expression, line):
super(_Module, self).__init__("_tt_modules." + expression, line,
raw=True) | [
"def",
"__init__",
"(",
"self",
",",
"expression",
",",
"line",
")",
":",
"super",
"(",
"_Module",
",",
"self",
")",
".",
"__init__",
"(",
"\"_tt_modules.\"",
"+",
"expression",
",",
"line",
",",
"raw",
"=",
"True",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/tornado/template.py#L637-L639 | ||||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/vcs/__init__.py | python | VersionControl.check_destination | (self, dest, url, rev_options, rev_display) | return checkout | Prepare a location to receive a checkout/clone.
Return True if the location is ready for (and requires) a
checkout/clone, False otherwise. | Prepare a location to receive a checkout/clone. | [
"Prepare",
"a",
"location",
"to",
"receive",
"a",
"checkout",
"/",
"clone",
"."
] | def check_destination(self, dest, url, rev_options, rev_display):
"""
Prepare a location to receive a checkout/clone.
Return True if the location is ready for (and requires) a
checkout/clone, False otherwise.
"""
checkout = True
prompt = False
if os.path.... | [
"def",
"check_destination",
"(",
"self",
",",
"dest",
",",
"url",
",",
"rev_options",
",",
"rev_display",
")",
":",
"checkout",
"=",
"True",
"prompt",
"=",
"False",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":",
"checkout",
"=",
"False"... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/vcs/__init__.py#L194-L277 | |
python-diamond/Diamond | 7000e16cfdf4508ed9291fc4b3800592557b2431 | src/diamond/handler/hostedgraphite.py | python | HostedGraphiteHandler.__init__ | (self, config=None) | Create a new instance of the HostedGraphiteHandler class | Create a new instance of the HostedGraphiteHandler class | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"HostedGraphiteHandler",
"class"
] | def __init__(self, config=None):
"""
Create a new instance of the HostedGraphiteHandler class
"""
# Initialize Handler
Handler.__init__(self, config)
self.key = self.config['apikey'].lower().strip()
self.graphite = GraphiteHandler(self.config) | [
"def",
"__init__",
"(",
"self",
",",
"config",
"=",
"None",
")",
":",
"# Initialize Handler",
"Handler",
".",
"__init__",
"(",
"self",
",",
"config",
")",
"self",
".",
"key",
"=",
"self",
".",
"config",
"[",
"'apikey'",
"]",
".",
"lower",
"(",
")",
"... | https://github.com/python-diamond/Diamond/blob/7000e16cfdf4508ed9291fc4b3800592557b2431/src/diamond/handler/hostedgraphite.py#L25-L34 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/RiskIQDigitalFootprint/Integrations/RiskIQDigitalFootprint/RiskIQDigitalFootprint.py | python | prepare_deep_link_for_asset_changes_summary | (resp: List[Dict[str, Any]], date_arg: str, range_arg: str) | return deep_link | Generates deep link for asset-changes-summary command to redirect to RiskIQ Platform.
:param resp: response that is fetched by making the API call using the acquired arguments
:param date_arg: date argument passed by user to build redirect URL to RiskIQ platform.
:param range_arg: range argument passed by ... | Generates deep link for asset-changes-summary command to redirect to RiskIQ Platform. | [
"Generates",
"deep",
"link",
"for",
"asset",
"-",
"changes",
"-",
"summary",
"command",
"to",
"redirect",
"to",
"RiskIQ",
"Platform",
"."
] | def prepare_deep_link_for_asset_changes_summary(resp: List[Dict[str, Any]], date_arg: str, range_arg: str) -> str:
"""
Generates deep link for asset-changes-summary command to redirect to RiskIQ Platform.
:param resp: response that is fetched by making the API call using the acquired arguments
:param d... | [
"def",
"prepare_deep_link_for_asset_changes_summary",
"(",
"resp",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
",",
"date_arg",
":",
"str",
",",
"range_arg",
":",
"str",
")",
"->",
"str",
":",
"last_run_date",
"=",
"resp",
"[",
"0",
"]",
... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/RiskIQDigitalFootprint/Integrations/RiskIQDigitalFootprint/RiskIQDigitalFootprint.py#L516-L533 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/pdb.py | python | Pdb.defaultFile | (self) | return filename | Produce a reasonable default. | Produce a reasonable default. | [
"Produce",
"a",
"reasonable",
"default",
"."
] | def defaultFile(self):
"""Produce a reasonable default."""
filename = self.curframe.f_code.co_filename
if filename == '<string>' and self.mainpyfile:
filename = self.mainpyfile
return filename | [
"def",
"defaultFile",
"(",
"self",
")",
":",
"filename",
"=",
"self",
".",
"curframe",
".",
"f_code",
".",
"co_filename",
"if",
"filename",
"==",
"'<string>'",
"and",
"self",
".",
"mainpyfile",
":",
"filename",
"=",
"self",
".",
"mainpyfile",
"return",
"fi... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/pdb.py#L427-L432 | |
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/utils/Execution.py | python | executeToolChecked | (logger, command, absence_message, stderr_filter=None) | return stdout | Execute external tool, checking for success and no error outputs, returning result. | Execute external tool, checking for success and no error outputs, returning result. | [
"Execute",
"external",
"tool",
"checking",
"for",
"success",
"and",
"no",
"error",
"outputs",
"returning",
"result",
"."
] | def executeToolChecked(logger, command, absence_message, stderr_filter=None):
"""Execute external tool, checking for success and no error outputs, returning result."""
tool = command[0]
if not isExecutableCommand(tool):
logger.sysexit(absence_message)
# Allow to avoid repeated scans in PATH f... | [
"def",
"executeToolChecked",
"(",
"logger",
",",
"command",
",",
"absence_message",
",",
"stderr_filter",
"=",
"None",
")",
":",
"tool",
"=",
"command",
"[",
"0",
"]",
"if",
"not",
"isExecutableCommand",
"(",
"tool",
")",
":",
"logger",
".",
"sysexit",
"("... | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/utils/Execution.py#L412-L444 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | openedx/core/djangoapps/content/block_structure/transformers.py | python | BlockStructureTransformers.collect | (cls, block_structure) | Collects data for each registered transformer. | Collects data for each registered transformer. | [
"Collects",
"data",
"for",
"each",
"registered",
"transformer",
"."
] | def collect(cls, block_structure):
"""
Collects data for each registered transformer.
"""
for transformer in TransformerRegistry.get_registered_transformers():
block_structure._add_transformer(transformer) # pylint: disable=protected-access
transformer.collect(bl... | [
"def",
"collect",
"(",
"cls",
",",
"block_structure",
")",
":",
"for",
"transformer",
"in",
"TransformerRegistry",
".",
"get_registered_transformers",
"(",
")",
":",
"block_structure",
".",
"_add_transformer",
"(",
"transformer",
")",
"# pylint: disable=protected-access... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/content/block_structure/transformers.py#L72-L81 | ||
lxc/pylxd | d82e4bbf81cb2a932d62179e895c955c489066fd | pylxd/models/instance.py | python | Instance.raw_interactive_execute | (
self, commands, environment=None, user=None, group=None, cwd=None
) | return {
"ws": "{}?secret={}".format(parsed.path, fds["0"]),
"control": "{}?secret={}".format(parsed.path, fds["control"]),
} | Execute a command on the instance interactively and returns
urls to websockets. The urls contain a secret uuid, and can be accesses
without further authentication. The caller has to open and manage
the websockets themselves.
:param commands: The command and arguments as a list of string... | Execute a command on the instance interactively and returns
urls to websockets. The urls contain a secret uuid, and can be accesses
without further authentication. The caller has to open and manage
the websockets themselves. | [
"Execute",
"a",
"command",
"on",
"the",
"instance",
"interactively",
"and",
"returns",
"urls",
"to",
"websockets",
".",
"The",
"urls",
"contain",
"a",
"secret",
"uuid",
"and",
"can",
"be",
"accesses",
"without",
"further",
"authentication",
".",
"The",
"caller... | def raw_interactive_execute(
self, commands, environment=None, user=None, group=None, cwd=None
):
"""Execute a command on the instance interactively and returns
urls to websockets. The urls contain a secret uuid, and can be accesses
without further authentication. The caller has to o... | [
"def",
"raw_interactive_execute",
"(",
"self",
",",
"commands",
",",
"environment",
"=",
"None",
",",
"user",
"=",
"None",
",",
"group",
"=",
"None",
",",
"cwd",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"commands",
",",
"str",
")",
":",
"raise",... | https://github.com/lxc/pylxd/blob/d82e4bbf81cb2a932d62179e895c955c489066fd/pylxd/models/instance.py#L509-L558 | |
hrwhisper/algorithm_course | ce1de1823b7b29d5e336011f2a9095a397b75cfa | 1_Divide_and_Conquer/1.py | python | binary_search | (A, la, ra, B, lb, rb, k) | [] | def binary_search(A, la, ra, B, lb, rb, k):
m, n = ra - la, rb - lb
if n == 0: return A[la + k - 1]
if k == 1: return min(A[la], B[lb])
b_m = k >> 1
a_m = k - b_m
if A[la + a_m - 1] < B[lb + b_m - 1]:
return binary_search(A, la + a_m, ra, B, lb, lb + b_m, k - a_m)
else: # A[la + a_... | [
"def",
"binary_search",
"(",
"A",
",",
"la",
",",
"ra",
",",
"B",
",",
"lb",
",",
"rb",
",",
"k",
")",
":",
"m",
",",
"n",
"=",
"ra",
"-",
"la",
",",
"rb",
"-",
"lb",
"if",
"n",
"==",
"0",
":",
"return",
"A",
"[",
"la",
"+",
"k",
"-",
... | https://github.com/hrwhisper/algorithm_course/blob/ce1de1823b7b29d5e336011f2a9095a397b75cfa/1_Divide_and_Conquer/1.py#L6-L16 | ||||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/retrying.py | python | retry | (*dargs, **dkw) | Decorator function that instantiates the Retrying object
@param *dargs: positional arguments passed to Retrying object
@param **dkw: keyword arguments passed to the Retrying object | Decorator function that instantiates the Retrying object | [
"Decorator",
"function",
"that",
"instantiates",
"the",
"Retrying",
"object"
] | def retry(*dargs, **dkw):
"""
Decorator function that instantiates the Retrying object
@param *dargs: positional arguments passed to Retrying object
@param **dkw: keyword arguments passed to the Retrying object
"""
# support both @retry and @retry() as valid syntax
if len(dargs) == 1 and cal... | [
"def",
"retry",
"(",
"*",
"dargs",
",",
"*",
"*",
"dkw",
")",
":",
"# support both @retry and @retry() as valid syntax",
"if",
"len",
"(",
"dargs",
")",
"==",
"1",
"and",
"callable",
"(",
"dargs",
"[",
"0",
"]",
")",
":",
"def",
"wrap_simple",
"(",
"f",
... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/retrying.py#L26-L53 | ||
sqlalchemy/sqlalchemy | eb716884a4abcabae84a6aaba105568e925b7d27 | lib/sqlalchemy/orm/interfaces.py | python | LoaderStrategy.create_row_processor | (
self,
context,
query_entity,
path,
loadopt,
mapper,
result,
adapter,
populators,
) | Establish row processing functions for a given QueryContext.
This method fulfills the contract specified by
MapperProperty.create_row_processor().
StrategizedProperty delegates its create_row_processor() method
directly to this method. | Establish row processing functions for a given QueryContext. | [
"Establish",
"row",
"processing",
"functions",
"for",
"a",
"given",
"QueryContext",
"."
] | def create_row_processor(
self,
context,
query_entity,
path,
loadopt,
mapper,
result,
adapter,
populators,
):
"""Establish row processing functions for a given QueryContext.
This method fulfills the contract specified by
... | [
"def",
"create_row_processor",
"(",
"self",
",",
"context",
",",
"query_entity",
",",
"path",
",",
"loadopt",
",",
"mapper",
",",
"result",
",",
"adapter",
",",
"populators",
",",
")",
":"
] | https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/orm/interfaces.py#L972-L991 | ||
WenmuZhou/PytorchOCR | 0b2b3a67814ae40b20f3814d6793f5d75d644e38 | tools/det_train_pse.py | python | build_optimizer | (params, config) | return opt | 优化器
Returns: | 优化器
Returns: | [
"优化器",
"Returns",
":"
] | def build_optimizer(params, config):
"""
优化器
Returns:
"""
from torch import optim
opt_type = config.pop('type')
opt = getattr(optim, opt_type)(params, **config)
return opt | [
"def",
"build_optimizer",
"(",
"params",
",",
"config",
")",
":",
"from",
"torch",
"import",
"optim",
"opt_type",
"=",
"config",
".",
"pop",
"(",
"'type'",
")",
"opt",
"=",
"getattr",
"(",
"optim",
",",
"opt_type",
")",
"(",
"params",
",",
"*",
"*",
... | https://github.com/WenmuZhou/PytorchOCR/blob/0b2b3a67814ae40b20f3814d6793f5d75d644e38/tools/det_train_pse.py#L77-L86 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/distutils/dist.py | python | DistributionMetadata.set_provides | (self, value) | [] | def set_provides(self, value):
value = [v.strip() for v in value]
for v in value:
import distutils.versionpredicate
distutils.versionpredicate.split_provision(v)
self.provides = value | [
"def",
"set_provides",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"[",
"v",
".",
"strip",
"(",
")",
"for",
"v",
"in",
"value",
"]",
"for",
"v",
"in",
"value",
":",
"import",
"distutils",
".",
"versionpredicate",
"distutils",
".",
"versionpredic... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/distutils/dist.py#L1233-L1238 | ||||
huwenxianglyy/bert-use-demo | ce0d927f15f45d4430381fd2ef360d43a3262803 | bert/tokenization.py | python | BasicTokenizer._run_split_on_punc | (self, text) | return ["".join(x) for x in output] | Splits punctuation on a piece of text. | Splits punctuation on a piece of text. | [
"Splits",
"punctuation",
"on",
"a",
"piece",
"of",
"text",
"."
] | def _run_split_on_punc(self, text):
"""Splits punctuation on a piece of text."""
chars = list(text)
i = 0
start_new_word = True
output = []
while i < len(chars):
char = chars[i]
if _is_punctuation(char):
output.append([char])
start_new_word = True
else:
... | [
"def",
"_run_split_on_punc",
"(",
"self",
",",
"text",
")",
":",
"chars",
"=",
"list",
"(",
"text",
")",
"i",
"=",
"0",
"start_new_word",
"=",
"True",
"output",
"=",
"[",
"]",
"while",
"i",
"<",
"len",
"(",
"chars",
")",
":",
"char",
"=",
"chars",
... | https://github.com/huwenxianglyy/bert-use-demo/blob/ce0d927f15f45d4430381fd2ef360d43a3262803/bert/tokenization.py#L180-L198 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/sklearn/externals/joblib/memory.py | python | Memory.__reduce__ | (self) | return (self.__class__, (cachedir,
self.mmap_mode, self.compress, self._verbose)) | We don't store the timestamp when pickling, to avoid the hash
depending from it.
In addition, when unpickling, we run the __init__ | We don't store the timestamp when pickling, to avoid the hash
depending from it.
In addition, when unpickling, we run the __init__ | [
"We",
"don",
"t",
"store",
"the",
"timestamp",
"when",
"pickling",
"to",
"avoid",
"the",
"hash",
"depending",
"from",
"it",
".",
"In",
"addition",
"when",
"unpickling",
"we",
"run",
"the",
"__init__"
] | def __reduce__(self):
""" We don't store the timestamp when pickling, to avoid the hash
depending from it.
In addition, when unpickling, we run the __init__
"""
# We need to remove 'joblib' from the end of cachedir
cachedir = self.cachedir[:-7] if self.cachedir is... | [
"def",
"__reduce__",
"(",
"self",
")",
":",
"# We need to remove 'joblib' from the end of cachedir",
"cachedir",
"=",
"self",
".",
"cachedir",
"[",
":",
"-",
"7",
"]",
"if",
"self",
".",
"cachedir",
"is",
"not",
"None",
"else",
"None",
"return",
"(",
"self",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/externals/joblib/memory.py#L910-L918 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/EWS/Integrations/EWSO365/EWSO365.py | python | mark_item_as_read | (
client: EWSClient, item_ids, operation="read", target_mailbox=None
) | return readable_output, output, marked_items | Marks item as read
:param client: EWS Client
:param item_ids: items ids to mark as read
:param (Optional) operation: operation to execute
:param (Optional) target_mailbox: target mailbox
:return: Output tuple | Marks item as read
:param client: EWS Client
:param item_ids: items ids to mark as read
:param (Optional) operation: operation to execute
:param (Optional) target_mailbox: target mailbox
:return: Output tuple | [
"Marks",
"item",
"as",
"read",
":",
"param",
"client",
":",
"EWS",
"Client",
":",
"param",
"item_ids",
":",
"items",
"ids",
"to",
"mark",
"as",
"read",
":",
"param",
"(",
"Optional",
")",
"operation",
":",
"operation",
"to",
"execute",
":",
"param",
"(... | def mark_item_as_read(
client: EWSClient, item_ids, operation="read", target_mailbox=None
):
"""
Marks item as read
:param client: EWS Client
:param item_ids: items ids to mark as read
:param (Optional) operation: operation to execute
:param (Optional) target_mailbox: target mailbox
... | [
"def",
"mark_item_as_read",
"(",
"client",
":",
"EWSClient",
",",
"item_ids",
",",
"operation",
"=",
"\"read\"",
",",
"target_mailbox",
"=",
"None",
")",
":",
"marked_items",
"=",
"[",
"]",
"item_ids",
"=",
"argToList",
"(",
"item_ids",
")",
"items",
"=",
... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/EWS/Integrations/EWSO365/EWSO365.py#L1589-L1621 | |
jhorey/ferry | bbaa047df08386e17130a939e20fde5e840d1ffa | ferry/config/spark/sparkconfig.py | python | SparkInitializer.get_internal_ports | (self, num_instances) | return ["0-65535"] | Ports needed for communication within the network.
This is usually used for internal IPC. | Ports needed for communication within the network.
This is usually used for internal IPC. | [
"Ports",
"needed",
"for",
"communication",
"within",
"the",
"network",
".",
"This",
"is",
"usually",
"used",
"for",
"internal",
"IPC",
"."
] | def get_internal_ports(self, num_instances):
"""
Ports needed for communication within the network.
This is usually used for internal IPC.
"""
return ["0-65535"] | [
"def",
"get_internal_ports",
"(",
"self",
",",
"num_instances",
")",
":",
"return",
"[",
"\"0-65535\"",
"]"
] | https://github.com/jhorey/ferry/blob/bbaa047df08386e17130a939e20fde5e840d1ffa/ferry/config/spark/sparkconfig.py#L77-L82 | |
datacenter/acitoolkit | 629b84887dd0f0183b81efc8adb16817f985541a | acitoolkit/aciphysobject.py | python | Interface.is_lldp_enabled | (self) | return self._lldp_config == 'enabled' | Returns whether this interface has LLDP configured as enabled.
:returns: True or False | Returns whether this interface has LLDP configured as enabled. | [
"Returns",
"whether",
"this",
"interface",
"has",
"LLDP",
"configured",
"as",
"enabled",
"."
] | def is_lldp_enabled(self):
"""
Returns whether this interface has LLDP configured as enabled.
:returns: True or False
"""
return self._lldp_config == 'enabled' | [
"def",
"is_lldp_enabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lldp_config",
"==",
"'enabled'"
] | https://github.com/datacenter/acitoolkit/blob/629b84887dd0f0183b81efc8adb16817f985541a/acitoolkit/aciphysobject.py#L2535-L2541 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/rest_framework/relations.py | python | ManyRelatedField.grouped_choices | (self) | return self.choices | [] | def grouped_choices(self):
return self.choices | [
"def",
"grouped_choices",
"(",
"self",
")",
":",
"return",
"self",
".",
"choices"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/rest_framework/relations.py#L531-L532 | |||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/irc/irc/client.py | python | ServerConnection.user | (self, username, realname) | Send a USER command. | Send a USER command. | [
"Send",
"a",
"USER",
"command",
"."
] | def user(self, username, realname):
"""Send a USER command."""
self.send_raw("USER %s 0 * :%s" % (username, realname)) | [
"def",
"user",
"(",
"self",
",",
"username",
",",
"realname",
")",
":",
"self",
".",
"send_raw",
"(",
"\"USER %s 0 * :%s\"",
"%",
"(",
"username",
",",
"realname",
")",
")"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/irc/irc/client.py#L917-L919 | ||
appu1232/Discord-Selfbot | 2305be70cdd8499c4ddb8b79101c70ac2f3fbb0d | cogs/utility.py | python | Utility.messagedump | (self, ctx, limit, filename, details="yes", reverse="no") | Dump messages. | Dump messages. | [
"Dump",
"messages",
"."
] | async def messagedump(self, ctx, limit, filename, details="yes", reverse="no"):
"""Dump messages."""
await ctx.message.delete()
await ctx.send(self.bot.bot_prefix + "Downloading messages...")
if not os.path.isdir('message_dump'):
os.mkdir('message_dump')
with open("me... | [
"async",
"def",
"messagedump",
"(",
"self",
",",
"ctx",
",",
"limit",
",",
"filename",
",",
"details",
"=",
"\"yes\"",
",",
"reverse",
"=",
"\"no\"",
")",
":",
"await",
"ctx",
".",
"message",
".",
"delete",
"(",
")",
"await",
"ctx",
".",
"send",
"(",... | https://github.com/appu1232/Discord-Selfbot/blob/2305be70cdd8499c4ddb8b79101c70ac2f3fbb0d/cogs/utility.py#L574-L597 | ||
mupen64plus/mupen64plus-ui-python | e24679436a93e8aae0aa664dc4b2dea40d8236c1 | src/m64py/frontend/mainwindow.py | python | MainWindow.on_actionReset_triggered | (self) | Resets emulator. | Resets emulator. | [
"Resets",
"emulator",
"."
] | def on_actionReset_triggered(self):
"""Resets emulator."""
self.worker.reset() | [
"def",
"on_actionReset_triggered",
"(",
"self",
")",
":",
"self",
".",
"worker",
".",
"reset",
"(",
")"
] | https://github.com/mupen64plus/mupen64plus-ui-python/blob/e24679436a93e8aae0aa664dc4b2dea40d8236c1/src/m64py/frontend/mainwindow.py#L422-L424 | ||
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/aiohttp/abc.py | python | AbstractCookieJar.clear | (self) | Clear all cookies. | Clear all cookies. | [
"Clear",
"all",
"cookies",
"."
] | def clear(self):
"""Clear all cookies.""" | [
"def",
"clear",
"(",
"self",
")",
":"
] | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/aiohttp/abc.py#L122-L123 | ||
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/Mask RCNN/matterport-Mask_RCNN/train_shape.py | python | ShapesDataset.load_image | (self, image_id) | return image | Generate an image from the specs of the given image ID.
Typically this function loads the image from a file, but
in this case it generates the image on the fly from the
specs in image_info. | Generate an image from the specs of the given image ID.
Typically this function loads the image from a file, but
in this case it generates the image on the fly from the
specs in image_info. | [
"Generate",
"an",
"image",
"from",
"the",
"specs",
"of",
"the",
"given",
"image",
"ID",
".",
"Typically",
"this",
"function",
"loads",
"the",
"image",
"from",
"a",
"file",
"but",
"in",
"this",
"case",
"it",
"generates",
"the",
"image",
"on",
"the",
"fly"... | def load_image(self, image_id):
"""Generate an image from the specs of the given image ID.
Typically this function loads the image from a file, but
in this case it generates the image on the fly from the
specs in image_info.
"""
info = self.image_info[image_id]
bg... | [
"def",
"load_image",
"(",
"self",
",",
"image_id",
")",
":",
"info",
"=",
"self",
".",
"image_info",
"[",
"image_id",
"]",
"bg_color",
"=",
"np",
".",
"array",
"(",
"info",
"[",
"'bg_color'",
"]",
")",
".",
"reshape",
"(",
"[",
"1",
",",
"1",
",",
... | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/Mask RCNN/matterport-Mask_RCNN/train_shape.py#L138-L150 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/op2/tables/geom/geom2.py | python | GEOM2._read_ctriax3fd_32 | (self, card_obj, data: bytes, n: int) | return n, elements | Word Name Type Description
1 EID I Element identification number
2 PID I Property identification number
3 G(6) I Grid point identification numbers of connection points
(331, 111, 331, 332, 333, 0, 0, 0,
332, 11, 331, 333, 334, 0, 0, 0) | Word Name Type Description
1 EID I Element identification number
2 PID I Property identification number
3 G(6) I Grid point identification numbers of connection points | [
"Word",
"Name",
"Type",
"Description",
"1",
"EID",
"I",
"Element",
"identification",
"number",
"2",
"PID",
"I",
"Property",
"identification",
"number",
"3",
"G",
"(",
"6",
")",
"I",
"Grid",
"point",
"identification",
"numbers",
"of",
"connection",
"points"
] | def _read_ctriax3fd_32(self, card_obj, data: bytes, n: int) -> int:
"""
Word Name Type Description
1 EID I Element identification number
2 PID I Property identification number
3 G(6) I Grid point identification numbers of connection points
(331, 111, 331, 332, 333, 0, ... | [
"def",
"_read_ctriax3fd_32",
"(",
"self",
",",
"card_obj",
",",
"data",
":",
"bytes",
",",
"n",
":",
"int",
")",
"->",
"int",
":",
"op2",
"=",
"self",
".",
"op2",
"s",
"=",
"Struct",
"(",
"op2",
".",
"_endian",
"+",
"b'8i'",
")",
"ntotal",
"=",
"... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/tables/geom/geom2.py#L3988-L4017 | |
bungnoid/glTools | 8ff0899de43784a18bd4543285655e68e28fb5e5 | ui/utils.py | python | loadSurfaceSel | (textField,prefixTextField='') | Load selected surface into UI text field
@param textField: TextField UI object to load surface selection into
@type textField: str
@param prefixTextField: TextField UI object to load surface name prefix into
@type prefixTextField: str | Load selected surface into UI text field | [
"Load",
"selected",
"surface",
"into",
"UI",
"text",
"field"
] | def loadSurfaceSel(textField,prefixTextField=''):
'''
Load selected surface into UI text field
@param textField: TextField UI object to load surface selection into
@type textField: str
@param prefixTextField: TextField UI object to load surface name prefix into
@type prefixTextField: str
'''
# Get user selectio... | [
"def",
"loadSurfaceSel",
"(",
"textField",
",",
"prefixTextField",
"=",
"''",
")",
":",
"# Get user selection",
"sel",
"=",
"mc",
".",
"ls",
"(",
"sl",
"=",
"True",
")",
"# Check selection",
"if",
"not",
"sel",
":",
"return",
"if",
"not",
"glTools",
".",
... | https://github.com/bungnoid/glTools/blob/8ff0899de43784a18bd4543285655e68e28fb5e5/ui/utils.py#L190-L209 | ||
descarteslabs/descarteslabs-python | ace8a1a89d58b75df1bcaa613a4b3544d7bdc4be | descarteslabs/catalog/attributes.py | python | BooleanAttribute.deserialize | (self, value, validate=True) | return bool(value) | Deserialize a value to a native type.
See :meth:`Attribute.deserialize`.
Returns
-------
bool
The boolean value. Note that any non-empty string, include "False" will
return ``True``. | Deserialize a value to a native type. | [
"Deserialize",
"a",
"value",
"to",
"a",
"native",
"type",
"."
] | def deserialize(self, value, validate=True):
"""Deserialize a value to a native type.
See :meth:`Attribute.deserialize`.
Returns
-------
bool
The boolean value. Note that any non-empty string, include "False" will
return ``True``.
"""
re... | [
"def",
"deserialize",
"(",
"self",
",",
"value",
",",
"validate",
"=",
"True",
")",
":",
"return",
"bool",
"(",
"value",
")"
] | https://github.com/descarteslabs/descarteslabs-python/blob/ace8a1a89d58b75df1bcaa613a4b3544d7bdc4be/descarteslabs/catalog/attributes.py#L600-L611 | |
p2pool/p2pool | 53c438bbada06b9d4a9a465bc13f7694a7a322b7 | wstools/WSDLTools.py | python | GetWSAActionFault | (operation, name) | return WSA.FAULT | Find wsa:Action attribute, and return value or WSA.FAULT
for the default. | Find wsa:Action attribute, and return value or WSA.FAULT
for the default. | [
"Find",
"wsa",
":",
"Action",
"attribute",
"and",
"return",
"value",
"or",
"WSA",
".",
"FAULT",
"for",
"the",
"default",
"."
] | def GetWSAActionFault(operation, name):
"""Find wsa:Action attribute, and return value or WSA.FAULT
for the default.
"""
attr = operation.faults[name].action
if attr is not None:
return attr
return WSA.FAULT | [
"def",
"GetWSAActionFault",
"(",
"operation",
",",
"name",
")",
":",
"attr",
"=",
"operation",
".",
"faults",
"[",
"name",
"]",
".",
"action",
"if",
"attr",
"is",
"not",
"None",
":",
"return",
"attr",
"return",
"WSA",
".",
"FAULT"
] | https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/wstools/WSDLTools.py#L1382-L1389 | |
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/site-packages/pip/_vendor/html5lib/treebuilders/base.py | python | Node.__init__ | (self, name) | Node representing an item in the tree.
name - The tag name associated with the node
parent - The parent of the current node (or None for the document node)
value - The value of the current node (applies to text nodes and
comments
attributes - a dict holding name, value pairs for ... | Node representing an item in the tree.
name - The tag name associated with the node
parent - The parent of the current node (or None for the document node)
value - The value of the current node (applies to text nodes and
comments
attributes - a dict holding name, value pairs for ... | [
"Node",
"representing",
"an",
"item",
"in",
"the",
"tree",
".",
"name",
"-",
"The",
"tag",
"name",
"associated",
"with",
"the",
"node",
"parent",
"-",
"The",
"parent",
"of",
"the",
"current",
"node",
"(",
"or",
"None",
"for",
"the",
"document",
"node",
... | def __init__(self, name):
"""Node representing an item in the tree.
name - The tag name associated with the node
parent - The parent of the current node (or None for the document node)
value - The value of the current node (applies to text nodes and
comments
attributes - ... | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"parent",
"=",
"None",
"self",
".",
"value",
"=",
"None",
"self",
".",
"attributes",
"=",
"{",
"}",
"self",
".",
"childNodes",
"=",
"[",
"]",
"s... | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L24-L40 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_process.py | python | Yedit.yaml_dict | (self) | return self.__yaml_dict | getter method for yaml_dict | getter method for yaml_dict | [
"getter",
"method",
"for",
"yaml_dict"
] | def yaml_dict(self):
''' getter method for yaml_dict '''
return self.__yaml_dict | [
"def",
"yaml_dict",
"(",
"self",
")",
":",
"return",
"self",
".",
"__yaml_dict"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_process.py#L190-L192 | |
mrJean1/PyGeodesy | 7da5ca71aa3edb7bc49e219e0b8190686e1a7965 | pygeodesy/ellipsoidalVincenty.py | python | LatLon._Direct | (self, distance, bearing, llr, height) | return r | (INTERNAL) Direct Vincenty method.
@raise TypeError: The B{C{other}} point is not L{LatLon}.
@raise ValueError: If this and the B{C{other}} point's L{Datum}
ellipsoids are not compatible.
@raise VincentyError: Vincenty fails to converge for the current
... | (INTERNAL) Direct Vincenty method. | [
"(",
"INTERNAL",
")",
"Direct",
"Vincenty",
"method",
"."
] | def _Direct(self, distance, bearing, llr, height):
'''(INTERNAL) Direct Vincenty method.
@raise TypeError: The B{C{other}} point is not L{LatLon}.
@raise ValueError: If this and the B{C{other}} point's L{Datum}
ellipsoids are not compatible.
@rai... | [
"def",
"_Direct",
"(",
"self",
",",
"distance",
",",
"bearing",
",",
"llr",
",",
"height",
")",
":",
"E",
"=",
"self",
".",
"ellipsoid",
"(",
")",
"c1",
",",
"s1",
",",
"t1",
"=",
"_r3",
"(",
"self",
".",
"lat",
",",
"E",
".",
"f",
")",
"i",
... | https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/ellipsoidalVincenty.py#L210-L260 | |
flennerhag/mlens | 6cbc11354b5f9500a33d9cefb700a1bba9d3199a | mlens/parallel/learner.py | python | SubLearner.fit | (self, path=None) | Fit sub-learner | Fit sub-learner | [
"Fit",
"sub",
"-",
"learner"
] | def fit(self, path=None):
"""Fit sub-learner"""
if path is None:
path = self.path
t0 = time()
transformers = self._load_preprocess(path)
self._fit(transformers)
if self.out_array is not None:
self._predict(transformers, self.scorer is not None)
... | [
"def",
"fit",
"(",
"self",
",",
"path",
"=",
"None",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"self",
".",
"path",
"t0",
"=",
"time",
"(",
")",
"transformers",
"=",
"self",
".",
"_load_preprocess",
"(",
"path",
")",
"self",
".",
"_... | https://github.com/flennerhag/mlens/blob/6cbc11354b5f9500a33d9cefb700a1bba9d3199a/mlens/parallel/learner.py#L126-L150 | ||
joe-siyuan-qiao/DetectoRS | 612916ba89ad6452b07ae52d3a6ec8d34a792608 | mmdet/core/optimizer/builder.py | python | build_optimizer | (model, optimizer_cfg) | return build_from_cfg(optimizer_cfg, OPTIMIZERS) | Build optimizer from configs.
Args:
model (:obj:`nn.Module`): The model with parameters to be optimized.
optimizer_cfg (dict): The config dict of the optimizer.
Positional fields are:
- type: class name of the optimizer.
- lr: base learning rate.
... | Build optimizer from configs. | [
"Build",
"optimizer",
"from",
"configs",
"."
] | def build_optimizer(model, optimizer_cfg):
"""Build optimizer from configs.
Args:
model (:obj:`nn.Module`): The model with parameters to be optimized.
optimizer_cfg (dict): The config dict of the optimizer.
Positional fields are:
- type: class name of the optimizer.
... | [
"def",
"build_optimizer",
"(",
"model",
",",
"optimizer_cfg",
")",
":",
"if",
"hasattr",
"(",
"model",
",",
"'module'",
")",
":",
"model",
"=",
"model",
".",
"module",
"optimizer_cfg",
"=",
"optimizer_cfg",
".",
"copy",
"(",
")",
"paramwise_options",
"=",
... | https://github.com/joe-siyuan-qiao/DetectoRS/blob/612916ba89ad6452b07ae52d3a6ec8d34a792608/mmdet/core/optimizer/builder.py#L9-L101 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/Django/django/contrib/auth/forms.py | python | PasswordResetForm.save | (self, domain_override=None,
subject_template_name='registration/password_reset_subject.txt',
email_template_name='registration/password_reset_email.html',
use_https=False, token_generator=default_token_generator,
from_email=None, request=None) | Generates a one-use only link for resetting password and sends to the
user. | Generates a one-use only link for resetting password and sends to the
user. | [
"Generates",
"a",
"one",
"-",
"use",
"only",
"link",
"for",
"resetting",
"password",
"and",
"sends",
"to",
"the",
"user",
"."
] | def save(self, domain_override=None,
subject_template_name='registration/password_reset_subject.txt',
email_template_name='registration/password_reset_email.html',
use_https=False, token_generator=default_token_generator,
from_email=None, request=None):
"""
... | [
"def",
"save",
"(",
"self",
",",
"domain_override",
"=",
"None",
",",
"subject_template_name",
"=",
"'registration/password_reset_subject.txt'",
",",
"email_template_name",
"=",
"'registration/password_reset_email.html'",
",",
"use_https",
"=",
"False",
",",
"token_generato... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/contrib/auth/forms.py#L231-L261 | ||
facebookresearch/habitat-lab | c6b96ac061f238f18ad5ca2c08f7f46819d30bd0 | habitat/core/env.py | python | Env.step | (
self, action: Union[int, str, Dict[str, Any]], **kwargs
) | return observations | r"""Perform an action in the environment and return observations.
:param action: action (belonging to :ref:`action_space`) to be
performed inside the environment. Action is a name or index of
allowed task's action and action arguments (belonging to action's
:ref:`action_spac... | r"""Perform an action in the environment and return observations. | [
"r",
"Perform",
"an",
"action",
"in",
"the",
"environment",
"and",
"return",
"observations",
"."
] | def step(
self, action: Union[int, str, Dict[str, Any]], **kwargs
) -> Observations:
r"""Perform an action in the environment and return observations.
:param action: action (belonging to :ref:`action_space`) to be
performed inside the environment. Action is a name or index of
... | [
"def",
"step",
"(",
"self",
",",
"action",
":",
"Union",
"[",
"int",
",",
"str",
",",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
",",
"*",
"*",
"kwargs",
")",
"->",
"Observations",
":",
"assert",
"(",
"self",
".",
"_episode_start_time",
"is",
"not",... | https://github.com/facebookresearch/habitat-lab/blob/c6b96ac061f238f18ad5ca2c08f7f46819d30bd0/habitat/core/env.py#L275-L315 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/interfaces.py | python | IReactorSocket.adoptStreamConnection | (fileDescriptor, addressFamily, factory) | Add an existing connected I{SOCK_STREAM} socket to the reactor to
monitor for data.
Note that the given factory won't have its C{startFactory} and
C{stopFactory} methods called, as there is no sensible time to call
them in this situation.
@param fileDescriptor: A file descripto... | Add an existing connected I{SOCK_STREAM} socket to the reactor to
monitor for data. | [
"Add",
"an",
"existing",
"connected",
"I",
"{",
"SOCK_STREAM",
"}",
"socket",
"to",
"the",
"reactor",
"to",
"monitor",
"for",
"data",
"."
] | def adoptStreamConnection(fileDescriptor, addressFamily, factory):
"""
Add an existing connected I{SOCK_STREAM} socket to the reactor to
monitor for data.
Note that the given factory won't have its C{startFactory} and
C{stopFactory} methods called, as there is no sensible time t... | [
"def",
"adoptStreamConnection",
"(",
"fileDescriptor",
",",
"addressFamily",
",",
"factory",
")",
":"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/interfaces.py#L1067-L1096 | ||
TheSouthFrog/stylealign | 910632d2fccc9db61b00c265ae18a88913113c1d | dataloader.py | python | landmarks_loader | (shape, train, sigma, data_dir, img_list, fill_batches = True, shuffle = False,
return_keys = ["imgs", "joints", "norm_imgs", "norm_joints"]) | return BufferedWrapper(loader) | [] | def landmarks_loader(shape, train, sigma, data_dir, img_list, fill_batches = True, shuffle = False,
return_keys = ["imgs", "joints", "norm_imgs", "norm_joints"]):
loader = LandmarkLoader(shape, train, sigma,data_dir, img_list, fill_batches, shuffle, return_keys)
return BufferedWrapper(loader) | [
"def",
"landmarks_loader",
"(",
"shape",
",",
"train",
",",
"sigma",
",",
"data_dir",
",",
"img_list",
",",
"fill_batches",
"=",
"True",
",",
"shuffle",
"=",
"False",
",",
"return_keys",
"=",
"[",
"\"imgs\"",
",",
"\"joints\"",
",",
"\"norm_imgs\"",
",",
"... | https://github.com/TheSouthFrog/stylealign/blob/910632d2fccc9db61b00c265ae18a88913113c1d/dataloader.py#L80-L83 | |||
tornadoweb/tornado | 208672f3bf6cbb7e37f54c356e02a71ca29f1e02 | tornado/web.py | python | RequestHandler.settings | (self) | return self.application.settings | An alias for `self.application.settings <Application.settings>`. | An alias for `self.application.settings <Application.settings>`. | [
"An",
"alias",
"for",
"self",
".",
"application",
".",
"settings",
"<Application",
".",
"settings",
">",
"."
] | def settings(self) -> Dict[str, Any]:
"""An alias for `self.application.settings <Application.settings>`."""
return self.application.settings | [
"def",
"settings",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"self",
".",
"application",
".",
"settings"
] | https://github.com/tornadoweb/tornado/blob/208672f3bf6cbb7e37f54c356e02a71ca29f1e02/tornado/web.py#L259-L261 | |
bitcraze/crazyflie-lib-python | 876f0dc003b91ba5e4de05daae9d0b79cf600f81 | examples/positioning/bezier_trajectory.py | python | Segment.__init__ | (self, head_node, tail_node, scale) | [] | def __init__(self, head_node, tail_node, scale):
self._scale = scale
unscaled_points = np.concatenate(
[head_node.get_head_points(), tail_node.get_tail_points()])
self._points = self._scale_control_points(unscaled_points, self._scale)
polys = self._convert_to_polys()
... | [
"def",
"__init__",
"(",
"self",
",",
"head_node",
",",
"tail_node",
",",
"scale",
")",
":",
"self",
".",
"_scale",
"=",
"scale",
"unscaled_points",
"=",
"np",
".",
"concatenate",
"(",
"[",
"head_node",
".",
"get_head_points",
"(",
")",
",",
"tail_node",
... | https://github.com/bitcraze/crazyflie-lib-python/blob/876f0dc003b91ba5e4de05daae9d0b79cf600f81/examples/positioning/bezier_trajectory.py#L155-L168 | ||||
mathLab/PyGeM | c2895a120332fbaf6a36db5088d5ee3d453b1784 | pygem/cad/nurbshandler.py | python | NurbsHandler.write_face | (self, points_face, list_points_edge, topo_face, toledge) | return topods.Face(new_bspline_tface.Face()) | Method to recreate a Face associated to a geometric surface
after the modification of Face points. It returns a TopoDS_Face.
:param points_face: the new face points array.
:param list_points_edge: new edge points
:param topo_face: the face to be modified
:param toledge: toleranc... | Method to recreate a Face associated to a geometric surface
after the modification of Face points. It returns a TopoDS_Face. | [
"Method",
"to",
"recreate",
"a",
"Face",
"associated",
"to",
"a",
"geometric",
"surface",
"after",
"the",
"modification",
"of",
"Face",
"points",
".",
"It",
"returns",
"a",
"TopoDS_Face",
"."
] | def write_face(self, points_face, list_points_edge, topo_face, toledge):
"""
Method to recreate a Face associated to a geometric surface
after the modification of Face points. It returns a TopoDS_Face.
:param points_face: the new face points array.
:param list_points_edge: new e... | [
"def",
"write_face",
"(",
"self",
",",
"points_face",
",",
"list_points_edge",
",",
"topo_face",
",",
"toledge",
")",
":",
"# convert Face to Geom B-spline Surface",
"nurbs_converter",
"=",
"BRepBuilderAPI_NurbsConvert",
"(",
"topo_face",
")",
"nurbs_converter",
".",
"P... | https://github.com/mathLab/PyGeM/blob/c2895a120332fbaf6a36db5088d5ee3d453b1784/pygem/cad/nurbshandler.py#L457-L568 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/api/apiextensions_v1_api.py | python | ApiextensionsV1Api.patch_custom_resource_definition | (self, name, body, **kwargs) | return self.patch_custom_resource_definition_with_http_info(name, body, **kwargs) | patch_custom_resource_definition # noqa: E501
partially update the specified CustomResourceDefinition # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_custom_resource_definitio... | patch_custom_resource_definition # noqa: E501 | [
"patch_custom_resource_definition",
"#",
"noqa",
":",
"E501"
] | def patch_custom_resource_definition(self, name, body, **kwargs): # noqa: E501
"""patch_custom_resource_definition # noqa: E501
partially update the specified CustomResourceDefinition # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP r... | [
"def",
"patch_custom_resource_definition",
"(",
"self",
",",
"name",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"patch_custom_resource_definition_with_http_info",
... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/apiextensions_v1_api.py#L742-L770 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/reading.py | python | MultiReader.format | (self, fieldname) | [] | def format(self, fieldname):
for r in self.readers:
fmt = r.format(fieldname)
if fmt is not None:
return fmt | [
"def",
"format",
"(",
"self",
",",
"fieldname",
")",
":",
"for",
"r",
"in",
"self",
".",
"readers",
":",
"fmt",
"=",
"r",
".",
"format",
"(",
"fieldname",
")",
"if",
"fmt",
"is",
"not",
"None",
":",
"return",
"fmt"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/reading.py#L1029-L1033 | ||||
open-mmlab/mmediting | 6a08a728c63e76f0427eeebcd2db236839bbd11d | tools/data/super-resolution/div2k/preprocess_div2k_dataset.py | python | read_img_worker | (path, key, compress_level) | return (key, img_byte, (h, w, c)) | Read image worker
Args:
path (str): Image path.
key (str): Image key.
compress_level (int): Compress level when encoding images.
Returns:
str: Image key.
byte: Image byte.
tuple[int]: Image shape. | Read image worker | [
"Read",
"image",
"worker"
] | def read_img_worker(path, key, compress_level):
"""Read image worker
Args:
path (str): Image path.
key (str): Image key.
compress_level (int): Compress level when encoding images.
Returns:
str: Image key.
byte: Image byte.
tuple[int]: Image shape.
"""
... | [
"def",
"read_img_worker",
"(",
"path",
",",
"key",
",",
"compress_level",
")",
":",
"img",
"=",
"mmcv",
".",
"imread",
"(",
"path",
",",
"flag",
"=",
"'unchanged'",
")",
"if",
"img",
".",
"ndim",
"==",
"2",
":",
"h",
",",
"w",
"=",
"img",
".",
"s... | https://github.com/open-mmlab/mmediting/blob/6a08a728c63e76f0427eeebcd2db236839bbd11d/tools/data/super-resolution/div2k/preprocess_div2k_dataset.py#L324-L345 | |
postgres/pgadmin4 | 374c5e952fa594d749fadf1f88076c1cba8c5f64 | web/pgadmin/browser/server_groups/servers/types.py | python | ServerType.csssnippets | (self) | return [
render_template(
"css/server_type.css",
server_type=self.stype,
icon=self.icon
)
] | Returns a snippet of css to include in the page | Returns a snippet of css to include in the page | [
"Returns",
"a",
"snippet",
"of",
"css",
"to",
"include",
"in",
"the",
"page"
] | def csssnippets(self):
"""
Returns a snippet of css to include in the page
"""
return [
render_template(
"css/server_type.css",
server_type=self.stype,
icon=self.icon
)
] | [
"def",
"csssnippets",
"(",
"self",
")",
":",
"return",
"[",
"render_template",
"(",
"\"css/server_type.css\"",
",",
"server_type",
"=",
"self",
".",
"stype",
",",
"icon",
"=",
"self",
".",
"icon",
")",
"]"
] | https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/browser/server_groups/servers/types.py#L140-L150 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/pkg_resources/__init__.py | python | get_build_platform | () | return plat | Return this platform's string for platform-specific distributions
XXX Currently this is the same as ``distutils.util.get_platform()``, but it
needs some hacks for Linux and Mac OS X. | Return this platform's string for platform-specific distributions | [
"Return",
"this",
"platform",
"s",
"string",
"for",
"platform",
"-",
"specific",
"distributions"
] | def get_build_platform():
"""Return this platform's string for platform-specific distributions
XXX Currently this is the same as ``distutils.util.get_platform()``, but it
needs some hacks for Linux and Mac OS X.
"""
try:
# Python 2.7 or >=3.2
from sysconfig import get_platform
e... | [
"def",
"get_build_platform",
"(",
")",
":",
"try",
":",
"# Python 2.7 or >=3.2",
"from",
"sysconfig",
"import",
"get_platform",
"except",
"ImportError",
":",
"from",
"distutils",
".",
"util",
"import",
"get_platform",
"plat",
"=",
"get_platform",
"(",
")",
"if",
... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pkg_resources/__init__.py#L463-L486 | |
flosell/trailscraper | 2509b8da81b49edf375a44fbc22a58fd9e2ea928 | trailscraper/cli.py | python | download | (bucket, prefix, org_id, account_id, region, log_dir, from_s, to_s, wait, parallelism) | Downloads CloudTrail Logs from S3. | Downloads CloudTrail Logs from S3. | [
"Downloads",
"CloudTrail",
"Logs",
"from",
"S3",
"."
] | def download(bucket, prefix, org_id, account_id, region, log_dir, from_s, to_s, wait, parallelism):
"""Downloads CloudTrail Logs from S3."""
log_dir = os.path.expanduser(log_dir)
from_date = time_utils.parse_human_readable_time(from_s)
to_date = time_utils.parse_human_readable_time(to_s)
download_... | [
"def",
"download",
"(",
"bucket",
",",
"prefix",
",",
"org_id",
",",
"account_id",
",",
"region",
",",
"log_dir",
",",
"from_s",
",",
"to_s",
",",
"wait",
",",
"parallelism",
")",
":",
"log_dir",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"log_dir... | https://github.com/flosell/trailscraper/blob/2509b8da81b49edf375a44fbc22a58fd9e2ea928/trailscraper/cli.py#L54-L74 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/contrib/gis/db/models/query.py | python | GeoQuerySet.force_rhr | (self, **kwargs) | return self._geom_attribute('force_rhr', **kwargs) | Returns a modified version of the Polygon/MultiPolygon in which
all of the vertices follow the Right-Hand-Rule. By default,
this is attached as the `force_rhr` attribute on each element
of the GeoQuerySet. | Returns a modified version of the Polygon/MultiPolygon in which
all of the vertices follow the Right-Hand-Rule. By default,
this is attached as the `force_rhr` attribute on each element
of the GeoQuerySet. | [
"Returns",
"a",
"modified",
"version",
"of",
"the",
"Polygon",
"/",
"MultiPolygon",
"in",
"which",
"all",
"of",
"the",
"vertices",
"follow",
"the",
"Right",
"-",
"Hand",
"-",
"Rule",
".",
"By",
"default",
"this",
"is",
"attached",
"as",
"the",
"force_rhr",... | def force_rhr(self, **kwargs):
"""
Returns a modified version of the Polygon/MultiPolygon in which
all of the vertices follow the Right-Hand-Rule. By default,
this is attached as the `force_rhr` attribute on each element
of the GeoQuerySet.
"""
return self._geom_... | [
"def",
"force_rhr",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_geom_attribute",
"(",
"'force_rhr'",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/contrib/gis/db/models/query.py#L125-L132 | |
jmoiron/johnny-cache | d96ea94c5dfcde517ff8f65d6ba4e435d8a0168c | johnny/cache.py | python | QueryCacheBackend.patch | (self) | monkey patches django.db.models.sql.compiler.SQL*Compiler series | monkey patches django.db.models.sql.compiler.SQL*Compiler series | [
"monkey",
"patches",
"django",
".",
"db",
".",
"models",
".",
"sql",
".",
"compiler",
".",
"SQL",
"*",
"Compiler",
"series"
] | def patch(self):
"""
monkey patches django.db.models.sql.compiler.SQL*Compiler series
"""
from django.db.models.sql import compiler
self._read_compilers = (
compiler.SQLCompiler,
compiler.SQLAggregateCompiler,
compiler.SQLDateCompiler,
... | [
"def",
"patch",
"(",
"self",
")",
":",
"from",
"django",
".",
"db",
".",
"models",
".",
"sql",
"import",
"compiler",
"self",
".",
"_read_compilers",
"=",
"(",
"compiler",
".",
"SQLCompiler",
",",
"compiler",
".",
"SQLAggregateCompiler",
",",
"compiler",
".... | https://github.com/jmoiron/johnny-cache/blob/d96ea94c5dfcde517ff8f65d6ba4e435d8a0168c/johnny/cache.py#L403-L429 | ||
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/Shared/plugin/core/libraries/manager.py | python | LibrariesManager.test | () | Test native libraries to ensure they can be correctly loaded | Test native libraries to ensure they can be correctly loaded | [
"Test",
"native",
"libraries",
"to",
"ensure",
"they",
"can",
"be",
"correctly",
"loaded"
] | def test():
"""Test native libraries to ensure they can be correctly loaded"""
log.info('Testing native library support...')
# Retrieve library directories
search_paths = []
for path in sys.path:
path_lower = path.lower()
if 'trakttv.bundle' not in path... | [
"def",
"test",
"(",
")",
":",
"log",
".",
"info",
"(",
"'Testing native library support...'",
")",
"# Retrieve library directories",
"search_paths",
"=",
"[",
"]",
"for",
"path",
"in",
"sys",
".",
"path",
":",
"path_lower",
"=",
"path",
".",
"lower",
"(",
")... | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Shared/plugin/core/libraries/manager.py#L58-L119 | ||
bookieio/Bookie | 78b15fc68ec7e7dc3ad0c4fa049ce670a304d419 | bookie/models/social.py | python | SocialMgr.get_twitter_connections | (username=None) | return connections | Returns all twitter connections based on username | Returns all twitter connections based on username | [
"Returns",
"all",
"twitter",
"connections",
"based",
"on",
"username"
] | def get_twitter_connections(username=None):
""" Returns all twitter connections based on username """
if username:
connections = TwitterConnection.query.filter(
TwitterConnection.username == username).all()
else:
connections = TwitterConnection.query.all()... | [
"def",
"get_twitter_connections",
"(",
"username",
"=",
"None",
")",
":",
"if",
"username",
":",
"connections",
"=",
"TwitterConnection",
".",
"query",
".",
"filter",
"(",
"TwitterConnection",
".",
"username",
"==",
"username",
")",
".",
"all",
"(",
")",
"el... | https://github.com/bookieio/Bookie/blob/78b15fc68ec7e7dc3ad0c4fa049ce670a304d419/bookie/models/social.py#L26-L33 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-build/python-libs/gdata/build/lib/gdata/apps/groups/service.py | python | GroupsService.RetrieveOwner | (self, owner_email, group_id) | return self._GetProperties(uri) | Retrieve the given owner in the given group
Args:
owner_email: The email address of a group owner.
group_id: The ID of the group (e.g. us-sales).
Returns:
A dict containing the result of the retrieve operation. | Retrieve the given owner in the given group | [
"Retrieve",
"the",
"given",
"owner",
"in",
"the",
"given",
"group"
] | def RetrieveOwner(self, owner_email, group_id):
"""Retrieve the given owner in the given group
Args:
owner_email: The email address of a group owner.
group_id: The ID of the group (e.g. us-sales).
Returns:
A dict containing the result of the retrieve operation.
"""
uri = self._Se... | [
"def",
"RetrieveOwner",
"(",
"self",
",",
"owner_email",
",",
"group_id",
")",
":",
"uri",
"=",
"self",
".",
"_ServiceUrl",
"(",
"'owner'",
",",
"True",
",",
"group_id",
",",
"''",
",",
"owner_email",
",",
"''",
",",
"''",
")",
"return",
"self",
".",
... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/gdata/build/lib/gdata/apps/groups/service.py#L273-L284 | |
jantman/misc-scripts | dba5680bafbc5c5d2d9d4abcc305c57df373cd26 | github_clone_setup.py | python | is_github_repo | (confpath, gitdir) | return False | return true if this repo origin is on GitHub, False otherwise | return true if this repo origin is on GitHub, False otherwise | [
"return",
"true",
"if",
"this",
"repo",
"origin",
"is",
"on",
"GitHub",
"False",
"otherwise"
] | def is_github_repo(confpath, gitdir):
""" return true if this repo origin is on GitHub, False otherwise """
origin_url = get_config_value(confpath, 'remote.origin.url')
if 'github.com' in origin_url:
return True
return False | [
"def",
"is_github_repo",
"(",
"confpath",
",",
"gitdir",
")",
":",
"origin_url",
"=",
"get_config_value",
"(",
"confpath",
",",
"'remote.origin.url'",
")",
"if",
"'github.com'",
"in",
"origin_url",
":",
"return",
"True",
"return",
"False"
] | https://github.com/jantman/misc-scripts/blob/dba5680bafbc5c5d2d9d4abcc305c57df373cd26/github_clone_setup.py#L120-L125 | |
PaddlePaddle/PaddleSpeech | 26524031d242876b7fdb71582b0b3a7ea45c7d9d | paddlespeech/t2s/datasets/preprocess_utils.py | python | compare_duration_and_mel_length | (sentences, utt, mel) | check duration error, correct sentences[utt] if possible, else pop sentences[utt]
Parameters
----------
sentences : Dict
sentences[utt] = [phones_list ,durations_list]
utt : str
utt_id
mel : np.ndarry
features (num_frames, n_mels) | check duration error, correct sentences[utt] if possible, else pop sentences[utt]
Parameters
----------
sentences : Dict
sentences[utt] = [phones_list ,durations_list]
utt : str
utt_id
mel : np.ndarry
features (num_frames, n_mels) | [
"check",
"duration",
"error",
"correct",
"sentences",
"[",
"utt",
"]",
"if",
"possible",
"else",
"pop",
"sentences",
"[",
"utt",
"]",
"Parameters",
"----------",
"sentences",
":",
"Dict",
"sentences",
"[",
"utt",
"]",
"=",
"[",
"phones_list",
"durations_list",... | def compare_duration_and_mel_length(sentences, utt, mel):
'''
check duration error, correct sentences[utt] if possible, else pop sentences[utt]
Parameters
----------
sentences : Dict
sentences[utt] = [phones_list ,durations_list]
utt : str
utt_id
mel : np.ndarry
featu... | [
"def",
"compare_duration_and_mel_length",
"(",
"sentences",
",",
"utt",
",",
"mel",
")",
":",
"if",
"utt",
"in",
"sentences",
":",
"len_diff",
"=",
"mel",
".",
"shape",
"[",
"0",
"]",
"-",
"sum",
"(",
"sentences",
"[",
"utt",
"]",
"[",
"1",
"]",
")",... | https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/t2s/datasets/preprocess_utils.py#L162-L186 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/configobj-5.0.6/configobj.py | python | ConfigObj._decode_element | (self, line) | Decode element to unicode if necessary. | Decode element to unicode if necessary. | [
"Decode",
"element",
"to",
"unicode",
"if",
"necessary",
"."
] | def _decode_element(self, line):
"""Decode element to unicode if necessary."""
if isinstance(line, six.binary_type) and self.default_encoding:
return line.decode(self.default_encoding)
else:
return line | [
"def",
"_decode_element",
"(",
"self",
",",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"six",
".",
"binary_type",
")",
"and",
"self",
".",
"default_encoding",
":",
"return",
"line",
".",
"decode",
"(",
"self",
".",
"default_encoding",
")",
"... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/configobj-5.0.6/configobj.py#L1521-L1526 | ||
Tencent/GAutomator | 0ac9f849d1ca2c59760a91c5c94d3db375a380cd | GAutomatorAndroid/libs/urllib3/util/connection.py | python | create_connection | (address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
source_address=None, socket_options=None) | Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the... | Connect to *address* and return the socket object. | [
"Connect",
"to",
"*",
"address",
"*",
"and",
"return",
"the",
"socket",
"object",
"."
] | def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
source_address=None, socket_options=None):
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the o... | [
"def",
"create_connection",
"(",
"address",
",",
"timeout",
"=",
"socket",
".",
"_GLOBAL_DEFAULT_TIMEOUT",
",",
"source_address",
"=",
"None",
",",
"socket_options",
"=",
"None",
")",
":",
"host",
",",
"port",
"=",
"address",
"if",
"host",
".",
"startswith",
... | https://github.com/Tencent/GAutomator/blob/0ac9f849d1ca2c59760a91c5c94d3db375a380cd/GAutomatorAndroid/libs/urllib3/util/connection.py#L51-L100 | ||
huntfx/MouseTracks | 4dfab6386f9461be77cb19b54c9c498d74fb4ef6 | mousetracks/track/background.py | python | running_processes | (q_recv, q_send, background_send) | Check for running processes.
As refreshing the list takes some time but not CPU, this is put in its own thread
and sends the currently running program to the backgrund process. | Check for running processes.
As refreshing the list takes some time but not CPU, this is put in its own thread
and sends the currently running program to the backgrund process. | [
"Check",
"for",
"running",
"processes",
".",
"As",
"refreshing",
"the",
"list",
"takes",
"some",
"time",
"but",
"not",
"CPU",
"this",
"is",
"put",
"in",
"its",
"own",
"thread",
"and",
"sends",
"the",
"currently",
"running",
"program",
"to",
"the",
"backgru... | def running_processes(q_recv, q_send, background_send):
"""Check for running processes.
As refreshing the list takes some time but not CPU, this is put in its own thread
and sends the currently running program to the backgrund process.
"""
try:
previous_app = None
last_coordinates = ... | [
"def",
"running_processes",
"(",
"q_recv",
",",
"q_send",
",",
"background_send",
")",
":",
"try",
":",
"previous_app",
"=",
"None",
"last_coordinates",
"=",
"None",
"last_resolution",
"=",
"None",
"NOTIFY",
"(",
"LANGUAGE",
".",
"strings",
"[",
"'Tracking'",
... | https://github.com/huntfx/MouseTracks/blob/4dfab6386f9461be77cb19b54c9c498d74fb4ef6/mousetracks/track/background.py#L25-L132 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/polys/densearith.py | python | dup_sub_term | (f, c, i, K) | Subtract ``c*x**i`` from ``f`` in ``K[x]``.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x = ring("x", ZZ)
>>> R.dup_sub_term(2*x**4 + x**2 - 1, ZZ(2), 4)
x**2 - 1 | Subtract ``c*x**i`` from ``f`` in ``K[x]``. | [
"Subtract",
"c",
"*",
"x",
"**",
"i",
"from",
"f",
"in",
"K",
"[",
"x",
"]",
"."
] | def dup_sub_term(f, c, i, K):
"""
Subtract ``c*x**i`` from ``f`` in ``K[x]``.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x = ring("x", ZZ)
>>> R.dup_sub_term(2*x**4 + x**2 - 1, ZZ(2), 4)
x**2 - 1
"""
if not c:
return f
n = len(f)
m = n - i ... | [
"def",
"dup_sub_term",
"(",
"f",
",",
"c",
",",
"i",
",",
"K",
")",
":",
"if",
"not",
"c",
":",
"return",
"f",
"n",
"=",
"len",
"(",
"f",
")",
"m",
"=",
"n",
"-",
"i",
"-",
"1",
"if",
"i",
"==",
"n",
"-",
"1",
":",
"return",
"dup_strip",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/densearith.py#L81-L107 | ||
PaddlePaddle/PGL | e48545f2814523c777b8a9a9188bf5a7f00d6e52 | legacy/docs/markdown2rst.py | python | M2R.post_process | (self, text) | post_process | post_process | [
"post_process"
] | def post_process(self, text):
"""post_process"""
output = (text.replace('\\ \n', '\n').replace('\n\\ ', '\n')
.replace(' \\ ', ' ').replace('\\ ', ' ')
.replace('\\ .', '.'))
if self.renderer._include_raw_html:
return prolog + output
else:... | [
"def",
"post_process",
"(",
"self",
",",
"text",
")",
":",
"output",
"=",
"(",
"text",
".",
"replace",
"(",
"'\\\\ \\n'",
",",
"'\\n'",
")",
".",
"replace",
"(",
"'\\n\\\\ '",
",",
"'\\n'",
")",
".",
"replace",
"(",
"' \\\\ '",
",",
"' '",
")",
".",
... | https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/legacy/docs/markdown2rst.py#L557-L565 | ||
huchunxu/ros_exploring | d09506c4dcb4487be791cceb52ba7c764e614fd8 | robot_learning/tensorflow_object_detection/object_detection/utils/ops.py | python | normalize_to_target | (inputs,
target_norm_value,
dim,
epsilon=1e-7,
trainable=True,
scope='NormalizeToTarget',
summarize=True) | L2 normalizes the inputs across the specified dimension to a target norm.
This op implements the L2 Normalization layer introduced in
Liu, Wei, et al. "SSD: Single Shot MultiBox Detector."
and Liu, Wei, Andrew Rabinovich, and Alexander C. Berg.
"Parsenet: Looking wider to see better." and is useful for bringin... | L2 normalizes the inputs across the specified dimension to a target norm. | [
"L2",
"normalizes",
"the",
"inputs",
"across",
"the",
"specified",
"dimension",
"to",
"a",
"target",
"norm",
"."
] | def normalize_to_target(inputs,
target_norm_value,
dim,
epsilon=1e-7,
trainable=True,
scope='NormalizeToTarget',
summarize=True):
"""L2 normalizes the inputs across the speci... | [
"def",
"normalize_to_target",
"(",
"inputs",
",",
"target_norm_value",
",",
"dim",
",",
"epsilon",
"=",
"1e-7",
",",
"trainable",
"=",
"True",
",",
"scope",
"=",
"'NormalizeToTarget'",
",",
"summarize",
"=",
"True",
")",
":",
"with",
"tf",
".",
"variable_sco... | https://github.com/huchunxu/ros_exploring/blob/d09506c4dcb4487be791cceb52ba7c764e614fd8/robot_learning/tensorflow_object_detection/object_detection/utils/ops.py#L385-L459 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/email/message.py | python | Message.__str__ | (self) | return self.as_string(unixfrom=True) | Return the entire formatted message as a string.
This includes the headers, body, and envelope header. | Return the entire formatted message as a string.
This includes the headers, body, and envelope header. | [
"Return",
"the",
"entire",
"formatted",
"message",
"as",
"a",
"string",
".",
"This",
"includes",
"the",
"headers",
"body",
"and",
"envelope",
"header",
"."
] | def __str__(self):
"""Return the entire formatted message as a string.
This includes the headers, body, and envelope header.
"""
return self.as_string(unixfrom=True) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"as_string",
"(",
"unixfrom",
"=",
"True",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/email/message.py#L118-L122 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/infinity.py | python | MinusInfinity._sympy_ | (self) | return -sympy.oo | Converts ``-oo`` to sympy ``-oo``.
Then you don't have to worry which ``oo`` you use, like in these
examples:
EXAMPLES::
sage: import sympy
sage: bool(-oo == -sympy.oo)
True
sage: bool(SR(-oo) == -sympy.oo)
True
sage: boo... | Converts ``-oo`` to sympy ``-oo``. | [
"Converts",
"-",
"oo",
"to",
"sympy",
"-",
"oo",
"."
] | def _sympy_(self):
"""
Converts ``-oo`` to sympy ``-oo``.
Then you don't have to worry which ``oo`` you use, like in these
examples:
EXAMPLES::
sage: import sympy
sage: bool(-oo == -sympy.oo)
True
sage: bool(SR(-oo) == -sympy.oo)... | [
"def",
"_sympy_",
"(",
"self",
")",
":",
"import",
"sympy",
"return",
"-",
"sympy",
".",
"oo"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/infinity.py#L1608-L1627 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/algos/power.py | python | PoWER.std_params | (self) | return self._std_params | Return the standard deviation of the parameters. | Return the standard deviation of the parameters. | [
"Return",
"the",
"standard",
"deviation",
"of",
"the",
"parameters",
"."
] | def std_params(self):
"""Return the standard deviation of the parameters."""
return self._std_params | [
"def",
"std_params",
"(",
"self",
")",
":",
"return",
"self",
".",
"_std_params"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/algos/power.py#L107-L109 | |
jayleicn/scipy-lecture-notes-zh-CN | cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6 | advanced/mathematical_optimization/examples/cost_functions.py | python | mk_quad | (epsilon, ndim=2) | return f, f_prime, hessian | [] | def mk_quad(epsilon, ndim=2):
def f(x):
x = np.asarray(x)
y = x.copy()
y *= np.power(epsilon, np.arange(ndim))
return .33*np.sum(y**2)
def f_prime(x):
x = np.asarray(x)
y = x.copy()
scaling = np.power(epsilon, np.arange(ndim))
y *= scaling
return .... | [
"def",
"mk_quad",
"(",
"epsilon",
",",
"ndim",
"=",
"2",
")",
":",
"def",
"f",
"(",
"x",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"y",
"=",
"x",
".",
"copy",
"(",
")",
"y",
"*=",
"np",
".",
"power",
"(",
"epsilon",
",",
"n... | https://github.com/jayleicn/scipy-lecture-notes-zh-CN/blob/cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6/advanced/mathematical_optimization/examples/cost_functions.py#L55-L73 | |||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/controllers/profiling/scan_log_analysis/utils/utils.py | python | get_last_timestamp | (scan) | return LAST_TIMESTAMP | [] | def get_last_timestamp(scan):
# This is so ugly...
global LAST_TIMESTAMP
if LAST_TIMESTAMP is not None:
return LAST_TIMESTAMP
scan.seek(0)
for line in reverse_readline(scan):
try:
timestamp = get_line_epoch(line)
except InvalidTimeStamp:
# Read one ... | [
"def",
"get_last_timestamp",
"(",
"scan",
")",
":",
"# This is so ugly...",
"global",
"LAST_TIMESTAMP",
"if",
"LAST_TIMESTAMP",
"is",
"not",
"None",
":",
"return",
"LAST_TIMESTAMP",
"scan",
".",
"seek",
"(",
"0",
")",
"for",
"line",
"in",
"reverse_readline",
"("... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/profiling/scan_log_analysis/utils/utils.py#L57-L80 | |||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/fabmetheus_tools/alphabetize.py | python | getFunctionsWithStringByFileName | (fileName, searchString) | return functions | Get the functions with the search string in the file. | Get the functions with the search string in the file. | [
"Get",
"the",
"functions",
"with",
"the",
"search",
"string",
"in",
"the",
"file",
"."
] | def getFunctionsWithStringByFileName(fileName, searchString):
'Get the functions with the search string in the file.'
fileText = archive.getFileText(fileName)
functions = []
lines = archive.getTextLines(fileText)
for line in lines:
lineStripped = line.strip()
# if lineStripped.startswith('def ') and searchStrin... | [
"def",
"getFunctionsWithStringByFileName",
"(",
"fileName",
",",
"searchString",
")",
":",
"fileText",
"=",
"archive",
".",
"getFileText",
"(",
"fileName",
")",
"functions",
"=",
"[",
"]",
"lines",
"=",
"archive",
".",
"getTextLines",
"(",
"fileText",
")",
"fo... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/fabmetheus_tools/alphabetize.py#L69-L81 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/sqli/thirdparty/beautifulsoup/beautifulsoup.py | python | BeautifulStoneSoup.__getattr__ | (self, methodName) | This method routes method call requests to either the SGMLParser
superclass or the Tag superclass, depending on the method name. | This method routes method call requests to either the SGMLParser
superclass or the Tag superclass, depending on the method name. | [
"This",
"method",
"routes",
"method",
"call",
"requests",
"to",
"either",
"the",
"SGMLParser",
"superclass",
"or",
"the",
"Tag",
"superclass",
"depending",
"on",
"the",
"method",
"name",
"."
] | def __getattr__(self, methodName):
"""This method routes method call requests to either the SGMLParser
superclass or the Tag superclass, depending on the method name."""
#print "__getattr__ called on %s.%s" % (self.__class__, methodName)
if methodName.startswith('start_') or methodName.... | [
"def",
"__getattr__",
"(",
"self",
",",
"methodName",
")",
":",
"#print \"__getattr__ called on %s.%s\" % (self.__class__, methodName)",
"if",
"methodName",
".",
"startswith",
"(",
"'start_'",
")",
"or",
"methodName",
".",
"startswith",
"(",
"'end_'",
")",
"or",
"meth... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/thirdparty/beautifulsoup/beautifulsoup.py#L1192-L1203 | ||
ShadowXZT/pytorch_RFCN | 0e532444263938aa4d000113dc6aac2e72b4b925 | faster_rcnn/datasets/coco.py | python | coco._load_proposals | (self, method, gt_roidb) | return self.create_roidb_from_box_list(box_list, gt_roidb) | Load pre-computed proposals in the format provided by Jan Hosang:
http://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal-
computing/research/object-recognition-and-scene-understanding/how-
good-are-detection-proposals-really/
For MCG, use boxes from http://www.eecs.berk... | Load pre-computed proposals in the format provided by Jan Hosang:
http://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal-
computing/research/object-recognition-and-scene-understanding/how-
good-are-detection-proposals-really/
For MCG, use boxes from http://www.eecs.berk... | [
"Load",
"pre",
"-",
"computed",
"proposals",
"in",
"the",
"format",
"provided",
"by",
"Jan",
"Hosang",
":",
"http",
":",
"//",
"www",
".",
"mpi",
"-",
"inf",
".",
"mpg",
".",
"de",
"/",
"departments",
"/",
"computer",
"-",
"vision",
"-",
"and",
"-",
... | def _load_proposals(self, method, gt_roidb):
"""
Load pre-computed proposals in the format provided by Jan Hosang:
http://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal-
computing/research/object-recognition-and-scene-understanding/how-
good-are-detection-propo... | [
"def",
"_load_proposals",
"(",
"self",
",",
"method",
",",
"gt_roidb",
")",
":",
"box_list",
"=",
"[",
"]",
"top_k",
"=",
"self",
".",
"config",
"[",
"'top_k'",
"]",
"valid_methods",
"=",
"[",
"'MCG'",
",",
"'selective_search'",
",",
"'edge_boxes_AR'",
","... | https://github.com/ShadowXZT/pytorch_RFCN/blob/0e532444263938aa4d000113dc6aac2e72b4b925/faster_rcnn/datasets/coco.py#L170-L215 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/process_group_entity.py | python | ProcessGroupEntity.running_count | (self) | return self._running_count | Gets the running_count of this ProcessGroupEntity.
The number of running components in this process group.
:return: The running_count of this ProcessGroupEntity.
:rtype: int | Gets the running_count of this ProcessGroupEntity.
The number of running components in this process group. | [
"Gets",
"the",
"running_count",
"of",
"this",
"ProcessGroupEntity",
".",
"The",
"number",
"of",
"running",
"components",
"in",
"this",
"process",
"group",
"."
] | def running_count(self):
"""
Gets the running_count of this ProcessGroupEntity.
The number of running components in this process group.
:return: The running_count of this ProcessGroupEntity.
:rtype: int
"""
return self._running_count | [
"def",
"running_count",
"(",
"self",
")",
":",
"return",
"self",
".",
"_running_count"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/process_group_entity.py#L420-L428 | |
lsbardel/python-stdnet | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 | stdnet/utils/zset.py | python | zset.__init__ | (self) | [] | def __init__(self):
self.clear() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"clear",
"(",
")"
] | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/zset.py#L12-L13 | ||||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/distutils/util.py | python | subst_vars | (s, local_vars) | Perform shell/Perl-style variable substitution on 'string'. Every
occurrence of '$' followed by a name is considered a variable, and
variable is substituted by the value found in the 'local_vars'
dictionary, or in 'os.environ' if it's not in 'local_vars'.
'os.environ' is first checked/augmented to guar... | Perform shell/Perl-style variable substitution on 'string'. Every
occurrence of '$' followed by a name is considered a variable, and
variable is substituted by the value found in the 'local_vars'
dictionary, or in 'os.environ' if it's not in 'local_vars'.
'os.environ' is first checked/augmented to guar... | [
"Perform",
"shell",
"/",
"Perl",
"-",
"style",
"variable",
"substitution",
"on",
"string",
".",
"Every",
"occurrence",
"of",
"$",
"followed",
"by",
"a",
"name",
"is",
"considered",
"a",
"variable",
"and",
"variable",
"is",
"substituted",
"by",
"the",
"value"... | def subst_vars (s, local_vars):
"""Perform shell/Perl-style variable substitution on 'string'. Every
occurrence of '$' followed by a name is considered a variable, and
variable is substituted by the value found in the 'local_vars'
dictionary, or in 'os.environ' if it's not in 'local_vars'.
'os.envi... | [
"def",
"subst_vars",
"(",
"s",
",",
"local_vars",
")",
":",
"check_environ",
"(",
")",
"def",
"_subst",
"(",
"match",
",",
"local_vars",
"=",
"local_vars",
")",
":",
"var_name",
"=",
"match",
".",
"group",
"(",
"1",
")",
"if",
"var_name",
"in",
"local_... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/distutils/util.py#L184-L204 | ||
sopel-irc/sopel | 787baa6e39f9dad57d94600c92e10761c41b21ef | sopel/irc/isupport.py | python | ISupport.CHANMODES | (self) | return dict(zip('ABCD', self['CHANMODES'][:4])) | Expose ``CHANMODES`` as a dict.
This exposes information about 4 types of channel modes::
>>> isupport.CHANMODES
{
'A': 'b',
'B': 'k',
'C': 'l',
'D': 'imnpst',
}
The values are empty if the server does... | Expose ``CHANMODES`` as a dict. | [
"Expose",
"CHANMODES",
"as",
"a",
"dict",
"."
] | def CHANMODES(self):
"""Expose ``CHANMODES`` as a dict.
This exposes information about 4 types of channel modes::
>>> isupport.CHANMODES
{
'A': 'b',
'B': 'k',
'C': 'l',
'D': 'imnpst',
}
The val... | [
"def",
"CHANMODES",
"(",
"self",
")",
":",
"if",
"'CHANMODES'",
"not",
"in",
"self",
":",
"return",
"{",
"\"A\"",
":",
"\"\"",
",",
"\"B\"",
":",
"\"\"",
",",
"\"C\"",
":",
"\"\"",
",",
"\"D\"",
":",
"\"\"",
"}",
"return",
"dict",
"(",
"zip",
"(",
... | https://github.com/sopel-irc/sopel/blob/787baa6e39f9dad57d94600c92e10761c41b21ef/sopel/irc/isupport.py#L280-L303 | |
fossasia/knittingpattern | e440429884182d6f2684b0ac051c0605ba31ae75 | knittingpattern/convert/Layout.py | python | InGrid.xy | (self) | return self._position | :return: ``(x, y)`` coordinate in the grid
:rtype: tuple | :return: ``(x, y)`` coordinate in the grid
:rtype: tuple | [
":",
"return",
":",
"(",
"x",
"y",
")",
"coordinate",
"in",
"the",
"grid",
":",
"rtype",
":",
"tuple"
] | def xy(self):
""":return: ``(x, y)`` coordinate in the grid
:rtype: tuple
"""
return self._position | [
"def",
"xy",
"(",
"self",
")",
":",
"return",
"self",
".",
"_position"
] | https://github.com/fossasia/knittingpattern/blob/e440429884182d6f2684b0ac051c0605ba31ae75/knittingpattern/convert/Layout.py#L50-L54 | |
zaiweizhang/H3DNet | e69f2855634807b37ae12e6db5963c924e64d3e7 | utils/pc_util.py | python | point_cloud_to_bbox | (points) | return np.concatenate([cntr, lengths], axis=which_dim) | Extract the axis aligned box from a pcl or batch of pcls
Args:
points: Nx3 points or BxNx3
output is 6 dim: xyz pos of center and 3 lengths | Extract the axis aligned box from a pcl or batch of pcls
Args:
points: Nx3 points or BxNx3
output is 6 dim: xyz pos of center and 3 lengths | [
"Extract",
"the",
"axis",
"aligned",
"box",
"from",
"a",
"pcl",
"or",
"batch",
"of",
"pcls",
"Args",
":",
"points",
":",
"Nx3",
"points",
"or",
"BxNx3",
"output",
"is",
"6",
"dim",
":",
"xyz",
"pos",
"of",
"center",
"and",
"3",
"lengths"
] | def point_cloud_to_bbox(points):
""" Extract the axis aligned box from a pcl or batch of pcls
Args:
points: Nx3 points or BxNx3
output is 6 dim: xyz pos of center and 3 lengths
"""
which_dim = len(points.shape) - 2 # first dim if a single cloud and second if batch
mn, mx = po... | [
"def",
"point_cloud_to_bbox",
"(",
"points",
")",
":",
"which_dim",
"=",
"len",
"(",
"points",
".",
"shape",
")",
"-",
"2",
"# first dim if a single cloud and second if batch",
"mn",
",",
"mx",
"=",
"points",
".",
"min",
"(",
"which_dim",
")",
",",
"points",
... | https://github.com/zaiweizhang/H3DNet/blob/e69f2855634807b37ae12e6db5963c924e64d3e7/utils/pc_util.py#L435-L445 | |
openai/mlsh | 2ae2393db0949c087883ca162ff84591a47fbe5d | gym/gym/envs/rl2/bernoulli_bandit.py | python | BernoulliBanditEnv._render | (self, mode='human', close=False) | return outfile | Renders the bandit environment in ASCII style. Closely resembles the rendering implementation of algorithmic
tasks. | Renders the bandit environment in ASCII style. Closely resembles the rendering implementation of algorithmic
tasks. | [
"Renders",
"the",
"bandit",
"environment",
"in",
"ASCII",
"style",
".",
"Closely",
"resembles",
"the",
"rendering",
"implementation",
"of",
"algorithmic",
"tasks",
"."
] | def _render(self, mode='human', close=False):
"""
Renders the bandit environment in ASCII style. Closely resembles the rendering implementation of algorithmic
tasks.
"""
if close:
# Nothing interesting to close
return
outfile = StringIO() if mode ... | [
"def",
"_render",
"(",
"self",
",",
"mode",
"=",
"'human'",
",",
"close",
"=",
"False",
")",
":",
"if",
"close",
":",
"# Nothing interesting to close",
"return",
"outfile",
"=",
"StringIO",
"(",
")",
"if",
"mode",
"==",
"'ansi'",
"else",
"sys",
".",
"std... | https://github.com/openai/mlsh/blob/2ae2393db0949c087883ca162ff84591a47fbe5d/gym/gym/envs/rl2/bernoulli_bandit.py#L78-L101 | |
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/ipaddress.py | python | IPv6Address.is_site_local | (self) | return self in self._constants._sitelocal_network | Test if the address is reserved for site-local.
Note that the site-local address space has been deprecated by RFC 3879.
Use is_private to test if this address is in the space of unique local
addresses as defined by RFC 4193.
Returns:
A boolean, True if the address is reserv... | Test if the address is reserved for site-local. | [
"Test",
"if",
"the",
"address",
"is",
"reserved",
"for",
"site",
"-",
"local",
"."
] | def is_site_local(self):
"""Test if the address is reserved for site-local.
Note that the site-local address space has been deprecated by RFC 3879.
Use is_private to test if this address is in the space of unique local
addresses as defined by RFC 4193.
Returns:
A bo... | [
"def",
"is_site_local",
"(",
"self",
")",
":",
"return",
"self",
"in",
"self",
".",
"_constants",
".",
"_sitelocal_network"
] | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/ipaddress.py#L2084-L2095 | |
YunseokJANG/tgif-qa | 9ecbbc7cb3d08300ddb6662b3dfd651914f3183f | code/gifqa/models/rnn_cell/rnn_cell.py | python | CompiledWrapper.__init__ | (self, cell, compile_stateful=False) | Create CompiledWrapper cell.
Args:
cell: Instance of `RNNCell`.
compile_stateful: Whether to compile stateful ops like initializers
and random number generators (default: False). | Create CompiledWrapper cell. | [
"Create",
"CompiledWrapper",
"cell",
"."
] | def __init__(self, cell, compile_stateful=False):
"""Create CompiledWrapper cell.
Args:
cell: Instance of `RNNCell`.
compile_stateful: Whether to compile stateful ops like initializers
and random number generators (default: False).
"""
self._cell = cell
self._compile_stateful = ... | [
"def",
"__init__",
"(",
"self",
",",
"cell",
",",
"compile_stateful",
"=",
"False",
")",
":",
"self",
".",
"_cell",
"=",
"cell",
"self",
".",
"_compile_stateful",
"=",
"compile_stateful"
] | https://github.com/YunseokJANG/tgif-qa/blob/9ecbbc7cb3d08300ddb6662b3dfd651914f3183f/code/gifqa/models/rnn_cell/rnn_cell.py#L1843-L1852 | ||
h2oai/driverlessai-recipes | 6720525d7f305cee15d4451cea66212c593d17fe | scorers/regression/r2_by_tgc.py | python | R2byTimeSeries.acceptance_test_timeout | () | return config.acceptance_test_timeout | Timeout in minutes for each test of a custom recipe. | Timeout in minutes for each test of a custom recipe. | [
"Timeout",
"in",
"minutes",
"for",
"each",
"test",
"of",
"a",
"custom",
"recipe",
"."
] | def acceptance_test_timeout():
"""
Timeout in minutes for each test of a custom recipe.
"""
return config.acceptance_test_timeout | [
"def",
"acceptance_test_timeout",
"(",
")",
":",
"return",
"config",
".",
"acceptance_test_timeout"
] | https://github.com/h2oai/driverlessai-recipes/blob/6720525d7f305cee15d4451cea66212c593d17fe/scorers/regression/r2_by_tgc.py#L48-L52 | |
lxtGH/GALD-DGCNet | be7ebfe2b3d28ea28a2b4714852999d4af2a785e | libs/models/GALDNet.py | python | GALDNet.__init__ | (self, block, layers, num_classes, avg=False) | [] | def __init__(self, block, layers, num_classes, avg=False):
self.inplanes = 128
super(GALDNet, self).__init__()
self.conv1 = nn.Sequential(
conv3x3(3, 64, stride=2),
BatchNorm2d(64),
nn.ReLU(inplace=True),
conv3x3(64, 64),
BatchNorm2d(64... | [
"def",
"__init__",
"(",
"self",
",",
"block",
",",
"layers",
",",
"num_classes",
",",
"avg",
"=",
"False",
")",
":",
"self",
".",
"inplanes",
"=",
"128",
"super",
"(",
"GALDNet",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"conv1",
"=... | https://github.com/lxtGH/GALD-DGCNet/blob/be7ebfe2b3d28ea28a2b4714852999d4af2a785e/libs/models/GALDNet.py#L232-L258 | ||||
gxcuizy/Python | 72167d12439a615a8fd4b935eae1fb6516ed4e69 | 从零学Python-掘金活动/day16/get_city.py | python | GetCity.get_html | (self, url) | 请求html页面信息 | 请求html页面信息 | [
"请求html页面信息"
] | def get_html(self, url):
"""请求html页面信息"""
header = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'
}
try:
request = requests.get(url=url, headers=header)
request.encod... | [
"def",
"get_html",
"(",
"self",
",",
"url",
")",
":",
"header",
"=",
"{",
"'User-Agent'",
":",
"'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'",
"}",
"try",
":",
"request",
"=",
"requests",
".",
"get",
... | https://github.com/gxcuizy/Python/blob/72167d12439a615a8fd4b935eae1fb6516ed4e69/从零学Python-掘金活动/day16/get_city.py#L29-L40 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/sqlmap/thirdparty/bottle/bottle.py | python | BaseRequest.url | (self) | return self.urlparts.geturl() | The full request URI including hostname and scheme. If your app
lives behind a reverse proxy or load balancer and you get confusing
results, make sure that the ``X-Forwarded-Host`` header is set
correctly. | The full request URI including hostname and scheme. If your app
lives behind a reverse proxy or load balancer and you get confusing
results, make sure that the ``X-Forwarded-Host`` header is set
correctly. | [
"The",
"full",
"request",
"URI",
"including",
"hostname",
"and",
"scheme",
".",
"If",
"your",
"app",
"lives",
"behind",
"a",
"reverse",
"proxy",
"or",
"load",
"balancer",
"and",
"you",
"get",
"confusing",
"results",
"make",
"sure",
"that",
"the",
"X",
"-",... | def url(self):
""" The full request URI including hostname and scheme. If your app
lives behind a reverse proxy or load balancer and you get confusing
results, make sure that the ``X-Forwarded-Host`` header is set
correctly. """
return self.urlparts.geturl() | [
"def",
"url",
"(",
"self",
")",
":",
"return",
"self",
".",
"urlparts",
".",
"geturl",
"(",
")"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/thirdparty/bottle/bottle.py#L1091-L1096 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/PyObjCTools/KeyValueCoding.py | python | _ArrayOperators.unionOfObjects | (obj, segments) | return [ getKeyPath(item, path) for item in obj] | [] | def unionOfObjects(obj, segments):
path = '.'.join(segments)
return [ getKeyPath(item, path) for item in obj] | [
"def",
"unionOfObjects",
"(",
"obj",
",",
"segments",
")",
":",
"path",
"=",
"'.'",
".",
"join",
"(",
"segments",
")",
"return",
"[",
"getKeyPath",
"(",
"item",
",",
"path",
")",
"for",
"item",
"in",
"obj",
"]"
] | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/PyObjCTools/KeyValueCoding.py#L171-L173 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/io/fits/column.py | python | Column._convert_format | (format, cls) | return format, recformat | The format argument to this class's initializer may come in many
forms. This uses the given column format class ``cls`` to convert
to a format of that type.
TODO: There should be an abc base class for column format classes | The format argument to this class's initializer may come in many
forms. This uses the given column format class ``cls`` to convert
to a format of that type. | [
"The",
"format",
"argument",
"to",
"this",
"class",
"s",
"initializer",
"may",
"come",
"in",
"many",
"forms",
".",
"This",
"uses",
"the",
"given",
"column",
"format",
"class",
"cls",
"to",
"convert",
"to",
"a",
"format",
"of",
"that",
"type",
"."
] | def _convert_format(format, cls):
"""The format argument to this class's initializer may come in many
forms. This uses the given column format class ``cls`` to convert
to a format of that type.
TODO: There should be an abc base class for column format classes
"""
# Sho... | [
"def",
"_convert_format",
"(",
"format",
",",
"cls",
")",
":",
"# Short circuit in case we're already a _BaseColumnFormat--there is at",
"# least one case in which this can happen",
"if",
"isinstance",
"(",
"format",
",",
"_BaseColumnFormat",
")",
":",
"return",
"format",
","... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/io/fits/column.py#L919-L945 | |
ckan/ckan | b3b01218ad88ed3fb914b51018abe8b07b07bff3 | ckanext/datastore/backend/postgres.py | python | DatastorePostgresqlBackend._is_read_only_database | (self) | return True | Returns True if no connection has CREATE privileges on the public
schema. This is the case if replication is enabled. | Returns True if no connection has CREATE privileges on the public
schema. This is the case if replication is enabled. | [
"Returns",
"True",
"if",
"no",
"connection",
"has",
"CREATE",
"privileges",
"on",
"the",
"public",
"schema",
".",
"This",
"is",
"the",
"case",
"if",
"replication",
"is",
"enabled",
"."
] | def _is_read_only_database(self):
''' Returns True if no connection has CREATE privileges on the public
schema. This is the case if replication is enabled.'''
for url in [self.ckan_url, self.write_url, self.read_url]:
connection = _get_engine_from_url(url).connect()
try:
... | [
"def",
"_is_read_only_database",
"(",
"self",
")",
":",
"for",
"url",
"in",
"[",
"self",
".",
"ckan_url",
",",
"self",
".",
"write_url",
",",
"self",
".",
"read_url",
"]",
":",
"connection",
"=",
"_get_engine_from_url",
"(",
"url",
")",
".",
"connect",
"... | https://github.com/ckan/ckan/blob/b3b01218ad88ed3fb914b51018abe8b07b07bff3/ckanext/datastore/backend/postgres.py#L1729-L1741 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/logging/__init__.py | python | getLogRecordFactory | () | return _logRecordFactory | Return the factory to be used when instantiating a log record. | Return the factory to be used when instantiating a log record. | [
"Return",
"the",
"factory",
"to",
"be",
"used",
"when",
"instantiating",
"a",
"log",
"record",
"."
] | def getLogRecordFactory():
"""
Return the factory to be used when instantiating a log record.
"""
return _logRecordFactory | [
"def",
"getLogRecordFactory",
"(",
")",
":",
"return",
"_logRecordFactory"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/logging/__init__.py#L386-L391 | |
martinRenou/ipycanvas | 53348e3f63153fc80459c9f1e76ce73dc75dcd49 | ipycanvas/canvas.py | python | MultiCanvas.__getitem__ | (self, key) | return self._canvases[key] | Access one of the Canvas instances. | Access one of the Canvas instances. | [
"Access",
"one",
"of",
"the",
"Canvas",
"instances",
"."
] | def __getitem__(self, key):
"""Access one of the Canvas instances."""
return self._canvases[key] | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"_canvases",
"[",
"key",
"]"
] | https://github.com/martinRenou/ipycanvas/blob/53348e3f63153fc80459c9f1e76ce73dc75dcd49/ipycanvas/canvas.py#L1303-L1305 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/misc/verbose.py | python | get_verbose | () | return LEVEL | Return the global Sage verbosity level.
INPUT: int level: an integer between 0 and 2, inclusive.
OUTPUT: changes the state of the verbosity flag.
EXAMPLES::
sage: get_verbose()
0
sage: set_verbose(2)
sage: get_verbose()
2
sage: set_verbose(0) | Return the global Sage verbosity level. | [
"Return",
"the",
"global",
"Sage",
"verbosity",
"level",
"."
] | def get_verbose():
"""
Return the global Sage verbosity level.
INPUT: int level: an integer between 0 and 2, inclusive.
OUTPUT: changes the state of the verbosity flag.
EXAMPLES::
sage: get_verbose()
0
sage: set_verbose(2)
sage: get_verbose()
2
sag... | [
"def",
"get_verbose",
"(",
")",
":",
"global",
"LEVEL",
"return",
"LEVEL"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/misc/verbose.py#L251-L269 | |
bukun/TorCMS | f7b44e8650aa54774f6b57e7b178edebbbf57e8e | torcms/model/post_model.py | python | MPost.__query_with_label | (cat_id_arr, label=None, num=8, kind='1') | return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id
)).where((TabPost.kind == kind)
& (TabPost2Tag.tag_id << cat_id_arr)
& # the "<<" operator signifies an "IN" query
(TabPos... | :param cat_id_arr: list of categories. ['0101', '0102'] | :param cat_id_arr: list of categories. ['0101', '0102'] | [
":",
"param",
"cat_id_arr",
":",
"list",
"of",
"categories",
".",
"[",
"0101",
"0102",
"]"
] | def __query_with_label(cat_id_arr, label=None, num=8, kind='1'):
'''
:param cat_id_arr: list of categories. ['0101', '0102']
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id
)).where((TabPost.kind == kind)
... | [
"def",
"__query_with_label",
"(",
"cat_id_arr",
",",
"label",
"=",
"None",
",",
"num",
"=",
"8",
",",
"kind",
"=",
"'1'",
")",
":",
"return",
"TabPost",
".",
"select",
"(",
")",
".",
"join",
"(",
"TabPost2Tag",
",",
"on",
"=",
"(",
"TabPost",
".",
... | https://github.com/bukun/TorCMS/blob/f7b44e8650aa54774f6b57e7b178edebbbf57e8e/torcms/model/post_model.py#L444-L456 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/distlib/database.py | python | DistributionPath.get_exported_entries | (self, category, name=None) | Return all of the exported entries in a particular category.
:param category: The category to search for entries.
:param name: If specified, only entries with that name are returned. | Return all of the exported entries in a particular category. | [
"Return",
"all",
"of",
"the",
"exported",
"entries",
"in",
"a",
"particular",
"category",
"."
] | def get_exported_entries(self, category, name=None):
"""
Return all of the exported entries in a particular category.
:param category: The category to search for entries.
:param name: If specified, only entries with that name are returned.
"""
for dist in self.get_distri... | [
"def",
"get_exported_entries",
"(",
"self",
",",
"category",
",",
"name",
"=",
"None",
")",
":",
"for",
"dist",
"in",
"self",
".",
"get_distributions",
"(",
")",
":",
"r",
"=",
"dist",
".",
"exports",
"if",
"category",
"in",
"r",
":",
"d",
"=",
"r",
... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/distlib/database.py#L290-L306 | ||
home-assistant-libs/pychromecast | d7acb9f5ae2c0daa797d78da1a1e8090b4181d21 | pychromecast/socket_client.py | python | SocketClient._ensure_channel_connected | (self, destination_id) | Ensure we opened a channel to destination_id. | Ensure we opened a channel to destination_id. | [
"Ensure",
"we",
"opened",
"a",
"channel",
"to",
"destination_id",
"."
] | def _ensure_channel_connected(self, destination_id):
"""Ensure we opened a channel to destination_id."""
if destination_id not in self._open_channels:
self._open_channels.append(destination_id)
self.send_message(
destination_id,
NS_CONNECTION,
... | [
"def",
"_ensure_channel_connected",
"(",
"self",
",",
"destination_id",
")",
":",
"if",
"destination_id",
"not",
"in",
"self",
".",
"_open_channels",
":",
"self",
".",
"_open_channels",
".",
"append",
"(",
"destination_id",
")",
"self",
".",
"send_message",
"(",... | https://github.com/home-assistant-libs/pychromecast/blob/d7acb9f5ae2c0daa797d78da1a1e8090b4181d21/pychromecast/socket_client.py#L962-L984 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.