hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
6da5fd1978588b8f18272b4acfc45c0e4ec22108
timgates42/django-model-report
model_report/report.py
[ "BSD-3-Clause" ]
Python
cache_return
<not_specific>
def cache_return(fun): """ Usages of this decorator have been removed from the ReportAdmin base class. Caching method returns gets in the way of customization at the implementation level now that report instances can be modified based on request data. """ def wrap(self, *args, **kwargs): ...
Usages of this decorator have been removed from the ReportAdmin base class. Caching method returns gets in the way of customization at the implementation level now that report instances can be modified based on request data.
Usages of this decorator have been removed from the ReportAdmin base class. Caching method returns gets in the way of customization at the implementation level now that report instances can be modified based on request data.
[ "Usages", "of", "this", "decorator", "have", "been", "removed", "from", "the", "ReportAdmin", "base", "class", ".", "Caching", "method", "returns", "gets", "in", "the", "way", "of", "customization", "at", "the", "implementation", "level", "now", "that", "repor...
def cache_return(fun): def wrap(self, *args, **kwargs): cache_field = '%s_%s' % (self.__class__.__name__, fun.func_name) if cache_field in _cache_class: return _cache_class[cache_field] result = fun(self, *args, **kwargs) _cache_class[cache_field] = result return ...
[ "def", "cache_return", "(", "fun", ")", ":", "def", "wrap", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "cache_field", "=", "'%s_%s'", "%", "(", "self", ".", "__class__", ".", "__name__", ",", "fun", ".", "func_name", ")", "if", "...
Usages of this decorator have been removed from the ReportAdmin base class.
[ "Usages", "of", "this", "decorator", "have", "been", "removed", "from", "the", "ReportAdmin", "base", "class", "." ]
[ "\"\"\"\n Usages of this decorator have been removed from the ReportAdmin base class.\n\n Caching method returns gets in the way of customization at the implementation level\n now that report instances can be modified based on request data.\n \"\"\"" ]
[ { "param": "fun", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fun", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ecf255e9031ec886e0384ac274954ec2e38d00a4
Abraxas-Biosystems/eve-neo4j
eve_neo4j/neo4j.py
[ "MIT" ]
Python
_set_resource_defaults
null
def _set_resource_defaults(self, resource, settings): """Low-level method which sets default values for one resource. """ settings.setdefault('datasource', {}) ds = settings['datasource'] ds.setdefault('relation', False)
Low-level method which sets default values for one resource.
Low-level method which sets default values for one resource.
[ "Low", "-", "level", "method", "which", "sets", "default", "values", "for", "one", "resource", "." ]
def _set_resource_defaults(self, resource, settings): settings.setdefault('datasource', {}) ds = settings['datasource'] ds.setdefault('relation', False)
[ "def", "_set_resource_defaults", "(", "self", ",", "resource", ",", "settings", ")", ":", "settings", ".", "setdefault", "(", "'datasource'", ",", "{", "}", ")", "ds", "=", "settings", "[", "'datasource'", "]", "ds", ".", "setdefault", "(", "'relation'", "...
Low-level method which sets default values for one resource.
[ "Low", "-", "level", "method", "which", "sets", "default", "values", "for", "one", "resource", "." ]
[ "\"\"\"Low-level method which sets default values for one resource.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "resource", "type": null }, { "param": "settings", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "resource", "type": null, "docstring": null, "docstring_tokens...
ecf255e9031ec886e0384ac274954ec2e38d00a4
Abraxas-Biosystems/eve-neo4j
eve_neo4j/neo4j.py
[ "MIT" ]
Python
register_schema
null
def register_schema(self, app): """Register schema for Neo4j indexes. :param app: Flask application instance. """ for k, v in app.config['DOMAIN'].items(): if 'datasource' in v and 'source' in v['datasource']: label = v['datasource']['source'] els...
Register schema for Neo4j indexes. :param app: Flask application instance.
Register schema for Neo4j indexes.
[ "Register", "schema", "for", "Neo4j", "indexes", "." ]
def register_schema(self, app): for k, v in app.config['DOMAIN'].items(): if 'datasource' in v and 'source' in v['datasource']: label = v['datasource']['source'] else: label = k if 'id_field' in v: id_field = v['id_field'] ...
[ "def", "register_schema", "(", "self", ",", "app", ")", ":", "for", "k", ",", "v", "in", "app", ".", "config", "[", "'DOMAIN'", "]", ".", "items", "(", ")", ":", "if", "'datasource'", "in", "v", "and", "'source'", "in", "v", "[", "'datasource'", "]...
Register schema for Neo4j indexes.
[ "Register", "schema", "for", "Neo4j", "indexes", "." ]
[ "\"\"\"Register schema for Neo4j indexes.\n\n :param app: Flask application instance.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "app", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "app", "type": null, "docstring": "Flask application instance.", ...
ecf255e9031ec886e0384ac274954ec2e38d00a4
Abraxas-Biosystems/eve-neo4j
eve_neo4j/neo4j.py
[ "MIT" ]
Python
find
<not_specific>
def find(self, resource, req, sub_resource_lookup): """ Retrieves a set of documents matching a given request. :param resource: resource being accessed. You should then use the ``datasource`` helper function to retrieve both the db collection/table and ...
Retrieves a set of documents matching a given request. :param resource: resource being accessed. You should then use the ``datasource`` helper function to retrieve both the db collection/table and base query (filter), if any. :...
Retrieves a set of documents matching a given request.
[ "Retrieves", "a", "set", "of", "documents", "matching", "a", "given", "request", "." ]
def find(self, resource, req, sub_resource_lookup): label, filter_, fields, sort = self._datasource_ex(resource, []) selected = self.driver.select(label) if req.where: properties = json.loads(req.where) selected = selected.where(**properties) if req.max_results: ...
[ "def", "find", "(", "self", ",", "resource", ",", "req", ",", "sub_resource_lookup", ")", ":", "label", ",", "filter_", ",", "fields", ",", "sort", "=", "self", ".", "_datasource_ex", "(", "resource", ",", "[", "]", ")", "selected", "=", "self", ".", ...
Retrieves a set of documents matching a given request.
[ "Retrieves", "a", "set", "of", "documents", "matching", "a", "given", "request", "." ]
[ "\"\"\" Retrieves a set of documents matching a given request.\n\n :param resource: resource being accessed. You should then use\n the ``datasource`` helper function to retrieve both\n the db collection/table and base query (filter), if\n ...
[ { "param": "self", "type": null }, { "param": "resource", "type": null }, { "param": "req", "type": null }, { "param": "sub_resource_lookup", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "resource", "type": null, "docstring": "resource being accessed. You...
ecf255e9031ec886e0384ac274954ec2e38d00a4
Abraxas-Biosystems/eve-neo4j
eve_neo4j/neo4j.py
[ "MIT" ]
Python
insert
<not_specific>
def insert(self, resource, doc_or_docs): """ Inserts a document as a node with a label. :param resource: resource being accessed. :param doc_or_docs: json document or list of json documents to be added to the database. """ indexes = [] label, ...
Inserts a document as a node with a label. :param resource: resource being accessed. :param doc_or_docs: json document or list of json documents to be added to the database.
Inserts a document as a node with a label.
[ "Inserts", "a", "document", "as", "a", "node", "with", "a", "label", "." ]
def insert(self, resource, doc_or_docs): indexes = [] label, _, _, _ = self._datasource_ex(resource, []) id_field = config.DOMAIN[resource]['id_field'] relation = config.DOMAIN[resource]['datasource']['relation'] schema = config.DOMAIN[resource]['schema'] tx = self.driver...
[ "def", "insert", "(", "self", ",", "resource", ",", "doc_or_docs", ")", ":", "indexes", "=", "[", "]", "label", ",", "_", ",", "_", ",", "_", "=", "self", ".", "_datasource_ex", "(", "resource", ",", "[", "]", ")", "id_field", "=", "config", ".", ...
Inserts a document as a node with a label.
[ "Inserts", "a", "document", "as", "a", "node", "with", "a", "label", "." ]
[ "\"\"\" Inserts a document as a node with a label.\n\n :param resource: resource being accessed.\n :param doc_or_docs: json document or list of json documents to be added\n to the database.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "resource", "type": null }, { "param": "doc_or_docs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "resource", "type": null, "docstring": "resource being accessed.", ...
ecf255e9031ec886e0384ac274954ec2e38d00a4
Abraxas-Biosystems/eve-neo4j
eve_neo4j/neo4j.py
[ "MIT" ]
Python
remove
null
def remove(self, resource, lookup={}): """ Removes a node or an entire set of nodes from a graph label. :param resource: resource being accessed. You should then use the ``datasource`` helper function to retrieve the actual datasource name. :par...
Removes a node or an entire set of nodes from a graph label. :param resource: resource being accessed. You should then use the ``datasource`` helper function to retrieve the actual datasource name. :param lookup: a dict with the query that documents mu...
Removes a node or an entire set of nodes from a graph label.
[ "Removes", "a", "node", "or", "an", "entire", "set", "of", "nodes", "from", "a", "graph", "label", "." ]
def remove(self, resource, lookup={}): datasource, filter_, _, _ = self._datasource_ex(resource, lookup) nodes = self.driver.select(datasource, **filter_) tx = self.driver.graph.begin() for node in nodes: remote_node = node.__remote__ if remote_node: ...
[ "def", "remove", "(", "self", ",", "resource", ",", "lookup", "=", "{", "}", ")", ":", "datasource", ",", "filter_", ",", "_", ",", "_", "=", "self", ".", "_datasource_ex", "(", "resource", ",", "lookup", ")", "nodes", "=", "self", ".", "driver", "...
Removes a node or an entire set of nodes from a graph label.
[ "Removes", "a", "node", "or", "an", "entire", "set", "of", "nodes", "from", "a", "graph", "label", "." ]
[ "\"\"\" Removes a node or an entire set of nodes from a graph label.\n\n :param resource: resource being accessed. You should then use\n the ``datasource`` helper function to retrieve\n the actual datasource name.\n :param lookup: a dict with the query t...
[ { "param": "self", "type": null }, { "param": "resource", "type": null }, { "param": "lookup", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "resource", "type": null, "docstring": "resource being accessed. You...
4b6f8b7a19b4b8aeb4cd277cf774668642630ee8
dhartung/python-glove-loader
glove/GloveEmbeddings.py
[ "MIT" ]
Python
load
'Embedding'
def load(filename: str, keep_in_memory: bool = True, check_embedding_health=False) -> 'Embedding': """ Loads an embedding file and returns a new Embedding instance. Parameters: filename: The path of the file keep_in_memory: Whether all embeddings should be load to the m...
Loads an embedding file and returns a new Embedding instance. Parameters: filename: The path of the file keep_in_memory: Whether all embeddings should be load to the memory. If this flag is set to false, the file will be read once to index the embedding and wor...
Loads an embedding file and returns a new Embedding instance.
[ "Loads", "an", "embedding", "file", "and", "returns", "a", "new", "Embedding", "instance", "." ]
def load(filename: str, keep_in_memory: bool = True, check_embedding_health=False) -> 'Embedding': if keep_in_memory: return InMemoryEmbedding.load_from_file(filename, check_embedding_health) else: return FileBasedEmbedding.load_from_file(filename, check_embedding_health)
[ "def", "load", "(", "filename", ":", "str", ",", "keep_in_memory", ":", "bool", "=", "True", ",", "check_embedding_health", "=", "False", ")", "->", "'Embedding'", ":", "if", "keep_in_memory", ":", "return", "InMemoryEmbedding", ".", "load_from_file", "(", "fi...
Loads an embedding file and returns a new Embedding instance.
[ "Loads", "an", "embedding", "file", "and", "returns", "a", "new", "Embedding", "instance", "." ]
[ "\"\"\"\n Loads an embedding file and returns a new Embedding instance.\n\n Parameters:\n filename: The path of the file\n\n keep_in_memory: Whether all embeddings should be load to the memory. If this flag is set\n to false, the file will be read once to index the...
[ { "param": "filename", "type": "str" }, { "param": "keep_in_memory", "type": "bool" }, { "param": "check_embedding_health", "type": null } ]
{ "returns": [ { "docstring": "An embedding object", "docstring_tokens": [ "An", "embedding", "object" ], "type": null } ], "raises": [], "params": [ { "identifier": "filename", "type": "str", "docstring": "The path of the file", ...
4b6f8b7a19b4b8aeb4cd277cf774668642630ee8
dhartung/python-glove-loader
glove/GloveEmbeddings.py
[ "MIT" ]
Python
embedding_size
<not_specific>
def embedding_size(self): """ Returns the size (dimension) of the embedding """ return self.__embedding_size
Returns the size (dimension) of the embedding
Returns the size (dimension) of the embedding
[ "Returns", "the", "size", "(", "dimension", ")", "of", "the", "embedding" ]
def embedding_size(self): return self.__embedding_size
[ "def", "embedding_size", "(", "self", ")", ":", "return", "self", ".", "__embedding_size" ]
Returns the size (dimension) of the embedding
[ "Returns", "the", "size", "(", "dimension", ")", "of", "the", "embedding" ]
[ "\"\"\"\n Returns the size (dimension) of the embedding\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4b6f8b7a19b4b8aeb4cd277cf774668642630ee8
dhartung/python-glove-loader
glove/GloveEmbeddings.py
[ "MIT" ]
Python
create_random_oov_vectors
<not_specific>
def create_random_oov_vectors(self): """ Indicates the behavior if a word is not presented in the vocabulary. True: A unique random vector is returned False: A zero filled vector is returned """ return self.rand_vector_for_oov
Indicates the behavior if a word is not presented in the vocabulary. True: A unique random vector is returned False: A zero filled vector is returned
Indicates the behavior if a word is not presented in the vocabulary. True: A unique random vector is returned False: A zero filled vector is returned
[ "Indicates", "the", "behavior", "if", "a", "word", "is", "not", "presented", "in", "the", "vocabulary", ".", "True", ":", "A", "unique", "random", "vector", "is", "returned", "False", ":", "A", "zero", "filled", "vector", "is", "returned" ]
def create_random_oov_vectors(self): return self.rand_vector_for_oov
[ "def", "create_random_oov_vectors", "(", "self", ")", ":", "return", "self", ".", "rand_vector_for_oov" ]
Indicates the behavior if a word is not presented in the vocabulary.
[ "Indicates", "the", "behavior", "if", "a", "word", "is", "not", "presented", "in", "the", "vocabulary", "." ]
[ "\"\"\"\n Indicates the behavior if a word is not presented in the vocabulary.\n True: A unique random vector is returned\n False: A zero filled vector is returned\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4b6f8b7a19b4b8aeb4cd277cf774668642630ee8
dhartung/python-glove-loader
glove/GloveEmbeddings.py
[ "MIT" ]
Python
create_random_oov_vectors
null
def create_random_oov_vectors(self, value: bool): """ Indicates the behavior if a word is not presented in the vocabulary. True: A unique random vector is returned False: A zero filled vector is returned """ self.rand_vector_for_oov = value
Indicates the behavior if a word is not presented in the vocabulary. True: A unique random vector is returned False: A zero filled vector is returned
Indicates the behavior if a word is not presented in the vocabulary. True: A unique random vector is returned False: A zero filled vector is returned
[ "Indicates", "the", "behavior", "if", "a", "word", "is", "not", "presented", "in", "the", "vocabulary", ".", "True", ":", "A", "unique", "random", "vector", "is", "returned", "False", ":", "A", "zero", "filled", "vector", "is", "returned" ]
def create_random_oov_vectors(self, value: bool): self.rand_vector_for_oov = value
[ "def", "create_random_oov_vectors", "(", "self", ",", "value", ":", "bool", ")", ":", "self", ".", "rand_vector_for_oov", "=", "value" ]
Indicates the behavior if a word is not presented in the vocabulary.
[ "Indicates", "the", "behavior", "if", "a", "word", "is", "not", "presented", "in", "the", "vocabulary", "." ]
[ "\"\"\"\n Indicates the behavior if a word is not presented in the vocabulary.\n True: A unique random vector is returned\n False: A zero filled vector is returned\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": "bool", "docstring": null, "docstring_tokens"...
3f7ac5281602fb470d71e0c542352e1df456afea
Alwaysproblem/AutoGP
autogp/datasets/mnist.py
[ "Apache-2.0" ]
Python
import_mnist
<not_specific>
def import_mnist(validation_size=0): """ This import mnist and saves the data as an object of our DataSet class :param concat_val: Concatenate training and validation :return: """ SOURCE_URL = 'http://yann.lecun.com/exdb/mnist/' TRAIN_IMAGES = 'train-images-idx3-ubyte.gz' TRAIN_LABELS = ...
This import mnist and saves the data as an object of our DataSet class :param concat_val: Concatenate training and validation :return:
This import mnist and saves the data as an object of our DataSet class
[ "This", "import", "mnist", "and", "saves", "the", "data", "as", "an", "object", "of", "our", "DataSet", "class" ]
def import_mnist(validation_size=0): SOURCE_URL = 'http://yann.lecun.com/exdb/mnist/' TRAIN_IMAGES = 'train-images-idx3-ubyte.gz' TRAIN_LABELS = 'train-labels-idx1-ubyte.gz' TEST_IMAGES = 't10k-images-idx3-ubyte.gz' TEST_LABELS = 't10k-labels-idx1-ubyte.gz' ONE_HOT = True TRAIN_DIR = 'experi...
[ "def", "import_mnist", "(", "validation_size", "=", "0", ")", ":", "SOURCE_URL", "=", "'http://yann.lecun.com/exdb/mnist/'", "TRAIN_IMAGES", "=", "'train-images-idx3-ubyte.gz'", "TRAIN_LABELS", "=", "'train-labels-idx1-ubyte.gz'", "TEST_IMAGES", "=", "'t10k-images-idx3-ubyte.gz...
This import mnist and saves the data as an object of our DataSet class
[ "This", "import", "mnist", "and", "saves", "the", "data", "as", "an", "object", "of", "our", "DataSet", "class" ]
[ "\"\"\"\n This import mnist and saves the data as an object of our DataSet class\n :param concat_val: Concatenate training and validation\n :return:\n \"\"\"", "# process images", "# standardize data" ]
[ { "param": "validation_size", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "validation_size", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optiona...
f5b716d8fa0137e69c91129e8d64c92b97f8a9a2
Alwaysproblem/AutoGP
experiments/sarcos.py
[ "Apache-2.0" ]
Python
sarcos_all_joints_data
<not_specific>
def sarcos_all_joints_data(): """ Loads and returns data of SARCOS dataset for all joints. Returns ------- data : list A list of length = 1, where each element is a dictionary which contains ``train_outputs``, ``train_inputs``, ``test_outputs``, ``test_inputs``, and ``id`` """ ...
Loads and returns data of SARCOS dataset for all joints. Returns ------- data : list A list of length = 1, where each element is a dictionary which contains ``train_outputs``, ``train_inputs``, ``test_outputs``, ``test_inputs``, and ``id``
Loads and returns data of SARCOS dataset for all joints. Returns
[ "Loads", "and", "returns", "data", "of", "SARCOS", "dataset", "for", "all", "joints", ".", "Returns" ]
def sarcos_all_joints_data(): train = sio.loadmat(TRAIN_PATH)['sarcos_inv'] test = sio.loadmat(TEST_PATH)['sarcos_inv_test'] return{ 'train_inputs': train[:, :21], 'train_outputs': train[:, 21:], 'test_inputs': test[:, :21], 'test_outputs': test[:, 21:], 'id': 0 }
[ "def", "sarcos_all_joints_data", "(", ")", ":", "train", "=", "sio", ".", "loadmat", "(", "TRAIN_PATH", ")", "[", "'sarcos_inv'", "]", "test", "=", "sio", ".", "loadmat", "(", "TEST_PATH", ")", "[", "'sarcos_inv_test'", "]", "return", "{", "'train_inputs'", ...
Loads and returns data of SARCOS dataset for all joints.
[ "Loads", "and", "returns", "data", "of", "SARCOS", "dataset", "for", "all", "joints", "." ]
[ "\"\"\"\n Loads and returns data of SARCOS dataset for all joints.\n\n Returns\n -------\n data : list\n A list of length = 1, where each element is a dictionary which contains ``train_outputs``,\n ``train_inputs``, ``test_outputs``, ``test_inputs``, and ``id``\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
d011eb66659e460212ba68395b204300d9af0fea
Alwaysproblem/AutoGP
autogp/gaussian_process.py
[ "Apache-2.0" ]
Python
fit
null
def fit(self, data, optimizer, loo_steps=10, var_steps=10, epochs=200, batch_size=None, display_step=1, test=None, loss=None): """ Fit the Gaussian process model to the given data. Parameters ---------- data : subclass of datasets.DataSet The train input...
Fit the Gaussian process model to the given data. Parameters ---------- data : subclass of datasets.DataSet The train inputs and outputs. optimizer : TensorFlow optimizer The optimizer to use in the fitting process. loo_steps : int Nu...
Fit the Gaussian process model to the given data. Parameters data : subclass of datasets.DataSet The train inputs and outputs. optimizer : TensorFlow optimizer The optimizer to use in the fitting process. loo_steps : int Number of steps to update hyper-parameters using loo objective var_steps : int Number of steps to...
[ "Fit", "the", "Gaussian", "process", "model", "to", "the", "given", "data", ".", "Parameters", "data", ":", "subclass", "of", "datasets", ".", "DataSet", "The", "train", "inputs", "and", "outputs", ".", "optimizer", ":", "TensorFlow", "optimizer", "The", "op...
def fit(self, data, optimizer, loo_steps=10, var_steps=10, epochs=200, batch_size=None, display_step=1, test=None, loss=None): num_train = data.num_examples if batch_size is None: batch_size = num_train if self.optimizer != optimizer: self.optimizer = optimiz...
[ "def", "fit", "(", "self", ",", "data", ",", "optimizer", ",", "loo_steps", "=", "10", ",", "var_steps", "=", "10", ",", "epochs", "=", "200", ",", "batch_size", "=", "None", ",", "display_step", "=", "1", ",", "test", "=", "None", ",", "loss", "="...
Fit the Gaussian process model to the given data.
[ "Fit", "the", "Gaussian", "process", "model", "to", "the", "given", "data", "." ]
[ "\"\"\"\n Fit the Gaussian process model to the given data.\n\n Parameters\n ----------\n data : subclass of datasets.DataSet\n The train inputs and outputs.\n optimizer : TensorFlow optimizer\n The optimizer to use in the fitting process.\n loo_steps ...
[ { "param": "self", "type": null }, { "param": "data", "type": null }, { "param": "optimizer", "type": null }, { "param": "loo_steps", "type": null }, { "param": "var_steps", "type": null }, { "param": "epochs", "type": null }, { "param": "b...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
d011eb66659e460212ba68395b204300d9af0fea
Alwaysproblem/AutoGP
autogp/gaussian_process.py
[ "Apache-2.0" ]
Python
predict
<not_specific>
def predict(self, test_inputs, batch_size=None): """ Predict outputs given inputs. Parameters ---------- test_inputs : ndarray Points on which we wish to make predictions. Dimensions: num_test * input_dim. batch_size : int The size of ...
Predict outputs given inputs. Parameters ---------- test_inputs : ndarray Points on which we wish to make predictions. Dimensions: num_test * input_dim. batch_size : int The size of the batches we make predictions on. If batch_siz...
Predict outputs given inputs. Parameters test_inputs : ndarray Points on which we wish to make predictions. Returns ndarray The predicted mean of the test inputs.
[ "Predict", "outputs", "given", "inputs", ".", "Parameters", "test_inputs", ":", "ndarray", "Points", "on", "which", "we", "wish", "to", "make", "predictions", ".", "Returns", "ndarray", "The", "predicted", "mean", "of", "the", "test", "inputs", "." ]
def predict(self, test_inputs, batch_size=None): if batch_size is None: num_batches = 1 else: num_batches = util.ceil_divide(test_inputs.shape[0], batch_size) test_inputs = np.array_split(test_inputs, num_batches) pred_means = util.init_list(0.0, [num_batches]) ...
[ "def", "predict", "(", "self", ",", "test_inputs", ",", "batch_size", "=", "None", ")", ":", "if", "batch_size", "is", "None", ":", "num_batches", "=", "1", "else", ":", "num_batches", "=", "util", ".", "ceil_divide", "(", "test_inputs", ".", "shape", "[...
Predict outputs given inputs.
[ "Predict", "outputs", "given", "inputs", "." ]
[ "\"\"\"\n Predict outputs given inputs.\n\n Parameters\n ----------\n test_inputs : ndarray\n Points on which we wish to make predictions.\n Dimensions: num_test * input_dim.\n batch_size : int\n The size of the batches we make predictions on.\n ...
[ { "param": "self", "type": null }, { "param": "test_inputs", "type": null }, { "param": "batch_size", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "test_inputs", "type": null, "docstring": null, "docstring_tok...
616ecf28bfb24cb6026c25b4d855985a9cb5535b
felix-edel/flirror
flirror/utils.py
[ "MIT" ]
Python
prettydate
str
def prettydate(date: Union[datetime, float]) -> str: """ Return the relative timeframe between the given date and now. e.g. 'Just now', 'x days ago', 'x hours ago', ... When the difference is greater than 7 days, the timestamp will be returned instead. """ # TODO (felix): Make all dates time...
Return the relative timeframe between the given date and now. e.g. 'Just now', 'x days ago', 'x hours ago', ... When the difference is greater than 7 days, the timestamp will be returned instead.
Return the relative timeframe between the given date and now.
[ "Return", "the", "relative", "timeframe", "between", "the", "given", "date", "and", "now", "." ]
def prettydate(date: Union[datetime, float]) -> str: now = datetime.utcnow() if isinstance(date, float): date = datetime.utcfromtimestamp(date) diff = now - date if diff.days > 7: return date.strftime("%d. %b %Y") return arrow.get(date).humanize()
[ "def", "prettydate", "(", "date", ":", "Union", "[", "datetime", ",", "float", "]", ")", "->", "str", ":", "now", "=", "datetime", ".", "utcnow", "(", ")", "if", "isinstance", "(", "date", ",", "float", ")", ":", "date", "=", "datetime", ".", "utcf...
Return the relative timeframe between the given date and now.
[ "Return", "the", "relative", "timeframe", "between", "the", "given", "date", "and", "now", "." ]
[ "\"\"\"\n Return the relative timeframe between the given date and now.\n e.g. 'Just now', 'x days ago', 'x hours ago', ...\n When the difference is greater than 7 days, the timestamp will be returned\n instead.\n \"\"\"", "# TODO (felix): Make all dates timezone aware.", "# Currently, the dates ...
[ { "param": "date", "type": "Union[datetime, float]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "date", "type": "Union[datetime, float]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
616ecf28bfb24cb6026c25b4d855985a9cb5535b
felix-edel/flirror
flirror/utils.py
[ "MIT" ]
Python
clean_string
str
def clean_string(string: str) -> str: """ Taken from Django: https://github.com/django/django/blob/e3d0b4d5501c6d0bc39f035e4345e5bdfde12e41/django/utils/text.py#L222 Return the given string converted to a string that can be used for a clean filename. Remove leading and trailing spaces; convert othe...
Taken from Django: https://github.com/django/django/blob/e3d0b4d5501c6d0bc39f035e4345e5bdfde12e41/django/utils/text.py#L222 Return the given string converted to a string that can be used for a clean filename. Remove leading and trailing spaces; convert other spaces to underscores; and remove anyth...
Return the given string converted to a string that can be used for a clean filename. Remove leading and trailing spaces; convert other spaces to underscores; and remove anything that is not an alphanumeric, dash, underscore, or dot.
[ "Return", "the", "given", "string", "converted", "to", "a", "string", "that", "can", "be", "used", "for", "a", "clean", "filename", ".", "Remove", "leading", "and", "trailing", "spaces", ";", "convert", "other", "spaces", "to", "underscores", ";", "and", "...
def clean_string(string: str) -> str: string = str(string).strip().replace(" ", "_").replace("-", "_") return re.sub(r"(?u)[^-\w.]", "", string)
[ "def", "clean_string", "(", "string", ":", "str", ")", "->", "str", ":", "string", "=", "str", "(", "string", ")", ".", "strip", "(", ")", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "return", ...
Taken from Django: https://github.com/django/django/blob/e3d0b4d5501c6d0bc39f035e4345e5bdfde12e41/django/utils/text.py#L222
[ "Taken", "from", "Django", ":", "https", ":", "//", "github", ".", "com", "/", "django", "/", "django", "/", "blob", "/", "e3d0b4d5501c6d0bc39f035e4345e5bdfde12e41", "/", "django", "/", "utils", "/", "text", ".", "py#L222" ]
[ "\"\"\"\n Taken from Django:\n https://github.com/django/django/blob/e3d0b4d5501c6d0bc39f035e4345e5bdfde12e41/django/utils/text.py#L222\n\n Return the given string converted to a string that can be used for a clean\n filename. Remove leading and trailing spaces; convert other spaces to\n underscores;...
[ { "param": "string", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
616ecf28bfb24cb6026c25b4d855985a9cb5535b
felix-edel/flirror
flirror/utils.py
[ "MIT" ]
Python
discover_plugins
Dict[str, ModuleType]
def discover_plugins() -> Dict[str, ModuleType]: """ Discover installed flirror plugins following the naming schema 'fliror_*'. Find all installed packages starting with 'flirror_' using the pkgutil module and returns them. For more information, see https://packaging.python.org/guides/creating...
Discover installed flirror plugins following the naming schema 'fliror_*'. Find all installed packages starting with 'flirror_' using the pkgutil module and returns them. For more information, see https://packaging.python.org/guides/creating-and-discovering-plugins/
Discover installed flirror plugins following the naming schema 'fliror_*'. Find all installed packages starting with 'flirror_' using the pkgutil module and returns them.
[ "Discover", "installed", "flirror", "plugins", "following", "the", "naming", "schema", "'", "fliror_", "*", "'", ".", "Find", "all", "installed", "packages", "starting", "with", "'", "flirror_", "'", "using", "the", "pkgutil", "module", "and", "returns", "them...
def discover_plugins() -> Dict[str, ModuleType]: discovered_plugins = { name: importlib.import_module(name) for finder, name, ispkg in pkgutil.iter_modules() if name.startswith("flirror_") } LOGGER.debug( "Found the following flirror plugins: '%s'", "', '".join(discov...
[ "def", "discover_plugins", "(", ")", "->", "Dict", "[", "str", ",", "ModuleType", "]", ":", "discovered_plugins", "=", "{", "name", ":", "importlib", ".", "import_module", "(", "name", ")", "for", "finder", ",", "name", ",", "ispkg", "in", "pkgutil", "."...
Discover installed flirror plugins following the naming schema 'fliror_*'.
[ "Discover", "installed", "flirror", "plugins", "following", "the", "naming", "schema", "'", "fliror_", "*", "'", "." ]
[ "\"\"\"\n Discover installed flirror plugins following the naming schema 'fliror_*'.\n\n Find all installed packages starting with 'flirror_' using the pkgutil\n module and returns them.\n\n For more information, see\n https://packaging.python.org/guides/creating-and-discovering-plugins/\n \"\"\""...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
616ecf28bfb24cb6026c25b4d855985a9cb5535b
felix-edel/flirror
flirror/utils.py
[ "MIT" ]
Python
discover_flirror_modules
Iterable[FlirrorModule]
def discover_flirror_modules( discovered_plugins: Dict[str, ModuleType] ) -> Iterable[FlirrorModule]: """ Look up FlirroModule instances from a list of discovered plugins. Search the provided modules for a variable named FLIRROR_MODULE and try to load its value as flirror module. If the variable do...
Look up FlirroModule instances from a list of discovered plugins. Search the provided modules for a variable named FLIRROR_MODULE and try to load its value as flirror module. If the variable does not point to a valid FlirrorModule instance, it will be ignored. A plugin could also provide multiple...
Look up FlirroModule instances from a list of discovered plugins. Search the provided modules for a variable named FLIRROR_MODULE and try to load its value as flirror module. If the variable does not point to a valid FlirrorModule instance, it will be ignored. A plugin could also provide multiple flirror modules via t...
[ "Look", "up", "FlirroModule", "instances", "from", "a", "list", "of", "discovered", "plugins", ".", "Search", "the", "provided", "modules", "for", "a", "variable", "named", "FLIRROR_MODULE", "and", "try", "to", "load", "its", "value", "as", "flirror", "module"...
def discover_flirror_modules( discovered_plugins: Dict[str, ModuleType] ) -> Iterable[FlirrorModule]: all_discovered_flirror_modules = [] for package_name, package in discovered_plugins.items(): discovered_flirror_modules = [] module = getattr(package, "FLIRROR_MODULE", None) if modu...
[ "def", "discover_flirror_modules", "(", "discovered_plugins", ":", "Dict", "[", "str", ",", "ModuleType", "]", ")", "->", "Iterable", "[", "FlirrorModule", "]", ":", "all_discovered_flirror_modules", "=", "[", "]", "for", "package_name", ",", "package", "in", "d...
Look up FlirroModule instances from a list of discovered plugins.
[ "Look", "up", "FlirroModule", "instances", "from", "a", "list", "of", "discovered", "plugins", "." ]
[ "\"\"\"\n Look up FlirroModule instances from a list of discovered plugins.\n\n Search the provided modules for a variable named FLIRROR_MODULE and try to\n load its value as flirror module. If the variable does not point to a valid\n FlirrorModule instance, it will be ignored.\n\n A plugin could als...
[ { "param": "discovered_plugins", "type": "Dict[str, ModuleType]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "discovered_plugins", "type": "Dict[str, ModuleType]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
94e0cc50260ba675b741a14f2d350c3014fa3835
felix-edel/flirror
flirror/modules/__init__.py
[ "MIT" ]
Python
crawler
<not_specific>
def crawler(self): """Decorate a function to register it as a crawler for this module""" def decorator(f: Callable) -> Callable: self.register_crawler(f) return f return decorator
Decorate a function to register it as a crawler for this module
Decorate a function to register it as a crawler for this module
[ "Decorate", "a", "function", "to", "register", "it", "as", "a", "crawler", "for", "this", "module" ]
def crawler(self): def decorator(f: Callable) -> Callable: self.register_crawler(f) return f return decorator
[ "def", "crawler", "(", "self", ")", ":", "def", "decorator", "(", "f", ":", "Callable", ")", "->", "Callable", ":", "self", ".", "register_crawler", "(", "f", ")", "return", "f", "return", "decorator" ]
Decorate a function to register it as a crawler for this module
[ "Decorate", "a", "function", "to", "register", "it", "as", "a", "crawler", "for", "this", "module" ]
[ "\"\"\"Decorate a function to register it as a crawler for this module\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
94e0cc50260ba675b741a14f2d350c3014fa3835
felix-edel/flirror
flirror/modules/__init__.py
[ "MIT" ]
Python
view
Callable
def view(self, **options: Any) -> Callable: """ Decorate a function to register it as view for this module. This is the same as Flask's route() decorator, but ensures that the rule is always set to "/". """ def decorator(f): rule = "/" endpoint =...
Decorate a function to register it as view for this module. This is the same as Flask's route() decorator, but ensures that the rule is always set to "/".
Decorate a function to register it as view for this module. This is the same as Flask's route() decorator, but ensures that the rule is always set to "/".
[ "Decorate", "a", "function", "to", "register", "it", "as", "view", "for", "this", "module", ".", "This", "is", "the", "same", "as", "Flask", "'", "s", "route", "()", "decorator", "but", "ensures", "that", "the", "rule", "is", "always", "set", "to", "\"...
def view(self, **options: Any) -> Callable: def decorator(f): rule = "/" endpoint = options.pop("endpoint", f.__name__) self.add_url_rule(rule, endpoint, f, **options) return f return decorator
[ "def", "view", "(", "self", ",", "**", "options", ":", "Any", ")", "->", "Callable", ":", "def", "decorator", "(", "f", ")", ":", "rule", "=", "\"/\"", "endpoint", "=", "options", ".", "pop", "(", "\"endpoint\"", ",", "f", ".", "__name__", ")", "se...
Decorate a function to register it as view for this module.
[ "Decorate", "a", "function", "to", "register", "it", "as", "view", "for", "this", "module", "." ]
[ "\"\"\"\n Decorate a function to register it as view for this module.\n\n This is the same as Flask's route() decorator, but ensures that the\n rule is always set to \"/\".\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "options", "type": "Any" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": "Any", "docstring": null, "docstring_tokens...
7becbaeaf71ff7ae12b083d7de4fa7f3d41a97d6
felix-edel/flirror
flirror/__init__.py
[ "MIT" ]
Python
modules
<not_specific>
def modules(self): """ For convenience, so we don't have to access the blueprints attribute when dealing with modules. """ return self.blueprints
For convenience, so we don't have to access the blueprints attribute when dealing with modules.
For convenience, so we don't have to access the blueprints attribute when dealing with modules.
[ "For", "convenience", "so", "we", "don", "'", "t", "have", "to", "access", "the", "blueprints", "attribute", "when", "dealing", "with", "modules", "." ]
def modules(self): return self.blueprints
[ "def", "modules", "(", "self", ")", ":", "return", "self", ".", "blueprints" ]
For convenience, so we don't have to access the blueprints attribute when dealing with modules.
[ "For", "convenience", "so", "we", "don", "'", "t", "have", "to", "access", "the", "blueprints", "attribute", "when", "dealing", "with", "modules", "." ]
[ "\"\"\"\n For convenience, so we don't have to access the blueprints attribute\n when dealing with modules.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7becbaeaf71ff7ae12b083d7de4fa7f3d41a97d6
felix-edel/flirror
flirror/__init__.py
[ "MIT" ]
Python
create_app
Flirror
def create_app( config: Optional[Dict] = None, jinja_options: Optional[Any] = None ) -> Flirror: """ Load configuration file and initialize flirror app with necessary components like database and modules. """ # TODO (felix): Find a better way to overwrite the jinja_options for the unit tests. ...
Load configuration file and initialize flirror app with necessary components like database and modules.
Load configuration file and initialize flirror app with necessary components like database and modules.
[ "Load", "configuration", "file", "and", "initialize", "flirror", "app", "with", "necessary", "components", "like", "database", "and", "modules", "." ]
def create_app( config: Optional[Dict] = None, jinja_options: Optional[Any] = None ) -> Flirror: app = Flirror(__name__) if jinja_options is not None: app.jinja_options = {**app.jinja_options, **jinja_options} app.config.from_envvar(FLIRROR_SETTINGS_ENV) if config is not None: app.co...
[ "def", "create_app", "(", "config", ":", "Optional", "[", "Dict", "]", "=", "None", ",", "jinja_options", ":", "Optional", "[", "Any", "]", "=", "None", ")", "->", "Flirror", ":", "app", "=", "Flirror", "(", "__name__", ")", "if", "jinja_options", "is"...
Load configuration file and initialize flirror app with necessary components like database and modules.
[ "Load", "configuration", "file", "and", "initialize", "flirror", "app", "with", "necessary", "components", "like", "database", "and", "modules", "." ]
[ "\"\"\"\n Load configuration file and initialize flirror app with necessary\n components like database and modules.\n \"\"\"", "# TODO (felix): Find a better way to overwrite the jinja_options for the unit tests.", "# As stated in https://github.com/pallets/flask/blob/38eb5d3b49d628785a470e2e773fc5ac82...
[ { "param": "config", "type": "Optional[Dict]" }, { "param": "jinja_options", "type": "Optional[Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config", "type": "Optional[Dict]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "jinja_options", "type": "Optional[Any]", "docstring":...
7becbaeaf71ff7ae12b083d7de4fa7f3d41a97d6
felix-edel/flirror
flirror/__init__.py
[ "MIT" ]
Python
create_web
Flirror
def create_web( config: Optional[Dict] = None, jinja_options: Optional[Any] = None ) -> Flirror: """ Load the configuration file and initialize the flirror app with basic components plus everything that's necessary for the web app like jinja2 env, template filters and assets (SCSS/CSS). """ ...
Load the configuration file and initialize the flirror app with basic components plus everything that's necessary for the web app like jinja2 env, template filters and assets (SCSS/CSS).
Load the configuration file and initialize the flirror app with basic components plus everything that's necessary for the web app like jinja2 env, template filters and assets (SCSS/CSS).
[ "Load", "the", "configuration", "file", "and", "initialize", "the", "flirror", "app", "with", "basic", "components", "plus", "everything", "that", "'", "s", "necessary", "for", "the", "web", "app", "like", "jinja2", "env", "template", "filters", "and", "assets...
def create_web( config: Optional[Dict] = None, jinja_options: Optional[Any] = None ) -> Flirror: app = create_app(config, jinja_options) IndexView.register_url(app) error_handler = make_error_handler() app.register_error_handler(400, error_handler) app.register_error_handler(403, error_handler) ...
[ "def", "create_web", "(", "config", ":", "Optional", "[", "Dict", "]", "=", "None", ",", "jinja_options", ":", "Optional", "[", "Any", "]", "=", "None", ")", "->", "Flirror", ":", "app", "=", "create_app", "(", "config", ",", "jinja_options", ")", "Ind...
Load the configuration file and initialize the flirror app with basic components plus everything that's necessary for the web app like jinja2 env, template filters and assets (SCSS/CSS).
[ "Load", "the", "configuration", "file", "and", "initialize", "the", "flirror", "app", "with", "basic", "components", "plus", "everything", "that", "'", "s", "necessary", "for", "the", "web", "app", "like", "jinja2", "env", "template", "filters", "and", "assets...
[ "\"\"\"\n Load the configuration file and initialize the flirror app with basic\n components plus everything that's necessary for the web app like jinja2\n env, template filters and assets (SCSS/CSS).\n \"\"\"", "# The central index page showing all tiles", "# Register error handler to known status ...
[ { "param": "config", "type": "Optional[Dict]" }, { "param": "jinja_options", "type": "Optional[Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config", "type": "Optional[Dict]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "jinja_options", "type": "Optional[Any]", "docstring":...
bd942ed4d598cfb45a8291bd36500d250503c646
dzon4xx/flat_nest_pydict
flat_nest_pydict/dict_tools.py
[ "MIT" ]
Python
flatten
<not_specific>
def flatten(nested_dict, sep=':'): """Returns flat dictionary. Returned dictionary has got number of leafs keys. Each of key is a path to leaf. example: nested_dict = {'0-0': {'1-0': val '1-1': {'2-0': 'val'}}, '0-1': ...
Returns flat dictionary. Returned dictionary has got number of leafs keys. Each of key is a path to leaf. example: nested_dict = {'0-0': {'1-0': val '1-1': {'2-0': 'val'}}, '0-1': 'val', '0-2': ...
Returns flat dictionary. Returned dictionary has got number of leafs keys. Each of key is a path to leaf.
[ "Returns", "flat", "dictionary", ".", "Returned", "dictionary", "has", "got", "number", "of", "leafs", "keys", ".", "Each", "of", "key", "is", "a", "path", "to", "leaf", "." ]
def flatten(nested_dict, sep=':'): def _flatten(nested_dict, flat_dict, aggregated_key): for current_key, current_val in nested_dict.items(): if isinstance(current_val, Mapping): aggregated_key = sep.join([aggregated_key, current_key]) if aggregated_key else current_key ...
[ "def", "flatten", "(", "nested_dict", ",", "sep", "=", "':'", ")", ":", "def", "_flatten", "(", "nested_dict", ",", "flat_dict", ",", "aggregated_key", ")", ":", "for", "current_key", ",", "current_val", "in", "nested_dict", ".", "items", "(", ")", ":", ...
Returns flat dictionary.
[ "Returns", "flat", "dictionary", "." ]
[ "\"\"\"Returns flat dictionary. Returned dictionary has got number of leafs keys. Each of key is a path to leaf.\n\n example: nested_dict = {'0-0':\n {'1-0': val\n '1-1': {'2-0': 'val'}},\n '0-1': 'val',\n ...
[ { "param": "nested_dict", "type": null }, { "param": "sep", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "nested_dict", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sep", "type": null, "docstring": null, "docstring_toke...
bd942ed4d598cfb45a8291bd36500d250503c646
dzon4xx/flat_nest_pydict
flat_nest_pydict/dict_tools.py
[ "MIT" ]
Python
nest
<not_specific>
def nest(flat_dict, sep=':'): """Returns nested dictionary. Flat dictionary must follow convention that each key is a path to nested leaf. example: nested_dict = {'0-0': {'1-0': val '1-1': {'2-0': 'val'}}, ...
Returns nested dictionary. Flat dictionary must follow convention that each key is a path to nested leaf. example: nested_dict = {'0-0': {'1-0': val '1-1': {'2-0': 'val'}}, '0-1': 'val', ...
Returns nested dictionary. Flat dictionary must follow convention that each key is a path to nested leaf.
[ "Returns", "nested", "dictionary", ".", "Flat", "dictionary", "must", "follow", "convention", "that", "each", "key", "is", "a", "path", "to", "nested", "leaf", "." ]
def nest(flat_dict, sep=':'): def _nest(nested_dict, aggregated_key, val): try: leaf_key, aggregated_key = aggregated_key.split(sep, 1) except ValueError: leaf_key = aggregated_key dict_ = type(nested_dict)([(leaf_key, val)]) nested_dict.update(dict_) ...
[ "def", "nest", "(", "flat_dict", ",", "sep", "=", "':'", ")", ":", "def", "_nest", "(", "nested_dict", ",", "aggregated_key", ",", "val", ")", ":", "try", ":", "leaf_key", ",", "aggregated_key", "=", "aggregated_key", ".", "split", "(", "sep", ",", "1"...
Returns nested dictionary.
[ "Returns", "nested", "dictionary", "." ]
[ "\"\"\"Returns nested dictionary. Flat dictionary must follow convention that each key is a path to nested leaf.\n\n example: nested_dict = {'0-0':\n {'1-0': val\n '1-1': {'2-0': 'val'}},\n '0-1': 'val',\n ...
[ { "param": "flat_dict", "type": null }, { "param": "sep", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "flat_dict", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sep", "type": null, "docstring": null, "docstring_tokens...
4cdbb5fbcbbfc65c97451c0c7a58150c1e00ac21
JordanReiter/django-proxy
proxy/views.py
[ "Unlicense" ]
Python
proxy_view
<not_specific>
def proxy_view(request, url, domain=None, secure=False, requests_args=None, template_name="proxy/debug.html"): """ Forward as close to an exact copy of the request as possible along to the given url. Respond with as close to an exact copy of the resulting response as possible. If there are any add...
Forward as close to an exact copy of the request as possible along to the given url. Respond with as close to an exact copy of the resulting response as possible. If there are any additional arguments you wish to send to requests, put them in the requests_args dictionary.
Forward as close to an exact copy of the request as possible along to the given url. Respond with as close to an exact copy of the resulting response as possible. If there are any additional arguments you wish to send to requests, put them in the requests_args dictionary.
[ "Forward", "as", "close", "to", "an", "exact", "copy", "of", "the", "request", "as", "possible", "along", "to", "the", "given", "url", ".", "Respond", "with", "as", "close", "to", "an", "exact", "copy", "of", "the", "resulting", "response", "as", "possib...
def proxy_view(request, url, domain=None, secure=False, requests_args=None, template_name="proxy/debug.html"): requests_args = (requests_args or {}).copy() headers = get_headers(request.META) params = request.GET.copy() proxy_domain = settings.PROXY_DOMAIN protocol = 'http' if secure: pr...
[ "def", "proxy_view", "(", "request", ",", "url", ",", "domain", "=", "None", ",", "secure", "=", "False", ",", "requests_args", "=", "None", ",", "template_name", "=", "\"proxy/debug.html\"", ")", ":", "requests_args", "=", "(", "requests_args", "or", "{", ...
Forward as close to an exact copy of the request as possible along to the given url.
[ "Forward", "as", "close", "to", "an", "exact", "copy", "of", "the", "request", "as", "possible", "along", "to", "the", "given", "url", "." ]
[ "\"\"\"\n Forward as close to an exact copy of the request as possible along to the\n given url. Respond with as close to an exact copy of the resulting\n response as possible.\n\n If there are any additional arguments you wish to send to requests, put\n them in the requests_args dictionary.\n \"...
[ { "param": "request", "type": null }, { "param": "url", "type": null }, { "param": "domain", "type": null }, { "param": "secure", "type": null }, { "param": "requests_args", "type": null }, { "param": "template_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_tokens":...
eb1171c45b1e5d951202d5e92ffdeedcd66d40ad
tdsmith/pandas
pandas/core/indexes/timedeltas.py
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "MIT", "ECL-2.0", "BSD-3-Clause" ]
Python
_td_index_cmp
<not_specific>
def _td_index_cmp(opname, cls): """ Wrap comparison operations to convert timedelta-like to timedelta64 """ nat_result = True if opname == '__ne__' else False def wrapper(self, other): msg = "cannot compare a {cls} with type {typ}" func = getattr(super(TimedeltaIndex, self), opname)...
Wrap comparison operations to convert timedelta-like to timedelta64
Wrap comparison operations to convert timedelta-like to timedelta64
[ "Wrap", "comparison", "operations", "to", "convert", "timedelta", "-", "like", "to", "timedelta64" ]
def _td_index_cmp(opname, cls): nat_result = True if opname == '__ne__' else False def wrapper(self, other): msg = "cannot compare a {cls} with type {typ}" func = getattr(super(TimedeltaIndex, self), opname) if _is_convertible_to_td(other) or other is NaT: try: ...
[ "def", "_td_index_cmp", "(", "opname", ",", "cls", ")", ":", "nat_result", "=", "True", "if", "opname", "==", "'__ne__'", "else", "False", "def", "wrapper", "(", "self", ",", "other", ")", ":", "msg", "=", "\"cannot compare a {cls} with type {typ}\"", "func", ...
Wrap comparison operations to convert timedelta-like to timedelta64
[ "Wrap", "comparison", "operations", "to", "convert", "timedelta", "-", "like", "to", "timedelta64" ]
[ "\"\"\"\n Wrap comparison operations to convert timedelta-like to timedelta64\n \"\"\"", "# failed to parse as timedelta", "# support of bool dtype indexers" ]
[ { "param": "opname", "type": null }, { "param": "cls", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "opname", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": ...
eb1171c45b1e5d951202d5e92ffdeedcd66d40ad
tdsmith/pandas
pandas/core/indexes/timedeltas.py
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "MIT", "ECL-2.0", "BSD-3-Clause" ]
Python
union
<not_specific>
def union(self, other): """ Specialized union for TimedeltaIndex objects. If combine overlapping ranges with the same DateOffset, will be much faster than Index.union Parameters ---------- other : TimedeltaIndex or array-like Returns ------- ...
Specialized union for TimedeltaIndex objects. If combine overlapping ranges with the same DateOffset, will be much faster than Index.union Parameters ---------- other : TimedeltaIndex or array-like Returns ------- y : Index or TimedeltaIndex ...
Specialized union for TimedeltaIndex objects. If combine overlapping ranges with the same DateOffset, will be much faster than Index.union Parameters other : TimedeltaIndex or array-like Returns y : Index or TimedeltaIndex
[ "Specialized", "union", "for", "TimedeltaIndex", "objects", ".", "If", "combine", "overlapping", "ranges", "with", "the", "same", "DateOffset", "will", "be", "much", "faster", "than", "Index", ".", "union", "Parameters", "other", ":", "TimedeltaIndex", "or", "ar...
def union(self, other): self._assert_can_do_setop(other) if not isinstance(other, TimedeltaIndex): try: other = TimedeltaIndex(other) except (TypeError, ValueError): pass this, other = self, other if this._can_fast_union(other): ...
[ "def", "union", "(", "self", ",", "other", ")", ":", "self", ".", "_assert_can_do_setop", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "TimedeltaIndex", ")", ":", "try", ":", "other", "=", "TimedeltaIndex", "(", "other", ")", "except"...
Specialized union for TimedeltaIndex objects.
[ "Specialized", "union", "for", "TimedeltaIndex", "objects", "." ]
[ "\"\"\"\n Specialized union for TimedeltaIndex objects. If combine\n overlapping ranges with the same DateOffset, will be much\n faster than Index.union\n\n Parameters\n ----------\n other : TimedeltaIndex or array-like\n\n Returns\n -------\n y : Index...
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "other", "type": null, "docstring": null, "docstring_tokens": ...
eb1171c45b1e5d951202d5e92ffdeedcd66d40ad
tdsmith/pandas
pandas/core/indexes/timedeltas.py
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "MIT", "ECL-2.0", "BSD-3-Clause" ]
Python
intersection
<not_specific>
def intersection(self, other): """ Specialized intersection for TimedeltaIndex objects. May be much faster than Index.intersection Parameters ---------- other : TimedeltaIndex or array-like Returns ------- y : Index or TimedeltaIndex """ ...
Specialized intersection for TimedeltaIndex objects. May be much faster than Index.intersection Parameters ---------- other : TimedeltaIndex or array-like Returns ------- y : Index or TimedeltaIndex
Specialized intersection for TimedeltaIndex objects. May be much faster than Index.intersection Parameters other : TimedeltaIndex or array-like Returns y : Index or TimedeltaIndex
[ "Specialized", "intersection", "for", "TimedeltaIndex", "objects", ".", "May", "be", "much", "faster", "than", "Index", ".", "intersection", "Parameters", "other", ":", "TimedeltaIndex", "or", "array", "-", "like", "Returns", "y", ":", "Index", "or", "TimedeltaI...
def intersection(self, other): self._assert_can_do_setop(other) if not isinstance(other, TimedeltaIndex): try: other = TimedeltaIndex(other) except (TypeError, ValueError): pass result = Index.intersection(self, other) retur...
[ "def", "intersection", "(", "self", ",", "other", ")", ":", "self", ".", "_assert_can_do_setop", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "TimedeltaIndex", ")", ":", "try", ":", "other", "=", "TimedeltaIndex", "(", "other", ")", "...
Specialized intersection for TimedeltaIndex objects.
[ "Specialized", "intersection", "for", "TimedeltaIndex", "objects", "." ]
[ "\"\"\"\n Specialized intersection for TimedeltaIndex objects. May be much faster\n than Index.intersection\n\n Parameters\n ----------\n other : TimedeltaIndex or array-like\n\n Returns\n -------\n y : Index or TimedeltaIndex\n \"\"\"", "# to make ou...
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "other", "type": null, "docstring": null, "docstring_tokens": ...
eb1171c45b1e5d951202d5e92ffdeedcd66d40ad
tdsmith/pandas
pandas/core/indexes/timedeltas.py
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "MIT", "ECL-2.0", "BSD-3-Clause" ]
Python
insert
<not_specific>
def insert(self, loc, item): """ Make new Index inserting new item at location Parameters ---------- loc : int item : object if not either a Python datetime or a numpy integer-like, returned Index dtype will be object rather than datetime. ...
Make new Index inserting new item at location Parameters ---------- loc : int item : object if not either a Python datetime or a numpy integer-like, returned Index dtype will be object rather than datetime. Returns ------- new_in...
Make new Index inserting new item at location Parameters loc : int item : object if not either a Python datetime or a numpy integer-like, returned Index dtype will be object rather than datetime. Returns
[ "Make", "new", "Index", "inserting", "new", "item", "at", "location", "Parameters", "loc", ":", "int", "item", ":", "object", "if", "not", "either", "a", "Python", "datetime", "or", "a", "numpy", "integer", "-", "like", "returned", "Index", "dtype", "will"...
def insert(self, loc, item): if _is_convertible_to_td(item): try: item = Timedelta(item) except Exception: pass elif is_scalar(item) and isna(item): item = self._na_value freq = None if isinstance(item, Timedelta) or (is...
[ "def", "insert", "(", "self", ",", "loc", ",", "item", ")", ":", "if", "_is_convertible_to_td", "(", "item", ")", ":", "try", ":", "item", "=", "Timedelta", "(", "item", ")", "except", "Exception", ":", "pass", "elif", "is_scalar", "(", "item", ")", ...
Make new Index inserting new item at location Parameters
[ "Make", "new", "Index", "inserting", "new", "item", "at", "location", "Parameters" ]
[ "\"\"\"\n Make new Index inserting new item at location\n\n Parameters\n ----------\n loc : int\n item : object\n if not either a Python datetime or a numpy integer-like, returned\n Index dtype will be object rather than datetime.\n\n Returns\n ...
[ { "param": "self", "type": null }, { "param": "loc", "type": null }, { "param": "item", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "loc", "type": null, "docstring": null, "docstring_tokens": []...
fe4e461b0bd4f6559564c1214e971abbe5d13a42
tdsmith/pandas
pandas/core/arrays/base.py
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "MIT", "ECL-2.0", "BSD-3-Clause" ]
Python
_create_method
<not_specific>
def _create_method(cls, op, coerce_to_dtype=True): """ A class method that returns a method that will correspond to an operator for an ExtensionArray subclass, by dispatching to the relevant operator defined on the individual elements of the ExtensionArray. Parameters ...
A class method that returns a method that will correspond to an operator for an ExtensionArray subclass, by dispatching to the relevant operator defined on the individual elements of the ExtensionArray. Parameters ---------- op : function An operator...
A class method that returns a method that will correspond to an operator for an ExtensionArray subclass, by dispatching to the relevant operator defined on the individual elements of the ExtensionArray. Parameters op : function An operator that takes arguments op(a, b) coerce_to_dtype : bool boolean indicating wheth...
[ "A", "class", "method", "that", "returns", "a", "method", "that", "will", "correspond", "to", "an", "operator", "for", "an", "ExtensionArray", "subclass", "by", "dispatching", "to", "the", "relevant", "operator", "defined", "on", "the", "individual", "elements",...
def _create_method(cls, op, coerce_to_dtype=True): def _binop(self, other): def convert_values(param): if isinstance(param, ExtensionArray) or is_list_like(param): ovalues = param else: ovalues = [param] * len(self) ...
[ "def", "_create_method", "(", "cls", ",", "op", ",", "coerce_to_dtype", "=", "True", ")", ":", "def", "_binop", "(", "self", ",", "other", ")", ":", "def", "convert_values", "(", "param", ")", ":", "if", "isinstance", "(", "param", ",", "ExtensionArray",...
A class method that returns a method that will correspond to an operator for an ExtensionArray subclass, by dispatching to the relevant operator defined on the individual elements of the ExtensionArray.
[ "A", "class", "method", "that", "returns", "a", "method", "that", "will", "correspond", "to", "an", "operator", "for", "an", "ExtensionArray", "subclass", "by", "dispatching", "to", "the", "relevant", "operator", "defined", "on", "the", "individual", "elements",...
[ "\"\"\"\n A class method that returns a method that will correspond to an\n operator for an ExtensionArray subclass, by dispatching to the\n relevant operator defined on the individual elements of the\n ExtensionArray.\n\n Parameters\n ----------\n op : function\n ...
[ { "param": "cls", "type": null }, { "param": "op", "type": null }, { "param": "coerce_to_dtype", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "op", "type": null, "docstring": null, "docstring_tokens": [], ...
efba2f345d5f57cc2af90a5cf6ff6d607700f3f6
nicola-giuliani/PyDMD
setup.py
[ "MIT" ]
Python
readme
<not_specific>
def readme(): """ This function just return the content of README.md """ with open('README.md') as f: return f.read()
This function just return the content of README.md
This function just return the content of README.md
[ "This", "function", "just", "return", "the", "content", "of", "README", ".", "md" ]
def readme(): with open('README.md') as f: return f.read()
[ "def", "readme", "(", ")", ":", "with", "open", "(", "'README.md'", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
This function just return the content of README.md
[ "This", "function", "just", "return", "the", "content", "of", "README", ".", "md" ]
[ "\"\"\"\n\tThis function just return the content of README.md\n\t\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
762d14534838c789c5fcadcae676adede6d9742f
curlyyBOY/Maze-game-no-penalty
build-app.py
[ "Apache-2.0" ]
Python
trim_licence
<not_specific>
def trim_licence(self, code): """Strip out Google's and MIT's Apache licences. JS Compiler preserves dozens of Apache licences in the Blockly code. Remove these if they belong to Google or MIT. MIT's permission to do this is logged in Blockly issue 2412. Args: code: Large blob of compiled so...
Strip out Google's and MIT's Apache licences. JS Compiler preserves dozens of Apache licences in the Blockly code. Remove these if they belong to Google or MIT. MIT's permission to do this is logged in Blockly issue 2412. Args: code: Large blob of compiled source code. Returns: Code w...
Strip out Google's and MIT's Apache licences. JS Compiler preserves dozens of Apache licences in the Blockly code. Remove these if they belong to Google or MIT. MIT's permission to do this is logged in Blockly issue 2412.
[ "Strip", "out", "Google", "'", "s", "and", "MIT", "'", "s", "Apache", "licences", ".", "JS", "Compiler", "preserves", "dozens", "of", "Apache", "licences", "in", "the", "Blockly", "code", ".", "Remove", "these", "if", "they", "belong", "to", "Google", "o...
def trim_licence(self, code): apache2 = re.compile("""/\\* [\\w: ]+ (Copyright \\d+ (Google Inc.|Massachusetts Institute of Technology)) (https://developers.google.com/blockly/|All rights reserved.) Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except in complian...
[ "def", "trim_licence", "(", "self", ",", "code", ")", ":", "apache2", "=", "re", ".", "compile", "(", "\"\"\"/\\\\*\n\n [\\\\w: ]+\n\n (Copyright \\\\d+ (Google Inc.|Massachusetts Institute of Technology))\n (https://developers.google.com/blockly/|All rights reserved.)\n\n Licensed under...
Strip out Google's and MIT's Apache licences.
[ "Strip", "out", "Google", "'", "s", "and", "MIT", "'", "s", "Apache", "licences", "." ]
[ "\"\"\"Strip out Google's and MIT's Apache licences.\n\n JS Compiler preserves dozens of Apache licences in the Blockly code.\n Remove these if they belong to Google or MIT.\n MIT's permission to do this is logged in Blockly issue 2412.\n\n Args:\n code: Large blob of compiled source code.\n\n R...
[ { "param": "self", "type": null }, { "param": "code", "type": null } ]
{ "returns": [ { "docstring": "Code with Google's and MIT's Apache licences trimmed.", "docstring_tokens": [ "Code", "with", "Google", "'", "s", "and", "MIT", "'", "s", "Apache", "licences", "trimmed", ...
1feb9ee353375cf4276186fa62dc84a233c89212
hareeshbabu82ns/jyotisha
jyotisha/custom_transliteration.py
[ "MIT" ]
Python
sexastr2deci
<not_specific>
def sexastr2deci(sexa_str): """Converts as sexagesimal string to decimal Converts a given sexagesimal string to its decimal value Args: A string encoding of a sexagesimal value, with the various components separated by colons Returns: A decimal value corresponding to the sexagesimal...
Converts as sexagesimal string to decimal Converts a given sexagesimal string to its decimal value Args: A string encoding of a sexagesimal value, with the various components separated by colons Returns: A decimal value corresponding to the sexagesimal string Examples: >>> se...
Converts as sexagesimal string to decimal Converts a given sexagesimal string to its decimal value A string encoding of a sexagesimal value, with the various components separated by colons A decimal value corresponding to the sexagesimal string
[ "Converts", "as", "sexagesimal", "string", "to", "decimal", "Converts", "a", "given", "sexagesimal", "string", "to", "its", "decimal", "value", "A", "string", "encoding", "of", "a", "sexagesimal", "value", "with", "the", "various", "components", "separated", "by...
def sexastr2deci(sexa_str): if sexa_str[0] == '-': sgn = -1.0 dms = sexa_str[1:].split(':') else: sgn = 1.0 dms = sexa_str.split(':') decival = 0 for i in range(0, len(dms)): decival = decival + float(dms[i]) / (60.0 ** i) return decival * sgn
[ "def", "sexastr2deci", "(", "sexa_str", ")", ":", "if", "sexa_str", "[", "0", "]", "==", "'-'", ":", "sgn", "=", "-", "1.0", "dms", "=", "sexa_str", "[", "1", ":", "]", ".", "split", "(", "':'", ")", "else", ":", "sgn", "=", "1.0", "dms", "=", ...
Converts as sexagesimal string to decimal Converts a given sexagesimal string to its decimal value
[ "Converts", "as", "sexagesimal", "string", "to", "decimal", "Converts", "a", "given", "sexagesimal", "string", "to", "its", "decimal", "value" ]
[ "\"\"\"Converts as sexagesimal string to decimal\n\n Converts a given sexagesimal string to its decimal value\n\n Args:\n A string encoding of a sexagesimal value, with the various\n components separated by colons\n\n Returns:\n A decimal value corresponding to the sexagesimal string\n\n ...
[ { "param": "sexa_str", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sexa_str", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5056f46c7bcd40f84a7306a8c1d1dffd57f1b8e3
hareeshbabu82ns/jyotisha
jyotisha/panchangam/spatio_temporal/periodical.py
[ "MIT" ]
Python
update_festival_details
null
def update_festival_details(self): """ Festival data may be updated more frequently and a precomputed panchangam may go out of sync. Hence we keep this method separate. :return: """ self.reset_festivals() self.computeTransits() self.compute_solar_eclipses() ...
Festival data may be updated more frequently and a precomputed panchangam may go out of sync. Hence we keep this method separate. :return:
Festival data may be updated more frequently and a precomputed panchangam may go out of sync. Hence we keep this method separate.
[ "Festival", "data", "may", "be", "updated", "more", "frequently", "and", "a", "precomputed", "panchangam", "may", "go", "out", "of", "sync", ".", "Hence", "we", "keep", "this", "method", "separate", "." ]
def update_festival_details(self): self.reset_festivals() self.computeTransits() self.compute_solar_eclipses() self.compute_lunar_eclipses() self.assign_shraaddha_tithi() self.compute_festivals()
[ "def", "update_festival_details", "(", "self", ")", ":", "self", ".", "reset_festivals", "(", ")", "self", ".", "computeTransits", "(", ")", "self", ".", "compute_solar_eclipses", "(", ")", "self", ".", "compute_lunar_eclipses", "(", ")", "self", ".", "assign_...
Festival data may be updated more frequently and a precomputed panchangam may go out of sync.
[ "Festival", "data", "may", "be", "updated", "more", "frequently", "and", "a", "precomputed", "panchangam", "may", "go", "out", "of", "sync", "." ]
[ "\"\"\"\n\n Festival data may be updated more frequently and a precomputed panchangam may go out of sync. Hence we keep this method separate.\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
33fef2d7e833da6b4882d93c129f30c442d207c0
psorianom/modified_adsorption
modified_adsorption.py
[ "Apache-1.1" ]
Python
read_graph_seeds
<not_specific>
def read_graph_seeds(self, graph_file, seed_file, nb_seeds=10, delimiter="\t"): """ Quick and dirty way to get the adjacency matrix and seeds! """ G = read_weighted_edgelist(graph_file, delimiter=delimiter) W = to_scipy_sparse_matrix(G) nodes_G = G.nodes() label_i...
Quick and dirty way to get the adjacency matrix and seeds!
Quick and dirty way to get the adjacency matrix and seeds!
[ "Quick", "and", "dirty", "way", "to", "get", "the", "adjacency", "matrix", "and", "seeds!" ]
def read_graph_seeds(self, graph_file, seed_file, nb_seeds=10, delimiter="\t"): G = read_weighted_edgelist(graph_file, delimiter=delimiter) W = to_scipy_sparse_matrix(G) nodes_G = G.nodes() label_index = defaultdict(list) file_lines = open(seed_file, "r").readlines() seed...
[ "def", "read_graph_seeds", "(", "self", ",", "graph_file", ",", "seed_file", ",", "nb_seeds", "=", "10", ",", "delimiter", "=", "\"\\t\"", ")", ":", "G", "=", "read_weighted_edgelist", "(", "graph_file", ",", "delimiter", "=", "delimiter", ")", "W", "=", "...
Quick and dirty way to get the adjacency matrix and seeds!
[ "Quick", "and", "dirty", "way", "to", "get", "the", "adjacency", "matrix", "and", "seeds!" ]
[ "\"\"\"\n Quick and dirty way to get the adjacency matrix and seeds!\n \"\"\"", "# Deal with seeds", "# Store golden_labels/seeds node name and their real value", "# [L1, L2, L3,..., DUMMY]", "# Build the seeds matrix: number of nodes x number of labels + 1", "# We add 1 because of the \"dum...
[ { "param": "self", "type": null }, { "param": "graph_file", "type": null }, { "param": "seed_file", "type": null }, { "param": "nb_seeds", "type": null }, { "param": "delimiter", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "graph_file", "type": null, "docstring": null, "docstring_toke...
33fef2d7e833da6b4882d93c129f30c442d207c0
psorianom/modified_adsorption
modified_adsorption.py
[ "Apache-1.1" ]
Python
results
<not_specific>
def results(self): """ Return the class determined by the maximum in each row of the Yh matrix. Doesnt take into account the dummy label """ result_complete = [] self._mad_class_index = np.squeeze(np.asarray(self._Yh[:, :self._Yh.shape[1] - 1].todense().argmax(axis=1))) ...
Return the class determined by the maximum in each row of the Yh matrix. Doesnt take into account the dummy label
Return the class determined by the maximum in each row of the Yh matrix. Doesnt take into account the dummy label
[ "Return", "the", "class", "determined", "by", "the", "maximum", "in", "each", "row", "of", "the", "Yh", "matrix", ".", "Doesnt", "take", "into", "account", "the", "dummy", "label" ]
def results(self): result_complete = [] self._mad_class_index = np.squeeze(np.asarray(self._Yh[:, :self._Yh.shape[1] - 1].todense().argmax(axis=1))) self._label_results = np.array([self._labels[r] for r in self._mad_class_index]) print self._label_results for i in range(len(self....
[ "def", "results", "(", "self", ")", ":", "result_complete", "=", "[", "]", "self", ".", "_mad_class_index", "=", "np", ".", "squeeze", "(", "np", ".", "asarray", "(", "self", ".", "_Yh", "[", ":", ",", ":", "self", ".", "_Yh", ".", "shape", "[", ...
Return the class determined by the maximum in each row of the Yh matrix.
[ "Return", "the", "class", "determined", "by", "the", "maximum", "in", "each", "row", "of", "the", "Yh", "matrix", "." ]
[ "\"\"\"\n Return the class determined by the maximum in each row of the Yh matrix. Doesnt\n take into account the dummy label\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33fef2d7e833da6b4882d93c129f30c442d207c0
psorianom/modified_adsorption
modified_adsorption.py
[ "Apache-1.1" ]
Python
calculate_mad
null
def calculate_mad(self): print "\n...Calculating modified adsorption." nr_nodes = self._W.shape[0] # 1. Initialize Yhat self._Yh = lil_matrix(self._Y.copy()) # 2. Calculate Mvv self._M = lil_matrix((nr_nodes, nr_nodes)) # self._M = lil_matrix(np.diag((self._mu1*...
TODO: This does not work cause flattening and to array-ing is not memory cool so it fails. Need to find a way to build this initial matrices with sparse matrices
This does not work cause flattening and to array-ing is not memory cool so it fails. Need to find a way to build this initial matrices with sparse matrices
[ "This", "does", "not", "work", "cause", "flattening", "and", "to", "array", "-", "ing", "is", "not", "memory", "cool", "so", "it", "fails", ".", "Need", "to", "find", "a", "way", "to", "build", "this", "initial", "matrices", "with", "sparse", "matrices" ...
def calculate_mad(self): print "\n...Calculating modified adsorption." nr_nodes = self._W.shape[0] self._Yh = lil_matrix(self._Y.copy()) self._M = lil_matrix((nr_nodes, nr_nodes)) for v in range(nr_nodes): first_part = self._mu1 * self._Pinj[v, 0] second_p...
[ "def", "calculate_mad", "(", "self", ")", ":", "print", "\"\\n...Calculating modified adsorption.\"", "nr_nodes", "=", "self", ".", "_W", ".", "shape", "[", "0", "]", "self", ".", "_Yh", "=", "lil_matrix", "(", "self", ".", "_Y", ".", "copy", "(", ")", "...
TODO: This does not work cause flattening and to array-ing is not memory cool so it fails.
[ "TODO", ":", "This", "does", "not", "work", "cause", "flattening", "and", "to", "array", "-", "ing", "is", "not", "memory", "cool", "so", "it", "fails", "." ]
[ "# 1. Initialize Yhat", "# 2. Calculate Mvv", "# self._M = lil_matrix(np.diag((self._mu1*self._Pinj).toarray().flatten()) + (np.eye(nr_nodes)*self._mu3))", "\"\"\"\n TODO: This does not work cause flattening and to array-ing is not memory cool so it fails. Need to find a way to\n build this ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f7958a3f8d9f0b4c364ca0f99a3d3ce60ea47a80
AwesomeTrading/LeanParameterOptimization
Jtc.Optimization.LeanOptimizer.Example/ParameterizedSharedAppDomainAlgorithm.py
[ "Apache-2.0" ]
Python
Initialize
null
def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.SetStartDate(2013, 10, 8) #Set Start Date self.SetEndDate(2013, 10, 10) #Set End Date self.SetCash(100000) ...
Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
[ "Initialise", "the", "data", "and", "resolution", "required", "as", "well", "as", "the", "cash", "and", "start", "-", "end", "dates", "for", "your", "algorithm", ".", "All", "algorithms", "must", "initialized", "." ]
def Initialize(self): self.SetStartDate(2013, 10, 8) self.SetEndDate(2013, 10, 10) self.SetCash(100000) self.AddEquity("SPY") self.instancedConfig = InstancedConfig(self); ema_fast = self.instancedConfig.GetValue[int]("fast", 1) ema_slow = self...
[ "def", "Initialize", "(", "self", ")", ":", "self", ".", "SetStartDate", "(", "2013", ",", "10", ",", "8", ")", "self", ".", "SetEndDate", "(", "2013", ",", "10", ",", "10", ")", "self", ".", "SetCash", "(", "100000", ")", "self", ".", "AddEquity",...
Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm.
[ "Initialise", "the", "data", "and", "resolution", "required", "as", "well", "as", "the", "cash", "and", "start", "-", "end", "dates", "for", "your", "algorithm", "." ]
[ "'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''", "#Set Start Date", "#Set End Date", "#Set Strategy Cash", "# Find more symbols here: http://quantconnect.com/data", "# Receive parameters from the Job", "# T...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f7958a3f8d9f0b4c364ca0f99a3d3ce60ea47a80
AwesomeTrading/LeanParameterOptimization
Jtc.Optimization.LeanOptimizer.Example/ParameterizedSharedAppDomainAlgorithm.py
[ "Apache-2.0" ]
Python
OnData
<not_specific>
def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.''' # wait for our indicators to ready if not self.fast.IsReady or not self.slow.IsReady: return fast = self.fast.Current.Value slow = s...
OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
[ "OnData", "event", "is", "the", "primary", "entry", "point", "for", "your", "algorithm", ".", "Each", "new", "data", "point", "will", "be", "pumped", "in", "here", "." ]
def OnData(self, data): if not self.fast.IsReady or not self.slow.IsReady: return fast = self.fast.Current.Value slow = self.slow.Current.Value if fast > slow * 1.001: self.SetHoldings("SPY", 1) elif self.Portfolio.HoldStock and self.Portfolio["SPY"].Unrea...
[ "def", "OnData", "(", "self", ",", "data", ")", ":", "if", "not", "self", ".", "fast", ".", "IsReady", "or", "not", "self", ".", "slow", ".", "IsReady", ":", "return", "fast", "=", "self", ".", "fast", ".", "Current", ".", "Value", "slow", "=", "...
OnData event is the primary entry point for your algorithm.
[ "OnData", "event", "is", "the", "primary", "entry", "point", "for", "your", "algorithm", "." ]
[ "'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''", "# wait for our indicators to ready", "#self.Log(\"fast:\" + str(fast) + \"slow:\" + str(slow)+ \"take:\" + str(self.take))" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
1cf3eb8c262a5d827fde496519d1000f695ef90d
ioneone/alice
weather.py
[ "MIT" ]
Python
check_rain_today
<not_specific>
def check_rain_today(self): """Check if it will rain today.""" hourly_forecast = self.get_hourly_forecast() # only care about next 12 hours hourly_forecast = hourly_forecast[:12] # weather conditions smaller than 700 mean rain, snow, storm, etc return any(hourly['weather'...
Check if it will rain today.
Check if it will rain today.
[ "Check", "if", "it", "will", "rain", "today", "." ]
def check_rain_today(self): hourly_forecast = self.get_hourly_forecast() hourly_forecast = hourly_forecast[:12] return any(hourly['weather'][0]['id'] < 700 for hourly in hourly_forecast)
[ "def", "check_rain_today", "(", "self", ")", ":", "hourly_forecast", "=", "self", ".", "get_hourly_forecast", "(", ")", "hourly_forecast", "=", "hourly_forecast", "[", ":", "12", "]", "return", "any", "(", "hourly", "[", "'weather'", "]", "[", "0", "]", "[...
Check if it will rain today.
[ "Check", "if", "it", "will", "rain", "today", "." ]
[ "\"\"\"Check if it will rain today.\"\"\"", "# only care about next 12 hours", "# weather conditions smaller than 700 mean rain, snow, storm, etc" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fdd0d4cc21752839121cda576970db1152849a0c
ioneone/alice
notification.py
[ "MIT" ]
Python
send
null
def send(self, to_addrs: str, subject: str, body: str): """Sends a message to me as Alice.""" msg = MIMEMultipart() msg['From'] = BOT_GMAIL_ADDRESS msg['To'] = to_addrs msg['Subject'] = subject msg.attach(MIMEText(body)) # Message through SMS Gateway is not prope...
Sends a message to me as Alice.
Sends a message to me as Alice.
[ "Sends", "a", "message", "to", "me", "as", "Alice", "." ]
def send(self, to_addrs: str, subject: str, body: str): msg = MIMEMultipart() msg['From'] = BOT_GMAIL_ADDRESS msg['To'] = to_addrs msg['Subject'] = subject msg.attach(MIMEText(body)) msg.attach(MIMEText('')) with smtplib.SMTP('smtp.gmail.com') as connection: ...
[ "def", "send", "(", "self", ",", "to_addrs", ":", "str", ",", "subject", ":", "str", ",", "body", ":", "str", ")", ":", "msg", "=", "MIMEMultipart", "(", ")", "msg", "[", "'From'", "]", "=", "BOT_GMAIL_ADDRESS", "msg", "[", "'To'", "]", "=", "to_ad...
Sends a message to me as Alice.
[ "Sends", "a", "message", "to", "me", "as", "Alice", "." ]
[ "\"\"\"Sends a message to me as Alice.\"\"\"", "# Message through SMS Gateway is not properly encoded unless there are 2 or more MIME parts." ]
[ { "param": "self", "type": null }, { "param": "to_addrs", "type": "str" }, { "param": "subject", "type": "str" }, { "param": "body", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "to_addrs", "type": "str", "docstring": null, "docstring_token...
d28a5fb36a8ffcbf209e1d1f06135801de45b0be
rubenvf/Frecuency-plot-package
frecuency_plot.py
[ "MIT" ]
Python
split_array_like
<not_specific>
def split_array_like (self): ''' Method to separate all the single values in the array and append them to a list. It iterates trough all the rows in the data Args: None Returns: pandasseries: list of values ''' ...
Method to separate all the single values in the array and append them to a list. It iterates trough all the rows in the data Args: None Returns: pandasseries: list of values
Method to separate all the single values in the array and append them to a list. It iterates trough all the rows in the data None list of values
[ "Method", "to", "separate", "all", "the", "single", "values", "in", "the", "array", "and", "append", "them", "to", "a", "list", ".", "It", "iterates", "trough", "all", "the", "rows", "in", "the", "data", "None", "list", "of", "values" ]
def split_array_like (self): temp = self.data.value_counts().reset_index() temp.rename(columns = {'index': 'method', 'col_name':'count'}, inplace = True) temp['method'] = temp['method'].str.split(self.sep_type) val_list = [] for i in range(temp.shap...
[ "def", "split_array_like", "(", "self", ")", ":", "temp", "=", "self", ".", "data", ".", "value_counts", "(", ")", ".", "reset_index", "(", ")", "temp", ".", "rename", "(", "columns", "=", "{", "'index'", ":", "'method'", ",", "'col_name'", ":", "'coun...
Method to separate all the single values in the array and append them to a list.
[ "Method", "to", "separate", "all", "the", "single", "values", "in", "the", "array", "and", "append", "them", "to", "a", "list", "." ]
[ "'''\r\n Method to separate all the single values in the array and append them\r\n to a list. It iterates trough all the rows in the data\r\n \r\n Args: \r\n None\r\n \r\n Returns: \r\n pandasseries: list of values\r\n '''", "#Order values by ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d28a5fb36a8ffcbf209e1d1f06135801de45b0be
rubenvf/Frecuency-plot-package
frecuency_plot.py
[ "MIT" ]
Python
calculate_percentage
null
def calculate_percentage(self): ''' Method to calculate the frecuency of ocurrence of each unique value in a pandas series. Args: None Returns: pandasseries: frecuency of occurrence of each unique value ''' ...
Method to calculate the frecuency of ocurrence of each unique value in a pandas series. Args: None Returns: pandasseries: frecuency of occurrence of each unique value
Method to calculate the frecuency of ocurrence of each unique value in a pandas series. None frecuency of occurrence of each unique value
[ "Method", "to", "calculate", "the", "frecuency", "of", "ocurrence", "of", "each", "unique", "value", "in", "a", "pandas", "series", ".", "None", "frecuency", "of", "occurrence", "of", "each", "unique", "value" ]
def calculate_percentage(self): split = self.split_array_like () self.ratio = split.value_counts()/self.data.shape[0]
[ "def", "calculate_percentage", "(", "self", ")", ":", "split", "=", "self", ".", "split_array_like", "(", ")", "self", ".", "ratio", "=", "split", ".", "value_counts", "(", ")", "/", "self", ".", "data", ".", "shape", "[", "0", "]" ]
Method to calculate the frecuency of ocurrence of each unique value in a pandas series.
[ "Method", "to", "calculate", "the", "frecuency", "of", "ocurrence", "of", "each", "unique", "value", "in", "a", "pandas", "series", "." ]
[ "'''\r\n Method to calculate the frecuency of ocurrence of each unique value in\r\n a pandas series.\r\n \r\n Args: \r\n None\r\n \r\n Returns: \r\n pandasseries: frecuency of occurrence of each unique value\r\n '''", "#Calculate the unique va...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d28a5fb36a8ffcbf209e1d1f06135801de45b0be
rubenvf/Frecuency-plot-package
frecuency_plot.py
[ "MIT" ]
Python
barplot
<not_specific>
def barplot(self): ''' Method to plot the frecuency of occurrence of each unique value ------- Args: None Returns: ax object: bar plot of the ratio variable ''' temp = self.ratio.head(self.n_bars) ...
Method to plot the frecuency of occurrence of each unique value ------- Args: None Returns: ax object: bar plot of the ratio variable
Method to plot the frecuency of occurrence of each unique value None ax object: bar plot of the ratio variable
[ "Method", "to", "plot", "the", "frecuency", "of", "occurrence", "of", "each", "unique", "value", "None", "ax", "object", ":", "bar", "plot", "of", "the", "ratio", "variable" ]
def barplot(self): temp = self.ratio.head(self.n_bars) plt.figure(figsize = self.size) ax = sb.barplot(temp.values, temp.index, orient='h', color = self.color) plt.title(self.title, fontsize = 18, loc = 'left', pad = 20) ax.spines['top'].set_visible(False) ax.spines['righ...
[ "def", "barplot", "(", "self", ")", ":", "temp", "=", "self", ".", "ratio", ".", "head", "(", "self", ".", "n_bars", ")", "plt", ".", "figure", "(", "figsize", "=", "self", ".", "size", ")", "ax", "=", "sb", ".", "barplot", "(", "temp", ".", "v...
Method to plot the frecuency of occurrence of each unique value
[ "Method", "to", "plot", "the", "frecuency", "of", "occurrence", "of", "each", "unique", "value" ]
[ "'''\r\n \r\n\r\n Method to plot the frecuency of occurrence of each unique value\r\n -------\r\n Args: \r\n None\r\n \r\n Returns: \r\n ax object: bar plot of the ratio variable\r\n '''", "#Remove plot frame\r", "#Draw y grid below the bars...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3abc9e97f99b1f4081eeba0a25c9b54dfe3c2717
FastyBird/fb-mqtt-connector-plugin
fastybird_fb_mqtt_connector/connector.py
[ "Apache-2.0" ]
Python
stop
None
def stop(self) -> None: """Close all opened connections & stop connector""" if self.__client is not None: self.__client.stop() # When connector is closing... for device in self.__devices_registry: # ...set device state to disconnected self.__devices_r...
Close all opened connections & stop connector
Close all opened connections & stop connector
[ "Close", "all", "opened", "connections", "&", "stop", "connector" ]
def stop(self) -> None: if self.__client is not None: self.__client.stop() for device in self.__devices_registry: self.__devices_registry.set_state(device=device, state=ConnectionState.DISCONNECTED) self.__events_listener.close() self.__logger.info("Connector has ...
[ "def", "stop", "(", "self", ")", "->", "None", ":", "if", "self", ".", "__client", "is", "not", "None", ":", "self", ".", "__client", ".", "stop", "(", ")", "for", "device", "in", "self", ".", "__devices_registry", ":", "self", ".", "__devices_registry...
Close all opened connections & stop connector
[ "Close", "all", "opened", "connections", "&", "stop", "connector" ]
[ "\"\"\"Close all opened connections & stop connector\"\"\"", "# When connector is closing...", "# ...set device state to disconnected" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3abc9e97f99b1f4081eeba0a25c9b54dfe3c2717
FastyBird/fb-mqtt-connector-plugin
fastybird_fb_mqtt_connector/connector.py
[ "Apache-2.0" ]
Python
write_property
None
def write_property( # pylint: disable=too-many-branches self, property_item: Union[DevicePropertyEntity, ChannelPropertyEntity], data: Dict, ) -> None: """Write device or channel property value to device""" if self.__stopped: self.__logger.warning("Connector is s...
Write device or channel property value to device
Write device or channel property value to device
[ "Write", "device", "or", "channel", "property", "value", "to", "device" ]
def write_property( self, property_item: Union[DevicePropertyEntity, ChannelPropertyEntity], data: Dict, ) -> None: if self.__stopped: self.__logger.warning("Connector is stopped, value can't be written") return if isinstance(property_item, (DeviceDy...
[ "def", "write_property", "(", "self", ",", "property_item", ":", "Union", "[", "DevicePropertyEntity", ",", "ChannelPropertyEntity", "]", ",", "data", ":", "Dict", ",", ")", "->", "None", ":", "if", "self", ".", "__stopped", ":", "self", ".", "__logger", "...
Write device or channel property value to device
[ "Write", "device", "or", "channel", "property", "value", "to", "device" ]
[ "# pylint: disable=too-many-branches", "\"\"\"Write device or channel property value to device\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "property_item", "type": "Union[DevicePropertyEntity, ChannelPropertyEntity]" }, { "param": "data", "type": "Dict" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "property_item", "type": "Union[DevicePropertyEntity, ChannelPropertyEntit...
9e808b0011b9d7bb4366ee41c25469c48c7ef0b0
FateScript/YOLOX-1
yolox/core/trainer.py
[ "Apache-2.0" ]
Python
after_iter
null
def after_iter(self): """ `after_iter` contains two parts of logic: * log information * reset setting of resize """ # log needed information if (self.iter + 1) % self.exp.print_interval == 0: left_iters = self.max_iter * self.max_epoch - (self....
`after_iter` contains two parts of logic: * log information * reset setting of resize
`after_iter` contains two parts of logic: log information reset setting of resize
[ "`", "after_iter", "`", "contains", "two", "parts", "of", "logic", ":", "log", "information", "reset", "setting", "of", "resize" ]
def after_iter(self): if (self.iter + 1) % self.exp.print_interval == 0: left_iters = self.max_iter * self.max_epoch - (self.progress_in_iter + 1) eta_seconds = self.meter["iter_time"].global_avg * left_iters eta_str = "ETA: {}".format(datetime.timedelta(seconds=int(eta_secon...
[ "def", "after_iter", "(", "self", ")", ":", "if", "(", "self", ".", "iter", "+", "1", ")", "%", "self", ".", "exp", ".", "print_interval", "==", "0", ":", "left_iters", "=", "self", ".", "max_iter", "*", "self", ".", "max_epoch", "-", "(", "self", ...
`after_iter` contains two parts of logic: log information reset setting of resize
[ "`", "after_iter", "`", "contains", "two", "parts", "of", "logic", ":", "log", "information", "reset", "setting", "of", "resize" ]
[ "\"\"\"\n `after_iter` contains two parts of logic:\n * log information\n * reset setting of resize\n \"\"\"", "# log needed information", "# random resizing" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ee8b89647b0ba92f3b62342224c06db841260ccf
FateScript/YOLOX-1
yolox/utils/comm.py
[ "Apache-2.0" ]
Python
gather_pyobj
<not_specific>
def gather_pyobj(obj, obj_name, target_rank_id=0, reset_after_gather=True): """ gather non tensor object into target rank. Args: obj (object): object to gather, for non python-buildin object, please make sure that it's picklable, otherwise gather process might be stucked. obj_na...
gather non tensor object into target rank. Args: obj (object): object to gather, for non python-buildin object, please make sure that it's picklable, otherwise gather process might be stucked. obj_name (str): name of pyobj, used for distributed client. target_rank_id (int):...
gather non tensor object into target rank.
[ "gather", "non", "tensor", "object", "into", "target", "rank", "." ]
def gather_pyobj(obj, obj_name, target_rank_id=0, reset_after_gather=True): world_size = dist.get_world_size() if world_size == 1: return [obj] local_rank = dist.get_rank() if local_rank == target_rank_id: obj_list = [] for rank in range(world_size): if rank == target...
[ "def", "gather_pyobj", "(", "obj", ",", "obj_name", ",", "target_rank_id", "=", "0", ",", "reset_after_gather", "=", "True", ")", ":", "world_size", "=", "dist", ".", "get_world_size", "(", ")", "if", "world_size", "==", "1", ":", "return", "[", "obj", "...
gather non tensor object into target rank.
[ "gather", "non", "tensor", "object", "into", "target", "rank", "." ]
[ "\"\"\"\n gather non tensor object into target rank.\n\n Args:\n obj (object): object to gather, for non python-buildin object, please\n make sure that it's picklable, otherwise gather process might be stucked.\n obj_name (str): name of pyobj, used for distributed client.\n tar...
[ { "param": "obj", "type": null }, { "param": "obj_name", "type": null }, { "param": "target_rank_id", "type": null }, { "param": "reset_after_gather", "type": null } ]
{ "returns": [ { "docstring": "A list contains all objects if on target device, else None.", "docstring_tokens": [ "A", "list", "contains", "all", "objects", "if", "on", "target", "device", "else", "None", ...
c1dabd4eadc3715dcf5941bea81bbc5e1381c579
FateScript/YOLOX-1
yolox/evaluators/coco_evaluator.py
[ "Apache-2.0" ]
Python
evaluate
<not_specific>
def evaluate(self, model, distributed=False, half=False, test_size=None): """ COCO average precision (AP) Evaluation. Iterate inference on the test dataset and the results are evaluated by COCO API. NOTE: This function will change training mode to False, please save states if needed. ...
COCO average precision (AP) Evaluation. Iterate inference on the test dataset and the results are evaluated by COCO API. NOTE: This function will change training mode to False, please save states if needed. Args: model : model to evaluate. Returns: ap5...
COCO average precision (AP) Evaluation. Iterate inference on the test dataset and the results are evaluated by COCO API. This function will change training mode to False, please save states if needed.
[ "COCO", "average", "precision", "(", "AP", ")", "Evaluation", ".", "Iterate", "inference", "on", "the", "test", "dataset", "and", "the", "results", "are", "evaluated", "by", "COCO", "API", ".", "This", "function", "will", "change", "training", "mode", "to", ...
def evaluate(self, model, distributed=False, half=False, test_size=None): model.eval() ids = [] data_list = [] progress_bar = tqdm if self.is_main_process else iter inference_time = 0 nms_time = 0 n_samples = len(self.dataloader) - 1 for cur_iter, (imgs, _...
[ "def", "evaluate", "(", "self", ",", "model", ",", "distributed", "=", "False", ",", "half", "=", "False", ",", "test_size", "=", "None", ")", ":", "model", ".", "eval", "(", ")", "ids", "=", "[", "]", "data_list", "=", "[", "]", "progress_bar", "=...
COCO average precision (AP) Evaluation.
[ "COCO", "average", "precision", "(", "AP", ")", "Evaluation", "." ]
[ "\"\"\"\n COCO average precision (AP) Evaluation. Iterate inference on the test dataset\n and the results are evaluated by COCO API.\n\n NOTE: This function will change training mode to False, please save states if needed.\n\n Args:\n model : model to evaluate.\n\n Retu...
[ { "param": "self", "type": null }, { "param": "model", "type": null }, { "param": "distributed", "type": null }, { "param": "half", "type": null }, { "param": "test_size", "type": null } ]
{ "returns": [ { "docstring": "ap50_95 (float) : COCO AP of IoU=50:95\nap50 (float) : COCO AP of IoU=50\nsummary (sr): summary info of evaluation.", "docstring_tokens": [ "ap50_95", "(", "float", ")", ":", "COCO", "AP", "of", "IoU...
efbed504ee3a27914bb4bb945d685f6154e6e9e7
tomas-dostal/streamlit_elections_grapher
data.py
[ "MIT" ]
Python
update
null
def update(self): """ Overwrite existing data with new ones downloaded from volby.cz by __fetch_data(). Data is downloaded for all NUTS units separately due to the limitation on server site. :return: """ # It there was a change, then without a diff it is cheaper (and muc...
Overwrite existing data with new ones downloaded from volby.cz by __fetch_data(). Data is downloaded for all NUTS units separately due to the limitation on server site. :return:
Overwrite existing data with new ones downloaded from volby.cz by __fetch_data(). Data is downloaded for all NUTS units separately due to the limitation on server site.
[ "Overwrite", "existing", "data", "with", "new", "ones", "downloaded", "from", "volby", ".", "cz", "by", "__fetch_data", "()", ".", "Data", "is", "downloaded", "for", "all", "NUTS", "units", "separately", "due", "to", "the", "limitation", "on", "server", "sit...
def update(self): self.df.drop(self.df.index, inplace=True) self.df = pd.DataFrame(data={}) pool = ThreadPool(processes=32) multiple_results = [pool.apply_async( Data.__fetch_data, (self, nuts)) for nuts in NUTS] [self.__add_to_dataframe(res.get(timeout=10)) for res i...
[ "def", "update", "(", "self", ")", ":", "self", ".", "df", ".", "drop", "(", "self", ".", "df", ".", "index", ",", "inplace", "=", "True", ")", "self", ".", "df", "=", "pd", ".", "DataFrame", "(", "data", "=", "{", "}", ")", "pool", "=", "Thr...
Overwrite existing data with new ones downloaded from volby.cz by __fetch_data().
[ "Overwrite", "existing", "data", "with", "new", "ones", "downloaded", "from", "volby", ".", "cz", "by", "__fetch_data", "()", "." ]
[ "\"\"\"\n Overwrite existing data with new ones downloaded from volby.cz by __fetch_data().\n Data is downloaded for all NUTS units separately due to the limitation on server site.\n :return:\n \"\"\"", "# It there was a change, then without a diff it is cheaper (and much faster) to de...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
efbed504ee3a27914bb4bb945d685f6154e6e9e7
tomas-dostal/streamlit_elections_grapher
data.py
[ "MIT" ]
Python
__fetch_data
<not_specific>
def __fetch_data(self, nuts): """ Download elections data from volby.cz based on selected NUTS (something between region and district) and extract usedful data :param nuts: something between region and district, e.g. "CZ0412", see nuts_dial.txt :return: array[Dict of extracted da...
Download elections data from volby.cz based on selected NUTS (something between region and district) and extract usedful data :param nuts: something between region and district, e.g. "CZ0412", see nuts_dial.txt :return: array[Dict of extracted data]
Download elections data from volby.cz based on selected NUTS (something between region and district) and extract usedful data
[ "Download", "elections", "data", "from", "volby", ".", "cz", "based", "on", "selected", "NUTS", "(", "something", "between", "region", "and", "district", ")", "and", "extract", "usedful", "data" ]
def __fetch_data(self, nuts): url = "https://volby.cz/pls/ps2017nss/vysledky_okres?nuts={}".format( nuts) r = requests.get(url, allow_redirects=True) while r.status_code != 200: r = requests.get(url, allow_redirects=True) print('Retrying {}!'.format(nuts)) ...
[ "def", "__fetch_data", "(", "self", ",", "nuts", ")", ":", "url", "=", "\"https://volby.cz/pls/ps2017nss/vysledky_okres?nuts={}\"", ".", "format", "(", "nuts", ")", "r", "=", "requests", ".", "get", "(", "url", ",", "allow_redirects", "=", "True", ")", "while"...
Download elections data from volby.cz based on selected NUTS (something between region and district) and extract usedful data
[ "Download", "elections", "data", "from", "volby", ".", "cz", "based", "on", "selected", "NUTS", "(", "something", "between", "region", "and", "district", ")", "and", "extract", "usedful", "data" ]
[ "\"\"\"\n Download elections data from volby.cz based on selected NUTS (something between region and district) and extract\n usedful data\n :param nuts: something between region and district, e.g. \"CZ0412\", see nuts_dial.txt\n :return: array[Dict of extracted data]\n \"\"\"", ...
[ { "param": "self", "type": null }, { "param": "nuts", "type": null } ]
{ "returns": [ { "docstring": "array[Dict of extracted data]", "docstring_tokens": [ "array", "[", "Dict", "of", "extracted", "data", "]" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", ...
6b8442218ef19614d3cf38bd2ae7f955f9715239
tomas-dostal/streamlit_elections_grapher
app.py
[ "MIT" ]
Python
run
null
def run(self, location=None): """ Run election's grapher final state machine. :param location: [optional] location entered by a command line argument :return: None """ # Final state machine # type in place / receive in an argument # If unique result found...
Run election's grapher final state machine. :param location: [optional] location entered by a command line argument :return: None
Run election's grapher final state machine.
[ "Run", "election", "'", "s", "grapher", "final", "state", "machine", "." ]
def run(self, location=None): options = [] offset = 0 place = None current_state = States.UPDATE_DATA next_state = States.SEARCH while True: if current_state == States.SEARCH: clear() offset = 0 print("Elections ...
[ "def", "run", "(", "self", ",", "location", "=", "None", ")", ":", "options", "=", "[", "]", "offset", "=", "0", "place", "=", "None", "current_state", "=", "States", ".", "UPDATE_DATA", "next_state", "=", "States", ".", "SEARCH", "while", "True", ":",...
Run election's grapher final state machine.
[ "Run", "election", "'", "s", "grapher", "final", "state", "machine", "." ]
[ "\"\"\"\n Run election's grapher final state machine.\n :param location: [optional] location entered by a command line argument\n :return: None\n \"\"\"", "# Final state machine", "# type in place / receive in an argument", "# If unique result found, view graph", "# - return to...
[ { "param": "self", "type": null }, { "param": "location", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
c17dbfd7233dc612dfa585094856ed8d15d07a11
Preshehi/reservoir-engineering
Unit 10 Gas-Condensate Reservoirs/functions/materialbalance.py
[ "MIT" ]
Python
condensate_belowdew
<not_specific>
def condensate_belowdew(Rs, Rv, Rsi, Rvi, Bo, Bg, Np, Gp): """ Calculate the parameters for material balance plot of gas-condensate reservoirs below dewpoint pressure Input: Rs: array Rv: array Rsi: initial Rs, float (NOTE: if data doesn't provide, calculate it with calculate_condensate_par...
Calculate the parameters for material balance plot of gas-condensate reservoirs below dewpoint pressure Input: Rs: array Rv: array Rsi: initial Rs, float (NOTE: if data doesn't provide, calculate it with calculate_condensate_params function) Rvi: initial Rv, float (from data Rv) Bo: ar...
Calculate the parameters for material balance plot of gas-condensate reservoirs below dewpoint pressure Material balance plots: Plot 10.1: F vs Eg array Eg: array
[ "Calculate", "the", "parameters", "for", "material", "balance", "plot", "of", "gas", "-", "condensate", "reservoirs", "below", "dewpoint", "pressure", "Material", "balance", "plots", ":", "Plot", "10", ".", "1", ":", "F", "vs", "Eg", "array", "Eg", ":", "a...
def condensate_belowdew(Rs, Rv, Rsi, Rvi, Bo, Bg, Np, Gp): Btg = ((Bg * (1 - (Rs * Rvi))) + (Bo * (Rvi - Rv))) / (1 - (Rv * Rs)) Bto = ((Bo * (1 - (Rv * Rsi))) + (Bg * (Rsi - Rs))) / (1 - (Rv * Rs)) Gi = 0 F = (Np * ((Bo - (Rs * Bg)) / (1 - (Rv * Rs)))) + ((Gp - Gi) * ((Bg - (Rv * Bo)) / (1 - (Rv * Rs...
[ "def", "condensate_belowdew", "(", "Rs", ",", "Rv", ",", "Rsi", ",", "Rvi", ",", "Bo", ",", "Bg", ",", "Np", ",", "Gp", ")", ":", "Btg", "=", "(", "(", "Bg", "*", "(", "1", "-", "(", "Rs", "*", "Rvi", ")", ")", ")", "+", "(", "Bo", "*", ...
Calculate the parameters for material balance plot of gas-condensate reservoirs below dewpoint pressure
[ "Calculate", "the", "parameters", "for", "material", "balance", "plot", "of", "gas", "-", "condensate", "reservoirs", "below", "dewpoint", "pressure" ]
[ "\"\"\"\n Calculate the parameters for material balance plot of gas-condensate reservoirs\n below dewpoint pressure\n\n Input:\n Rs: array\n Rv: array\n Rsi: initial Rs, float (NOTE: if data doesn't provide, calculate it with calculate_condensate_params function)\n Rvi: initial Rv, float (from ...
[ { "param": "Rs", "type": null }, { "param": "Rv", "type": null }, { "param": "Rsi", "type": null }, { "param": "Rvi", "type": null }, { "param": "Bo", "type": null }, { "param": "Bg", "type": null }, { "param": "Np", "type": null }, ...
{ "returns": [], "raises": [], "params": [ { "identifier": "Rs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Rv", "type": null, "docstring": null, "docstring_tokens": [], ...
8bde2e58ba6928d484ea08d39c4b9511dc91ca12
dp0h/candlesticks
mktdata.py
[ "MIT" ]
Python
_check_db
<not_specific>
def _check_db(symbols, from_date, to_date): ''' Checks in very naive way if marketdata db is created and populated with data ''' try: l = list(Symbols().symbols()) if len(l) < len(symbols): return False if len(_get_marketdata(symbols[0], from_date, from_date + timedelta(days=...
Checks in very naive way if marketdata db is created and populated with data
Checks in very naive way if marketdata db is created and populated with data
[ "Checks", "in", "very", "naive", "way", "if", "marketdata", "db", "is", "created", "and", "populated", "with", "data" ]
def _check_db(symbols, from_date, to_date): try: l = list(Symbols().symbols()) if len(l) < len(symbols): return False if len(_get_marketdata(symbols[0], from_date, from_date + timedelta(days=10))) == 0: return False if len(_get_marketdata(symbols[-1], to_dat...
[ "def", "_check_db", "(", "symbols", ",", "from_date", ",", "to_date", ")", ":", "try", ":", "l", "=", "list", "(", "Symbols", "(", ")", ".", "symbols", "(", ")", ")", "if", "len", "(", "l", ")", "<", "len", "(", "symbols", ")", ":", "return", "...
Checks in very naive way if marketdata db is created and populated with data
[ "Checks", "in", "very", "naive", "way", "if", "marketdata", "db", "is", "created", "and", "populated", "with", "data" ]
[ "''' Checks in very naive way if marketdata db is created and populated with data '''", "# check if we have market data for first equity", "# check if we have market data for the last equity" ]
[ { "param": "symbols", "type": null }, { "param": "from_date", "type": null }, { "param": "to_date", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "symbols", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "from_date", "type": null, "docstring": null, "docstring_to...
8bde2e58ba6928d484ea08d39c4b9511dc91ca12
dp0h/candlesticks
mktdata.py
[ "MIT" ]
Python
_to_talib_format
<not_specific>
def _to_talib_format(mdata): ''' Converts market data to talib format ''' if len(mdata) == 0: return None res = {} for x in _AllFiels: res[x] = np.array([]) for md in mdata: for x in _AllFiels: res[x] = np.append(res[x], md[x]) return res
Converts market data to talib format
Converts market data to talib format
[ "Converts", "market", "data", "to", "talib", "format" ]
def _to_talib_format(mdata): if len(mdata) == 0: return None res = {} for x in _AllFiels: res[x] = np.array([]) for md in mdata: for x in _AllFiels: res[x] = np.append(res[x], md[x]) return res
[ "def", "_to_talib_format", "(", "mdata", ")", ":", "if", "len", "(", "mdata", ")", "==", "0", ":", "return", "None", "res", "=", "{", "}", "for", "x", "in", "_AllFiels", ":", "res", "[", "x", "]", "=", "np", ".", "array", "(", "[", "]", ")", ...
Converts market data to talib format
[ "Converts", "market", "data", "to", "talib", "format" ]
[ "''' Converts market data to talib format '''" ]
[ { "param": "mdata", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mdata", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8bde2e58ba6928d484ea08d39c4b9511dc91ca12
dp0h/candlesticks
mktdata.py
[ "MIT" ]
Python
has_split_dividents
<not_specific>
def has_split_dividents(mdata, from_date, to_date): ''' Verifies if market data interval has splits, dividends ''' from_diff = abs(mdata['close'][from_date] - mdata['adj_close'][from_date]) to_diff = abs(mdata['close'][to_date] - mdata['adj_close'][to_date]) if approx_equal(from_diff, to_diff, 0.0001): ...
Verifies if market data interval has splits, dividends
Verifies if market data interval has splits, dividends
[ "Verifies", "if", "market", "data", "interval", "has", "splits", "dividends" ]
def has_split_dividents(mdata, from_date, to_date): from_diff = abs(mdata['close'][from_date] - mdata['adj_close'][from_date]) to_diff = abs(mdata['close'][to_date] - mdata['adj_close'][to_date]) if approx_equal(from_diff, to_diff, 0.0001): return False return not percent_equal(from_diff, to_dif...
[ "def", "has_split_dividents", "(", "mdata", ",", "from_date", ",", "to_date", ")", ":", "from_diff", "=", "abs", "(", "mdata", "[", "'close'", "]", "[", "from_date", "]", "-", "mdata", "[", "'adj_close'", "]", "[", "from_date", "]", ")", "to_diff", "=", ...
Verifies if market data interval has splits, dividends
[ "Verifies", "if", "market", "data", "interval", "has", "splits", "dividends" ]
[ "''' Verifies if market data interval has splits, dividends '''" ]
[ { "param": "mdata", "type": null }, { "param": "from_date", "type": null }, { "param": "to_date", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mdata", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "from_date", "type": null, "docstring": null, "docstring_toke...
e5ffd4cad69040b2d1e2095bd0f4f2697620819b
dp0h/candlesticks
backtesting.py
[ "MIT" ]
Python
_process_position
<not_specific>
def _process_position(self, symbol, mdata_idx, mdata): ''' mdata_idx - position in market data when event happens ''' mdata_len = len(mdata['open']) open_idx = min(mdata_idx + 1, mdata_len - 1) # we can buy at day idx+1 close_idx = min(mdata_idx + 1 + self._hold_days, md...
mdata_idx - position in market data when event happens
position in market data when event happens
[ "position", "in", "market", "data", "when", "event", "happens" ]
def _process_position(self, symbol, mdata_idx, mdata): mdata_len = len(mdata['open']) open_idx = min(mdata_idx + 1, mdata_len - 1) close_idx = min(mdata_idx + 1 + self._hold_days, mdata_len - 1) if close_idx - open_idx < self._hold_days / 2: return if has_split_di...
[ "def", "_process_position", "(", "self", ",", "symbol", ",", "mdata_idx", ",", "mdata", ")", ":", "mdata_len", "=", "len", "(", "mdata", "[", "'open'", "]", ")", "open_idx", "=", "min", "(", "mdata_idx", "+", "1", ",", "mdata_len", "-", "1", ")", "cl...
mdata_idx - position in market data when event happens
[ "mdata_idx", "-", "position", "in", "market", "data", "when", "event", "happens" ]
[ "'''\n mdata_idx - position in market data when event happens\n '''", "# we can buy at day idx+1", "# skip events if we don't have enough days", "# skip events if split/dividents happens", "# skip odd events" ]
[ { "param": "self", "type": null }, { "param": "symbol", "type": null }, { "param": "mdata_idx", "type": null }, { "param": "mdata", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "symbol", "type": null, "docstring": null, "docstring_tokens":...
83a48cde224342eba81cca41c8902d2f0ecf97e0
MLMI2-CSSI/foundry
foundry/foundry.py
[ "MIT" ]
Python
load
<not_specific>
def load(self, name, download=True, globus=True, verbose=False, metadata=None, authorizers=None, **kwargs): """Load the metadata for a Foundry dataset into the client Args: name (str): Name of the foundry dataset download (bool): If True, download the data associated with the pac...
Load the metadata for a Foundry dataset into the client Args: name (str): Name of the foundry dataset download (bool): If True, download the data associated with the package (default is True) globus (bool): If True, download using Globus, otherwise https verbose (...
Load the metadata for a Foundry dataset into the client
[ "Load", "the", "metadata", "for", "a", "Foundry", "dataset", "into", "the", "client" ]
def load(self, name, download=True, globus=True, verbose=False, metadata=None, authorizers=None, **kwargs): if not name: raise ValueError("load: No dataset name is given") if metadata: res = metadata if metadata: res = metadata if is_doi(name) and not ...
[ "def", "load", "(", "self", ",", "name", ",", "download", "=", "True", ",", "globus", "=", "True", ",", "verbose", "=", "False", ",", "metadata", "=", "None", ",", "authorizers", "=", "None", ",", "**", "kwargs", ")", ":", "if", "not", "name", ":",...
Load the metadata for a Foundry dataset into the client
[ "Load", "the", "metadata", "for", "a", "Foundry", "dataset", "into", "the", "client" ]
[ "\"\"\"Load the metadata for a Foundry dataset into the client\n Args:\n name (str): Name of the foundry dataset\n download (bool): If True, download the data associated with the package (default is True)\n globus (bool): If True, download using Globus, otherwise https\n ...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "download", "type": null }, { "param": "globus", "type": null }, { "param": "verbose", "type": null }, { "param": "metadata", "type": null }, { "param": "autho...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": "Name of the foundry dataset", ...
83a48cde224342eba81cca41c8902d2f0ecf97e0
MLMI2-CSSI/foundry
foundry/foundry.py
[ "MIT" ]
Python
list
<not_specific>
def list(self): """List available Foundry data packages Returns ------- (pandas.DataFrame): DataFrame with summary list of Foundry data packages including name, title, and publication year """ res = ( self.forge_client.match_field( "mdf.or...
List available Foundry data packages Returns ------- (pandas.DataFrame): DataFrame with summary list of Foundry data packages including name, title, and publication year
List available Foundry data packages Returns (pandas.DataFrame): DataFrame with summary list of Foundry data packages including name, title, and publication year
[ "List", "available", "Foundry", "data", "packages", "Returns", "(", "pandas", ".", "DataFrame", ")", ":", "DataFrame", "with", "summary", "list", "of", "Foundry", "data", "packages", "including", "name", "title", "and", "publication", "year" ]
def list(self): res = ( self.forge_client.match_field( "mdf.organizations", self.config.organization) .match_resource_types("dataset") .search() ) return pd.DataFrame( [ { "source_id": r["mdf"]["s...
[ "def", "list", "(", "self", ")", ":", "res", "=", "(", "self", ".", "forge_client", ".", "match_field", "(", "\"mdf.organizations\"", ",", "self", ".", "config", ".", "organization", ")", ".", "match_resource_types", "(", "\"dataset\"", ")", ".", "search", ...
List available Foundry data packages Returns
[ "List", "available", "Foundry", "data", "packages", "Returns" ]
[ "\"\"\"List available Foundry data packages\n\n Returns\n -------\n (pandas.DataFrame): DataFrame with summary list of Foundry data packages including name, title, and publication year\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
83a48cde224342eba81cca41c8902d2f0ecf97e0
MLMI2-CSSI/foundry
foundry/foundry.py
[ "MIT" ]
Python
collect_dataframes
<not_specific>
def collect_dataframes(self, packages=[]): """Collect dataframes of local data packages Args: packages (list): List of packages to collect, defaults to all Returns ------- (tuple): Tuple of X(pandas.DataFrame), y(pandas.DataFrame) """ if not packag...
Collect dataframes of local data packages Args: packages (list): List of packages to collect, defaults to all Returns ------- (tuple): Tuple of X(pandas.DataFrame), y(pandas.DataFrame)
Collect dataframes of local data packages
[ "Collect", "dataframes", "of", "local", "data", "packages" ]
def collect_dataframes(self, packages=[]): if not packages: packages = self.get_packages() f = Foundry() X_frames = [] y_frames = [] for package in packages: self = self.load(package) X, y = self.load_data() X["source"] = package ...
[ "def", "collect_dataframes", "(", "self", ",", "packages", "=", "[", "]", ")", ":", "if", "not", "packages", ":", "packages", "=", "self", ".", "get_packages", "(", ")", "f", "=", "Foundry", "(", ")", "X_frames", "=", "[", "]", "y_frames", "=", "[", ...
Collect dataframes of local data packages
[ "Collect", "dataframes", "of", "local", "data", "packages" ]
[ "\"\"\"Collect dataframes of local data packages\n Args:\n packages (list): List of packages to collect, defaults to all\n\n Returns\n -------\n (tuple): Tuple of X(pandas.DataFrame), y(pandas.DataFrame)\n \"\"\"", "# TODO: update how this is unpacked, out of date"...
[ { "param": "self", "type": null }, { "param": "packages", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "packages", "type": null, "docstring": "List of packages to collect,...
83a48cde224342eba81cca41c8902d2f0ecf97e0
MLMI2-CSSI/foundry
foundry/foundry.py
[ "MIT" ]
Python
load_data
<not_specific>
def load_data(self, source_id=None, globus=True): """Load in the data associated with the prescribed dataset Tabular Data Type: Data are arranged in a standard data frame stored in self.dataframe_file. The contents are read, and File Data Type: <<Add desc>> For more complicate...
Load in the data associated with the prescribed dataset Tabular Data Type: Data are arranged in a standard data frame stored in self.dataframe_file. The contents are read, and File Data Type: <<Add desc>> For more complicated data structures, users should subclass Foundry and ...
Load in the data associated with the prescribed dataset Tabular Data Type: Data are arranged in a standard data frame stored in self.dataframe_file. The contents are read, and File Data Type: <> For more complicated data structures, users should subclass Foundry and override the load_data function
[ "Load", "in", "the", "data", "associated", "with", "the", "prescribed", "dataset", "Tabular", "Data", "Type", ":", "Data", "are", "arranged", "in", "a", "standard", "data", "frame", "stored", "in", "self", ".", "dataframe_file", ".", "The", "contents", "are"...
def load_data(self, source_id=None, globus=True): data = {} try: if self.dataset.splits: for split in self.dataset.splits: data[split.label] = self._load_data(file=split.path, source_id=source_id, glo...
[ "def", "load_data", "(", "self", ",", "source_id", "=", "None", ",", "globus", "=", "True", ")", ":", "data", "=", "{", "}", "try", ":", "if", "self", ".", "dataset", ".", "splits", ":", "for", "split", "in", "self", ".", "dataset", ".", "splits", ...
Load in the data associated with the prescribed dataset Tabular Data Type: Data are arranged in a standard data frame stored in self.dataframe_file.
[ "Load", "in", "the", "data", "associated", "with", "the", "prescribed", "dataset", "Tabular", "Data", "Type", ":", "Data", "are", "arranged", "in", "a", "standard", "data", "frame", "stored", "in", "self", ".", "dataframe_file", "." ]
[ "\"\"\"Load in the data associated with the prescribed dataset\n\n Tabular Data Type: Data are arranged in a standard data frame\n stored in self.dataframe_file. The contents are read, and\n\n File Data Type: <<Add desc>>\n\n For more complicated data structures, users should\n su...
[ { "param": "self", "type": null }, { "param": "source_id", "type": null }, { "param": "globus", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "source_id", "type": null, "docstring": null, "docstring_token...
83a48cde224342eba81cca41c8902d2f0ecf97e0
MLMI2-CSSI/foundry
foundry/foundry.py
[ "MIT" ]
Python
check_status
<not_specific>
def check_status(self, source_id, short=False, raw=False): """Check the status of your submission. Arguments: source_id (str): The ``source_id`` (``source_name`` + version information) of the submission to check. Returned in the ``res`` result from ``publish()`` via MDF ...
Check the status of your submission. Arguments: source_id (str): The ``source_id`` (``source_name`` + version information) of the submission to check. Returned in the ``res`` result from ``publish()`` via MDF Connect Client. short (bool): When ``False``, will print a...
Check the status of your submission.
[ "Check", "the", "status", "of", "your", "submission", "." ]
def check_status(self, source_id, short=False, raw=False): return self.connect_client.check_status(source_id, short, raw)
[ "def", "check_status", "(", "self", ",", "source_id", ",", "short", "=", "False", ",", "raw", "=", "False", ")", ":", "return", "self", ".", "connect_client", ".", "check_status", "(", "source_id", ",", "short", ",", "raw", ")" ]
Check the status of your submission.
[ "Check", "the", "status", "of", "your", "submission", "." ]
[ "\"\"\"Check the status of your submission.\n\n Arguments:\n source_id (str): The ``source_id`` (``source_name`` + version information) of the\n submission to check. Returned in the ``res`` result from ``publish()`` via MDF Connect Client.\n short (bool): When ``False...
[ { "param": "self", "type": null }, { "param": "source_id", "type": null }, { "param": "short", "type": null }, { "param": "raw", "type": null } ]
{ "returns": [ { "docstring": "If ``raw`` is ``True``, *dict*: The full status result.", "docstring_tokens": [ "If", "`", "`", "raw", "`", "`", "is", "`", "`", "True", "`", "`", "*", "dict",...
0922f199ce0265cc9a49f3ec97ad31e9207a9fbd
guseph/AirBear
server/api_class.py
[ "MIT" ]
Python
build_search_url
str
def build_search_url(self, search_query: str) -> str: ''' this method builds a search url given parameters ''' query_parameters = [('q', search_query), ('format', 'json')] return self._url + '/search?' + urllib.parse.urlencode(query_parameters)
this method builds a search url given parameters
this method builds a search url given parameters
[ "this", "method", "builds", "a", "search", "url", "given", "parameters" ]
def build_search_url(self, search_query: str) -> str: query_parameters = [('q', search_query), ('format', 'json')] return self._url + '/search?' + urllib.parse.urlencode(query_parameters)
[ "def", "build_search_url", "(", "self", ",", "search_query", ":", "str", ")", "->", "str", ":", "query_parameters", "=", "[", "(", "'q'", ",", "search_query", ")", ",", "(", "'format'", ",", "'json'", ")", "]", "return", "self", ".", "_url", "+", "'/se...
this method builds a search url given parameters
[ "this", "method", "builds", "a", "search", "url", "given", "parameters" ]
[ "''' this method builds a search url given parameters '''" ]
[ { "param": "self", "type": null }, { "param": "search_query", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "search_query", "type": "str", "docstring": null, "docstring_t...
0922f199ce0265cc9a49f3ec97ad31e9207a9fbd
guseph/AirBear
server/api_class.py
[ "MIT" ]
Python
build_reverse_url
str
def build_reverse_url(self, latitude: float, longitude: float) -> str: ''' this method builds a search url given parameters ''' query_parameters = [('format', 'json'), ('lat', str(latitude)), ('lon', str(longitude))] return self._url + '/reverse?' + urllib.parse.urlencode(query_par...
this method builds a search url given parameters
this method builds a search url given parameters
[ "this", "method", "builds", "a", "search", "url", "given", "parameters" ]
def build_reverse_url(self, latitude: float, longitude: float) -> str: query_parameters = [('format', 'json'), ('lat', str(latitude)), ('lon', str(longitude))] return self._url + '/reverse?' + urllib.parse.urlencode(query_parameters)
[ "def", "build_reverse_url", "(", "self", ",", "latitude", ":", "float", ",", "longitude", ":", "float", ")", "->", "str", ":", "query_parameters", "=", "[", "(", "'format'", ",", "'json'", ")", ",", "(", "'lat'", ",", "str", "(", "latitude", ")", ")", ...
this method builds a search url given parameters
[ "this", "method", "builds", "a", "search", "url", "given", "parameters" ]
[ "''' this method builds a search url given parameters '''" ]
[ { "param": "self", "type": null }, { "param": "latitude", "type": "float" }, { "param": "longitude", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "latitude", "type": "float", "docstring": null, "docstring_tok...
0922f199ce0265cc9a49f3ec97ad31e9207a9fbd
guseph/AirBear
server/api_class.py
[ "MIT" ]
Python
check_incorrect_format
bool
def check_incorrect_format(self, url: str) -> bool: ''' checks to see if the json file is in incorrect format ''' response = None try: request = urllib.request.Request(url) response = urllib.request.urlopen(request) json_text = response.read(...
checks to see if the json file is in incorrect format
checks to see if the json file is in incorrect format
[ "checks", "to", "see", "if", "the", "json", "file", "is", "in", "incorrect", "format" ]
def check_incorrect_format(self, url: str) -> bool: response = None try: request = urllib.request.Request(url) response = urllib.request.urlopen(request) json_text = response.read().decode(encoding = 'utf-8') if not json_text: return True ...
[ "def", "check_incorrect_format", "(", "self", ",", "url", ":", "str", ")", "->", "bool", ":", "response", "=", "None", "try", ":", "request", "=", "urllib", ".", "request", ".", "Request", "(", "url", ")", "response", "=", "urllib", ".", "request", "."...
checks to see if the json file is in incorrect format
[ "checks", "to", "see", "if", "the", "json", "file", "is", "in", "incorrect", "format" ]
[ "''' checks to see if the json file is in incorrect format '''", "# checks to see if json is empty" ]
[ { "param": "self", "type": null }, { "param": "url", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": "str", "docstring": null, "docstring_tokens": [...
0922f199ce0265cc9a49f3ec97ad31e9207a9fbd
guseph/AirBear
server/api_class.py
[ "MIT" ]
Python
run_search_center
tuple
def run_search_center(search_query: str) -> tuple: ''' this function runs the search and retrieves the long and lat from OSM''' result = API('https://nominatim.openstreetmap.org/') url = result.build_search_url(search_query) latitude = 0 longitude = 0 # validate URL status = result.get_stat...
this function runs the search and retrieves the long and lat from OSM
this function runs the search and retrieves the long and lat from OSM
[ "this", "function", "runs", "the", "search", "and", "retrieves", "the", "long", "and", "lat", "from", "OSM" ]
def run_search_center(search_query: str) -> tuple: result = API('https://nominatim.openstreetmap.org/') url = result.build_search_url(search_query) latitude = 0 longitude = 0 status = result.get_status(url) incorrect_format = result.check_incorrect_format(url) network_error = result.check_ne...
[ "def", "run_search_center", "(", "search_query", ":", "str", ")", "->", "tuple", ":", "result", "=", "API", "(", "'https://nominatim.openstreetmap.org/'", ")", "url", "=", "result", ".", "build_search_url", "(", "search_query", ")", "latitude", "=", "0", "longit...
this function runs the search and retrieves the long and lat from OSM
[ "this", "function", "runs", "the", "search", "and", "retrieves", "the", "long", "and", "lat", "from", "OSM" ]
[ "''' this function runs the search and retrieves the long and lat from OSM'''", "# validate URL", "# if url is valid, continue finding lat and long" ]
[ { "param": "search_query", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "search_query", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0922f199ce0265cc9a49f3ec97ad31e9207a9fbd
guseph/AirBear
server/api_class.py
[ "MIT" ]
Python
run_search_offline
tuple
def run_search_offline(data_list: list) -> tuple: ''' runs the search function utilizing a json file on the hard drive for Nomanatim ''' data = Nominatim_API_Data(data_list) latitude = data.get_lat() longitude = data.get_lon() return latitude, longitude
runs the search function utilizing a json file on the hard drive for Nomanatim
runs the search function utilizing a json file on the hard drive for Nomanatim
[ "runs", "the", "search", "function", "utilizing", "a", "json", "file", "on", "the", "hard", "drive", "for", "Nomanatim" ]
def run_search_offline(data_list: list) -> tuple: data = Nominatim_API_Data(data_list) latitude = data.get_lat() longitude = data.get_lon() return latitude, longitude
[ "def", "run_search_offline", "(", "data_list", ":", "list", ")", "->", "tuple", ":", "data", "=", "Nominatim_API_Data", "(", "data_list", ")", "latitude", "=", "data", ".", "get_lat", "(", ")", "longitude", "=", "data", ".", "get_lon", "(", ")", "return", ...
runs the search function utilizing a json file on the hard drive for Nomanatim
[ "runs", "the", "search", "function", "utilizing", "a", "json", "file", "on", "the", "hard", "drive", "for", "Nomanatim" ]
[ "'''\n runs the search function utilizing a json file\n on the hard drive for Nomanatim\n '''" ]
[ { "param": "data_list", "type": "list" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data_list", "type": "list", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0922f199ce0265cc9a49f3ec97ad31e9207a9fbd
guseph/AirBear
server/api_class.py
[ "MIT" ]
Python
run_reverse
str
def run_reverse(latitude: float, longitude: float) -> str: ''' this functions runs the reverse geocoding and retrieves the full address''' result = API('https://nominatim.openstreetmap.org/') url = result.build_reverse_url(latitude, longitude) result = result.get_result(url) data = Nominatim_API_D...
this functions runs the reverse geocoding and retrieves the full address
this functions runs the reverse geocoding and retrieves the full address
[ "this", "functions", "runs", "the", "reverse", "geocoding", "and", "retrieves", "the", "full", "address" ]
def run_reverse(latitude: float, longitude: float) -> str: result = API('https://nominatim.openstreetmap.org/') url = result.build_reverse_url(latitude, longitude) result = result.get_result(url) data = Nominatim_API_Data(result) print(data.get_description())
[ "def", "run_reverse", "(", "latitude", ":", "float", ",", "longitude", ":", "float", ")", "->", "str", ":", "result", "=", "API", "(", "'https://nominatim.openstreetmap.org/'", ")", "url", "=", "result", ".", "build_reverse_url", "(", "latitude", ",", "longitu...
this functions runs the reverse geocoding and retrieves the full address
[ "this", "functions", "runs", "the", "reverse", "geocoding", "and", "retrieves", "the", "full", "address" ]
[ "''' this functions runs the reverse geocoding and retrieves the full address'''" ]
[ { "param": "latitude", "type": "float" }, { "param": "longitude", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "latitude", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "longitude", "type": "float", "docstring": null, "docst...
0922f199ce0265cc9a49f3ec97ad31e9207a9fbd
guseph/AirBear
server/api_class.py
[ "MIT" ]
Python
run_reverse_offline
str
def run_reverse_offline(paths: str, latitude: float, longitude: float) -> str: ''' this functions runs the reverse geocoding and retrieves the full address''' result = [] paths = paths.split(' ') for i in paths: i = i.replace('\\\\', '\\') with open(i, encoding= 'utf8') as f: ...
this functions runs the reverse geocoding and retrieves the full address
this functions runs the reverse geocoding and retrieves the full address
[ "this", "functions", "runs", "the", "reverse", "geocoding", "and", "retrieves", "the", "full", "address" ]
def run_reverse_offline(paths: str, latitude: float, longitude: float) -> str: result = [] paths = paths.split(' ') for i in paths: i = i.replace('\\\\', '\\') with open(i, encoding= 'utf8') as f: d = json.load(f) result.append(d) for i in result: lat = i[...
[ "def", "run_reverse_offline", "(", "paths", ":", "str", ",", "latitude", ":", "float", ",", "longitude", ":", "float", ")", "->", "str", ":", "result", "=", "[", "]", "paths", "=", "paths", ".", "split", "(", "' '", ")", "for", "i", "in", "paths", ...
this functions runs the reverse geocoding and retrieves the full address
[ "this", "functions", "runs", "the", "reverse", "geocoding", "and", "retrieves", "the", "full", "address" ]
[ "''' this functions runs the reverse geocoding and retrieves the full address'''", "# round to 4th decimal place to find a match more easily " ]
[ { "param": "paths", "type": "str" }, { "param": "latitude", "type": "float" }, { "param": "longitude", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "paths", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "latitude", "type": "float", "docstring": null, "docstring_t...
0922f199ce0265cc9a49f3ec97ad31e9207a9fbd
guseph/AirBear
server/api_class.py
[ "MIT" ]
Python
run_purpleair
list
def run_purpleair(threshold: int, max_num: int, miles: int, lat: float, lon: float) -> list: ''' retrieves necessary information from the purple air json file online''' url = 'https://www.purpleair.com/data.json' result = API('https://www.purpleair.com/data.json') result = result.get_result(url) res...
retrieves necessary information from the purple air json file online
retrieves necessary information from the purple air json file online
[ "retrieves", "necessary", "information", "from", "the", "purple", "air", "json", "file", "online" ]
def run_purpleair(threshold: int, max_num: int, miles: int, lat: float, lon: float) -> list: url = 'https://www.purpleair.com/data.json' result = API('https://www.purpleair.com/data.json') result = result.get_result(url) result = purpleair.run_PURPLEAIR(result, threshold, max_num, miles, lat, lon) r...
[ "def", "run_purpleair", "(", "threshold", ":", "int", ",", "max_num", ":", "int", ",", "miles", ":", "int", ",", "lat", ":", "float", ",", "lon", ":", "float", ")", "->", "list", ":", "url", "=", "'https://www.purpleair.com/data.json'", "result", "=", "A...
retrieves necessary information from the purple air json file online
[ "retrieves", "necessary", "information", "from", "the", "purple", "air", "json", "file", "online" ]
[ "''' retrieves necessary information from the purple air json file online'''" ]
[ { "param": "threshold", "type": "int" }, { "param": "max_num", "type": "int" }, { "param": "miles", "type": "int" }, { "param": "lat", "type": "float" }, { "param": "lon", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "threshold", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "max_num", "type": "int", "docstring": null, "docstring_...
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
_read_user_input
str
def _read_user_input() -> str: ''' reads the user inputs that aren't empty strings''' # CENTER NOMINATION {location} # {location} any non empty string reading the center point of analysis while True: try: user_input = input() if not user_input: raise Valu...
reads the user inputs that aren't empty strings
reads the user inputs that aren't empty strings
[ "reads", "the", "user", "inputs", "that", "aren", "'", "t", "empty", "strings" ]
def _read_user_input() -> str: while True: try: user_input = input() if not user_input: raise ValueError else: break except ValueError: print('Please input a valid input') return user_input
[ "def", "_read_user_input", "(", ")", "->", "str", ":", "while", "True", ":", "try", ":", "user_input", "=", "input", "(", ")", "if", "not", "user_input", ":", "raise", "ValueError", "else", ":", "break", "except", "ValueError", ":", "print", "(", "'Pleas...
reads the user inputs that aren't empty strings
[ "reads", "the", "user", "inputs", "that", "aren", "'", "t", "empty", "strings" ]
[ "''' reads the user inputs that aren't empty strings'''", "# CENTER NOMINATION {location}", "# {location} any non empty string reading the center point of analysis" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
input_location_center
tuple
def input_location_center(addr) -> tuple: ''' finds the lat and long (center) with user's given location ''' user_input = addr # initialize variable latitude = 0 longitude = 0 if user_input.startswith('CENTER NOMINATIM '): center = _get_location(user_input) center = cent...
finds the lat and long (center) with user's given location
finds the lat and long (center) with user's given location
[ "finds", "the", "lat", "and", "long", "(", "center", ")", "with", "user", "'", "s", "given", "location" ]
def input_location_center(addr) -> tuple: user_input = addr latitude = 0 longitude = 0 if user_input.startswith('CENTER NOMINATIM '): center = _get_location(user_input) center = center.replace(',', '') latitude, longitude = api_class.run_search_center(center) return latit...
[ "def", "input_location_center", "(", "addr", ")", "->", "tuple", ":", "user_input", "=", "addr", "latitude", "=", "0", "longitude", "=", "0", "if", "user_input", ".", "startswith", "(", "'CENTER NOMINATIM '", ")", ":", "center", "=", "_get_location", "(", "u...
finds the lat and long (center) with user's given location
[ "finds", "the", "lat", "and", "long", "(", "center", ")", "with", "user", "'", "s", "given", "location" ]
[ "''' finds the lat and long (center) with user's given location '''", "# initialize variable", "# FIND FILE PATH DIRECTORY" ]
[ { "param": "addr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "addr", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
input_integer
int
def input_integer() -> int: ''' retrieves user's inputted integers and reads the user line to determine what value to store in a variable for either miles AQI or max ''' user_input = _read_user_input() if user_input.startswith('RANGE '): int_value = _get_miles(user_input) e...
retrieves user's inputted integers and reads the user line to determine what value to store in a variable for either miles AQI or max
retrieves user's inputted integers and reads the user line to determine what value to store in a variable for either miles AQI or max
[ "retrieves", "user", "'", "s", "inputted", "integers", "and", "reads", "the", "user", "line", "to", "determine", "what", "value", "to", "store", "in", "a", "variable", "for", "either", "miles", "AQI", "or", "max" ]
def input_integer() -> int: user_input = _read_user_input() if user_input.startswith('RANGE '): int_value = _get_miles(user_input) elif user_input.startswith('THRESHOLD '): int_value = _get_AQI(user_input) elif user_input.startswith('MAX '): int_value = _get_number(user_input) ...
[ "def", "input_integer", "(", ")", "->", "int", ":", "user_input", "=", "_read_user_input", "(", ")", "if", "user_input", ".", "startswith", "(", "'RANGE '", ")", ":", "int_value", "=", "_get_miles", "(", "user_input", ")", "elif", "user_input", ".", "startsw...
retrieves user's inputted integers and reads the user line to determine what value to store in a variable for either miles AQI or max
[ "retrieves", "user", "'", "s", "inputted", "integers", "and", "reads", "the", "user", "line", "to", "determine", "what", "value", "to", "store", "in", "a", "variable", "for", "either", "miles", "AQI", "or", "max" ]
[ "'''\n retrieves user's inputted integers and reads the user line\n to determine what value to store in a variable for either miles\n AQI or max\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
_get_location
str
def _get_location(user_input: str) -> str: ''' retrieves location from user input if this line of input said CENTER NOMINATIMBren Hall Irvine, CA, the center of our analysis is Bren Hall on the campus of UC Irvine. ''' return user_input.replace('CENTER NOMINATIM ', '')
retrieves location from user input if this line of input said CENTER NOMINATIMBren Hall Irvine, CA, the center of our analysis is Bren Hall on the campus of UC Irvine.
retrieves location from user input if this line of input said CENTER NOMINATIMBren Hall Irvine, CA, the center of our analysis is Bren Hall on the campus of UC Irvine.
[ "retrieves", "location", "from", "user", "input", "if", "this", "line", "of", "input", "said", "CENTER", "NOMINATIMBren", "Hall", "Irvine", "CA", "the", "center", "of", "our", "analysis", "is", "Bren", "Hall", "on", "the", "campus", "of", "UC", "Irvine", "...
def _get_location(user_input: str) -> str: return user_input.replace('CENTER NOMINATIM ', '')
[ "def", "_get_location", "(", "user_input", ":", "str", ")", "->", "str", ":", "return", "user_input", ".", "replace", "(", "'CENTER NOMINATIM '", ",", "''", ")" ]
retrieves location from user input if this line of input said CENTER NOMINATIMBren Hall Irvine, CA, the center of our analysis is Bren Hall on the campus of UC Irvine.
[ "retrieves", "location", "from", "user", "input", "if", "this", "line", "of", "input", "said", "CENTER", "NOMINATIMBren", "Hall", "Irvine", "CA", "the", "center", "of", "our", "analysis", "is", "Bren", "Hall", "on", "the", "campus", "of", "UC", "Irvine", "...
[ "'''\n retrieves location from user input\n if this line of input said CENTER NOMINATIMBren Hall Irvine,\n CA, the center of our analysis is Bren Hall on the campus of UC Irvine. \n '''" ]
[ { "param": "user_input", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user_input", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
_get_miles
int
def _get_miles(user_input: str) -> int: ''' retrieves the miles For example, if this line of input said RANGE 30, then the range of our analysis is 30 miles from the center location ''' user_input = user_input.replace('RANGE ', '') return int(user_input)
retrieves the miles For example, if this line of input said RANGE 30, then the range of our analysis is 30 miles from the center location
retrieves the miles For example, if this line of input said RANGE 30, then the range of our analysis is 30 miles from the center location
[ "retrieves", "the", "miles", "For", "example", "if", "this", "line", "of", "input", "said", "RANGE", "30", "then", "the", "range", "of", "our", "analysis", "is", "30", "miles", "from", "the", "center", "location" ]
def _get_miles(user_input: str) -> int: user_input = user_input.replace('RANGE ', '') return int(user_input)
[ "def", "_get_miles", "(", "user_input", ":", "str", ")", "->", "int", ":", "user_input", "=", "user_input", ".", "replace", "(", "'RANGE '", ",", "''", ")", "return", "int", "(", "user_input", ")" ]
retrieves the miles For example, if this line of input said RANGE 30, then the range of our analysis is 30 miles from the center location
[ "retrieves", "the", "miles", "For", "example", "if", "this", "line", "of", "input", "said", "RANGE", "30", "then", "the", "range", "of", "our", "analysis", "is", "30", "miles", "from", "the", "center", "location" ]
[ "'''\n retrieves the miles\n For example, if this line of input said RANGE 30,\n then the range of our analysis is 30 miles from the center location\n '''" ]
[ { "param": "user_input", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user_input", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
_get_AQI
float
def _get_AQI(user_input: str) -> float: ''' a positive integer specifying the AQI threshold, which means we're interested in finding places that have AQI values at least as high as the threshold. It is safe to assume that the AQI threshold is non-negative, though it could be zero ''' us...
a positive integer specifying the AQI threshold, which means we're interested in finding places that have AQI values at least as high as the threshold. It is safe to assume that the AQI threshold is non-negative, though it could be zero
a positive integer specifying the AQI threshold, which means we're interested in finding places that have AQI values at least as high as the threshold. It is safe to assume that the AQI threshold is non-negative, though it could be zero
[ "a", "positive", "integer", "specifying", "the", "AQI", "threshold", "which", "means", "we", "'", "re", "interested", "in", "finding", "places", "that", "have", "AQI", "values", "at", "least", "as", "high", "as", "the", "threshold", ".", "It", "is", "safe"...
def _get_AQI(user_input: str) -> float: user_input = user_input.replace('THRESHOLD ', '') return int(user_input)
[ "def", "_get_AQI", "(", "user_input", ":", "str", ")", "->", "float", ":", "user_input", "=", "user_input", ".", "replace", "(", "'THRESHOLD '", ",", "''", ")", "return", "int", "(", "user_input", ")" ]
a positive integer specifying the AQI threshold, which means we're interested in finding places that have AQI values at least as high as the threshold.
[ "a", "positive", "integer", "specifying", "the", "AQI", "threshold", "which", "means", "we", "'", "re", "interested", "in", "finding", "places", "that", "have", "AQI", "values", "at", "least", "as", "high", "as", "the", "threshold", "." ]
[ "'''\n a positive integer specifying the AQI threshold, which means\n we're interested in finding places that have AQI values at least as high as the threshold.\n It is\n safe to assume that the AQI threshold is non-negative, though it could be\n zero\n '''" ]
[ { "param": "user_input", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user_input", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
_get_number
int
def _get_number(user_input: str) -> int: ''' for example, if this line of input said MAX 5, then we're looking for up to five locations where the AQI value is at or above the AQI threshold ''' user_input = user_input.replace('MAX ', '') return int(user_input)
for example, if this line of input said MAX 5, then we're looking for up to five locations where the AQI value is at or above the AQI threshold
for example, if this line of input said MAX 5, then we're looking for up to five locations where the AQI value is at or above the AQI threshold
[ "for", "example", "if", "this", "line", "of", "input", "said", "MAX", "5", "then", "we", "'", "re", "looking", "for", "up", "to", "five", "locations", "where", "the", "AQI", "value", "is", "at", "or", "above", "the", "AQI", "threshold" ]
def _get_number(user_input: str) -> int: user_input = user_input.replace('MAX ', '') return int(user_input)
[ "def", "_get_number", "(", "user_input", ":", "str", ")", "->", "int", ":", "user_input", "=", "user_input", ".", "replace", "(", "'MAX '", ",", "''", ")", "return", "int", "(", "user_input", ")" ]
for example, if this line of input said MAX 5, then we're looking for up to five locations where the AQI value is at or above the AQI threshold
[ "for", "example", "if", "this", "line", "of", "input", "said", "MAX", "5", "then", "we", "'", "re", "looking", "for", "up", "to", "five", "locations", "where", "the", "AQI", "value", "is", "at", "or", "above", "the", "AQI", "threshold" ]
[ "'''\n for example, if this line of input said MAX 5, then we're looking for up to five locations\n where the AQI value is at or above the AQI threshold\n '''" ]
[ { "param": "user_input", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user_input", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
_get_PURPLEAIR
str
def _get_PURPLEAIR(user_input: str) -> str: ''' AQI PURPLEAIR which means that we want to obtain our air quality information from PurpleAir's API with all of the sensor data in it ''' return user_input
AQI PURPLEAIR which means that we want to obtain our air quality information from PurpleAir's API with all of the sensor data in it
AQI PURPLEAIR which means that we want to obtain our air quality information from PurpleAir's API with all of the sensor data in it
[ "AQI", "PURPLEAIR", "which", "means", "that", "we", "want", "to", "obtain", "our", "air", "quality", "information", "from", "PurpleAir", "'", "s", "API", "with", "all", "of", "the", "sensor", "data", "in", "it" ]
def _get_PURPLEAIR(user_input: str) -> str: return user_input
[ "def", "_get_PURPLEAIR", "(", "user_input", ":", "str", ")", "->", "str", ":", "return", "user_input" ]
AQI PURPLEAIR which means that we want to obtain our air quality information from PurpleAir's API with all of the sensor data in it
[ "AQI", "PURPLEAIR", "which", "means", "that", "we", "want", "to", "obtain", "our", "air", "quality", "information", "from", "PurpleAir", "'", "s", "API", "with", "all", "of", "the", "sensor", "data", "in", "it" ]
[ "'''\n AQI PURPLEAIR which means that we want to obtain our air quality information\n from PurpleAir's API with all of the sensor data in it\n '''" ]
[ { "param": "user_input", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user_input", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3496427c29cd0795cdb6ce883414948b82725878
guseph/AirBear
server/inputs.py
[ "MIT" ]
Python
_get_reverse
<not_specific>
def _get_reverse(user_input: str): ''' which means that we want to use the Nominatim API to do reverse geocoding, i.e., to determine a description of where problematic air quality sensors are located ''' return True
which means that we want to use the Nominatim API to do reverse geocoding, i.e., to determine a description of where problematic air quality sensors are located
which means that we want to use the Nominatim API to do reverse geocoding, i.e., to determine a description of where problematic air quality sensors are located
[ "which", "means", "that", "we", "want", "to", "use", "the", "Nominatim", "API", "to", "do", "reverse", "geocoding", "i", ".", "e", ".", "to", "determine", "a", "description", "of", "where", "problematic", "air", "quality", "sensors", "are", "located" ]
def _get_reverse(user_input: str): return True
[ "def", "_get_reverse", "(", "user_input", ":", "str", ")", ":", "return", "True" ]
which means that we want to use the Nominatim API to do reverse geocoding, i.e., to determine a description of where problematic air quality sensors are located
[ "which", "means", "that", "we", "want", "to", "use", "the", "Nominatim", "API", "to", "do", "reverse", "geocoding", "i", ".", "e", ".", "to", "determine", "a", "description", "of", "where", "problematic", "air", "quality", "sensors", "are", "located" ]
[ "'''\n which means that we want to use the Nominatim API to do reverse geocoding, i.e., to\n determine a description of where problematic air quality sensors are located\n '''" ]
[ { "param": "user_input", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user_input", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
47a852a98f7082a8921634cc75ad9dd9adc46361
guseph/AirBear
server/aqi.py
[ "MIT" ]
Python
output_center
None
def output_center(lat: str, lon: str) -> None: ''' prints the center lat and lon in format of direction ''' if float(lat) < 0: north_or_south = 'S' lat = float(lat) * -1 elif float(lat) >= 0: north_or_south = 'N' if float(lon) < 0: east_or_west = 'W' lon = float(...
prints the center lat and lon in format of direction
prints the center lat and lon in format of direction
[ "prints", "the", "center", "lat", "and", "lon", "in", "format", "of", "direction" ]
def output_center(lat: str, lon: str) -> None: if float(lat) < 0: north_or_south = 'S' lat = float(lat) * -1 elif float(lat) >= 0: north_or_south = 'N' if float(lon) < 0: east_or_west = 'W' lon = float(lon) * -1 elif float(lon) >= 0: east_or_west = 'E' ...
[ "def", "output_center", "(", "lat", ":", "str", ",", "lon", ":", "str", ")", "->", "None", ":", "if", "float", "(", "lat", ")", "<", "0", ":", "north_or_south", "=", "'S'", "lat", "=", "float", "(", "lat", ")", "*", "-", "1", "elif", "float", "...
prints the center lat and lon in format of direction
[ "prints", "the", "center", "lat", "and", "lon", "in", "format", "of", "direction" ]
[ "''' prints the center lat and lon in format of direction '''" ]
[ { "param": "lat", "type": "str" }, { "param": "lon", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lat", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lon", "type": "str", "docstring": null, "docstring_tokens": [...
144e4180bb5fcb8237b3dcfbf4fd97e05e6ed70a
J0s3M4rqu3z/VIAsegura-test
viasegura/downloader.py
[ "FTL" ]
Python
check_artifacts
null
def check_artifacts(self): """ This function allows to check if the path for downloads exists """ if not Path(self.models_path).is_dir(): raise ImportError('The route for the models is not present, it means that the models are not downloaded on this environment, use viasegura.download_models function to down...
This function allows to check if the path for downloads exists
This function allows to check if the path for downloads exists
[ "This", "function", "allows", "to", "check", "if", "the", "path", "for", "downloads", "exists" ]
def check_artifacts(self): if not Path(self.models_path).is_dir(): raise ImportError('The route for the models is not present, it means that the models are not downloaded on this environment, use viasegura.download_models function to download them propertly')
[ "def", "check_artifacts", "(", "self", ")", ":", "if", "not", "Path", "(", "self", ".", "models_path", ")", ".", "is_dir", "(", ")", ":", "raise", "ImportError", "(", "'The route for the models is not present, it means that the models are not downloaded on this environmen...
This function allows to check if the path for downloads exists
[ "This", "function", "allows", "to", "check", "if", "the", "path", "for", "downloads", "exists" ]
[ "\"\"\"\n\t\tThis function allows to check if the path for downloads exists\n\t\t\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
144e4180bb5fcb8237b3dcfbf4fd97e05e6ed70a
J0s3M4rqu3z/VIAsegura-test
viasegura/downloader.py
[ "FTL" ]
Python
check_files
<not_specific>
def check_files(self, filePath): """ This function allows to chec if an specific file exists Parameters ---------- filePath: str Route of the file to be checked """ if Path(filePath).is_file(): return True else: return False
This function allows to chec if an specific file exists Parameters ---------- filePath: str Route of the file to be checked
This function allows to chec if an specific file exists Parameters str Route of the file to be checked
[ "This", "function", "allows", "to", "chec", "if", "an", "specific", "file", "exists", "Parameters", "str", "Route", "of", "the", "file", "to", "be", "checked" ]
def check_files(self, filePath): if Path(filePath).is_file(): return True else: return False
[ "def", "check_files", "(", "self", ",", "filePath", ")", ":", "if", "Path", "(", "filePath", ")", ".", "is_file", "(", ")", ":", "return", "True", "else", ":", "return", "False" ]
This function allows to chec if an specific file exists Parameters
[ "This", "function", "allows", "to", "chec", "if", "an", "specific", "file", "exists", "Parameters" ]
[ "\"\"\"\n\t\tThis function allows to chec if an specific file exists\n\n\t\tParameters\n\t\t----------\n\n\t\tfilePath: str\n\t\t\tRoute of the file to be checked\n\n\t\t\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "filePath", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filePath", "type": null, "docstring": null, "docstring_tokens...
144e4180bb5fcb8237b3dcfbf4fd97e05e6ed70a
J0s3M4rqu3z/VIAsegura-test
viasegura/downloader.py
[ "FTL" ]
Python
download
null
def download(self, url = None, aws_access_key=None, signature = None, expires = None): """ This function allows to dowload the corresponding packages using the route already on the created instance Parameters ---------- url: str The signed url for downloading the models aws_access_key: str The aw...
This function allows to dowload the corresponding packages using the route already on the created instance Parameters ---------- url: str The signed url for downloading the models aws_access_key: str The aws access key id provided by the interamerican development bank to have access to the models ...
This function allows to dowload the corresponding packages using the route already on the created instance Parameters str The signed url for downloading the models str The aws access key id provided by the interamerican development bank to have access to the models str The aws signature provided from IDB to download...
[ "This", "function", "allows", "to", "dowload", "the", "corresponding", "packages", "using", "the", "route", "already", "on", "the", "created", "instance", "Parameters", "str", "The", "signed", "url", "for", "downloading", "the", "models", "str", "The", "aws", ...
def download(self, url = None, aws_access_key=None, signature = None, expires = None): if url: self.models_path.mkdir(parents=True, exist_ok=True) temp_file_path = tempfile.NamedTemporaryFile(suffix='.tar.gz').name logger.info('Downloading models') try: request.urlretrieve(url, temp_file_path) exce...
[ "def", "download", "(", "self", ",", "url", "=", "None", ",", "aws_access_key", "=", "None", ",", "signature", "=", "None", ",", "expires", "=", "None", ")", ":", "if", "url", ":", "self", ".", "models_path", ".", "mkdir", "(", "parents", "=", "True"...
This function allows to dowload the corresponding packages using the route already on the created instance Parameters
[ "This", "function", "allows", "to", "dowload", "the", "corresponding", "packages", "using", "the", "route", "already", "on", "the", "created", "instance", "Parameters" ]
[ "\"\"\"\n\t\tThis function allows to dowload the corresponding packages using the route already on the created instance\n\n\t\tParameters\n\t\t----------\n\t\t\n\t\turl: str\n\t\t\tThe signed url for downloading the models\n\n\t\taws_access_key: str\n\t\t\tThe aws access key id provided by the interamerican develop...
[ { "param": "self", "type": null }, { "param": "url", "type": null }, { "param": "aws_access_key", "type": null }, { "param": "signature", "type": null }, { "param": "expires", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_tokens": []...
b3a4e69431c93d75d277d0c88b10b880de2cff32
rogerdahl/python-esp8266
esp8266.py
[ "MIT" ]
Python
sendCmd
<not_specific>
def sendCmd(self, cmd, retries=3): '''Send an AT command with automatic retries. If retries are exhausted, the final exception is forwarded to the client. If successful, the response lines are returned in a list.''' for i in range(retries): try: return self._sendCmd(cmd) except ESP8266Ex...
Send an AT command with automatic retries. If retries are exhausted, the final exception is forwarded to the client. If successful, the response lines are returned in a list.
Send an AT command with automatic retries. If retries are exhausted, the final exception is forwarded to the client. If successful, the response lines are returned in a list.
[ "Send", "an", "AT", "command", "with", "automatic", "retries", ".", "If", "retries", "are", "exhausted", "the", "final", "exception", "is", "forwarded", "to", "the", "client", ".", "If", "successful", "the", "response", "lines", "are", "returned", "in", "a",...
def sendCmd(self, cmd, retries=3): for i in range(retries): try: return self._sendCmd(cmd) except ESP8266Exception: if i == retries - 1: raise
[ "def", "sendCmd", "(", "self", ",", "cmd", ",", "retries", "=", "3", ")", ":", "for", "i", "in", "range", "(", "retries", ")", ":", "try", ":", "return", "self", ".", "_sendCmd", "(", "cmd", ")", "except", "ESP8266Exception", ":", "if", "i", "==", ...
Send an AT command with automatic retries.
[ "Send", "an", "AT", "command", "with", "automatic", "retries", "." ]
[ "'''Send an AT command with automatic retries. If retries are exhausted, the final exception is\n forwarded to the client. If successful, the response lines are returned in a list.'''" ]
[ { "param": "self", "type": null }, { "param": "cmd", "type": null }, { "param": "retries", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cmd", "type": null, "docstring": null, "docstring_tokens": []...
b3a4e69431c93d75d277d0c88b10b880de2cff32
rogerdahl/python-esp8266
esp8266.py
[ "MIT" ]
Python
sendBuffer
null
def sendBuffer(self, protocol_str, host_str, port_int, buf): '''Make a TCP or UDP connection and send a buffer. Reuses an existing connection if possible. Disconnects from old host and reconnects to new host if necessary.''' self.sendCmd('AT+CIPMUX=0') currentStatus_str, currentProtocol_str, current...
Make a TCP or UDP connection and send a buffer. Reuses an existing connection if possible. Disconnects from old host and reconnects to new host if necessary.
Make a TCP or UDP connection and send a buffer. Reuses an existing connection if possible. Disconnects from old host and reconnects to new host if necessary.
[ "Make", "a", "TCP", "or", "UDP", "connection", "and", "send", "a", "buffer", ".", "Reuses", "an", "existing", "connection", "if", "possible", ".", "Disconnects", "from", "old", "host", "and", "reconnects", "to", "new", "host", "if", "necessary", "." ]
def sendBuffer(self, protocol_str, host_str, port_int, buf): self.sendCmd('AT+CIPMUX=0') currentStatus_str, currentProtocol_str, currentHost_str, currentPort_int = self.getCipStatus() print currentStatus_str, currentProtocol_str, currentHost_str, currentPort_int if currentProtocol_str != protocol_str or...
[ "def", "sendBuffer", "(", "self", ",", "protocol_str", ",", "host_str", ",", "port_int", ",", "buf", ")", ":", "self", ".", "sendCmd", "(", "'AT+CIPMUX=0'", ")", "currentStatus_str", ",", "currentProtocol_str", ",", "currentHost_str", ",", "currentPort_int", "="...
Make a TCP or UDP connection and send a buffer.
[ "Make", "a", "TCP", "or", "UDP", "connection", "and", "send", "a", "buffer", "." ]
[ "'''Make a TCP or UDP connection and send a buffer. Reuses an existing\n connection if possible. Disconnects from old host and reconnects to new host\n if necessary.'''" ]
[ { "param": "self", "type": null }, { "param": "protocol_str", "type": null }, { "param": "host_str", "type": null }, { "param": "port_int", "type": null }, { "param": "buf", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "protocol_str", "type": null, "docstring": null, "docstring_to...
b3a4e69431c93d75d277d0c88b10b880de2cff32
rogerdahl/python-esp8266
esp8266.py
[ "MIT" ]
Python
connectToAccessPoint
<not_specific>
def connectToAccessPoint(self, ssid_str, password_str): '''Call is ignored if already connected to the given access point. If already connected to another access point, the old access point is automatically disconnected first.''' current_ssid_str = self.getConnectedAccessPoint() if current_ssid_str ...
Call is ignored if already connected to the given access point. If already connected to another access point, the old access point is automatically disconnected first.
Call is ignored if already connected to the given access point. If already connected to another access point, the old access point is automatically disconnected first.
[ "Call", "is", "ignored", "if", "already", "connected", "to", "the", "given", "access", "point", ".", "If", "already", "connected", "to", "another", "access", "point", "the", "old", "access", "point", "is", "automatically", "disconnected", "first", "." ]
def connectToAccessPoint(self, ssid_str, password_str): current_ssid_str = self.getConnectedAccessPoint() if current_ssid_str == ssid_str: logging.info('Already connected to access point: {}'.format(ssid_str)) return if current_ssid_str != '<NOT CONNECTED>': self.disconnectFromAccessPoin...
[ "def", "connectToAccessPoint", "(", "self", ",", "ssid_str", ",", "password_str", ")", ":", "current_ssid_str", "=", "self", ".", "getConnectedAccessPoint", "(", ")", "if", "current_ssid_str", "==", "ssid_str", ":", "logging", ".", "info", "(", "'Already connected...
Call is ignored if already connected to the given access point.
[ "Call", "is", "ignored", "if", "already", "connected", "to", "the", "given", "access", "point", "." ]
[ "'''Call is ignored if already connected to the given access point. If\n already connected to another access point, the old access point is\n automatically disconnected first.'''" ]
[ { "param": "self", "type": null }, { "param": "ssid_str", "type": null }, { "param": "password_str", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ssid_str", "type": null, "docstring": null, "docstring_tokens...
f2b6734857ca8316ded4fc984f37af3a72683651
csim456/engsci211_fs_notebooks
sourcecode_fs.py
[ "MIT" ]
Python
produceFourierSeries
<not_specific>
def produceFourierSeries(x, nMax, xMin, xMax, f): """ Produces Fourier Series approximation of a function ---------- Parameters ---------- x: array_like sample values nMax: int number of terms xMin: float lower bound on wi...
Produces Fourier Series approximation of a function ---------- Parameters ---------- x: array_like sample values nMax: int number of terms xMin: float lower bound on window/approximation xMax: float upper...
Produces Fourier Series approximation of a function Parameters int number of terms float lower bound on window/approximation float upper bound on window/approximation function function to be approximated
[ "Produces", "Fourier", "Series", "approximation", "of", "a", "function", "Parameters", "int", "number", "of", "terms", "float", "lower", "bound", "on", "window", "/", "approximation", "float", "upper", "bound", "on", "window", "/", "approximation", "function", "...
def produceFourierSeries(x, nMax, xMin, xMax, f): T = xMax - xMin xFuncPeriod = np.arange(xMin, xMax, 0.001) series = np.zeros(len(x)) series += (1./T)*np.trapz(f(xFuncPeriod,xMin,xMax), x=xFuncPeriod) prev = None for i in range(nMax): n = i+1 an = (2./T)*np.trapz(f(xFuncPeriod,...
[ "def", "produceFourierSeries", "(", "x", ",", "nMax", ",", "xMin", ",", "xMax", ",", "f", ")", ":", "T", "=", "xMax", "-", "xMin", "xFuncPeriod", "=", "np", ".", "arange", "(", "xMin", ",", "xMax", ",", "0.001", ")", "series", "=", "np", ".", "ze...
Produces Fourier Series approximation of a function Parameters
[ "Produces", "Fourier", "Series", "approximation", "of", "a", "function", "Parameters" ]
[ "\"\"\" Produces Fourier Series approximation of a function\n \n ----------\n\n Parameters\n\n ----------\n\n x: array_like\n sample values\n\n nMax: int\n number of terms\n\n xMin: float\n lower bound on window/approximation\n\n x...
[ { "param": "x", "type": null }, { "param": "nMax", "type": null }, { "param": "xMin", "type": null }, { "param": "xMax", "type": null }, { "param": "f", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nMax", "type": null, "docstring": null, "docstring_tokens": [], ...
f2b6734857ca8316ded4fc984f37af3a72683651
csim456/engsci211_fs_notebooks
sourcecode_fs.py
[ "MIT" ]
Python
fourierMain
null
def fourierMain(function, nMax, showPrevTerm): """ Main function for calling produceFourierSeries and plotting ---------- Parameters ---------- function: string function key nMax: int number of terms showPrevTerm: bool ...
Main function for calling produceFourierSeries and plotting ---------- Parameters ---------- function: string function key nMax: int number of terms showPrevTerm: bool true if most recent term should be displayed....
Main function for calling produceFourierSeries and plotting Parameters string function key int number of terms bool true if most recent term should be displayed. False otherwise
[ "Main", "function", "for", "calling", "produceFourierSeries", "and", "plotting", "Parameters", "string", "function", "key", "int", "number", "of", "terms", "bool", "true", "if", "most", "recent", "term", "should", "be", "displayed", ".", "False", "otherwise" ]
def fourierMain(function, nMax, showPrevTerm): functions = {'Linear':[f1, -np.pi, np.pi],'Square Wave':[f2, -np.pi/2, np.pi/2],'Cubic':[f3, -np.pi, np.pi],\ '4B':[example_4b,-np.pi,np.pi],'4C':[example_4c,-np.pi,np.pi],\ '5A_Sine':[example_5a_sine,-1.,1.],'5A_Cosine':[example_5a_cosi...
[ "def", "fourierMain", "(", "function", ",", "nMax", ",", "showPrevTerm", ")", ":", "functions", "=", "{", "'Linear'", ":", "[", "f1", ",", "-", "np", ".", "pi", ",", "np", ".", "pi", "]", ",", "'Square Wave'", ":", "[", "f2", ",", "-", "np", ".",...
Main function for calling produceFourierSeries and plotting Parameters
[ "Main", "function", "for", "calling", "produceFourierSeries", "and", "plotting", "Parameters" ]
[ "\"\"\"\n Main function for calling produceFourierSeries and plotting\n\n ----------\n\n Parameters\n\n ----------\n\n function: string\n function key\n\n nMax: int\n number of terms\n \n showPrevTerm: bool\n true if most recen...
[ { "param": "function", "type": null }, { "param": "nMax", "type": null }, { "param": "showPrevTerm", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "function", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nMax", "type": null, "docstring": null, "docstring_tokens...
f2b6734857ca8316ded4fc984f37af3a72683651
csim456/engsci211_fs_notebooks
sourcecode_fs.py
[ "MIT" ]
Python
plotWaves
null
def plotWaves(waves): """ Main plotting function for RandomWave. Also sums waves to produce signal ---------- Parameters ---------- waves: array_like noWavesx3 array that contains amplitude, angular velocity and horizontal shift of each wave """ _, (rawAx, com...
Main plotting function for RandomWave. Also sums waves to produce signal ---------- Parameters ---------- waves: array_like noWavesx3 array that contains amplitude, angular velocity and horizontal shift of each wave
Main plotting function for RandomWave. Also sums waves to produce signal Parameters array_like noWavesx3 array that contains amplitude, angular velocity and horizontal shift of each wave
[ "Main", "plotting", "function", "for", "RandomWave", ".", "Also", "sums", "waves", "to", "produce", "signal", "Parameters", "array_like", "noWavesx3", "array", "that", "contains", "amplitude", "angular", "velocity", "and", "horizontal", "shift", "of", "each", "wav...
def plotWaves(waves): _, (rawAx, compAx, ampAx) = plt.subplots(3,figsize=(16,10)) x = np.arange(0,2*np.pi,0.01) out = 0 for wave in waves: a, f, s = wave w = 2*np.pi*f out += a*np.sin(w*x-s) compAx.plot(x, a*np.sin(w*x-s), ls="--",linewidth=0.5) rawAx.plot(x, out, lin...
[ "def", "plotWaves", "(", "waves", ")", ":", "_", ",", "(", "rawAx", ",", "compAx", ",", "ampAx", ")", "=", "plt", ".", "subplots", "(", "3", ",", "figsize", "=", "(", "16", ",", "10", ")", ")", "x", "=", "np", ".", "arange", "(", "0", ",", ...
Main plotting function for RandomWave.
[ "Main", "plotting", "function", "for", "RandomWave", "." ]
[ "\"\"\" Main plotting function for RandomWave. Also sums waves to produce signal\n\n ----------\n\n Parameters\n\n ----------\n\n waves: array_like\n noWavesx3 array that contains amplitude, angular velocity and horizontal shift of each wave\n \"\"\"", "# Removing all tra...
[ { "param": "waves", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "waves", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f2b6734857ca8316ded4fc984f37af3a72683651
csim456/engsci211_fs_notebooks
sourcecode_fs.py
[ "MIT" ]
Python
runWaves
null
def runWaves(noWaves, seed, filterRange=[minf, maxf]): """ Filters waves from genWaves ---------- Parameters ---------- noWaves: int number of waves to produce seed: int seed for random number generator filterRange: array_like ...
Filters waves from genWaves ---------- Parameters ---------- noWaves: int number of waves to produce seed: int seed for random number generator filterRange: array_like pair of min and max filter values
Filters waves from genWaves Parameters int number of waves to produce int seed for random number generator array_like pair of min and max filter values
[ "Filters", "waves", "from", "genWaves", "Parameters", "int", "number", "of", "waves", "to", "produce", "int", "seed", "for", "random", "number", "generator", "array_like", "pair", "of", "min", "and", "max", "filter", "values" ]
def runWaves(noWaves, seed, filterRange=[minf, maxf]): filterMin, filterMax = filterRange waves = genWaves(noWaves, seed) filteredWaves = [wave for wave in waves if((wave[1] < filterMin) or wave[1] > filterMax)] if len(filteredWaves) > 1: plotWaves(filteredWaves)
[ "def", "runWaves", "(", "noWaves", ",", "seed", ",", "filterRange", "=", "[", "minf", ",", "maxf", "]", ")", ":", "filterMin", ",", "filterMax", "=", "filterRange", "waves", "=", "genWaves", "(", "noWaves", ",", "seed", ")", "filteredWaves", "=", "[", ...
Filters waves from genWaves Parameters
[ "Filters", "waves", "from", "genWaves", "Parameters" ]
[ "\"\"\" Filters waves from genWaves\n ----------\n\n Parameters\n\n ----------\n\n noWaves: int\n number of waves to produce\n\n seed: int\n seed for random number generator\n\n filterRange: array_like\n pair of min and max filter values\n ...
[ { "param": "noWaves", "type": null }, { "param": "seed", "type": null }, { "param": "filterRange", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "noWaves", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "seed", "type": null, "docstring": null, "docstring_tokens"...
f2b6734857ca8316ded4fc984f37af3a72683651
csim456/engsci211_fs_notebooks
sourcecode_fs.py
[ "MIT" ]
Python
MusicNote
<not_specific>
def MusicNote(audioData, freqDom, freqs): """ Produces UI componants for user. Drives plotting of PlotFourierAnalysis ---------- Parameters ---------- audioData: array_like raw audio data freqDom: array_like transformed frequency d...
Produces UI componants for user. Drives plotting of PlotFourierAnalysis ---------- Parameters ---------- audioData: array_like raw audio data freqDom: array_like transformed frequency domain data freqs: array_like ...
Produces UI componants for user. Drives plotting of PlotFourierAnalysis Parameters array_like raw audio data array_like transformed frequency domain data
[ "Produces", "UI", "componants", "for", "user", ".", "Drives", "plotting", "of", "PlotFourierAnalysis", "Parameters", "array_like", "raw", "audio", "data", "array_like", "transformed", "frequency", "domain", "data" ]
def MusicNote(audioData, freqDom, freqs): xlim_sldr = widgets.IntRangeSlider(value=[0, 22.5e3], min=0, max=22.5e3, step=1000, continuous_update=False, description='Ax. lim') return widgets.VBox([widgets.interactive_output(PlotSignal, { 'signal':widgets.fixed(audioData), 'amps':widgets.f...
[ "def", "MusicNote", "(", "audioData", ",", "freqDom", ",", "freqs", ")", ":", "xlim_sldr", "=", "widgets", ".", "IntRangeSlider", "(", "value", "=", "[", "0", ",", "22.5e3", "]", ",", "min", "=", "0", ",", "max", "=", "22.5e3", ",", "step", "=", "1...
Produces UI componants for user.
[ "Produces", "UI", "componants", "for", "user", "." ]
[ "\"\"\"\n Produces UI componants for user. Drives plotting of PlotFourierAnalysis\n\n ----------\n\n Parameters\n\n ----------\n\n audioData: array_like\n raw audio data\n \n freqDom: array_like\n transformed frequency domain data\n \n ...
[ { "param": "audioData", "type": null }, { "param": "freqDom", "type": null }, { "param": "freqs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "audioData", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "freqDom", "type": null, "docstring": null, "docstring_to...
f2b6734857ca8316ded4fc984f37af3a72683651
csim456/engsci211_fs_notebooks
sourcecode_fs.py
[ "MIT" ]
Python
FilterBand
null
def FilterBand(audioData, freqDom, freqs, filtFreq, FALim, export): """ Sets amplitudes in transform to 0 that are outside frequency range. Performs inverse tranform Calls PlotSignal ---------- Parameters ---------- audioData: array_like raw audio data...
Sets amplitudes in transform to 0 that are outside frequency range. Performs inverse tranform Calls PlotSignal ---------- Parameters ---------- audioData: array_like raw audio data processed: array_like fourier transformed data ...
Sets amplitudes in transform to 0 that are outside frequency range. Performs inverse tranform Calls PlotSignal Parameters array_like raw audio data array_like fourier transformed data array_like frequencies for filtering and inversion array_like pair of frequencies representing filter band array_like pair of ...
[ "Sets", "amplitudes", "in", "transform", "to", "0", "that", "are", "outside", "frequency", "range", ".", "Performs", "inverse", "tranform", "Calls", "PlotSignal", "Parameters", "array_like", "raw", "audio", "data", "array_like", "fourier", "transformed", "data", "...
def FilterBand(audioData, freqDom, freqs, filtFreq, FALim, export): filteredTrans = freqDom.copy() for i in range(len(freqDom)): if ((freqs[i] >= filtFreq[0]) and (freqs[i] <= filtFreq[1])): filteredTrans[i] = 0 if freqs[i] > filtFreq[1]: break filteredSignal = irfft(filteredTran...
[ "def", "FilterBand", "(", "audioData", ",", "freqDom", ",", "freqs", ",", "filtFreq", ",", "FALim", ",", "export", ")", ":", "filteredTrans", "=", "freqDom", ".", "copy", "(", ")", "for", "i", "in", "range", "(", "len", "(", "freqDom", ")", ")", ":",...
Sets amplitudes in transform to 0 that are outside frequency range.
[ "Sets", "amplitudes", "in", "transform", "to", "0", "that", "are", "outside", "frequency", "range", "." ]
[ "\"\"\"\n Sets amplitudes in transform to 0 that are outside frequency range. Performs inverse tranform\n Calls PlotSignal\n\n ----------\n\n Parameters\n\n ----------\n\n audioData: array_like\n raw audio data\n\n processed: array_like\n fourie...
[ { "param": "audioData", "type": null }, { "param": "freqDom", "type": null }, { "param": "freqs", "type": null }, { "param": "filtFreq", "type": null }, { "param": "FALim", "type": null }, { "param": "export", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "audioData", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "freqDom", "type": null, "docstring": null, "docstring_to...
f2b6734857ca8316ded4fc984f37af3a72683651
csim456/engsci211_fs_notebooks
sourcecode_fs.py
[ "MIT" ]
Python
exportWav
null
def exportWav(audioData): """ Function for exporting signal to wav ---------- Parameters ---------- audioData: array_like discrete audio signal """ audioData = np.asarray(audioData, dtype=np.int16) wavfile.write(path+'exportedAudio.wav',int(sampFreq),...
Function for exporting signal to wav ---------- Parameters ---------- audioData: array_like discrete audio signal
Function for exporting signal to wav Parameters array_like discrete audio signal
[ "Function", "for", "exporting", "signal", "to", "wav", "Parameters", "array_like", "discrete", "audio", "signal" ]
def exportWav(audioData): audioData = np.asarray(audioData, dtype=np.int16) wavfile.write(path+'exportedAudio.wav',int(sampFreq), audioData)
[ "def", "exportWav", "(", "audioData", ")", ":", "audioData", "=", "np", ".", "asarray", "(", "audioData", ",", "dtype", "=", "np", ".", "int16", ")", "wavfile", ".", "write", "(", "path", "+", "'exportedAudio.wav'", ",", "int", "(", "sampFreq", ")", ",...
Function for exporting signal to wav Parameters
[ "Function", "for", "exporting", "signal", "to", "wav", "Parameters" ]
[ "\"\"\" Function for exporting signal to wav\n\n ----------\n\n Parameters\n\n ----------\n\n audioData: array_like\n discrete audio signal\n \"\"\"" ]
[ { "param": "audioData", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "audioData", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e19abf19eeccf3935319c68ae226c09b96a17f65
Clever/kayvee-python
test/test_kayvee.py
[ "Apache-2.0" ]
Python
assertEqualJson
null
def assertEqualJson(self, a, b): """ Given two strings, assert they are the same json dict """ actual = json.loads(a) expected = json.loads(b) self.assertEquals(actual, expected)
Given two strings, assert they are the same json dict
Given two strings, assert they are the same json dict
[ "Given", "two", "strings", "assert", "they", "are", "the", "same", "json", "dict" ]
def assertEqualJson(self, a, b): actual = json.loads(a) expected = json.loads(b) self.assertEquals(actual, expected)
[ "def", "assertEqualJson", "(", "self", ",", "a", ",", "b", ")", ":", "actual", "=", "json", ".", "loads", "(", "a", ")", "expected", "=", "json", ".", "loads", "(", "b", ")", "self", ".", "assertEquals", "(", "actual", ",", "expected", ")" ]
Given two strings, assert they are the same json dict
[ "Given", "two", "strings", "assert", "they", "are", "the", "same", "json", "dict" ]
[ "\"\"\" Given two strings, assert they are the same json dict \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "a", "type": null }, { "param": "b", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], ...
1c9d346846f77b31818c4ef3a652606937974567
Clever/kayvee-python
test/test_logger.py
[ "Apache-2.0" ]
Python
assertEqualJson
null
def assertEqualJson(self, a, b): """ Given two strings, assert they are the same json dict """ actual = json.loads(a) expected = json.loads(b) self.assertEqual(actual, expected)
Given two strings, assert they are the same json dict
Given two strings, assert they are the same json dict
[ "Given", "two", "strings", "assert", "they", "are", "the", "same", "json", "dict" ]
def assertEqualJson(self, a, b): actual = json.loads(a) expected = json.loads(b) self.assertEqual(actual, expected)
[ "def", "assertEqualJson", "(", "self", ",", "a", ",", "b", ")", ":", "actual", "=", "json", ".", "loads", "(", "a", ")", "expected", "=", "json", ".", "loads", "(", "b", ")", "self", ".", "assertEqual", "(", "actual", ",", "expected", ")" ]
Given two strings, assert they are the same json dict
[ "Given", "two", "strings", "assert", "they", "are", "the", "same", "json", "dict" ]
[ "\"\"\" Given two strings, assert they are the same json dict \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "a", "type": null }, { "param": "b", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], ...
1c9d346846f77b31818c4ef3a652606937974567
Clever/kayvee-python
test/test_logger.py
[ "Apache-2.0" ]
Python
assertNotEqualJson
null
def assertNotEqualJson(self, a, b): """ Given two strings, assert they are the same json dict """ actual = json.loads(a) expected = json.loads(b) self.assertNotEqual(actual, expected)
Given two strings, assert they are the same json dict
Given two strings, assert they are the same json dict
[ "Given", "two", "strings", "assert", "they", "are", "the", "same", "json", "dict" ]
def assertNotEqualJson(self, a, b): actual = json.loads(a) expected = json.loads(b) self.assertNotEqual(actual, expected)
[ "def", "assertNotEqualJson", "(", "self", ",", "a", ",", "b", ")", ":", "actual", "=", "json", ".", "loads", "(", "a", ")", "expected", "=", "json", ".", "loads", "(", "b", ")", "self", ".", "assertNotEqual", "(", "actual", ",", "expected", ")" ]
Given two strings, assert they are the same json dict
[ "Given", "two", "strings", "assert", "they", "are", "the", "same", "json", "dict" ]
[ "\"\"\" Given two strings, assert they are the same json dict \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "a", "type": null }, { "param": "b", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], ...
b58ce96b6ad770e91e4505d95e77e41ca827ab1d
Clever/kayvee-python
kayvee/kayvee.py
[ "Apache-2.0" ]
Python
formatLog
<not_specific>
def formatLog(source="", level="", title="", data={}): """ Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it? :param source - application context - where did it come from? :param title - brief description - what kind of ...
Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it? :param source - application context - where did it come from? :param title - brief description - what kind of event happened? :param data - additional information - wha...
Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it. :param source - application context - where did it come from. :param title - brief description - what kind of event happened.
[ "Similar", "to", "format", "but", "takes", "additional", "reserved", "params", "to", "promote", "logging", "best", "-", "practices", ":", "param", "level", "-", "severity", "of", "message", "-", "how", "bad", "is", "it", ".", ":", "param", "source", "-", ...
def formatLog(source="", level="", title="", data={}): source = "" if source is None else source level = "" if level is None else level title = "" if title is None else title if not type(data) is dict: data = {} data['source'] = source data['level'] = level data['title'] = title return format(data)
[ "def", "formatLog", "(", "source", "=", "\"\"", ",", "level", "=", "\"\"", ",", "title", "=", "\"\"", ",", "data", "=", "{", "}", ")", ":", "source", "=", "\"\"", "if", "source", "is", "None", "else", "source", "level", "=", "\"\"", "if", "level", ...
Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it?
[ "Similar", "to", "format", "but", "takes", "additional", "reserved", "params", "to", "promote", "logging", "best", "-", "practices", ":", "param", "level", "-", "severity", "of", "message", "-", "how", "bad", "is", "it?" ]
[ "\"\"\" Similar to format, but takes additional reserved params to promote logging best-practices\n\n :param level - severity of message - how bad is it?\n :param source - application context - where did it come from?\n :param title - brief description - what kind of event happened?\n :param data - additional i...
[ { "param": "source", "type": null }, { "param": "level", "type": null }, { "param": "title", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "source", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "level", "type": null, "docstring": null, "docstring_tokens"...
00beaa3976bea4af417e97762ac28b52ae74dc67
dsar/Twitter_Sentiment_Analysis
src/utils.py
[ "MIT" ]
Python
create_csv_submission
null
def create_csv_submission(y_pred): """ DESCRIPTION: Creates the final submission file to be uploaded on Kaggle platform INPUT: y_pred: List of sentiment predictions. Contains 1 and -1 values """ with open(PRED_SUBMISSION_FILE, 'w') as csvfile: fieldnames = [...
DESCRIPTION: Creates the final submission file to be uploaded on Kaggle platform INPUT: y_pred: List of sentiment predictions. Contains 1 and -1 values
Creates the final submission file to be uploaded on Kaggle platform INPUT: y_pred: List of sentiment predictions. Contains 1 and -1 values
[ "Creates", "the", "final", "submission", "file", "to", "be", "uploaded", "on", "Kaggle", "platform", "INPUT", ":", "y_pred", ":", "List", "of", "sentiment", "predictions", ".", "Contains", "1", "and", "-", "1", "values" ]
def create_csv_submission(y_pred): with open(PRED_SUBMISSION_FILE, 'w') as csvfile: fieldnames = ['Id', 'Prediction'] writer = csv.DictWriter(csvfile, delimiter=",", fieldnames=fieldnames) writer.writeheader() r1 = 1 for r2 in y_pred: writer.writerow({'Id':int(r1)...
[ "def", "create_csv_submission", "(", "y_pred", ")", ":", "with", "open", "(", "PRED_SUBMISSION_FILE", ",", "'w'", ")", "as", "csvfile", ":", "fieldnames", "=", "[", "'Id'", ",", "'Prediction'", "]", "writer", "=", "csv", ".", "DictWriter", "(", "csvfile", ...
DESCRIPTION: Creates the final submission file to be uploaded on Kaggle platform INPUT: y_pred: List of sentiment predictions.
[ "DESCRIPTION", ":", "Creates", "the", "final", "submission", "file", "to", "be", "uploaded", "on", "Kaggle", "platform", "INPUT", ":", "y_pred", ":", "List", "of", "sentiment", "predictions", "." ]
[ "\"\"\"\r\n DESCRIPTION: \r\n Creates the final submission file to be uploaded on Kaggle platform\r\n INPUT: \r\n y_pred: List of sentiment predictions. Contains 1 and -1 values\r\n \"\"\"" ]
[ { "param": "y_pred", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "y_pred", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
00beaa3976bea4af417e97762ac28b52ae74dc67
dsar/Twitter_Sentiment_Analysis
src/utils.py
[ "MIT" ]
Python
clear_cache
null
def clear_cache(): """ DESCRIPTION: Clears the selected cached files from options.py file """ print('clearing cache files') if algorithm['options']['clear_params']['preproc']: if os.system('rm '+ PREPROC_DATA_PATH+'*') == 0: print('clear preproc DONE') if algorithm['options']['clear_params']['...
DESCRIPTION: Clears the selected cached files from options.py file
Clears the selected cached files from options.py file
[ "Clears", "the", "selected", "cached", "files", "from", "options", ".", "py", "file" ]
def clear_cache(): print('clearing cache files') if algorithm['options']['clear_params']['preproc']: if os.system('rm '+ PREPROC_DATA_PATH+'*') == 0: print('clear preproc DONE') if algorithm['options']['clear_params']['tfidf']: if os.system('rm ' + TFIDF_TRAIN_FILE) == 0: print('clear tfidf DONE') if algo...
[ "def", "clear_cache", "(", ")", ":", "print", "(", "'clearing cache files'", ")", "if", "algorithm", "[", "'options'", "]", "[", "'clear_params'", "]", "[", "'preproc'", "]", ":", "if", "os", ".", "system", "(", "'rm '", "+", "PREPROC_DATA_PATH", "+", "'*'...
DESCRIPTION: Clears the selected cached files from options.py file
[ "DESCRIPTION", ":", "Clears", "the", "selected", "cached", "files", "from", "options", ".", "py", "file" ]
[ "\"\"\"\r\n\tDESCRIPTION: \r\n\t Clears the selected cached files from options.py file\r\n\t\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }