repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
onnx/onnx-mxnet
onnx_mxnet/import_onnx.py
GraphProto._fix_bias_shape
def _fix_bias_shape(self, op_name, inputs, attrs): """A workaround to reshape bias term to (1, num_channel).""" if (op_name == 'Add' or op_name == 'Mul') and (int(len(self._params)) > 0) and \ ('broadcast' in attrs and attrs['broadcast'] == 1): assert len(list(inputs)) == 2 ...
python
def _fix_bias_shape(self, op_name, inputs, attrs): """A workaround to reshape bias term to (1, num_channel).""" if (op_name == 'Add' or op_name == 'Mul') and (int(len(self._params)) > 0) and \ ('broadcast' in attrs and attrs['broadcast'] == 1): assert len(list(inputs)) == 2 ...
[ "def", "_fix_bias_shape", "(", "self", ",", "op_name", ",", "inputs", ",", "attrs", ")", ":", "if", "(", "op_name", "==", "'Add'", "or", "op_name", "==", "'Mul'", ")", "and", "(", "int", "(", "len", "(", "self", ".", "_params", ")", ")", ">", "0", ...
A workaround to reshape bias term to (1, num_channel).
[ "A", "workaround", "to", "reshape", "bias", "term", "to", "(", "1", "num_channel", ")", "." ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L287-L299
onnx/onnx-mxnet
onnx_mxnet/import_onnx.py
GraphProto._fix_channels
def _fix_channels(self, op, attrs, inputs): """A workaround for getting 'channels' or 'units' since onnx don't provide these attributes. We check the shape of weights provided to get the number. """ if op not in [mx.sym.Convolution, mx.sym.Deconvolution, mx.sym.FullyConnected]: ...
python
def _fix_channels(self, op, attrs, inputs): """A workaround for getting 'channels' or 'units' since onnx don't provide these attributes. We check the shape of weights provided to get the number. """ if op not in [mx.sym.Convolution, mx.sym.Deconvolution, mx.sym.FullyConnected]: ...
[ "def", "_fix_channels", "(", "self", ",", "op", ",", "attrs", ",", "inputs", ")", ":", "if", "op", "not", "in", "[", "mx", ".", "sym", ".", "Convolution", ",", "mx", ".", "sym", ".", "Deconvolution", ",", "mx", ".", "sym", ".", "FullyConnected", "]...
A workaround for getting 'channels' or 'units' since onnx don't provide these attributes. We check the shape of weights provided to get the number.
[ "A", "workaround", "for", "getting", "channels", "or", "units", "since", "onnx", "don", "t", "provide", "these", "attributes", ".", "We", "check", "the", "shape", "of", "weights", "provided", "to", "get", "the", "number", "." ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L302-L326
onnx/onnx-mxnet
onnx_mxnet/backend_rep.py
MXNetBackendRep.run
def run(self, inputs, **kwargs): """Run model inference and return the result Parameters ---------- inputs : numpy array input to run a layer on Returns ------- params : numpy array result obtained after running the inference on mxnet ...
python
def run(self, inputs, **kwargs): """Run model inference and return the result Parameters ---------- inputs : numpy array input to run a layer on Returns ------- params : numpy array result obtained after running the inference on mxnet ...
[ "def", "run", "(", "self", ",", "inputs", ",", "*", "*", "kwargs", ")", ":", "input_data", "=", "np", ".", "asarray", "(", "inputs", "[", "0", "]", ",", "dtype", "=", "'f'", ")", "# create module, passing cpu context", "if", "self", ".", "device", "=="...
Run model inference and return the result Parameters ---------- inputs : numpy array input to run a layer on Returns ------- params : numpy array result obtained after running the inference on mxnet
[ "Run", "model", "inference", "and", "return", "the", "result" ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/backend_rep.py#L36-L68
onnx/onnx-mxnet
onnx_mxnet/common.py
AttributeConverter._parse_default
def _parse_default(self, target): """Helper function to parse default values.""" if not isinstance(target, (list, tuple)): k, v, t = target, None, lambda x: x elif len(target) == 1: k, v, t = target[0], None, lambda x: x elif len(target) == 2: k, v, t ...
python
def _parse_default(self, target): """Helper function to parse default values.""" if not isinstance(target, (list, tuple)): k, v, t = target, None, lambda x: x elif len(target) == 1: k, v, t = target[0], None, lambda x: x elif len(target) == 2: k, v, t ...
[ "def", "_parse_default", "(", "self", ",", "target", ")", ":", "if", "not", "isinstance", "(", "target", ",", "(", "list", ",", "tuple", ")", ")", ":", "k", ",", "v", ",", "t", "=", "target", ",", "None", ",", "lambda", "x", ":", "x", "elif", "...
Helper function to parse default values.
[ "Helper", "function", "to", "parse", "default", "values", "." ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/common.py#L114-L129
onnx/onnx-mxnet
onnx_mxnet/common.py
AttributeConverter._parse_bool
def _parse_bool(self, value): """Helper function to parse default boolean values.""" if isinstance(value, string_types): return value.strip().lower() in ['true', '1', 't', 'y', 'yes'] return bool(value)
python
def _parse_bool(self, value): """Helper function to parse default boolean values.""" if isinstance(value, string_types): return value.strip().lower() in ['true', '1', 't', 'y', 'yes'] return bool(value)
[ "def", "_parse_bool", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "string_types", ")", ":", "return", "value", ".", "strip", "(", ")", ".", "lower", "(", ")", "in", "[", "'true'", ",", "'1'", ",", "'t'", ",", "'y'", ...
Helper function to parse default boolean values.
[ "Helper", "function", "to", "parse", "default", "boolean", "values", "." ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/common.py#L131-L135
onnx/onnx-mxnet
onnx_mxnet/common.py
AttributeConverter._required_attr
def _required_attr(self, attr, key): """Wrapper for getting required attributes.""" assert isinstance(attr, dict) if key not in attr: raise AttributeError("Required attribute {} not found.".format(key)) return attr[key]
python
def _required_attr(self, attr, key): """Wrapper for getting required attributes.""" assert isinstance(attr, dict) if key not in attr: raise AttributeError("Required attribute {} not found.".format(key)) return attr[key]
[ "def", "_required_attr", "(", "self", ",", "attr", ",", "key", ")", ":", "assert", "isinstance", "(", "attr", ",", "dict", ")", "if", "key", "not", "in", "attr", ":", "raise", "AttributeError", "(", "\"Required attribute {} not found.\"", ".", "format", "(",...
Wrapper for getting required attributes.
[ "Wrapper", "for", "getting", "required", "attributes", "." ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/common.py#L137-L142
onnx/onnx-mxnet
onnx_mxnet/backend.py
MXNetBackend.make_graph
def make_graph(node, inputs): """ Created ONNX GraphProto from node""" initializer = [] tensor_input_info = [] tensor_output_info = [] # Adding input tensor info. for index in range(len(node.input)): tensor_input_info.append( helper.make_tenso...
python
def make_graph(node, inputs): """ Created ONNX GraphProto from node""" initializer = [] tensor_input_info = [] tensor_output_info = [] # Adding input tensor info. for index in range(len(node.input)): tensor_input_info.append( helper.make_tenso...
[ "def", "make_graph", "(", "node", ",", "inputs", ")", ":", "initializer", "=", "[", "]", "tensor_input_info", "=", "[", "]", "tensor_output_info", "=", "[", "]", "# Adding input tensor info.", "for", "index", "in", "range", "(", "len", "(", "node", ".", "i...
Created ONNX GraphProto from node
[ "Created", "ONNX", "GraphProto", "from", "node" ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/backend.py#L30-L68
onnx/onnx-mxnet
onnx_mxnet/backend.py
MXNetBackend.run_node
def run_node(cls, node, inputs, device='CPU'): # pylint: disable=arguments-differ """Running individual node inference on mxnet engine and return the result to onnx test infrastructure. Parameters ---------- node : onnx node object loaded onnx node (individual lay...
python
def run_node(cls, node, inputs, device='CPU'): # pylint: disable=arguments-differ """Running individual node inference on mxnet engine and return the result to onnx test infrastructure. Parameters ---------- node : onnx node object loaded onnx node (individual lay...
[ "def", "run_node", "(", "cls", ",", "node", ",", "inputs", ",", "device", "=", "'CPU'", ")", ":", "# pylint: disable=arguments-differ", "graph", "=", "GraphProto", "(", ")", "sym", ",", "_", "=", "graph", ".", "from_onnx", "(", "MXNetBackend", ".", "make_g...
Running individual node inference on mxnet engine and return the result to onnx test infrastructure. Parameters ---------- node : onnx node object loaded onnx node (individual layer) inputs : numpy array input to run a node on device : 'CPU' ...
[ "Running", "individual", "node", "inference", "on", "mxnet", "engine", "and", "return", "the", "result", "to", "onnx", "test", "infrastructure", "." ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/backend.py#L72-L137
onnx/onnx-mxnet
onnx_mxnet/backend.py
MXNetBackend.prepare
def prepare(cls, model, device='CPU', **kwargs): """For running end to end model(used for onnx test backend) Parameters ---------- model : onnx ModelProto object loaded onnx graph device : 'CPU' specifying device to run test on kwargs : ...
python
def prepare(cls, model, device='CPU', **kwargs): """For running end to end model(used for onnx test backend) Parameters ---------- model : onnx ModelProto object loaded onnx graph device : 'CPU' specifying device to run test on kwargs : ...
[ "def", "prepare", "(", "cls", ",", "model", ",", "device", "=", "'CPU'", ",", "*", "*", "kwargs", ")", ":", "graph", "=", "GraphProto", "(", ")", "sym", ",", "params", "=", "graph", ".", "from_onnx", "(", "model", ".", "graph", ")", "return", "MXNe...
For running end to end model(used for onnx test backend) Parameters ---------- model : onnx ModelProto object loaded onnx graph device : 'CPU' specifying device to run test on kwargs : other arguments Returns ------- ...
[ "For", "running", "end", "to", "end", "model", "(", "used", "for", "onnx", "test", "backend", ")" ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/backend.py#L140-L160
onnx/onnx-mxnet
onnx_mxnet/import_helper.py
_revert_caffe2_pad
def _revert_caffe2_pad(attr): """Removing extra padding from Caffe2.""" if len(attr) == 4: attr = attr[:2] elif len(attr) == 2: pass else: raise ValueError("Invalid caffe2 type padding: {}".format(attr)) return attr
python
def _revert_caffe2_pad(attr): """Removing extra padding from Caffe2.""" if len(attr) == 4: attr = attr[:2] elif len(attr) == 2: pass else: raise ValueError("Invalid caffe2 type padding: {}".format(attr)) return attr
[ "def", "_revert_caffe2_pad", "(", "attr", ")", ":", "if", "len", "(", "attr", ")", "==", "4", ":", "attr", "=", "attr", "[", ":", "2", "]", "elif", "len", "(", "attr", ")", "==", "2", ":", "pass", "else", ":", "raise", "ValueError", "(", "\"Inval...
Removing extra padding from Caffe2.
[ "Removing", "extra", "padding", "from", "Caffe2", "." ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_helper.py#L19-L27
onnx/onnx-mxnet
onnx_mxnet/import_helper.py
_pad_sequence_fix
def _pad_sequence_fix(attr, kernelDim=None): """Changing onnx's pads sequence to match with mxnet's pad_width mxnet: (x1_begin, x1_end, ... , xn_begin, xn_end) onnx: (x1_begin, x2_begin, ... , xn_end, xn_end)""" new_attr = () if len(attr) % 2 == 0: for index in range(int(len(attr) / 2)): ...
python
def _pad_sequence_fix(attr, kernelDim=None): """Changing onnx's pads sequence to match with mxnet's pad_width mxnet: (x1_begin, x1_end, ... , xn_begin, xn_end) onnx: (x1_begin, x2_begin, ... , xn_end, xn_end)""" new_attr = () if len(attr) % 2 == 0: for index in range(int(len(attr) / 2)): ...
[ "def", "_pad_sequence_fix", "(", "attr", ",", "kernelDim", "=", "None", ")", ":", "new_attr", "=", "(", ")", "if", "len", "(", "attr", ")", "%", "2", "==", "0", ":", "for", "index", "in", "range", "(", "int", "(", "len", "(", "attr", ")", "/", ...
Changing onnx's pads sequence to match with mxnet's pad_width mxnet: (x1_begin, x1_end, ... , xn_begin, xn_end) onnx: (x1_begin, x2_begin, ... , xn_end, xn_end)
[ "Changing", "onnx", "s", "pads", "sequence", "to", "match", "with", "mxnet", "s", "pad_width", "mxnet", ":", "(", "x1_begin", "x1_end", "...", "xn_begin", "xn_end", ")", "onnx", ":", "(", "x1_begin", "x2_begin", "...", "xn_end", "xn_end", ")" ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_helper.py#L111-L124
onnx/onnx-mxnet
onnx_mxnet/__init__.py
import_model
def import_model(model_file): """Imports the supplied ONNX model file into MXNet symbol and parameters. Parameters ---------- model_file : ONNX model file name Returns ------- sym : mx.symbol Compatible mxnet symbol params : dict of str to mx.ndarray Dict of converted ...
python
def import_model(model_file): """Imports the supplied ONNX model file into MXNet symbol and parameters. Parameters ---------- model_file : ONNX model file name Returns ------- sym : mx.symbol Compatible mxnet symbol params : dict of str to mx.ndarray Dict of converted ...
[ "def", "import_model", "(", "model_file", ")", ":", "graph", "=", "GraphProto", "(", ")", "# loads model file and returns ONNX protobuf object", "model_proto", "=", "onnx", ".", "load", "(", "model_file", ")", "sym", ",", "params", "=", "graph", ".", "from_onnx", ...
Imports the supplied ONNX model file into MXNet symbol and parameters. Parameters ---------- model_file : ONNX model file name Returns ------- sym : mx.symbol Compatible mxnet symbol params : dict of str to mx.ndarray Dict of converted parameters stored in mx.ndarray forma...
[ "Imports", "the", "supplied", "ONNX", "model", "file", "into", "MXNet", "symbol", "and", "parameters", "." ]
train
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/__init__.py#L16-L36
chrissimpkins/crypto
lib/crypto/library/hash.py
generate_hash
def generate_hash(filepath): """Public function that reads a local file and generates a SHA256 hash digest for it""" fr = FileReader(filepath) data = fr.read_bin() return _calculate_sha256(data)
python
def generate_hash(filepath): """Public function that reads a local file and generates a SHA256 hash digest for it""" fr = FileReader(filepath) data = fr.read_bin() return _calculate_sha256(data)
[ "def", "generate_hash", "(", "filepath", ")", ":", "fr", "=", "FileReader", "(", "filepath", ")", "data", "=", "fr", ".", "read_bin", "(", ")", "return", "_calculate_sha256", "(", "data", ")" ]
Public function that reads a local file and generates a SHA256 hash digest for it
[ "Public", "function", "that", "reads", "a", "local", "file", "and", "generates", "a", "SHA256", "hash", "digest", "for", "it" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/hash.py#L10-L14
chrissimpkins/crypto
lib/crypto/library/package.py
generate_tar_files
def generate_tar_files(directory_list): """Public function that reads a list of local directories and generates tar archives from them""" tar_file_list = [] for directory in directory_list: if dir_exists(directory): _generate_tar(directory) # create the tar archive...
python
def generate_tar_files(directory_list): """Public function that reads a list of local directories and generates tar archives from them""" tar_file_list = [] for directory in directory_list: if dir_exists(directory): _generate_tar(directory) # create the tar archive...
[ "def", "generate_tar_files", "(", "directory_list", ")", ":", "tar_file_list", "=", "[", "]", "for", "directory", "in", "directory_list", ":", "if", "dir_exists", "(", "directory", ")", ":", "_generate_tar", "(", "directory", ")", "# create the tar archive", "tar_...
Public function that reads a list of local directories and generates tar archives from them
[ "Public", "function", "that", "reads", "a", "list", "of", "local", "directories", "and", "generates", "tar", "archives", "from", "them" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/package.py#L13-L25
chrissimpkins/crypto
lib/crypto/library/package.py
remove_tar_files
def remove_tar_files(file_list): """Public function that removes temporary tar archive files in a local directory""" for f in file_list: if file_exists(f) and f.endswith('.tar'): os.remove(f)
python
def remove_tar_files(file_list): """Public function that removes temporary tar archive files in a local directory""" for f in file_list: if file_exists(f) and f.endswith('.tar'): os.remove(f)
[ "def", "remove_tar_files", "(", "file_list", ")", ":", "for", "f", "in", "file_list", ":", "if", "file_exists", "(", "f", ")", "and", "f", ".", "endswith", "(", "'.tar'", ")", ":", "os", ".", "remove", "(", "f", ")" ]
Public function that removes temporary tar archive files in a local directory
[ "Public", "function", "that", "removes", "temporary", "tar", "archive", "files", "in", "a", "local", "directory" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/package.py#L28-L32
chrissimpkins/crypto
lib/crypto/library/package.py
_generate_tar
def _generate_tar(dir_path): """Private function that reads a local directory and generates a tar archive from it""" try: with tarfile.open(dir_path + '.tar', 'w') as tar: tar.add(dir_path) except tarfile.TarError as e: stderr("Error: tar archive creation failed [" + str(e) + "]"...
python
def _generate_tar(dir_path): """Private function that reads a local directory and generates a tar archive from it""" try: with tarfile.open(dir_path + '.tar', 'w') as tar: tar.add(dir_path) except tarfile.TarError as e: stderr("Error: tar archive creation failed [" + str(e) + "]"...
[ "def", "_generate_tar", "(", "dir_path", ")", ":", "try", ":", "with", "tarfile", ".", "open", "(", "dir_path", "+", "'.tar'", ",", "'w'", ")", "as", "tar", ":", "tar", ".", "add", "(", "dir_path", ")", "except", "tarfile", ".", "TarError", "as", "e"...
Private function that reads a local directory and generates a tar archive from it
[ "Private", "function", "that", "reads", "a", "local", "directory", "and", "generates", "a", "tar", "archive", "from", "it" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/package.py#L39-L45
chrissimpkins/crypto
lib/crypto/library/cryptor.py
Cryptor.encrypt_file
def encrypt_file(self, inpath, force_nocompress=False, force_compress=False, armored=False, checksum=False): """public method for single file encryption with optional compression, ASCII armored formatting, and file hash digest generation""" if armored: if force_compress: comm...
python
def encrypt_file(self, inpath, force_nocompress=False, force_compress=False, armored=False, checksum=False): """public method for single file encryption with optional compression, ASCII armored formatting, and file hash digest generation""" if armored: if force_compress: comm...
[ "def", "encrypt_file", "(", "self", ",", "inpath", ",", "force_nocompress", "=", "False", ",", "force_compress", "=", "False", ",", "armored", "=", "False", ",", "checksum", "=", "False", ")", ":", "if", "armored", ":", "if", "force_compress", ":", "comman...
public method for single file encryption with optional compression, ASCII armored formatting, and file hash digest generation
[ "public", "method", "for", "single", "file", "encryption", "with", "optional", "compression", "ASCII", "armored", "formatting", "and", "file", "hash", "digest", "generation" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L36-L81
chrissimpkins/crypto
lib/crypto/library/cryptor.py
Cryptor.encrypt_files
def encrypt_files(self, file_list, force_nocompress=False, force_compress=False, armored=False, checksum=False): """public method for multiple file encryption with optional compression, ASCII armored formatting, and file hash digest generation""" for the_file in file_list: self.encrypt_file(...
python
def encrypt_files(self, file_list, force_nocompress=False, force_compress=False, armored=False, checksum=False): """public method for multiple file encryption with optional compression, ASCII armored formatting, and file hash digest generation""" for the_file in file_list: self.encrypt_file(...
[ "def", "encrypt_files", "(", "self", ",", "file_list", ",", "force_nocompress", "=", "False", ",", "force_compress", "=", "False", ",", "armored", "=", "False", ",", "checksum", "=", "False", ")", ":", "for", "the_file", "in", "file_list", ":", "self", "."...
public method for multiple file encryption with optional compression, ASCII armored formatting, and file hash digest generation
[ "public", "method", "for", "multiple", "file", "encryption", "with", "optional", "compression", "ASCII", "armored", "formatting", "and", "file", "hash", "digest", "generation" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L86-L89
chrissimpkins/crypto
lib/crypto/library/cryptor.py
Cryptor._is_compress_filetype
def _is_compress_filetype(self, inpath): """private method that performs magic number and size check on file to determine whether to compress the file""" # check for common file type suffixes in order to avoid the need for file reads to check magic number for binary vs. text file if self._is_com...
python
def _is_compress_filetype(self, inpath): """private method that performs magic number and size check on file to determine whether to compress the file""" # check for common file type suffixes in order to avoid the need for file reads to check magic number for binary vs. text file if self._is_com...
[ "def", "_is_compress_filetype", "(", "self", ",", "inpath", ")", ":", "# check for common file type suffixes in order to avoid the need for file reads to check magic number for binary vs. text file", "if", "self", ".", "_is_common_binary", "(", "inpath", ")", ":", "return", "Fals...
private method that performs magic number and size check on file to determine whether to compress the file
[ "private", "method", "that", "performs", "magic", "number", "and", "size", "check", "on", "file", "to", "determine", "whether", "to", "compress", "the", "file" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L106-L130
chrissimpkins/crypto
lib/crypto/library/cryptor.py
Cryptor._is_common_binary
def _is_common_binary(self, inpath): """private method to compare file path mime type to common binary file types""" # make local variables for the available char numbers in the suffix types to be tested two_suffix = inpath[-3:] three_suffix = inpath[-4:] four_suffix = inpath[-5:...
python
def _is_common_binary(self, inpath): """private method to compare file path mime type to common binary file types""" # make local variables for the available char numbers in the suffix types to be tested two_suffix = inpath[-3:] three_suffix = inpath[-4:] four_suffix = inpath[-5:...
[ "def", "_is_common_binary", "(", "self", ",", "inpath", ")", ":", "# make local variables for the available char numbers in the suffix types to be tested", "two_suffix", "=", "inpath", "[", "-", "3", ":", "]", "three_suffix", "=", "inpath", "[", "-", "4", ":", "]", ...
private method to compare file path mime type to common binary file types
[ "private", "method", "to", "compare", "file", "path", "mime", "type", "to", "common", "binary", "file", "types" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L132-L147
chrissimpkins/crypto
lib/crypto/library/cryptor.py
Cryptor._is_common_text
def _is_common_text(self, inpath): """private method to compare file path mime type to common text file types""" # make local variables for the available char numbers in the suffix types to be tested one_suffix = inpath[-2:] two_suffix = inpath[-3:] three_suffix = inpath[-4:] ...
python
def _is_common_text(self, inpath): """private method to compare file path mime type to common text file types""" # make local variables for the available char numbers in the suffix types to be tested one_suffix = inpath[-2:] two_suffix = inpath[-3:] three_suffix = inpath[-4:] ...
[ "def", "_is_common_text", "(", "self", ",", "inpath", ")", ":", "# make local variables for the available char numbers in the suffix types to be tested", "one_suffix", "=", "inpath", "[", "-", "2", ":", "]", "two_suffix", "=", "inpath", "[", "-", "3", ":", "]", "thr...
private method to compare file path mime type to common text file types
[ "private", "method", "to", "compare", "file", "path", "mime", "type", "to", "common", "text", "file", "types" ]
train
https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L149-L167
iskandr/knnimpute
knnimpute/few_observed_entries.py
knn_impute_few_observed
def knn_impute_few_observed( X, missing_mask, k, verbose=False, print_interval=100): """ Seems to be the fastest kNN implementation. Pre-sorts each rows neighbors and then filters these sorted indices using each columns mask of observed values. Important detail: If k observed values are not...
python
def knn_impute_few_observed( X, missing_mask, k, verbose=False, print_interval=100): """ Seems to be the fastest kNN implementation. Pre-sorts each rows neighbors and then filters these sorted indices using each columns mask of observed values. Important detail: If k observed values are not...
[ "def", "knn_impute_few_observed", "(", "X", ",", "missing_mask", ",", "k", ",", "verbose", "=", "False", ",", "print_interval", "=", "100", ")", ":", "start_t", "=", "time", ".", "time", "(", ")", "n_rows", ",", "n_cols", "=", "X", ".", "shape", "# put...
Seems to be the fastest kNN implementation. Pre-sorts each rows neighbors and then filters these sorted indices using each columns mask of observed values. Important detail: If k observed values are not available then uses fewer than k neighboring rows. Parameters ---------- X : np.ndarray...
[ "Seems", "to", "be", "the", "fastest", "kNN", "implementation", ".", "Pre", "-", "sorts", "each", "rows", "neighbors", "and", "then", "filters", "these", "sorted", "indices", "using", "each", "columns", "mask", "of", "observed", "values", "." ]
train
https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/few_observed_entries.py#L21-L90
iskandr/knnimpute
knnimpute/common.py
knn_initialize
def knn_initialize( X, missing_mask, verbose=False, min_dist=1e-6, max_dist_multiplier=1e6): """ Fill X with NaN values if necessary, construct the n_samples x n_samples distance matrix and set the self-distance of each row to infinity. Returns contents of X laid...
python
def knn_initialize( X, missing_mask, verbose=False, min_dist=1e-6, max_dist_multiplier=1e6): """ Fill X with NaN values if necessary, construct the n_samples x n_samples distance matrix and set the self-distance of each row to infinity. Returns contents of X laid...
[ "def", "knn_initialize", "(", "X", ",", "missing_mask", ",", "verbose", "=", "False", ",", "min_dist", "=", "1e-6", ",", "max_dist_multiplier", "=", "1e6", ")", ":", "X_row_major", "=", "X", ".", "copy", "(", "\"C\"", ")", "if", "missing_mask", ".", "sum...
Fill X with NaN values if necessary, construct the n_samples x n_samples distance matrix and set the self-distance of each row to infinity. Returns contents of X laid out in row-major, the distance matrix, and an "effective infinity" which is larger than any entry of the distance matrix.
[ "Fill", "X", "with", "NaN", "values", "if", "necessary", "construct", "the", "n_samples", "x", "n_samples", "distance", "matrix", "and", "set", "the", "self", "-", "distance", "of", "each", "row", "to", "infinity", "." ]
train
https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/common.py#L20-L50
iskandr/knnimpute
knnimpute/optimistic.py
knn_impute_optimistic
def knn_impute_optimistic( X, missing_mask, k, verbose=False, print_interval=100): """ Fill in the given incomplete matrix using k-nearest neighbor imputation. This version assumes that most of the time the same neighbors will be used so first performs the weight...
python
def knn_impute_optimistic( X, missing_mask, k, verbose=False, print_interval=100): """ Fill in the given incomplete matrix using k-nearest neighbor imputation. This version assumes that most of the time the same neighbors will be used so first performs the weight...
[ "def", "knn_impute_optimistic", "(", "X", ",", "missing_mask", ",", "k", ",", "verbose", "=", "False", ",", "print_interval", "=", "100", ")", ":", "start_t", "=", "time", ".", "time", "(", ")", "n_rows", ",", "n_cols", "=", "X", ".", "shape", "X_row_m...
Fill in the given incomplete matrix using k-nearest neighbor imputation. This version assumes that most of the time the same neighbors will be used so first performs the weighted average of a row's k-nearest neighbors and checks afterward whether it was valid (due to possible missing values). Has been...
[ "Fill", "in", "the", "given", "incomplete", "matrix", "using", "k", "-", "nearest", "neighbor", "imputation", "." ]
train
https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/optimistic.py#L21-L152
iskandr/knnimpute
knnimpute/normalized_distance.py
all_pairs_normalized_distances
def all_pairs_normalized_distances(X): """ We can't really compute distances over incomplete data since rows are missing different numbers of entries. The next best thing is the mean squared difference between two vectors (a normalized distance), which gets computed only over the columns that tw...
python
def all_pairs_normalized_distances(X): """ We can't really compute distances over incomplete data since rows are missing different numbers of entries. The next best thing is the mean squared difference between two vectors (a normalized distance), which gets computed only over the columns that tw...
[ "def", "all_pairs_normalized_distances", "(", "X", ")", ":", "n_rows", ",", "n_cols", "=", "X", ".", "shape", "# matrix of mean squared difference between between samples", "D", "=", "np", ".", "ones", "(", "(", "n_rows", ",", "n_rows", ")", ",", "dtype", "=", ...
We can't really compute distances over incomplete data since rows are missing different numbers of entries. The next best thing is the mean squared difference between two vectors (a normalized distance), which gets computed only over the columns that two vectors have in common. If two vectors have no fe...
[ "We", "can", "t", "really", "compute", "distances", "over", "incomplete", "data", "since", "rows", "are", "missing", "different", "numbers", "of", "entries", ".", "The", "next", "best", "thing", "is", "the", "mean", "squared", "difference", "between", "two", ...
train
https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/normalized_distance.py#L18-L84
iskandr/knnimpute
knnimpute/normalized_distance.py
all_pairs_normalized_distances_reference
def all_pairs_normalized_distances_reference(X): """ Reference implementation of normalized all-pairs distance, used for testing the more efficient implementation above for equivalence. """ n_samples, n_cols = X.shape # matrix of mean squared difference between between samples D = np.ones((n...
python
def all_pairs_normalized_distances_reference(X): """ Reference implementation of normalized all-pairs distance, used for testing the more efficient implementation above for equivalence. """ n_samples, n_cols = X.shape # matrix of mean squared difference between between samples D = np.ones((n...
[ "def", "all_pairs_normalized_distances_reference", "(", "X", ")", ":", "n_samples", ",", "n_cols", "=", "X", ".", "shape", "# matrix of mean squared difference between between samples", "D", "=", "np", ".", "ones", "(", "(", "n_samples", ",", "n_samples", ")", ",", ...
Reference implementation of normalized all-pairs distance, used for testing the more efficient implementation above for equivalence.
[ "Reference", "implementation", "of", "normalized", "all", "-", "pairs", "distance", "used", "for", "testing", "the", "more", "efficient", "implementation", "above", "for", "equivalence", "." ]
train
https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/normalized_distance.py#L87-L103
iskandr/knnimpute
knnimpute/argpartition.py
knn_impute_with_argpartition
def knn_impute_with_argpartition( X, missing_mask, k, verbose=False, print_interval=100): """ Fill in the given incomplete matrix using k-nearest neighbor imputation. This version is a simpler algorithm meant primarily for testing but surprisingly it's faster for...
python
def knn_impute_with_argpartition( X, missing_mask, k, verbose=False, print_interval=100): """ Fill in the given incomplete matrix using k-nearest neighbor imputation. This version is a simpler algorithm meant primarily for testing but surprisingly it's faster for...
[ "def", "knn_impute_with_argpartition", "(", "X", ",", "missing_mask", ",", "k", ",", "verbose", "=", "False", ",", "print_interval", "=", "100", ")", ":", "start_t", "=", "time", ".", "time", "(", ")", "n_rows", ",", "n_cols", "=", "X", ".", "shape", "...
Fill in the given incomplete matrix using k-nearest neighbor imputation. This version is a simpler algorithm meant primarily for testing but surprisingly it's faster for many (but not all) dataset sizes, particularly when most of the columns are missing in any given row. The crucial bottleneck is the c...
[ "Fill", "in", "the", "given", "incomplete", "matrix", "using", "k", "-", "nearest", "neighbor", "imputation", "." ]
train
https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/argpartition.py#L22-L98
iskandr/knnimpute
knnimpute/reference.py
knn_impute_reference
def knn_impute_reference( X, missing_mask, k, verbose=False, print_interval=100): """ Reference implementation of kNN imputation logic. """ n_rows, n_cols = X.shape X_result, D, effective_infinity = \ knn_initialize(X, missing_mask, verbose=verbose) ...
python
def knn_impute_reference( X, missing_mask, k, verbose=False, print_interval=100): """ Reference implementation of kNN imputation logic. """ n_rows, n_cols = X.shape X_result, D, effective_infinity = \ knn_initialize(X, missing_mask, verbose=verbose) ...
[ "def", "knn_impute_reference", "(", "X", ",", "missing_mask", ",", "k", ",", "verbose", "=", "False", ",", "print_interval", "=", "100", ")", ":", "n_rows", ",", "n_cols", "=", "X", ".", "shape", "X_result", ",", "D", ",", "effective_infinity", "=", "knn...
Reference implementation of kNN imputation logic.
[ "Reference", "implementation", "of", "kNN", "imputation", "logic", "." ]
train
https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/reference.py#L20-L55
bruth/django-tracking2
tracking/managers.py
VisitorManager.active
def active(self, registered_only=True): "Returns all active users, e.g. not logged and non-expired session." visitors = self.filter( expiry_time__gt=timezone.now(), end_time=None ) if registered_only: visitors = visitors.filter(user__isnull=False) ...
python
def active(self, registered_only=True): "Returns all active users, e.g. not logged and non-expired session." visitors = self.filter( expiry_time__gt=timezone.now(), end_time=None ) if registered_only: visitors = visitors.filter(user__isnull=False) ...
[ "def", "active", "(", "self", ",", "registered_only", "=", "True", ")", ":", "visitors", "=", "self", ".", "filter", "(", "expiry_time__gt", "=", "timezone", ".", "now", "(", ")", ",", "end_time", "=", "None", ")", "if", "registered_only", ":", "visitors...
Returns all active users, e.g. not logged and non-expired session.
[ "Returns", "all", "active", "users", "e", ".", "g", ".", "not", "logged", "and", "non", "-", "expired", "session", "." ]
train
https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L13-L21
bruth/django-tracking2
tracking/managers.py
VisitorManager.stats
def stats(self, start_date, end_date, registered_only=False): """Returns a dictionary of visits including: * total visits * unique visits * return ratio * pages per visit (if pageviews are enabled) * time on site for all users, registered use...
python
def stats(self, start_date, end_date, registered_only=False): """Returns a dictionary of visits including: * total visits * unique visits * return ratio * pages per visit (if pageviews are enabled) * time on site for all users, registered use...
[ "def", "stats", "(", "self", ",", "start_date", ",", "end_date", ",", "registered_only", "=", "False", ")", ":", "visitors", "=", "self", ".", "filter", "(", "start_time__gte", "=", "start_date", ",", "start_time__lt", "=", "end_date", ")", "stats", "=", "...
Returns a dictionary of visits including: * total visits * unique visits * return ratio * pages per visit (if pageviews are enabled) * time on site for all users, registered users and guests.
[ "Returns", "a", "dictionary", "of", "visits", "including", ":" ]
train
https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L29-L151
bruth/django-tracking2
tracking/managers.py
PageviewManager.stats
def stats(self, start_date=None, end_date=None, registered_only=False): """Returns a dictionary of pageviews including: * total pageviews for all users, registered users and guests. """ pageviews = self.filter( visitor__start_time__lt=end_date, visit...
python
def stats(self, start_date=None, end_date=None, registered_only=False): """Returns a dictionary of pageviews including: * total pageviews for all users, registered users and guests. """ pageviews = self.filter( visitor__start_time__lt=end_date, visit...
[ "def", "stats", "(", "self", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ",", "registered_only", "=", "False", ")", ":", "pageviews", "=", "self", ".", "filter", "(", "visitor__start_time__lt", "=", "end_date", ",", "visitor__start_time__gte"...
Returns a dictionary of pageviews including: * total pageviews for all users, registered users and guests.
[ "Returns", "a", "dictionary", "of", "pageviews", "including", ":" ]
train
https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L189-L247
bruth/django-tracking2
tracking/views.py
dashboard
def dashboard(request): "Counts, aggregations and more!" end_time = now() start_time = end_time - timedelta(days=7) defaults = {'start': start_time, 'end': end_time} form = DashboardForm(data=request.GET or defaults) if form.is_valid(): start_time = form.cleaned_data['start'] en...
python
def dashboard(request): "Counts, aggregations and more!" end_time = now() start_time = end_time - timedelta(days=7) defaults = {'start': start_time, 'end': end_time} form = DashboardForm(data=request.GET or defaults) if form.is_valid(): start_time = form.cleaned_data['start'] en...
[ "def", "dashboard", "(", "request", ")", ":", "end_time", "=", "now", "(", ")", "start_time", "=", "end_time", "-", "timedelta", "(", "days", "=", "7", ")", "defaults", "=", "{", "'start'", ":", "start_time", ",", "'end'", ":", "end_time", "}", "form",...
Counts, aggregations and more!
[ "Counts", "aggregations", "and", "more!" ]
train
https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/views.py#L31-L68
bruth/django-tracking2
tracking/models.py
Visitor.geoip_data
def geoip_data(self): """Attempt to retrieve MaxMind GeoIP data based on visitor's IP.""" if not HAS_GEOIP or not TRACK_USING_GEOIP: return if not hasattr(self, '_geoip_data'): self._geoip_data = None try: gip = GeoIP(cache=GEOIP_CACHE_TYPE) ...
python
def geoip_data(self): """Attempt to retrieve MaxMind GeoIP data based on visitor's IP.""" if not HAS_GEOIP or not TRACK_USING_GEOIP: return if not hasattr(self, '_geoip_data'): self._geoip_data = None try: gip = GeoIP(cache=GEOIP_CACHE_TYPE) ...
[ "def", "geoip_data", "(", "self", ")", ":", "if", "not", "HAS_GEOIP", "or", "not", "TRACK_USING_GEOIP", ":", "return", "if", "not", "hasattr", "(", "self", ",", "'_geoip_data'", ")", ":", "self", ".", "_geoip_data", "=", "None", "try", ":", "gip", "=", ...
Attempt to retrieve MaxMind GeoIP data based on visitor's IP.
[ "Attempt", "to", "retrieve", "MaxMind", "GeoIP", "data", "based", "on", "visitor", "s", "IP", "." ]
train
https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/models.py#L62-L77
syrusakbary/pyjade
pyjade/runtime.py
escape
def escape(s): """Convert the characters &, <, >, ' and " in string s to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. Marks return value as markup string. """ if hasattr(s, '__html__'): return s.__html__() if isinstance(s, six.bi...
python
def escape(s): """Convert the characters &, <, >, ' and " in string s to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. Marks return value as markup string. """ if hasattr(s, '__html__'): return s.__html__() if isinstance(s, six.bi...
[ "def", "escape", "(", "s", ")", ":", "if", "hasattr", "(", "s", ",", "'__html__'", ")", ":", "return", "s", ".", "__html__", "(", ")", "if", "isinstance", "(", "s", ",", "six", ".", "binary_type", ")", ":", "s", "=", "six", ".", "text_type", "(",...
Convert the characters &, <, >, ' and " in string s to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. Marks return value as markup string.
[ "Convert", "the", "characters", "&", "<", ">", "and", "in", "string", "s", "to", "HTML", "-", "safe", "sequences", ".", "Use", "this", "if", "you", "need", "to", "display", "text", "that", "might", "contain", "such", "characters", "in", "HTML", ".", "M...
train
https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/runtime.py#L28-L48
syrusakbary/pyjade
pyjade/runtime.py
iteration
def iteration(obj, num_keys): """ Jade iteration supports "for 'value' [, key]?" iteration only. PyJade has implicitly supported value unpacking instead, without the list indexes. Trying to not break existing code, the following rules are applied: 1. If the object is a mapping type, return it...
python
def iteration(obj, num_keys): """ Jade iteration supports "for 'value' [, key]?" iteration only. PyJade has implicitly supported value unpacking instead, without the list indexes. Trying to not break existing code, the following rules are applied: 1. If the object is a mapping type, return it...
[ "def", "iteration", "(", "obj", ",", "num_keys", ")", ":", "# If the object is a mapping type, return it as-is", "if", "is_mapping", "(", "obj", ")", ":", "return", "obj", "_marker", "=", "[", "]", "iter_obj", "=", "iter", "(", "obj", ")", "head", "=", "next...
Jade iteration supports "for 'value' [, key]?" iteration only. PyJade has implicitly supported value unpacking instead, without the list indexes. Trying to not break existing code, the following rules are applied: 1. If the object is a mapping type, return it as-is, and assume the caller has...
[ "Jade", "iteration", "supports", "for", "value", "[", "key", "]", "?", "iteration", "only", ".", "PyJade", "has", "implicitly", "supported", "value", "unpacking", "instead", "without", "the", "list", "indexes", ".", "Trying", "to", "not", "break", "existing", ...
train
https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/runtime.py#L89-L135
syrusakbary/pyjade
pyjade/ext/django/templatetags.py
do_evaluate
def do_evaluate(parser, token): '''Calls an arbitrary method on an object.''' code = token.contents firstspace = code.find(' ') if firstspace >= 0: code = code[firstspace+1:] return Evaluator(code)
python
def do_evaluate(parser, token): '''Calls an arbitrary method on an object.''' code = token.contents firstspace = code.find(' ') if firstspace >= 0: code = code[firstspace+1:] return Evaluator(code)
[ "def", "do_evaluate", "(", "parser", ",", "token", ")", ":", "code", "=", "token", ".", "contents", "firstspace", "=", "code", ".", "find", "(", "' '", ")", "if", "firstspace", ">=", "0", ":", "code", "=", "code", "[", "firstspace", "+", "1", ":", ...
Calls an arbitrary method on an object.
[ "Calls", "an", "arbitrary", "method", "on", "an", "object", "." ]
train
https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L24-L30
syrusakbary/pyjade
pyjade/ext/django/templatetags.py
do_set
def do_set(parser, token): '''Calls an arbitrary method on an object.''' code = token.contents firstspace = code.find(' ') if firstspace >= 0: code = code[firstspace+1:] return Setter(code)
python
def do_set(parser, token): '''Calls an arbitrary method on an object.''' code = token.contents firstspace = code.find(' ') if firstspace >= 0: code = code[firstspace+1:] return Setter(code)
[ "def", "do_set", "(", "parser", ",", "token", ")", ":", "code", "=", "token", ".", "contents", "firstspace", "=", "code", ".", "find", "(", "' '", ")", "if", "firstspace", ">=", "0", ":", "code", "=", "code", "[", "firstspace", "+", "1", ":", "]", ...
Calls an arbitrary method on an object.
[ "Calls", "an", "arbitrary", "method", "on", "an", "object", "." ]
train
https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L50-L56
syrusakbary/pyjade
pyjade/ext/django/templatetags.py
Evaluator.render
def render(self, context): '''Evaluates the code in the page and returns the result''' modules = { 'pyjade': __import__('pyjade') } context['false'] = False context['true'] = True try: return six.text_type(eval('pyjade.runtime.attrs(%s)'%self.code,modules,context)) except NameE...
python
def render(self, context): '''Evaluates the code in the page and returns the result''' modules = { 'pyjade': __import__('pyjade') } context['false'] = False context['true'] = True try: return six.text_type(eval('pyjade.runtime.attrs(%s)'%self.code,modules,context)) except NameE...
[ "def", "render", "(", "self", ",", "context", ")", ":", "modules", "=", "{", "'pyjade'", ":", "__import__", "(", "'pyjade'", ")", "}", "context", "[", "'false'", "]", "=", "False", "context", "[", "'true'", "]", "=", "True", "try", ":", "return", "si...
Evaluates the code in the page and returns the result
[ "Evaluates", "the", "code", "in", "the", "page", "and", "returns", "the", "result" ]
train
https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L37-L47
syrusakbary/pyjade
pyjade/ext/django/templatetags.py
Setter.render
def render(self, context): '''Evaluates the code in the page and returns the result''' modules = { } context['false'] = False context['true'] = True new_ctx = eval('dict(%s)'%self.code,modules,context) context.update(new_ctx) return ''
python
def render(self, context): '''Evaluates the code in the page and returns the result''' modules = { } context['false'] = False context['true'] = True new_ctx = eval('dict(%s)'%self.code,modules,context) context.update(new_ctx) return ''
[ "def", "render", "(", "self", ",", "context", ")", ":", "modules", "=", "{", "}", "context", "[", "'false'", "]", "=", "False", "context", "[", "'true'", "]", "=", "True", "new_ctx", "=", "eval", "(", "'dict(%s)'", "%", "self", ".", "code", ",", "m...
Evaluates the code in the page and returns the result
[ "Evaluates", "the", "code", "in", "the", "page", "and", "returns", "the", "result" ]
train
https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L63-L71
PokeAPI/pokebase
pokebase/common.py
sprite_filepath_build
def sprite_filepath_build(sprite_type, sprite_id, **kwargs): """returns the filepath of the sprite *relative to SPRITE_CACHE*""" options = parse_sprite_options(sprite_type, **kwargs) filename = '.'.join([str(sprite_id), SPRITE_EXT]) filepath = os.path.join(sprite_type, *options, filename) return ...
python
def sprite_filepath_build(sprite_type, sprite_id, **kwargs): """returns the filepath of the sprite *relative to SPRITE_CACHE*""" options = parse_sprite_options(sprite_type, **kwargs) filename = '.'.join([str(sprite_id), SPRITE_EXT]) filepath = os.path.join(sprite_type, *options, filename) return ...
[ "def", "sprite_filepath_build", "(", "sprite_type", ",", "sprite_id", ",", "*", "*", "kwargs", ")", ":", "options", "=", "parse_sprite_options", "(", "sprite_type", ",", "*", "*", "kwargs", ")", "filename", "=", "'.'", ".", "join", "(", "[", "str", "(", ...
returns the filepath of the sprite *relative to SPRITE_CACHE*
[ "returns", "the", "filepath", "of", "the", "sprite", "*", "relative", "to", "SPRITE_CACHE", "*" ]
train
https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/common.py#L72-L80
PokeAPI/pokebase
pokebase/interface.py
_make_obj
def _make_obj(obj): """Takes an object and returns a corresponding API class. The names and values of the data will match exactly with those found in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data may be of a standard type, such as an integer or string. For those cases, the...
python
def _make_obj(obj): """Takes an object and returns a corresponding API class. The names and values of the data will match exactly with those found in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data may be of a standard type, such as an integer or string. For those cases, the...
[ "def", "_make_obj", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "dict", ")", ":", "if", "'url'", "in", "obj", ".", "keys", "(", ")", ":", "url", "=", "obj", "[", "'url'", "]", "id_", "=", "int", "(", "url", ".", "split", "(", "...
Takes an object and returns a corresponding API class. The names and values of the data will match exactly with those found in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data may be of a standard type, such as an integer or string. For those cases, the input value is simply retu...
[ "Takes", "an", "object", "and", "returns", "a", "corresponding", "API", "class", "." ]
train
https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/interface.py#L7-L29
PokeAPI/pokebase
pokebase/interface.py
APIResource._load
def _load(self): """Function to collect reference data and connect it to the instance as attributes. Internal function, does not usually need to be called by the user, as it is called automatically when an attribute is requested. :return None """ data = get_...
python
def _load(self): """Function to collect reference data and connect it to the instance as attributes. Internal function, does not usually need to be called by the user, as it is called automatically when an attribute is requested. :return None """ data = get_...
[ "def", "_load", "(", "self", ")", ":", "data", "=", "get_data", "(", "self", ".", "endpoint", ",", "self", ".", "id_", ",", "force_lookup", "=", "self", ".", "__force_lookup", ")", "# Make our custom objects from the data.", "for", "key", ",", "val", "in", ...
Function to collect reference data and connect it to the instance as attributes. Internal function, does not usually need to be called by the user, as it is called automatically when an attribute is requested. :return None
[ "Function", "to", "collect", "reference", "data", "and", "connect", "it", "to", "the", "instance", "as", "attributes", "." ]
train
https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/interface.py#L126-L158
PokeAPI/pokebase
pokebase/cache.py
safe_make_dirs
def safe_make_dirs(path, mode=0o777): """Create a leaf directory and all intermediate ones in a safe way. A wrapper to os.makedirs() that handles existing leaf directories while avoiding os.path.exists() race conditions. :param path: relative or absolute directory tree to create :param mode: direc...
python
def safe_make_dirs(path, mode=0o777): """Create a leaf directory and all intermediate ones in a safe way. A wrapper to os.makedirs() that handles existing leaf directories while avoiding os.path.exists() race conditions. :param path: relative or absolute directory tree to create :param mode: direc...
[ "def", "safe_make_dirs", "(", "path", ",", "mode", "=", "0o777", ")", ":", "try", ":", "os", ".", "makedirs", "(", "path", ",", "mode", ")", "except", "OSError", "as", "error", ":", "if", "error", ".", "errno", "!=", "17", ":", "# File exists", "rais...
Create a leaf directory and all intermediate ones in a safe way. A wrapper to os.makedirs() that handles existing leaf directories while avoiding os.path.exists() race conditions. :param path: relative or absolute directory tree to create :param mode: directory permissions in octal :return: The ne...
[ "Create", "a", "leaf", "directory", "and", "all", "intermediate", "ones", "in", "a", "safe", "way", "." ]
train
https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L76-L92
PokeAPI/pokebase
pokebase/cache.py
get_default_cache
def get_default_cache(): """Get the default cache location. Adheres to the XDG Base Directory specification, as described in https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html :return: the default cache directory absolute path """ xdg_cache_home = os.environ.get('XDG_CACH...
python
def get_default_cache(): """Get the default cache location. Adheres to the XDG Base Directory specification, as described in https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html :return: the default cache directory absolute path """ xdg_cache_home = os.environ.get('XDG_CACH...
[ "def", "get_default_cache", "(", ")", ":", "xdg_cache_home", "=", "os", ".", "environ", ".", "get", "(", "'XDG_CACHE_HOME'", ")", "or", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", ",", "'.cache'", ")", ...
Get the default cache location. Adheres to the XDG Base Directory specification, as described in https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html :return: the default cache directory absolute path
[ "Get", "the", "default", "cache", "location", "." ]
train
https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L95-L107
PokeAPI/pokebase
pokebase/cache.py
set_cache
def set_cache(new_path=None): """Simple function to change the cache location. `new_path` can be an absolute or relative path. If the directory does not exist yet, this function will create it. If None it will set the cache to the default cache directory. If you are going to change the cache direc...
python
def set_cache(new_path=None): """Simple function to change the cache location. `new_path` can be an absolute or relative path. If the directory does not exist yet, this function will create it. If None it will set the cache to the default cache directory. If you are going to change the cache direc...
[ "def", "set_cache", "(", "new_path", "=", "None", ")", ":", "global", "CACHE_DIR", ",", "API_CACHE", ",", "SPRITE_CACHE", "if", "new_path", "is", "None", ":", "new_path", "=", "get_default_cache", "(", ")", "CACHE_DIR", "=", "safe_make_dirs", "(", "os", ".",...
Simple function to change the cache location. `new_path` can be an absolute or relative path. If the directory does not exist yet, this function will create it. If None it will set the cache to the default cache directory. If you are going to change the cache directory, this function should be cal...
[ "Simple", "function", "to", "change", "the", "cache", "location", "." ]
train
https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L117-L142
emc-openstack/storops
storops/unity/resource/host.py
UnityHost.attach
def attach(self, lun_or_snap, skip_hlu_0=False): """ Attaches lun, snap or member snap of cg snap to host. Don't pass cg snapshot in as `lun_or_snap`. :param lun_or_snap: the lun, snap, or a member snap of cg snap :param skip_hlu_0: whether to skip hlu 0 :return: the hlu number...
python
def attach(self, lun_or_snap, skip_hlu_0=False): """ Attaches lun, snap or member snap of cg snap to host. Don't pass cg snapshot in as `lun_or_snap`. :param lun_or_snap: the lun, snap, or a member snap of cg snap :param skip_hlu_0: whether to skip hlu 0 :return: the hlu number...
[ "def", "attach", "(", "self", ",", "lun_or_snap", ",", "skip_hlu_0", "=", "False", ")", ":", "# `UnityResourceAlreadyAttachedError` check was removed due to there", "# is a host cache existing in Cinder driver. If the lun was attached to", "# the host and the info was stored in the cache...
Attaches lun, snap or member snap of cg snap to host. Don't pass cg snapshot in as `lun_or_snap`. :param lun_or_snap: the lun, snap, or a member snap of cg snap :param skip_hlu_0: whether to skip hlu 0 :return: the hlu number
[ "Attaches", "lun", "snap", "or", "member", "snap", "of", "cg", "snap", "to", "host", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L259-L289
emc-openstack/storops
storops/unity/resource/host.py
UnityHost.has_hlu
def has_hlu(self, lun_or_snap, cg_member=None): """Returns True if `lun_or_snap` is attached to the host. :param lun_or_snap: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg snap. :return: True - if `lu...
python
def has_hlu(self, lun_or_snap, cg_member=None): """Returns True if `lun_or_snap` is attached to the host. :param lun_or_snap: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg snap. :return: True - if `lu...
[ "def", "has_hlu", "(", "self", ",", "lun_or_snap", ",", "cg_member", "=", "None", ")", ":", "hlu", "=", "self", ".", "get_hlu", "(", "lun_or_snap", ",", "cg_member", "=", "cg_member", ")", "return", "hlu", "is", "not", "None" ]
Returns True if `lun_or_snap` is attached to the host. :param lun_or_snap: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg snap. :return: True - if `lun_or_snap` is attached, otherwise False.
[ "Returns", "True", "if", "lun_or_snap", "is", "attached", "to", "the", "host", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L310-L319
emc-openstack/storops
storops/unity/resource/host.py
UnityHost.get_host_lun
def get_host_lun(self, lun_or_snap, cg_member=None): """Gets the host lun of a lun, lun snap, cg snap or a member snap of cg snap. :param lun_or_snap: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg sna...
python
def get_host_lun(self, lun_or_snap, cg_member=None): """Gets the host lun of a lun, lun snap, cg snap or a member snap of cg snap. :param lun_or_snap: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg sna...
[ "def", "get_host_lun", "(", "self", ",", "lun_or_snap", ",", "cg_member", "=", "None", ")", ":", "import", "storops", ".", "unity", ".", "resource", ".", "lun", "as", "lun_module", "import", "storops", ".", "unity", ".", "resource", ".", "snap", "as", "s...
Gets the host lun of a lun, lun snap, cg snap or a member snap of cg snap. :param lun_or_snap: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg snap. :return: the host lun object.
[ "Gets", "the", "host", "lun", "of", "a", "lun", "lun", "snap", "cg", "snap", "or", "a", "member", "snap", "of", "cg", "snap", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L329-L358
emc-openstack/storops
storops/unity/resource/host.py
UnityHost.get_hlu
def get_hlu(self, resource, cg_member=None): """Gets the hlu number of a lun, lun snap, cg snap or a member snap of cg snap. :param resource: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg snap. ...
python
def get_hlu(self, resource, cg_member=None): """Gets the hlu number of a lun, lun snap, cg snap or a member snap of cg snap. :param resource: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg snap. ...
[ "def", "get_hlu", "(", "self", ",", "resource", ",", "cg_member", "=", "None", ")", ":", "host_lun", "=", "self", ".", "get_host_lun", "(", "resource", ",", "cg_member", "=", "cg_member", ")", "return", "host_lun", "if", "host_lun", "is", "None", "else", ...
Gets the hlu number of a lun, lun snap, cg snap or a member snap of cg snap. :param resource: can be lun, lun snap, cg snap or a member snap of cg snap. :param cg_member: the member lun of cg if `lun_or_snap` is cg snap. :return: the hlu number.
[ "Gets", "the", "hlu", "number", "of", "a", "lun", "lun", "snap", "cg", "snap", "or", "a", "member", "snap", "of", "cg", "snap", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L360-L370
emc-openstack/storops
storops/unity/resource/host.py
UnityHost.update_initiators
def update_initiators(self, iqns=None, wwns=None): """Primarily for puppet-unity use. Update the iSCSI and FC initiators if needed. """ # First get current iqns iqns = set(iqns) if iqns else set() current_iqns = set() if self.iscsi_host_initiators: cu...
python
def update_initiators(self, iqns=None, wwns=None): """Primarily for puppet-unity use. Update the iSCSI and FC initiators if needed. """ # First get current iqns iqns = set(iqns) if iqns else set() current_iqns = set() if self.iscsi_host_initiators: cu...
[ "def", "update_initiators", "(", "self", ",", "iqns", "=", "None", ",", "wwns", "=", "None", ")", ":", "# First get current iqns", "iqns", "=", "set", "(", "iqns", ")", "if", "iqns", "else", "set", "(", ")", "current_iqns", "=", "set", "(", ")", "if", ...
Primarily for puppet-unity use. Update the iSCSI and FC initiators if needed.
[ "Primarily", "for", "puppet", "-", "unity", "use", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L435-L454
rstoneback/pysat
pysat/instruments/nasa_cdaweb_methods.py
list_files
def list_files(tag=None, sat_id=None, data_path=None, format_str=None, supported_tags=None, fake_daily_files_from_monthly=False, two_digit_year_break=None): """Return a Pandas Series of every file for chosen satellite data. This routine is intended to be used by pysat instrume...
python
def list_files(tag=None, sat_id=None, data_path=None, format_str=None, supported_tags=None, fake_daily_files_from_monthly=False, two_digit_year_break=None): """Return a Pandas Series of every file for chosen satellite data. This routine is intended to be used by pysat instrume...
[ "def", "list_files", "(", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ",", "supported_tags", "=", "None", ",", "fake_daily_files_from_monthly", "=", "False", ",", "two_digit_year_break", "=", ...
Return a Pandas Series of every file for chosen satellite data. This routine is intended to be used by pysat instrument modules supporting a particular NASA CDAWeb dataset. Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are <tag strings>...
[ "Return", "a", "Pandas", "Series", "of", "every", "file", "for", "chosen", "satellite", "data", ".", "This", "routine", "is", "intended", "to", "be", "used", "by", "pysat", "instrument", "modules", "supporting", "a", "particular", "NASA", "CDAWeb", "dataset", ...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L15-L85
rstoneback/pysat
pysat/instruments/nasa_cdaweb_methods.py
load
def load(fnames, tag=None, sat_id=None, fake_daily_files_from_monthly=False, flatten_twod=True): """Load NASA CDAWeb CDF files. This routine is intended to be used by pysat instrument modules supporting a particular NASA CDAWeb dataset. Parameters ------------ fnames : (...
python
def load(fnames, tag=None, sat_id=None, fake_daily_files_from_monthly=False, flatten_twod=True): """Load NASA CDAWeb CDF files. This routine is intended to be used by pysat instrument modules supporting a particular NASA CDAWeb dataset. Parameters ------------ fnames : (...
[ "def", "load", "(", "fnames", ",", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "fake_daily_files_from_monthly", "=", "False", ",", "flatten_twod", "=", "True", ")", ":", "import", "pysatCDF", "if", "len", "(", "fnames", ")", "<=", "0", ":", "r...
Load NASA CDAWeb CDF files. This routine is intended to be used by pysat instrument modules supporting a particular NASA CDAWeb dataset. Parameters ------------ fnames : (pandas.Series) Series of filenames tag : (str or NoneType) tag or None (default=None) sat_id : (str...
[ "Load", "NASA", "CDAWeb", "CDF", "files", ".", "This", "routine", "is", "intended", "to", "be", "used", "by", "pysat", "instrument", "modules", "supporting", "a", "particular", "NASA", "CDAWeb", "dataset", "." ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L87-L157
rstoneback/pysat
pysat/instruments/nasa_cdaweb_methods.py
download
def download(supported_tags, date_array, tag, sat_id, ftp_site='cdaweb.gsfc.nasa.gov', data_path=None, user=None, password=None, fake_daily_files_from_monthly=False): """Routine to download NASA CDAWeb CDF data. This routine is intended to be used by pysat instrumen...
python
def download(supported_tags, date_array, tag, sat_id, ftp_site='cdaweb.gsfc.nasa.gov', data_path=None, user=None, password=None, fake_daily_files_from_monthly=False): """Routine to download NASA CDAWeb CDF data. This routine is intended to be used by pysat instrumen...
[ "def", "download", "(", "supported_tags", ",", "date_array", ",", "tag", ",", "sat_id", ",", "ftp_site", "=", "'cdaweb.gsfc.nasa.gov'", ",", "data_path", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "fake_daily_files_from_monthly", ...
Routine to download NASA CDAWeb CDF data. This routine is intended to be used by pysat instrument modules supporting a particular NASA CDAWeb dataset. Parameters ----------- supported_tags : dict dict of dicts. Keys are supported tag names for download. Value is a dict with 'd...
[ "Routine", "to", "download", "NASA", "CDAWeb", "CDF", "data", ".", "This", "routine", "is", "intended", "to", "be", "used", "by", "pysat", "instrument", "modules", "supporting", "a", "particular", "NASA", "CDAWeb", "dataset", "." ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L159-L261
emc-openstack/storops
storops/connection/exceptions.py
from_response
def from_response(response, method, url): """Returns an instance of :class:`HttpError` or subclass based on response. :param response: instance of `requests.Response` class :param method: HTTP method used for request :param url: URL used for request """ req_id = response.headers.get("x-opensta...
python
def from_response(response, method, url): """Returns an instance of :class:`HttpError` or subclass based on response. :param response: instance of `requests.Response` class :param method: HTTP method used for request :param url: URL used for request """ req_id = response.headers.get("x-opensta...
[ "def", "from_response", "(", "response", ",", "method", ",", "url", ")", ":", "req_id", "=", "response", ".", "headers", ".", "get", "(", "\"x-openstack-request-id\"", ")", "# NOTE(hdd) true for older versions of nova and cinder", "if", "not", "req_id", ":", "req_id...
Returns an instance of :class:`HttpError` or subclass based on response. :param response: instance of `requests.Response` class :param method: HTTP method used for request :param url: URL used for request
[ "Returns", "an", "instance", "of", ":", "class", ":", "HttpError", "or", "subclass", "based", "on", "response", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/connection/exceptions.py#L84-L132
emc-openstack/storops
storops/unity/resource/system.py
UnitySystem.create_pool
def create_pool(self, name, raid_groups, description=None, **kwargs): """Create pool based on RaidGroupParameter. :param name: pool name :param raid_groups: a list of *RaidGroupParameter* :param description: pool description :param alert_threshold: Threshold at which the system ...
python
def create_pool(self, name, raid_groups, description=None, **kwargs): """Create pool based on RaidGroupParameter. :param name: pool name :param raid_groups: a list of *RaidGroupParameter* :param description: pool description :param alert_threshold: Threshold at which the system ...
[ "def", "create_pool", "(", "self", ",", "name", ",", "raid_groups", ",", "description", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "UnityPool", ".", "create", "(", "self", ".", "_cli", ",", "name", "=", "name", ",", "description", "=", ...
Create pool based on RaidGroupParameter. :param name: pool name :param raid_groups: a list of *RaidGroupParameter* :param description: pool description :param alert_threshold: Threshold at which the system will generate alerts about the free space in the pool, specified a...
[ "Create", "pool", "based", "on", "RaidGroupParameter", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L122-L160
emc-openstack/storops
storops/unity/resource/system.py
UnitySystem.get_file_port
def get_file_port(self): """Returns ports list can be used by File File ports includes ethernet ports and link aggregation ports. """ eths = self.get_ethernet_port(bond=False) las = self.get_link_aggregation() return eths + las
python
def get_file_port(self): """Returns ports list can be used by File File ports includes ethernet ports and link aggregation ports. """ eths = self.get_ethernet_port(bond=False) las = self.get_link_aggregation() return eths + las
[ "def", "get_file_port", "(", "self", ")", ":", "eths", "=", "self", ".", "get_ethernet_port", "(", "bond", "=", "False", ")", "las", "=", "self", ".", "get_link_aggregation", "(", ")", "return", "eths", "+", "las" ]
Returns ports list can be used by File File ports includes ethernet ports and link aggregation ports.
[ "Returns", "ports", "list", "can", "be", "used", "by", "File" ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L209-L216
emc-openstack/storops
storops/unity/resource/system.py
UnitySystem.create_remote_system
def create_remote_system(self, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None): """ Configures a remote system for remote replication. ...
python
def create_remote_system(self, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None): """ Configures a remote system for remote replication. ...
[ "def", "create_remote_system", "(", "self", ",", "management_address", ",", "local_username", "=", "None", ",", "local_password", "=", "None", ",", "remote_username", "=", "None", ",", "remote_password", "=", "None", ",", "connection_type", "=", "None", ")", ":"...
Configures a remote system for remote replication. :param management_address: the management IP address of the remote system. :param local_username: administrative username of local system. :param local_password: administrative password of local system. :param remote_usernam...
[ "Configures", "a", "remote", "system", "for", "remote", "replication", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L512-L534
emc-openstack/storops
storops/unity/resource/system.py
UnitySystem.create_replication_interface
def create_replication_interface(self, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Creates a replication interface. :param sp: `UnityStorageProcessor` object. Storage pro...
python
def create_replication_interface(self, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Creates a replication interface. :param sp: `UnityStorageProcessor` object. Storage pro...
[ "def", "create_replication_interface", "(", "self", ",", "sp", ",", "ip_port", ",", "ip_address", ",", "netmask", "=", "None", ",", "v6_prefix_length", "=", "None", ",", "gateway", "=", "None", ",", "vlan_id", "=", "None", ")", ":", "return", "UnityReplicati...
Creates a replication interface. :param sp: `UnityStorageProcessor` object. Storage processor on which the replication interface is running. :param ip_port: `UnityIpPort` object. Physical port or link aggregation on the storage processor on which the interface is running. ...
[ "Creates", "a", "replication", "interface", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L544-L567
rstoneback/pysat
demo/cosmic_and_ivm_demo.py
geo2mag
def geo2mag(incoord): """geographic coordinate to magnetic coordinate (coarse): Parameters ---------- incoord : numpy.array of shape (2,*) array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]), where glat, glon are geographic latitude and longitude (or if you have only one po...
python
def geo2mag(incoord): """geographic coordinate to magnetic coordinate (coarse): Parameters ---------- incoord : numpy.array of shape (2,*) array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]), where glat, glon are geographic latitude and longitude (or if you have only one po...
[ "def", "geo2mag", "(", "incoord", ")", ":", "from", "numpy", "import", "pi", ",", "cos", ",", "sin", ",", "arctan2", ",", "sqrt", ",", "dot", "# SOME 'constants' for location of northern mag pole", "lat", "=", "80.08", "#79.3", "lon", "=", "-", "72.211", "+"...
geographic coordinate to magnetic coordinate (coarse): Parameters ---------- incoord : numpy.array of shape (2,*) array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]), where glat, glon are geographic latitude and longitude (or if you have only one point it is [[glat,glon]]). ...
[ "geographic", "coordinate", "to", "magnetic", "coordinate", "(", "coarse", ")", ":" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/demo/cosmic_and_ivm_demo.py#L13-L104
emc-openstack/storops
storops/vnx/resource/snap.py
VNXSnap.restore
def restore(self, res_id, backup_snap=None): """ Restores a snapshot. :param res_id: the LUN number of primary LUN or snapshot mount point to be restored. :param backup_snap: the name of a backup snapshot to be created before restoring. """ name = ...
python
def restore(self, res_id, backup_snap=None): """ Restores a snapshot. :param res_id: the LUN number of primary LUN or snapshot mount point to be restored. :param backup_snap: the name of a backup snapshot to be created before restoring. """ name = ...
[ "def", "restore", "(", "self", ",", "res_id", ",", "backup_snap", "=", "None", ")", ":", "name", "=", "self", ".", "_get_name", "(", ")", "out", "=", "self", ".", "_cli", ".", "restore_snap", "(", "name", ",", "res_id", ",", "backup_snap", ")", "ex",...
Restores a snapshot. :param res_id: the LUN number of primary LUN or snapshot mount point to be restored. :param backup_snap: the name of a backup snapshot to be created before restoring.
[ "Restores", "a", "snapshot", ".", ":", "param", "res_id", ":", "the", "LUN", "number", "of", "primary", "LUN", "or", "snapshot", "mount", "point", "to", "be", "restored", ".", ":", "param", "backup_snap", ":", "the", "name", "of", "a", "backup", "snapsho...
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/snap.py#L104-L115
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
list_files
def list_files(tag='', sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen SuperMAG data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magne...
python
def list_files(tag='', sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen SuperMAG data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magne...
[ "def", "list_files", "(", "tag", "=", "''", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ")", ":", "if", "format_str", "is", "None", "and", "data_path", "is", "not", "None", ":", "file_base", "=", "'superma...
Return a Pandas Series of every file for chosen SuperMAG data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer measurements). (default='') sat_id : (string or NoneType) ...
[ "Return", "a", "Pandas", "Series", "of", "every", "file", "for", "chosen", "SuperMAG", "data" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L62-L128
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
load
def load(fnames, tag='', sat_id=None): """ Load the SuperMAG files Parameters ----------- fnames : (list) List of filenames tag : (str or NoneType) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer measurements). (d...
python
def load(fnames, tag='', sat_id=None): """ Load the SuperMAG files Parameters ----------- fnames : (list) List of filenames tag : (str or NoneType) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer measurements). (d...
[ "def", "load", "(", "fnames", ",", "tag", "=", "''", ",", "sat_id", "=", "None", ")", ":", "# Ensure that there are files to load", "if", "len", "(", "fnames", ")", "<=", "0", ":", "return", "pysat", ".", "DataFrame", "(", "None", ")", ",", "pysat", "....
Load the SuperMAG files Parameters ----------- fnames : (list) List of filenames tag : (str or NoneType) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer measurements). (default='') sat_id : (str or NoneType) ...
[ "Load", "the", "SuperMAG", "files" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L131-L195
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
load_csv_data
def load_csv_data(fname, tag): """Load data from a comma separated SuperMAG file Parameters ------------ fname : (str) CSV SuperMAG file name tag : (str) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer measurement...
python
def load_csv_data(fname, tag): """Load data from a comma separated SuperMAG file Parameters ------------ fname : (str) CSV SuperMAG file name tag : (str) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer measurement...
[ "def", "load_csv_data", "(", "fname", ",", "tag", ")", ":", "import", "re", "if", "tag", "==", "\"stations\"", ":", "# Because there may be multiple operators, the default pandas reader", "# cannot be used.", "ddict", "=", "dict", "(", ")", "dkeys", "=", "list", "("...
Load data from a comma separated SuperMAG file Parameters ------------ fname : (str) CSV SuperMAG file name tag : (str) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer measurements). Returns -------- data...
[ "Load", "data", "from", "a", "comma", "separated", "SuperMAG", "file" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L197-L259
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
load_ascii_data
def load_ascii_data(fname, tag): """Load data from a self-documenting ASCII SuperMAG file Parameters ------------ fname : (str) ASCII SuperMAG filename tag : (str) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer m...
python
def load_ascii_data(fname, tag): """Load data from a self-documenting ASCII SuperMAG file Parameters ------------ fname : (str) ASCII SuperMAG filename tag : (str) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer m...
[ "def", "load_ascii_data", "(", "fname", ",", "tag", ")", ":", "import", "re", "ndata", "=", "{", "\"indices\"", ":", "2", ",", "\"\"", ":", "4", ",", "\"all\"", ":", "4", ",", "\"stations\"", ":", "8", "}", "dkeys", "=", "{", "'stations'", ":", "li...
Load data from a self-documenting ASCII SuperMAG file Parameters ------------ fname : (str) ASCII SuperMAG filename tag : (str) Denotes type of file to load. Accepted types are 'indices', 'all', 'stations', and '' (for just magnetometer measurements). Returns -------- ...
[ "Load", "data", "from", "a", "self", "-", "documenting", "ASCII", "SuperMAG", "file" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L261-L414
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
update_smag_metadata
def update_smag_metadata(col_name): """Update SuperMAG metadata Parameters ----------- col_name : (str) Data column name Returns -------- col_dict : (dict) Dictionary of strings detailing the units and long-form name of the data """ smag_units = {'IAGA':'non...
python
def update_smag_metadata(col_name): """Update SuperMAG metadata Parameters ----------- col_name : (str) Data column name Returns -------- col_dict : (dict) Dictionary of strings detailing the units and long-form name of the data """ smag_units = {'IAGA':'non...
[ "def", "update_smag_metadata", "(", "col_name", ")", ":", "smag_units", "=", "{", "'IAGA'", ":", "'none'", ",", "'N'", ":", "'nT'", ",", "'E'", ":", "'nT'", ",", "'Z'", ":", "'nT'", ",", "'MLT'", ":", "'hours'", ",", "'MLAT'", ":", "'degrees'", ",", ...
Update SuperMAG metadata Parameters ----------- col_name : (str) Data column name Returns -------- col_dict : (dict) Dictionary of strings detailing the units and long-form name of the data
[ "Update", "SuperMAG", "metadata" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L416-L483
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
format_baseline_list
def format_baseline_list(baseline_list): """Format the list of baseline information from the loaded files into a cohesive, informative string Parameters ------------ baseline_list : (list) List of strings specifying the baseline information for each SuperMAG file Returns --...
python
def format_baseline_list(baseline_list): """Format the list of baseline information from the loaded files into a cohesive, informative string Parameters ------------ baseline_list : (list) List of strings specifying the baseline information for each SuperMAG file Returns --...
[ "def", "format_baseline_list", "(", "baseline_list", ")", ":", "uniq_base", "=", "dict", "(", ")", "uniq_delta", "=", "dict", "(", ")", "for", "bline", "in", "baseline_list", ":", "bsplit", "=", "bline", ".", "split", "(", ")", "bdate", "=", "\" \"", "."...
Format the list of baseline information from the loaded files into a cohesive, informative string Parameters ------------ baseline_list : (list) List of strings specifying the baseline information for each SuperMAG file Returns --------- base_string : (str) Single s...
[ "Format", "the", "list", "of", "baseline", "information", "from", "the", "loaded", "files", "into", "a", "cohesive", "informative", "string" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L485-L544
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
download
def download(date_array, tag, sat_id='', data_path=None, user=None, password=None, baseline='all', delta='none', options='all', file_fmt='ascii'): """Routine to download SuperMAG data Parameters ----------- date_array : np.array Array of datetime objects tag : stri...
python
def download(date_array, tag, sat_id='', data_path=None, user=None, password=None, baseline='all', delta='none', options='all', file_fmt='ascii'): """Routine to download SuperMAG data Parameters ----------- date_array : np.array Array of datetime objects tag : stri...
[ "def", "download", "(", "date_array", ",", "tag", ",", "sat_id", "=", "''", ",", "data_path", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "baseline", "=", "'all'", ",", "delta", "=", "'none'", ",", "options", "=", "'all'...
Routine to download SuperMAG data Parameters ----------- date_array : np.array Array of datetime objects tag : string String denoting the type of file to load, accepted values are 'indices', 'all', 'stations', and '' (for only magnetometer data) sat_id : string Not u...
[ "Routine", "to", "download", "SuperMAG", "data" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L551-L767
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
append_data
def append_data(file_strings, file_fmt, tag): """ Load the SuperMAG files Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data file_fmt : str String denoting file type (ascii or csv) tag : string String ...
python
def append_data(file_strings, file_fmt, tag): """ Load the SuperMAG files Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data file_fmt : str String denoting file type (ascii or csv) tag : string String ...
[ "def", "append_data", "(", "file_strings", ",", "file_fmt", ",", "tag", ")", ":", "# Determine the right appending routine for the file type", "if", "file_fmt", ".", "lower", "(", ")", "==", "\"csv\"", ":", "return", "append_csv_data", "(", "file_strings", ")", "els...
Load the SuperMAG files Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data file_fmt : str String denoting file type (ascii or csv) tag : string String denoting the type of file to load, accepted values are...
[ "Load", "the", "SuperMAG", "files" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L769-L792
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
append_ascii_data
def append_ascii_data(file_strings, tag): """ Append data from multiple files for the same time period Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data tag : string String denoting the type of file to load, acce...
python
def append_ascii_data(file_strings, tag): """ Append data from multiple files for the same time period Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data tag : string String denoting the type of file to load, acce...
[ "def", "append_ascii_data", "(", "file_strings", ",", "tag", ")", ":", "import", "re", "# Start with data from the first list element", "out_lines", "=", "file_strings", "[", "0", "]", ".", "split", "(", "'\\n'", ")", "iparam", "=", "-", "1", "# Index for the para...
Append data from multiple files for the same time period Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data tag : string String denoting the type of file to load, accepted values are 'indices', 'all', 'station...
[ "Append", "data", "from", "multiple", "files", "for", "the", "same", "time", "period" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L794-L902
rstoneback/pysat
pysat/instruments/supermag_magnetometer.py
append_csv_data
def append_csv_data(file_strings): """ Append data from multiple csv files for the same time period Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data Returns ------- out_string : string String with all d...
python
def append_csv_data(file_strings): """ Append data from multiple csv files for the same time period Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data Returns ------- out_string : string String with all d...
[ "def", "append_csv_data", "(", "file_strings", ")", ":", "# Start with data from the first list element", "out_lines", "=", "list", "(", ")", "head_line", "=", "None", "# Cycle through the lists of file strings, creating a list of line strings", "for", "fstrings", "in", "file_s...
Append data from multiple csv files for the same time period Parameters ----------- file_strings : array-like Lists or arrays of strings, where each string contains one file of data Returns ------- out_string : string String with all data, ready for output to a file
[ "Append", "data", "from", "multiple", "csv", "files", "for", "the", "same", "time", "period" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L904-L946
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
init
def init(self): """ Adds custom calculations to orbit simulation. This routine is run once, and only once, upon instantiation. Adds quasi-dipole coordiantes, velocity calculation in ECEF coords, adds the attitude vectors of spacecraft assuming x is ram pointing and z is generally nadir, add...
python
def init(self): """ Adds custom calculations to orbit simulation. This routine is run once, and only once, upon instantiation. Adds quasi-dipole coordiantes, velocity calculation in ECEF coords, adds the attitude vectors of spacecraft assuming x is ram pointing and z is generally nadir, add...
[ "def", "init", "(", "self", ")", ":", "self", ".", "custom", ".", "add", "(", "add_quasi_dipole_coordinates", ",", "'modify'", ")", "self", ".", "custom", ".", "add", "(", "add_aacgm_coordinates", ",", "'modify'", ")", "self", ".", "custom", ".", "add", ...
Adds custom calculations to orbit simulation. This routine is run once, and only once, upon instantiation. Adds quasi-dipole coordiantes, velocity calculation in ECEF coords, adds the attitude vectors of spacecraft assuming x is ram pointing and z is generally nadir, adds ionospheric parameters fro...
[ "Adds", "custom", "calculations", "to", "orbit", "simulation", ".", "This", "routine", "is", "run", "once", "and", "only", "once", "upon", "instantiation", ".", "Adds", "quasi", "-", "dipole", "coordiantes", "velocity", "calculation", "in", "ECEF", "coords", "...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L35-L67
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
load
def load(fnames, tag=None, sat_id=None, obs_long=0., obs_lat=0., obs_alt=0., TLE1=None, TLE2=None): """ Returns data and metadata in the format required by pysat. Finds position of satellite in both ECI and ECEF co-ordinates. Routine is directl...
python
def load(fnames, tag=None, sat_id=None, obs_long=0., obs_lat=0., obs_alt=0., TLE1=None, TLE2=None): """ Returns data and metadata in the format required by pysat. Finds position of satellite in both ECI and ECEF co-ordinates. Routine is directl...
[ "def", "load", "(", "fnames", ",", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "obs_long", "=", "0.", ",", "obs_lat", "=", "0.", ",", "obs_alt", "=", "0.", ",", "TLE1", "=", "None", ",", "TLE2", "=", "None", ")", ":", "import", "sgp4", ...
Returns data and metadata in the format required by pysat. Finds position of satellite in both ECI and ECEF co-ordinates. Routine is directly called by pysat and not the user. Parameters ---------- fnames : list-like collection File name that contains date in its name. ...
[ "Returns", "data", "and", "metadata", "in", "the", "format", "required", "by", "pysat", ".", "Finds", "position", "of", "satellite", "in", "both", "ECI", "and", "ECEF", "co", "-", "ordinates", ".", "Routine", "is", "directly", "called", "by", "pysat", "and...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L69-L205
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
list_files
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a fake list of files spanning a year""" index = pds.date_range(pysat.datetime(2017,12,1), pysat.datetime(2018,12,1)) # file list is effectively just the date in string format - '%D' works only in Mac. '%x' workins in bo...
python
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a fake list of files spanning a year""" index = pds.date_range(pysat.datetime(2017,12,1), pysat.datetime(2018,12,1)) # file list is effectively just the date in string format - '%D' works only in Mac. '%x' workins in bo...
[ "def", "list_files", "(", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ")", ":", "index", "=", "pds", ".", "date_range", "(", "pysat", ".", "datetime", "(", "2017", ",", "12", ",", "...
Produce a fake list of files spanning a year
[ "Produce", "a", "fake", "list", "of", "files", "spanning", "a", "year" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L255-L261
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
add_sc_attitude_vectors
def add_sc_attitude_vectors(inst): """ Add attitude vectors for spacecraft assuming ram pointing. Presumes spacecraft is pointed along the velocity vector (x), z is generally nadir pointing (positive towards Earth), and y completes the right handed system (generally southward). ...
python
def add_sc_attitude_vectors(inst): """ Add attitude vectors for spacecraft assuming ram pointing. Presumes spacecraft is pointed along the velocity vector (x), z is generally nadir pointing (positive towards Earth), and y completes the right handed system (generally southward). ...
[ "def", "add_sc_attitude_vectors", "(", "inst", ")", ":", "import", "pysatMagVect", "# ram pointing is along velocity vector", "inst", "[", "'sc_xhat_ecef_x'", "]", ",", "inst", "[", "'sc_xhat_ecef_y'", "]", ",", "inst", "[", "'sc_xhat_ecef_z'", "]", "=", "pysatMagVect...
Add attitude vectors for spacecraft assuming ram pointing. Presumes spacecraft is pointed along the velocity vector (x), z is generally nadir pointing (positive towards Earth), and y completes the right handed system (generally southward). Notes ----- Expects velocity and positi...
[ "Add", "attitude", "vectors", "for", "spacecraft", "assuming", "ram", "pointing", ".", "Presumes", "spacecraft", "is", "pointed", "along", "the", "velocity", "vector", "(", "x", ")", "z", "is", "generally", "nadir", "pointing", "(", "positive", "towards", "Ear...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L269-L361
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
calculate_ecef_velocity
def calculate_ecef_velocity(inst): """ Calculates spacecraft velocity in ECEF frame. Presumes that the spacecraft velocity in ECEF is in the input instrument object as position_ecef_*. Uses a symmetric difference to calculate the velocity thus endpoints will be set to NaN. Routine should b...
python
def calculate_ecef_velocity(inst): """ Calculates spacecraft velocity in ECEF frame. Presumes that the spacecraft velocity in ECEF is in the input instrument object as position_ecef_*. Uses a symmetric difference to calculate the velocity thus endpoints will be set to NaN. Routine should b...
[ "def", "calculate_ecef_velocity", "(", "inst", ")", ":", "x", "=", "inst", "[", "'position_ecef_x'", "]", "vel_x", "=", "(", "x", ".", "values", "[", "2", ":", "]", "-", "x", ".", "values", "[", "0", ":", "-", "2", "]", ")", "/", "2.", "y", "="...
Calculates spacecraft velocity in ECEF frame. Presumes that the spacecraft velocity in ECEF is in the input instrument object as position_ecef_*. Uses a symmetric difference to calculate the velocity thus endpoints will be set to NaN. Routine should be run using pysat data padding feature to c...
[ "Calculates", "spacecraft", "velocity", "in", "ECEF", "frame", ".", "Presumes", "that", "the", "spacecraft", "velocity", "in", "ECEF", "is", "in", "the", "input", "instrument", "object", "as", "position_ecef_", "*", ".", "Uses", "a", "symmetric", "difference", ...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L363-L405
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
add_quasi_dipole_coordinates
def add_quasi_dipole_coordinates(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses Apexpy package to add quasi-dipole coordinates to instrument object. The Quasi-Dipole coordinate system includes both the tilt and offset of the geomag...
python
def add_quasi_dipole_coordinates(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses Apexpy package to add quasi-dipole coordinates to instrument object. The Quasi-Dipole coordinate system includes both the tilt and offset of the geomag...
[ "def", "add_quasi_dipole_coordinates", "(", "inst", ",", "glat_label", "=", "'glat'", ",", "glong_label", "=", "'glong'", ",", "alt_label", "=", "'alt'", ")", ":", "import", "apexpy", "ap", "=", "apexpy", ".", "Apex", "(", "date", "=", "inst", ".", "date",...
Uses Apexpy package to add quasi-dipole coordinates to instrument object. The Quasi-Dipole coordinate system includes both the tilt and offset of the geomagnetic field to calculate the latitude, longitude, and local time of the spacecraft with respect to the geomagnetic field. This system is ...
[ "Uses", "Apexpy", "package", "to", "add", "quasi", "-", "dipole", "coordinates", "to", "instrument", "object", ".", "The", "Quasi", "-", "Dipole", "coordinate", "system", "includes", "both", "the", "tilt", "and", "offset", "of", "the", "geomagnetic", "field", ...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L407-L462
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
add_aacgm_coordinates
def add_aacgm_coordinates(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses AACGMV2 package to add AACGM coordinates to instrument object. The Altitude Adjusted Corrected Geomagnetic Coordinates library is used to calculate the latitud...
python
def add_aacgm_coordinates(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses AACGMV2 package to add AACGM coordinates to instrument object. The Altitude Adjusted Corrected Geomagnetic Coordinates library is used to calculate the latitud...
[ "def", "add_aacgm_coordinates", "(", "inst", ",", "glat_label", "=", "'glat'", ",", "glong_label", "=", "'glong'", ",", "alt_label", "=", "'alt'", ")", ":", "import", "aacgmv2", "aalat", "=", "[", "]", "aalon", "=", "[", "]", "mlt", "=", "[", "]", "for...
Uses AACGMV2 package to add AACGM coordinates to instrument object. The Altitude Adjusted Corrected Geomagnetic Coordinates library is used to calculate the latitude, longitude, and local time of the spacecraft with respect to the geomagnetic field. Example ------- # function added...
[ "Uses", "AACGMV2", "package", "to", "add", "AACGM", "coordinates", "to", "instrument", "object", ".", "The", "Altitude", "Adjusted", "Corrected", "Geomagnetic", "Coordinates", "library", "is", "used", "to", "calculate", "the", "latitude", "longitude", "and", "loca...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L464-L516
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
add_iri_thermal_plasma
def add_iri_thermal_plasma(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses IRI (International Reference Ionosphere) model to simulate an ionosphere. Uses pyglow module to run IRI. Configured to use actual solar parameters to run model. ...
python
def add_iri_thermal_plasma(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses IRI (International Reference Ionosphere) model to simulate an ionosphere. Uses pyglow module to run IRI. Configured to use actual solar parameters to run model. ...
[ "def", "add_iri_thermal_plasma", "(", "inst", ",", "glat_label", "=", "'glat'", ",", "glong_label", "=", "'glong'", ",", "alt_label", "=", "'alt'", ")", ":", "import", "pyglow", "from", "pyglow", ".", "pyglow", "import", "Point", "iri_params", "=", "[", "]",...
Uses IRI (International Reference Ionosphere) model to simulate an ionosphere. Uses pyglow module to run IRI. Configured to use actual solar parameters to run model. Example ------- # function added velow modifies the inst object upon every inst.load call inst.custom.add(add_i...
[ "Uses", "IRI", "(", "International", "Reference", "Ionosphere", ")", "model", "to", "simulate", "an", "ionosphere", ".", "Uses", "pyglow", "module", "to", "run", "IRI", ".", "Configured", "to", "use", "actual", "solar", "parameters", "to", "run", "model", "....
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L519-L582
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
add_hwm_winds_and_ecef_vectors
def add_hwm_winds_and_ecef_vectors(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses HWM (Horizontal Wind Model) model to obtain neutral wind details. Uses pyglow module to run HWM. Configured to use actual solar parameters to run m...
python
def add_hwm_winds_and_ecef_vectors(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses HWM (Horizontal Wind Model) model to obtain neutral wind details. Uses pyglow module to run HWM. Configured to use actual solar parameters to run m...
[ "def", "add_hwm_winds_and_ecef_vectors", "(", "inst", ",", "glat_label", "=", "'glat'", ",", "glong_label", "=", "'glong'", ",", "alt_label", "=", "'alt'", ")", ":", "import", "pyglow", "import", "pysatMagVect", "hwm_params", "=", "[", "]", "for", "time", ",",...
Uses HWM (Horizontal Wind Model) model to obtain neutral wind details. Uses pyglow module to run HWM. Configured to use actual solar parameters to run model. Example ------- # function added velow modifies the inst object upon every inst.load call inst.custom.add(add_hwm_winds...
[ "Uses", "HWM", "(", "Horizontal", "Wind", "Model", ")", "model", "to", "obtain", "neutral", "wind", "details", ".", "Uses", "pyglow", "module", "to", "run", "HWM", ".", "Configured", "to", "use", "actual", "solar", "parameters", "to", "run", "model", ".", ...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L585-L681
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
add_igrf
def add_igrf(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values. Uses pyglow module to run IGRF. Configured to use actual solar parameters to run ...
python
def add_igrf(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values. Uses pyglow module to run IGRF. Configured to use actual solar parameters to run ...
[ "def", "add_igrf", "(", "inst", ",", "glat_label", "=", "'glat'", ",", "glong_label", "=", "'glong'", ",", "alt_label", "=", "'alt'", ")", ":", "import", "pyglow", "from", "pyglow", ".", "pyglow", "import", "Point", "import", "pysatMagVect", "igrf_params", "...
Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values. Uses pyglow module to run IGRF. Configured to use actual solar parameters to run model. Example ------- # function added velow modifies the inst object upon every inst.load call ins...
[ "Uses", "International", "Geomagnetic", "Reference", "Field", "(", "IGRF", ")", "model", "to", "obtain", "geomagnetic", "field", "values", ".", "Uses", "pyglow", "module", "to", "run", "IGRF", ".", "Configured", "to", "use", "actual", "solar", "parameters", "t...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L684-L765
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
add_msis
def add_msis(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses MSIS model to obtain thermospheric values. Uses pyglow module to run MSIS. Configured to use actual solar parameters to run model. Example ------- # f...
python
def add_msis(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses MSIS model to obtain thermospheric values. Uses pyglow module to run MSIS. Configured to use actual solar parameters to run model. Example ------- # f...
[ "def", "add_msis", "(", "inst", ",", "glat_label", "=", "'glat'", ",", "glong_label", "=", "'glong'", ",", "alt_label", "=", "'alt'", ")", ":", "import", "pyglow", "from", "pyglow", ".", "pyglow", "import", "Point", "msis_params", "=", "[", "]", "# print '...
Uses MSIS model to obtain thermospheric values. Uses pyglow module to run MSIS. Configured to use actual solar parameters to run model. Example ------- # function added velow modifies the inst object upon every inst.load call inst.custom.add(add_msis, 'modify', glat_label='cus...
[ "Uses", "MSIS", "model", "to", "obtain", "thermospheric", "values", ".", "Uses", "pyglow", "module", "to", "run", "MSIS", ".", "Configured", "to", "use", "actual", "solar", "parameters", "to", "run", "model", ".", "Example", "-------", "#", "function", "adde...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L768-L843
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
project_ecef_vector_onto_sc
def project_ecef_vector_onto_sc(inst, x_label, y_label, z_label, new_x_label, new_y_label, new_z_label, meta=None): """Express input vector using s/c attitude directions x - ram pointing y - generally southward z - generally nadir ...
python
def project_ecef_vector_onto_sc(inst, x_label, y_label, z_label, new_x_label, new_y_label, new_z_label, meta=None): """Express input vector using s/c attitude directions x - ram pointing y - generally southward z - generally nadir ...
[ "def", "project_ecef_vector_onto_sc", "(", "inst", ",", "x_label", ",", "y_label", ",", "z_label", ",", "new_x_label", ",", "new_y_label", ",", "new_z_label", ",", "meta", "=", "None", ")", ":", "import", "pysatMagVect", "x", ",", "y", ",", "z", "=", "pysa...
Express input vector using s/c attitude directions x - ram pointing y - generally southward z - generally nadir Parameters ---------- x_label : string Label used to get ECEF-X component of vector to be projected y_label : string Label used to get ECEF-Y component of...
[ "Express", "input", "vector", "using", "s", "/", "c", "attitude", "directions", "x", "-", "ram", "pointing", "y", "-", "generally", "southward", "z", "-", "generally", "nadir", "Parameters", "----------", "x_label", ":", "string", "Label", "used", "to", "get...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L845-L887
rstoneback/pysat
pysat/ssnl/plot.py
scatterplot
def scatterplot(inst, labelx, labely, data_label, datalim, xlim=None, ylim=None): """Return scatterplot of data_label(s) as functions of labelx,y over a season. Parameters ---------- labelx : string data product for x-axis labely : string data product for y-axis data_label : s...
python
def scatterplot(inst, labelx, labely, data_label, datalim, xlim=None, ylim=None): """Return scatterplot of data_label(s) as functions of labelx,y over a season. Parameters ---------- labelx : string data product for x-axis labely : string data product for y-axis data_label : s...
[ "def", "scatterplot", "(", "inst", ",", "labelx", ",", "labely", ",", "data_label", ",", "datalim", ",", "xlim", "=", "None", ",", "ylim", "=", "None", ")", ":", "# interactive plotting off", "plt", ".", "ioff", "(", ")", "# create figures for plotting", "fi...
Return scatterplot of data_label(s) as functions of labelx,y over a season. Parameters ---------- labelx : string data product for x-axis labely : string data product for y-axis data_label : string, array-like of strings data product(s) to be scatter plotted datalim : ...
[ "Return", "scatterplot", "of", "data_label", "(", "s", ")", "as", "functions", "of", "labelx", "y", "over", "a", "season", "." ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/ssnl/plot.py#L9-L92
emc-openstack/storops
storops/__init__.py
enable_log
def enable_log(level=logging.DEBUG): """Enable console logging. This is a utils method for try run with storops. :param level: log level, default to DEBUG """ logger = logging.getLogger(__name__) logger.setLevel(level) if not logger.handlers: logger.info('enabling logging to console...
python
def enable_log(level=logging.DEBUG): """Enable console logging. This is a utils method for try run with storops. :param level: log level, default to DEBUG """ logger = logging.getLogger(__name__) logger.setLevel(level) if not logger.handlers: logger.info('enabling logging to console...
[ "def", "enable_log", "(", "level", "=", "logging", ".", "DEBUG", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "logger", ".", "setLevel", "(", "level", ")", "if", "not", "logger", ".", "handlers", ":", "logger", ".", "info...
Enable console logging. This is a utils method for try run with storops. :param level: log level, default to DEBUG
[ "Enable", "console", "logging", "." ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/__init__.py#L30-L40
rstoneback/pysat
pysat/instruments/cosmic2013_gps.py
list_files
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '' and 'ascii'. If '' is specified, the primary d...
python
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '' and 'ascii'. If '' is specified, the primary d...
[ "def", "list_files", "(", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ")", ":", "import", "sys", "#if tag == 'ionprf':", "# # from_os constructor currently doesn't work because of the variable ", "#...
Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '' and 'ascii'. If '' is specified, the primary data type (ascii) is loaded. (default=None) sat_id : (string or None...
[ "Return", "a", "Pandas", "Series", "of", "every", "file", "for", "chosen", "satellite", "data" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cosmic2013_gps.py#L57-L122
rstoneback/pysat
pysat/instruments/cosmic2013_gps.py
load_files
def load_files(files, tag=None, sat_id=None, altitude_bin=None): '''Loads a list of COSMIC data files, supplied by user. Returns a list of dicts, a dict for each file. ''' output = [None]*len(files) drop_idx = [] for (i,file) in enumerate(files): try: #data = net...
python
def load_files(files, tag=None, sat_id=None, altitude_bin=None): '''Loads a list of COSMIC data files, supplied by user. Returns a list of dicts, a dict for each file. ''' output = [None]*len(files) drop_idx = [] for (i,file) in enumerate(files): try: #data = net...
[ "def", "load_files", "(", "files", ",", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "altitude_bin", "=", "None", ")", ":", "output", "=", "[", "None", "]", "*", "len", "(", "files", ")", "drop_idx", "=", "[", "]", "for", "(", "i", ",", ...
Loads a list of COSMIC data files, supplied by user. Returns a list of dicts, a dict for each file.
[ "Loads", "a", "list", "of", "COSMIC", "data", "files", "supplied", "by", "user", ".", "Returns", "a", "list", "of", "dicts", "a", "dict", "for", "each", "file", "." ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cosmic2013_gps.py#L172-L224
emc-openstack/storops
storops/vnx/calculator.py
round_60
def round_60(value): """ round the number to the multiple of 60 Say a random value is represented by: 60 * n + r n is an integer and r is an integer between 0 and 60. if r < 30, the result is 60 * n. otherwise, the result is 60 * (n + 1) The use of this function is that the counter refreshment...
python
def round_60(value): """ round the number to the multiple of 60 Say a random value is represented by: 60 * n + r n is an integer and r is an integer between 0 and 60. if r < 30, the result is 60 * n. otherwise, the result is 60 * (n + 1) The use of this function is that the counter refreshment...
[ "def", "round_60", "(", "value", ")", ":", "t", "=", "60", "if", "value", "is", "not", "None", ":", "r", "=", "value", "%", "t", "if", "r", ">", "t", "/", "2", ":", "ret", "=", "value", "+", "(", "t", "-", "r", ")", "else", ":", "ret", "=...
round the number to the multiple of 60 Say a random value is represented by: 60 * n + r n is an integer and r is an integer between 0 and 60. if r < 30, the result is 60 * n. otherwise, the result is 60 * (n + 1) The use of this function is that the counter refreshment on VNX is always 1 minut...
[ "round", "the", "number", "to", "the", "multiple", "of", "60" ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L85-L108
emc-openstack/storops
storops/vnx/calculator.py
utilization
def utilization(prev, curr, counters): """ calculate the utilization delta_busy = curr.busy - prev.busy delta_idle = curr.idle - prev.idle utilization = delta_busy / (delta_busy + delta_idle) :param prev: previous resource :param curr: current resource :param counters: list of two, busy ti...
python
def utilization(prev, curr, counters): """ calculate the utilization delta_busy = curr.busy - prev.busy delta_idle = curr.idle - prev.idle utilization = delta_busy / (delta_busy + delta_idle) :param prev: previous resource :param curr: current resource :param counters: list of two, busy ti...
[ "def", "utilization", "(", "prev", ",", "curr", ",", "counters", ")", ":", "busy_prop", ",", "idle_prop", "=", "counters", "pb", "=", "getattr", "(", "prev", ",", "busy_prop", ")", "pi", "=", "getattr", "(", "prev", ",", "idle_prop", ")", "cb", "=", ...
calculate the utilization delta_busy = curr.busy - prev.busy delta_idle = curr.idle - prev.idle utilization = delta_busy / (delta_busy + delta_idle) :param prev: previous resource :param curr: current resource :param counters: list of two, busy ticks and idle ticks :return: value, NaN if i...
[ "calculate", "the", "utilization" ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L138-L161
emc-openstack/storops
storops/vnx/calculator.py
delta_ps
def delta_ps(prev, curr, counters): """ calculate the delta per second of one counter formula: (curr - prev) / delta_time :param prev: previous resource :param curr: current resource :param counters: the counter to do delta and per second, one only :return: value, NaN if invalid. """ co...
python
def delta_ps(prev, curr, counters): """ calculate the delta per second of one counter formula: (curr - prev) / delta_time :param prev: previous resource :param curr: current resource :param counters: the counter to do delta and per second, one only :return: value, NaN if invalid. """ co...
[ "def", "delta_ps", "(", "prev", ",", "curr", ",", "counters", ")", ":", "counter", "=", "get_counter", "(", "counters", ")", "pv", "=", "getattr", "(", "prev", ",", "counter", ")", "cv", "=", "getattr", "(", "curr", ",", "counter", ")", "return", "mi...
calculate the delta per second of one counter formula: (curr - prev) / delta_time :param prev: previous resource :param curr: current resource :param counters: the counter to do delta and per second, one only :return: value, NaN if invalid.
[ "calculate", "the", "delta", "per", "second", "of", "one", "counter" ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L170-L183
emc-openstack/storops
storops/vnx/calculator.py
io_size_kb
def io_size_kb(prev, curr, counters): """ calculate the io size based on bandwidth and throughput formula: average_io_size = bandwidth / throughput :param prev: prev resource, not used :param curr: current resource :param counters: two stats, bandwidth in MB and throughput count :return: value,...
python
def io_size_kb(prev, curr, counters): """ calculate the io size based on bandwidth and throughput formula: average_io_size = bandwidth / throughput :param prev: prev resource, not used :param curr: current resource :param counters: two stats, bandwidth in MB and throughput count :return: value,...
[ "def", "io_size_kb", "(", "prev", ",", "curr", ",", "counters", ")", ":", "bw_stats", ",", "io_stats", "=", "counters", "size_mb", "=", "div", "(", "getattr", "(", "curr", ",", "bw_stats", ")", ",", "getattr", "(", "curr", ",", "io_stats", ")", ")", ...
calculate the io size based on bandwidth and throughput formula: average_io_size = bandwidth / throughput :param prev: prev resource, not used :param curr: current resource :param counters: two stats, bandwidth in MB and throughput count :return: value, NaN if invalid
[ "calculate", "the", "io", "size", "based", "on", "bandwidth", "and", "throughput" ]
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L187-L198
rstoneback/pysat
pysat/instruments/champ_star.py
list_files
def list_files(tag='', sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '' and 'ascii'. If '' is specified, the primary dat...
python
def list_files(tag='', sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '' and 'ascii'. If '' is specified, the primary dat...
[ "def", "list_files", "(", "tag", "=", "''", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ")", ":", "if", "format_str", "is", "None", "and", "tag", "is", "not", "None", ":", "if", "tag", "==", "''", "or"...
Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '' and 'ascii'. If '' is specified, the primary data type (ascii) is loaded. (default='') sat_id : (string or NoneTy...
[ "Return", "a", "Pandas", "Series", "of", "every", "file", "for", "chosen", "satellite", "data" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/champ_star.py#L39-L75
rstoneback/pysat
pysat/instruments/champ_star.py
load
def load(fnames, tag=None, sat_id=None): """Load CHAMP STAR files Parameters ------------ fnames : (pandas.Series) Series of filenames tag : (str or NoneType) tag or None (default=None) sat_id : (str or NoneType) satellite id or None (default=None) Returns -----...
python
def load(fnames, tag=None, sat_id=None): """Load CHAMP STAR files Parameters ------------ fnames : (pandas.Series) Series of filenames tag : (str or NoneType) tag or None (default=None) sat_id : (str or NoneType) satellite id or None (default=None) Returns -----...
[ "def", "load", "(", "fnames", ",", "tag", "=", "None", ",", "sat_id", "=", "None", ")", ":", "import", "re", "if", "len", "(", "fnames", ")", "<=", "0", ":", "return", "pysat", ".", "DataFrame", "(", "None", ")", ",", "pysat", ".", "Meta", "(", ...
Load CHAMP STAR files Parameters ------------ fnames : (pandas.Series) Series of filenames tag : (str or NoneType) tag or None (default=None) sat_id : (str or NoneType) satellite id or None (default=None) Returns --------- data : (pandas.DataFrame) Objec...
[ "Load", "CHAMP", "STAR", "files" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/champ_star.py#L78-L193
rstoneback/pysat
pysat/_instrument.py
Instrument._assign_funcs
def _assign_funcs(self, by_name=False, inst_module=None): """Assign all external science instrument methods to Instrument object. """ import importlib # set defaults self._list_rtn = self._pass_func self._load_rtn = self._pass_func self._default_rtn = self...
python
def _assign_funcs(self, by_name=False, inst_module=None): """Assign all external science instrument methods to Instrument object. """ import importlib # set defaults self._list_rtn = self._pass_func self._load_rtn = self._pass_func self._default_rtn = self...
[ "def", "_assign_funcs", "(", "self", ",", "by_name", "=", "False", ",", "inst_module", "=", "None", ")", ":", "import", "importlib", "# set defaults", "self", ".", "_list_rtn", "=", "self", ".", "_pass_func", "self", ".", "_load_rtn", "=", "self", ".", "_p...
Assign all external science instrument methods to Instrument object.
[ "Assign", "all", "external", "science", "instrument", "methods", "to", "Instrument", "object", "." ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L452-L515
rstoneback/pysat
pysat/_instrument.py
Instrument._load_data
def _load_data(self, date=None, fid=None): """ Load data for an instrument on given date or fid, dependng upon input. Parameters ------------ date : (dt.datetime.date object or NoneType) file date fid : (int or NoneType) filename index value ...
python
def _load_data(self, date=None, fid=None): """ Load data for an instrument on given date or fid, dependng upon input. Parameters ------------ date : (dt.datetime.date object or NoneType) file date fid : (int or NoneType) filename index value ...
[ "def", "_load_data", "(", "self", ",", "date", "=", "None", ",", "fid", "=", "None", ")", ":", "if", "fid", "is", "not", "None", ":", "# get filename based off of index value", "fname", "=", "self", ".", "files", "[", "fid", ":", "fid", "+", "1", "]", ...
Load data for an instrument on given date or fid, dependng upon input. Parameters ------------ date : (dt.datetime.date object or NoneType) file date fid : (int or NoneType) filename index value Returns -------- data : (pds.DataFrame) ...
[ "Load", "data", "for", "an", "instrument", "on", "given", "date", "or", "fid", "dependng", "upon", "input", "." ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L592-L664
rstoneback/pysat
pysat/_instrument.py
Instrument._load_next
def _load_next(self): """Load the next days data (or file) without incrementing the date. Repeated calls will not advance date/file and will produce the same data Uses info stored in object to either increment the date, or the file. Looks for self._load_by_date flag. ...
python
def _load_next(self): """Load the next days data (or file) without incrementing the date. Repeated calls will not advance date/file and will produce the same data Uses info stored in object to either increment the date, or the file. Looks for self._load_by_date flag. ...
[ "def", "_load_next", "(", "self", ")", ":", "if", "self", ".", "_load_by_date", ":", "next_date", "=", "self", ".", "date", "+", "pds", ".", "DateOffset", "(", "days", "=", "1", ")", "return", "self", ".", "_load_data", "(", "date", "=", "next_date", ...
Load the next days data (or file) without incrementing the date. Repeated calls will not advance date/file and will produce the same data Uses info stored in object to either increment the date, or the file. Looks for self._load_by_date flag.
[ "Load", "the", "next", "days", "data", "(", "or", "file", ")", "without", "incrementing", "the", "date", ".", "Repeated", "calls", "will", "not", "advance", "date", "/", "file", "and", "will", "produce", "the", "same", "data", "Uses", "info", "stored", "...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L666-L678
rstoneback/pysat
pysat/_instrument.py
Instrument._load_prev
def _load_prev(self): """Load the next days data (or file) without decrementing the date. Repeated calls will not decrement date/file and will produce the same data Uses info stored in object to either decrement the date, or the file. Looks for self._load_by_date flag. ...
python
def _load_prev(self): """Load the next days data (or file) without decrementing the date. Repeated calls will not decrement date/file and will produce the same data Uses info stored in object to either decrement the date, or the file. Looks for self._load_by_date flag. ...
[ "def", "_load_prev", "(", "self", ")", ":", "if", "self", ".", "_load_by_date", ":", "prev_date", "=", "self", ".", "date", "-", "pds", ".", "DateOffset", "(", "days", "=", "1", ")", "return", "self", ".", "_load_data", "(", "date", "=", "prev_date", ...
Load the next days data (or file) without decrementing the date. Repeated calls will not decrement date/file and will produce the same data Uses info stored in object to either decrement the date, or the file. Looks for self._load_by_date flag.
[ "Load", "the", "next", "days", "data", "(", "or", "file", ")", "without", "decrementing", "the", "date", ".", "Repeated", "calls", "will", "not", "decrement", "date", "/", "file", "and", "will", "produce", "the", "same", "data", "Uses", "info", "stored", ...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L680-L694
rstoneback/pysat
pysat/_instrument.py
Instrument.load
def load(self, yr=None, doy=None, date=None, fname=None, fid=None, verifyPad=False): """Load instrument data into Instrument object .data. Parameters ---------- yr : integer year for desired data doy : integer day of year date : date...
python
def load(self, yr=None, doy=None, date=None, fname=None, fid=None, verifyPad=False): """Load instrument data into Instrument object .data. Parameters ---------- yr : integer year for desired data doy : integer day of year date : date...
[ "def", "load", "(", "self", ",", "yr", "=", "None", ",", "doy", "=", "None", ",", "date", "=", "None", ",", "fname", "=", "None", ",", "fid", "=", "None", ",", "verifyPad", "=", "False", ")", ":", "# set options used by loading routine based upon user inpu...
Load instrument data into Instrument object .data. Parameters ---------- yr : integer year for desired data doy : integer day of year date : datetime object date to load fname : 'string' filename to be loaded verify...
[ "Load", "instrument", "data", "into", "Instrument", "object", ".", "data", "." ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L709-L916
rstoneback/pysat
pysat/_instrument.py
Instrument.download
def download(self, start, stop, freq='D', user=None, password=None, **kwargs): """Download data for given Instrument object from start to stop. Parameters ---------- start : pandas.datetime start date to download data stop : pandas.datetime ...
python
def download(self, start, stop, freq='D', user=None, password=None, **kwargs): """Download data for given Instrument object from start to stop. Parameters ---------- start : pandas.datetime start date to download data stop : pandas.datetime ...
[ "def", "download", "(", "self", ",", "start", ",", "stop", ",", "freq", "=", "'D'", ",", "user", "=", "None", ",", "password", "=", "None", ",", "*", "*", "kwargs", ")", ":", "import", "errno", "# make sure directories are there, otherwise create them", "try...
Download data for given Instrument object from start to stop. Parameters ---------- start : pandas.datetime start date to download data stop : pandas.datetime stop date to download data freq : string Stepsize between dates for season, ...
[ "Download", "data", "for", "given", "Instrument", "object", "from", "start", "to", "stop", ".", "Parameters", "----------", "start", ":", "pandas", ".", "datetime", "start", "date", "to", "download", "data", "stop", ":", "pandas", ".", "datetime", "stop", "d...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L918-L980
rstoneback/pysat
pysat/_instrument.py
Instrument.next
def next(self, verifyPad=False): """Manually iterate through the data loaded in Instrument object. Bounds of iteration and iteration type (day/file) are set by `bounds` attribute. Note ---- If there were no previous calls to load then the first...
python
def next(self, verifyPad=False): """Manually iterate through the data loaded in Instrument object. Bounds of iteration and iteration type (day/file) are set by `bounds` attribute. Note ---- If there were no previous calls to load then the first...
[ "def", "next", "(", "self", ",", "verifyPad", "=", "False", ")", ":", "if", "self", ".", "_iter_type", "==", "'date'", ":", "if", "self", ".", "date", "is", "not", "None", ":", "idx", ",", "=", "np", ".", "where", "(", "self", ".", "_iter_list", ...
Manually iterate through the data loaded in Instrument object. Bounds of iteration and iteration type (day/file) are set by `bounds` attribute. Note ---- If there were no previous calls to load then the first day(default)/file will be loaded.
[ "Manually", "iterate", "through", "the", "data", "loaded", "in", "Instrument", "object", ".", "Bounds", "of", "iteration", "and", "iteration", "type", "(", "day", "/", "file", ")", "are", "set", "by", "bounds", "attribute", ".", "Note", "----", "If", "ther...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1132-L1168
rstoneback/pysat
pysat/_instrument.py
Instrument._get_var_type_code
def _get_var_type_code(self, coltype): '''Determines the two-character type code for a given variable type Parameters ---------- coltype : type or np.dtype The type of the variable Returns ------- str The variable type code for the given ...
python
def _get_var_type_code(self, coltype): '''Determines the two-character type code for a given variable type Parameters ---------- coltype : type or np.dtype The type of the variable Returns ------- str The variable type code for the given ...
[ "def", "_get_var_type_code", "(", "self", ",", "coltype", ")", ":", "if", "type", "(", "coltype", ")", "is", "np", ".", "dtype", ":", "var_type", "=", "coltype", ".", "kind", "+", "str", "(", "coltype", ".", "itemsize", ")", "return", "var_type", "else...
Determines the two-character type code for a given variable type Parameters ---------- coltype : type or np.dtype The type of the variable Returns ------- str The variable type code for the given type
[ "Determines", "the", "two", "-", "character", "type", "code", "for", "a", "given", "variable", "type" ]
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1208-L1248