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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
blue-oil/blueoil | 0c9160b524b17482d59ae48a0c11384f1d26dccc | blueoil/cmd/predict.py | python | predict | (input_dir, output_dir, experiment_id, config_file=None, checkpoint=None, save_images=True) | Make predictions from input dir images by using trained model.
Save the predictions npy, json, images results to output dir.
npy: `{output_dir}/npy/{batch number}.npy`
json: `{output_dir}/json/{batch number}.json`
images: `{output_dir}/images/{some type}/{input image file name}` | Make predictions from input dir images by using trained model.
Save the predictions npy, json, images results to output dir.
npy: `{output_dir}/npy/{batch number}.npy`
json: `{output_dir}/json/{batch number}.json`
images: `{output_dir}/images/{some type}/{input image file name}` | [
"Make",
"predictions",
"from",
"input",
"dir",
"images",
"by",
"using",
"trained",
"model",
".",
"Save",
"the",
"predictions",
"npy",
"json",
"images",
"results",
"to",
"output",
"dir",
".",
"npy",
":",
"{",
"output_dir",
"}",
"/",
"npy",
"/",
"{",
"batc... | def predict(input_dir, output_dir, experiment_id, config_file=None, checkpoint=None, save_images=True):
"""Make predictions from input dir images by using trained model.
Save the predictions npy, json, images results to output dir.
npy: `{output_dir}/npy/{batch number}.npy`
json: `{output_di... | [
"def",
"predict",
"(",
"input_dir",
",",
"output_dir",
",",
"experiment_id",
",",
"config_file",
"=",
"None",
",",
"checkpoint",
"=",
"None",
",",
"save_images",
"=",
"True",
")",
":",
"restore_path",
"=",
"None",
"if",
"checkpoint",
":",
"saved_dir",
"=",
... | https://github.com/blue-oil/blueoil/blob/0c9160b524b17482d59ae48a0c11384f1d26dccc/blueoil/cmd/predict.py#L149-L161 | ||
filerock/FileRock-Client | 37214f701666e76e723595f8f9ed238a42f6eb06 | filerockclient/workers/filters/abstract/worker.py | python | Worker.__on_terminate | (self) | Called at the end of process | Called at the end of process | [
"Called",
"at",
"the",
"end",
"of",
"process"
] | def __on_terminate(self):
"""
Called at the end of process
"""
self.times = 0 | [
"def",
"__on_terminate",
"(",
"self",
")",
":",
"self",
".",
"times",
"=",
"0"
] | https://github.com/filerock/FileRock-Client/blob/37214f701666e76e723595f8f9ed238a42f6eb06/filerockclient/workers/filters/abstract/worker.py#L110-L114 | ||
biolab/orange2 | db40a9449cb45b507d63dcd5739b223f9cffb8e6 | Orange/OrangeCanvas/gui/toolbox.py | python | ToolBox.setTabButtonHeight | (self, height) | Set the tab button height. | Set the tab button height. | [
"Set",
"the",
"tab",
"button",
"height",
"."
] | def setTabButtonHeight(self, height):
"""
Set the tab button height.
"""
if self.__tabButtonHeight != height:
self.__tabButtonHeight = height
for page in self.__pages:
page.button.setFixedHeight(height) | [
"def",
"setTabButtonHeight",
"(",
"self",
",",
"height",
")",
":",
"if",
"self",
".",
"__tabButtonHeight",
"!=",
"height",
":",
"self",
".",
"__tabButtonHeight",
"=",
"height",
"for",
"page",
"in",
"self",
".",
"__pages",
":",
"page",
".",
"button",
".",
... | https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/Orange/OrangeCanvas/gui/toolbox.py#L295-L302 | ||
beancount/fava | 69614956d3c01074403af0a07ddbaa986cf602a0 | src/fava/json_api.py | python | get_api_endpoint | (func: Callable[[], Any]) | return cast(Callable[[], Any], _wrapper) | Register a GET endpoint. | Register a GET endpoint. | [
"Register",
"a",
"GET",
"endpoint",
"."
] | def get_api_endpoint(func: Callable[[], Any]) -> Callable[[], Any]:
"""Register a GET endpoint."""
@json_api.route(f"/{func.__name__}", methods=["GET"])
@functools.wraps(func)
def _wrapper() -> Any:
return json_success(func())
return cast(Callable[[], Any], _wrapper) | [
"def",
"get_api_endpoint",
"(",
"func",
":",
"Callable",
"[",
"[",
"]",
",",
"Any",
"]",
")",
"->",
"Callable",
"[",
"[",
"]",
",",
"Any",
"]",
":",
"@",
"json_api",
".",
"route",
"(",
"f\"/{func.__name__}\"",
",",
"methods",
"=",
"[",
"\"GET\"",
"]"... | https://github.com/beancount/fava/blob/69614956d3c01074403af0a07ddbaa986cf602a0/src/fava/json_api.py#L54-L62 | |
O365/python-o365 | 7f77005c3cee8177d0141e79b8eda8a7b60c5124 | O365/connection.py | python | Protocol.__init__ | (self, *, protocol_url=None, api_version=None,
default_resource=None,
casing_function=None, protocol_scope_prefix=None,
timezone=None, **kwargs) | Create a new protocol object
:param str protocol_url: the base url used to communicate with the
server
:param str api_version: the api version
:param str default_resource: the default resource to use when there is
nothing explicitly specified during the requests
:param... | Create a new protocol object | [
"Create",
"a",
"new",
"protocol",
"object"
] | def __init__(self, *, protocol_url=None, api_version=None,
default_resource=None,
casing_function=None, protocol_scope_prefix=None,
timezone=None, **kwargs):
""" Create a new protocol object
:param str protocol_url: the base url used to communicate wit... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"protocol_url",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"default_resource",
"=",
"None",
",",
"casing_function",
"=",
"None",
",",
"protocol_scope_prefix",
"=",
"None",
",",
"timezone",
"=",
"None",
... | https://github.com/O365/python-o365/blob/7f77005c3cee8177d0141e79b8eda8a7b60c5124/O365/connection.py#L70-L111 | ||
doorstop-dev/doorstop | 03aa287e5069e29da6979274e1cb6714ee450d3a | scent.py | python | python_files | (filename) | return filename.endswith('.py') | [] | def python_files(filename):
return filename.endswith('.py') | [
"def",
"python_files",
"(",
"filename",
")",
":",
"return",
"filename",
".",
"endswith",
"(",
"'.py'",
")"
] | https://github.com/doorstop-dev/doorstop/blob/03aa287e5069e29da6979274e1cb6714ee450d3a/scent.py#L37-L38 | |||
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/requests/utils.py | python | get_encodings_from_content | (content) | return (charset_re.findall(content) +
pragma_re.findall(content) +
xml_re.findall(content)) | Returns encodings from given content string.
:param content: bytestring to extract encodings from. | Returns encodings from given content string. | [
"Returns",
"encodings",
"from",
"given",
"content",
"string",
"."
] | def get_encodings_from_content(content):
"""Returns encodings from given content string.
:param content: bytestring to extract encodings from.
"""
warnings.warn((
'In requests 3.0, get_encodings_from_content will be removed. For '
'more information, please see the discussion on issue #2... | [
"def",
"get_encodings_from_content",
"(",
"content",
")",
":",
"warnings",
".",
"warn",
"(",
"(",
"'In requests 3.0, get_encodings_from_content will be removed. For '",
"'more information, please see the discussion on issue #2266. (This'",
"' warning should only appear once.)'",
")",
"... | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/requests/utils.py#L327-L344 | |
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | mac/pyobjc-core/Lib/objc/_properties.py | python | set_proxy.__isub__ | (self, other) | return self | [] | def __isub__(self, other):
if self._ro:
raise ValueError("Property '%s' is read-only"%(self._name,))
self.difference_update(other)
return self | [
"def",
"__isub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"_ro",
":",
"raise",
"ValueError",
"(",
"\"Property '%s' is read-only\"",
"%",
"(",
"self",
".",
"_name",
",",
")",
")",
"self",
".",
"difference_update",
"(",
"other",
")",
"retu... | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/mac/pyobjc-core/Lib/objc/_properties.py#L1004-L1009 | |||
CoinAlpha/hummingbot | 36f6149c1644c07cd36795b915f38b8f49b798e7 | hummingbot/core/web_assistant/ws_assistant.py | python | WSAssistant.subscribe | (self, request: WSRequest) | Will eventually be used to handle automatic re-connection. | Will eventually be used to handle automatic re-connection. | [
"Will",
"eventually",
"be",
"used",
"to",
"handle",
"automatic",
"re",
"-",
"connection",
"."
] | async def subscribe(self, request: WSRequest):
"""Will eventually be used to handle automatic re-connection."""
await self.send(request) | [
"async",
"def",
"subscribe",
"(",
"self",
",",
"request",
":",
"WSRequest",
")",
":",
"await",
"self",
".",
"send",
"(",
"request",
")"
] | https://github.com/CoinAlpha/hummingbot/blob/36f6149c1644c07cd36795b915f38b8f49b798e7/hummingbot/core/web_assistant/ws_assistant.py#L47-L49 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/computing/standalone/_table.py | python | Table.mapValues | (self, func) | return Table(self._table.mapValues(func)) | [] | def mapValues(self, func):
return Table(self._table.mapValues(func)) | [
"def",
"mapValues",
"(",
"self",
",",
"func",
")",
":",
"return",
"Table",
"(",
"self",
".",
"_table",
".",
"mapValues",
"(",
"func",
")",
")"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/computing/standalone/_table.py#L98-L99 | |||
TNTLFreiburg/braindecode | d9feb5c6cfcd203fa8daa79ccd3217712714f330 | braindecode/torch_ext/optimizers.py | python | AdamW.step | (self, closure=None) | return loss | Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss. | Performs a single optimization step. | [
"Performs",
"a",
"single",
"optimization",
"step",
"."
] | def step(self, closure=None):
"""Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss.
"""
loss = None
if closure is not None:
loss = closure()
for... | [
"def",
"step",
"(",
"self",
",",
"closure",
"=",
"None",
")",
":",
"loss",
"=",
"None",
"if",
"closure",
"is",
"not",
"None",
":",
"loss",
"=",
"closure",
"(",
")",
"for",
"group",
"in",
"self",
".",
"param_groups",
":",
"for",
"p",
"in",
"group",
... | https://github.com/TNTLFreiburg/braindecode/blob/d9feb5c6cfcd203fa8daa79ccd3217712714f330/braindecode/torch_ext/optimizers.py#L38-L85 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py | python | rsa_recover_prime_factors | (n, e, d) | return (p, q) | Compute factors p and q from the private exponent d. We assume that n has
no more than two factors. This function is adapted from code in PyCrypto. | Compute factors p and q from the private exponent d. We assume that n has
no more than two factors. This function is adapted from code in PyCrypto. | [
"Compute",
"factors",
"p",
"and",
"q",
"from",
"the",
"private",
"exponent",
"d",
".",
"We",
"assume",
"that",
"n",
"has",
"no",
"more",
"than",
"two",
"factors",
".",
"This",
"function",
"is",
"adapted",
"from",
"code",
"in",
"PyCrypto",
"."
] | def rsa_recover_prime_factors(n, e, d):
"""
Compute factors p and q from the private exponent d. We assume that n has
no more than two factors. This function is adapted from code in PyCrypto.
"""
# See 8.2.2(i) in Handbook of Applied Cryptography.
ktot = d * e - 1
# The quantity d*e-1 is a m... | [
"def",
"rsa_recover_prime_factors",
"(",
"n",
",",
"e",
",",
"d",
")",
":",
"# See 8.2.2(i) in Handbook of Applied Cryptography.",
"ktot",
"=",
"d",
"*",
"e",
"-",
"1",
"# The quantity d*e-1 is a multiple of phi(n), even,",
"# and can be represented as t*2^s.",
"t",
"=",
... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py#L225-L265 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/bz2.py | python | BZ2File.peek | (self, n=0) | Return buffered data without advancing the file position.
Always returns at least one byte of data, unless at EOF.
The exact number of bytes returned is unspecified. | Return buffered data without advancing the file position. | [
"Return",
"buffered",
"data",
"without",
"advancing",
"the",
"file",
"position",
"."
] | def peek(self, n=0):
"""Return buffered data without advancing the file position.
Always returns at least one byte of data, unless at EOF.
The exact number of bytes returned is unspecified.
"""
with self._lock:
self._check_can_read()
# Relies on the undoc... | [
"def",
"peek",
"(",
"self",
",",
"n",
"=",
"0",
")",
":",
"with",
"self",
".",
"_lock",
":",
"self",
".",
"_check_can_read",
"(",
")",
"# Relies on the undocumented fact that BufferedReader.peek()",
"# always returns at least one byte (except at EOF), independent",
"# of ... | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/bz2.py#L160-L171 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/campaign_bid_modifier_service/client.py | python | CampaignBidModifierServiceClient.campaign_bid_modifier_path | (
customer_id: str, campaign_id: str, criterion_id: str,
) | return "customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}".format(
customer_id=customer_id,
campaign_id=campaign_id,
criterion_id=criterion_id,
) | Return a fully-qualified campaign_bid_modifier string. | Return a fully-qualified campaign_bid_modifier string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"campaign_bid_modifier",
"string",
"."
] | def campaign_bid_modifier_path(
customer_id: str, campaign_id: str, criterion_id: str,
) -> str:
"""Return a fully-qualified campaign_bid_modifier string."""
return "customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}".format(
customer_id=customer_id,
... | [
"def",
"campaign_bid_modifier_path",
"(",
"customer_id",
":",
"str",
",",
"campaign_id",
":",
"str",
",",
"criterion_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}\"",
".",
"format",
"(... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/campaign_bid_modifier_service/client.py#L197-L205 | |
pjkundert/cpppo | 4c217b6c06b88bede3888cc5ea2731f271a95086 | server/enip/device.py | python | parse_route_path | ( route_path, trailer_parser=None ) | return route_path | A route path is None/0/False, or list of port/link[/port/link] segments. Allows a single
port/link element to be specified bare, and will en-list it, eg: "--route_path=1/2".
Must either result in a Falsey, or a valid sequence of port/link[/port/link...], followed by
whatever sequence trailer_parser pr... | A route path is None/0/False, or list of port/link[/port/link] segments. Allows a single
port/link element to be specified bare, and will en-list it, eg: "--route_path=1/2".
Must either result in a Falsey, or a valid sequence of port/link[/port/link...], followed by
whatever sequence trailer_parser pr... | [
"A",
"route",
"path",
"is",
"None",
"/",
"0",
"/",
"False",
"or",
"list",
"of",
"port",
"/",
"link",
"[",
"/",
"port",
"/",
"link",
"]",
"segments",
".",
"Allows",
"a",
"single",
"port",
"/",
"link",
"element",
"to",
"be",
"specified",
"bare",
"and... | def parse_route_path( route_path, trailer_parser=None ):
"""A route path is None/0/False, or list of port/link[/port/link] segments. Allows a single
port/link element to be specified bare, and will en-list it, eg: "--route_path=1/2".
Must either result in a Falsey, or a valid sequence of port/link[/po... | [
"def",
"parse_route_path",
"(",
"route_path",
",",
"trailer_parser",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"route_path",
",",
"type_str_base",
")",
":",
"try",
":",
"route_path",
"=",
"json",
".",
"loads",
"(",
"route_path",
")",
"if",
"route_path"... | https://github.com/pjkundert/cpppo/blob/4c217b6c06b88bede3888cc5ea2731f271a95086/server/enip/device.py#L442-L507 | |
astropy/astroquery | 11c9c83fa8e5f948822f8f73c854ec4b72043016 | astroquery/eso/core.py | python | EsoClass.verify_data_exists | (self, dataset) | return 'No data returned' not in content | Given a data set name, return 'True' if ESO has the file and 'False'
otherwise | Given a data set name, return 'True' if ESO has the file and 'False'
otherwise | [
"Given",
"a",
"data",
"set",
"name",
"return",
"True",
"if",
"ESO",
"has",
"the",
"file",
"and",
"False",
"otherwise"
] | def verify_data_exists(self, dataset):
"""
Given a data set name, return 'True' if ESO has the file and 'False'
otherwise
"""
url = 'http://archive.eso.org/wdb/wdb/eso/eso_archive_main/query'
payload = {'dp_id': dataset,
'ascii_out_mode': 'true',
... | [
"def",
"verify_data_exists",
"(",
"self",
",",
"dataset",
")",
":",
"url",
"=",
"'http://archive.eso.org/wdb/wdb/eso/eso_archive_main/query'",
"payload",
"=",
"{",
"'dp_id'",
":",
"dataset",
",",
"'ascii_out_mode'",
":",
"'true'",
",",
"}",
"# Never cache this as it is ... | https://github.com/astropy/astroquery/blob/11c9c83fa8e5f948822f8f73c854ec4b72043016/astroquery/eso/core.py#L879-L893 | |
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/data/owtable.py | python | OWDataTable.update_selection | (self, *_) | [] | def update_selection(self, *_):
self.commit.deferred() | [
"def",
"update_selection",
"(",
"self",
",",
"*",
"_",
")",
":",
"self",
".",
"commit",
".",
"deferred",
"(",
")"
] | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/owtable.py#L647-L648 | ||||
coreemu/core | 7e18a7a72023a69a92ad61d87461bd659ba27f7c | daemon/core/api/grpc/client.py | python | CoreGrpcClient.get_node_service_configs | (
self, session_id: int
) | return self.stub.GetNodeServiceConfigs(request) | Get service data for a node.
:param session_id: session id
:return: response with all node service configs
:raises grpc.RpcError: when session doesn't exist | Get service data for a node. | [
"Get",
"service",
"data",
"for",
"a",
"node",
"."
] | def get_node_service_configs(
self, session_id: int
) -> GetNodeServiceConfigsResponse:
"""
Get service data for a node.
:param session_id: session id
:return: response with all node service configs
:raises grpc.RpcError: when session doesn't exist
"""
... | [
"def",
"get_node_service_configs",
"(",
"self",
",",
"session_id",
":",
"int",
")",
"->",
"GetNodeServiceConfigsResponse",
":",
"request",
"=",
"GetNodeServiceConfigsRequest",
"(",
"session_id",
"=",
"session_id",
")",
"return",
"self",
".",
"stub",
".",
"GetNodeSer... | https://github.com/coreemu/core/blob/7e18a7a72023a69a92ad61d87461bd659ba27f7c/daemon/core/api/grpc/client.py#L896-L907 | |
facebookresearch/mmf | fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f | tools/scripts/features/extract_features_vmb.py | python | FeatureExtractor.get_detectron_features | (self, image_paths) | return feat_list | [] | def get_detectron_features(self, image_paths):
img_tensor, im_scales, im_infos = [], [], []
for image_path in image_paths:
im, im_scale, im_info = self._image_transform(image_path)
img_tensor.append(im)
im_scales.append(im_scale)
im_infos.append(im_info)
... | [
"def",
"get_detectron_features",
"(",
"self",
",",
"image_paths",
")",
":",
"img_tensor",
",",
"im_scales",
",",
"im_infos",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"for",
"image_path",
"in",
"image_paths",
":",
"im",
",",
"im_scale",
",",
"im_info"... | https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/tools/scripts/features/extract_features_vmb.py#L226-L251 | |||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/subprocess.py | python | Popen.poll | (self) | return self._internal_poll() | Check if child process has terminated. Set and return returncode
attribute. | Check if child process has terminated. Set and return returncode
attribute. | [
"Check",
"if",
"child",
"process",
"has",
"terminated",
".",
"Set",
"and",
"return",
"returncode",
"attribute",
"."
] | def poll(self):
"""Check if child process has terminated. Set and return returncode
attribute."""
return self._internal_poll() | [
"def",
"poll",
"(",
"self",
")",
":",
"return",
"self",
".",
"_internal_poll",
"(",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/subprocess.py#L1173-L1176 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/werkzeug/wrappers.py | python | BaseRequest.__enter__ | (self) | return self | [] | def __enter__(self):
return self | [
"def",
"__enter__",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/wrappers.py#L418-L419 | |||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/idlelib/autocomplete_w.py | python | AutoCompleteWindow.hide_window | (self) | [] | def hide_window(self):
if not self.is_active():
return
# unbind events
self.autocompletewindow.event_delete(HIDE_VIRTUAL_EVENT_NAME,
HIDE_FOCUS_OUT_SEQUENCE)
for seq in HIDE_SEQUENCES:
self.widget.event_delete(HIDE_VIR... | [
"def",
"hide_window",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_active",
"(",
")",
":",
"return",
"# unbind events",
"self",
".",
"autocompletewindow",
".",
"event_delete",
"(",
"HIDE_VIRTUAL_EVENT_NAME",
",",
"HIDE_FOCUS_OUT_SEQUENCE",
")",
"for",
"s... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/idlelib/autocomplete_w.py#L439-L476 | ||||
aws/aws-xray-sdk-python | 71436ad7f275c603298da68bee072af7c214cfc3 | aws_xray_sdk/core/models/entity.py | python | Entity.save_origin_trace_header | (self, trace_header) | Temporarily store additional data fields in trace header
to the entity for later propagation. The data will be
cleaned up upon serialization. | Temporarily store additional data fields in trace header
to the entity for later propagation. The data will be
cleaned up upon serialization. | [
"Temporarily",
"store",
"additional",
"data",
"fields",
"in",
"trace",
"header",
"to",
"the",
"entity",
"for",
"later",
"propagation",
".",
"The",
"data",
"will",
"be",
"cleaned",
"up",
"upon",
"serialization",
"."
] | def save_origin_trace_header(self, trace_header):
"""
Temporarily store additional data fields in trace header
to the entity for later propagation. The data will be
cleaned up upon serialization.
"""
setattr(self, ORIGIN_TRACE_HEADER_ATTR_KEY, trace_header) | [
"def",
"save_origin_trace_header",
"(",
"self",
",",
"trace_header",
")",
":",
"setattr",
"(",
"self",
",",
"ORIGIN_TRACE_HEADER_ATTR_KEY",
",",
"trace_header",
")"
] | https://github.com/aws/aws-xray-sdk-python/blob/71436ad7f275c603298da68bee072af7c214cfc3/aws_xray_sdk/core/models/entity.py#L246-L252 | ||
hiidef/oauth2app | 2a4371adc68fb8688df30515f1884d4de0b28b19 | oauth2app/lib/uri.py | python | add_fragments | (url, fragments) | return urlunparse(parts) | Parses URL and appends fragments.
**Args:**
* *url:* URL string.
* *fragments:* Dict of fragments
*Returns str* | Parses URL and appends fragments. | [
"Parses",
"URL",
"and",
"appends",
"fragments",
"."
] | def add_fragments(url, fragments):
"""Parses URL and appends fragments.
**Args:**
* *url:* URL string.
* *fragments:* Dict of fragments
*Returns str*"""
parts = list(urlparse(url))
parts[5] = urlencode(parse_qsl(parts[5]) + fragments.items())
return urlunparse(parts) | [
"def",
"add_fragments",
"(",
"url",
",",
"fragments",
")",
":",
"parts",
"=",
"list",
"(",
"urlparse",
"(",
"url",
")",
")",
"parts",
"[",
"5",
"]",
"=",
"urlencode",
"(",
"parse_qsl",
"(",
"parts",
"[",
"5",
"]",
")",
"+",
"fragments",
".",
"items... | https://github.com/hiidef/oauth2app/blob/2a4371adc68fb8688df30515f1884d4de0b28b19/oauth2app/lib/uri.py#L26-L37 | |
NVIDIA/NeMo | 5b0c0b4dec12d87d3cd960846de4105309ce938e | nemo_text_processing/text_normalization/en/taggers/date.py | python | get_hundreds_graph | (deterministic: bool = True) | return graph | Returns a four digit transducer which is combination of ties/teen or digits
(using hundred instead of thousand format), e.g.
1219 -> twelve nineteen
3900 -> thirty nine hundred | Returns a four digit transducer which is combination of ties/teen or digits
(using hundred instead of thousand format), e.g.
1219 -> twelve nineteen
3900 -> thirty nine hundred | [
"Returns",
"a",
"four",
"digit",
"transducer",
"which",
"is",
"combination",
"of",
"ties",
"/",
"teen",
"or",
"digits",
"(",
"using",
"hundred",
"instead",
"of",
"thousand",
"format",
")",
"e",
".",
"g",
".",
"1219",
"-",
">",
"twelve",
"nineteen",
"3900... | def get_hundreds_graph(deterministic: bool = True):
"""
Returns a four digit transducer which is combination of ties/teen or digits
(using hundred instead of thousand format), e.g.
1219 -> twelve nineteen
3900 -> thirty nine hundred
"""
graph_ties = get_ties_graph(deterministic)
graph = ... | [
"def",
"get_hundreds_graph",
"(",
"deterministic",
":",
"bool",
"=",
"True",
")",
":",
"graph_ties",
"=",
"get_ties_graph",
"(",
"deterministic",
")",
"graph",
"=",
"(",
"graph_ties",
"+",
"insert_space",
"+",
"graph_ties",
"|",
"graph_teen",
"+",
"insert_space"... | https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo_text_processing/text_normalization/en/taggers/date.py#L63-L92 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/jenkinsmod.py | python | job_exists | (name=None) | Check whether the job exists in configured Jenkins jobs.
:param name: The name of the job is check if it exists.
:return: True if job exists, False if job does not exist.
CLI Example:
.. code-block:: bash
salt '*' jenkins.job_exists jobname | Check whether the job exists in configured Jenkins jobs. | [
"Check",
"whether",
"the",
"job",
"exists",
"in",
"configured",
"Jenkins",
"jobs",
"."
] | def job_exists(name=None):
"""
Check whether the job exists in configured Jenkins jobs.
:param name: The name of the job is check if it exists.
:return: True if job exists, False if job does not exist.
CLI Example:
.. code-block:: bash
salt '*' jenkins.job_exists jobname
"""
... | [
"def",
"job_exists",
"(",
"name",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"raise",
"SaltInvocationError",
"(",
"\"Required parameter 'name' is missing\"",
")",
"server",
"=",
"_connect",
"(",
")",
"if",
"server",
".",
"job_exists",
"(",
"name",
")",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/jenkinsmod.py#L179-L200 | ||
Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks | 40c985b9a9ff1189ddf278462440b120cf96b196 | libs/scapy/plist.py | python | PacketList.rawhexdump | (self) | Prints an hexadecimal dump of each packet in the list | Prints an hexadecimal dump of each packet in the list | [
"Prints",
"an",
"hexadecimal",
"dump",
"of",
"each",
"packet",
"in",
"the",
"list"
] | def rawhexdump(self):
# type: (Optional[Callable]) -> None
"""Prints an hexadecimal dump of each packet in the list"""
for p in self:
hexdump(self._elt2pkt(p)) | [
"def",
"rawhexdump",
"(",
"self",
")",
":",
"# type: (Optional[Callable]) -> None",
"for",
"p",
"in",
"self",
":",
"hexdump",
"(",
"self",
".",
"_elt2pkt",
"(",
"p",
")",
")"
] | https://github.com/Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks/blob/40c985b9a9ff1189ddf278462440b120cf96b196/libs/scapy/plist.py#L310-L314 | ||
rdiff-backup/rdiff-backup | 321e0cd6e5e47d4c158a0172e47ab38240a8b653 | src/rdiff_backup/connection.py | python | LowLevelPipeConnection.__str__ | (self) | return "LowLevelPipeConnection" | Return string version
This is actually an important function, because otherwise
requests to represent this object would result in "__str__"
being executed on the other side of the connection. | Return string version | [
"Return",
"string",
"version"
] | def __str__(self):
"""Return string version
This is actually an important function, because otherwise
requests to represent this object would result in "__str__"
being executed on the other side of the connection.
"""
return "LowLevelPipeConnection" | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"\"LowLevelPipeConnection\""
] | https://github.com/rdiff-backup/rdiff-backup/blob/321e0cd6e5e47d4c158a0172e47ab38240a8b653/src/rdiff_backup/connection.py#L164-L172 | |
marinho/geraldo | 868ebdce67176d9b6205cddc92476f642c783fff | site/newsite/site-geraldo/django/dispatch/dispatcher.py | python | Signal._remove_receiver | (self, receiver) | Remove dead receivers from connections. | Remove dead receivers from connections. | [
"Remove",
"dead",
"receivers",
"from",
"connections",
"."
] | def _remove_receiver(self, receiver):
"""Remove dead receivers from connections."""
to_remove = []
for key, connected_receiver in self.receivers:
if connected_receiver == receiver:
to_remove.append(key)
for key in to_remove:
for idx, (r_key, _) in... | [
"def",
"_remove_receiver",
"(",
"self",
",",
"receiver",
")",
":",
"to_remove",
"=",
"[",
"]",
"for",
"key",
",",
"connected_receiver",
"in",
"self",
".",
"receivers",
":",
"if",
"connected_receiver",
"==",
"receiver",
":",
"to_remove",
".",
"append",
"(",
... | https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/site-geraldo/django/dispatch/dispatcher.py#L204-L214 | ||
fabioz/PyDev.Debugger | 0f8c02a010fe5690405da1dd30ed72326191ce63 | pydevd_attach_to_process/winappdbg/process.py | python | Process.scan | (self) | Populates the snapshot of threads and modules. | Populates the snapshot of threads and modules. | [
"Populates",
"the",
"snapshot",
"of",
"threads",
"and",
"modules",
"."
] | def scan(self):
"""
Populates the snapshot of threads and modules.
"""
self.scan_threads()
self.scan_modules() | [
"def",
"scan",
"(",
"self",
")",
":",
"self",
".",
"scan_threads",
"(",
")",
"self",
".",
"scan_modules",
"(",
")"
] | https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/pydevd_attach_to_process/winappdbg/process.py#L466-L471 | ||
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_vendor/pygments/formatters/img.py | python | ImageFormatter._get_text_bg_color | (self, style) | return bg_color | Get the correct background color for the token from the style. | Get the correct background color for the token from the style. | [
"Get",
"the",
"correct",
"background",
"color",
"for",
"the",
"token",
"from",
"the",
"style",
"."
] | def _get_text_bg_color(self, style):
"""
Get the correct background color for the token from the style.
"""
if style['bgcolor'] is not None:
bg_color = '#' + style['bgcolor']
else:
bg_color = None
return bg_color | [
"def",
"_get_text_bg_color",
"(",
"self",
",",
"style",
")",
":",
"if",
"style",
"[",
"'bgcolor'",
"]",
"is",
"not",
"None",
":",
"bg_color",
"=",
"'#'",
"+",
"style",
"[",
"'bgcolor'",
"]",
"else",
":",
"bg_color",
"=",
"None",
"return",
"bg_color"
] | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/pygments/formatters/img.py#L455-L463 | |
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/protocols/endorse_transaction/v1_0/messages/endorsed_transaction_response.py | python | EndorsedTransactionResponse.__init__ | (
self,
*,
transaction_id: str = None,
thread_id: str = None,
signature_response: dict = None,
state: str = None,
endorser_did: str = None,
ledger_response: dict = None,
**kwargs,
) | Initialize an endorsed transaction response object.
Args:
transaction_id: The id of the transaction record
thread_id: The thread id of the transaction record
signature_response: The response created to endorse the transaction
state: The state of the transaction r... | Initialize an endorsed transaction response object. | [
"Initialize",
"an",
"endorsed",
"transaction",
"response",
"object",
"."
] | def __init__(
self,
*,
transaction_id: str = None,
thread_id: str = None,
signature_response: dict = None,
state: str = None,
endorser_did: str = None,
ledger_response: dict = None,
**kwargs,
):
"""
Initialize an endorsed transa... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"transaction_id",
":",
"str",
"=",
"None",
",",
"thread_id",
":",
"str",
"=",
"None",
",",
"signature_response",
":",
"dict",
"=",
"None",
",",
"state",
":",
"str",
"=",
"None",
",",
"endorser_did",
":",
... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/endorsed_transaction_response.py#L26-L54 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/feature/feature_scale/base_scale.py | python | BaseScale.set_column_range | (self, upper, lower) | [] | def set_column_range(self, upper, lower):
self.column_max_value = upper
self.column_min_value = lower | [
"def",
"set_column_range",
"(",
"self",
",",
"upper",
",",
"lower",
")",
":",
"self",
".",
"column_max_value",
"=",
"upper",
"self",
".",
"column_min_value",
"=",
"lower"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/feature/feature_scale/base_scale.py#L197-L199 | ||||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/websocket/_socket.py | python | setdefaulttimeout | (timeout) | Set the global timeout setting to connect.
timeout: default socket timeout time. This value is second. | Set the global timeout setting to connect. | [
"Set",
"the",
"global",
"timeout",
"setting",
"to",
"connect",
"."
] | def setdefaulttimeout(timeout):
"""
Set the global timeout setting to connect.
timeout: default socket timeout time. This value is second.
"""
global _default_timeout
_default_timeout = timeout | [
"def",
"setdefaulttimeout",
"(",
"timeout",
")",
":",
"global",
"_default_timeout",
"_default_timeout",
"=",
"timeout"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/websocket/_socket.py#L58-L65 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/CofenseTriage/Integrations/CofenseTriagev3/CofenseTriagev3.py | python | prepare_hr_for_reporters | (results: List[Dict[str, Any]]) | return tableToMarkdown("Reporter(s)", reporters_hr,
headers=["Reporter ID", "Reporter Email", "Reports Count", "Reputation Score", "VIP",
"Last Reported At", CREATED_AT, UPDATED_AT], removeNull=True) | Parse and convert the reporters in the response into human-readable markdown string.
:type results: ``List[Dict[str, Any]]``
:param results: Details of reporters.
:return: Human Readable string containing information of reporters.
:rtype: ``str`` | Parse and convert the reporters in the response into human-readable markdown string. | [
"Parse",
"and",
"convert",
"the",
"reporters",
"in",
"the",
"response",
"into",
"human",
"-",
"readable",
"markdown",
"string",
"."
] | def prepare_hr_for_reporters(results: List[Dict[str, Any]]) -> str:
"""
Parse and convert the reporters in the response into human-readable markdown string.
:type results: ``List[Dict[str, Any]]``
:param results: Details of reporters.
:return: Human Readable string containing information of report... | [
"def",
"prepare_hr_for_reporters",
"(",
"results",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
")",
"->",
"str",
":",
"reporters_hr",
"=",
"[",
"]",
"for",
"res",
"in",
"results",
":",
"attributes",
"=",
"res",
".",
"get",
"(",
"\"att... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/CofenseTriage/Integrations/CofenseTriagev3/CofenseTriagev3.py#L874-L901 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/ndimage/morphology.py | python | morphological_gradient | (input, size=None, footprint=None, structure=None,
output=None, mode="reflect", cval=0.0, origin=0) | Multi-dimensional morphological gradient.
The morphological gradient is calculated as the difference between a
dilation and an erosion of the input with a given structuring element.
Parameters
----------
input : array_like
Array over which to compute the morphlogical gradient.
size : t... | Multi-dimensional morphological gradient. | [
"Multi",
"-",
"dimensional",
"morphological",
"gradient",
"."
] | def morphological_gradient(input, size=None, footprint=None, structure=None,
output=None, mode="reflect", cval=0.0, origin=0):
"""
Multi-dimensional morphological gradient.
The morphological gradient is calculated as the difference between a
dilation and an erosion of the inp... | [
"def",
"morphological_gradient",
"(",
"input",
",",
"size",
"=",
"None",
",",
"footprint",
"=",
"None",
",",
"structure",
"=",
"None",
",",
"output",
"=",
"None",
",",
"mode",
"=",
"\"reflect\"",
",",
"cval",
"=",
"0.0",
",",
"origin",
"=",
"0",
")",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/ndimage/morphology.py#L1534-L1644 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/urllib3/exceptions.py | python | RequestError.__init__ | (self, pool, url, message) | [] | def __init__(self, pool, url, message):
self.url = url
PoolError.__init__(self, pool, message) | [
"def",
"__init__",
"(",
"self",
",",
"pool",
",",
"url",
",",
"message",
")",
":",
"self",
".",
"url",
"=",
"url",
"PoolError",
".",
"__init__",
"(",
"self",
",",
"pool",
",",
"message",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/urllib3/exceptions.py#L31-L33 | ||||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/geometry/manipulation_paths/overhang.py | python | getManipulatedPaths | (close, elementNode, loop, prefix, sideLength) | return [euclidean.getLoopWithoutCloseSequentialPoints(close, alongAway.loop)] | Get path with overhangs removed or filled in. | Get path with overhangs removed or filled in. | [
"Get",
"path",
"with",
"overhangs",
"removed",
"or",
"filled",
"in",
"."
] | def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
"Get path with overhangs removed or filled in."
if len(loop) < 3:
print('Warning, loop has less than three sides in getManipulatedPaths in overhang for:')
print(elementNode)
return [loop]
derivation = OverhangDerivation(elementNode, prefix)... | [
"def",
"getManipulatedPaths",
"(",
"close",
",",
"elementNode",
",",
"loop",
",",
"prefix",
",",
"sideLength",
")",
":",
"if",
"len",
"(",
"loop",
")",
"<",
"3",
":",
"print",
"(",
"'Warning, loop has less than three sides in getManipulatedPaths in overhang for:'",
... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/manipulation_paths/overhang.py#L105-L124 | |
JimmXinu/FanFicFare | bc149a2deb2636320fe50a3e374af6eef8f61889 | included_dependencies/html2text/utils.py | python | reformat_table | (lines, right_margin) | return new_lines | Given the lines of a table
padds the cells and returns the new lines | Given the lines of a table
padds the cells and returns the new lines | [
"Given",
"the",
"lines",
"of",
"a",
"table",
"padds",
"the",
"cells",
"and",
"returns",
"the",
"new",
"lines"
] | def reformat_table(lines, right_margin):
"""
Given the lines of a table
padds the cells and returns the new lines
"""
# find the maximum width of the columns
max_width = [len(x.rstrip()) + right_margin for x in lines[0].split('|')]
max_cols = len(max_width)
for line in lines:
col... | [
"def",
"reformat_table",
"(",
"lines",
",",
"right_margin",
")",
":",
"# find the maximum width of the columns",
"max_width",
"=",
"[",
"len",
"(",
"x",
".",
"rstrip",
"(",
")",
")",
"+",
"right_margin",
"for",
"x",
"in",
"lines",
"[",
"0",
"]",
".",
"spli... | https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/html2text/utils.py#L248-L286 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/zmq/error.py | python | ZMQError.__init__ | (self, errno=None, msg=None) | Wrap an errno style error.
Parameters
----------
errno : int
The ZMQ errno or None. If None, then ``zmq_errno()`` is called and
used.
msg : string
Description of the error or None. | Wrap an errno style error. | [
"Wrap",
"an",
"errno",
"style",
"error",
"."
] | def __init__(self, errno=None, msg=None):
"""Wrap an errno style error.
Parameters
----------
errno : int
The ZMQ errno or None. If None, then ``zmq_errno()`` is called and
used.
msg : string
Description of the error or None.
"""
... | [
"def",
"__init__",
"(",
"self",
",",
"errno",
"=",
"None",
",",
"msg",
"=",
"None",
")",
":",
"from",
"zmq",
".",
"backend",
"import",
"strerror",
",",
"zmq_errno",
"if",
"errno",
"is",
"None",
":",
"errno",
"=",
"zmq_errno",
"(",
")",
"if",
"isinsta... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/zmq/error.py#L26-L50 | ||
Map-A-Droid/MAD | 81375b5c9ccc5ca3161eb487aa81469d40ded221 | mapadroid/webhook/webhookworker.py | python | WebhookWorker.__payload_type_count | (self, payload) | return count | [] | def __payload_type_count(self, payload):
count = {}
for elem in payload:
count[elem["type"]] = count.get(elem["type"], 0) + 1
return count | [
"def",
"__payload_type_count",
"(",
"self",
",",
"payload",
")",
":",
"count",
"=",
"{",
"}",
"for",
"elem",
"in",
"payload",
":",
"count",
"[",
"elem",
"[",
"\"type\"",
"]",
"]",
"=",
"count",
".",
"get",
"(",
"elem",
"[",
"\"type\"",
"]",
",",
"0... | https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/webhook/webhookworker.py#L49-L55 | |||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/inject/extra/dbgtool/dbgtool.py | python | convert | (inputFile) | return script | [] | def convert(inputFile):
fileStat = os.stat(inputFile)
fileSize = fileStat.st_size
if fileSize > 65280:
print "ERROR: the provided input file '%s' is too big for debug.exe" % inputFile
sys.exit(1)
script = "n %s\nr cx\n" % os.path.basename(inputFile.replace(".", "_"))
script += "%x\... | [
"def",
"convert",
"(",
"inputFile",
")",
":",
"fileStat",
"=",
"os",
".",
"stat",
"(",
"inputFile",
")",
"fileSize",
"=",
"fileStat",
".",
"st_size",
"if",
"fileSize",
">",
"65280",
":",
"print",
"\"ERROR: the provided input file '%s' is too big for debug.exe\"",
... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/extra/dbgtool/dbgtool.py#L17-L58 | |||
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/jax/layers/embedding_softmax.py | python | RotaryPositionalEmbedding.extend_step | (self,
theta: NestedMap,
inputs: JTensor,
time_step: Optional[Union[int, JTensor]] = None) | return output | Generates a JTensor of sinusoids with different frequencies for a step.
Args:
theta: A `.NestedMap` object containing weights' values of this layer and
its children layers.
inputs: The input sequence on which to apply the Rotary position
embedding. Since rotary position embeddings are a... | Generates a JTensor of sinusoids with different frequencies for a step. | [
"Generates",
"a",
"JTensor",
"of",
"sinusoids",
"with",
"different",
"frequencies",
"for",
"a",
"step",
"."
] | def extend_step(self,
theta: NestedMap,
inputs: JTensor,
time_step: Optional[Union[int, JTensor]] = None) -> JTensor:
"""Generates a JTensor of sinusoids with different frequencies for a step.
Args:
theta: A `.NestedMap` object containing weights' val... | [
"def",
"extend_step",
"(",
"self",
",",
"theta",
":",
"NestedMap",
",",
"inputs",
":",
"JTensor",
",",
"time_step",
":",
"Optional",
"[",
"Union",
"[",
"int",
",",
"JTensor",
"]",
"]",
"=",
"None",
")",
"->",
"JTensor",
":",
"assert",
"len",
"(",
"in... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/jax/layers/embedding_softmax.py#L351-L386 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/nova/nova/virt/powervm/operator.py | python | BaseOperator.set_lpar_mac_base_value | (self, instance_name, mac) | Set LPAR's property virtual_eth_mac_base_value
:param instance_name: name of the instance to be set
:param mac: mac of virtual ethernet | Set LPAR's property virtual_eth_mac_base_value | [
"Set",
"LPAR",
"s",
"property",
"virtual_eth_mac_base_value"
] | def set_lpar_mac_base_value(self, instance_name, mac):
"""Set LPAR's property virtual_eth_mac_base_value
:param instance_name: name of the instance to be set
:param mac: mac of virtual ethernet
"""
# NOTE(ldbragst) We only use the base mac value because the last
# byte i... | [
"def",
"set_lpar_mac_base_value",
"(",
"self",
",",
"instance_name",
",",
"mac",
")",
":",
"# NOTE(ldbragst) We only use the base mac value because the last",
"# byte is the slot id of the virtual NIC, which doesn't change.",
"mac_base_value",
"=",
"mac",
"[",
":",
"-",
"2",
"]... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/virt/powervm/operator.py#L764-L776 | ||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/metadataserver/models/scriptset.py | python | ScriptSet.select_for_hardware_scripts | (self, modaliases=None) | Select for_hardware scripts for the given node and user input.
Goes through an existing ScriptSet and adds any for_hardware tagged
Script and removes those that were autoselected but the hardware has
been removed. | Select for_hardware scripts for the given node and user input. | [
"Select",
"for_hardware",
"scripts",
"for",
"the",
"given",
"node",
"and",
"user",
"input",
"."
] | def select_for_hardware_scripts(self, modaliases=None):
"""Select for_hardware scripts for the given node and user input.
Goes through an existing ScriptSet and adds any for_hardware tagged
Script and removes those that were autoselected but the hardware has
been removed.
"""
... | [
"def",
"select_for_hardware_scripts",
"(",
"self",
",",
"modaliases",
"=",
"None",
")",
":",
"# Only the builtin commissioning scripts run on controllers.",
"if",
"self",
".",
"node",
".",
"is_controller",
":",
"return",
"if",
"modaliases",
"is",
"None",
":",
"modalia... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/metadataserver/models/scriptset.py#L487-L557 | ||
Johnson0722/CTR_Prediction | ec4de3d2654c5d808ff633d9a10cdd04d636db1e | FM/FM.py | python | check_restore_parameters | (sess, saver) | Restore the previously trained parameters if there are any. | Restore the previously trained parameters if there are any. | [
"Restore",
"the",
"previously",
"trained",
"parameters",
"if",
"there",
"are",
"any",
"."
] | def check_restore_parameters(sess, saver):
""" Restore the previously trained parameters if there are any. """
ckpt = tf.train.get_checkpoint_state("checkpoints")
if ckpt and ckpt.model_checkpoint_path:
logging.info("Loading parameters for the my CNN architectures...")
saver.restore(sess, ck... | [
"def",
"check_restore_parameters",
"(",
"sess",
",",
"saver",
")",
":",
"ckpt",
"=",
"tf",
".",
"train",
".",
"get_checkpoint_state",
"(",
"\"checkpoints\"",
")",
"if",
"ckpt",
"and",
"ckpt",
".",
"model_checkpoint_path",
":",
"logging",
".",
"info",
"(",
"\... | https://github.com/Johnson0722/CTR_Prediction/blob/ec4de3d2654c5d808ff633d9a10cdd04d636db1e/FM/FM.py#L95-L102 | ||
cogitas3d/OrtogOnBlender | 881e93f5beb2263e44c270974dd0e81deca44762 | DesenhaObjetos.py | python | PreparaMalhaCorte.execute | (self, context) | return {'FINISHED'} | [] | def execute(self, context):
PreparaMalhaCorteDef(self, context)
return {'FINISHED'} | [
"def",
"execute",
"(",
"self",
",",
"context",
")",
":",
"PreparaMalhaCorteDef",
"(",
"self",
",",
"context",
")",
"return",
"{",
"'FINISHED'",
"}"
] | https://github.com/cogitas3d/OrtogOnBlender/blob/881e93f5beb2263e44c270974dd0e81deca44762/DesenhaObjetos.py#L1596-L1600 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/_pyio.py | python | _BufferedIOMixin.fileno | (self) | return self.raw.fileno() | [] | def fileno(self):
return self.raw.fileno() | [
"def",
"fileno",
"(",
"self",
")",
":",
"return",
"self",
".",
"raw",
".",
"fileno",
"(",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/_pyio.py#L785-L786 | |||
laughtervv/SGPN | 257f0458a5cd734db1642b8805d547dff72f9840 | utils/pointnet_util.py | python | sample_and_group_all | (xyz, points, use_xyz=True) | return new_xyz, new_points, idx, grouped_xyz | Inputs:
xyz: (batch_size, ndataset, 3) TF tensor
points: (batch_size, ndataset, channel) TF tensor, if None will just use xyz as points
use_xyz: bool, if True concat XYZ with local point features, otherwise just use point features
Outputs:
new_xyz: (batch_size, 1, 3) as (0,0,0)
... | Inputs:
xyz: (batch_size, ndataset, 3) TF tensor
points: (batch_size, ndataset, channel) TF tensor, if None will just use xyz as points
use_xyz: bool, if True concat XYZ with local point features, otherwise just use point features
Outputs:
new_xyz: (batch_size, 1, 3) as (0,0,0)
... | [
"Inputs",
":",
"xyz",
":",
"(",
"batch_size",
"ndataset",
"3",
")",
"TF",
"tensor",
"points",
":",
"(",
"batch_size",
"ndataset",
"channel",
")",
"TF",
"tensor",
"if",
"None",
"will",
"just",
"use",
"xyz",
"as",
"points",
"use_xyz",
":",
"bool",
"if",
... | def sample_and_group_all(xyz, points, use_xyz=True):
'''
Inputs:
xyz: (batch_size, ndataset, 3) TF tensor
points: (batch_size, ndataset, channel) TF tensor, if None will just use xyz as points
use_xyz: bool, if True concat XYZ with local point features, otherwise just use point features
... | [
"def",
"sample_and_group_all",
"(",
"xyz",
",",
"points",
",",
"use_xyz",
"=",
"True",
")",
":",
"batch_size",
"=",
"xyz",
".",
"get_shape",
"(",
")",
"[",
"0",
"]",
".",
"value",
"nsample",
"=",
"xyz",
".",
"get_shape",
"(",
")",
"[",
"1",
"]",
".... | https://github.com/laughtervv/SGPN/blob/257f0458a5cd734db1642b8805d547dff72f9840/utils/pointnet_util.py#L63-L88 | |
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | PyTorch/Translation/Transformer/scripts/deployer_lib.py | python | DeployerLibrary.run_models | (self, models, inputs) | return ret | run the models on inputs, return the outputs and execution times | run the models on inputs, return the outputs and execution times | [
"run",
"the",
"models",
"on",
"inputs",
"return",
"the",
"outputs",
"and",
"execution",
"times"
] | def run_models(self, models, inputs):
''' run the models on inputs, return the outputs and execution times '''
ret = []
for model in models:
torch.cuda.synchronize()
time_start = time.time()
outputs = []
for input in inputs:
with to... | [
"def",
"run_models",
"(",
"self",
",",
"models",
",",
"inputs",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"model",
"in",
"models",
":",
"torch",
".",
"cuda",
".",
"synchronize",
"(",
")",
"time_start",
"=",
"time",
".",
"time",
"(",
")",
"outputs",
"=... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/PyTorch/Translation/Transformer/scripts/deployer_lib.py#L317-L339 | |
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | skeinforge_application/skeinforge_plugins/craft_plugins/fill.py | python | addAroundGridPoint | ( arounds, gridPoint, gridPointInsetX, gridPointInsetY, gridPoints, gridSearchRadius, isBothOrNone, isDoubleJunction, isJunctionWide, paths, pixelTable, width ) | Add the path around the grid point. | Add the path around the grid point. | [
"Add",
"the",
"path",
"around",
"the",
"grid",
"point",
"."
] | def addAroundGridPoint( arounds, gridPoint, gridPointInsetX, gridPointInsetY, gridPoints, gridSearchRadius, isBothOrNone, isDoubleJunction, isJunctionWide, paths, pixelTable, width ):
'Add the path around the grid point.'
closestPathIndex = None
aroundIntersectionPaths = []
for aroundIndex in xrange( len(arounds) )... | [
"def",
"addAroundGridPoint",
"(",
"arounds",
",",
"gridPoint",
",",
"gridPointInsetX",
",",
"gridPointInsetY",
",",
"gridPoints",
",",
"gridSearchRadius",
",",
"isBothOrNone",
",",
"isDoubleJunction",
",",
"isJunctionWide",
",",
"paths",
",",
"pixelTable",
",",
"wid... | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py#L214-L267 | ||
alexgolec/tda-api | 3a5232178ecaad423bd530764e547f968a822ec1 | tda/client/base.py | python | BaseClient.create_watchlist | (self, account_id, watchlist_spec) | return self._post_request(path, watchlist_spec) | Create watchlist for specific account.This method does not verify
that the symbol or asset type are valid.
`Official documentation
<https://developer.tdameritrade.com/watchlist/apis/post/accounts/
%7BaccountId%7D/watchlists-0>`__. | Create watchlist for specific account.This method does not verify
that the symbol or asset type are valid.
`Official documentation
<https://developer.tdameritrade.com/watchlist/apis/post/accounts/
%7BaccountId%7D/watchlists-0>`__. | [
"Create",
"watchlist",
"for",
"specific",
"account",
".",
"This",
"method",
"does",
"not",
"verify",
"that",
"the",
"symbol",
"or",
"asset",
"type",
"are",
"valid",
".",
"Official",
"documentation",
"<https",
":",
"//",
"developer",
".",
"tdameritrade",
".",
... | def create_watchlist(self, account_id, watchlist_spec):
''''Create watchlist for specific account.This method does not verify
that the symbol or asset type are valid.
`Official documentation
<https://developer.tdameritrade.com/watchlist/apis/post/accounts/
%7BaccountId%7D/watchli... | [
"def",
"create_watchlist",
"(",
"self",
",",
"account_id",
",",
"watchlist_spec",
")",
":",
"path",
"=",
"'/v1/accounts/{}/watchlists'",
".",
"format",
"(",
"account_id",
")",
"return",
"self",
".",
"_post_request",
"(",
"path",
",",
"watchlist_spec",
")"
] | https://github.com/alexgolec/tda-api/blob/3a5232178ecaad423bd530764e547f968a822ec1/tda/client/base.py#L1151-L1158 | |
pymeasure/pymeasure | b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e | pymeasure/instruments/keithley/keithley2450.py | python | Keithley2450.use_front_terminals | (self) | Enables the front terminals for measurement, and
disables the rear terminals. | Enables the front terminals for measurement, and
disables the rear terminals. | [
"Enables",
"the",
"front",
"terminals",
"for",
"measurement",
"and",
"disables",
"the",
"rear",
"terminals",
"."
] | def use_front_terminals(self):
""" Enables the front terminals for measurement, and
disables the rear terminals. """
self.write(":ROUT:TERM FRON") | [
"def",
"use_front_terminals",
"(",
"self",
")",
":",
"self",
".",
"write",
"(",
"\":ROUT:TERM FRON\"",
")"
] | https://github.com/pymeasure/pymeasure/blob/b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e/pymeasure/instruments/keithley/keithley2450.py#L623-L626 | ||
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/formats/ttkit.py | python | FlatXMLUnit.has_content | (self) | return super().has_content() | Check whether unit has content.
The attribute-less units will have context None. | Check whether unit has content. | [
"Check",
"whether",
"unit",
"has",
"content",
"."
] | def has_content(self):
"""Check whether unit has content.
The attribute-less units will have context None.
"""
if self.context is None:
return False
return super().has_content() | [
"def",
"has_content",
"(",
"self",
")",
":",
"if",
"self",
".",
"context",
"is",
"None",
":",
"return",
"False",
"return",
"super",
"(",
")",
".",
"has_content",
"(",
")"
] | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/formats/ttkit.py#L750-L757 | |
sentinel-hub/eo-learn | cf964eaf173668d6a374675dbd7c1d244264c11d | ml_tools/eolearn/ml_tools/utilities.py | python | rolling_window | (array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True) | return np.lib.stride_tricks.as_strided(array, shape=new_shape, strides=new_strides) | Create a view of `array` which for every point gives the n-dimensional neighbourhood of size window. New
dimensions are added at the end of `array` or after the corresponding original dimension.
Examples:
.. code-block:: python
>>> a = np.arange(9).reshape(3,3)
>>> rolling_window(a, (2,2)... | Create a view of `array` which for every point gives the n-dimensional neighbourhood of size window. New
dimensions are added at the end of `array` or after the corresponding original dimension. | [
"Create",
"a",
"view",
"of",
"array",
"which",
"for",
"every",
"point",
"gives",
"the",
"n",
"-",
"dimensional",
"neighbourhood",
"of",
"size",
"window",
".",
"New",
"dimensions",
"are",
"added",
"at",
"the",
"end",
"of",
"array",
"or",
"after",
"the",
"... | def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
""" Create a view of `array` which for every point gives the n-dimensional neighbourhood of size window. New
dimensions are added at the end of `array` or after the corresponding original dimension.
Examples:
.. c... | [
"def",
"rolling_window",
"(",
"array",
",",
"window",
"=",
"(",
"0",
",",
")",
",",
"asteps",
"=",
"None",
",",
"wsteps",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"toend",
"=",
"True",
")",
":",
"# pylint: disable=too-many-branches",
"# pylint: disable=... | https://github.com/sentinel-hub/eo-learn/blob/cf964eaf173668d6a374675dbd7c1d244264c11d/ml_tools/eolearn/ml_tools/utilities.py#L31-L199 | |
caktus/django-timepiece | 52515dec027664890efbc535429e1ba1ee152f40 | setup.py | python | _read_requirements | (filename) | return [line.strip() for line in requirements_file.splitlines()
if _is_requirement(line)] | Returns a list of package requirements read from the file. | Returns a list of package requirements read from the file. | [
"Returns",
"a",
"list",
"of",
"package",
"requirements",
"read",
"from",
"the",
"file",
"."
] | def _read_requirements(filename):
"""Returns a list of package requirements read from the file."""
requirements_file = open(filename).read()
return [line.strip() for line in requirements_file.splitlines()
if _is_requirement(line)] | [
"def",
"_read_requirements",
"(",
"filename",
")",
":",
"requirements_file",
"=",
"open",
"(",
"filename",
")",
".",
"read",
"(",
")",
"return",
"[",
"line",
".",
"strip",
"(",
")",
"for",
"line",
"in",
"requirements_file",
".",
"splitlines",
"(",
")",
"... | https://github.com/caktus/django-timepiece/blob/52515dec027664890efbc535429e1ba1ee152f40/setup.py#L10-L14 | |
chainer/chainercv | 7159616642e0be7c5b3ef380b848e16b7e99355b | chainercv/datasets/online_products/online_products_dataset.py | python | _get_online_products | () | return base_path | [] | def _get_online_products():
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'online_products.lock')):
data_root = download.get_dataset_directory(root)
base_path = os.path.join... | [
"def",
"_get_online_products",
"(",
")",
":",
"# To support ChainerMN, the target directory should be locked.",
"with",
"filelock",
".",
"FileLock",
"(",
"os",
".",
"path",
".",
"join",
"(",
"download",
".",
"get_dataset_directory",
"(",
"'pfnet/chainercv/.lock'",
")",
... | https://github.com/chainer/chainercv/blob/7159616642e0be7c5b3ef380b848e16b7e99355b/chainercv/datasets/online_products/online_products_dataset.py#L30-L43 | |||
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/utils/tp_dependent_property.py | python | TPDependentProperty.plot_isobar | (self, P, Tmin=None, Tmax=None, methods_P=[], pts=50,
only_valid=True, show=True) | r'''Method to create a plot of the property vs temperature at a
specific pressure according to
either a specified list of methods, or user methods (if set), or all
methods. User-selectable number of points, and temperature range. If
only_valid is set,:obj:`test_method_validity_P` will be... | r'''Method to create a plot of the property vs temperature at a
specific pressure according to
either a specified list of methods, or user methods (if set), or all
methods. User-selectable number of points, and temperature range. If
only_valid is set,:obj:`test_method_validity_P` will be... | [
"r",
"Method",
"to",
"create",
"a",
"plot",
"of",
"the",
"property",
"vs",
"temperature",
"at",
"a",
"specific",
"pressure",
"according",
"to",
"either",
"a",
"specified",
"list",
"of",
"methods",
"or",
"user",
"methods",
"(",
"if",
"set",
")",
"or",
"al... | def plot_isobar(self, P, Tmin=None, Tmax=None, methods_P=[], pts=50,
only_valid=True, show=True): # pragma: no cover
r'''Method to create a plot of the property vs temperature at a
specific pressure according to
either a specified list of methods, or user methods (if set), o... | [
"def",
"plot_isobar",
"(",
"self",
",",
"P",
",",
"Tmin",
"=",
"None",
",",
"Tmax",
"=",
"None",
",",
"methods_P",
"=",
"[",
"]",
",",
"pts",
"=",
"50",
",",
"only_valid",
"=",
"True",
",",
"show",
"=",
"True",
")",
":",
"# pragma: no cover",
"if",... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/utils/tp_dependent_property.py#L515-L599 | ||
AntreasAntoniou/DAGAN | 6f1a5035df62da8c1459fd7eca61cf74d4a1b4a4 | dagan_networks_wgan.py | python | DAGAN.init_train | (self, learning_rate=1e-4, beta1=0.0, beta2=0.9) | return summary, losses, apply_grads_ops | Initialize training by constructing the summary, loss and ops
:param learning_rate: The learning rate for the Adam optimizer
:param beta1: Beta1 for the Adam optimizer
:param beta2: Beta2 for the Adam optimizer
:return: summary op, losses and training ops. | Initialize training by constructing the summary, loss and ops
:param learning_rate: The learning rate for the Adam optimizer
:param beta1: Beta1 for the Adam optimizer
:param beta2: Beta2 for the Adam optimizer
:return: summary op, losses and training ops. | [
"Initialize",
"training",
"by",
"constructing",
"the",
"summary",
"loss",
"and",
"ops",
":",
"param",
"learning_rate",
":",
"The",
"learning",
"rate",
"for",
"the",
"Adam",
"optimizer",
":",
"param",
"beta1",
":",
"Beta1",
"for",
"the",
"Adam",
"optimizer",
... | def init_train(self, learning_rate=1e-4, beta1=0.0, beta2=0.9):
"""
Initialize training by constructing the summary, loss and ops
:param learning_rate: The learning rate for the Adam optimizer
:param beta1: Beta1 for the Adam optimizer
:param beta2: Beta2 for the Adam optimizer
... | [
"def",
"init_train",
"(",
"self",
",",
"learning_rate",
"=",
"1e-4",
",",
"beta1",
"=",
"0.0",
",",
"beta2",
"=",
"0.9",
")",
":",
"losses",
"=",
"dict",
"(",
")",
"opts",
"=",
"dict",
"(",
")",
"if",
"self",
".",
"num_gpus",
">",
"0",
":",
"devi... | https://github.com/AntreasAntoniou/DAGAN/blob/6f1a5035df62da8c1459fd7eca61cf74d4a1b4a4/dagan_networks_wgan.py#L223-L256 | |
dylanaraps/pywal | 236aa48e741ff8d65c4c3826db2813bf2ee6f352 | pywal/theme.py | python | list_themes | (dark=True) | return [t for t in themes if os.path.isfile(t.path)] | List all installed theme files. | List all installed theme files. | [
"List",
"all",
"installed",
"theme",
"files",
"."
] | def list_themes(dark=True):
"""List all installed theme files."""
dark = "dark" if dark else "light"
themes = os.scandir(os.path.join(MODULE_DIR, "colorschemes", dark))
return [t for t in themes if os.path.isfile(t.path)] | [
"def",
"list_themes",
"(",
"dark",
"=",
"True",
")",
":",
"dark",
"=",
"\"dark\"",
"if",
"dark",
"else",
"\"light\"",
"themes",
"=",
"os",
".",
"scandir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"MODULE_DIR",
",",
"\"colorschemes\"",
",",
"dark",
")"... | https://github.com/dylanaraps/pywal/blob/236aa48e741ff8d65c4c3826db2813bf2ee6f352/pywal/theme.py#L48-L52 | |
meetbill/zabbix_manager | 739e5b51facf19cc6bda2b50f29108f831cf833e | ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/ExcelFormulaParser.py | python | mk_tokenSet_0 | () | return data | [] | def mk_tokenSet_0():
### var1
data = [ 37681618946, 0]
return data | [
"def",
"mk_tokenSet_0",
"(",
")",
":",
"### var1",
"data",
"=",
"[",
"37681618946",
",",
"0",
"]",
"return",
"data"
] | https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/ExcelFormulaParser.py#L664-L667 | |||
google/loaner | 24f9a9e70434e430f1beb4ead87e3675f4b53676 | loaner/web_app/backend/actions/base_action.py | python | BaseAction.__getattribute__ | (self, attr) | return super(BaseAction, self).__getattribute__(attr) | [] | def __getattribute__(self, attr):
if attr == 'run':
return super(BaseAction, self).__getattribute__(
'_validate_and_execute_run')
return super(BaseAction, self).__getattribute__(attr) | [
"def",
"__getattribute__",
"(",
"self",
",",
"attr",
")",
":",
"if",
"attr",
"==",
"'run'",
":",
"return",
"super",
"(",
"BaseAction",
",",
"self",
")",
".",
"__getattribute__",
"(",
"'_validate_and_execute_run'",
")",
"return",
"super",
"(",
"BaseAction",
"... | https://github.com/google/loaner/blob/24f9a9e70434e430f1beb4ead87e3675f4b53676/loaner/web_app/backend/actions/base_action.py#L136-L140 | |||
mathics/Mathics | 318e06dea8f1c70758a50cb2f95c9900150e3a68 | mathics/builtin/pympler/asizeof.py | python | _typedefof | (obj, save=False, **opts) | return v | Get the typedef for an object. | Get the typedef for an object. | [
"Get",
"the",
"typedef",
"for",
"an",
"object",
"."
] | def _typedefof(obj, save=False, **opts):
"""Get the typedef for an object."""
k = _objkey(obj)
v = _typedefs.get(k, None)
if not v: # new typedef
v = _typedef(obj, **opts)
if save:
_typedefs[k] = v
return v | [
"def",
"_typedefof",
"(",
"obj",
",",
"save",
"=",
"False",
",",
"*",
"*",
"opts",
")",
":",
"k",
"=",
"_objkey",
"(",
"obj",
")",
"v",
"=",
"_typedefs",
".",
"get",
"(",
"k",
",",
"None",
")",
"if",
"not",
"v",
":",
"# new typedef",
"v",
"=",
... | https://github.com/mathics/Mathics/blob/318e06dea8f1c70758a50cb2f95c9900150e3a68/mathics/builtin/pympler/asizeof.py#L2954-L2962 | |
EasonLiao/CudaTree | fcd9c7f4dbac00c105bbfbff9f55db1d29747fc7 | cudatree/random_tree.py | python | RandomClassifierTree.__get_block_size | (self, n_samples) | return n_block, int(math.ceil(float(n_samples) / n_block)) | [] | def __get_block_size(self, n_samples):
n_block = int(math.ceil(float(n_samples) / 2000))
if n_block > self.MAX_BLOCK_PER_FEATURE:
n_block = self.MAX_BLOCK_PER_FEATURE
return n_block, int(math.ceil(float(n_samples) / n_block)) | [
"def",
"__get_block_size",
"(",
"self",
",",
"n_samples",
")",
":",
"n_block",
"=",
"int",
"(",
"math",
".",
"ceil",
"(",
"float",
"(",
"n_samples",
")",
"/",
"2000",
")",
")",
"if",
"n_block",
">",
"self",
".",
"MAX_BLOCK_PER_FEATURE",
":",
"n_block",
... | https://github.com/EasonLiao/CudaTree/blob/fcd9c7f4dbac00c105bbfbff9f55db1d29747fc7/cudatree/random_tree.py#L515-L519 | |||
openstack/barbican | a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce | barbican/plugin/dogtag.py | python | DogtagCAPlugin._are_subcas_enabled_on_backend | (self, connection) | return False | Check if subca feature is available
SubCA creation must be supported in both the Dogtag client as well
as on the back-end server. Moreover, it must be enabled on the
backend server. This method sets the subcas_available global variable.
:return: True/False | Check if subca feature is available | [
"Check",
"if",
"subca",
"feature",
"is",
"available"
] | def _are_subcas_enabled_on_backend(self, connection):
"""Check if subca feature is available
SubCA creation must be supported in both the Dogtag client as well
as on the back-end server. Moreover, it must be enabled on the
backend server. This method sets the subcas_available global v... | [
"def",
"_are_subcas_enabled_on_backend",
"(",
"self",
",",
"connection",
")",
":",
"global",
"subcas_available",
"if",
"subcas_available",
":",
"# subcas are supported in the Dogtag client",
"try",
":",
"feature_client",
"=",
"feature",
".",
"FeatureClient",
"(",
"connect... | https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/plugin/dogtag.py#L754-L778 | |
superfell/Beatbox | 14f35e83d2bca254406f003a5a8559d6cc42f56b | beatbox/_beatbox.py | python | Client.useSession | (self, sessionId, serverUrl) | Initialize from an existing sessionId & serverUrl
Useful if we're being launched via a custom link | Initialize from an existing sessionId & serverUrl | [
"Initialize",
"from",
"an",
"existing",
"sessionId",
"&",
"serverUrl"
] | def useSession(self, sessionId, serverUrl):
"""Initialize from an existing sessionId & serverUrl
Useful if we're being launched via a custom link
"""
self.sessionId = sessionId
self.__serverUrl = serverUrl
(scheme, host, path, params, query, frag) = urlparse(self.__serve... | [
"def",
"useSession",
"(",
"self",
",",
"sessionId",
",",
"serverUrl",
")",
":",
"self",
".",
"sessionId",
"=",
"sessionId",
"self",
".",
"__serverUrl",
"=",
"serverUrl",
"(",
"scheme",
",",
"host",
",",
"path",
",",
"params",
",",
"query",
",",
"frag",
... | https://github.com/superfell/Beatbox/blob/14f35e83d2bca254406f003a5a8559d6cc42f56b/beatbox/_beatbox.py#L73-L81 | ||
avrae/avrae | 6ebe46a1ec3d4dfaa2f9b18fac948325f39f87de | cogsmisc/tutorials/models.py | python | TutorialState.objective | (self, ctx, state_map) | Displays the current objective.
:type ctx: utils.context.AvraeContext
:type state_map: TutorialStateMap | Displays the current objective. | [
"Displays",
"the",
"current",
"objective",
"."
] | async def objective(self, ctx, state_map):
"""
Displays the current objective.
:type ctx: utils.context.AvraeContext
:type state_map: TutorialStateMap
"""
raise NotImplementedError | [
"async",
"def",
"objective",
"(",
"self",
",",
"ctx",
",",
"state_map",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/avrae/avrae/blob/6ebe46a1ec3d4dfaa2f9b18fac948325f39f87de/cogsmisc/tutorials/models.py#L70-L77 | ||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/contrib/numpy-1.1.0/numpy/fft/fftpack.py | python | rfft2 | (a, s=None, axes=(-2,-1)) | return rfftn(a, s, axes) | rfft2(a, s=None, axes=(-2,-1))
The 2d fft of the real valued array a. This is really just rfftn with
different default behavior. | rfft2(a, s=None, axes=(-2,-1)) | [
"rfft2",
"(",
"a",
"s",
"=",
"None",
"axes",
"=",
"(",
"-",
"2",
"-",
"1",
"))"
] | def rfft2(a, s=None, axes=(-2,-1)):
"""rfft2(a, s=None, axes=(-2,-1))
The 2d fft of the real valued array a. This is really just rfftn with
different default behavior."""
return rfftn(a, s, axes) | [
"def",
"rfft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
")",
":",
"return",
"rfftn",
"(",
"a",
",",
"s",
",",
"axes",
")"
] | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/numpy-1.1.0/numpy/fft/fftpack.py#L289-L295 | |
spender-sandbox/cuckoo-modified | eb93ef3d41b8fee51b4330306dcd315d8101e021 | lib/cuckoo/common/peepdf/PDFCore.py | python | PDFParser.createPDFTrailer | (self, rawContent, offset, streamPresent = False) | return (0,trailer) | Create a PDFTrailer instance from the raw content of the PDF file
@param rawContent String with the raw content of the PDF body (string)
@param offset Offset of the trailer in the PDF file (int)
@param streamPresent It specifies if an object stream exists in the PDF body
... | Create a PDFTrailer instance from the raw content of the PDF file | [
"Create",
"a",
"PDFTrailer",
"instance",
"from",
"the",
"raw",
"content",
"of",
"the",
"PDF",
"file"
] | def createPDFTrailer (self, rawContent, offset, streamPresent = False) :
'''
Create a PDFTrailer instance from the raw content of the PDF file
@param rawContent String with the raw content of the PDF body (string)
@param offset Offset of the trailer in the PDF file (int)
... | [
"def",
"createPDFTrailer",
"(",
"self",
",",
"rawContent",
",",
"offset",
",",
"streamPresent",
"=",
"False",
")",
":",
"global",
"pdfFile",
",",
"isForceMode",
"trailer",
"=",
"None",
"self",
".",
"charCounter",
"=",
"0",
"if",
"not",
"isinstance",
"(",
"... | https://github.com/spender-sandbox/cuckoo-modified/blob/eb93ef3d41b8fee51b4330306dcd315d8101e021/lib/cuckoo/common/peepdf/PDFCore.py#L7521-L7575 | |
alecwangcq/EigenDamage-Pytorch | 0e2174f80294773e76a8cb73c0bd03f1b7fd2ccf | main_prune_separable.py | python | count_rotation_numels | (model) | return total | Count how many parameters in the rotation matrix.
Call this only when they are not trainable for complementing
the number of parameters. | Count how many parameters in the rotation matrix.
Call this only when they are not trainable for complementing
the number of parameters. | [
"Count",
"how",
"many",
"parameters",
"in",
"the",
"rotation",
"matrix",
".",
"Call",
"this",
"only",
"when",
"they",
"are",
"not",
"trainable",
"for",
"complementing",
"the",
"number",
"of",
"parameters",
"."
] | def count_rotation_numels(model):
"""Count how many parameters in the rotation matrix.
Call this only when they are not trainable for complementing
the number of parameters.
"""
total = 0
for m in model.modules():
if isinstance(m, (ConvLayerRotation, LinearLayerRotation)):
to... | [
"def",
"count_rotation_numels",
"(",
"model",
")",
":",
"total",
"=",
"0",
"for",
"m",
"in",
"model",
".",
"modules",
"(",
")",
":",
"if",
"isinstance",
"(",
"m",
",",
"(",
"ConvLayerRotation",
",",
"LinearLayerRotation",
")",
")",
":",
"total",
"+=",
... | https://github.com/alecwangcq/EigenDamage-Pytorch/blob/0e2174f80294773e76a8cb73c0bd03f1b7fd2ccf/main_prune_separable.py#L39-L48 | |
omaha-consulting/omaha-server | 1aa507b51e3656b490f72a3c9d60ee9d085e389e | omaha_server/omaha/core.py | python | Packages | (packages_list) | return packages | >>> from lxml import etree as ET
>>> print(ET.tostring(Packages([Package(
... 'chrome_installer.exe',
... required='true',
... size='23963192',
... hash='VXriGUVI0TNqfLlU02vBel4Q3Zo=')]), pretty_print=True))
b'<packages>
<package required="true" hash="VXriGUVI0T... | >>> from lxml import etree as ET
>>> print(ET.tostring(Packages([Package(
... 'chrome_installer.exe',
... required='true',
... size='23963192',
... hash='VXriGUVI0TNqfLlU02vBel4Q3Zo=')]), pretty_print=True))
b'<packages>
<package required="true" hash="VXriGUVI0T... | [
">>>",
"from",
"lxml",
"import",
"etree",
"as",
"ET",
">>>",
"print",
"(",
"ET",
".",
"tostring",
"(",
"Packages",
"(",
"[",
"Package",
"(",
"...",
"chrome_installer",
".",
"exe",
"...",
"required",
"=",
"true",
"...",
"size",
"=",
"23963192",
"...",
"... | def Packages(packages_list):
"""
>>> from lxml import etree as ET
>>> print(ET.tostring(Packages([Package(
... 'chrome_installer.exe',
... required='true',
... size='23963192',
... hash='VXriGUVI0TNqfLlU02vBel4Q3Zo=')]), pretty_print=True))
b'<packages>
... | [
"def",
"Packages",
"(",
"packages_list",
")",
":",
"packages",
"=",
"E",
".",
"packages",
"(",
")",
"list",
"(",
"map",
"(",
"packages",
".",
"append",
",",
"packages_list",
")",
")",
"return",
"packages"
] | https://github.com/omaha-consulting/omaha-server/blob/1aa507b51e3656b490f72a3c9d60ee9d085e389e/omaha_server/omaha/core.py#L132-L146 | |
stopstalk/stopstalk-deployment | 10c3ab44c4ece33ae515f6888c15033db2004bb1 | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/distro.py | python | LinuxDistribution._parse_distro_release_content | (line) | return distro_info | Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information items. | Parse a line from a distro release file. | [
"Parse",
"a",
"line",
"from",
"a",
"distro",
"release",
"file",
"."
] | def _parse_distro_release_content(line):
"""
Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information ite... | [
"def",
"_parse_distro_release_content",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"bytes",
")",
":",
"line",
"=",
"line",
".",
"decode",
"(",
"'utf-8'",
")",
"matches",
"=",
"_DISTRO_RELEASE_CONTENT_REVERSED_PATTERN",
".",
"match",
"(",
"lin... | https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/distro.py#L1142-L1167 | |
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/core/leoserver.py | python | LeoServer._bad_commands | (self, c) | return result | Return the list of command names that connected clients should ignore. | Return the list of command names that connected clients should ignore. | [
"Return",
"the",
"list",
"of",
"command",
"names",
"that",
"connected",
"clients",
"should",
"ignore",
"."
] | def _bad_commands(self, c):
"""Return the list of command names that connected clients should ignore."""
d = c.commandsDict if c else {} # keys are command names, values are functions.
bad = []
#
# leoInteg #173: Remove only vim commands.
for command_name in sorted(d):
... | [
"def",
"_bad_commands",
"(",
"self",
",",
"c",
")",
":",
"d",
"=",
"c",
".",
"commandsDict",
"if",
"c",
"else",
"{",
"}",
"# keys are command names, values are functions.",
"bad",
"=",
"[",
"]",
"#",
"# leoInteg #173: Remove only vim commands.",
"for",
"command_na... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/core/leoserver.py#L1762-L2507 | |
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/mixture.py | python | Mixture.InChIs | (self) | return [i.InChI for i in self.Chemicals] | r'''InChI strings for all chemicals in the mixture.
Examples
--------
>>> Mixture(['methane', 'ethane', 'propane', 'butane'],
... zs=[0.25, 0.25, 0.25, 0.25]).InChIs
['CH4/h1H4', 'C2H6/c1-2/h1-2H3', 'C3H8/c1-3-2/h3H2,1-2H3', 'C4H10/c1-3-4-2/h3-4H2,1-2H3'] | r'''InChI strings for all chemicals in the mixture. | [
"r",
"InChI",
"strings",
"for",
"all",
"chemicals",
"in",
"the",
"mixture",
"."
] | def InChIs(self):
r'''InChI strings for all chemicals in the mixture.
Examples
--------
>>> Mixture(['methane', 'ethane', 'propane', 'butane'],
... zs=[0.25, 0.25, 0.25, 0.25]).InChIs
['CH4/h1H4', 'C2H6/c1-2/h1-2H3', 'C3H8/c1-3-2/h3H2,1-2H3', 'C4H10/c1-3-4-2/h3-4H2,1-2H3... | [
"def",
"InChIs",
"(",
"self",
")",
":",
"return",
"[",
"i",
".",
"InChI",
"for",
"i",
"in",
"self",
".",
"Chemicals",
"]"
] | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/mixture.py#L1212-L1221 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/tempfile.py | python | _gettempdir | () | return tempdir | Private accessor for tempfile.tempdir. | Private accessor for tempfile.tempdir. | [
"Private",
"accessor",
"for",
"tempfile",
".",
"tempdir",
"."
] | def _gettempdir():
"""Private accessor for tempfile.tempdir."""
global tempdir
if tempdir is None:
_once_lock.acquire()
try:
if tempdir is None:
tempdir = _get_default_tempdir()
finally:
_once_lock.release()
return tempdir | [
"def",
"_gettempdir",
"(",
")",
":",
"global",
"tempdir",
"if",
"tempdir",
"is",
"None",
":",
"_once_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"tempdir",
"is",
"None",
":",
"tempdir",
"=",
"_get_default_tempdir",
"(",
")",
"finally",
":",
"_once... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/tempfile.py#L285-L295 | |
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/TCLIService/TCLIService.py | python | ExecuteStatement_result.write | (self, oprot) | [] | def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('ExecuteStatement_result')
if self.success is not None:
op... | [
"def",
"write",
"(",
"self",
",",
"oprot",
")",
":",
"if",
"oprot",
".",
"_fast_encode",
"is",
"not",
"None",
"and",
"self",
".",
"thrift_spec",
"is",
"not",
"None",
":",
"oprot",
".",
"trans",
".",
"write",
"(",
"oprot",
".",
"_fast_encode",
"(",
"s... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/TCLIService/TCLIService.py#L1754-L1764 | ||||
jaychsu/algorithm | 87dac5456b74a515dd97507ac68e9b8588066a04 | lintcode/575_expression_expand.py | python | Solution.expressionExpand | (self, s) | return ''.join(stack) | :type s: str
:rtype: str | :type s: str
:rtype: str | [
":",
"type",
"s",
":",
"str",
":",
"rtype",
":",
"str"
] | def expressionExpand(self, s):
"""
:type s: str
:rtype: str
"""
if not s:
return ''
times = 0
stack = []
for c in s:
if c.isdigit():
times = times * 10 + int(c)
elif c == '[':
stack.appe... | [
"def",
"expressionExpand",
"(",
"self",
",",
"s",
")",
":",
"if",
"not",
"s",
":",
"return",
"''",
"times",
"=",
"0",
"stack",
"=",
"[",
"]",
"for",
"c",
"in",
"s",
":",
"if",
"c",
".",
"isdigit",
"(",
")",
":",
"times",
"=",
"times",
"*",
"1... | https://github.com/jaychsu/algorithm/blob/87dac5456b74a515dd97507ac68e9b8588066a04/lintcode/575_expression_expand.py#L2-L28 | |
pulp/pulp | a0a28d804f997b6f81c391378aff2e4c90183df9 | server/pulp/server/managers/repo/group/cud.py | python | RepoGroupManager.create_repo_group | (group_id, display_name=None, description=None, repo_ids=None, notes=None) | return group | Create a new repo group.
:param group_id: unique id of the repo group
:param display_name: display name of the repo group
:type display_name: str or None
:param description: description of the repo group
:type description: str or None
:param repo_ids: list of ids for re... | Create a new repo group.
:param group_id: unique id of the repo group
:param display_name: display name of the repo group
:type display_name: str or None
:param description: description of the repo group
:type description: str or None
:param repo_ids: list of ids for re... | [
"Create",
"a",
"new",
"repo",
"group",
".",
":",
"param",
"group_id",
":",
"unique",
"id",
"of",
"the",
"repo",
"group",
":",
"param",
"display_name",
":",
"display",
"name",
"of",
"the",
"repo",
"group",
":",
"type",
"display_name",
":",
"str",
"or",
... | def create_repo_group(group_id, display_name=None, description=None, repo_ids=None, notes=None):
"""
Create a new repo group.
:param group_id: unique id of the repo group
:param display_name: display name of the repo group
:type display_name: str or None
:param descripti... | [
"def",
"create_repo_group",
"(",
"group_id",
",",
"display_name",
"=",
"None",
",",
"description",
"=",
"None",
",",
"repo_ids",
"=",
"None",
",",
"notes",
"=",
"None",
")",
":",
"# Check if ids in repo_ids belong to existing repositories",
"existing_repos",
"=",
"m... | https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/server/pulp/server/managers/repo/group/cud.py#L20-L50 | |
ilius/pyglossary | d599b3beda3ae17642af5debd83bb991148e6425 | pyglossary/ui/progressbar/widgets.py | python | Bar.__init__ | (self, marker='#', left='|', right='|', fill=' ',
fill_left=True) | Creates a customizable progress bar.
marker - string or updatable object to use as a marker
left - string or updatable object to use as a left border
right - string or updatable object to use as a right border
fill - character to use for the empty part of the progress bar
fill_l... | Creates a customizable progress bar. | [
"Creates",
"a",
"customizable",
"progress",
"bar",
"."
] | def __init__(self, marker='#', left='|', right='|', fill=' ',
fill_left=True):
"""Creates a customizable progress bar.
marker - string or updatable object to use as a marker
left - string or updatable object to use as a left border
right - string or updatable object to ... | [
"def",
"__init__",
"(",
"self",
",",
"marker",
"=",
"'#'",
",",
"left",
"=",
"'|'",
",",
"right",
"=",
"'|'",
",",
"fill",
"=",
"' '",
",",
"fill_left",
"=",
"True",
")",
":",
"self",
".",
"marker",
"=",
"marker",
"self",
".",
"left",
"=",
"left"... | https://github.com/ilius/pyglossary/blob/d599b3beda3ae17642af5debd83bb991148e6425/pyglossary/ui/progressbar/widgets.py#L289-L303 | ||
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/lib/scapy/sendrecv_backup.py | python | srp | (x,iface=None, iface_hint=None, filter=None, nofilter=0, type=ETH_P_ALL, *args,**kargs) | return a,b | Send and receive packets at layer 2
nofilter: put 1 to avoid use of bpf filters
retry: if positive, how many times to resend unanswered packets
if negative, how many times to retry when no more packets are answered
timeout: how much time to wait after the last packet has been sent
verbose: set verbosity ... | Send and receive packets at layer 2
nofilter: put 1 to avoid use of bpf filters
retry: if positive, how many times to resend unanswered packets
if negative, how many times to retry when no more packets are answered
timeout: how much time to wait after the last packet has been sent
verbose: set verbosity ... | [
"Send",
"and",
"receive",
"packets",
"at",
"layer",
"2",
"nofilter",
":",
"put",
"1",
"to",
"avoid",
"use",
"of",
"bpf",
"filters",
"retry",
":",
"if",
"positive",
"how",
"many",
"times",
"to",
"resend",
"unanswered",
"packets",
"if",
"negative",
"how",
... | def srp(x,iface=None, iface_hint=None, filter=None, nofilter=0, type=ETH_P_ALL, *args,**kargs):
"""Send and receive packets at layer 2
nofilter: put 1 to avoid use of bpf filters
retry: if positive, how many times to resend unanswered packets
if negative, how many times to retry when no more packets ar... | [
"def",
"srp",
"(",
"x",
",",
"iface",
"=",
"None",
",",
"iface_hint",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"nofilter",
"=",
"0",
",",
"type",
"=",
"ETH_P_ALL",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"not",
"kargs",
"... | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/sendrecv_backup.py#L336-L353 | |
sampsyo/hass-smartthinq | 3d2b6bdf90658aa9e90112cb5ff73a1866ad95a2 | sensor.py | python | LGDishWasherDevice.initial_time | (self) | return str(datetime.timedelta(minutes=minutes))[:-3] | [] | def initial_time(self):
minutes = self.initial_time_in_minutes if self._status else 0
return str(datetime.timedelta(minutes=minutes))[:-3] | [
"def",
"initial_time",
"(",
"self",
")",
":",
"minutes",
"=",
"self",
".",
"initial_time_in_minutes",
"if",
"self",
".",
"_status",
"else",
"0",
"return",
"str",
"(",
"datetime",
".",
"timedelta",
"(",
"minutes",
"=",
"minutes",
")",
")",
"[",
":",
"-",
... | https://github.com/sampsyo/hass-smartthinq/blob/3d2b6bdf90658aa9e90112cb5ff73a1866ad95a2/sensor.py#L141-L143 | |||
tensorwerk/hangar-py | a6deb22854a6c9e9709011b91c1c0eeda7f47bb0 | src/hangar/diagnostics/graphing.py | python | Graph._insert_into_new_columns | (self, commit, mapping_index) | return mapping_index + 2 | If the commit is already in the new_columns list, we don't need to add
it. Just update the mapping correctly. | If the commit is already in the new_columns list, we don't need to add
it. Just update the mapping correctly. | [
"If",
"the",
"commit",
"is",
"already",
"in",
"the",
"new_columns",
"list",
"we",
"don",
"t",
"need",
"to",
"add",
"it",
".",
"Just",
"update",
"the",
"mapping",
"correctly",
"."
] | def _insert_into_new_columns(self, commit, mapping_index):
"""
If the commit is already in the new_columns list, we don't need to add
it. Just update the mapping correctly.
"""
for i in range(self.num_new_columns):
if self.new_columns[i].commit == commit:
... | [
"def",
"_insert_into_new_columns",
"(",
"self",
",",
"commit",
",",
"mapping_index",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_new_columns",
")",
":",
"if",
"self",
".",
"new_columns",
"[",
"i",
"]",
".",
"commit",
"==",
"commit",
":",
... | https://github.com/tensorwerk/hangar-py/blob/a6deb22854a6c9e9709011b91c1c0eeda7f47bb0/src/hangar/diagnostics/graphing.py#L301-L316 | |
meraki/dashboard-api-python | aef5e6fe5d23a40d435d5c64ff30580a28af07f1 | meraki_v0/aio/api/sm.py | python | AsyncSM.createNetworkSmBypassActivationLockAttempt | (self, networkId: str, ids: list) | return await self._session.post(metadata, resource, payload) | **Bypass activation lock attempt**
https://developer.cisco.com/meraki/api/#!create-network-sm-bypass-activation-lock-attempt
- networkId (string)
- ids (array): The ids of the devices to attempt activation lock bypass. | **Bypass activation lock attempt**
https://developer.cisco.com/meraki/api/#!create-network-sm-bypass-activation-lock-attempt
- networkId (string)
- ids (array): The ids of the devices to attempt activation lock bypass. | [
"**",
"Bypass",
"activation",
"lock",
"attempt",
"**",
"https",
":",
"//",
"developer",
".",
"cisco",
".",
"com",
"/",
"meraki",
"/",
"api",
"/",
"#!create",
"-",
"network",
"-",
"sm",
"-",
"bypass",
"-",
"activation",
"-",
"lock",
"-",
"attempt",
"-",... | async def createNetworkSmBypassActivationLockAttempt(self, networkId: str, ids: list):
"""
**Bypass activation lock attempt**
https://developer.cisco.com/meraki/api/#!create-network-sm-bypass-activation-lock-attempt
- networkId (string)
- ids (array): The ids of the devi... | [
"async",
"def",
"createNetworkSmBypassActivationLockAttempt",
"(",
"self",
",",
"networkId",
":",
"str",
",",
"ids",
":",
"list",
")",
":",
"kwargs",
"=",
"locals",
"(",
")",
"metadata",
"=",
"{",
"'tags'",
":",
"[",
"'SM'",
"]",
",",
"'operation'",
":",
... | https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki_v0/aio/api/sm.py#L6-L26 | |
xme/toolbox | b32be04b6018483f968da1422d68ed6b8b9ee61b | pum.py | python | addURLToCategory | (fw, key, urlCategory, url) | return | ------------------------------------------- | ------------------------------------------- | [
"-------------------------------------------"
] | def addURLToCategory(fw, key, urlCategory, url):
""" ------------------------------------------- """
""" Add the specified URL from the URL category """
""" ------------------------------------------- """
if not url or not fw or not key or not urlCategory:
return
... | [
"def",
"addURLToCategory",
"(",
"fw",
",",
"key",
",",
"urlCategory",
",",
"url",
")",
":",
"\"\"\" Add the specified URL from the URL category \"\"\"",
"\"\"\" ------------------------------------------- \"\"\"",
"if",
"not",
"url",
"or",
"not",
"fw",
"or",
"not",
"key",... | https://github.com/xme/toolbox/blob/b32be04b6018483f968da1422d68ed6b8b9ee61b/pum.py#L121-L136 | |
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/widgets/imageview.py | python | ImageView.__init__ | (self, parent=None) | [] | def __init__(self, parent=None):
super(ImageView, self).__init__(parent)
scene = QtWidgets.QGraphicsScene(self)
self.graphics_pixmap = QtWidgets.QGraphicsPixmapItem()
scene.addItem(self.graphics_pixmap)
self.setScene(scene)
self.zoom_factor = 1.125
self.rubberba... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
"=",
"None",
")",
":",
"super",
"(",
"ImageView",
",",
"self",
")",
".",
"__init__",
"(",
"parent",
")",
"scene",
"=",
"QtWidgets",
".",
"QGraphicsScene",
"(",
"self",
")",
"self",
".",
"graphics_pixmap",
... | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/imageview.py#L59-L91 | ||||
marinho/geraldo | 868ebdce67176d9b6205cddc92476f642c783fff | site/newsite/django_1_0/django/utils/text.py | python | get_text_list | (list_, last_word=ugettext_lazy(u'or')) | return u'%s %s %s' % (', '.join([force_unicode(i) for i in list_][:-1]), force_unicode(last_word), force_unicode(list_[-1])) | >>> get_text_list(['a', 'b', 'c', 'd'])
u'a, b, c or d'
>>> get_text_list(['a', 'b', 'c'], 'and')
u'a, b and c'
>>> get_text_list(['a', 'b'], 'and')
u'a and b'
>>> get_text_list(['a'])
u'a'
>>> get_text_list([])
u'' | >>> get_text_list(['a', 'b', 'c', 'd'])
u'a, b, c or d'
>>> get_text_list(['a', 'b', 'c'], 'and')
u'a, b and c'
>>> get_text_list(['a', 'b'], 'and')
u'a and b'
>>> get_text_list(['a'])
u'a'
>>> get_text_list([])
u'' | [
">>>",
"get_text_list",
"(",
"[",
"a",
"b",
"c",
"d",
"]",
")",
"u",
"a",
"b",
"c",
"or",
"d",
">>>",
"get_text_list",
"(",
"[",
"a",
"b",
"c",
"]",
"and",
")",
"u",
"a",
"b",
"and",
"c",
">>>",
"get_text_list",
"(",
"[",
"a",
"b",
"]",
"an... | def get_text_list(list_, last_word=ugettext_lazy(u'or')):
"""
>>> get_text_list(['a', 'b', 'c', 'd'])
u'a, b, c or d'
>>> get_text_list(['a', 'b', 'c'], 'and')
u'a, b and c'
>>> get_text_list(['a', 'b'], 'and')
u'a and b'
>>> get_text_list(['a'])
u'a'
>>> get_text_list([])
u'... | [
"def",
"get_text_list",
"(",
"list_",
",",
"last_word",
"=",
"ugettext_lazy",
"(",
"u'or'",
")",
")",
":",
"if",
"len",
"(",
"list_",
")",
"==",
"0",
":",
"return",
"u''",
"if",
"len",
"(",
"list_",
")",
"==",
"1",
":",
"return",
"force_unicode",
"("... | https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/django_1_0/django/utils/text.py#L128-L143 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/arrow/arrow.py | python | Arrow.strftime | (self, format) | return self._datetime.strftime(format) | Formats in the style of ``datetime.strptime``.
:param format: the format string. | Formats in the style of ``datetime.strptime``. | [
"Formats",
"in",
"the",
"style",
"of",
"datetime",
".",
"strptime",
"."
] | def strftime(self, format):
''' Formats in the style of ``datetime.strptime``.
:param format: the format string.
'''
return self._datetime.strftime(format) | [
"def",
"strftime",
"(",
"self",
",",
"format",
")",
":",
"return",
"self",
".",
"_datetime",
".",
"strftime",
"(",
"format",
")"
] | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/arrow/arrow.py#L966-L973 | |
tensorflow/tensorboard | 61d11d99ef034c30ba20b6a7840c8eededb9031c | tensorboard/plugins/npmi/npmi_plugin.py | python | NpmiPlugin.serve_tags | (self, request) | return http_util.Respond(request, contents, "application/json") | [] | def serve_tags(self, request):
ctx = plugin_util.context(request.environ)
experiment = plugin_util.experiment_id(request.environ)
contents = self.tags_impl(ctx, experiment=experiment)
return http_util.Respond(request, contents, "application/json") | [
"def",
"serve_tags",
"(",
"self",
",",
"request",
")",
":",
"ctx",
"=",
"plugin_util",
".",
"context",
"(",
"request",
".",
"environ",
")",
"experiment",
"=",
"plugin_util",
".",
"experiment_id",
"(",
"request",
".",
"environ",
")",
"contents",
"=",
"self"... | https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/plugins/npmi/npmi_plugin.py#L224-L228 | |||
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/qbittorrent/client.py | python | Client.qbittorrent_version | (self) | return self._get('api/v2/app/version') | Get qBittorrent version. | Get qBittorrent version. | [
"Get",
"qBittorrent",
"version",
"."
] | def qbittorrent_version(self):
"""
Get qBittorrent version.
"""
return self._get('api/v2/app/version') | [
"def",
"qbittorrent_version",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get",
"(",
"'api/v2/app/version'",
")"
] | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/qbittorrent/client.py#L114-L118 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/inspect.py | python | _has_code_flag | (f, flag) | return bool(f.__code__.co_flags & flag) | Return true if ``f`` is a function (or a method or functools.partial
wrapper wrapping a function) whose code object has the given ``flag``
set in its flags. | Return true if ``f`` is a function (or a method or functools.partial
wrapper wrapping a function) whose code object has the given ``flag``
set in its flags. | [
"Return",
"true",
"if",
"f",
"is",
"a",
"function",
"(",
"or",
"a",
"method",
"or",
"functools",
".",
"partial",
"wrapper",
"wrapping",
"a",
"function",
")",
"whose",
"code",
"object",
"has",
"the",
"given",
"flag",
"set",
"in",
"its",
"flags",
"."
] | def _has_code_flag(f, flag):
"""Return true if ``f`` is a function (or a method or functools.partial
wrapper wrapping a function) whose code object has the given ``flag``
set in its flags."""
while ismethod(f):
f = f.__func__
f = functools._unwrap_partial(f)
if not isfunction(f):
... | [
"def",
"_has_code_flag",
"(",
"f",
",",
"flag",
")",
":",
"while",
"ismethod",
"(",
"f",
")",
":",
"f",
"=",
"f",
".",
"__func__",
"f",
"=",
"functools",
".",
"_unwrap_partial",
"(",
"f",
")",
"if",
"not",
"isfunction",
"(",
"f",
")",
":",
"return"... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/inspect.py#L171-L180 | |
PyLops/pylops | 33eb807c6f429dd2efe697627c0d3955328af81f | pylops/optimization/solver.py | python | cgls | (Op, y, x0, niter=10, damp=0.0, tol=1e-4, show=False, callback=None) | return x, istop, iiter, r1norm, r2norm, cost[:iiter] | r"""Conjugate gradient least squares
Solve an overdetermined system of equations given an operator ``Op`` and
data ``y`` using conjugate gradient iterations.
Parameters
----------
Op : :obj:`pylops.LinearOperator`
Operator to invert of size :math:`[N \times M]`
y : :obj:`np.ndarray`
... | r"""Conjugate gradient least squares | [
"r",
"Conjugate",
"gradient",
"least",
"squares"
] | def cgls(Op, y, x0, niter=10, damp=0.0, tol=1e-4, show=False, callback=None):
r"""Conjugate gradient least squares
Solve an overdetermined system of equations given an operator ``Op`` and
data ``y`` using conjugate gradient iterations.
Parameters
----------
Op : :obj:`pylops.LinearOperator`
... | [
"def",
"cgls",
"(",
"Op",
",",
"y",
",",
"x0",
",",
"niter",
"=",
"10",
",",
"damp",
"=",
"0.0",
",",
"tol",
"=",
"1e-4",
",",
"show",
"=",
"False",
",",
"callback",
"=",
"None",
")",
":",
"ncp",
"=",
"get_array_module",
"(",
"y",
")",
"if",
... | https://github.com/PyLops/pylops/blob/33eb807c6f429dd2efe697627c0d3955328af81f/pylops/optimization/solver.py#L113-L255 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/ctypes/macholib/dyld.py | python | dyld_default_search | (name, env=None) | [] | def dyld_default_search(name, env=None):
yield name
framework = framework_info(name)
if framework is not None:
fallback_framework_path = dyld_fallback_framework_path(env)
for path in fallback_framework_path:
yield os.path.join(path, framework['name'])
fallback_library_path... | [
"def",
"dyld_default_search",
"(",
"name",
",",
"env",
"=",
"None",
")",
":",
"yield",
"name",
"framework",
"=",
"framework_info",
"(",
"name",
")",
"if",
"framework",
"is",
"not",
"None",
":",
"fallback_framework_path",
"=",
"dyld_fallback_framework_path",
"(",... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/ctypes/macholib/dyld.py#L100-L120 | ||||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/providers/torrent/rss/shazbat.py | python | ShazbatProvider.__init__ | (self) | Initialize the class. | Initialize the class. | [
"Initialize",
"the",
"class",
"."
] | def __init__(self):
"""Initialize the class."""
super(ShazbatProvider, self).__init__('Shazbat.tv')
# Credentials
self.passkey = None
# URLs
self.url = 'http://www.shazbat.tv'
self.urls = {
'login': urljoin(self.url, 'login'),
'rss_recent... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"ShazbatProvider",
",",
"self",
")",
".",
"__init__",
"(",
"'Shazbat.tv'",
")",
"# Credentials",
"self",
".",
"passkey",
"=",
"None",
"# URLs",
"self",
".",
"url",
"=",
"'http://www.shazbat.tv'",
"self"... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/providers/torrent/rss/shazbat.py#L22-L47 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/python_ldap-2.4.10-py2.7-linux-x86_64.egg/ldap/ldapobject.py | python | SimpleLDAPObject.modrdn | (self,dn,newrdn,delold=1) | return self.rename(dn,newrdn,None,delold) | modrdn(dn, newrdn [,delold=1]) -> int
modrdn_s(dn, newrdn [,delold=1]) -> None
Perform a modify RDN operation. These routines take dn, the
DN of the entry whose RDN is to be changed, and newrdn, the
new RDN to give to the entry. The optional parameter delold
is used to specify whethe... | modrdn(dn, newrdn [,delold=1]) -> int
modrdn_s(dn, newrdn [,delold=1]) -> None
Perform a modify RDN operation. These routines take dn, the
DN of the entry whose RDN is to be changed, and newrdn, the
new RDN to give to the entry. The optional parameter delold
is used to specify whethe... | [
"modrdn",
"(",
"dn",
"newrdn",
"[",
"delold",
"=",
"1",
"]",
")",
"-",
">",
"int",
"modrdn_s",
"(",
"dn",
"newrdn",
"[",
"delold",
"=",
"1",
"]",
")",
"-",
">",
"None",
"Perform",
"a",
"modify",
"RDN",
"operation",
".",
"These",
"routines",
"take",... | def modrdn(self,dn,newrdn,delold=1):
"""
modrdn(dn, newrdn [,delold=1]) -> int
modrdn_s(dn, newrdn [,delold=1]) -> None
Perform a modify RDN operation. These routines take dn, the
DN of the entry whose RDN is to be changed, and newrdn, the
new RDN to give to the entry. The optional p... | [
"def",
"modrdn",
"(",
"self",
",",
"dn",
",",
"newrdn",
",",
"delold",
"=",
"1",
")",
":",
"return",
"self",
".",
"rename",
"(",
"dn",
",",
"newrdn",
",",
"None",
",",
"delold",
")"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/python_ldap-2.4.10-py2.7-linux-x86_64.egg/ldap/ldapobject.py#L359-L373 | |
fluentpython/example-code-2e | 80f7f84274a47579e59c29a4657691525152c9d5 | 21-async/mojifinder/bottle.py | python | AutoServer.run | (self, handler) | [] | def run(self, handler):
for sa in self.adapters:
try:
return sa(self.host, self.port, **self.options).run(handler)
except ImportError:
pass | [
"def",
"run",
"(",
"self",
",",
"handler",
")",
":",
"for",
"sa",
"in",
"self",
".",
"adapters",
":",
"try",
":",
"return",
"sa",
"(",
"self",
".",
"host",
",",
"self",
".",
"port",
",",
"*",
"*",
"self",
".",
"options",
")",
".",
"run",
"(",
... | https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/21-async/mojifinder/bottle.py#L2986-L2991 | ||||
fastnlp/fastNLP | fb645d370f4cc1b00c7dbb16c1ff4542327c46e5 | fastNLP/core/metrics.py | python | _bioes_tag_to_spans | (tags, ignore_labels=None) | return [(span[0], (span[1][0], span[1][1] + 1))
for span in spans
if span[0] not in ignore_labels
] | r"""
给定一个tags的lis,比如['O', 'B-singer', 'I-singer', 'E-singer', 'O', 'O']。
返回[('singer', (1, 4))] (左闭右开区间)
:param tags: List[str],
:param ignore_labels: List[str], 在该list中的label将被忽略
:return: List[Tuple[str, List[int, int]]]. [(label,[start, end])] | r"""
给定一个tags的lis,比如['O', 'B-singer', 'I-singer', 'E-singer', 'O', 'O']。
返回[('singer', (1, 4))] (左闭右开区间) | [
"r",
"给定一个tags的lis,比如",
"[",
"O",
"B",
"-",
"singer",
"I",
"-",
"singer",
"E",
"-",
"singer",
"O",
"O",
"]",
"。",
"返回",
"[",
"(",
"singer",
"(",
"1",
"4",
"))",
"]",
"(",
"左闭右开区间",
")"
] | def _bioes_tag_to_spans(tags, ignore_labels=None):
r"""
给定一个tags的lis,比如['O', 'B-singer', 'I-singer', 'E-singer', 'O', 'O']。
返回[('singer', (1, 4))] (左闭右开区间)
:param tags: List[str],
:param ignore_labels: List[str], 在该list中的label将被忽略
:return: List[Tuple[str, List[int, int]]]. [(label,[start, end])... | [
"def",
"_bioes_tag_to_spans",
"(",
"tags",
",",
"ignore_labels",
"=",
"None",
")",
":",
"ignore_labels",
"=",
"set",
"(",
"ignore_labels",
")",
"if",
"ignore_labels",
"else",
"set",
"(",
")",
"spans",
"=",
"[",
"]",
"prev_bioes_tag",
"=",
"None",
"for",
"i... | https://github.com/fastnlp/fastNLP/blob/fb645d370f4cc1b00c7dbb16c1ff4542327c46e5/fastNLP/core/metrics.py#L723-L751 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/mailbox.py | python | mbox._generate_toc | (self) | Generate key-to-(start, stop) table of contents. | Generate key-to-(start, stop) table of contents. | [
"Generate",
"key",
"-",
"to",
"-",
"(",
"start",
"stop",
")",
"table",
"of",
"contents",
"."
] | def _generate_toc(self):
"""Generate key-to-(start, stop) table of contents."""
starts, stops = [], []
last_was_empty = False
self._file.seek(0)
while True:
line_pos = self._file.tell()
line = self._file.readline()
if line.startswith(b'From '):... | [
"def",
"_generate_toc",
"(",
"self",
")",
":",
"starts",
",",
"stops",
"=",
"[",
"]",
",",
"[",
"]",
"last_was_empty",
"=",
"False",
"self",
".",
"_file",
".",
"seek",
"(",
"0",
")",
"while",
"True",
":",
"line_pos",
"=",
"self",
".",
"_file",
".",... | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/mailbox.py#L851-L882 | ||
chrism2671/PyTrendFollow | 439232aed4d67ccf339e782b7c8b96f2dd961d43 | trading/rules.py | python | carry | (inst, **kw) | Generic carry function.
If the Instrument has a spot price series, use that for carry (carry_spot), otherwise use the next contract (carry_next) | Generic carry function.
If the Instrument has a spot price series, use that for carry (carry_spot), otherwise use the next contract (carry_next) | [
"Generic",
"carry",
"function",
".",
"If",
"the",
"Instrument",
"has",
"a",
"spot",
"price",
"series",
"use",
"that",
"for",
"carry",
"(",
"carry_spot",
")",
"otherwise",
"use",
"the",
"next",
"contract",
"(",
"carry_next",
")"
] | def carry(inst, **kw):
"""
Generic carry function.
If the Instrument has a spot price series, use that for carry (carry_spot), otherwise use the next contract (carry_next)
"""
if hasattr(inst, 'spot'):
return carry_spot(inst, **kw).rename('carry')
else:
return carry_next(in... | [
"def",
"carry",
"(",
"inst",
",",
"*",
"*",
"kw",
")",
":",
"if",
"hasattr",
"(",
"inst",
",",
"'spot'",
")",
":",
"return",
"carry_spot",
"(",
"inst",
",",
"*",
"*",
"kw",
")",
".",
"rename",
"(",
"'carry'",
")",
"else",
":",
"return",
"carry_ne... | https://github.com/chrism2671/PyTrendFollow/blob/439232aed4d67ccf339e782b7c8b96f2dd961d43/trading/rules.py#L39-L48 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/paho/mqtt/properties.py | python | readUTF | (buffer, maxlen) | return buf, length+2 | [] | def readUTF(buffer, maxlen):
if maxlen >= 2:
length = readInt16(buffer)
else:
raise MalformedPacket("Not enough data to read string length")
maxlen -= 2
if length > maxlen:
raise MalformedPacket("Length delimited string too long")
buf = buffer[2:2+length].decode("utf-8")
... | [
"def",
"readUTF",
"(",
"buffer",
",",
"maxlen",
")",
":",
"if",
"maxlen",
">=",
"2",
":",
"length",
"=",
"readInt16",
"(",
"buffer",
")",
"else",
":",
"raise",
"MalformedPacket",
"(",
"\"Not enough data to read string length\"",
")",
"maxlen",
"-=",
"2",
"if... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/paho/mqtt/properties.py#L62-L80 | |||
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v6_0/work_item_tracking_process/work_item_tracking_process_client.py | python | WorkItemTrackingProcessClient.move_group_to_section | (self, group, process_id, wit_ref_name, page_id, section_id, group_id, remove_from_section_id) | return self._deserialize('Group', response) | MoveGroupToSection.
[Preview API] Moves a group to a different section.
:param :class:`<Group> <azure.devops.v6_0.work_item_tracking_process.models.Group>` group: The updated group.
:param str process_id: The ID of the process.
:param str wit_ref_name: The reference name of the work item... | MoveGroupToSection.
[Preview API] Moves a group to a different section.
:param :class:`<Group> <azure.devops.v6_0.work_item_tracking_process.models.Group>` group: The updated group.
:param str process_id: The ID of the process.
:param str wit_ref_name: The reference name of the work item... | [
"MoveGroupToSection",
".",
"[",
"Preview",
"API",
"]",
"Moves",
"a",
"group",
"to",
"a",
"different",
"section",
".",
":",
"param",
":",
"class",
":",
"<Group",
">",
"<azure",
".",
"devops",
".",
"v6_0",
".",
"work_item_tracking_process",
".",
"models",
".... | def move_group_to_section(self, group, process_id, wit_ref_name, page_id, section_id, group_id, remove_from_section_id):
"""MoveGroupToSection.
[Preview API] Moves a group to a different section.
:param :class:`<Group> <azure.devops.v6_0.work_item_tracking_process.models.Group>` group: The updat... | [
"def",
"move_group_to_section",
"(",
"self",
",",
"group",
",",
"process_id",
",",
"wit_ref_name",
",",
"page_id",
",",
"section_id",
",",
"group_id",
",",
"remove_from_section_id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"process_id",
"is",
"not",
"Non... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v6_0/work_item_tracking_process/work_item_tracking_process_client.py#L404-L437 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.