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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tilezen/vector-datasource | f7994f67e2a3c14d3495102231acafbd5a7f4a34 | vectordatasource/transform.py | python | apply_disputed_boundary_viewpoints | (ctx) | return layer | Use the dispute features to apply viewpoints to the admin boundaries.
We take the 'mz_internal_dispute_mask' features and build a mask from them.
The mask is used to move the information from 'disputed_by' lists on the
mask features to 'kind:xx' overrides on the boundary features. The mask
features are... | Use the dispute features to apply viewpoints to the admin boundaries. | [
"Use",
"the",
"dispute",
"features",
"to",
"apply",
"viewpoints",
"to",
"the",
"admin",
"boundaries",
"."
] | def apply_disputed_boundary_viewpoints(ctx):
"""
Use the dispute features to apply viewpoints to the admin boundaries.
We take the 'mz_internal_dispute_mask' features and build a mask from them.
The mask is used to move the information from 'disputed_by' lists on the
mask features to 'kind:xx' over... | [
"def",
"apply_disputed_boundary_viewpoints",
"(",
"ctx",
")",
":",
"params",
"=",
"_Params",
"(",
"ctx",
",",
"'apply_disputed_boundary_viewpoints'",
")",
"layer_name",
"=",
"params",
".",
"required",
"(",
"'base_layer'",
")",
"start_zoom",
"=",
"params",
".",
"op... | https://github.com/tilezen/vector-datasource/blob/f7994f67e2a3c14d3495102231acafbd5a7f4a34/vectordatasource/transform.py#L9358-L9434 | |
jwkvam/bowtie | 220cd41367a70f2e206db846278cb7b6fd3649eb | bowtie/control.py | python | Checkbox.do_check | (self, values: Sequence[Union[int, str]]) | return values | Set the value of the slider.
Parameters
----------
values : Sequence of int, str
The radio value to select. | Set the value of the slider. | [
"Set",
"the",
"value",
"of",
"the",
"slider",
"."
] | def do_check(self, values: Sequence[Union[int, str]]):
"""Set the value of the slider.
Parameters
----------
values : Sequence of int, str
The radio value to select.
"""
return values | [
"def",
"do_check",
"(",
"self",
",",
"values",
":",
"Sequence",
"[",
"Union",
"[",
"int",
",",
"str",
"]",
"]",
")",
":",
"return",
"values"
] | https://github.com/jwkvam/bowtie/blob/220cd41367a70f2e206db846278cb7b6fd3649eb/bowtie/control.py#L923-L932 | |
facebookresearch/mmf | fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f | mmf/utils/general.py | python | clip_gradients | (model, optimizer, i_iter, writer, config, scale=1.0) | [] | def clip_gradients(model, optimizer, i_iter, writer, config, scale=1.0):
max_grad_l2_norm = config.training.max_grad_l2_norm
clip_norm_mode = config.training.clip_norm_mode
if max_grad_l2_norm is not None:
if clip_norm_mode == "all":
if hasattr(optimizer, "clip_grad_norm"):
... | [
"def",
"clip_gradients",
"(",
"model",
",",
"optimizer",
",",
"i_iter",
",",
"writer",
",",
"config",
",",
"scale",
"=",
"1.0",
")",
":",
"max_grad_l2_norm",
"=",
"config",
".",
"training",
".",
"max_grad_l2_norm",
"clip_norm_mode",
"=",
"config",
".",
"trai... | https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/utils/general.py#L33-L50 | ||||
pventuzelo/octopus | e8b8c5a9d5f6d9c63605afe9ef1528ab481ec983 | octopus/platforms/BTC/explorer.py | python | BitcoinExplorerRPC.getbalance | (self, account="*", minconf=1, include_watchonly=False) | return self.call('getbalance', [account, minconf, include_watchonly]) | http://chainquery.com/bitcoin-api/getbalance
If account is not specified, returns the server's total available balance.
If account is specified (DEPRECATED), returns the balance in the account.
Note that the account "" is not the same as leaving the parameter out.
The server total may b... | http://chainquery.com/bitcoin-api/getbalance | [
"http",
":",
"//",
"chainquery",
".",
"com",
"/",
"bitcoin",
"-",
"api",
"/",
"getbalance"
] | def getbalance(self, account="*", minconf=1, include_watchonly=False):
'''
http://chainquery.com/bitcoin-api/getbalance
If account is not specified, returns the server's total available balance.
If account is specified (DEPRECATED), returns the balance in the account.
Note that ... | [
"def",
"getbalance",
"(",
"self",
",",
"account",
"=",
"\"*\"",
",",
"minconf",
"=",
"1",
",",
"include_watchonly",
"=",
"False",
")",
":",
"return",
"self",
".",
"call",
"(",
"'getbalance'",
",",
"[",
"account",
",",
"minconf",
",",
"include_watchonly",
... | https://github.com/pventuzelo/octopus/blob/e8b8c5a9d5f6d9c63605afe9ef1528ab481ec983/octopus/platforms/BTC/explorer.py#L457-L486 | |
modin-project/modin | 0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee | modin/core/dataframe/pandas/dataframe/dataframe.py | python | PandasDataframe.from_labels | (self) | return result | Convert the row labels to a column of data, inserted at the first position.
Gives result by similar way as `pandas.DataFrame.reset_index`. Each level
of `self.index` will be added as separate column of data.
Returns
-------
PandasDataframe
A PandasDataframe with new... | Convert the row labels to a column of data, inserted at the first position. | [
"Convert",
"the",
"row",
"labels",
"to",
"a",
"column",
"of",
"data",
"inserted",
"at",
"the",
"first",
"position",
"."
] | def from_labels(self) -> "PandasDataframe":
"""
Convert the row labels to a column of data, inserted at the first position.
Gives result by similar way as `pandas.DataFrame.reset_index`. Each level
of `self.index` will be added as separate column of data.
Returns
------... | [
"def",
"from_labels",
"(",
"self",
")",
"->",
"\"PandasDataframe\"",
":",
"new_row_labels",
"=",
"pandas",
".",
"RangeIndex",
"(",
"len",
"(",
"self",
".",
"index",
")",
")",
"if",
"self",
".",
"index",
".",
"nlevels",
">",
"1",
":",
"level_names",
"=",
... | https://github.com/modin-project/modin/blob/0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee/modin/core/dataframe/pandas/dataframe/dataframe.py#L618-L693 | |
rucio/rucio | 6d0d358e04f5431f0b9a98ae40f31af0ddff4833 | lib/rucio/rse/protocols/protocol.py | python | RSEDeterministicTranslation.supports | (cls, name) | return name in cls._LFN2PFN_ALGORITHMS | Check to see if a specific algorithm is supported.
:param name: Name of the deterministic algorithm.
:returns: True if `name` is an algorithm supported by the translator class, False otherwise. | Check to see if a specific algorithm is supported. | [
"Check",
"to",
"see",
"if",
"a",
"specific",
"algorithm",
"is",
"supported",
"."
] | def supports(cls, name):
"""
Check to see if a specific algorithm is supported.
:param name: Name of the deterministic algorithm.
:returns: True if `name` is an algorithm supported by the translator class, False otherwise.
"""
return name in cls._LFN2PFN_ALGORITHMS | [
"def",
"supports",
"(",
"cls",
",",
"name",
")",
":",
"return",
"name",
"in",
"cls",
".",
"_LFN2PFN_ALGORITHMS"
] | https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/rse/protocols/protocol.py#L90-L97 | |
boston-dynamics/spot-sdk | 5ffa12e6943a47323c7279d86e30346868755f52 | python/bosdyn-client/src/bosdyn/client/time_sync.py | python | TimeSyncClient.get_time_sync_update_async | (self, previous_round_trip, clock_identifier, **kwargs) | return self.call_async(self._stub.TimeSyncUpdate, req, None, common_header_errors, **kwargs) | Async version of get_time_sync_update() | Async version of get_time_sync_update() | [
"Async",
"version",
"of",
"get_time_sync_update",
"()"
] | def get_time_sync_update_async(self, previous_round_trip, clock_identifier, **kwargs):
"""Async version of get_time_sync_update()"""
req = self._get_time_sync_update_request(previous_round_trip, clock_identifier)
return self.call_async(self._stub.TimeSyncUpdate, req, None, common_header_errors, ... | [
"def",
"get_time_sync_update_async",
"(",
"self",
",",
"previous_round_trip",
",",
"clock_identifier",
",",
"*",
"*",
"kwargs",
")",
":",
"req",
"=",
"self",
".",
"_get_time_sync_update_request",
"(",
"previous_round_trip",
",",
"clock_identifier",
")",
"return",
"s... | https://github.com/boston-dynamics/spot-sdk/blob/5ffa12e6943a47323c7279d86e30346868755f52/python/bosdyn-client/src/bosdyn/client/time_sync.py#L67-L70 | |
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | DemoPrograms/Demo_Progress_Meters.py | python | custom_meter_example | () | [] | def custom_meter_example():
# layout the form
layout = [[sg.Text('A typical custom progress meter')],
[sg.ProgressBar(1, orientation='h', size=(20, 20), key='progress')],
[sg.Cancel()]]
# create the form`
window = sg.Window('Custom Progress Meter', layout)
progress_bar =... | [
"def",
"custom_meter_example",
"(",
")",
":",
"# layout the form",
"layout",
"=",
"[",
"[",
"sg",
".",
"Text",
"(",
"'A typical custom progress meter'",
")",
"]",
",",
"[",
"sg",
".",
"ProgressBar",
"(",
"1",
",",
"orientation",
"=",
"'h'",
",",
"size",
"=... | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_Progress_Meters.py#L142-L160 | ||||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/random.py | python | Random.weibullvariate | (self, alpha, beta) | return alpha * pow(-_log(u), 1.0/beta) | Weibull distribution.
alpha is the scale parameter and beta is the shape parameter. | Weibull distribution. | [
"Weibull",
"distribution",
"."
] | def weibullvariate(self, alpha, beta):
"""Weibull distribution.
alpha is the scale parameter and beta is the shape parameter.
"""
# Jain, pg. 499; bug fix courtesy Bill Arms
u = 1.0 - self.random()
return alpha * pow(-_log(u), 1.0/beta) | [
"def",
"weibullvariate",
"(",
"self",
",",
"alpha",
",",
"beta",
")",
":",
"# Jain, pg. 499; bug fix courtesy Bill Arms",
"u",
"=",
"1.0",
"-",
"self",
".",
"random",
"(",
")",
"return",
"alpha",
"*",
"pow",
"(",
"-",
"_log",
"(",
"u",
")",
",",
"1.0",
... | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/random.py#L644-L653 | |
celery/django-celery | c679b05b2abc174e6fa3231b120a07b49ec8f911 | djcelery/admin.py | python | PeriodicTaskAdmin.enable_tasks | (self, request, queryset) | [] | def enable_tasks(self, request, queryset):
queryset.update(enabled=True)
self.update_periodic_tasks() | [
"def",
"enable_tasks",
"(",
"self",
",",
"request",
",",
"queryset",
")",
":",
"queryset",
".",
"update",
"(",
"enabled",
"=",
"True",
")",
"self",
".",
"update_periodic_tasks",
"(",
")"
] | https://github.com/celery/django-celery/blob/c679b05b2abc174e6fa3231b120a07b49ec8f911/djcelery/admin.py#L362-L364 | ||||
aws-quickstart/quickstart-redhat-openshift | 2b87dd38b72e7e4c439a606c5a9ea458d72da612 | functions/source/KeyGen/asn1crypto/keys.py | python | PublicKeyInfo.fingerprint | (self) | return self._fingerprint | Creates a fingerprint that can be compared with a private key to see if
the two form a pair.
This fingerprint is not compatible with fingerprints generated by any
other software.
:return:
A byte string that is a sha256 hash of selected components (based
on the k... | Creates a fingerprint that can be compared with a private key to see if
the two form a pair. | [
"Creates",
"a",
"fingerprint",
"that",
"can",
"be",
"compared",
"with",
"a",
"private",
"key",
"to",
"see",
"if",
"the",
"two",
"form",
"a",
"pair",
"."
] | def fingerprint(self):
"""
Creates a fingerprint that can be compared with a private key to see if
the two form a pair.
This fingerprint is not compatible with fingerprints generated by any
other software.
:return:
A byte string that is a sha256 hash of sele... | [
"def",
"fingerprint",
"(",
"self",
")",
":",
"if",
"self",
".",
"_fingerprint",
"is",
"None",
":",
"key_type",
"=",
"self",
"[",
"'algorithm'",
"]",
"[",
"'algorithm'",
"]",
".",
"native",
"params",
"=",
"self",
"[",
"'algorithm'",
"]",
"[",
"'parameters... | https://github.com/aws-quickstart/quickstart-redhat-openshift/blob/2b87dd38b72e7e4c439a606c5a9ea458d72da612/functions/source/KeyGen/asn1crypto/keys.py#L1193-L1249 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/stats/morestats.py | python | _yeojohnson_transform | (x, lmbda) | return out | Return x transformed by the Yeo-Johnson power transform with given
parameter lmbda. | Return x transformed by the Yeo-Johnson power transform with given
parameter lmbda. | [
"Return",
"x",
"transformed",
"by",
"the",
"Yeo",
"-",
"Johnson",
"power",
"transform",
"with",
"given",
"parameter",
"lmbda",
"."
] | def _yeojohnson_transform(x, lmbda):
"""Return x transformed by the Yeo-Johnson power transform with given
parameter lmbda."""
out = np.zeros_like(x)
pos = x >= 0 # binary mask
# when x >= 0
if abs(lmbda) < np.spacing(1.):
out[pos] = np.log1p(x[pos])
else: # lmbda != 0
ou... | [
"def",
"_yeojohnson_transform",
"(",
"x",
",",
"lmbda",
")",
":",
"out",
"=",
"np",
".",
"zeros_like",
"(",
"x",
")",
"pos",
"=",
"x",
">=",
"0",
"# binary mask",
"# when x >= 0",
"if",
"abs",
"(",
"lmbda",
")",
"<",
"np",
".",
"spacing",
"(",
"1.",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/stats/morestats.py#L1353-L1372 | |
exercism/python | f79d44ef6c9cf68d8c76cb94017a590f04391635 | exercises/practice/clock/.meta/example.py | python | Clock.__add__ | (self, minutes) | return self.cleanup() | [] | def __add__(self, minutes):
self.minute += minutes
return self.cleanup() | [
"def",
"__add__",
"(",
"self",
",",
"minutes",
")",
":",
"self",
".",
"minute",
"+=",
"minutes",
"return",
"self",
".",
"cleanup",
"(",
")"
] | https://github.com/exercism/python/blob/f79d44ef6c9cf68d8c76cb94017a590f04391635/exercises/practice/clock/.meta/example.py#L18-L20 | |||
xdress/xdress | eb7f0a02b3edf617d401939ede7f0d713a88917f | xdress/clang/cindex.py | python | Token.location | (self) | return conf.lib.clang_getTokenLocation(self._tu, self) | The SourceLocation this Token occurs at. | The SourceLocation this Token occurs at. | [
"The",
"SourceLocation",
"this",
"Token",
"occurs",
"at",
"."
] | def location(self):
"""The SourceLocation this Token occurs at."""
return conf.lib.clang_getTokenLocation(self._tu, self) | [
"def",
"location",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getTokenLocation",
"(",
"self",
".",
"_tu",
",",
"self",
")"
] | https://github.com/xdress/xdress/blob/eb7f0a02b3edf617d401939ede7f0d713a88917f/xdress/clang/cindex.py#L2799-L2801 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/wheel/install.py | python | WheelFile.compatibility_rank | (self, supported) | return (_big_number, 0) | Rank the wheel against the supported tags. Smaller ranks are more
compatible!
:param supported: A list of compatibility tags that the current
Python implemenation can run. | Rank the wheel against the supported tags. Smaller ranks are more
compatible! | [
"Rank",
"the",
"wheel",
"against",
"the",
"supported",
"tags",
".",
"Smaller",
"ranks",
"are",
"more",
"compatible!"
] | def compatibility_rank(self, supported):
"""Rank the wheel against the supported tags. Smaller ranks are more
compatible!
:param supported: A list of compatibility tags that the current
Python implemenation can run.
"""
preferences = []
for tag in self.compat... | [
"def",
"compatibility_rank",
"(",
"self",
",",
"supported",
")",
":",
"preferences",
"=",
"[",
"]",
"for",
"tag",
"in",
"self",
".",
"compatibility_tags",
":",
"try",
":",
"preferences",
".",
"append",
"(",
"supported",
".",
"index",
"(",
"tag",
")",
")"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/wheel/install.py#L157-L173 | |
google/gin-config | 1c1458065120141f0090335ac59c4a43f3923cee | gin/config.py | python | parse_config_files_and_bindings | (
config_files: Optional[Sequence[str]],
bindings: Optional[Sequence[str]],
finalize_config: bool = True,
skip_unknown: Union[bool, Sequence[str]] = False,
print_includes_and_imports: bool = False) | return nested_includes_and_imports | Parse a list of config files followed by extra Gin bindings.
This function is equivalent to:
for config_file in config_files:
gin.parse_config_file(config_file, skip_configurables)
gin.parse_config(bindings, skip_configurables)
if finalize_config:
gin.finalize()
Args:
config... | Parse a list of config files followed by extra Gin bindings. | [
"Parse",
"a",
"list",
"of",
"config",
"files",
"followed",
"by",
"extra",
"Gin",
"bindings",
"."
] | def parse_config_files_and_bindings(
config_files: Optional[Sequence[str]],
bindings: Optional[Sequence[str]],
finalize_config: bool = True,
skip_unknown: Union[bool, Sequence[str]] = False,
print_includes_and_imports: bool = False):
"""Parse a list of config files followed by extra Gin bindings.
... | [
"def",
"parse_config_files_and_bindings",
"(",
"config_files",
":",
"Optional",
"[",
"Sequence",
"[",
"str",
"]",
"]",
",",
"bindings",
":",
"Optional",
"[",
"Sequence",
"[",
"str",
"]",
"]",
",",
"finalize_config",
":",
"bool",
"=",
"True",
",",
"skip_unkno... | https://github.com/google/gin-config/blob/1c1458065120141f0090335ac59c4a43f3923cee/gin/config.py#L2460-L2510 | |
exodrifter/unity-python | bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d | Lib/chunk.py | python | Chunk.getsize | (self) | return self.chunksize | Return the size of the current chunk. | Return the size of the current chunk. | [
"Return",
"the",
"size",
"of",
"the",
"current",
"chunk",
"."
] | def getsize(self):
"""Return the size of the current chunk."""
return self.chunksize | [
"def",
"getsize",
"(",
"self",
")",
":",
"return",
"self",
".",
"chunksize"
] | https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/chunk.py#L82-L84 | |
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/email/_header_value_parser.py | python | get_extended_attribute | (value) | return attribute, value | [CFWS] 1*extended_attrtext [CFWS]
This is like the non-extended version except we allow % characters, so that
we can pick up an encoded value as a single string. | [CFWS] 1*extended_attrtext [CFWS] | [
"[",
"CFWS",
"]",
"1",
"*",
"extended_attrtext",
"[",
"CFWS",
"]"
] | def get_extended_attribute(value):
""" [CFWS] 1*extended_attrtext [CFWS]
This is like the non-extended version except we allow % characters, so that
we can pick up an encoded value as a single string.
"""
# XXX: should we have an ExtendedAttribute TokenList?
attribute = Attribute()
if valu... | [
"def",
"get_extended_attribute",
"(",
"value",
")",
":",
"# XXX: should we have an ExtendedAttribute TokenList?",
"attribute",
"=",
"Attribute",
"(",
")",
"if",
"value",
"and",
"value",
"[",
"0",
"]",
"in",
"CFWS_LEADER",
":",
"token",
",",
"value",
"=",
"get_cfws... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/email/_header_value_parser.py#L2570-L2590 | |
dagster-io/dagster | b27d569d5fcf1072543533a0c763815d96f90b8f | python_modules/libraries/dagster-dbt/dagster_dbt/rpc/solids.py | python | dbt_rpc_compile_sql | (context: SolidExecutionContext, sql: String) | return unwrap_result(
_poll_rpc(
context,
request_token,
should_yield_materializations=context.solid_config["yield_materializations"],
)
) | This solid sends the ``dbt compile`` command to a dbt RPC server and returns the request
token.
This dbt RPC solid is asynchronous. The request token can be used in subsequent RPC requests to
poll the progress of the running dbt process. | This solid sends the ``dbt compile`` command to a dbt RPC server and returns the request
token. | [
"This",
"solid",
"sends",
"the",
"dbt",
"compile",
"command",
"to",
"a",
"dbt",
"RPC",
"server",
"and",
"returns",
"the",
"request",
"token",
"."
] | def dbt_rpc_compile_sql(context: SolidExecutionContext, sql: String) -> DbtRpcOutput:
"""This solid sends the ``dbt compile`` command to a dbt RPC server and returns the request
token.
This dbt RPC solid is asynchronous. The request token can be used in subsequent RPC requests to
poll the progress of t... | [
"def",
"dbt_rpc_compile_sql",
"(",
"context",
":",
"SolidExecutionContext",
",",
"sql",
":",
"String",
")",
"->",
"DbtRpcOutput",
":",
"out",
"=",
"context",
".",
"resources",
".",
"dbt_rpc",
".",
"compile_sql",
"(",
"sql",
"=",
"sql",
",",
"name",
"=",
"c... | https://github.com/dagster-io/dagster/blob/b27d569d5fcf1072543533a0c763815d96f90b8f/python_modules/libraries/dagster-dbt/dagster_dbt/rpc/solids.py#L805-L822 | |
spartan-array/spartan | fdcf059ce7e48688648d793d632dc5961f4e72b5 | spartan/expr/operator/filter.py | python | _bool_index_mapper | (ex, src, idx) | return LocalKernelResult(result=[(ex, tile_id)]) | Kernel function for boolean indexing.
Fetches the input file from ``src`` and applies the mask from ``idx``.
Args:
ex: `Extent` to process.
src (DistArray):
idx (DistArray): | Kernel function for boolean indexing. | [
"Kernel",
"function",
"for",
"boolean",
"indexing",
"."
] | def _bool_index_mapper(ex, src, idx):
'''Kernel function for boolean indexing.
Fetches the input file from ``src`` and applies the mask from ``idx``.
Args:
ex: `Extent` to process.
src (DistArray):
idx (DistArray):
'''
val = src.fetch(ex)
mask = idx.fetch(ex)
#util.log_info('\nVal: %s\n Ma... | [
"def",
"_bool_index_mapper",
"(",
"ex",
",",
"src",
",",
"idx",
")",
":",
"val",
"=",
"src",
".",
"fetch",
"(",
"ex",
")",
"mask",
"=",
"idx",
".",
"fetch",
"(",
"ex",
")",
"#util.log_info('\\nVal: %s\\n Mask: %s', val, mask)",
"masked_val",
"=",
"np",
"."... | https://github.com/spartan-array/spartan/blob/fdcf059ce7e48688648d793d632dc5961f4e72b5/spartan/expr/operator/filter.py#L79-L97 | |
MDudek-ICS/TRISIS-TRITON-HATMAN | 15a00af7fd1040f0430729d024427601f84886a1 | decompiled_code/library/threading.py | python | Thread.__delete | (self) | Remove current thread from the dict of currently running threads. | Remove current thread from the dict of currently running threads. | [
"Remove",
"current",
"thread",
"from",
"the",
"dict",
"of",
"currently",
"running",
"threads",
"."
] | def __delete(self):
"""Remove current thread from the dict of currently running threads."""
try:
with _active_limbo_lock:
del _active[_get_ident()]
except KeyError:
if 'dummy_threading' not in _sys.modules:
raise | [
"def",
"__delete",
"(",
"self",
")",
":",
"try",
":",
"with",
"_active_limbo_lock",
":",
"del",
"_active",
"[",
"_get_ident",
"(",
")",
"]",
"except",
"KeyError",
":",
"if",
"'dummy_threading'",
"not",
"in",
"_sys",
".",
"modules",
":",
"raise"
] | https://github.com/MDudek-ICS/TRISIS-TRITON-HATMAN/blob/15a00af7fd1040f0430729d024427601f84886a1/decompiled_code/library/threading.py#L773-L780 | ||
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/web/client.py | python | _GzipProtocol.connectionLost | (self, reason) | Forward the connection lost event, flushing remaining data from the
decompressor if any. | Forward the connection lost event, flushing remaining data from the
decompressor if any. | [
"Forward",
"the",
"connection",
"lost",
"event",
"flushing",
"remaining",
"data",
"from",
"the",
"decompressor",
"if",
"any",
"."
] | def connectionLost(self, reason):
"""
Forward the connection lost event, flushing remaining data from the
decompressor if any.
"""
try:
rawData = self._zlibDecompress.flush()
except zlib.error:
raise ResponseFailed([reason, failure.Failure()], self... | [
"def",
"connectionLost",
"(",
"self",
",",
"reason",
")",
":",
"try",
":",
"rawData",
"=",
"self",
".",
"_zlibDecompress",
".",
"flush",
"(",
")",
"except",
"zlib",
".",
"error",
":",
"raise",
"ResponseFailed",
"(",
"[",
"reason",
",",
"failure",
".",
... | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/web/client.py#L1448-L1459 | ||
enthought/traits | d22ce1f096e2a6f87c78d7f1bb5bf0abab1a18ff | traits/traits_listener.py | python | ListenerParser.skip_ws | (self) | The next non-whitespace character. | The next non-whitespace character. | [
"The",
"next",
"non",
"-",
"whitespace",
"character",
"."
] | def skip_ws(self):
"""The next non-whitespace character."""
while True:
c = self.next
if c not in whitespace:
return c | [
"def",
"skip_ws",
"(",
"self",
")",
":",
"while",
"True",
":",
"c",
"=",
"self",
".",
"next",
"if",
"c",
"not",
"in",
"whitespace",
":",
"return",
"c"
] | https://github.com/enthought/traits/blob/d22ce1f096e2a6f87c78d7f1bb5bf0abab1a18ff/traits/traits_listener.py#L965-L970 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/cubecolourdialog.py | python | CubeColourDialog.SetCodes | (self) | Sets the HTML/MS Access codes (if any) in the text controls. | Sets the HTML/MS Access codes (if any) in the text controls. | [
"Sets",
"the",
"HTML",
"/",
"MS",
"Access",
"codes",
"(",
"if",
"any",
")",
"in",
"the",
"text",
"controls",
"."
] | def SetCodes(self):
""" Sets the HTML/MS Access codes (if any) in the text controls. """
colour = rgb2html(self._colour)
self.htmlCode.SetValue(colour)
self.htmlCode.Refresh()
if colour in HTMLCodes:
colourName, access, webSafe = HTMLCodes[colour]
self.w... | [
"def",
"SetCodes",
"(",
"self",
")",
":",
"colour",
"=",
"rgb2html",
"(",
"self",
".",
"_colour",
")",
"self",
".",
"htmlCode",
".",
"SetValue",
"(",
"colour",
")",
"self",
".",
"htmlCode",
".",
"Refresh",
"(",
")",
"if",
"colour",
"in",
"HTMLCodes",
... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/cubecolourdialog.py#L3260-L3275 | ||
amundsen-io/amundsendatabuilder | a0af611350fde12438450d4bfd83b226ef220c3f | databuilder/__init__.py | python | Scoped.get_scope | (self) | return '' | A scope for the config. Typesafe config supports nested config.
Scope, string, is used to basically peel off nested config
:return: | A scope for the config. Typesafe config supports nested config.
Scope, string, is used to basically peel off nested config
:return: | [
"A",
"scope",
"for",
"the",
"config",
".",
"Typesafe",
"config",
"supports",
"nested",
"config",
".",
"Scope",
"string",
"is",
"used",
"to",
"basically",
"peel",
"off",
"nested",
"config",
":",
"return",
":"
] | def get_scope(self) -> str:
"""
A scope for the config. Typesafe config supports nested config.
Scope, string, is used to basically peel off nested config
:return:
"""
return '' | [
"def",
"get_scope",
"(",
"self",
")",
"->",
"str",
":",
"return",
"''"
] | https://github.com/amundsen-io/amundsendatabuilder/blob/a0af611350fde12438450d4bfd83b226ef220c3f/databuilder/__init__.py#L48-L54 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/demo/weather.py | python | async_setup_entry | (
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up the Demo config entry. | Set up the Demo config entry. | [
"Set",
"up",
"the",
"Demo",
"config",
"entry",
"."
] | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the Demo config entry."""
setup_platform(hass, {}, async_add_entities) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"setup_platform",
"(",
"hass",
",",
"{",
"}",
",",
"async_add_ent... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/demo/weather.py#L54-L60 | ||
mediacloud/backend | d36b489e4fbe6e44950916a04d9543a1d6cd5df0 | apps/common/src/python/mediawords/util/web/user_agent/__init__.py | python | UserAgent.max_size | (self) | return self.__max_size | Return max. download size; if None, download size will not be limited. | Return max. download size; if None, download size will not be limited. | [
"Return",
"max",
".",
"download",
"size",
";",
"if",
"None",
"download",
"size",
"will",
"not",
"be",
"limited",
"."
] | def max_size(self) -> Union[int, None]:
"""Return max. download size; if None, download size will not be limited."""
return self.__max_size | [
"def",
"max_size",
"(",
"self",
")",
"->",
"Union",
"[",
"int",
",",
"None",
"]",
":",
"return",
"self",
".",
"__max_size"
] | https://github.com/mediacloud/backend/blob/d36b489e4fbe6e44950916a04d9543a1d6cd5df0/apps/common/src/python/mediawords/util/web/user_agent/__init__.py#L885-L887 | |
FreeOpcUa/python-opcua | 67f15551884d7f11659d52483e7b932999ca3a75 | opcua/common/node.py | python | Node.get_children | (self, refs=ua.ObjectIds.HierarchicalReferences, nodeclassmask=ua.NodeClass.Unspecified) | return self.get_referenced_nodes(refs, ua.BrowseDirection.Forward, nodeclassmask) | Get all children of a node. By default hierarchical references and all node classes are returned.
Other reference types may be given:
References = 31
NonHierarchicalReferences = 32
HierarchicalReferences = 33
HasChild = 34
Organizes = 35
HasEventSource = 36
... | Get all children of a node. By default hierarchical references and all node classes are returned.
Other reference types may be given:
References = 31
NonHierarchicalReferences = 32
HierarchicalReferences = 33
HasChild = 34
Organizes = 35
HasEventSource = 36
... | [
"Get",
"all",
"children",
"of",
"a",
"node",
".",
"By",
"default",
"hierarchical",
"references",
"and",
"all",
"node",
"classes",
"are",
"returned",
".",
"Other",
"reference",
"types",
"may",
"be",
"given",
":",
"References",
"=",
"31",
"NonHierarchicalReferen... | def get_children(self, refs=ua.ObjectIds.HierarchicalReferences, nodeclassmask=ua.NodeClass.Unspecified):
"""
Get all children of a node. By default hierarchical references and all node classes are returned.
Other reference types may be given:
References = 31
NonHierarchicalRefer... | [
"def",
"get_children",
"(",
"self",
",",
"refs",
"=",
"ua",
".",
"ObjectIds",
".",
"HierarchicalReferences",
",",
"nodeclassmask",
"=",
"ua",
".",
"NodeClass",
".",
"Unspecified",
")",
":",
"return",
"self",
".",
"get_referenced_nodes",
"(",
"refs",
",",
"ua... | https://github.com/FreeOpcUa/python-opcua/blob/67f15551884d7f11659d52483e7b932999ca3a75/opcua/common/node.py#L294-L316 | |
google/turbinia | 4559d4af9267762a8995cfc415099a80a22ee4d3 | turbinia/workers/hindsight.py | python | HindsightTask.run | (self, evidence, result) | return result | Task to execute hindsight.
Args:
evidence (Evidence object): The evidence we will process.
result (TurbiniaTaskResult): The object to place task results into.
Returns:
TurbiniaTaskResult object. | Task to execute hindsight. | [
"Task",
"to",
"execute",
"hindsight",
"."
] | def run(self, evidence, result):
"""Task to execute hindsight.
Args:
evidence (Evidence object): The evidence we will process.
result (TurbiniaTaskResult): The object to place task results into.
Returns:
TurbiniaTaskResult object.
"""
# Create a path that we can write the... | [
"def",
"run",
"(",
"self",
",",
"evidence",
",",
"result",
")",
":",
"# Create a path that we can write the new file to.",
"output_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"output_dir",
",",
"'hindsight_report'",
")",
"# Create the new Evid... | https://github.com/google/turbinia/blob/4559d4af9267762a8995cfc415099a80a22ee4d3/turbinia/workers/hindsight.py#L31-L62 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/pyparsing.py | python | And.__init__ | ( self, exprs, savelist = True ) | [] | def __init__( self, exprs, savelist = True ):
super(And,self).__init__(exprs, savelist)
self.mayReturnEmpty = all(e.mayReturnEmpty for e in self.exprs)
self.setWhitespaceChars( self.exprs[0].whiteChars )
self.skipWhitespace = self.exprs[0].skipWhitespace
self.callPreparse = True | [
"def",
"__init__",
"(",
"self",
",",
"exprs",
",",
"savelist",
"=",
"True",
")",
":",
"super",
"(",
"And",
",",
"self",
")",
".",
"__init__",
"(",
"exprs",
",",
"savelist",
")",
"self",
".",
"mayReturnEmpty",
"=",
"all",
"(",
"e",
".",
"mayReturnEmpt... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/pyparsing.py#L3349-L3354 | ||||
HuberTRoy/MusicBox | 82fdf21809b7f018c616c4d1c78cfbf04cd5d9e3 | MusicPlayer/features/configQQFeatures.py | python | ConfigQQ.__init__ | (self, parent) | [] | def __init__(self, parent):
super(ConfigQQ, self).__init__(parent)
self.api = qqApi
self.ein = 29 | [
"def",
"__init__",
"(",
"self",
",",
"parent",
")",
":",
"super",
"(",
"ConfigQQ",
",",
"self",
")",
".",
"__init__",
"(",
"parent",
")",
"self",
".",
"api",
"=",
"qqApi",
"self",
".",
"ein",
"=",
"29"
] | https://github.com/HuberTRoy/MusicBox/blob/82fdf21809b7f018c616c4d1c78cfbf04cd5d9e3/MusicPlayer/features/configQQFeatures.py#L8-L13 | ||||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/change_feed/consumer/feed.py | python | KafkaChangeFeed._get_single_topic_or_fail | (self) | return self._topics[0] | [] | def _get_single_topic_or_fail(self):
if len(self._topics) != 1:
raise ValueError("This function requires a single topic but found {}!".format(self._topics))
return self._topics[0] | [
"def",
"_get_single_topic_or_fail",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_topics",
")",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"This function requires a single topic but found {}!\"",
".",
"format",
"(",
"self",
".",
"_topics",
")",
")",... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/change_feed/consumer/feed.py#L53-L56 | |||
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/core/typing/npydecl.py | python | _check_linalg_matrix | (a, func_name) | [] | def _check_linalg_matrix(a, func_name):
if not isinstance(a, types.Array):
return
if not a.ndim == 2:
raise TypingError("np.linalg.%s() only supported on 2-D arrays"
% func_name)
if not isinstance(a.dtype, (types.Float, types.Complex)):
raise TypingError("np... | [
"def",
"_check_linalg_matrix",
"(",
"a",
",",
"func_name",
")",
":",
"if",
"not",
"isinstance",
"(",
"a",
",",
"types",
".",
"Array",
")",
":",
"return",
"if",
"not",
"a",
".",
"ndim",
"==",
"2",
":",
"raise",
"TypingError",
"(",
"\"np.linalg.%s() only s... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/typing/npydecl.py#L1030-L1038 | ||||
zigpy/zigpy | db10b078874d93ad1c546ec810706c2e5dc33d7f | zigpy/zdo/__init__.py | python | ZDO.device | (self) | return self._device | [] | def device(self):
return self._device | [
"def",
"device",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device"
] | https://github.com/zigpy/zigpy/blob/db10b078874d93ad1c546ec810706c2e5dc33d7f/zigpy/zdo/__init__.py#L210-L211 | |||
wmliang/pe-afl | 4036d2f41da20ff12ecac43a076de5d60ce68bd9 | lighthouse/lighthouse/ui/coverage_combobox.py | python | CoverageComboBoxModel.data | (self, index, role=QtCore.Qt.DisplayRole) | return None | Define how Qt should access the underlying model data. | Define how Qt should access the underlying model data. | [
"Define",
"how",
"Qt",
"should",
"access",
"the",
"underlying",
"model",
"data",
"."
] | def data(self, index, role=QtCore.Qt.DisplayRole):
"""
Define how Qt should access the underlying model data.
"""
# sanity check the given index
if not index.isValid() or \
not (index.row() < self.rowCount()) or \
not (index.column() < self.columnCount()... | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
"=",
"QtCore",
".",
"Qt",
".",
"DisplayRole",
")",
":",
"# sanity check the given index",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
"or",
"not",
"(",
"index",
".",
"row",
"(",
")",
"<",
"se... | https://github.com/wmliang/pe-afl/blob/4036d2f41da20ff12ecac43a076de5d60ce68bd9/lighthouse/lighthouse/ui/coverage_combobox.py#L528-L613 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/polys/agca/modules.py | python | FreeModuleQuotientRing.unlift | (self, elem) | return self.convert(elem.data) | Push down an element of self.quot to self.
This undoes ``lift``.
Examples
========
>>> from sympy.abc import x
>>> from sympy import QQ
>>> F = (QQ.old_poly_ring(x)/[x**2 + 1]).free_module(2)
>>> e = F.convert([1, 0])
>>> l = F.lift(e)
>>> e == ... | Push down an element of self.quot to self. | [
"Push",
"down",
"an",
"element",
"of",
"self",
".",
"quot",
"to",
"self",
"."
] | def unlift(self, elem):
"""
Push down an element of self.quot to self.
This undoes ``lift``.
Examples
========
>>> from sympy.abc import x
>>> from sympy import QQ
>>> F = (QQ.old_poly_ring(x)/[x**2 + 1]).free_module(2)
>>> e = F.convert([1, 0])... | [
"def",
"unlift",
"(",
"self",
",",
"elem",
")",
":",
"return",
"self",
".",
"convert",
"(",
"elem",
".",
"data",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/polys/agca/modules.py#L580-L599 | |
openstack-archive/dragonflow | 4dc36ed6490e2ed53b47dece883cdbd78ea96033 | dragonflow/switch/drivers/ovs/os_ken_base_app.py | python | OsKenDFAdapter.set_sw_async_msg_config_for_ttl | (self, cur_config) | Configure switch for TTL
Configure the switch to packet-in TTL invalid packets to controller.
Note that this method only works in OFP 1.3, however, this os_ken app
claims that it only supports ofproto_v1_3.OFP_VERSION. So, no check
will be made here. | Configure switch for TTL | [
"Configure",
"switch",
"for",
"TTL"
] | def set_sw_async_msg_config_for_ttl(self, cur_config):
"""Configure switch for TTL
Configure the switch to packet-in TTL invalid packets to controller.
Note that this method only works in OFP 1.3, however, this os_ken app
claims that it only supports ofproto_v1_3.OFP_VERSION. So, no che... | [
"def",
"set_sw_async_msg_config_for_ttl",
"(",
"self",
",",
"cur_config",
")",
":",
"dp",
"=",
"self",
".",
"_datapath",
"parser",
"=",
"dp",
".",
"ofproto_parser",
"ofproto",
"=",
"dp",
".",
"ofproto",
"if",
"cur_config",
".",
"packet_in_mask",
"[",
"0",
"]... | https://github.com/openstack-archive/dragonflow/blob/4dc36ed6490e2ed53b47dece883cdbd78ea96033/dragonflow/switch/drivers/ovs/os_ken_base_app.py#L183-L207 | ||
mrlesmithjr/Ansible | d44f0dc0d942bdf3bf7334b307e6048f0ee16e36 | roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarInfo.get_info | (self) | return info | Return the TarInfo's attributes as a dictionary. | Return the TarInfo's attributes as a dictionary. | [
"Return",
"the",
"TarInfo",
"s",
"attributes",
"as",
"a",
"dictionary",
"."
] | def get_info(self):
"""Return the TarInfo's attributes as a dictionary.
"""
info = {
"name": self.name,
"mode": self.mode & 0o7777,
"uid": self.uid,
"gid": self.gid,
"size": self.size,
"mtime": self.... | [
"def",
"get_info",
"(",
"self",
")",
":",
"info",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"mode\"",
":",
"self",
".",
"mode",
"&",
"0o7777",
",",
"\"uid\"",
":",
"self",
".",
"uid",
",",
"\"gid\"",
":",
"self",
".",
"gid",
",",
"\"... | https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L978-L1000 | |
ricequant/rqalpha | d8b345ca3fde299e061c6a89c1f2c362c3584c96 | rqalpha/portfolio/__init__.py | python | Portfolio.future_account | (self) | return self._accounts.get(DEFAULT_ACCOUNT_TYPE.FUTURE.name, None) | [FutureAccount] 期货账户 | [FutureAccount] 期货账户 | [
"[",
"FutureAccount",
"]",
"期货账户"
] | def future_account(self):
"""
[FutureAccount] 期货账户
"""
return self._accounts.get(DEFAULT_ACCOUNT_TYPE.FUTURE.name, None) | [
"def",
"future_account",
"(",
"self",
")",
":",
"return",
"self",
".",
"_accounts",
".",
"get",
"(",
"DEFAULT_ACCOUNT_TYPE",
".",
"FUTURE",
".",
"name",
",",
"None",
")"
] | https://github.com/ricequant/rqalpha/blob/d8b345ca3fde299e061c6a89c1f2c362c3584c96/rqalpha/portfolio/__init__.py#L126-L130 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/groups/semimonomial_transformations/semimonomial_transformation_group.py | python | SemimonomialActionMat.__init__ | (self, G, M, check=True) | r"""
Initialization.
EXAMPLES::
sage: F.<a> = GF(4)
sage: s = SemimonomialTransformationGroup(F, 3).an_element()
sage: M = MatrixSpace(F, 3).one()
sage: s*M # indirect doctest
[ 0 1 0]
[ 0 0 1]
[a... | r"""
Initialization. | [
"r",
"Initialization",
"."
] | def __init__(self, G, M, check=True):
r"""
Initialization.
EXAMPLES::
sage: F.<a> = GF(4)
sage: s = SemimonomialTransformationGroup(F, 3).an_element()
sage: M = MatrixSpace(F, 3).one()
sage: s*M # indirect doctest
[ 0 1 0]
... | [
"def",
"__init__",
"(",
"self",
",",
"G",
",",
"M",
",",
"check",
"=",
"True",
")",
":",
"if",
"check",
":",
"from",
"sage",
".",
"matrix",
".",
"matrix_space",
"import",
"MatrixSpace",
"if",
"not",
"isinstance",
"(",
"G",
",",
"SemimonomialTransformatio... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/groups/semimonomial_transformations/semimonomial_transformation_group.py#L463-L488 | ||
mandiant/flare-qdb | daf2dbf4cdc3b76f07203c44cd993d8a9a8c529f | flareqdb/__init__.py | python | Qdb._add_delayed_query | (self, pc_symbolic, vexpr, conds) | Set delayed breakpoint. | Set delayed breakpoint. | [
"Set",
"delayed",
"breakpoint",
"."
] | def _add_delayed_query(self, pc_symbolic, vexpr, conds):
"""Set delayed breakpoint."""
self._exprs_delayed[pc_symbolic] = vexpr
self._trace.addBreakpoint(QdbBreak(self, pc_symbolic, vexpr, conds)) | [
"def",
"_add_delayed_query",
"(",
"self",
",",
"pc_symbolic",
",",
"vexpr",
",",
"conds",
")",
":",
"self",
".",
"_exprs_delayed",
"[",
"pc_symbolic",
"]",
"=",
"vexpr",
"self",
".",
"_trace",
".",
"addBreakpoint",
"(",
"QdbBreak",
"(",
"self",
",",
"pc_sy... | https://github.com/mandiant/flare-qdb/blob/daf2dbf4cdc3b76f07203c44cd993d8a9a8c529f/flareqdb/__init__.py#L1935-L1938 | ||
coreemu/core | 7e18a7a72023a69a92ad61d87461bd659ba27f7c | daemon/core/emulator/data.py | python | IpPrefixes.create_iface | (
self, node: "CoreNode", name: str = None, mac: str = None
) | return iface_data | Creates interface data for linking nodes, using the nodes unique id for
generation, along with a random mac address, unless provided.
:param node: node to create interface for
:param name: name to set for interface, default is eth{id}
:param mac: mac address to use for this interface, d... | Creates interface data for linking nodes, using the nodes unique id for
generation, along with a random mac address, unless provided. | [
"Creates",
"interface",
"data",
"for",
"linking",
"nodes",
"using",
"the",
"nodes",
"unique",
"id",
"for",
"generation",
"along",
"with",
"a",
"random",
"mac",
"address",
"unless",
"provided",
"."
] | def create_iface(
self, node: "CoreNode", name: str = None, mac: str = None
) -> InterfaceData:
"""
Creates interface data for linking nodes, using the nodes unique id for
generation, along with a random mac address, unless provided.
:param node: node to create interface for... | [
"def",
"create_iface",
"(",
"self",
",",
"node",
":",
"\"CoreNode\"",
",",
"name",
":",
"str",
"=",
"None",
",",
"mac",
":",
"str",
"=",
"None",
")",
"->",
"InterfaceData",
":",
"iface_data",
"=",
"self",
".",
"gen_iface",
"(",
"node",
".",
"id",
","... | https://github.com/coreemu/core/blob/7e18a7a72023a69a92ad61d87461bd659ba27f7c/daemon/core/emulator/data.py#L275-L290 | |
burke-software/django-report-builder | 21394979d3dc35afac06155aa2dd6cc4bdaffe19 | report_builder/models.py | python | DisplayField.get_choices | (self, model, field_name) | [] | def get_choices(self, model, field_name):
try:
model_field = model._meta.get_field_by_name(field_name)[0]
except:
model_field = None
if model_field and model_field.choices:
return ((model_field.get_prep_value(key), val) for key, val in model_field.choices) | [
"def",
"get_choices",
"(",
"self",
",",
"model",
",",
"field_name",
")",
":",
"try",
":",
"model_field",
"=",
"model",
".",
"_meta",
".",
"get_field_by_name",
"(",
"field_name",
")",
"[",
"0",
"]",
"except",
":",
"model_field",
"=",
"None",
"if",
"model_... | https://github.com/burke-software/django-report-builder/blob/21394979d3dc35afac06155aa2dd6cc4bdaffe19/report_builder/models.py#L555-L561 | ||||
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/trial/reporter.py | python | TestResult.stopTest | (self, test) | This must be called after the given test is completed.
@type test: L{pyunit.TestCase} | This must be called after the given test is completed. | [
"This",
"must",
"be",
"called",
"after",
"the",
"given",
"test",
"is",
"completed",
"."
] | def stopTest(self, test):
"""
This must be called after the given test is completed.
@type test: L{pyunit.TestCase}
"""
super(TestResult, self).stopTest(test)
self._lastTime = self._getTime() - self._testStarted | [
"def",
"stopTest",
"(",
"self",
",",
"test",
")",
":",
"super",
"(",
"TestResult",
",",
"self",
")",
".",
"stopTest",
"(",
"test",
")",
"self",
".",
"_lastTime",
"=",
"self",
".",
"_getTime",
"(",
")",
"-",
"self",
".",
"_testStarted"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/trial/reporter.py#L97-L104 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/extensions_v1beta1_deployment_condition.py | python | ExtensionsV1beta1DeploymentCondition.last_update_time | (self) | return self._last_update_time | Gets the last_update_time of this ExtensionsV1beta1DeploymentCondition.
The last time this condition was updated.
:return: The last_update_time of this ExtensionsV1beta1DeploymentCondition.
:rtype: datetime | Gets the last_update_time of this ExtensionsV1beta1DeploymentCondition.
The last time this condition was updated. | [
"Gets",
"the",
"last_update_time",
"of",
"this",
"ExtensionsV1beta1DeploymentCondition",
".",
"The",
"last",
"time",
"this",
"condition",
"was",
"updated",
"."
] | def last_update_time(self):
"""
Gets the last_update_time of this ExtensionsV1beta1DeploymentCondition.
The last time this condition was updated.
:return: The last_update_time of this ExtensionsV1beta1DeploymentCondition.
:rtype: datetime
"""
return self._last_up... | [
"def",
"last_update_time",
"(",
"self",
")",
":",
"return",
"self",
".",
"_last_update_time"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/extensions_v1beta1_deployment_condition.py#L82-L90 | |
aaPanel/BaoTa | 9bb1336f31ae2893ab513af7a3efed633338c64b | class/public.py | python | cloud_check_domain | (domain) | @name 从云端验证域名的可访问性,并将结果保存到文件
@author hwliang<2020-12-10>
@param domain {string} 被验证的域名
@return void | [] | def cloud_check_domain(domain):
'''
@name 从云端验证域名的可访问性,并将结果保存到文件
@author hwliang<2020-12-10>
@param domain {string} 被验证的域名
@return void
'''
try:
check_domain_path = '{}/data/check_domain/'.format(get_panel_path())
if not os.path.exists(check_domain_path):
... | [
"def",
"cloud_check_domain",
"(",
"domain",
")",
":",
"try",
":",
"check_domain_path",
"=",
"'{}/data/check_domain/'",
".",
"format",
"(",
"get_panel_path",
"(",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"check_domain_path",
")",
":",
"os... | https://github.com/aaPanel/BaoTa/blob/9bb1336f31ae2893ab513af7a3efed633338c64b/class/public.py#L2766-L2783 | |||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/db/models/query.py | python | QuerySet.get_or_create | (self, **kwargs) | Looks up an object with the given kwargs, creating one if necessary.
Returns a tuple of (object, created), where created is a boolean
specifying whether an object was created. | Looks up an object with the given kwargs, creating one if necessary.
Returns a tuple of (object, created), where created is a boolean
specifying whether an object was created. | [
"Looks",
"up",
"an",
"object",
"with",
"the",
"given",
"kwargs",
"creating",
"one",
"if",
"necessary",
".",
"Returns",
"a",
"tuple",
"of",
"(",
"object",
"created",
")",
"where",
"created",
"is",
"a",
"boolean",
"specifying",
"whether",
"an",
"object",
"wa... | def get_or_create(self, **kwargs):
"""
Looks up an object with the given kwargs, creating one if necessary.
Returns a tuple of (object, created), where created is a boolean
specifying whether an object was created.
"""
assert kwargs, \
'get_or_create() mus... | [
"def",
"get_or_create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"kwargs",
",",
"'get_or_create() must be passed at least one keyword argument'",
"defaults",
"=",
"kwargs",
".",
"pop",
"(",
"'defaults'",
",",
"{",
"}",
")",
"lookup",
"=",
"kwarg... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/db/models/query.py#L427-L459 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_config_map_env_source.py | python | V1ConfigMapEnvSource.__init__ | (self, name=None, optional=None, local_vars_configuration=None) | V1ConfigMapEnvSource - a model defined in OpenAPI | V1ConfigMapEnvSource - a model defined in OpenAPI | [
"V1ConfigMapEnvSource",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, name=None, optional=None, local_vars_configuration=None): # noqa: E501
"""V1ConfigMapEnvSource - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_... | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"None",
",",
"optional",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa: E501",
"if",
"local_vars_configuration",
"is",
"None",
":",
"local_vars_configuration",
"=",
... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_config_map_env_source.py#L45-L58 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/BmcHelixRemedyForce/Integrations/BmcHelixRemedyForce/BMCHelixRemedyforce.py | python | handle_error_response | (response: Response) | Handles http error response and raises DemistoException with appropriate message.
:param response: Http response
:return: None
:raises DemistoException: With proper error message for different error scenarios | Handles http error response and raises DemistoException with appropriate message.
:param response: Http response
:return: None
:raises DemistoException: With proper error message for different error scenarios | [
"Handles",
"http",
"error",
"response",
"and",
"raises",
"DemistoException",
"with",
"appropriate",
"message",
".",
":",
"param",
"response",
":",
"Http",
"response",
":",
"return",
":",
"None",
":",
"raises",
"DemistoException",
":",
"With",
"proper",
"error",
... | def handle_error_response(response: Response) -> None:
"""
Handles http error response and raises DemistoException with appropriate message.
:param response: Http response
:return: None
:raises DemistoException: With proper error message for different error scenarios
"""
if response.status_c... | [
"def",
"handle_error_response",
"(",
"response",
":",
"Response",
")",
"->",
"None",
":",
"if",
"response",
".",
"status_code",
"==",
"401",
":",
"# Invalidate session from integration context.",
"integration_context",
"=",
"demisto",
".",
"getIntegrationContext",
"(",
... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/BmcHelixRemedyForce/Integrations/BmcHelixRemedyForce/BMCHelixRemedyforce.py#L521-L556 | ||
chriso/gauged | cda3bba2f3e92ce2fb4aa92132dcc0e689bf7976 | gauged/structures/float_array.py | python | FloatArray.__init__ | (self, buf=None, length=0) | Create a new array. The constructor accepts a buffer + byte_length
or a python list of floats | Create a new array. The constructor accepts a buffer + byte_length
or a python list of floats | [
"Create",
"a",
"new",
"array",
".",
"The",
"constructor",
"accepts",
"a",
"buffer",
"+",
"byte_length",
"or",
"a",
"python",
"list",
"of",
"floats"
] | def __init__(self, buf=None, length=0):
"""Create a new array. The constructor accepts a buffer + byte_length
or a python list of floats"""
if isinstance(buf, list):
items = buf
buf = None
else:
items = None
if buf is not None:
if I... | [
"def",
"__init__",
"(",
"self",
",",
"buf",
"=",
"None",
",",
"length",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"buf",
",",
"list",
")",
":",
"items",
"=",
"buf",
"buf",
"=",
"None",
"else",
":",
"items",
"=",
"None",
"if",
"buf",
"is",
"n... | https://github.com/chriso/gauged/blob/cda3bba2f3e92ce2fb4aa92132dcc0e689bf7976/gauged/structures/float_array.py#L24-L50 | ||
quantumlib/Cirq | 89f88b01d69222d3f1ec14d649b7b3a85ed9211f | cirq-google/cirq_google/engine/client/quantum_v1alpha1/gapic/quantum_engine_service_client.py | python | QuantumEngineServiceClient.delete_quantum_job | (
self,
name: Optional[str] = None,
retry: Optional[google.api_core.retry.Retry] = google.api_core.gapic_v1.method.DEFAULT,
timeout: Optional[float] = google.api_core.gapic_v1.method.DEFAULT,
metadata: Optional[Sequence[Tuple[str, str]]] = None,
) | -
Example:
>>> from cirq_google.engine.client import quantum_v1alpha1
>>>
>>> client = quantum_v1alpha1.QuantumEngineServiceClient()
>>>
>>> client.delete_quantum_job()
Args:
name (str): -
retry (Optional[google.api_co... | - | [
"-"
] | def delete_quantum_job(
self,
name: Optional[str] = None,
retry: Optional[google.api_core.retry.Retry] = google.api_core.gapic_v1.method.DEFAULT,
timeout: Optional[float] = google.api_core.gapic_v1.method.DEFAULT,
metadata: Optional[Sequence[Tuple[str, str]]] = None,
):
... | [
"def",
"delete_quantum_job",
"(",
"self",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"retry",
":",
"Optional",
"[",
"google",
".",
"api_core",
".",
"retry",
".",
"Retry",
"]",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
... | https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-google/cirq_google/engine/client/quantum_v1alpha1/gapic/quantum_engine_service_client.py#L858-L922 | ||
madhug-nadig/Machine-Learning-Algorithms-from-Scratch | 1777e7dcaf135e030610eac173ada04c04233559 | Mean Shift.py | python | main | () | Pclass Passenger Class (1 = 1st; 2 = 2nd; 3 = 3rd)
survival Survival (0 = No; 1 = Yes)
name Name
sex Sex
age Age
sibsp Number of Siblings/Spouses Aboard
parch Number of Parents/Children Aboard
ticket Ticket Number
fare Passenger Fare (British pound)
cabin Cabin
embarked Port of Embarkation (C = Cherbourg; Q =... | Pclass Passenger Class (1 = 1st; 2 = 2nd; 3 = 3rd)
survival Survival (0 = No; 1 = Yes)
name Name
sex Sex
age Age
sibsp Number of Siblings/Spouses Aboard
parch Number of Parents/Children Aboard
ticket Ticket Number
fare Passenger Fare (British pound)
cabin Cabin
embarked Port of Embarkation (C = Cherbourg; Q =... | [
"Pclass",
"Passenger",
"Class",
"(",
"1",
"=",
"1st",
";",
"2",
"=",
"2nd",
";",
"3",
"=",
"3rd",
")",
"survival",
"Survival",
"(",
"0",
"=",
"No",
";",
"1",
"=",
"Yes",
")",
"name",
"Name",
"sex",
"Sex",
"age",
"Age",
"sibsp",
"Number",
"of",
... | def main():
'''
Pclass Passenger Class (1 = 1st; 2 = 2nd; 3 = 3rd)
survival Survival (0 = No; 1 = Yes)
name Name
sex Sex
age Age
sibsp Number of Siblings/Spouses Aboard
parch Number of Parents/Children Aboard
ticket Ticket Number
fare Passenger Fare (British pound)
cabin Cabin
embarked Port of Embarkation (... | [
"def",
"main",
"(",
")",
":",
"df",
"=",
"pd",
".",
"read_excel",
"(",
"'data/titanic.xls'",
")",
"original_df",
"=",
"pd",
".",
"DataFrame",
".",
"copy",
"(",
"df",
")",
"df",
".",
"drop",
"(",
"[",
"'body'",
",",
"'name'",
"]",
",",
"1",
",",
"... | https://github.com/madhug-nadig/Machine-Learning-Algorithms-from-Scratch/blob/1777e7dcaf135e030610eac173ada04c04233559/Mean Shift.py#L24-L86 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/datetime.py | python | timedelta.seconds | (self) | return self._seconds | seconds | seconds | [
"seconds"
] | def seconds(self):
"""seconds"""
return self._seconds | [
"def",
"seconds",
"(",
"self",
")",
":",
"return",
"self",
".",
"_seconds"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/datetime.py#L496-L498 | |
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/orthoxml/_orthoxml.py | python | database.exportChildren | (self, outfile, level, namespace_='ortho:', name_='database', fromsubclass_=False) | [] | def exportChildren(self, outfile, level, namespace_='ortho:', name_='database', fromsubclass_=False):
if self.genes:
self.genes.export(outfile, level, namespace_, name_='genes', ) | [
"def",
"exportChildren",
"(",
"self",
",",
"outfile",
",",
"level",
",",
"namespace_",
"=",
"'ortho:'",
",",
"name_",
"=",
"'database'",
",",
"fromsubclass_",
"=",
"False",
")",
":",
"if",
"self",
".",
"genes",
":",
"self",
".",
"genes",
".",
"export",
... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/orthoxml/_orthoxml.py#L756-L758 | ||||
openshift/openshift-ansible-contrib | cd17fa3c5b8cab87b2403bde3a560eadcdcd0955 | setup.py | python | find_files | (base_dir, exclude_dirs, include_dirs, file_regex) | return found | find files matching file_regex | find files matching file_regex | [
"find",
"files",
"matching",
"file_regex"
] | def find_files(base_dir, exclude_dirs, include_dirs, file_regex):
''' find files matching file_regex '''
found = []
exclude_regex = ''
include_regex = ''
if exclude_dirs is not None:
exclude_regex = r'|'.join([fnmatch.translate(x) for x in exclude_dirs]) or r'$.'
if include_dirs is not... | [
"def",
"find_files",
"(",
"base_dir",
",",
"exclude_dirs",
",",
"include_dirs",
",",
"file_regex",
")",
":",
"found",
"=",
"[",
"]",
"exclude_regex",
"=",
"''",
"include_regex",
"=",
"''",
"if",
"exclude_dirs",
"is",
"not",
"None",
":",
"exclude_regex",
"=",... | https://github.com/openshift/openshift-ansible-contrib/blob/cd17fa3c5b8cab87b2403bde3a560eadcdcd0955/setup.py#L51-L75 | |
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/tlinerender.py | python | TimeLineRenderer.delete_selected_segment | (self) | [] | def delete_selected_segment(self):
# This is called from tline events and we are disabling deleting while rendering
#if _update_thread != None:
# return
for seg in self.segments:
if seg.selected == True:
self.delete_segment(seg) | [
"def",
"delete_selected_segment",
"(",
"self",
")",
":",
"# This is called from tline events and we are disabling deleting while rendering",
"#if _update_thread != None:",
"# return",
"for",
"seg",
"in",
"self",
".",
"segments",
":",
"if",
"seg",
".",
"selected",
"==",
"... | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/tlinerender.py#L420-L427 | ||||
DIYer22/boxx | d271bc375a33e01e616a0f74ce028e6d77d1820e | boxx/ylsci/ylnp.py | python | loadnp | (path='savenp_default.npz') | return arr | 读取path路径下的 .npz 返回 np.array | 读取path路径下的 .npz 返回 np.array | [
"读取path路径下的",
".",
"npz",
"返回",
"np",
".",
"array"
] | def loadnp(path='savenp_default.npz'):
'''读取path路径下的 .npz 返回 np.array'''
if path[-4:] != '.npz':
path += '.npz'
compress = np.load(path)
arr = compress[compress.files[0]]
compress.close()
return arr | [
"def",
"loadnp",
"(",
"path",
"=",
"'savenp_default.npz'",
")",
":",
"if",
"path",
"[",
"-",
"4",
":",
"]",
"!=",
"'.npz'",
":",
"path",
"+=",
"'.npz'",
"compress",
"=",
"np",
".",
"load",
"(",
"path",
")",
"arr",
"=",
"compress",
"[",
"compress",
... | https://github.com/DIYer22/boxx/blob/d271bc375a33e01e616a0f74ce028e6d77d1820e/boxx/ylsci/ylnp.py#L27-L34 | |
rootpy/rootpy | 3926935e1f2100d8ba68070c2ab44055d4800f73 | rootpy/extern/pyparsing.py | python | ParserElement.__or__ | (self, other ) | return MatchFirst( [ self, other ] ) | Implementation of | operator - returns C{L{MatchFirst}} | Implementation of | operator - returns C{L{MatchFirst}} | [
"Implementation",
"of",
"|",
"operator",
"-",
"returns",
"C",
"{",
"L",
"{",
"MatchFirst",
"}}"
] | def __or__(self, other ):
"""Implementation of | operator - returns C{L{MatchFirst}}"""
if isinstance( other, basestring ):
other = ParserElement.literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine element of type %s with P... | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement",... | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/pyparsing.py#L1337-L1345 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/library/yedit.py | python | Yedit.parse_value | (inc_value, vtype='') | return inc_value | determine value type passed | determine value type passed | [
"determine",
"value",
"type",
"passed"
] | def parse_value(inc_value, vtype=''):
'''determine value type passed'''
true_bools = ['y', 'Y', 'yes', 'Yes', 'YES', 'true', 'True', 'TRUE',
'on', 'On', 'ON', ]
false_bools = ['n', 'N', 'no', 'No', 'NO', 'false', 'False', 'FALSE',
'off', 'Off', 'OFF']... | [
"def",
"parse_value",
"(",
"inc_value",
",",
"vtype",
"=",
"''",
")",
":",
"true_bools",
"=",
"[",
"'y'",
",",
"'Y'",
",",
"'yes'",
",",
"'Yes'",
",",
"'YES'",
",",
"'true'",
",",
"'True'",
",",
"'TRUE'",
",",
"'on'",
",",
"'On'",
",",
"'ON'",
",",... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/library/yedit.py#L751-L777 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/idlelib/SearchDialogBase.py | python | SearchDialogBase.create_option_buttons | (self) | return frame, options | Return (filled frame, options) for testing.
Options is a list of SearchEngine booleanvar, label pairs.
A gridded frame from make_frame is filled with a Checkbutton
for each pair, bound to the var, with the corresponding label. | Return (filled frame, options) for testing. | [
"Return",
"(",
"filled",
"frame",
"options",
")",
"for",
"testing",
"."
] | def create_option_buttons(self):
'''Return (filled frame, options) for testing.
Options is a list of SearchEngine booleanvar, label pairs.
A gridded frame from make_frame is filled with a Checkbutton
for each pair, bound to the var, with the corresponding label.
'''
fram... | [
"def",
"create_option_buttons",
"(",
"self",
")",
":",
"frame",
"=",
"self",
".",
"make_frame",
"(",
"\"Options\"",
")",
"[",
"0",
"]",
"engine",
"=",
"self",
".",
"engine",
"options",
"=",
"[",
"(",
"engine",
".",
"revar",
",",
"\"Regular expression\"",
... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/idlelib/SearchDialogBase.py#L127-L146 | |
Ultimaker/Cura | a1622c77ea7259ecb956acd6de07b7d34b7ac52b | cura/Settings/CuraContainerStack.py | python | CuraContainerStack.quality | (self) | return cast(InstanceContainer, self._containers[_ContainerIndexes.Quality]) | Get the quality container.
:return: The quality container. Should always be a valid container, but can be equal to the empty InstanceContainer. | Get the quality container. | [
"Get",
"the",
"quality",
"container",
"."
] | def quality(self) -> InstanceContainer:
"""Get the quality container.
:return: The quality container. Should always be a valid container, but can be equal to the empty InstanceContainer.
"""
return cast(InstanceContainer, self._containers[_ContainerIndexes.Quality]) | [
"def",
"quality",
"(",
"self",
")",
"->",
"InstanceContainer",
":",
"return",
"cast",
"(",
"InstanceContainer",
",",
"self",
".",
"_containers",
"[",
"_ContainerIndexes",
".",
"Quality",
"]",
")"
] | https://github.com/Ultimaker/Cura/blob/a1622c77ea7259ecb956acd6de07b7d34b7ac52b/cura/Settings/CuraContainerStack.py#L130-L136 | |
CVLAB-Unibo/Real-time-self-adaptive-deep-stereo | 183a660b177021347b32b8986e17fbfd929ba832 | Stereo_Online_Adaptation.py | python | softmax | (x) | return np.exp(x) / np.sum(np.exp(x), axis=0) | Compute softmax values for each sets of scores in x. | Compute softmax values for each sets of scores in x. | [
"Compute",
"softmax",
"values",
"for",
"each",
"sets",
"of",
"scores",
"in",
"x",
"."
] | def softmax(x):
"""Compute softmax values for each sets of scores in x."""
return np.exp(x) / np.sum(np.exp(x), axis=0) | [
"def",
"softmax",
"(",
"x",
")",
":",
"return",
"np",
".",
"exp",
"(",
"x",
")",
"/",
"np",
".",
"sum",
"(",
"np",
".",
"exp",
"(",
"x",
")",
",",
"axis",
"=",
"0",
")"
] | https://github.com/CVLAB-Unibo/Real-time-self-adaptive-deep-stereo/blob/183a660b177021347b32b8986e17fbfd929ba832/Stereo_Online_Adaptation.py#L25-L27 | |
hyperledger/sawtooth-core | 704cd5837c21f53642c06ffc97ba7978a77940b0 | cli/sawtooth_cli/network_command/compare.py | python | print_cliques | (cliques, next_cliques, node_id_map) | Print a '*' on each branch with its block id and the ids of the nodes
that have the block. | Print a '*' on each branch with its block id and the ids of the nodes
that have the block. | [
"Print",
"a",
"*",
"on",
"each",
"branch",
"with",
"its",
"block",
"id",
"and",
"the",
"ids",
"of",
"the",
"nodes",
"that",
"have",
"the",
"block",
"."
] | def print_cliques(cliques, next_cliques, node_id_map):
"""Print a '*' on each branch with its block id and the ids of the nodes
that have the block."""
n_cliques = len(cliques)
format_str = '{:<' + str(n_cliques * 2) + '} {} {}'
branches = ['|'] * len(cliques)
for i, clique in enumerate(cliques... | [
"def",
"print_cliques",
"(",
"cliques",
",",
"next_cliques",
",",
"node_id_map",
")",
":",
"n_cliques",
"=",
"len",
"(",
"cliques",
")",
"format_str",
"=",
"'{:<'",
"+",
"str",
"(",
"n_cliques",
"*",
"2",
")",
"+",
"'} {} {}'",
"branches",
"=",
"[",
"'|... | https://github.com/hyperledger/sawtooth-core/blob/704cd5837c21f53642c06ffc97ba7978a77940b0/cli/sawtooth_cli/network_command/compare.py#L462-L474 | ||
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/site-packages/pip/compat/dictconfig.py | python | DictConfigurator.add_handlers | (self, logger, handlers) | Add handlers to a logger from a list of names. | Add handlers to a logger from a list of names. | [
"Add",
"handlers",
"to",
"a",
"logger",
"from",
"a",
"list",
"of",
"names",
"."
] | def add_handlers(self, logger, handlers):
"""Add handlers to a logger from a list of names."""
for h in handlers:
try:
logger.addHandler(self.config['handlers'][h])
except StandardError as e:
raise ValueError('Unable to add handler %r: %s' % (h, e)... | [
"def",
"add_handlers",
"(",
"self",
",",
"logger",
",",
"handlers",
")",
":",
"for",
"h",
"in",
"handlers",
":",
"try",
":",
"logger",
".",
"addHandler",
"(",
"self",
".",
"config",
"[",
"'handlers'",
"]",
"[",
"h",
"]",
")",
"except",
"StandardError",... | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/compat/dictconfig.py#L521-L527 | ||
wummel/linkchecker | c2ce810c3fb00b895a841a7be6b2e78c64e7b042 | linkcheck/strformat.py | python | get_paragraphs | (text) | return _para_ro.split(text) | A new paragraph is considered to start at a line which follows
one or more blank lines (lines containing nothing or just spaces).
The first line of the text also starts a paragraph. | A new paragraph is considered to start at a line which follows
one or more blank lines (lines containing nothing or just spaces).
The first line of the text also starts a paragraph. | [
"A",
"new",
"paragraph",
"is",
"considered",
"to",
"start",
"at",
"a",
"line",
"which",
"follows",
"one",
"or",
"more",
"blank",
"lines",
"(",
"lines",
"containing",
"nothing",
"or",
"just",
"spaces",
")",
".",
"The",
"first",
"line",
"of",
"the",
"text"... | def get_paragraphs (text):
"""A new paragraph is considered to start at a line which follows
one or more blank lines (lines containing nothing or just spaces).
The first line of the text also starts a paragraph."""
if not text:
return []
return _para_ro.split(text) | [
"def",
"get_paragraphs",
"(",
"text",
")",
":",
"if",
"not",
"text",
":",
"return",
"[",
"]",
"return",
"_para_ro",
".",
"split",
"(",
"text",
")"
] | https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/strformat.py#L128-L134 | |
firedrakeproject/firedrake | 06ab4975c14c0d4dcb79be55821f8b9e41554125 | firedrake/matrix.py | python | MatrixBase.bcs | (self) | return self._bcs | The set of boundary conditions attached to this
:class:`.MatrixBase` (may be empty). | The set of boundary conditions attached to this
:class:`.MatrixBase` (may be empty). | [
"The",
"set",
"of",
"boundary",
"conditions",
"attached",
"to",
"this",
":",
"class",
":",
".",
"MatrixBase",
"(",
"may",
"be",
"empty",
")",
"."
] | def bcs(self):
"""The set of boundary conditions attached to this
:class:`.MatrixBase` (may be empty)."""
return self._bcs | [
"def",
"bcs",
"(",
"self",
")",
":",
"return",
"self",
".",
"_bcs"
] | https://github.com/firedrakeproject/firedrake/blob/06ab4975c14c0d4dcb79be55821f8b9e41554125/firedrake/matrix.py#L44-L47 | |
SpaceNetChallenge/SpaceNet_Off_Nadir_Solutions | 014c4ca27a70b5907a183e942228004c989dcbe4 | cannab/losses.py | python | soft_dice_loss | (outputs, targets, per_image=False) | return loss | [] | def soft_dice_loss(outputs, targets, per_image=False):
batch_size = outputs.size()[0]
eps = 1e-5
if not per_image:
batch_size = 1
dice_target = targets.contiguous().view(batch_size, -1).float()
dice_output = outputs.contiguous().view(batch_size, -1)
intersection = torch.sum(dice_output *... | [
"def",
"soft_dice_loss",
"(",
"outputs",
",",
"targets",
",",
"per_image",
"=",
"False",
")",
":",
"batch_size",
"=",
"outputs",
".",
"size",
"(",
")",
"[",
"0",
"]",
"eps",
"=",
"1e-5",
"if",
"not",
"per_image",
":",
"batch_size",
"=",
"1",
"dice_targ... | https://github.com/SpaceNetChallenge/SpaceNet_Off_Nadir_Solutions/blob/014c4ca27a70b5907a183e942228004c989dcbe4/cannab/losses.py#L18-L28 | |||
automl/RoBO | 91366b12a1a3deb8e80dd08599e0eaf4df28adc1 | robo/maximizers/grid_search.py | python | GridSearch.__init__ | (self, objective_function, lower, upper, resolution=1000) | Evaluates a equally spaced grid to maximize the acquisition function
in a one dimensional input space.
Parameters
----------
objective_function: acquisition function
The acquisition function which will be maximized
lower: np.ndarray (D)
Lower bounds of th... | Evaluates a equally spaced grid to maximize the acquisition function
in a one dimensional input space. | [
"Evaluates",
"a",
"equally",
"spaced",
"grid",
"to",
"maximize",
"the",
"acquisition",
"function",
"in",
"a",
"one",
"dimensional",
"input",
"space",
"."
] | def __init__(self, objective_function, lower, upper, resolution=1000):
"""
Evaluates a equally spaced grid to maximize the acquisition function
in a one dimensional input space.
Parameters
----------
objective_function: acquisition function
The acquisition fu... | [
"def",
"__init__",
"(",
"self",
",",
"objective_function",
",",
"lower",
",",
"upper",
",",
"resolution",
"=",
"1000",
")",
":",
"self",
".",
"resolution",
"=",
"resolution",
"if",
"lower",
".",
"shape",
"[",
"0",
"]",
">",
"1",
":",
"raise",
"RuntimeE... | https://github.com/automl/RoBO/blob/91366b12a1a3deb8e80dd08599e0eaf4df28adc1/robo/maximizers/grid_search.py#L8-L28 | ||
ChineseGLUE/ChineseGLUE | 1591b85cf5427c2ff60f718d359ecb71d2b44879 | baselines/models/roberta_wwm_ext/extract_features.py | python | model_fn_builder | (bert_config, init_checkpoint, layer_indexes, use_tpu,
use_one_hot_embeddings) | return model_fn | Returns `model_fn` closure for TPUEstimator. | Returns `model_fn` closure for TPUEstimator. | [
"Returns",
"model_fn",
"closure",
"for",
"TPUEstimator",
"."
] | def model_fn_builder(bert_config, init_checkpoint, layer_indexes, use_tpu,
use_one_hot_embeddings):
"""Returns `model_fn` closure for TPUEstimator."""
def model_fn(features, labels, mode, params): # pylint: disable=unused-argument
"""The `model_fn` for TPUEstimator."""
unique_ids = f... | [
"def",
"model_fn_builder",
"(",
"bert_config",
",",
"init_checkpoint",
",",
"layer_indexes",
",",
"use_tpu",
",",
"use_one_hot_embeddings",
")",
":",
"def",
"model_fn",
"(",
"features",
",",
"labels",
",",
"mode",
",",
"params",
")",
":",
"# pylint: disable=unused... | https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/roberta_wwm_ext/extract_features.py#L148-L207 | |
OpenAgricultureFoundation/openag-device-software | a51d2de399c0a6781ae51d0dcfaae1583d75f346 | device/peripherals/modules/atlas_ec/manager.py | python | AtlasECManager.calibrate_dry | (self) | return "Taking dry calibration reading", 200 | Pre-processes calibrate dry event request. | Pre-processes calibrate dry event request. | [
"Pre",
"-",
"processes",
"calibrate",
"dry",
"event",
"request",
"."
] | def calibrate_dry(self) -> Tuple[str, int]:
"""Pre-processes calibrate dry event request."""
self.logger.debug("Pre-processing calibrate dry event request")
# Require mode to be in calibrate
if self.mode != modes.CALIBRATE:
message = "Must be in calibration mode to take dry ... | [
"def",
"calibrate_dry",
"(",
"self",
")",
"->",
"Tuple",
"[",
"str",
",",
"int",
"]",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Pre-processing calibrate dry event request\"",
")",
"# Require mode to be in calibrate",
"if",
"self",
".",
"mode",
"!=",
"mod... | https://github.com/OpenAgricultureFoundation/openag-device-software/blob/a51d2de399c0a6781ae51d0dcfaae1583d75f346/device/peripherals/modules/atlas_ec/manager.py#L171-L186 | |
OWASP/Nettacker | 0b79a5b4fc8762199e85dd086554d585e62c314a | core/graph.py | python | create_report | (options, scan_unique_id) | return True | sort all events, create log file in HTML/TEXT/JSON and remove old logs
Args:
options: parsing options
scan_unique_id: scan unique id
Returns:
True if success otherwise None | sort all events, create log file in HTML/TEXT/JSON and remove old logs | [
"sort",
"all",
"events",
"create",
"log",
"file",
"in",
"HTML",
"/",
"TEXT",
"/",
"JSON",
"and",
"remove",
"old",
"logs"
] | def create_report(options, scan_unique_id):
"""
sort all events, create log file in HTML/TEXT/JSON and remove old logs
Args:
options: parsing options
scan_unique_id: scan unique id
Returns:
True if success otherwise None
"""
all_scan_logs = get_logs_by_scan_unique_id(sc... | [
"def",
"create_report",
"(",
"options",
",",
"scan_unique_id",
")",
":",
"all_scan_logs",
"=",
"get_logs_by_scan_unique_id",
"(",
"scan_unique_id",
")",
"if",
"not",
"all_scan_logs",
":",
"info",
"(",
"messages",
"(",
"\"no_events_for_report\"",
")",
")",
"return",
... | https://github.com/OWASP/Nettacker/blob/0b79a5b4fc8762199e85dd086554d585e62c314a/core/graph.py#L98-L190 | |
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/eos.py | python | GCEOS.dS_dep_dT_g | (self) | return (R*x1*(x2 - x0/self.T) - x1*x3 - 4.0*x2*x8*self.da_alpha_dT
/(x7*x7*x8 - 1.0) - x3/(self.b - x0)
+ 2.0*x6*catanh(x6*x7).real*self.d2a_alpha_dT2) | r'''Derivative of departure entropy with respect to
temperature for the gas phase, [(J/mol)/K^2].
.. math::
\frac{\partial S_{dep, g}}{\partial T} = - \frac{R \frac{d}{d T}
V{\left (T \right )}}{V{\left (T \right )}} + \frac{R \frac{d}{d T}
V{\left (T \right )}}{- b ... | r'''Derivative of departure entropy with respect to
temperature for the gas phase, [(J/mol)/K^2]. | [
"r",
"Derivative",
"of",
"departure",
"entropy",
"with",
"respect",
"to",
"temperature",
"for",
"the",
"gas",
"phase",
"[",
"(",
"J",
"/",
"mol",
")",
"/",
"K^2",
"]",
"."
] | def dS_dep_dT_g(self):
r'''Derivative of departure entropy with respect to
temperature for the gas phase, [(J/mol)/K^2].
.. math::
\frac{\partial S_{dep, g}}{\partial T} = - \frac{R \frac{d}{d T}
V{\left (T \right )}}{V{\left (T \right )}} + \frac{R \frac{d}{d T}
... | [
"def",
"dS_dep_dT_g",
"(",
"self",
")",
":",
"x0",
"=",
"self",
".",
"V_g",
"if",
"x0",
">",
"1e50",
":",
"if",
"self",
".",
"S_dep_g",
"==",
"0.0",
":",
"return",
"0.0",
"x1",
"=",
"1.",
"/",
"x0",
"x2",
"=",
"self",
".",
"dV_dT_g",
"if",
"isi... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/eos.py#L5664-L5702 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/controllers/misc/file_lock.py | python | FileLock.__init__ | (self, file_name, timeout=10, delay=.05) | Prepare the file locker. Specify the file to lock and optionally
the maximum timeout and the delay between each attempt to lock. | Prepare the file locker. Specify the file to lock and optionally
the maximum timeout and the delay between each attempt to lock. | [
"Prepare",
"the",
"file",
"locker",
".",
"Specify",
"the",
"file",
"to",
"lock",
"and",
"optionally",
"the",
"maximum",
"timeout",
"and",
"the",
"delay",
"between",
"each",
"attempt",
"to",
"lock",
"."
] | def __init__(self, file_name, timeout=10, delay=.05):
""" Prepare the file locker. Specify the file to lock and optionally
the maximum timeout and the delay between each attempt to lock.
"""
self.is_locked = False
self.lockfile = os.path.join(os.getcwd(), "%s.lock" % file_nam... | [
"def",
"__init__",
"(",
"self",
",",
"file_name",
",",
"timeout",
"=",
"10",
",",
"delay",
"=",
".05",
")",
":",
"self",
".",
"is_locked",
"=",
"False",
"self",
".",
"lockfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getcwd",
"(",
... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/misc/file_lock.py#L41-L49 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_project.py | python | OCProject.__init__ | (self,
config,
verbose=False) | Constructor for OCProject | Constructor for OCProject | [
"Constructor",
"for",
"OCProject"
] | def __init__(self,
config,
verbose=False):
''' Constructor for OCProject '''
super(OCProject, self).__init__(None, config.kubeconfig)
self.config = config
self._project = None | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"verbose",
"=",
"False",
")",
":",
"super",
"(",
"OCProject",
",",
"self",
")",
".",
"__init__",
"(",
"None",
",",
"config",
".",
"kubeconfig",
")",
"self",
".",
"config",
"=",
"config",
"self",
"."... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_project.py#L1567-L1573 | ||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/email/_header_value_parser.py | python | get_extended_attribute | (value) | return attribute, value | [CFWS] 1*extended_attrtext [CFWS]
This is like the non-extended version except we allow % characters, so that
we can pick up an encoded value as a single string. | [CFWS] 1*extended_attrtext [CFWS] | [
"[",
"CFWS",
"]",
"1",
"*",
"extended_attrtext",
"[",
"CFWS",
"]"
] | def get_extended_attribute(value):
""" [CFWS] 1*extended_attrtext [CFWS]
This is like the non-extended version except we allow % characters, so that
we can pick up an encoded value as a single string.
"""
# XXX: should we have an ExtendedAttribute TokenList?
attribute = Attribute()
if valu... | [
"def",
"get_extended_attribute",
"(",
"value",
")",
":",
"# XXX: should we have an ExtendedAttribute TokenList?",
"attribute",
"=",
"Attribute",
"(",
")",
"if",
"value",
"and",
"value",
"[",
"0",
"]",
"in",
"CFWS_LEADER",
":",
"token",
",",
"value",
"=",
"get_cfws... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/email/_header_value_parser.py#L2209-L2229 | |
swcarpentry/python-novice-inflammation | 06bb720afaf558edc2ecdded3cab4cbe7839a554 | bin/util.py | python | load_yaml | (filename) | Wrapper around YAML loading so that 'import yaml' is only needed
in one file. | Wrapper around YAML loading so that 'import yaml' is only needed
in one file. | [
"Wrapper",
"around",
"YAML",
"loading",
"so",
"that",
"import",
"yaml",
"is",
"only",
"needed",
"in",
"one",
"file",
"."
] | def load_yaml(filename):
"""
Wrapper around YAML loading so that 'import yaml' is only needed
in one file.
"""
try:
with open(filename, 'r', encoding='utf-8') as reader:
return yaml.load(reader, Loader=yaml.SafeLoader)
except (yaml.YAMLError, IOError) as e:
print('Un... | [
"def",
"load_yaml",
"(",
"filename",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"reader",
":",
"return",
"yaml",
".",
"load",
"(",
"reader",
",",
"Loader",
"=",
"yaml",
".",
"SafeLoa... | https://github.com/swcarpentry/python-novice-inflammation/blob/06bb720afaf558edc2ecdded3cab4cbe7839a554/bin/util.py#L75-L87 | ||
igraph/python-igraph | e9f83e8af08f24ea025596e745917197d8b44d94 | src/igraph/configuration.py | python | Configuration.load | (self, stream=None) | Loads the configuration from the given file.
@param stream: name of a file or a file object. The configuration will be loaded
from here. Can be omitted, in this case, the user-level configuration is
loaded. | Loads the configuration from the given file. | [
"Loads",
"the",
"configuration",
"from",
"the",
"given",
"file",
"."
] | def load(self, stream=None):
"""Loads the configuration from the given file.
@param stream: name of a file or a file object. The configuration will be loaded
from here. Can be omitted, in this case, the user-level configuration is
loaded.
"""
stream = stream or get_u... | [
"def",
"load",
"(",
"self",
",",
"stream",
"=",
"None",
")",
":",
"stream",
"=",
"stream",
"or",
"get_user_config_file",
"(",
")",
"if",
"isinstance",
"(",
"stream",
",",
"str",
")",
":",
"stream",
"=",
"open",
"(",
"stream",
",",
"\"r\"",
")",
"file... | https://github.com/igraph/python-igraph/blob/e9f83e8af08f24ea025596e745917197d8b44d94/src/igraph/configuration.py#L386-L400 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/api/v2010/account/incoming_phone_number/local.py | python | LocalInstance.__init__ | (self, version, payload, account_sid) | Initialize the LocalInstance
:returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance
:rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance | Initialize the LocalInstance | [
"Initialize",
"the",
"LocalInstance"
] | def __init__(self, version, payload, account_sid):
"""
Initialize the LocalInstance
:returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance
:rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance
"""
super(LocalInstance, ... | [
"def",
"__init__",
"(",
"self",
",",
"version",
",",
"payload",
",",
"account_sid",
")",
":",
"super",
"(",
"LocalInstance",
",",
"self",
")",
".",
"__init__",
"(",
"version",
")",
"# Marshaled Properties",
"self",
".",
"_properties",
"=",
"{",
"'account_sid... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/incoming_phone_number/local.py#L296-L345 | ||
bluedazzle/django-vue.js-blog | ac297e9805adab498bb2a83dc92ac0909dc17d5d | weapp/models.py | python | Domain.__unicode__ | (self) | return self.name | [] | def __unicode__(self):
return self.name | [
"def",
"__unicode__",
"(",
"self",
")",
":",
"return",
"self",
".",
"name"
] | https://github.com/bluedazzle/django-vue.js-blog/blob/ac297e9805adab498bb2a83dc92ac0909dc17d5d/weapp/models.py#L17-L18 | |||
pyocd/pyOCD | 7d164d99e816c4ef6c99f257014543188a0ca5a6 | pyocd/target/pack/pack_target.py | python | ManagedPacks.populate_target | (device_name) | ! @brief Add targets from cmsis-pack-manager matching the given name.
Targets are added to the `#TARGET` list. A case-insensitive comparison against the
device part number is used to find the target to populate. If multiple packs are installed
that provide the same part numbers, all matching ta... | ! @brief Add targets from cmsis-pack-manager matching the given name. | [
"!",
"@brief",
"Add",
"targets",
"from",
"cmsis",
"-",
"pack",
"-",
"manager",
"matching",
"the",
"given",
"name",
"."
] | def populate_target(device_name):
"""! @brief Add targets from cmsis-pack-manager matching the given name.
Targets are added to the `#TARGET` list. A case-insensitive comparison against the
device part number is used to find the target to populate. If multiple packs are installed
that p... | [
"def",
"populate_target",
"(",
"device_name",
")",
":",
"device_name",
"=",
"device_name",
".",
"lower",
"(",
")",
"targets",
"=",
"ManagedPacks",
".",
"get_installed_targets",
"(",
")",
"for",
"dev",
"in",
"targets",
":",
"if",
"device_name",
"==",
"dev",
"... | https://github.com/pyocd/pyOCD/blob/7d164d99e816c4ef6c99f257014543188a0ca5a6/pyocd/target/pack/pack_target.py#L76-L87 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/crownstone/config_flow.py | python | CrownstoneConfigFlowHandler.async_step_user | (
self, user_input: dict[str, Any] | None = None
) | return await self.async_step_usb_config() | Handle the initial step. | Handle the initial step. | [
"Handle",
"the",
"initial",
"step",
"."
] | async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle the initial step."""
errors: dict[str, str] = {}
if user_input is None:
return self.async_show_form(
step_id="user",
data_schema=vol.Schema... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"FlowResult",
":",
"errors",
":",
"dict",
"[",
"str",
",",
"str",
"]",
"=",
"{",
"}",
"if",
"user_inpu... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/crownstone/config_flow.py#L147-L190 | |
feipan664/IntraDA | 070b0b702fe94a34288eba4ca990410b5aaadc4a | intrada/train.py | python | get_arguments | () | return parser.parse_args() | Parse input arguments | Parse input arguments | [
"Parse",
"input",
"arguments"
] | def get_arguments():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description="Code for domain adaptation (DA) training")
parser.add_argument('--cfg', type=str, default=None,
help='optional config file', )
parser.add_argument("--random-train", action="st... | [
"def",
"get_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Code for domain adaptation (DA) training\"",
")",
"parser",
".",
"add_argument",
"(",
"'--cfg'",
",",
"type",
"=",
"str",
",",
"default",
"=",
"N... | https://github.com/feipan664/IntraDA/blob/070b0b702fe94a34288eba4ca990410b5aaadc4a/intrada/train.py#L28-L43 | |
Coalfire-Research/Slackor | aa32a7f9250bd8b107d48fd573f26176b527b2a5 | impacket/impacket/dot11.py | python | Dot11ManagementFrame.set_sequence_number | (self, value) | Set the 802.11 Management frame \'Sequence Number\' subfield | Set the 802.11 Management frame \'Sequence Number\' subfield | [
"Set",
"the",
"802",
".",
"11",
"Management",
"frame",
"\\",
"Sequence",
"Number",
"\\",
"subfield"
] | def set_sequence_number(self, value):
'Set the 802.11 Management frame \'Sequence Number\' subfield'
# clear the bits
mask = (~0xFFF0) & 0xFFFF
masked = self.header.get_word(20, "<") & mask
# set the bits
nb = masked | ((value & 0x0FFF ) << 4 )
self.header.set_... | [
"def",
"set_sequence_number",
"(",
"self",
",",
"value",
")",
":",
"# clear the bits",
"mask",
"=",
"(",
"~",
"0xFFF0",
")",
"&",
"0xFFFF",
"masked",
"=",
"self",
".",
"header",
".",
"get_word",
"(",
"20",
",",
"\"<\"",
")",
"&",
"mask",
"# set the bits ... | https://github.com/Coalfire-Research/Slackor/blob/aa32a7f9250bd8b107d48fd573f26176b527b2a5/impacket/impacket/dot11.py#L2118-L2125 | ||
bjmayor/hacker | e3ce2ad74839c2733b27dac6c0f495e0743e1866 | venv/lib/python3.5/site-packages/pip/_vendor/html5lib/treebuilders/base.py | python | Node.hasContent | (self) | Return true if the node has children or text, false otherwise | Return true if the node has children or text, false otherwise | [
"Return",
"true",
"if",
"the",
"node",
"has",
"children",
"or",
"text",
"false",
"otherwise"
] | def hasContent(self):
"""Return true if the node has children or text, false otherwise
"""
raise NotImplementedError | [
"def",
"hasContent",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L92-L95 | ||
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/pip/build/lib.linux-i686-2.7/pip/_vendor/requests/sessions.py | python | Session.patch | (self, url, data=None, **kwargs) | return self.request('PATCH', url, data=data, **kwargs) | Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes. | Sends a PATCH request. Returns :class:`Response` object. | [
"Sends",
"a",
"PATCH",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def patch(self, url, data=None, **kwargs):
"""Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param \*\*kwargs: Opti... | [
"def",
"patch",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"'PATCH'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/build/lib.linux-i686-2.7/pip/_vendor/requests/sessions.py#L520-L528 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/ip_messaging/v1/service/channel/member.py | python | MemberList.get | (self, sid) | return MemberContext(
self._version,
service_sid=self._solution['service_sid'],
channel_sid=self._solution['channel_sid'],
sid=sid,
) | Constructs a MemberContext
:param sid: The sid
:returns: twilio.rest.ip_messaging.v1.service.channel.member.MemberContext
:rtype: twilio.rest.ip_messaging.v1.service.channel.member.MemberContext | Constructs a MemberContext | [
"Constructs",
"a",
"MemberContext"
] | def get(self, sid):
"""
Constructs a MemberContext
:param sid: The sid
:returns: twilio.rest.ip_messaging.v1.service.channel.member.MemberContext
:rtype: twilio.rest.ip_messaging.v1.service.channel.member.MemberContext
"""
return MemberContext(
self.... | [
"def",
"get",
"(",
"self",
",",
"sid",
")",
":",
"return",
"MemberContext",
"(",
"self",
".",
"_version",
",",
"service_sid",
"=",
"self",
".",
"_solution",
"[",
"'service_sid'",
"]",
",",
"channel_sid",
"=",
"self",
".",
"_solution",
"[",
"'channel_sid'",... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/ip_messaging/v1/service/channel/member.py#L143-L157 | |
awslabs/amazon-kinesis-client-python | 26c2b3087bcecbc8dd8b8adbb27f598534753f15 | amazon_kclpy/v2/processor.py | python | RecordProcessorBase.shutdown_requested | (self, shutdown_requested_input) | Called by a KCLProcess instance to indicate that this record processor is about to be be shutdown. This gives
the record processor a chance to checkpoint, before the lease is terminated.
:param amazon_kclpy.messages.ShutdownRequestedInput shutdown_requested_input:
Information related to sh... | Called by a KCLProcess instance to indicate that this record processor is about to be be shutdown. This gives
the record processor a chance to checkpoint, before the lease is terminated. | [
"Called",
"by",
"a",
"KCLProcess",
"instance",
"to",
"indicate",
"that",
"this",
"record",
"processor",
"is",
"about",
"to",
"be",
"be",
"shutdown",
".",
"This",
"gives",
"the",
"record",
"processor",
"a",
"chance",
"to",
"checkpoint",
"before",
"the",
"leas... | def shutdown_requested(self, shutdown_requested_input):
"""
Called by a KCLProcess instance to indicate that this record processor is about to be be shutdown. This gives
the record processor a chance to checkpoint, before the lease is terminated.
:param amazon_kclpy.messages.ShutdownRe... | [
"def",
"shutdown_requested",
"(",
"self",
",",
"shutdown_requested_input",
")",
":",
"pass"
] | https://github.com/awslabs/amazon-kinesis-client-python/blob/26c2b3087bcecbc8dd8b8adbb27f598534753f15/amazon_kclpy/v2/processor.py#L66-L74 | ||
lisa-lab/pylearn2 | af81e5c362f0df4df85c3e54e23b2adeec026055 | pylearn2/datasets/dataset.py | python | Dataset._init_iterator | (self, mode=None, batch_size=None, num_batches=None,
rng=None, data_specs=None) | return [mode, batch_size, num_batches, rng, data_specs] | Fill-in unspecified attributes trying to set them to their default
values or raising an error.
Parameters
----------
mode : str or object, optional
batch_size : int, optional
num_batches : int, optional
rng : int, object or array_like, optional
data_specs... | Fill-in unspecified attributes trying to set them to their default
values or raising an error. | [
"Fill",
"-",
"in",
"unspecified",
"attributes",
"trying",
"to",
"set",
"them",
"to",
"their",
"default",
"values",
"or",
"raising",
"an",
"error",
"."
] | def _init_iterator(self, mode=None, batch_size=None, num_batches=None,
rng=None, data_specs=None):
"""
Fill-in unspecified attributes trying to set them to their default
values or raising an error.
Parameters
----------
mode : str or object, option... | [
"def",
"_init_iterator",
"(",
"self",
",",
"mode",
"=",
"None",
",",
"batch_size",
"=",
"None",
",",
"num_batches",
"=",
"None",
",",
"rng",
"=",
"None",
",",
"data_specs",
"=",
"None",
")",
":",
"# TODO How much of this is possible to put in the Dataset.iterator ... | https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/datasets/dataset.py#L114-L179 | |
mpenning/ciscoconfparse | a6a176e6ceac7c5f3e974272fa70273476ba84a3 | ciscoconfparse/models_cisco.py | python | BaseIOSIntfLine.ip_accessgroup_in | (self) | return self.ipv4_accessgroup_in | [] | def ip_accessgroup_in(self):
return self.ipv4_accessgroup_in | [
"def",
"ip_accessgroup_in",
"(",
"self",
")",
":",
"return",
"self",
".",
"ipv4_accessgroup_in"
] | https://github.com/mpenning/ciscoconfparse/blob/a6a176e6ceac7c5f3e974272fa70273476ba84a3/ciscoconfparse/models_cisco.py#L1671-L1672 | |||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/matrices/subspaces.py | python | _nullspace | (M, simplify=False, iszerofunc=_iszero) | return [M._new(M.cols, 1, b) for b in basis] | Returns list of vectors (Matrix objects) that span nullspace of ``M``
Examples
========
>>> from sympy.matrices import Matrix
>>> M = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
>>> M
Matrix([
[ 1, 3, 0],
[-2, -6, 0],
[ 3, 9, 6]])
>>> M.nullspace()
[Matrix([
[-3],
... | Returns list of vectors (Matrix objects) that span nullspace of ``M`` | [
"Returns",
"list",
"of",
"vectors",
"(",
"Matrix",
"objects",
")",
"that",
"span",
"nullspace",
"of",
"M"
] | def _nullspace(M, simplify=False, iszerofunc=_iszero):
"""Returns list of vectors (Matrix objects) that span nullspace of ``M``
Examples
========
>>> from sympy.matrices import Matrix
>>> M = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
>>> M
Matrix([
[ 1, 3, 0],
[-2, -6, 0],
[... | [
"def",
"_nullspace",
"(",
"M",
",",
"simplify",
"=",
"False",
",",
"iszerofunc",
"=",
"_iszero",
")",
":",
"reduced",
",",
"pivots",
"=",
"M",
".",
"rref",
"(",
"iszerofunc",
"=",
"iszerofunc",
",",
"simplify",
"=",
"simplify",
")",
"free_vars",
"=",
"... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/matrices/subspaces.py#L38-L80 | |
SimJeg/FC-DenseNet | 947ee933144949d82ada32198e49d76b708f60e4 | layers.py | python | SoftmaxLayer | (inputs, n_classes) | return l | Performs 1x1 convolution followed by softmax nonlinearity
The output will have the shape (batch_size * n_rows * n_cols, n_classes) | Performs 1x1 convolution followed by softmax nonlinearity
The output will have the shape (batch_size * n_rows * n_cols, n_classes) | [
"Performs",
"1x1",
"convolution",
"followed",
"by",
"softmax",
"nonlinearity",
"The",
"output",
"will",
"have",
"the",
"shape",
"(",
"batch_size",
"*",
"n_rows",
"*",
"n_cols",
"n_classes",
")"
] | def SoftmaxLayer(inputs, n_classes):
"""
Performs 1x1 convolution followed by softmax nonlinearity
The output will have the shape (batch_size * n_rows * n_cols, n_classes)
"""
l = Conv2DLayer(inputs, n_classes, filter_size=1, nonlinearity=linear, W=HeUniform(gain='relu'), pad='same',
... | [
"def",
"SoftmaxLayer",
"(",
"inputs",
",",
"n_classes",
")",
":",
"l",
"=",
"Conv2DLayer",
"(",
"inputs",
",",
"n_classes",
",",
"filter_size",
"=",
"1",
",",
"nonlinearity",
"=",
"linear",
",",
"W",
"=",
"HeUniform",
"(",
"gain",
"=",
"'relu'",
")",
"... | https://github.com/SimJeg/FC-DenseNet/blob/947ee933144949d82ada32198e49d76b708f60e4/layers.py#L48-L66 | |
dawsonjon/Chips-2.0 | 57a986b8df36248bb4736bd84e3e68046b8665af | chips/compiler/macro_expander.py | python | push_pop | (instructions) | return new_instructions | substitue push and pop macros with real instructions | substitue push and pop macros with real instructions | [
"substitue",
"push",
"and",
"pop",
"macros",
"with",
"real",
"instructions"
] | def push_pop(instructions):
"""substitue push and pop macros with real instructions"""
new_instructions = []
i = 0
while i < len(instructions):
instruction = instructions[i]
trace = instruction["trace"]
if i < len(instructions) - 1:
next_instruction = instructions[i ... | [
"def",
"push_pop",
"(",
"instructions",
")",
":",
"new_instructions",
"=",
"[",
"]",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"instructions",
")",
":",
"instruction",
"=",
"instructions",
"[",
"i",
"]",
"trace",
"=",
"instruction",
"[",
"\"trace\"",... | https://github.com/dawsonjon/Chips-2.0/blob/57a986b8df36248bb4736bd84e3e68046b8665af/chips/compiler/macro_expander.py#L14-L60 | |
Flask-Middleware/flask-security | 9ebc0342c47c0eed19246e143e580d06cb680580 | flask_security/views.py | python | two_factor_token_validation | () | View function for two-factor token validation
Two cases:
1) normal login case - everything setup correctly; normal 2FA validation
In this case - user not logged in -
but 'tf_state' == 'ready' or 'validating_profile'
2) validating after CHANGE/ENABLE 2FA. In this case user logged in/authentica... | View function for two-factor token validation | [
"View",
"function",
"for",
"two",
"-",
"factor",
"token",
"validation"
] | def two_factor_token_validation():
"""View function for two-factor token validation
Two cases:
1) normal login case - everything setup correctly; normal 2FA validation
In this case - user not logged in -
but 'tf_state' == 'ready' or 'validating_profile'
2) validating after CHANGE/ENABLE 2... | [
"def",
"two_factor_token_validation",
"(",
")",
":",
"form_class",
"=",
"_security",
".",
"two_factor_verify_code_form",
"if",
"request",
".",
"is_json",
":",
"form",
"=",
"form_class",
"(",
"MultiDict",
"(",
"request",
".",
"get_json",
"(",
")",
")",
",",
"me... | https://github.com/Flask-Middleware/flask-security/blob/9ebc0342c47c0eed19246e143e580d06cb680580/flask_security/views.py#L837-L964 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/lib2to3/pgen2/driver.py | python | _newer | (a, b) | return os.path.getmtime(a) >= os.path.getmtime(b) | Inquire whether file a was written since file b. | Inquire whether file a was written since file b. | [
"Inquire",
"whether",
"file",
"a",
"was",
"written",
"since",
"file",
"b",
"."
] | def _newer(a, b):
"""Inquire whether file a was written since file b."""
if not os.path.exists(a):
return False
if not os.path.exists(b):
return True
return os.path.getmtime(a) >= os.path.getmtime(b) | [
"def",
"_newer",
"(",
"a",
",",
"b",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"a",
")",
":",
"return",
"False",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"b",
")",
":",
"return",
"True",
"return",
"os",
".",
"pa... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/lib2to3/pgen2/driver.py#L134-L140 | |
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/lstm_object_detection/inputs/seq_dataset_builder.py | python | _build_training_batch_dict | (batch_sequences_with_states, unroll_length,
batch_size) | return seq_tensors_dict | Builds training batch samples.
Args:
batch_sequences_with_states: A batch_sequences_with_states object.
unroll_length: Unrolled length for LSTM training.
batch_size: Batch size for queue outputs.
Returns:
A dictionary of tensors based on items in input_reader_config. | Builds training batch samples. | [
"Builds",
"training",
"batch",
"samples",
"."
] | def _build_training_batch_dict(batch_sequences_with_states, unroll_length,
batch_size):
"""Builds training batch samples.
Args:
batch_sequences_with_states: A batch_sequences_with_states object.
unroll_length: Unrolled length for LSTM training.
batch_size: Batch size for ... | [
"def",
"_build_training_batch_dict",
"(",
"batch_sequences_with_states",
",",
"unroll_length",
",",
"batch_size",
")",
":",
"seq_tensors_dict",
"=",
"{",
"fields",
".",
"InputDataFields",
".",
"image",
":",
"[",
"]",
",",
"fields",
".",
"InputDataFields",
".",
"gr... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/lstm_object_detection/inputs/seq_dataset_builder.py#L44-L86 | |
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/pyparsing.py | python | ParseResults.haskeys | ( self ) | return bool(self.__tokdict) | Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names. | Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names. | [
"Since",
"keys",
"()",
"returns",
"an",
"iterator",
"this",
"method",
"is",
"helpful",
"in",
"bypassing",
"code",
"that",
"looks",
"for",
"the",
"existence",
"of",
"any",
"defined",
"results",
"names",
"."
] | def haskeys( self ):
"""Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names."""
return bool(self.__tokdict) | [
"def",
"haskeys",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"__tokdict",
")"
] | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/pyparsing.py#L483-L486 | |
astropy/astroquery | 11c9c83fa8e5f948822f8f73c854ec4b72043016 | astroquery/esa/jwst/core.py | python | JwstClass.list_async_jobs | (self, *, verbose=False) | return self.__jwsttap.list_async_jobs(verbose) | Returns all the asynchronous jobs
TAP & TAP+
Parameters
----------
verbose : bool, optional, default 'False'
flag to display information about the process
Returns
-------
A list of Job objects | Returns all the asynchronous jobs
TAP & TAP+ | [
"Returns",
"all",
"the",
"asynchronous",
"jobs",
"TAP",
"&",
"TAP",
"+"
] | def list_async_jobs(self, *, verbose=False):
"""Returns all the asynchronous jobs
TAP & TAP+
Parameters
----------
verbose : bool, optional, default 'False'
flag to display information about the process
Returns
-------
A list of Job objects
... | [
"def",
"list_async_jobs",
"(",
"self",
",",
"*",
",",
"verbose",
"=",
"False",
")",
":",
"return",
"self",
".",
"__jwsttap",
".",
"list_async_jobs",
"(",
"verbose",
")"
] | https://github.com/astropy/astroquery/blob/11c9c83fa8e5f948822f8f73c854ec4b72043016/astroquery/esa/jwst/core.py#L212-L225 | |
snipsco/snips-nlu | 74b2893c91fc0bafc919a7e088ecb0b2bd611acf | snips_nlu/intent_parser/intent_parser.py | python | IntentParser.get_slots | (self, text, intent) | Extract slots from a text input, with the knowledge of the intent
Args:
text (str): input
intent (str): the intent which the input corresponds to
Returns:
list: the list of extracted slots
Raises:
IntentNotFoundError: when the intent was not par... | Extract slots from a text input, with the knowledge of the intent | [
"Extract",
"slots",
"from",
"a",
"text",
"input",
"with",
"the",
"knowledge",
"of",
"the",
"intent"
] | def get_slots(self, text, intent):
"""Extract slots from a text input, with the knowledge of the intent
Args:
text (str): input
intent (str): the intent which the input corresponds to
Returns:
list: the list of extracted slots
Raises:
In... | [
"def",
"get_slots",
"(",
"self",
",",
"text",
",",
"intent",
")",
":",
"pass"
] | https://github.com/snipsco/snips-nlu/blob/74b2893c91fc0bafc919a7e088ecb0b2bd611acf/snips_nlu/intent_parser/intent_parser.py#L71-L85 | ||
thaines/helit | 04bd36ee0fb6b762c63d746e2cd8813641dceda9 | svm/params_sets.py | python | ParamsSet.addBasisFuncs | (self, rExpHigh = 6, rExp = 2.0, sdExpHigh = 6, sdExp = 2.0, cExpLow = -3, cExpHigh = 3, cExp = 10.0, rebalance = True) | Adds the basis functions to the set, both Radial and Gaussian. The parameter for the radial basis functions go from rExp^0 to rExp^rExpHigh, whilst the parameter for the Gaussian does the same thing, but with the sd parameters. Same c controls as for addLinear. | Adds the basis functions to the set, both Radial and Gaussian. The parameter for the radial basis functions go from rExp^0 to rExp^rExpHigh, whilst the parameter for the Gaussian does the same thing, but with the sd parameters. Same c controls as for addLinear. | [
"Adds",
"the",
"basis",
"functions",
"to",
"the",
"set",
"both",
"Radial",
"and",
"Gaussian",
".",
"The",
"parameter",
"for",
"the",
"radial",
"basis",
"functions",
"go",
"from",
"rExp^0",
"to",
"rExp^rExpHigh",
"whilst",
"the",
"parameter",
"for",
"the",
"G... | def addBasisFuncs(self, rExpHigh = 6, rExp = 2.0, sdExpHigh = 6, sdExp = 2.0, cExpLow = -3, cExpHigh = 3, cExp = 10.0, rebalance = True):
"""Adds the basis functions to the set, both Radial and Gaussian. The parameter for the radial basis functions go from rExp^0 to rExp^rExpHigh, whilst the parameter for the Gauss... | [
"def",
"addBasisFuncs",
"(",
"self",
",",
"rExpHigh",
"=",
"6",
",",
"rExp",
"=",
"2.0",
",",
"sdExpHigh",
"=",
"6",
",",
"sdExp",
"=",
"2.0",
",",
"cExpLow",
"=",
"-",
"3",
",",
"cExpHigh",
"=",
"3",
",",
"cExp",
"=",
"10.0",
",",
"rebalance",
"... | https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/svm/params_sets.py#L144-L162 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/stats/_distn_infrastructure.py | python | _drv2_moment | (self, n, *args) | return _expect(fun, _a, _b, self.ppf(0.5, *args), self.inc) | Non-central moment of discrete distribution. | Non-central moment of discrete distribution. | [
"Non",
"-",
"central",
"moment",
"of",
"discrete",
"distribution",
"."
] | def _drv2_moment(self, n, *args):
"""Non-central moment of discrete distribution."""
def fun(x):
return np.power(x, n) * self._pmf(x, *args)
_a, _b = self._get_support(*args)
return _expect(fun, _a, _b, self.ppf(0.5, *args), self.inc) | [
"def",
"_drv2_moment",
"(",
"self",
",",
"n",
",",
"*",
"args",
")",
":",
"def",
"fun",
"(",
"x",
")",
":",
"return",
"np",
".",
"power",
"(",
"x",
",",
"n",
")",
"*",
"self",
".",
"_pmf",
"(",
"x",
",",
"*",
"args",
")",
"_a",
",",
"_b",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/stats/_distn_infrastructure.py#L2517-L2523 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.