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
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
torchMoji/torchmoji/class_avg_finetuning.py
python
class_avg_tune_trainable
(model, nb_classes, loss_op, optim_op, train, val, test, epoch_size, nb_epochs, batch_size, init_weight_path, checkpoint_weight_path, patience=5, verbose=True)
return total_f1 / nb_iter
Finetunes the given model using the F1 measure. # Arguments: model: Model to be finetuned. nb_classes: Number of classes in the given dataset. train: Training data, given as a tuple of (inputs, outputs) val: Validation data, given as a tuple of (inputs, outputs) test: Testin...
Finetunes the given model using the F1 measure.
[ "Finetunes", "the", "given", "model", "using", "the", "F1", "measure", "." ]
def class_avg_tune_trainable(model, nb_classes, loss_op, optim_op, train, val, test, epoch_size, nb_epochs, batch_size, init_weight_path, checkpoint_weight_path, patience=5, verbose=True): """ Finetunes the given model using the ...
[ "def", "class_avg_tune_trainable", "(", "model", ",", "nb_classes", ",", "loss_op", ",", "optim_op", ",", "train", ",", "val", ",", "test", ",", "epoch_size", ",", "nb_epochs", ",", "batch_size", ",", "init_weight_path", ",", "checkpoint_weight_path", ",", "pati...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/torchMoji/torchmoji/class_avg_finetuning.py#L166-L233
xonsh/xonsh
b76d6f994f22a4078f602f8b386f4ec280c8461f
xonsh/procs/proxies.py
python
proxy_four
(f, args, stdin, stdout, stderr, spec, stack)
return f(args, stdin, stdout, stderr)
Calls a proxy function which takes four parameter: args, stdin, stdout, and stderr.
Calls a proxy function which takes four parameter: args, stdin, stdout, and stderr.
[ "Calls", "a", "proxy", "function", "which", "takes", "four", "parameter", ":", "args", "stdin", "stdout", "and", "stderr", "." ]
def proxy_four(f, args, stdin, stdout, stderr, spec, stack): """Calls a proxy function which takes four parameter: args, stdin, stdout, and stderr. """ return f(args, stdin, stdout, stderr)
[ "def", "proxy_four", "(", "f", ",", "args", ",", "stdin", ",", "stdout", ",", "stderr", ",", "spec", ",", "stack", ")", ":", "return", "f", "(", "args", ",", "stdin", ",", "stdout", ",", "stderr", ")" ]
https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/procs/proxies.py#L308-L312
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/cwp/v20180228/cwp_client.py
python
CwpClient.DescribeBaselineAnalysisData
(self, request)
根据基线策略id查询基线策略数据概览统计 :param request: Request instance for DescribeBaselineAnalysisData. :type request: :class:`tencentcloud.cwp.v20180228.models.DescribeBaselineAnalysisDataRequest` :rtype: :class:`tencentcloud.cwp.v20180228.models.DescribeBaselineAnalysisDataResponse`
根据基线策略id查询基线策略数据概览统计
[ "根据基线策略id查询基线策略数据概览统计" ]
def DescribeBaselineAnalysisData(self, request): """根据基线策略id查询基线策略数据概览统计 :param request: Request instance for DescribeBaselineAnalysisData. :type request: :class:`tencentcloud.cwp.v20180228.models.DescribeBaselineAnalysisDataRequest` :rtype: :class:`tencentcloud.cwp.v20180228.models.Des...
[ "def", "DescribeBaselineAnalysisData", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeBaselineAnalysisData\"", ",", "params", ")", "response", "=", "...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cwp/v20180228/cwp_client.py#L1877-L1902
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/utils/logging.py
python
indent_log
(num=2)
A context manager which will cause the log output to be indented for any log messages emitted inside it.
A context manager which will cause the log output to be indented for any log messages emitted inside it.
[ "A", "context", "manager", "which", "will", "cause", "the", "log", "output", "to", "be", "indented", "for", "any", "log", "messages", "emitted", "inside", "it", "." ]
def indent_log(num=2): """ A context manager which will cause the log output to be indented for any log messages emitted inside it. """ _log_state.indentation += num try: yield finally: _log_state.indentation -= num
[ "def", "indent_log", "(", "num", "=", "2", ")", ":", "_log_state", ".", "indentation", "+=", "num", "try", ":", "yield", "finally", ":", "_log_state", ".", "indentation", "-=", "num" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/utils/logging.py#L29-L38
supernotman/RetinaFace_Pytorch
8369b9304e19923c1a02c049df69628890bf30b5
anchors.py
python
generate_anchors
(base_size=16, ratios=None, scales=None)
return anchors
Generate anchor (reference) windows by enumerating aspect ratios X scales w.r.t. a reference window.
Generate anchor (reference) windows by enumerating aspect ratios X scales w.r.t. a reference window.
[ "Generate", "anchor", "(", "reference", ")", "windows", "by", "enumerating", "aspect", "ratios", "X", "scales", "w", ".", "r", ".", "t", ".", "a", "reference", "window", "." ]
def generate_anchors(base_size=16, ratios=None, scales=None): """ Generate anchor (reference) windows by enumerating aspect ratios X scales w.r.t. a reference window. """ if ratios is None: ratios = np.array([1, 1, 1]) if scales is None: scales = np.array([2 ** 0, 2 ** (1.0 / 3...
[ "def", "generate_anchors", "(", "base_size", "=", "16", ",", "ratios", "=", "None", ",", "scales", "=", "None", ")", ":", "if", "ratios", "is", "None", ":", "ratios", "=", "np", ".", "array", "(", "[", "1", ",", "1", ",", "1", "]", ")", "if", "...
https://github.com/supernotman/RetinaFace_Pytorch/blob/8369b9304e19923c1a02c049df69628890bf30b5/anchors.py#L42-L66
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
docs/refman/generatormd.py
python
GeneratorMD._write_file
(self, data: str, file_id: str)
Write the data to disk ans store the id for the generated data
Write the data to disk ans store the id for the generated data
[ "Write", "the", "data", "to", "disk", "ans", "store", "the", "id", "for", "the", "generated", "data" ]
def _write_file(self, data: str, file_id: str) -> None:# ''' Write the data to disk ans store the id for the generated data ''' self.generated_files[file_id] = self._gen_filename(file_id) out_file = self.out_dir / self.generated_files[file_id] out_file.write_text(data, encoding='ascii')...
[ "def", "_write_file", "(", "self", ",", "data", ":", "str", ",", "file_id", ":", "str", ")", "->", "None", ":", "#", "self", ".", "generated_files", "[", "file_id", "]", "=", "self", ".", "_gen_filename", "(", "file_id", ")", "out_file", "=", "self", ...
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/docs/refman/generatormd.py#L121-L127
ncullen93/torchsample
1f328d1ea3ef533c8c0c4097ed4a3fa16d784ba4
torchsample/datasets.py
python
TensorDataset.__init__
(self, inputs, targets=None, input_transform=None, target_transform=None, co_transform=None)
Dataset class for loading in-memory data. Arguments --------- inputs: numpy array targets : numpy array input_transform : class with __call__ function implemented transform to apply to input sample individually target_transform : class with __call__ functi...
Dataset class for loading in-memory data.
[ "Dataset", "class", "for", "loading", "in", "-", "memory", "data", "." ]
def __init__(self, inputs, targets=None, input_transform=None, target_transform=None, co_transform=None): """ Dataset class for loading in-memory data. Arguments --------- inputs: numpy array ...
[ "def", "__init__", "(", "self", ",", "inputs", ",", "targets", "=", "None", ",", "input_transform", "=", "None", ",", "target_transform", "=", "None", ",", "co_transform", "=", "None", ")", ":", "self", ".", "inputs", "=", "_process_array_argument", "(", "...
https://github.com/ncullen93/torchsample/blob/1f328d1ea3ef533c8c0c4097ed4a3fa16d784ba4/torchsample/datasets.py#L203-L244
LMFDB/lmfdb
6cf48a4c18a96e6298da6ae43f587f96845bcb43
lmfdb/siegel_modular_forms/sample.py
python
Sample
(collection, name)
return Sample_class(doc) if doc else None
Return a light instance of Sample_class, where 'light' means 'without eigenvalues, Fourier coefficients or explicit formula'.
Return a light instance of Sample_class, where 'light' means 'without eigenvalues, Fourier coefficients or explicit formula'.
[ "Return", "a", "light", "instance", "of", "Sample_class", "where", "light", "means", "without", "eigenvalues", "Fourier", "coefficients", "or", "explicit", "formula", "." ]
def Sample(collection, name): """ Return a light instance of Sample_class, where 'light' means 'without eigenvalues, Fourier coefficients or explicit formula'. """ query = {'collection': {'$contains': [collection]}, 'name': name} doc = db.smf_samples.lucky(query, {'Fourier_coefficients': False, 'eig...
[ "def", "Sample", "(", "collection", ",", "name", ")", ":", "query", "=", "{", "'collection'", ":", "{", "'$contains'", ":", "[", "collection", "]", "}", ",", "'name'", ":", "name", "}", "doc", "=", "db", ".", "smf_samples", ".", "lucky", "(", "query"...
https://github.com/LMFDB/lmfdb/blob/6cf48a4c18a96e6298da6ae43f587f96845bcb43/lmfdb/siegel_modular_forms/sample.py#L103-L109
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/tempfile.py
python
SpooledTemporaryFile.tell
(self)
return self._file.tell()
[]
def tell(self): return self._file.tell()
[ "def", "tell", "(", "self", ")", ":", "return", "self", ".", "_file", ".", "tell", "(", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/tempfile.py#L758-L759
jansel/opentuner
070c5cef6d933eb760a2f9cd5cd08c95f27aee75
opentuner/search/manipulator.py
python
ParameterArray.op1_randomize
(self, config)
randomly selects a sub-parameter and randomizes it :param config: the configuration to be changed
randomly selects a sub-parameter and randomizes it
[ "randomly", "selects", "a", "sub", "-", "parameter", "and", "randomizes", "it" ]
def op1_randomize(self, config): """ randomly selects a sub-parameter and randomizes it :param config: the configuration to be changed """ random.choice(self.sub_parameters()).op1_randomize(config)
[ "def", "op1_randomize", "(", "self", ",", "config", ")", ":", "random", ".", "choice", "(", "self", ".", "sub_parameters", "(", ")", ")", ".", "op1_randomize", "(", "config", ")" ]
https://github.com/jansel/opentuner/blob/070c5cef6d933eb760a2f9cd5cd08c95f27aee75/opentuner/search/manipulator.py#L1507-L1513
Jakobovski/aws-spot-bot
1a84c498df8b98b8fd2439a6c520e7a9b16e4a0d
utils/pricing_util.py
python
get_best_az
()
return sorted_azs[-1]
[]
def get_best_az(): azs = get_initialized_azs() for az in azs: az.calculate_score(uconf.INSTANCE_TYPES, 0.65) # Sort the AZs by score and return the best one sorted_azs = sorted(azs, key=attrgetter('score')) for az in sorted_azs: print az.name print '>> price:', az.current_...
[ "def", "get_best_az", "(", ")", ":", "azs", "=", "get_initialized_azs", "(", ")", "for", "az", "in", "azs", ":", "az", ".", "calculate_score", "(", "uconf", ".", "INSTANCE_TYPES", ",", "0.65", ")", "# Sort the AZs by score and return the best one", "sorted_azs", ...
https://github.com/Jakobovski/aws-spot-bot/blob/1a84c498df8b98b8fd2439a6c520e7a9b16e4a0d/utils/pricing_util.py#L64-L80
Instagram/LibCST
13370227703fe3171e94c57bdd7977f3af696b73
libcst/_parser/conversions/expression.py
python
convert_fstring_format_spec
( config: ParserConfig, children: typing.Sequence[typing.Any] )
return FormattedStringFormatSpecPartial(tuple(content), colon.whitespace_before)
[]
def convert_fstring_format_spec( config: ParserConfig, children: typing.Sequence[typing.Any] ) -> typing.Any: colon, *content = children return FormattedStringFormatSpecPartial(tuple(content), colon.whitespace_before)
[ "def", "convert_fstring_format_spec", "(", "config", ":", "ParserConfig", ",", "children", ":", "typing", ".", "Sequence", "[", "typing", ".", "Any", "]", ")", "->", "typing", ".", "Any", ":", "colon", ",", "", "*", "content", "=", "children", "return", ...
https://github.com/Instagram/LibCST/blob/13370227703fe3171e94c57bdd7977f3af696b73/libcst/_parser/conversions/expression.py#L1100-L1104
ambujraj/hacktoberfest2018
53df2cac8b3404261131a873352ec4f2ffa3544d
MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/list.py
python
format_for_columns
(pkgs, options)
return data, header
Convert the package data into something usable by output_package_listing_columns.
Convert the package data into something usable by output_package_listing_columns.
[ "Convert", "the", "package", "data", "into", "something", "usable", "by", "output_package_listing_columns", "." ]
def format_for_columns(pkgs, options): """ Convert the package data into something usable by output_package_listing_columns. """ running_outdated = options.outdated # Adjust the header for the `pip list --outdated` case. if running_outdated: header = ["Package", "Version", "Latest", ...
[ "def", "format_for_columns", "(", "pkgs", ",", "options", ")", ":", "running_outdated", "=", "options", ".", "outdated", "# Adjust the header for the `pip list --outdated` case.", "if", "running_outdated", ":", "header", "=", "[", "\"Package\"", ",", "\"Version\"", ",",...
https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/list.py#L292-L326
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
PySimpleGUIWx/PySimpleGUIWx.py
python
RealtimeButton
(button_text, image_filename=None, image_data=None, image_size=(None, None), image_subsample=None, border_width=None, tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, disabled=False, bind_return_key=False, focus=False, pad=None, key=None)
return Button(button_text=button_text, button_type=BUTTON_TYPE_REALTIME, image_filename=image_filename, image_data=image_data, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, disabled=disabled, size=size, auto_size...
[]
def RealtimeButton(button_text, image_filename=None, image_data=None, image_size=(None, None), image_subsample=None, border_width=None, tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, disabled=False, bind_return_key=False, focus=False, pad=None...
[ "def", "RealtimeButton", "(", "button_text", ",", "image_filename", "=", "None", ",", "image_data", "=", "None", ",", "image_size", "=", "(", "None", ",", "None", ")", ",", "image_subsample", "=", "None", ",", "border_width", "=", "None", ",", "tooltip", "...
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/PySimpleGUIWx/PySimpleGUIWx.py#L3797-L3804
ucsb-seclab/karonte
427ac313e596f723e40768b95d13bd7a9fc92fd8
karonte-viz/viz-results.py
python
main
()
[]
def main(): if len(sys.argv) != 2: print('Use: python viz-results.py <PATH_TO_LOG_FILE>') exit() try: raw_data = open(sys.argv[1]).read() except: print('Error reading file') exit() global res res = parse_json_log(raw_data) set_layout() # Timer(1, o...
[ "def", "main", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", "!=", "2", ":", "print", "(", "'Use: python viz-results.py <PATH_TO_LOG_FILE>'", ")", "exit", "(", ")", "try", ":", "raw_data", "=", "open", "(", "sys", ".", "argv", "[", "1", "...
https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/karonte-viz/viz-results.py#L359-L376
foremast/foremast
e8eb9bd24e975772532d90efa8a9ba1850e968cc
src/foremast/iam/destroy_iam/__main__.py
python
main
()
Destroy any IAM related Resources.
Destroy any IAM related Resources.
[ "Destroy", "any", "IAM", "related", "Resources", "." ]
def main(): """Destroy any IAM related Resources.""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description=main.__doc__) add_debug(parser) add_app(parser) add_env(parser) args = parser.parse_args() logging.getLogger(__package__.split('.')[0]).setLevel(...
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "main", ".", "__doc__", ")", "add_debug", "(", "parser", ")", "add_app", "(",...
https://github.com/foremast/foremast/blob/e8eb9bd24e975772532d90efa8a9ba1850e968cc/src/foremast/iam/destroy_iam/__main__.py#L27-L39
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_internal/configuration.py
python
Configuration.__init__
(self, isolated, load_only=None)
[]
def __init__(self, isolated, load_only=None): # type: (bool, Kind) -> None super(Configuration, self).__init__() _valid_load_only = [kinds.USER, kinds.GLOBAL, kinds.VENV, None] if load_only not in _valid_load_only: raise ConfigurationError( "Got invalid value...
[ "def", "__init__", "(", "self", ",", "isolated", ",", "load_only", "=", "None", ")", ":", "# type: (bool, Kind) -> None", "super", "(", "Configuration", ",", "self", ")", ".", "__init__", "(", ")", "_valid_load_only", "=", "[", "kinds", ".", "USER", ",", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_internal/configuration.py#L80-L108
mapbox/robosat
cbb1c73328183afd2d6351b7bfa3f430b73103ea
robosat/transforms.py
python
JointRandomVerticalFlip.__call__
(self, images, mask)
Randomly flips images and their mask top to bottom. Args: images: the PIL.Image image to transform. mask: the PIL.Image mask to transform. Returns: The PIL.Image (images, mask) tuple with either images and mask flipped or none of them flipped.
Randomly flips images and their mask top to bottom.
[ "Randomly", "flips", "images", "and", "their", "mask", "top", "to", "bottom", "." ]
def __call__(self, images, mask): """Randomly flips images and their mask top to bottom. Args: images: the PIL.Image image to transform. mask: the PIL.Image mask to transform. Returns: The PIL.Image (images, mask) tuple with either images and mask flipped or none ...
[ "def", "__call__", "(", "self", ",", "images", ",", "mask", ")", ":", "if", "random", ".", "random", "(", ")", "<", "self", ".", "p", ":", "return", "[", "v", ".", "transpose", "(", "Image", ".", "FLIP_TOP_BOTTOM", ")", "for", "v", "in", "images", ...
https://github.com/mapbox/robosat/blob/cbb1c73328183afd2d6351b7bfa3f430b73103ea/robosat/transforms.py#L140-L154
quantumlib/Cirq
89f88b01d69222d3f1ec14d649b7b3a85ed9211f
cirq-core/cirq/work/observable_settings.py
python
_max_weight_observable
(observables: Iterable[ops.PauliString])
return ops.PauliString(qubit_pauli_map)
Create a new observable that is compatible with all input observables and has the maximum non-identity elements. The returned PauliString is constructed by taking the non-identity single-qubit Pauli at each qubit position. This function will return `None` if the input observables do not share a te...
Create a new observable that is compatible with all input observables and has the maximum non-identity elements.
[ "Create", "a", "new", "observable", "that", "is", "compatible", "with", "all", "input", "observables", "and", "has", "the", "maximum", "non", "-", "identity", "elements", "." ]
def _max_weight_observable(observables: Iterable[ops.PauliString]) -> Union[None, ops.PauliString]: """Create a new observable that is compatible with all input observables and has the maximum non-identity elements. The returned PauliString is constructed by taking the non-identity single-qubit Pauli a...
[ "def", "_max_weight_observable", "(", "observables", ":", "Iterable", "[", "ops", ".", "PauliString", "]", ")", "->", "Union", "[", "None", ",", "ops", ".", "PauliString", "]", ":", "qubit_pauli_map", ":", "Dict", "[", "ops", ".", "Qid", ",", "ops", ".",...
https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-core/cirq/work/observable_settings.py#L62-L86
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1beta1_endpoint_slice.py
python
V1beta1EndpointSlice.__ne__
(self, other)
return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
Returns true if both objects are not equal
[ "Returns", "true", "if", "both", "objects", "are", "not", "equal" ]
def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, V1beta1EndpointSlice): return True return self.to_dict() != other.to_dict()
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V1beta1EndpointSlice", ")", ":", "return", "True", "return", "self", ".", "to_dict", "(", ")", "!=", "other", ".", "to_dict", "(", ")" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1beta1_endpoint_slice.py#L257-L262
ramses-tech/ramses
ea2e1e896325b7256cdf5902309e05fd98e0c14c
ramses/acl.py
python
parse_acl
(acl_string)
return result_acl
Parse raw string :acl_string: of RAML-defined ACLs. If :acl_string: is blank or None, all permissions are given. Values of ACL action and principal are parsed using `actions` and `special_principals` maps and are looked up after `strip()` and `lower()`. ACEs in :acl_string: may be separated by new...
Parse raw string :acl_string: of RAML-defined ACLs.
[ "Parse", "raw", "string", ":", "acl_string", ":", "of", "RAML", "-", "defined", "ACLs", "." ]
def parse_acl(acl_string): """ Parse raw string :acl_string: of RAML-defined ACLs. If :acl_string: is blank or None, all permissions are given. Values of ACL action and principal are parsed using `actions` and `special_principals` maps and are looked up after `strip()` and `lower()`. ACEs in :...
[ "def", "parse_acl", "(", "acl_string", ")", ":", "if", "not", "acl_string", ":", "return", "[", "ALLOW_ALL", "]", "aces_list", "=", "acl_string", ".", "replace", "(", "'\\n'", ",", "';'", ")", ".", "split", "(", "';'", ")", "aces_list", "=", "[", "ace"...
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/acl.py#L61-L107
thinkle/gourmet
8af29c8ded24528030e5ae2ea3461f61c1e5a575
gourmet/plugins/nutritional_information/reccard_plugin.py
python
NutritionDisplayModule.nutrition_highlighting_label_changed
(self, *args)
[]
def nutrition_highlighting_label_changed (self, *args): self.nutritional_highlighting = True self.recipe_display.prefs['nutrition_to_highlight'] = self.nutritionLabel.active_name self.recipe_display.ingredientDisplay.display_ingredients()
[ "def", "nutrition_highlighting_label_changed", "(", "self", ",", "*", "args", ")", ":", "self", ".", "nutritional_highlighting", "=", "True", "self", ".", "recipe_display", ".", "prefs", "[", "'nutrition_to_highlight'", "]", "=", "self", ".", "nutritionLabel", "."...
https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/plugins/nutritional_information/reccard_plugin.py#L59-L62
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/heatmapgl/_stream.py
python
Stream.__init__
(self, arg=None, maxpoints=None, token=None, **kwargs)
Construct a new Stream object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.heatmapgl.Stream` maxpoints Sets the maximum number of points to keep on the pl...
Construct a new Stream object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.heatmapgl.Stream` maxpoints Sets the maximum number of points to keep on the pl...
[ "Construct", "a", "new", "Stream", "object", "Parameters", "----------", "arg", "dict", "of", "properties", "compatible", "with", "this", "constructor", "or", "an", "instance", "of", ":", "class", ":", "plotly", ".", "graph_objs", ".", "heatmapgl", ".", "Strea...
def __init__(self, arg=None, maxpoints=None, token=None, **kwargs): """ Construct a new Stream object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.heatmapgl.S...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "maxpoints", "=", "None", ",", "token", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Stream", ",", "self", ")", ".", "__init__", "(", "\"stream\"", ")", "if", "\"_paren...
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/heatmapgl/_stream.py#L73-L141
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmentables/kps.py
python
KeypointsOnImage.clip_out_of_image_
(self)
return self.remove_out_of_image_fraction_(0.5)
Remove all KPs that are outside of the image plane. This method exists for consistency with other augmentables, e.g. bounding boxes. Added in 0.4.0. Returns ------- imgaug.augmentables.kps.KeypointsOnImage Keypoints that are inside the image plane. ...
Remove all KPs that are outside of the image plane.
[ "Remove", "all", "KPs", "that", "are", "outside", "of", "the", "image", "plane", "." ]
def clip_out_of_image_(self): """Remove all KPs that are outside of the image plane. This method exists for consistency with other augmentables, e.g. bounding boxes. Added in 0.4.0. Returns ------- imgaug.augmentables.kps.KeypointsOnImage Keypoints ...
[ "def", "clip_out_of_image_", "(", "self", ")", ":", "# we could use anything >0 here as the fraction", "return", "self", ".", "remove_out_of_image_fraction_", "(", "0.5", ")" ]
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmentables/kps.py#L851-L867
mlflow/mlflow
364aca7daf0fcee3ec407ae0b1b16d9cb3085081
mlflow/store/tracking/sqlalchemy_store.py
python
SqlAlchemyStore._list_experiments
( self, ids=None, names=None, view_type=ViewType.ACTIVE_ONLY, max_results=None, page_token=None, eager=False, )
:param eager: If ``True``, eagerly loads each experiments's tags. If ``False``, these tags are not eagerly loaded and will be loaded if/when their corresponding object properties are accessed from a resulting ``SqlExperiment`` object.
:param eager: If ``True``, eagerly loads each experiments's tags. If ``False``, these tags are not eagerly loaded and will be loaded if/when their corresponding object properties are accessed from a resulting ``SqlExperiment`` object.
[ ":", "param", "eager", ":", "If", "True", "eagerly", "loads", "each", "experiments", "s", "tags", ".", "If", "False", "these", "tags", "are", "not", "eagerly", "loaded", "and", "will", "be", "loaded", "if", "/", "when", "their", "corresponding", "object", ...
def _list_experiments( self, ids=None, names=None, view_type=ViewType.ACTIVE_ONLY, max_results=None, page_token=None, eager=False, ): """ :param eager: If ``True``, eagerly loads each experiments's tags. If ``False``, these tags ...
[ "def", "_list_experiments", "(", "self", ",", "ids", "=", "None", ",", "names", "=", "None", ",", "view_type", "=", "ViewType", ".", "ACTIVE_ONLY", ",", "max_results", "=", "None", ",", "page_token", "=", "None", ",", "eager", "=", "False", ",", ")", "...
https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/store/tracking/sqlalchemy_store.py#L255-L310
transcranial/jupyter-themer
c12a953315734b90147a078750cfbe323eda340d
jupythemer/jupythemer.py
python
run
(args=None)
[]
def run(args=None): if args is None: parser = argparse.ArgumentParser(description='Jupyter notebook themer.') parser.add_argument('-c', '--color', required=False, dest='color', default=None, help='color style') parser.add_argument('-l', '--layout', required=False, dest='layout', default=None...
[ "def", "run", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Jupyter notebook themer.'", ")", "parser", ".", "add_argument", "(", "'-c'", ",", "'--color'", "...
https://github.com/transcranial/jupyter-themer/blob/c12a953315734b90147a078750cfbe323eda340d/jupythemer/jupythemer.py#L24-L117
NervanaSystems/neon
8c3fb8a93b4a89303467b25817c60536542d08bd
examples/ssd/datasets/ingest_pascalvoc.py
python
get_tag_list
(index_file)
return tag_list
[]
def get_tag_list(index_file): with open(index_file) as f: tag_list = [tag.rstrip(os.linesep) for tag in f] return tag_list
[ "def", "get_tag_list", "(", "index_file", ")", ":", "with", "open", "(", "index_file", ")", "as", "f", ":", "tag_list", "=", "[", "tag", ".", "rstrip", "(", "os", ".", "linesep", ")", "for", "tag", "in", "f", "]", "return", "tag_list" ]
https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/examples/ssd/datasets/ingest_pascalvoc.py#L153-L157
SHI-Labs/Decoupled-Classification-Refinement
16202b48eb9cbf79a9b130a98e8c209d4f24693e
faster_rcnn/train_end2end.py
python
train_net
(args, ctx, pretrained, epoch, prefix, begin_epoch, end_epoch, lr, lr_step)
[]
def train_net(args, ctx, pretrained, epoch, prefix, begin_epoch, end_epoch, lr, lr_step): logger, final_output_path = create_logger(config.output_path, args.cfg, config.dataset.image_set) prefix = os.path.join(final_output_path, prefix) # load symbol shutil.copy2(os.path.join(curr_path, 'symbols', conf...
[ "def", "train_net", "(", "args", ",", "ctx", ",", "pretrained", ",", "epoch", ",", "prefix", ",", "begin_epoch", ",", "end_epoch", ",", "lr", ",", "lr_step", ")", ":", "logger", ",", "final_output_path", "=", "create_logger", "(", "config", ".", "output_pa...
https://github.com/SHI-Labs/Decoupled-Classification-Refinement/blob/16202b48eb9cbf79a9b130a98e8c209d4f24693e/faster_rcnn/train_end2end.py#L57-L162
ZZUTK/SRNTT
c9a2cf95534e2d3c2c2210718c9903c9f389d67d
SRNTT/tensorlayer/db.py
python
TensorDB._print_dict
(self, args)
return string
[]
def _print_dict(self, args): # return " / ".join(str(key) + ": "+ str(value) for key, value in args.items()) string = '' for key, value in args.items(): if key is not '_id': string += str(key) + ": "+ str(value) + " / " return string
[ "def", "_print_dict", "(", "self", ",", "args", ")", ":", "# return \" / \".join(str(key) + \": \"+ str(value) for key, value in args.items())", "string", "=", "''", "for", "key", ",", "value", "in", "args", ".", "items", "(", ")", ":", "if", "key", "is", "not", ...
https://github.com/ZZUTK/SRNTT/blob/c9a2cf95534e2d3c2c2210718c9903c9f389d67d/SRNTT/tensorlayer/db.py#L216-L223
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/codecs.py
python
StreamRecoder.next
(self)
return data
Return the next decoded line from the input stream.
Return the next decoded line from the input stream.
[ "Return", "the", "next", "decoded", "line", "from", "the", "input", "stream", "." ]
def next(self): """ Return the next decoded line from the input stream.""" data = self.reader.next() data, bytesencoded = self.encode(data, self.errors) return data
[ "def", "next", "(", "self", ")", ":", "data", "=", "self", ".", "reader", ".", "next", "(", ")", "data", ",", "bytesencoded", "=", "self", ".", "encode", "(", "data", ",", "self", ".", "errors", ")", "return", "data" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/codecs.py#L815-L820
carnal0wnage/weirdAAL
c14e36d7bb82447f38a43da203f4bc29429f4cf4
libs/aws/brute.py
python
brute_ssm_permissions
()
return generic_permission_bruteforcer('ssm', tests)
http://boto3.readthedocs.io/en/latest/reference/services/ssm.html
http://boto3.readthedocs.io/en/latest/reference/services/ssm.html
[ "http", ":", "//", "boto3", ".", "readthedocs", ".", "io", "/", "en", "/", "latest", "/", "reference", "/", "services", "/", "ssm", ".", "html" ]
def brute_ssm_permissions(): ''' http://boto3.readthedocs.io/en/latest/reference/services/ssm.html ''' print("### Enumerating Amazon Simple Systems Manager (SSM) Permissions ###") tests = [('DescribeActivations', 'describe_activations', (), {}), # ('DescribeAssociation', 'describe_assoc...
[ "def", "brute_ssm_permissions", "(", ")", ":", "print", "(", "\"### Enumerating Amazon Simple Systems Manager (SSM) Permissions ###\"", ")", "tests", "=", "[", "(", "'DescribeActivations'", ",", "'describe_activations'", ",", "(", ")", ",", "{", "}", ")", ",", "# ('De...
https://github.com/carnal0wnage/weirdAAL/blob/c14e36d7bb82447f38a43da203f4bc29429f4cf4/libs/aws/brute.py#L2254-L2263
ProjectQ-Framework/ProjectQ
0d32c1610ba4e9aefd7f19eb52dadb4fbe5f9005
projectq/meta/_compute.py
python
ComputeTag.__eq__
(self, other)
return isinstance(other, ComputeTag)
Equal operator.
Equal operator.
[ "Equal", "operator", "." ]
def __eq__(self, other): """Equal operator.""" return isinstance(other, ComputeTag)
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "return", "isinstance", "(", "other", ",", "ComputeTag", ")" ]
https://github.com/ProjectQ-Framework/ProjectQ/blob/0d32c1610ba4e9aefd7f19eb52dadb4fbe5f9005/projectq/meta/_compute.py#L39-L41
AndroidHooker/hooker
1f73d741195f6d57c12e0d36bfd8a0a22f573e6c
hooker_xp/hooker_xp/analysis/Analysis.py
python
Analysis.reporter
(self)
return self.__reporter
The reporter
The reporter
[ "The", "reporter" ]
def reporter(self): """The reporter """ return self.__reporter
[ "def", "reporter", "(", "self", ")", ":", "return", "self", ".", "__reporter" ]
https://github.com/AndroidHooker/hooker/blob/1f73d741195f6d57c12e0d36bfd8a0a22f573e6c/hooker_xp/hooker_xp/analysis/Analysis.py#L217-L220
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/plugins/backlink.py
python
backlinkController.loadLinksInt
(self)
load links after file opened or reload on request from UI
load links after file opened or reload on request from UI
[ "load", "links", "after", "file", "opened", "or", "reload", "on", "request", "from", "UI" ]
def loadLinksInt(self): """load links after file opened or reload on request from UI""" c = self.c # checked in loadLinks() self.initIvars() # clears self.vnode idsSeen = set() # just the vnodes with link info. # make map from linked node's ids to their vnodes for ...
[ "def", "loadLinksInt", "(", "self", ")", ":", "c", "=", "self", ".", "c", "# checked in loadLinks()", "self", ".", "initIvars", "(", ")", "# clears self.vnode", "idsSeen", "=", "set", "(", ")", "# just the vnodes with link info.", "# make map from linked node's ids to...
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/backlink.py#L424-L475
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/django/dispatch/dispatcher.py
python
receiver
(signal, **kwargs)
return _decorator
A decorator for connecting receivers to signals. Used by passing in the signal (or list of signals) and keyword arguments to connect:: @receiver(post_save, sender=MyModel) def signal_receiver(sender, **kwargs): ... @receiver([post_save, post_delete], sender=MyModel) def...
A decorator for connecting receivers to signals. Used by passing in the signal (or list of signals) and keyword arguments to connect::
[ "A", "decorator", "for", "connecting", "receivers", "to", "signals", ".", "Used", "by", "passing", "in", "the", "signal", "(", "or", "list", "of", "signals", ")", "and", "keyword", "arguments", "to", "connect", "::" ]
def receiver(signal, **kwargs): """ A decorator for connecting receivers to signals. Used by passing in the signal (or list of signals) and keyword arguments to connect:: @receiver(post_save, sender=MyModel) def signal_receiver(sender, **kwargs): ... @receiver([post_sav...
[ "def", "receiver", "(", "signal", ",", "*", "*", "kwargs", ")", ":", "def", "_decorator", "(", "func", ")", ":", "if", "isinstance", "(", "signal", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "s", "in", "signal", ":", "s", ".", "connect...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/dispatch/dispatcher.py#L252-L273
Abjad/abjad
d0646dfbe83db3dc5ab268f76a0950712b87b7fd
abjad/bind.py
python
Wrapper.indicator
(self)
return self._indicator
Gets indicator.
Gets indicator.
[ "Gets", "indicator", "." ]
def indicator(self) -> typing.Any: """ Gets indicator. """ return self._indicator
[ "def", "indicator", "(", "self", ")", "->", "typing", ".", "Any", ":", "return", "self", ".", "_indicator" ]
https://github.com/Abjad/abjad/blob/d0646dfbe83db3dc5ab268f76a0950712b87b7fd/abjad/bind.py#L543-L547
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/werkzeug/utils.py
python
find_modules
(import_path, include_packages=False, recursive=False)
Finds all the modules below a package. This can be useful to automatically import all views / controllers so that their metaclasses / function decorators have a chance to register themselves on the application. Packages are not returned unless `include_packages` is `True`. This can also recursive...
Finds all the modules below a package. This can be useful to automatically import all views / controllers so that their metaclasses / function decorators have a chance to register themselves on the application.
[ "Finds", "all", "the", "modules", "below", "a", "package", ".", "This", "can", "be", "useful", "to", "automatically", "import", "all", "views", "/", "controllers", "so", "that", "their", "metaclasses", "/", "function", "decorators", "have", "a", "chance", "t...
def find_modules(import_path, include_packages=False, recursive=False): """Finds all the modules below a package. This can be useful to automatically import all views / controllers so that their metaclasses / function decorators have a chance to register themselves on the application. Packages are...
[ "def", "find_modules", "(", "import_path", ",", "include_packages", "=", "False", ",", "recursive", "=", "False", ")", ":", "module", "=", "import_string", "(", "import_path", ")", "path", "=", "getattr", "(", "module", ",", "'__path__'", ",", "None", ")", ...
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/werkzeug/utils.py#L446-L475
NVIDIA/Megatron-LM
9a8b89acd8f6ba096860170d0e30ddc0bc2bacd4
megatron/text_generation/tokenization.py
python
detokenize_generations
(tokens_gpu_tensor, lengths_gpu_tensor, return_segments)
return tokens, prompts_plus_generations
Detokenize the generated tokens.
Detokenize the generated tokens.
[ "Detokenize", "the", "generated", "tokens", "." ]
def detokenize_generations(tokens_gpu_tensor, lengths_gpu_tensor, return_segments): """Detokenize the generated tokens.""" tokenizer = get_tokenizer() prompts_plus_generations = [] if return_segments: prompts_plus_generations_segments = [] ...
[ "def", "detokenize_generations", "(", "tokens_gpu_tensor", ",", "lengths_gpu_tensor", ",", "return_segments", ")", ":", "tokenizer", "=", "get_tokenizer", "(", ")", "prompts_plus_generations", "=", "[", "]", "if", "return_segments", ":", "prompts_plus_generations_segments...
https://github.com/NVIDIA/Megatron-LM/blob/9a8b89acd8f6ba096860170d0e30ddc0bc2bacd4/megatron/text_generation/tokenization.py#L26-L57
sdispater/tomlkit
7b450661e02d161cbf9a3bec3b3955cbcb64efef
tomlkit/container.py
python
Container._previous_item_with_index
( self, idx: Optional[int] = None, ignore=(Null,) )
return None
Find the immediate previous item before index ``idx``
Find the immediate previous item before index ``idx``
[ "Find", "the", "immediate", "previous", "item", "before", "index", "idx" ]
def _previous_item_with_index( self, idx: Optional[int] = None, ignore=(Null,) ) -> Optional[Tuple[int, Item]]: """Find the immediate previous item before index ``idx``""" if idx is None or idx > len(self._body): idx = len(self._body) for i in range(idx - 1, -1, -1): ...
[ "def", "_previous_item_with_index", "(", "self", ",", "idx", ":", "Optional", "[", "int", "]", "=", "None", ",", "ignore", "=", "(", "Null", ",", ")", ")", "->", "Optional", "[", "Tuple", "[", "int", ",", "Item", "]", "]", ":", "if", "idx", "is", ...
https://github.com/sdispater/tomlkit/blob/7b450661e02d161cbf9a3bec3b3955cbcb64efef/tomlkit/container.py#L755-L765
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/idlelib/searchbase.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/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/idlelib/searchbase.py#L129-L146
IBM/lale
b4d6829c143a4735b06083a0e6c70d2cca244162
lale/lib/rasl/_eval_spark_df.py
python
day_of_year
(call: ast.Call)
return time_functions(call, dayofyear)
[]
def day_of_year(call: ast.Call): return time_functions(call, dayofyear)
[ "def", "day_of_year", "(", "call", ":", "ast", ".", "Call", ")", ":", "return", "time_functions", "(", "call", ",", "dayofyear", ")" ]
https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/lib/rasl/_eval_spark_df.py#L147-L148
deepmind/bsuite
f305972cf05042f6ce23d638477ea9b33918ba17
bsuite/utils/gym_wrapper.py
python
DMEnvFromGym.close
(self)
[]
def close(self): self.gym_env.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "gym_env", ".", "close", "(", ")" ]
https://github.com/deepmind/bsuite/blob/f305972cf05042f6ce23d638477ea9b33918ba17/bsuite/utils/gym_wrapper.py#L178-L179
esafak/mca
f2b79ecbf37629902ccdbad2e1a556977c53d370
src/mca.py
python
MCA.fs_c_sup
(self, DF, N=None)
return _mul((DF/DF.sum()).T, self.F, S_inv)[:, :N]
Find the supplementary column factor scores. ncols: The number of singular vectors to retain. If both are passed, cols is given preference.
Find the supplementary column factor scores.
[ "Find", "the", "supplementary", "column", "factor", "scores", "." ]
def fs_c_sup(self, DF, N=None): """Find the supplementary column factor scores. ncols: The number of singular vectors to retain. If both are passed, cols is given preference. """ if not hasattr(self, 'F'): self.fs_r(N=self.rank) # generate F if N and (not isinstance(N, int) or N <= 0): raise ValueE...
[ "def", "fs_c_sup", "(", "self", ",", "DF", ",", "N", "=", "None", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'F'", ")", ":", "self", ".", "fs_r", "(", "N", "=", "self", ".", "rank", ")", "# generate F", "if", "N", "and", "(", "not", ...
https://github.com/esafak/mca/blob/f2b79ecbf37629902ccdbad2e1a556977c53d370/src/mca.py#L216-L231
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/cherrypy/cherrypy/lib/caching.py
python
Cache.delete
(self)
Remove ALL cached variants of the current resource.
Remove ALL cached variants of the current resource.
[ "Remove", "ALL", "cached", "variants", "of", "the", "current", "resource", "." ]
def delete(self): """Remove ALL cached variants of the current resource.""" raise NotImplemented
[ "def", "delete", "(", "self", ")", ":", "raise", "NotImplemented" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/cherrypy/cherrypy/lib/caching.py#L56-L58
deanishe/alfred-vpn-manager
f5d0dd1433ea69b1517d4866a12b1118097057b9
src/workflow/web.py
python
Response._get_encoding
(self)
return encoding
Get encoding from HTTP headers or content. :returns: encoding or `None` :rtype: unicode or ``None``
Get encoding from HTTP headers or content.
[ "Get", "encoding", "from", "HTTP", "headers", "or", "content", "." ]
def _get_encoding(self): """Get encoding from HTTP headers or content. :returns: encoding or `None` :rtype: unicode or ``None`` """ headers = self.raw.info() encoding = None if headers.getparam('charset'): encoding = headers.getparam('charset') ...
[ "def", "_get_encoding", "(", "self", ")", ":", "headers", "=", "self", ".", "raw", ".", "info", "(", ")", "encoding", "=", "None", "if", "headers", ".", "getparam", "(", "'charset'", ")", ":", "encoding", "=", "headers", ".", "getparam", "(", "'charset...
https://github.com/deanishe/alfred-vpn-manager/blob/f5d0dd1433ea69b1517d4866a12b1118097057b9/src/workflow/web.py#L416-L463
privacyidea/privacyidea
9490c12ddbf77a34ac935b082d09eb583dfafa2c
privacyidea/lib/importotp.py
python
_create_static_password
(key_hex)
return password
According to yubikey manual 5.5.5 the static-ticket is the same algorithm with no moving factors. The msg_hex that is encoded with the AES key is '000000000000ffffffffffffffff0f2e'
According to yubikey manual 5.5.5 the static-ticket is the same algorithm with no moving factors. The msg_hex that is encoded with the AES key is '000000000000ffffffffffffffff0f2e'
[ "According", "to", "yubikey", "manual", "5", ".", "5", ".", "5", "the", "static", "-", "ticket", "is", "the", "same", "algorithm", "with", "no", "moving", "factors", ".", "The", "msg_hex", "that", "is", "encoded", "with", "the", "AES", "key", "is", "00...
def _create_static_password(key_hex): ''' According to yubikey manual 5.5.5 the static-ticket is the same algorithm with no moving factors. The msg_hex that is encoded with the AES key is '000000000000ffffffffffffffff0f2e' ''' msg_hex = "000000000000ffffffffffffffff0f2e" msg_bin = binasc...
[ "def", "_create_static_password", "(", "key_hex", ")", ":", "msg_hex", "=", "\"000000000000ffffffffffffffff0f2e\"", "msg_bin", "=", "binascii", ".", "unhexlify", "(", "msg_hex", ")", "cipher", "=", "Cipher", "(", "algorithms", ".", "AES", "(", "binascii", ".", "...
https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/lib/importotp.py#L77-L92
deepfakes/faceswap
09c7d8aca3c608d1afad941ea78e9fd9b64d9219
lib/gui/popup_session.py
python
SessionPopUp._opts_buttons
(self, frame)
Add the option buttons. Parameters ---------- frame: `tkinter.ttk.Frame` The frame that the options reside in
Add the option buttons.
[ "Add", "the", "option", "buttons", "." ]
def _opts_buttons(self, frame): """ Add the option buttons. Parameters ---------- frame: `tkinter.ttk.Frame` The frame that the options reside in """ logger.debug("Building Buttons") btnframe = ttk.Frame(frame) lblstatus = ttk.Label(btnframe, ...
[ "def", "_opts_buttons", "(", "self", ",", "frame", ")", ":", "logger", ".", "debug", "(", "\"Building Buttons\"", ")", "btnframe", "=", "ttk", ".", "Frame", "(", "frame", ")", "lblstatus", "=", "ttk", ".", "Label", "(", "btnframe", ",", "width", "=", "...
https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/lib/gui/popup_session.py#L246-L272
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/states/mount.py
python
_convert_to
(maybe_device, convert_to)
return result
Convert a device name, UUID or LABEL to a device name, UUID or LABEL. Return the fs_spec required for fstab.
Convert a device name, UUID or LABEL to a device name, UUID or LABEL.
[ "Convert", "a", "device", "name", "UUID", "or", "LABEL", "to", "a", "device", "name", "UUID", "or", "LABEL", "." ]
def _convert_to(maybe_device, convert_to): """ Convert a device name, UUID or LABEL to a device name, UUID or LABEL. Return the fs_spec required for fstab. """ # Fast path. If we already have the information required, we can # save one blkid call if ( not convert_to or...
[ "def", "_convert_to", "(", "maybe_device", ",", "convert_to", ")", ":", "# Fast path. If we already have the information required, we can", "# save one blkid call", "if", "(", "not", "convert_to", "or", "(", "convert_to", "==", "\"device\"", "and", "maybe_device", ".", "s...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/states/mount.py#L1038-L1070
google-research/disentanglement_lib
86a644d4ed35c771560dc3360756363d35477357
disentanglement_lib/evaluation/abstract_reasoning/reason.py
python
reason
( input_dir, output_dir, overwrite=False, model=gin.REQUIRED, num_iterations=gin.REQUIRED, training_steps_per_iteration=gin.REQUIRED, eval_steps_per_iteration=gin.REQUIRED, random_seed=gin.REQUIRED, batch_size=gin.REQUIRED, name="", )
Trains the estimator and exports the snapshot and the gin config. The use of this function requires the gin binding 'dataset.name' to be specified if a model is trained from scratch as that determines the data set used for training. Args: input_dir: String with path to directory where the representation f...
Trains the estimator and exports the snapshot and the gin config.
[ "Trains", "the", "estimator", "and", "exports", "the", "snapshot", "and", "the", "gin", "config", "." ]
def reason( input_dir, output_dir, overwrite=False, model=gin.REQUIRED, num_iterations=gin.REQUIRED, training_steps_per_iteration=gin.REQUIRED, eval_steps_per_iteration=gin.REQUIRED, random_seed=gin.REQUIRED, batch_size=gin.REQUIRED, name="", ): """Trains the estimator and expo...
[ "def", "reason", "(", "input_dir", ",", "output_dir", ",", "overwrite", "=", "False", ",", "model", "=", "gin", ".", "REQUIRED", ",", "num_iterations", "=", "gin", ".", "REQUIRED", ",", "training_steps_per_iteration", "=", "gin", ".", "REQUIRED", ",", "eval_...
https://github.com/google-research/disentanglement_lib/blob/86a644d4ed35c771560dc3360756363d35477357/disentanglement_lib/evaluation/abstract_reasoning/reason.py#L67-L200
fooof-tools/fooof
14d6196e0b60c7e6da95b5cf858b20adcc5fc0ac
fooof/objs/fit.py
python
FOOOF.add_settings
(self, fooof_settings)
Add settings into object from a FOOOFSettings object. Parameters ---------- fooof_settings : FOOOFSettings A data object containing the settings for a FOOOF model.
Add settings into object from a FOOOFSettings object.
[ "Add", "settings", "into", "object", "from", "a", "FOOOFSettings", "object", "." ]
def add_settings(self, fooof_settings): """Add settings into object from a FOOOFSettings object. Parameters ---------- fooof_settings : FOOOFSettings A data object containing the settings for a FOOOF model. """ for setting in OBJ_DESC['settings']: ...
[ "def", "add_settings", "(", "self", ",", "fooof_settings", ")", ":", "for", "setting", "in", "OBJ_DESC", "[", "'settings'", "]", ":", "setattr", "(", "self", ",", "setting", ",", "getattr", "(", "fooof_settings", ",", "setting", ")", ")", "self", ".", "_...
https://github.com/fooof-tools/fooof/blob/14d6196e0b60c7e6da95b5cf858b20adcc5fc0ac/fooof/objs/fit.py#L327-L339
arizvisa/ida-minsc
8627a60f047b5e55d3efeecde332039cd1a16eea
custom/tags.py
python
read.frame
(cls, ea)
return
Iterate through each field within the frame belonging to the function `ea`.
Iterate through each field within the frame belonging to the function `ea`.
[ "Iterate", "through", "each", "field", "within", "the", "frame", "belonging", "to", "the", "function", "ea", "." ]
def frame(cls, ea): '''Iterate through each field within the frame belonging to the function `ea`.''' F = func.by(ea) # iterate through all of the frame's members try: res = func.frame(F) except internal.exceptions.MissingTypeOrAttribute: logging.info(u"{...
[ "def", "frame", "(", "cls", ",", "ea", ")", ":", "F", "=", "func", ".", "by", "(", "ea", ")", "# iterate through all of the frame's members", "try", ":", "res", "=", "func", ".", "frame", "(", "F", ")", "except", "internal", ".", "exceptions", ".", "Mi...
https://github.com/arizvisa/ida-minsc/blob/8627a60f047b5e55d3efeecde332039cd1a16eea/custom/tags.py#L117-L144
flask-admin/flask-admin
7cff9c742d44d42a8d3495c73a6d71381c796396
flask_admin/contrib/sqla/fields.py
python
InlineModelFormList.__init__
(self, form, session, model, prop, inline_view, **kwargs)
Default constructor. :param form: Form for the related model :param session: SQLAlchemy session :param model: Related model :param prop: Related property name :param inline_view: ...
Default constructor.
[ "Default", "constructor", "." ]
def __init__(self, form, session, model, prop, inline_view, **kwargs): """ Default constructor. :param form: Form for the related model :param session: SQLAlchemy session :param model: Related model :par...
[ "def", "__init__", "(", "self", ",", "form", ",", "session", ",", "model", ",", "prop", ",", "inline_view", ",", "*", "*", "kwargs", ")", ":", "self", ".", "form", "=", "form", "self", ".", "session", "=", "session", "self", ".", "model", "=", "mod...
https://github.com/flask-admin/flask-admin/blob/7cff9c742d44d42a8d3495c73a6d71381c796396/flask_admin/contrib/sqla/fields.py#L259-L288
achael/eht-imaging
bbd3aeb06bef52bf89fa1c06de71e5509a5b0015
ehtim/imager.py
python
Imager.check_params
(self)
Check parameter consistency.
Check parameter consistency.
[ "Check", "parameter", "consistency", "." ]
def check_params(self): """Check parameter consistency. """ if ((self.prior_next.psize != self.init_next.psize) or (self.prior_next.xdim != self.init_next.xdim) or (self.prior_next.ydim != self.prior_next.ydim)): raise Exception("Initial image does not mat...
[ "def", "check_params", "(", "self", ")", ":", "if", "(", "(", "self", ".", "prior_next", ".", "psize", "!=", "self", ".", "init_next", ".", "psize", ")", "or", "(", "self", ".", "prior_next", ".", "xdim", "!=", "self", ".", "init_next", ".", "xdim", ...
https://github.com/achael/eht-imaging/blob/bbd3aeb06bef52bf89fa1c06de71e5509a5b0015/ehtim/imager.py#L424-L630
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/beets/dbcore/db.py
python
Model._getters
(cls)
Return a mapping from field names to getter functions.
Return a mapping from field names to getter functions.
[ "Return", "a", "mapping", "from", "field", "names", "to", "getter", "functions", "." ]
def _getters(cls): """Return a mapping from field names to getter functions. """ # We could cache this if it becomes a performance problem to # gather the getter mapping every time. raise NotImplementedError()
[ "def", "_getters", "(", "cls", ")", ":", "# We could cache this if it becomes a performance problem to", "# gather the getter mapping every time.", "raise", "NotImplementedError", "(", ")" ]
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/beets/dbcore/db.py#L144-L149
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/parser/template/nodes/rand.py
python
TemplateRandomNode.parse_expression
(self, graph, expression)
[]
def parse_expression(self, graph, expression): li_found = False for child in expression: tag_name = TextUtils.tag_from_text(child.tag) if tag_name == 'li': li_found = True li_node = graph.get_base_node() self.children.append(li_nod...
[ "def", "parse_expression", "(", "self", ",", "graph", ",", "expression", ")", ":", "li_found", "=", "False", "for", "child", "in", "expression", ":", "tag_name", "=", "TextUtils", ".", "tag_from_text", "(", "child", ".", "tag", ")", "if", "tag_name", "==",...
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/parser/template/nodes/rand.py#L50-L64
enzienaudio/hvcc
30e47328958d600c54889e2a254c3f17f2b2fd06
interpreters/max2hv/MaxUnopObject.py
python
MaxUnopObject.get_supported_objects
(clazz)
return MaxUnopObject.__MAX_HEAVY_DICT.keys()
[]
def get_supported_objects(clazz): return MaxUnopObject.__MAX_HEAVY_DICT.keys()
[ "def", "get_supported_objects", "(", "clazz", ")", ":", "return", "MaxUnopObject", ".", "__MAX_HEAVY_DICT", ".", "keys", "(", ")" ]
https://github.com/enzienaudio/hvcc/blob/30e47328958d600c54889e2a254c3f17f2b2fd06/interpreters/max2hv/MaxUnopObject.py#L23-L24
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/beacons/memusage.py
python
beacon
(config)
return ret
Monitor the memory usage of the minion Specify thresholds for percent used and only emit a beacon if it is exceeded. .. code-block:: yaml beacons: memusage: - percent: 63%
Monitor the memory usage of the minion
[ "Monitor", "the", "memory", "usage", "of", "the", "minion" ]
def beacon(config): """ Monitor the memory usage of the minion Specify thresholds for percent used and only emit a beacon if it is exceeded. .. code-block:: yaml beacons: memusage: - percent: 63% """ ret = [] config = salt.utils.beacons.list_to_dict(conf...
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "config", "=", "salt", ".", "utils", ".", "beacons", ".", "list_to_dict", "(", "config", ")", "_current_usage", "=", "psutil", ".", "virtual_memory", "(", ")", "current_usage", "=", "_curren...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/beacons/memusage.py#L47-L73
runawayhorse001/LearningApacheSpark
67f3879dce17553195f094f5728b94a01badcf24
pyspark/sql/catalog.py
python
Catalog.listDatabases
(self)
return databases
Returns a list of databases available across all sessions.
Returns a list of databases available across all sessions.
[ "Returns", "a", "list", "of", "databases", "available", "across", "all", "sessions", "." ]
def listDatabases(self): """Returns a list of databases available across all sessions.""" iter = self._jcatalog.listDatabases().toLocalIterator() databases = [] while iter.hasNext(): jdb = iter.next() databases.append(Database( name=jdb.name(), ...
[ "def", "listDatabases", "(", "self", ")", ":", "iter", "=", "self", ".", "_jcatalog", ".", "listDatabases", "(", ")", ".", "toLocalIterator", "(", ")", "databases", "=", "[", "]", "while", "iter", ".", "hasNext", "(", ")", ":", "jdb", "=", "iter", "....
https://github.com/runawayhorse001/LearningApacheSpark/blob/67f3879dce17553195f094f5728b94a01badcf24/pyspark/sql/catalog.py#L61-L71
faucetsdn/ryu
537f35f4b2bc634ef05e3f28373eb5e24609f989
ryu/services/protocols/bgp/operator/views/base.py
python
OperatorAbstractView.__init__
(self, obj, filter_func=None)
Init :param obj: data model for view. In other words object we are creating view for. In case of ListView it should be a list and in case of DictView it should be a dict. :param filter_func: function to filter models
Init
[ "Init" ]
def __init__(self, obj, filter_func=None): """Init :param obj: data model for view. In other words object we are creating view for. In case of ListView it should be a list and in case of DictView it should be a dict. :param filter_func: function to filter models ...
[ "def", "__init__", "(", "self", ",", "obj", ",", "filter_func", "=", "None", ")", ":", "self", ".", "_filter_func", "=", "filter_func", "self", ".", "_fields", "=", "self", ".", "_collect_fields", "(", ")", "self", ".", "_obj", "=", "obj" ]
https://github.com/faucetsdn/ryu/blob/537f35f4b2bc634ef05e3f28373eb5e24609f989/ryu/services/protocols/bgp/operator/views/base.py#L35-L45
nsacyber/WALKOFF
52d3311abe99d64cd2a902eb998c5e398efe0e07
common/walkoff_client/walkoff_client/models/copy_workflow.py
python
CopyWorkflow.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if has...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "six", ".", "iteritems", "(", "self", ".", "openapi_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", ...
https://github.com/nsacyber/WALKOFF/blob/52d3311abe99d64cd2a902eb998c5e398efe0e07/common/walkoff_client/walkoff_client/models/copy_workflow.py#L100-L122
emesene/emesene
4548a4098310e21b16437bb36223a7f632a4f7bc
emesene/e3/papylib/papyon/papyon/event/media.py
python
MediaStreamEventInterface.on_remote_candidates_received
(self, candidates)
Called when the remote candidates for this stream are received @param candidates: the remote candidates @type candidates: L{ICECandidate<papyon.sip.ice.ICECandidate>}
Called when the remote candidates for this stream are received
[ "Called", "when", "the", "remote", "candidates", "for", "this", "stream", "are", "received" ]
def on_remote_candidates_received(self, candidates): """Called when the remote candidates for this stream are received @param candidates: the remote candidates @type candidates: L{ICECandidate<papyon.sip.ice.ICECandidate>}""" pass
[ "def", "on_remote_candidates_received", "(", "self", ",", "candidates", ")", ":", "pass" ]
https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/papylib/papyon/papyon/event/media.py#L85-L89
hzy46/fast-neural-style-tensorflow
eeaa47d359e5c589a4cc6ccbf8c0450ccc657d2d
preprocessing/lenet_preprocessing.py
python
preprocess_image
(image, output_height, output_width, is_training)
return image
Preprocesses the given image. Args: image: A `Tensor` representing an image of arbitrary size. output_height: The height of the image after preprocessing. output_width: The width of the image after preprocessing. is_training: `True` if we're preprocessing the image for training and `False` othe...
Preprocesses the given image.
[ "Preprocesses", "the", "given", "image", "." ]
def preprocess_image(image, output_height, output_width, is_training): """Preprocesses the given image. Args: image: A `Tensor` representing an image of arbitrary size. output_height: The height of the image after preprocessing. output_width: The width of the image after preprocessing. is_training:...
[ "def", "preprocess_image", "(", "image", ",", "output_height", ",", "output_width", ",", "is_training", ")", ":", "image", "=", "tf", ".", "to_float", "(", "image", ")", "image", "=", "tf", ".", "image", ".", "resize_image_with_crop_or_pad", "(", "image", ",...
https://github.com/hzy46/fast-neural-style-tensorflow/blob/eeaa47d359e5c589a4cc6ccbf8c0450ccc657d2d/preprocessing/lenet_preprocessing.py#L26-L44
snwh/suru-icon-theme
2d8102084eaf194f04076ec6949feacb0eb4a1ba
src/cursors/render-cursors.py
python
SVGHandler.startElement_svg
(self, name, attrs)
Callback hook which handles the start of an svg image
Callback hook which handles the start of an svg image
[ "Callback", "hook", "which", "handles", "the", "start", "of", "an", "svg", "image" ]
def startElement_svg(self, name, attrs): """Callback hook which handles the start of an svg image""" dbg('startElement_svg called') width = attrs.get('width', None) height = attrs.get('height', None) self.pageBounds.x2 = self.parseCoordinates(width) self.pageBounds.y2 = self.parseCoordinates(height)
[ "def", "startElement_svg", "(", "self", ",", "name", ",", "attrs", ")", ":", "dbg", "(", "'startElement_svg called'", ")", "width", "=", "attrs", ".", "get", "(", "'width'", ",", "None", ")", "height", "=", "attrs", ".", "get", "(", "'height'", ",", "N...
https://github.com/snwh/suru-icon-theme/blob/2d8102084eaf194f04076ec6949feacb0eb4a1ba/src/cursors/render-cursors.py#L384-L390
Erotemic/ubelt
221d5f6262d5c8e78638e1a38e3adcc9cc9a15e9
ubelt/util_hash.py
python
_rectify_hashlen
(hashlen)
Example: >>> assert _rectify_hashlen(NoParam) is None >>> assert _rectify_hashlen(8) == 8
Example: >>> assert _rectify_hashlen(NoParam) is None >>> assert _rectify_hashlen(8) == 8
[ "Example", ":", ">>>", "assert", "_rectify_hashlen", "(", "NoParam", ")", "is", "None", ">>>", "assert", "_rectify_hashlen", "(", "8", ")", "==", "8" ]
def _rectify_hashlen(hashlen): # nocover """ Example: >>> assert _rectify_hashlen(NoParam) is None >>> assert _rectify_hashlen(8) == 8 """ if hashlen is NoParam: return None else: # nocover # import warnings from ubelt._util_deprecated import schedule_deprec...
[ "def", "_rectify_hashlen", "(", "hashlen", ")", ":", "# nocover", "if", "hashlen", "is", "NoParam", ":", "return", "None", "else", ":", "# nocover", "# import warnings", "from", "ubelt", ".", "_util_deprecated", "import", "schedule_deprecation2", "schedule_deprecation...
https://github.com/Erotemic/ubelt/blob/221d5f6262d5c8e78638e1a38e3adcc9cc9a15e9/ubelt/util_hash.py#L371-L391
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/jms/java_management_service_client.py
python
JavaManagementServiceClient.summarize_installation_usage
(self, fleet_id, **kwargs)
List Java installation usage in a Fleet filtered by query parameters. :param str fleet_id: (required) The `OCID`__ of the Fleet. __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm :param str jre_vendor: (optional) The vendor of the related J...
List Java installation usage in a Fleet filtered by query parameters.
[ "List", "Java", "installation", "usage", "in", "a", "Fleet", "filtered", "by", "query", "parameters", "." ]
def summarize_installation_usage(self, fleet_id, **kwargs): """ List Java installation usage in a Fleet filtered by query parameters. :param str fleet_id: (required) The `OCID`__ of the Fleet. __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm ...
[ "def", "summarize_installation_usage", "(", "self", ",", "fleet_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/fleets/{fleetId}/actions/summarizeInstallationUsage\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", ...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/jms/java_management_service_client.py#L1408-L1610
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/_collections.py
python
HTTPHeaderDict.__init__
(self, headers=None, **kwargs)
[]
def __init__(self, headers=None, **kwargs): super(HTTPHeaderDict, self).__init__() self._container = OrderedDict() if headers is not None: if isinstance(headers, HTTPHeaderDict): self._copy_from(headers) else: self.extend(headers) i...
[ "def", "__init__", "(", "self", ",", "headers", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "HTTPHeaderDict", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "_container", "=", "OrderedDict", "(", ")", "if", "headers", "is...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/_collections.py#L135-L144
geoopt/geoopt
c0163cde17aa215aa0f34e833364ac918ec5e974
geoopt/optim/rlinesearch.py
python
RiemannianLineSearch._derphi
(self, step_size)
return derphi
Compute derivative of phi. The derivative of phi is given by computing inner product between all tensor gradients at target point and those at source point. The source gradients are transported to the target point, and both gradients are projected.
Compute derivative of phi.
[ "Compute", "derivative", "of", "phi", "." ]
def _derphi(self, step_size): """Compute derivative of phi. The derivative of phi is given by computing inner product between all tensor gradients at target point and those at source point. The source gradients are transported to the target point, and both gradients are projecte...
[ "def", "_derphi", "(", "self", ",", "step_size", ")", ":", "if", "not", "self", ".", "compute_derphi", ":", "raise", "ValueError", "(", "\"Cannot call _derphi if self.compute_derphi=False!\"", ")", "# Call _phi to compute gradients; Does nothing if _phi was", "# already calle...
https://github.com/geoopt/geoopt/blob/c0163cde17aa215aa0f34e833364ac918ec5e974/geoopt/optim/rlinesearch.py#L306-L330
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/click/utils.py
python
LazyFile.__getattr__
(self, name)
return getattr(self.open(), name)
[]
def __getattr__(self, name): return getattr(self.open(), name)
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "return", "getattr", "(", "self", ".", "open", "(", ")", ",", "name", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/click/utils.py#L96-L97
PowerScript/KatanaFramework
0f6ad90a88de865d58ec26941cb4460501e75496
lib/scapy/scapy/contrib/gsm_um.py
python
applicationInformation
()
return packet
APPLICATION INFORMATION Section 9.1.53
APPLICATION INFORMATION Section 9.1.53
[ "APPLICATION", "INFORMATION", "Section", "9", ".", "1", ".", "53" ]
def applicationInformation(): """APPLICATION INFORMATION Section 9.1.53""" a = TpPd(pd=0x6) b = MessageType(mesType=0x38) # 00111000 c = ApduIDAndApduFlags() e = ApduData() packet = a / b / c / e return packet
[ "def", "applicationInformation", "(", ")", ":", "a", "=", "TpPd", "(", "pd", "=", "0x6", ")", "b", "=", "MessageType", "(", "mesType", "=", "0x38", ")", "# 00111000", "c", "=", "ApduIDAndApduFlags", "(", ")", "e", "=", "ApduData", "(", ")", "packet", ...
https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/scapy/scapy/contrib/gsm_um.py#L1302-L1309
researchmm/tasn
5dba8ccc096cedc63913730eeea14a9647911129
tasn-mxnet/docs/mxdoc.py
python
generate_doxygen
(app)
Run the doxygen make commands
Run the doxygen make commands
[ "Run", "the", "doxygen", "make", "commands" ]
def generate_doxygen(app): """Run the doxygen make commands""" _run_cmd("cd %s/.. && make doxygen" % app.builder.srcdir) _run_cmd("cp -rf doxygen/html %s/doxygen" % app.builder.outdir)
[ "def", "generate_doxygen", "(", "app", ")", ":", "_run_cmd", "(", "\"cd %s/.. && make doxygen\"", "%", "app", ".", "builder", ".", "srcdir", ")", "_run_cmd", "(", "\"cp -rf doxygen/html %s/doxygen\"", "%", "app", ".", "builder", ".", "outdir", ")" ]
https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/docs/mxdoc.py#L82-L85
chb/indivo_server
9826c67ab17d7fc0df935db327344fb0c7d237e5
indivo/serializers/python.py
python
Deserializer
(object_list, **options)
Deserialization is not currently supported
Deserialization is not currently supported
[ "Deserialization", "is", "not", "currently", "supported" ]
def Deserializer(object_list, **options): """ Deserialization is not currently supported """ raise NotImplementedError
[ "def", "Deserializer", "(", "object_list", ",", "*", "*", "options", ")", ":", "raise", "NotImplementedError" ]
https://github.com/chb/indivo_server/blob/9826c67ab17d7fc0df935db327344fb0c7d237e5/indivo/serializers/python.py#L74-L79
OWASP/ZSC
5bb9fed69efdc17996be4856b54af632aaed87b0
module/readline_windows/pyreadline/modes/vi.py
python
ViCommand.key_percent
(self, char)
find matching <([{}])>
find matching <([{}])>
[ "find", "matching", "<", "(", "[", "{}", "]", ")", ">" ]
def key_percent(self, char): '''find matching <([{}])>''' self.motion = self.motion_matching self.delete_right = 1 self.state = _VI_MOTION self.apply()
[ "def", "key_percent", "(", "self", ",", "char", ")", ":", "self", ".", "motion", "=", "self", ".", "motion_matching", "self", ".", "delete_right", "=", "1", "self", ".", "state", "=", "_VI_MOTION", "self", ".", "apply", "(", ")" ]
https://github.com/OWASP/ZSC/blob/5bb9fed69efdc17996be4856b54af632aaed87b0/module/readline_windows/pyreadline/modes/vi.py#L562-L567
biubug6/Face-Detector-1MB-with-landmark
2b075657aef954b9426f938ac7fce100b6910fe6
train.py
python
adjust_learning_rate
(optimizer, gamma, epoch, step_index, iteration, epoch_size)
return lr
Sets the learning rate # Adapted from PyTorch Imagenet example: # https://github.com/pytorch/examples/blob/master/imagenet/main.py
Sets the learning rate # Adapted from PyTorch Imagenet example: # https://github.com/pytorch/examples/blob/master/imagenet/main.py
[ "Sets", "the", "learning", "rate", "#", "Adapted", "from", "PyTorch", "Imagenet", "example", ":", "#", "https", ":", "//", "github", ".", "com", "/", "pytorch", "/", "examples", "/", "blob", "/", "master", "/", "imagenet", "/", "main", ".", "py" ]
def adjust_learning_rate(optimizer, gamma, epoch, step_index, iteration, epoch_size): """Sets the learning rate # Adapted from PyTorch Imagenet example: # https://github.com/pytorch/examples/blob/master/imagenet/main.py """ warmup_epoch = -1 if epoch <= warmup_epoch: lr = 1e-6 + (initial...
[ "def", "adjust_learning_rate", "(", "optimizer", ",", "gamma", ",", "epoch", ",", "step_index", ",", "iteration", ",", "epoch_size", ")", ":", "warmup_epoch", "=", "-", "1", "if", "epoch", "<=", "warmup_epoch", ":", "lr", "=", "1e-6", "+", "(", "initial_lr...
https://github.com/biubug6/Face-Detector-1MB-with-landmark/blob/2b075657aef954b9426f938ac7fce100b6910fe6/train.py#L153-L165
GoogleCloudPlatform/professional-services
0c707aa97437f3d154035ef8548109b7882f71da
examples/dataflow-data-generator/data-generator-pipeline/data_generator_pipeline.py
python
run
(argv=None)
This function parses the command line arguments and runs the Beam Pipeline. Args: argv: list containing the commandline arguments for this call of the script.
This function parses the command line arguments and runs the Beam Pipeline.
[ "This", "function", "parses", "the", "command", "line", "arguments", "and", "runs", "the", "Beam", "Pipeline", "." ]
def run(argv=None): """ This function parses the command line arguments and runs the Beam Pipeline. Args: argv: list containing the commandline arguments for this call of the script. """ # Keeps track if schema was inferred by input or ouput table. schema_inferred = False ...
[ "def", "run", "(", "argv", "=", "None", ")", ":", "# Keeps track if schema was inferred by input or ouput table.", "schema_inferred", "=", "False", "data_args", ",", "pipeline_args", "=", "parse_data_generator_args", "(", "argv", ")", "data_args", ",", "schema_inferred", ...
https://github.com/GoogleCloudPlatform/professional-services/blob/0c707aa97437f3d154035ef8548109b7882f71da/examples/dataflow-data-generator/data-generator-pipeline/data_generator_pipeline.py#L43-L152
toxygen-project/toxygen
0a54012cf5ee72434b923bcde7d8f1a4e575ce2f
toxygen/callbacks.py
python
file_recv_control
(tox, friend_number, file_number, file_control, user_data)
Friend cancelled, paused or resumed file transfer
Friend cancelled, paused or resumed file transfer
[ "Friend", "cancelled", "paused", "or", "resumed", "file", "transfer" ]
def file_recv_control(tox, friend_number, file_number, file_control, user_data): """ Friend cancelled, paused or resumed file transfer """ if file_control == TOX_FILE_CONTROL['CANCEL']: invoke_in_main_thread(Profile.get_instance().cancel_transfer, friend_number, file_number, True) elif file_...
[ "def", "file_recv_control", "(", "tox", ",", "friend_number", ",", "file_number", ",", "file_control", ",", "user_data", ")", ":", "if", "file_control", "==", "TOX_FILE_CONTROL", "[", "'CANCEL'", "]", ":", "invoke_in_main_thread", "(", "Profile", ".", "get_instanc...
https://github.com/toxygen-project/toxygen/blob/0a54012cf5ee72434b923bcde7d8f1a4e575ce2f/toxygen/callbacks.py#L257-L266
httpie/httpie
4c56d894ba9e2bb1c097a3a6067006843ac2944d
httpie/models.py
python
HTTPRequest.iter_lines
(self, chunk_size)
[]
def iter_lines(self, chunk_size): yield self.body, b''
[ "def", "iter_lines", "(", "self", ",", "chunk_size", ")", ":", "yield", "self", ".", "body", ",", "b''" ]
https://github.com/httpie/httpie/blob/4c56d894ba9e2bb1c097a3a6067006843ac2944d/httpie/models.py#L112-L113
python273/vk_api
1ef82594baabc80802ef4792aceee9180ae3e9c9
examples/captcha_handle.py
python
main
()
Пример обработки капчи
Пример обработки капчи
[ "Пример", "обработки", "капчи" ]
def main(): """ Пример обработки капчи """ login, password = 'python@vk.com', 'mypassword' vk_session = vk_api.VkApi( login, password, captcha_handler=captcha_handler # функция для обработки капчи ) try: vk_session.auth() except vk_api.AuthError as error_msg: p...
[ "def", "main", "(", ")", ":", "login", ",", "password", "=", "'python@vk.com'", ",", "'mypassword'", "vk_session", "=", "vk_api", ".", "VkApi", "(", "login", ",", "password", ",", "captcha_handler", "=", "captcha_handler", "# функция для обработки капчи", ")", "...
https://github.com/python273/vk_api/blob/1ef82594baabc80802ef4792aceee9180ae3e9c9/examples/captcha_handle.py#L17-L30
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/trakt/sync.py
python
Scrobbler.pause
(self)
Pause the scrobbling of this :class:`Scrobbler`'s *media* object
Pause the scrobbling of this :class:`Scrobbler`'s *media* object
[ "Pause", "the", "scrobbling", "of", "this", ":", "class", ":", "Scrobbler", "s", "*", "media", "*", "object" ]
def pause(self): """Pause the scrobbling of this :class:`Scrobbler`'s *media* object""" self._post('scrobble/pause')
[ "def", "pause", "(", "self", ")", ":", "self", ".", "_post", "(", "'scrobble/pause'", ")" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/trakt/sync.py#L461-L463
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pkg_resources/__init__.py
python
yield_lines
(strs)
Yield non-empty/non-comment lines of a string or sequence
Yield non-empty/non-comment lines of a string or sequence
[ "Yield", "non", "-", "empty", "/", "non", "-", "comment", "lines", "of", "a", "string", "or", "sequence" ]
def yield_lines(strs): """Yield non-empty/non-comment lines of a string or sequence""" if isinstance(strs, six.string_types): for s in strs.splitlines(): s = s.strip() # skip blank lines/comments if s and not s.startswith('#'): yield s else: ...
[ "def", "yield_lines", "(", "strs", ")", ":", "if", "isinstance", "(", "strs", ",", "six", ".", "string_types", ")", ":", "for", "s", "in", "strs", ".", "splitlines", "(", ")", ":", "s", "=", "s", ".", "strip", "(", ")", "# skip blank lines/comments", ...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pkg_resources/__init__.py#L2343-L2354
bjmayor/hacker
e3ce2ad74839c2733b27dac6c0f495e0743e1866
venv/lib/python3.5/site-packages/pip/_vendor/requests/api.py
python
get
(url, params=None, **kwargs)
return request('get', url, params=params, **kwargs)
Sends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: request...
Sends a GET request.
[ "Sends", "a", "GET", "request", "." ]
def get(url, params=None, **kwargs): """Sends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Res...
[ "def", "get", "(", "url", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'allow_redirects'", ",", "True", ")", "return", "request", "(", "'get'", ",", "url", ",", "params", "=", "params", ",", "*", ...
https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pip/_vendor/requests/api.py#L59-L70
ethereum/web3.py
6a90a26ea12e5a789834c9cd6a7ae6d302648f88
ethpm/package.py
python
Package.from_uri
(cls, uri: URI, w3: "Web3")
return cls(manifest, w3, uri)
Returns a Package object instantiated by a manifest located at a content-addressed URI. A valid ``Web3`` instance is also required. URI schemes supported: - IPFS: `ipfs://Qm...` - HTTP: `https://api.github.com/repos/:owner/:repo/git/blobs/:file_sha` - Registry: `erc1319://regi...
Returns a Package object instantiated by a manifest located at a content-addressed URI. A valid ``Web3`` instance is also required. URI schemes supported:
[ "Returns", "a", "Package", "object", "instantiated", "by", "a", "manifest", "located", "at", "a", "content", "-", "addressed", "URI", ".", "A", "valid", "Web3", "instance", "is", "also", "required", ".", "URI", "schemes", "supported", ":" ]
def from_uri(cls, uri: URI, w3: "Web3") -> "Package": """ Returns a Package object instantiated by a manifest located at a content-addressed URI. A valid ``Web3`` instance is also required. URI schemes supported: - IPFS: `ipfs://Qm...` - HTTP: `https://api.github.com/re...
[ "def", "from_uri", "(", "cls", ",", "uri", ":", "URI", ",", "w3", ":", "\"Web3\"", ")", "->", "\"Package\"", ":", "contents", "=", "to_text", "(", "resolve_uri_contents", "(", "uri", ")", ")", "validate_raw_manifest_format", "(", "contents", ")", "manifest",...
https://github.com/ethereum/web3.py/blob/6a90a26ea12e5a789834c9cd6a7ae6d302648f88/ethpm/package.py#L222-L241
google/active-learning
efedd8f1c45421ee13af2b9ff593ad31f3835942
utils/create_data.py
python
get_csv_data
(filename)
return data
Parse csv and return Dataset object with data and targets. Create pickle data from csv, assumes the first column contains the targets Args: filename: complete path of the csv file Returns: Dataset object
Parse csv and return Dataset object with data and targets.
[ "Parse", "csv", "and", "return", "Dataset", "object", "with", "data", "and", "targets", "." ]
def get_csv_data(filename): """Parse csv and return Dataset object with data and targets. Create pickle data from csv, assumes the first column contains the targets Args: filename: complete path of the csv file Returns: Dataset object """ f = gfile.GFile(filename, 'r') mat = [] for l in f: ...
[ "def", "get_csv_data", "(", "filename", ")", ":", "f", "=", "gfile", ".", "GFile", "(", "filename", ",", "'r'", ")", "mat", "=", "[", "]", "for", "l", "in", "f", ":", "row", "=", "l", ".", "strip", "(", ")", "row", "=", "row", ".", "replace", ...
https://github.com/google/active-learning/blob/efedd8f1c45421ee13af2b9ff593ad31f3835942/utils/create_data.py#L65-L86
sebastien/cuisine
f6f70268ef1361db66815383017f7c8969002154
src/cuisine.py
python
group_ensure_linux
(name, gid=None)
Ensures that the group with the given name (and optional gid) exists.
Ensures that the group with the given name (and optional gid) exists.
[ "Ensures", "that", "the", "group", "with", "the", "given", "name", "(", "and", "optional", "gid", ")", "exists", "." ]
def group_ensure_linux(name, gid=None): """Ensures that the group with the given name (and optional gid) exists.""" d = group_check(name) if not d: group_create(name, gid) else: if gid != None and d.get("gid") != gid: sudo("groupmod -g %s '%s'" % (gid, name))
[ "def", "group_ensure_linux", "(", "name", ",", "gid", "=", "None", ")", ":", "d", "=", "group_check", "(", "name", ")", "if", "not", "d", ":", "group_create", "(", "name", ",", "gid", ")", "else", ":", "if", "gid", "!=", "None", "and", "d", ".", ...
https://github.com/sebastien/cuisine/blob/f6f70268ef1361db66815383017f7c8969002154/src/cuisine.py#L1872-L1880
xdress/xdress
eb7f0a02b3edf617d401939ede7f0d713a88917f
xdress/_enum/__init__.py
python
_make_class_unpicklable
(cls)
Make the given class un-picklable.
Make the given class un-picklable.
[ "Make", "the", "given", "class", "un", "-", "picklable", "." ]
def _make_class_unpicklable(cls): """Make the given class un-picklable.""" def _break_on_call_reduce(self): raise TypeError('%r cannot be pickled' % self) cls.__reduce__ = _break_on_call_reduce cls.__module__ = '<unknown>'
[ "def", "_make_class_unpicklable", "(", "cls", ")", ":", "def", "_break_on_call_reduce", "(", "self", ")", ":", "raise", "TypeError", "(", "'%r cannot be pickled'", "%", "self", ")", "cls", ".", "__reduce__", "=", "_break_on_call_reduce", "cls", ".", "__module__", ...
https://github.com/xdress/xdress/blob/eb7f0a02b3edf617d401939ede7f0d713a88917f/xdress/_enum/__init__.py#L67-L72
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/controllers/threads/pool276.py
python
ApplyResult.get
(self, timeout=None)
[]
def get(self, timeout=None): self.wait(timeout) if not self._ready: raise TimeoutError if self._success: return self._value else: raise self._value
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "self", ".", "wait", "(", "timeout", ")", "if", "not", "self", ".", "_ready", ":", "raise", "TimeoutError", "if", "self", ".", "_success", ":", "return", "self", ".", "_value", "else",...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/threads/pool276.py#L671-L678
pycontribs/pyrax
a0c022981f76a4cba96a22ecc19bb52843ac4fbe
pyrax/__init__.py
python
connect_to_autoscale
(region=None)
return _create_client(ep_name="autoscale", region=region)
Creates a client for working with AutoScale.
Creates a client for working with AutoScale.
[ "Creates", "a", "client", "for", "working", "with", "AutoScale", "." ]
def connect_to_autoscale(region=None): """Creates a client for working with AutoScale.""" return _create_client(ep_name="autoscale", region=region)
[ "def", "connect_to_autoscale", "(", "region", "=", "None", ")", ":", "return", "_create_client", "(", "ep_name", "=", "\"autoscale\"", ",", "region", "=", "region", ")" ]
https://github.com/pycontribs/pyrax/blob/a0c022981f76a4cba96a22ecc19bb52843ac4fbe/pyrax/__init__.py#L813-L815
tensorly/tensorly
87b435b3f3343447b49d47ebb5461118f6c8a9ab
tensorly/random/base.py
python
random_tt
(shape, rank, full=False, random_state=None, **context)
Generates a random TT/MPS tensor Parameters ---------- shape : tuple shape of the tensor to generate rank : int rank of the TT decomposition must verify rank[0] == rank[-1] ==1 (boundary conditions) and len(rank) == len(shape)+1 full : bool, optional, default is Fals...
Generates a random TT/MPS tensor
[ "Generates", "a", "random", "TT", "/", "MPS", "tensor" ]
def random_tt(shape, rank, full=False, random_state=None, **context): """Generates a random TT/MPS tensor Parameters ---------- shape : tuple shape of the tensor to generate rank : int rank of the TT decomposition must verify rank[0] == rank[-1] ==1 (boundary conditions) ...
[ "def", "random_tt", "(", "shape", ",", "rank", ",", "full", "=", "False", ",", "random_state", "=", "None", ",", "*", "*", "context", ")", ":", "n_dim", "=", "len", "(", "shape", ")", "rank", "=", "validate_tt_rank", "(", "shape", ",", "rank", ")", ...
https://github.com/tensorly/tensorly/blob/87b435b3f3343447b49d47ebb5461118f6c8a9ab/tensorly/random/base.py#L153-L199
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/ogl/basic.py
python
ShapeRegion.SetProportions
(self, xp, yp)
Set the proportions. :param `xp`: the x region proportion :Param `yp`: the y region proportion
Set the proportions.
[ "Set", "the", "proportions", "." ]
def SetProportions(self, xp, yp): """ Set the proportions. :param `xp`: the x region proportion :Param `yp`: the y region proportion """ self._regionProportionX = xp self._regionProportionY = yp
[ "def", "SetProportions", "(", "self", ",", "xp", ",", "yp", ")", ":", "self", ".", "_regionProportionX", "=", "xp", "self", ".", "_regionProportionY", "=", "yp" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/ogl/basic.py#L3679-L3688
flairNLP/flair
b774774752c8338aab3d620f7e5062f66ec7a69d
flair/datasets/biomedical.py
python
Entity.overlaps
(self, other_entity)
return (self.char_span.start <= other_entity.char_span.start < self.char_span.stop) or ( self.char_span.start < other_entity.char_span.stop <= self.char_span.stop )
Checks whether this and the given entity overlap :param other_entity: Entity to check
Checks whether this and the given entity overlap
[ "Checks", "whether", "this", "and", "the", "given", "entity", "overlap" ]
def overlaps(self, other_entity) -> bool: """ Checks whether this and the given entity overlap :param other_entity: Entity to check """ return (self.char_span.start <= other_entity.char_span.start < self.char_span.stop) or ( self.char_span.start < other_entity.char_s...
[ "def", "overlaps", "(", "self", ",", "other_entity", ")", "->", "bool", ":", "return", "(", "self", ".", "char_span", ".", "start", "<=", "other_entity", ".", "char_span", ".", "start", "<", "self", ".", "char_span", ".", "stop", ")", "or", "(", "self"...
https://github.com/flairNLP/flair/blob/b774774752c8338aab3d620f7e5062f66ec7a69d/flair/datasets/biomedical.py#L81-L89
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/polynomial/legendre.py
python
legsub
(c1, c2)
return pu.trimseq(ret)
Subtract one Legendre series from another. Returns the difference of two Legendre series `c1` - `c2`. The sequences of coefficients are from lowest order term to highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays ...
Subtract one Legendre series from another.
[ "Subtract", "one", "Legendre", "series", "from", "another", "." ]
def legsub(c1, c2): """ Subtract one Legendre series from another. Returns the difference of two Legendre series `c1` - `c2`. The sequences of coefficients are from lowest order term to highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 ...
[ "def", "legsub", "(", "c1", ",", "c2", ")", ":", "# c1, c2 are trimmed copies", "[", "c1", ",", "c2", "]", "=", "pu", ".", "as_series", "(", "[", "c1", ",", "c2", "]", ")", "if", "len", "(", "c1", ")", ">", "len", "(", "c2", ")", ":", "c1", "...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/polynomial/legendre.py#L383-L433
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/mac_portspkg.py
python
install
(name=None, refresh=False, pkgs=None, **kwargs)
return ret
Install the passed package(s) with ``port install`` name The name of the formula to be installed. Note that this parameter is ignored if "pkgs" is passed. CLI Example: .. code-block:: bash salt '*' pkg.install <package name> version Specify a version to p...
Install the passed package(s) with ``port install``
[ "Install", "the", "passed", "package", "(", "s", ")", "with", "port", "install" ]
def install(name=None, refresh=False, pkgs=None, **kwargs): """ Install the passed package(s) with ``port install`` name The name of the formula to be installed. Note that this parameter is ignored if "pkgs" is passed. CLI Example: .. code-block:: bash salt '*...
[ "def", "install", "(", "name", "=", "None", ",", "refresh", "=", "False", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "pkg_params", ",", "pkg_type", "=", "__salt__", "[", "\"pkg_resource.parse_targets\"", "]", "(", "name", ",", "pkgs", ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/mac_portspkg.py#L247-L359
dmnfarrell/pandastable
9c268b3e2bfe2e718eaee4a30bd02832a0ad1614
pandastable/plugins/rename.py
python
BatchRenamePlugin.refresh
(self)
return
Load files list
Load files list
[ "Load", "files", "list" ]
def refresh(self): """Load files list""" self.fileslist.delete('1.0',END) fp = self.patternvar.get() flist = glob.glob(os.path.join(self.path,fp)) filestr = '\n'.join(flist) self.fileslist.insert(END, filestr) return
[ "def", "refresh", "(", "self", ")", ":", "self", ".", "fileslist", ".", "delete", "(", "'1.0'", ",", "END", ")", "fp", "=", "self", ".", "patternvar", ".", "get", "(", ")", "flist", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", ...
https://github.com/dmnfarrell/pandastable/blob/9c268b3e2bfe2e718eaee4a30bd02832a0ad1614/pandastable/plugins/rename.py#L126-L134
tensorflow/transform
bc5c3da6aebe9c8780da806e7e8103959c242863
tensorflow_transform/impl_helper.py
python
make_tensor_to_arrow_converter
( schema: schema_pb2.Schema)
return tensor_to_arrow.TensorsToRecordBatchConverter(type_specs)
Constructs a `tf.Tensor` to `pa.RecordBatch` converter.
Constructs a `tf.Tensor` to `pa.RecordBatch` converter.
[ "Constructs", "a", "tf", ".", "Tensor", "to", "pa", ".", "RecordBatch", "converter", "." ]
def make_tensor_to_arrow_converter( schema: schema_pb2.Schema) -> tensor_to_arrow.TensorsToRecordBatchConverter: """Constructs a `tf.Tensor` to `pa.RecordBatch` converter.""" feature_specs = schema_utils.schema_as_feature_spec(schema).feature_spec type_specs = get_type_specs_from_feature_specs(feature_specs) ...
[ "def", "make_tensor_to_arrow_converter", "(", "schema", ":", "schema_pb2", ".", "Schema", ")", "->", "tensor_to_arrow", ".", "TensorsToRecordBatchConverter", ":", "feature_specs", "=", "schema_utils", ".", "schema_as_feature_spec", "(", "schema", ")", ".", "feature_spec...
https://github.com/tensorflow/transform/blob/bc5c3da6aebe9c8780da806e7e8103959c242863/tensorflow_transform/impl_helper.py#L550-L555
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/distutils/cygwinccompiler.py
python
get_versions
()
return tuple([_find_exe_version(cmd) for cmd in commands])
Try to find out the versions of gcc, ld and dllwrap. If not possible it returns None for it.
Try to find out the versions of gcc, ld and dllwrap.
[ "Try", "to", "find", "out", "the", "versions", "of", "gcc", "ld", "and", "dllwrap", "." ]
def get_versions(): """ Try to find out the versions of gcc, ld and dllwrap. If not possible it returns None for it. """ commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] return tuple([_find_exe_version(cmd) for cmd in commands])
[ "def", "get_versions", "(", ")", ":", "commands", "=", "[", "'gcc -dumpversion'", ",", "'ld -v'", ",", "'dllwrap --version'", "]", "return", "tuple", "(", "[", "_find_exe_version", "(", "cmd", ")", "for", "cmd", "in", "commands", "]", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/distutils/cygwinccompiler.py#L394-L400
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
NLP/ACL2020-GraphSum/src/networks/graphsum/run_graphsum.py
python
evaluate
(args, exe, program, pyreader, graph_vars, eval_phase, vocab_size, do_dec=False, vocab_path=None, features=None, decode_path="")
Obtain model loss or decoding output
Obtain model loss or decoding output
[ "Obtain", "model", "loss", "or", "decoding", "output" ]
def evaluate(args, exe, program, pyreader, graph_vars, eval_phase, vocab_size, do_dec=False, vocab_path=None, features=None, decode_path=""): """Obtain model loss or decoding output""" if args.label_smooth_eps: # the best cross-entropy value with label smoothing loss_normalizer = -...
[ "def", "evaluate", "(", "args", ",", "exe", ",", "program", ",", "pyreader", ",", "graph_vars", ",", "eval_phase", ",", "vocab_size", ",", "do_dec", "=", "False", ",", "vocab_path", "=", "None", ",", "features", "=", "None", ",", "decode_path", "=", "\"\...
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/NLP/ACL2020-GraphSum/src/networks/graphsum/run_graphsum.py#L453-L641
magicalraccoon/tootstream
6dd84fc3767ef25df645a599cb632ad3745744df
src/tootstream/toot.py
python
unmute
(mastodon, rest)
Unmutes a user by username or id. ex: unmute 23 unmute @user unmute @user@instance.example.com
Unmutes a user by username or id.
[ "Unmutes", "a", "user", "by", "username", "or", "id", "." ]
def unmute(mastodon, rest): """Unmutes a user by username or id. ex: unmute 23 unmute @user unmute @user@instance.example.com""" userid = get_userid(mastodon, rest) if isinstance(userid, list): cprint(" multiple matches found:", fg('red')) printUsersShort(userid) el...
[ "def", "unmute", "(", "mastodon", ",", "rest", ")", ":", "userid", "=", "get_userid", "(", "mastodon", ",", "rest", ")", "if", "isinstance", "(", "userid", ",", "list", ")", ":", "cprint", "(", "\" multiple matches found:\"", ",", "fg", "(", "'red'", ")...
https://github.com/magicalraccoon/tootstream/blob/6dd84fc3767ef25df645a599cb632ad3745744df/src/tootstream/toot.py#L1737-L1755
JacquesLucke/animation_nodes
b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1
animation_nodes/id_keys/data_types/transforms_type.py
python
TransformDataType.iterSubpropertyPaths
(cls, name)
[]
def iterSubpropertyPaths(cls, name): yield '["AN*Transforms*Location*%s"]' % name yield '["AN*Transforms*Rotation*%s"]' % name yield '["AN*Transforms*Scale*%s"]' % name
[ "def", "iterSubpropertyPaths", "(", "cls", ",", "name", ")", ":", "yield", "'[\"AN*Transforms*Location*%s\"]'", "%", "name", "yield", "'[\"AN*Transforms*Rotation*%s\"]'", "%", "name", "yield", "'[\"AN*Transforms*Scale*%s\"]'", "%", "name" ]
https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/id_keys/data_types/transforms_type.py#L109-L112
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/platforms/visual_pinball_engine/visual_pinball_engine.py
python
VisualPinballEnginePlatform.send_command
(self, command)
Send command to VPE.
Send command to VPE.
[ "Send", "command", "to", "VPE", "." ]
def send_command(self, command): """Send command to VPE.""" self.platform_rpc.send_command(command)
[ "def", "send_command", "(", "self", ",", "command", ")", ":", "self", ".", "platform_rpc", ".", "send_command", "(", "command", ")" ]
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/visual_pinball_engine/visual_pinball_engine.py#L303-L305
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
ST_DM/KDD2021-MSTPAC/code/MST-PAC/frame/core/gpu_trainer.py
python
GPUTrainer.set_optimizer
(self, FLAGS, net_output)
return optimizer.minimize(net_output['loss'])
set optimizer
set optimizer
[ "set", "optimizer" ]
def set_optimizer(self, FLAGS, net_output): """ set optimizer """ optimizer = net_output['optimizer'] if self.is_multi_gpu(FLAGS): trainer_id = int(os.getenv("PADDLE_TRAINER_ID")) num_trainers = int(os.getenv("PADDLE_TRAINERS_NUM")) trainer_end...
[ "def", "set_optimizer", "(", "self", ",", "FLAGS", ",", "net_output", ")", ":", "optimizer", "=", "net_output", "[", "'optimizer'", "]", "if", "self", ".", "is_multi_gpu", "(", "FLAGS", ")", ":", "trainer_id", "=", "int", "(", "os", ".", "getenv", "(", ...
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/ST_DM/KDD2021-MSTPAC/code/MST-PAC/frame/core/gpu_trainer.py#L43-L78
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/dev/bdf_vectorized/cards/aero/aero_cards.py
python
FLFACT.add_card
(cls, card, comment='')
return FLFACT(sid, factors, comment=comment)
Adds an FLFACT card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card
Adds an FLFACT card from ``BDF.add_card(...)``
[ "Adds", "an", "FLFACT", "card", "from", "BDF", ".", "add_card", "(", "...", ")" ]
def add_card(cls, card, comment=''): """ Adds an FLFACT card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') ...
[ "def", "add_card", "(", "cls", ",", "card", ",", "comment", "=", "''", ")", ":", "sid", "=", "integer", "(", "card", ",", "1", ",", "'sid'", ")", "assert", "len", "(", "card", ")", ">", "2", ",", "'len(FLFACT card)=%s; card=%s'", "%", "(", "len", "...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized/cards/aero/aero_cards.py#L3308-L3338