id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
44,900
cloudnull/turbolift
turbolift/worker.py
Worker.run_manager
def run_manager(self, job_override=None): """The run manager. The run manager is responsible for loading the plugin required based on what the user has inputted using the parsed_command value as found in the job_args dict. If the user provides a *job_override* the method will at...
python
def run_manager(self, job_override=None): """The run manager. The run manager is responsible for loading the plugin required based on what the user has inputted using the parsed_command value as found in the job_args dict. If the user provides a *job_override* the method will at...
[ "def", "run_manager", "(", "self", ",", "job_override", "=", "None", ")", ":", "for", "arg_name", ",", "arg_value", "in", "self", ".", "job_args", ".", "items", "(", ")", ":", "if", "arg_name", ".", "endswith", "(", "'_headers'", ")", ":", "if", "isins...
The run manager. The run manager is responsible for loading the plugin required based on what the user has inputted using the parsed_command value as found in the job_args dict. If the user provides a *job_override* the method will attempt to import the module and class as provided by t...
[ "The", "run", "manager", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/worker.py#L80-L130
44,901
stephantul/somber
somber/components/initializers.py
range_initialization
def range_initialization(X, num_weights): """ Initialize the weights by calculating the range of the data. The data range is calculated by reshaping the input matrix to a 2D matrix, and then taking the min and max values over the columns. Parameters ---------- X : numpy array The i...
python
def range_initialization(X, num_weights): """ Initialize the weights by calculating the range of the data. The data range is calculated by reshaping the input matrix to a 2D matrix, and then taking the min and max values over the columns. Parameters ---------- X : numpy array The i...
[ "def", "range_initialization", "(", "X", ",", "num_weights", ")", ":", "# Randomly initialize weights to cover the range of each feature.", "X_", "=", "X", ".", "reshape", "(", "-", "1", ",", "X", ".", "shape", "[", "-", "1", "]", ")", "min_val", ",", "max_val...
Initialize the weights by calculating the range of the data. The data range is calculated by reshaping the input matrix to a 2D matrix, and then taking the min and max values over the columns. Parameters ---------- X : numpy array The input data. The data range is calculated over the last ...
[ "Initialize", "the", "weights", "by", "calculating", "the", "range", "of", "the", "data", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/components/initializers.py#L10-L37
44,902
stephantul/somber
somber/base.py
Base.fit
def fit(self, X, num_epochs=10, updates_epoch=None, stop_param_updates=dict(), batch_size=1, show_progressbar=False, show_epoch=False, refit=True): """ Fit the learner to some data. Parameters ...
python
def fit(self, X, num_epochs=10, updates_epoch=None, stop_param_updates=dict(), batch_size=1, show_progressbar=False, show_epoch=False, refit=True): """ Fit the learner to some data. Parameters ...
[ "def", "fit", "(", "self", ",", "X", ",", "num_epochs", "=", "10", ",", "updates_epoch", "=", "None", ",", "stop_param_updates", "=", "dict", "(", ")", ",", "batch_size", "=", "1", ",", "show_progressbar", "=", "False", ",", "show_epoch", "=", "False", ...
Fit the learner to some data. Parameters ---------- X : numpy array. The input data. num_epochs : int, optional, default 10 The number of epochs to train for. updates_epoch : int, optional, default 10 The number of updates to perform on the le...
[ "Fit", "the", "learner", "to", "some", "data", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L91-L157
44,903
stephantul/somber
somber/base.py
Base._init_weights
def _init_weights(self, X): """Set the weights and normalize data before starting training.""" X = np.asarray(X, dtype=np.float64) if self.scaler is not None: X = self.scaler.fit_transform(X) if self.initializer is not None: self.weights = ...
python
def _init_weights(self, X): """Set the weights and normalize data before starting training.""" X = np.asarray(X, dtype=np.float64) if self.scaler is not None: X = self.scaler.fit_transform(X) if self.initializer is not None: self.weights = ...
[ "def", "_init_weights", "(", "self", ",", "X", ")", ":", "X", "=", "np", ".", "asarray", "(", "X", ",", "dtype", "=", "np", ".", "float64", ")", "if", "self", ".", "scaler", "is", "not", "None", ":", "X", "=", "self", ".", "scaler", ".", "fit_t...
Set the weights and normalize data before starting training.
[ "Set", "the", "weights", "and", "normalize", "data", "before", "starting", "training", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L159-L173
44,904
stephantul/somber
somber/base.py
Base._pre_train
def _pre_train(self, stop_param_updates, num_epochs, updates_epoch): """Set parameters and constants before training.""" # Calculate the total number of updates given early stopping. updates = {k: stop_param_updates.get(k, num_epochs) * up...
python
def _pre_train(self, stop_param_updates, num_epochs, updates_epoch): """Set parameters and constants before training.""" # Calculate the total number of updates given early stopping. updates = {k: stop_param_updates.get(k, num_epochs) * up...
[ "def", "_pre_train", "(", "self", ",", "stop_param_updates", ",", "num_epochs", ",", "updates_epoch", ")", ":", "# Calculate the total number of updates given early stopping.", "updates", "=", "{", "k", ":", "stop_param_updates", ".", "get", "(", "k", ",", "num_epochs...
Set parameters and constants before training.
[ "Set", "parameters", "and", "constants", "before", "training", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L175-L195
44,905
stephantul/somber
somber/base.py
Base.fit_predict
def fit_predict(self, X, num_epochs=10, updates_epoch=10, stop_param_updates=dict(), batch_size=1, show_progressbar=False): """First fit, then predict.""" self.fit(X, ...
python
def fit_predict(self, X, num_epochs=10, updates_epoch=10, stop_param_updates=dict(), batch_size=1, show_progressbar=False): """First fit, then predict.""" self.fit(X, ...
[ "def", "fit_predict", "(", "self", ",", "X", ",", "num_epochs", "=", "10", ",", "updates_epoch", "=", "10", ",", "stop_param_updates", "=", "dict", "(", ")", ",", "batch_size", "=", "1", ",", "show_progressbar", "=", "False", ")", ":", "self", ".", "fi...
First fit, then predict.
[ "First", "fit", "then", "predict", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L197-L212
44,906
stephantul/somber
somber/base.py
Base.fit_transform
def fit_transform(self, X, num_epochs=10, updates_epoch=10, stop_param_updates=dict(), batch_size=1, show_progressbar=False, show_epoch=False): """First fit, ...
python
def fit_transform(self, X, num_epochs=10, updates_epoch=10, stop_param_updates=dict(), batch_size=1, show_progressbar=False, show_epoch=False): """First fit, ...
[ "def", "fit_transform", "(", "self", ",", "X", ",", "num_epochs", "=", "10", ",", "updates_epoch", "=", "10", ",", "stop_param_updates", "=", "dict", "(", ")", ",", "batch_size", "=", "1", ",", "show_progressbar", "=", "False", ",", "show_epoch", "=", "F...
First fit, then transform.
[ "First", "fit", "then", "transform", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L214-L231
44,907
stephantul/somber
somber/base.py
Base._update_params
def _update_params(self, constants): """Update params and return new influence.""" for k, v in constants.items(): self.params[k]['value'] *= v influence = self._calculate_influence(self.params['infl']['value']) return influence * self.params['lr']['value']
python
def _update_params(self, constants): """Update params and return new influence.""" for k, v in constants.items(): self.params[k]['value'] *= v influence = self._calculate_influence(self.params['infl']['value']) return influence * self.params['lr']['value']
[ "def", "_update_params", "(", "self", ",", "constants", ")", ":", "for", "k", ",", "v", "in", "constants", ".", "items", "(", ")", ":", "self", ".", "params", "[", "k", "]", "[", "'value'", "]", "*=", "v", "influence", "=", "self", ".", "_calculate...
Update params and return new influence.
[ "Update", "params", "and", "return", "new", "influence", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L295-L301
44,908
stephantul/somber
somber/base.py
Base._create_batches
def _create_batches(self, X, batch_size, shuffle_data=True): """ Create batches out of a sequence of data. This function will append zeros to the end of your data to ensure that all batches are even-sized. These are masked out during training. """ if shuffle_data: ...
python
def _create_batches(self, X, batch_size, shuffle_data=True): """ Create batches out of a sequence of data. This function will append zeros to the end of your data to ensure that all batches are even-sized. These are masked out during training. """ if shuffle_data: ...
[ "def", "_create_batches", "(", "self", ",", "X", ",", "batch_size", ",", "shuffle_data", "=", "True", ")", ":", "if", "shuffle_data", ":", "X", "=", "shuffle", "(", "X", ")", "if", "batch_size", ">", "X", ".", "shape", "[", "0", "]", ":", "batch_size...
Create batches out of a sequence of data. This function will append zeros to the end of your data to ensure that all batches are even-sized. These are masked out during training.
[ "Create", "batches", "out", "of", "a", "sequence", "of", "data", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L311-L327
44,909
stephantul/somber
somber/base.py
Base._propagate
def _propagate(self, x, influences, **kwargs): """Propagate a single batch of examples through the network.""" activation, difference_x = self.forward(x) update = self.backward(difference_x, influences, activation) # If batch size is 1 we can leave out the call to mean. if update...
python
def _propagate(self, x, influences, **kwargs): """Propagate a single batch of examples through the network.""" activation, difference_x = self.forward(x) update = self.backward(difference_x, influences, activation) # If batch size is 1 we can leave out the call to mean. if update...
[ "def", "_propagate", "(", "self", ",", "x", ",", "influences", ",", "*", "*", "kwargs", ")", ":", "activation", ",", "difference_x", "=", "self", ".", "forward", "(", "x", ")", "update", "=", "self", ".", "backward", "(", "difference_x", ",", "influenc...
Propagate a single batch of examples through the network.
[ "Propagate", "a", "single", "batch", "of", "examples", "through", "the", "network", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L329-L339
44,910
stephantul/somber
somber/base.py
Base._check_input
def _check_input(self, X): """ Check the input for validity. Ensures that the input data, X, is a 2-dimensional matrix, and that the second dimension of this matrix has the same dimensionality as the weight matrix. """ if np.ndim(X) == 1: X = np.resha...
python
def _check_input(self, X): """ Check the input for validity. Ensures that the input data, X, is a 2-dimensional matrix, and that the second dimension of this matrix has the same dimensionality as the weight matrix. """ if np.ndim(X) == 1: X = np.resha...
[ "def", "_check_input", "(", "self", ",", "X", ")", ":", "if", "np", ".", "ndim", "(", "X", ")", "==", "1", ":", "X", "=", "np", ".", "reshape", "(", "X", ",", "(", "1", ",", "-", "1", ")", ")", "if", "X", ".", "ndim", "!=", "2", ":", "r...
Check the input for validity. Ensures that the input data, X, is a 2-dimensional matrix, and that the second dimension of this matrix has the same dimensionality as the weight matrix.
[ "Check", "the", "input", "for", "validity", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L413-L432
44,911
stephantul/somber
somber/base.py
Base.transform
def transform(self, X, batch_size=100, show_progressbar=False): """ Transform input to a distance matrix by measuring the L2 distance. Parameters ---------- X : numpy array. The input data. batch_size : int, optional, default 100 The batch size to...
python
def transform(self, X, batch_size=100, show_progressbar=False): """ Transform input to a distance matrix by measuring the L2 distance. Parameters ---------- X : numpy array. The input data. batch_size : int, optional, default 100 The batch size to...
[ "def", "transform", "(", "self", ",", "X", ",", "batch_size", "=", "100", ",", "show_progressbar", "=", "False", ")", ":", "X", "=", "self", ".", "_check_input", "(", "X", ")", "batched", "=", "self", ".", "_create_batches", "(", "X", ",", "batch_size"...
Transform input to a distance matrix by measuring the L2 distance. Parameters ---------- X : numpy array. The input data. batch_size : int, optional, default 100 The batch size to use in transformation. This may affect the transformation in stateful, ...
[ "Transform", "input", "to", "a", "distance", "matrix", "by", "measuring", "the", "L2", "distance", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L434-L469
44,912
stephantul/somber
somber/base.py
Base.predict
def predict(self, X, batch_size=1, show_progressbar=False): """ Predict the BMU for each input data. Parameters ---------- X : numpy array. The input data. batch_size : int, optional, default 100 The batch size to use in prediction. This may affec...
python
def predict(self, X, batch_size=1, show_progressbar=False): """ Predict the BMU for each input data. Parameters ---------- X : numpy array. The input data. batch_size : int, optional, default 100 The batch size to use in prediction. This may affec...
[ "def", "predict", "(", "self", ",", "X", ",", "batch_size", "=", "1", ",", "show_progressbar", "=", "False", ")", ":", "dist", "=", "self", ".", "transform", "(", "X", ",", "batch_size", ",", "show_progressbar", ")", "res", "=", "dist", ".", "__getattr...
Predict the BMU for each input data. Parameters ---------- X : numpy array. The input data. batch_size : int, optional, default 100 The batch size to use in prediction. This may affect prediction in stateful, i.e. sequential SOMs. show_progres...
[ "Predict", "the", "BMU", "for", "each", "input", "data", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L471-L494
44,913
stephantul/somber
somber/base.py
Base.quantization_error
def quantization_error(self, X, batch_size=1): """ Calculate the quantization error. Find the the minimum euclidean distance between the units and some input. Parameters ---------- X : numpy array. The input data. batch_size : int ...
python
def quantization_error(self, X, batch_size=1): """ Calculate the quantization error. Find the the minimum euclidean distance between the units and some input. Parameters ---------- X : numpy array. The input data. batch_size : int ...
[ "def", "quantization_error", "(", "self", ",", "X", ",", "batch_size", "=", "1", ")", ":", "dist", "=", "self", ".", "transform", "(", "X", ",", "batch_size", ")", "res", "=", "dist", ".", "__getattribute__", "(", "self", ".", "valfunc", ")", "(", "1...
Calculate the quantization error. Find the the minimum euclidean distance between the units and some input. Parameters ---------- X : numpy array. The input data. batch_size : int The batch size to use for processing. Returns ---...
[ "Calculate", "the", "quantization", "error", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L496-L519
44,914
stephantul/somber
somber/base.py
Base.load
def load(cls, path): """ Load a SOM from a JSON file saved with this package. Parameters ---------- path : str The path to the JSON file. Returns ------- s : cls A som of the specified class. """ data = json.load(...
python
def load(cls, path): """ Load a SOM from a JSON file saved with this package. Parameters ---------- path : str The path to the JSON file. Returns ------- s : cls A som of the specified class. """ data = json.load(...
[ "def", "load", "(", "cls", ",", "path", ")", ":", "data", "=", "json", ".", "load", "(", "open", "(", "path", ")", ")", "weights", "=", "data", "[", "'weights'", "]", "weights", "=", "np", ".", "asarray", "(", "weights", ",", "dtype", "=", "np", ...
Load a SOM from a JSON file saved with this package. Parameters ---------- path : str The path to the JSON file. Returns ------- s : cls A som of the specified class.
[ "Load", "a", "SOM", "from", "a", "JSON", "file", "saved", "with", "this", "package", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L593-L625
44,915
stephantul/somber
somber/base.py
Base.save
def save(self, path): """Save a SOM to a JSON file.""" to_save = {} for x in self.param_names: attr = self.__getattribute__(x) if type(attr) == np.ndarray: attr = [[float(x) for x in row] for row in attr] elif isinstance(attr, types.FunctionTyp...
python
def save(self, path): """Save a SOM to a JSON file.""" to_save = {} for x in self.param_names: attr = self.__getattribute__(x) if type(attr) == np.ndarray: attr = [[float(x) for x in row] for row in attr] elif isinstance(attr, types.FunctionTyp...
[ "def", "save", "(", "self", ",", "path", ")", ":", "to_save", "=", "{", "}", "for", "x", "in", "self", ".", "param_names", ":", "attr", "=", "self", ".", "__getattribute__", "(", "x", ")", "if", "type", "(", "attr", ")", "==", "np", ".", "ndarray...
Save a SOM to a JSON file.
[ "Save", "a", "SOM", "to", "a", "JSON", "file", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/base.py#L627-L638
44,916
cloudnull/turbolift
turbolift/authentication/utils.py
get_authversion
def get_authversion(job_args): """Get or infer the auth version. Based on the information found in the *AUTH_VERSION_MAP* the authentication version will be set to a correct value as determined by the **os_auth_version** parameter as found in the `job_args`. :param job_args: ``dict`` :returns:...
python
def get_authversion(job_args): """Get or infer the auth version. Based on the information found in the *AUTH_VERSION_MAP* the authentication version will be set to a correct value as determined by the **os_auth_version** parameter as found in the `job_args`. :param job_args: ``dict`` :returns:...
[ "def", "get_authversion", "(", "job_args", ")", ":", "_version", "=", "job_args", ".", "get", "(", "'os_auth_version'", ")", "for", "version", ",", "variants", "in", "AUTH_VERSION_MAP", ".", "items", "(", ")", ":", "if", "_version", "in", "variants", ":", ...
Get or infer the auth version. Based on the information found in the *AUTH_VERSION_MAP* the authentication version will be set to a correct value as determined by the **os_auth_version** parameter as found in the `job_args`. :param job_args: ``dict`` :returns: ``str``
[ "Get", "or", "infer", "the", "auth", "version", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/authentication/utils.py#L53-L73
44,917
cloudnull/turbolift
turbolift/authentication/utils.py
V1Authentication.get_headers
def get_headers(self): """Setup headers for authentication request.""" try: return { 'X-Auth-User': self.job_args['os_user'], 'X-Auth-Key': self.job_args['os_apikey'] } except KeyError as exp: raise exceptions.AuthenticationPro...
python
def get_headers(self): """Setup headers for authentication request.""" try: return { 'X-Auth-User': self.job_args['os_user'], 'X-Auth-Key': self.job_args['os_apikey'] } except KeyError as exp: raise exceptions.AuthenticationPro...
[ "def", "get_headers", "(", "self", ")", ":", "try", ":", "return", "{", "'X-Auth-User'", ":", "self", ".", "job_args", "[", "'os_user'", "]", ",", "'X-Auth-Key'", ":", "self", ".", "job_args", "[", "'os_apikey'", "]", "}", "except", "KeyError", "as", "ex...
Setup headers for authentication request.
[ "Setup", "headers", "for", "authentication", "request", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/authentication/utils.py#L104-L116
44,918
cloudnull/turbolift
turbolift/authentication/utils.py
OSAuthentication.auth_request
def auth_request(self, url, headers, body): """Perform auth request for token.""" return self.req.post(url, headers, body=body)
python
def auth_request(self, url, headers, body): """Perform auth request for token.""" return self.req.post(url, headers, body=body)
[ "def", "auth_request", "(", "self", ",", "url", ",", "headers", ",", "body", ")", ":", "return", "self", ".", "req", ".", "post", "(", "url", ",", "headers", ",", "body", "=", "body", ")" ]
Perform auth request for token.
[ "Perform", "auth", "request", "for", "token", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/authentication/utils.py#L150-L153
44,919
cloudnull/turbolift
turbolift/authentication/utils.py
OSAuthentication.parse_reqtype
def parse_reqtype(self): """Return the authentication body.""" if self.job_args['os_auth_version'] == 'v1.0': return dict() else: setup = { 'username': self.job_args.get('os_user') } # Check if any prefix items are set. A prefix s...
python
def parse_reqtype(self): """Return the authentication body.""" if self.job_args['os_auth_version'] == 'v1.0': return dict() else: setup = { 'username': self.job_args.get('os_user') } # Check if any prefix items are set. A prefix s...
[ "def", "parse_reqtype", "(", "self", ")", ":", "if", "self", ".", "job_args", "[", "'os_auth_version'", "]", "==", "'v1.0'", ":", "return", "dict", "(", ")", "else", ":", "setup", "=", "{", "'username'", ":", "self", ".", "job_args", ".", "get", "(", ...
Return the authentication body.
[ "Return", "the", "authentication", "body", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/authentication/utils.py#L155-L224
44,920
cloudnull/turbolift
turbolift/executable.py
execute
def execute(): """This is the run section of the application Turbolift.""" if len(sys.argv) <= 1: raise SystemExit( 'No Arguments provided. use [--help] for more information.' ) # Capture user arguments _args = arguments.ArgumentParserator( arguments_dict=turbolift....
python
def execute(): """This is the run section of the application Turbolift.""" if len(sys.argv) <= 1: raise SystemExit( 'No Arguments provided. use [--help] for more information.' ) # Capture user arguments _args = arguments.ArgumentParserator( arguments_dict=turbolift....
[ "def", "execute", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", "<=", "1", ":", "raise", "SystemExit", "(", "'No Arguments provided. use [--help] for more information.'", ")", "# Capture user arguments", "_args", "=", "arguments", ".", "ArgumentParserato...
This is the run section of the application Turbolift.
[ "This", "is", "the", "run", "section", "of", "the", "application", "Turbolift", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/executable.py#L21-L59
44,921
Clivern/PyLogging
pylogging/storage.py
TextStorage.write
def write(self, log_file, msg): """ Append message to .log file """ try: with open(log_file, 'a') as LogFile: LogFile.write(msg + os.linesep) except: raise Exception('Error Configuring PyLogger.TextStorage Class.') return os.path.isfile(log_file)
python
def write(self, log_file, msg): """ Append message to .log file """ try: with open(log_file, 'a') as LogFile: LogFile.write(msg + os.linesep) except: raise Exception('Error Configuring PyLogger.TextStorage Class.') return os.path.isfile(log_file)
[ "def", "write", "(", "self", ",", "log_file", ",", "msg", ")", ":", "try", ":", "with", "open", "(", "log_file", ",", "'a'", ")", "as", "LogFile", ":", "LogFile", ".", "write", "(", "msg", "+", "os", ".", "linesep", ")", "except", ":", "raise", "...
Append message to .log file
[ "Append", "message", "to", ".", "log", "file" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/storage.py#L12-L20
44,922
Clivern/PyLogging
pylogging/storage.py
TextStorage.read
def read(self, log_file): """ Read messages from .log file """ if os.path.isdir(os.path.dirname(log_file)) and os.path.isfile(log_file): with open(log_file, 'r') as LogFile: data = LogFile.readlines() data = "".join(line for line in data) else: ...
python
def read(self, log_file): """ Read messages from .log file """ if os.path.isdir(os.path.dirname(log_file)) and os.path.isfile(log_file): with open(log_file, 'r') as LogFile: data = LogFile.readlines() data = "".join(line for line in data) else: ...
[ "def", "read", "(", "self", ",", "log_file", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "dirname", "(", "log_file", ")", ")", "and", "os", ".", "path", ".", "isfile", "(", "log_file", ")", ":", "with", "open", ...
Read messages from .log file
[ "Read", "messages", "from", ".", "log", "file" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/storage.py#L22-L30
44,923
stephantul/somber
somber/components/utilities.py
Scaler.fit
def fit(self, X): """ Fit the scaler based on some data. Takes the columnwise mean and standard deviation of the entire input array. If the array has more than 2 dimensions, it is flattened. Parameters ---------- X : numpy array Returns ...
python
def fit(self, X): """ Fit the scaler based on some data. Takes the columnwise mean and standard deviation of the entire input array. If the array has more than 2 dimensions, it is flattened. Parameters ---------- X : numpy array Returns ...
[ "def", "fit", "(", "self", ",", "X", ")", ":", "if", "X", ".", "ndim", ">", "2", ":", "X", "=", "X", ".", "reshape", "(", "(", "np", ".", "prod", "(", "X", ".", "shape", "[", ":", "-", "1", "]", ")", ",", "X", ".", "shape", "[", "-", ...
Fit the scaler based on some data. Takes the columnwise mean and standard deviation of the entire input array. If the array has more than 2 dimensions, it is flattened. Parameters ---------- X : numpy array Returns ------- scaled : numpy array ...
[ "Fit", "the", "scaler", "based", "on", "some", "data", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/components/utilities.py#L31-L54
44,924
stephantul/somber
somber/components/utilities.py
Scaler.transform
def transform(self, X): """Transform your data to zero mean unit variance.""" if not self.is_fit: raise ValueError("The scaler has not been fit yet.") return (X-self.mean) / (self.std + 10e-7)
python
def transform(self, X): """Transform your data to zero mean unit variance.""" if not self.is_fit: raise ValueError("The scaler has not been fit yet.") return (X-self.mean) / (self.std + 10e-7)
[ "def", "transform", "(", "self", ",", "X", ")", ":", "if", "not", "self", ".", "is_fit", ":", "raise", "ValueError", "(", "\"The scaler has not been fit yet.\"", ")", "return", "(", "X", "-", "self", ".", "mean", ")", "/", "(", "self", ".", "std", "+",...
Transform your data to zero mean unit variance.
[ "Transform", "your", "data", "to", "zero", "mean", "unit", "variance", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/components/utilities.py#L56-L60
44,925
cloudnull/turbolift
turbolift/clouderator/utils.py
stupid_hack
def stupid_hack(most=10, wait=None): """Return a random time between 1 - 10 Seconds.""" # Stupid Hack For Public Cloud so it is not overwhelmed with API requests. if wait is not None: time.sleep(wait) else: time.sleep(random.randrange(1, most))
python
def stupid_hack(most=10, wait=None): """Return a random time between 1 - 10 Seconds.""" # Stupid Hack For Public Cloud so it is not overwhelmed with API requests. if wait is not None: time.sleep(wait) else: time.sleep(random.randrange(1, most))
[ "def", "stupid_hack", "(", "most", "=", "10", ",", "wait", "=", "None", ")", ":", "# Stupid Hack For Public Cloud so it is not overwhelmed with API requests.", "if", "wait", "is", "not", "None", ":", "time", ".", "sleep", "(", "wait", ")", "else", ":", "time", ...
Return a random time between 1 - 10 Seconds.
[ "Return", "a", "random", "time", "between", "1", "-", "10", "Seconds", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/utils.py#L51-L58
44,926
cloudnull/turbolift
turbolift/clouderator/utils.py
time_stamp
def time_stamp(): """Setup time functions :returns: ``tuple`` """ # Time constants fmt = '%Y-%m-%dT%H:%M:%S.%f' date = datetime.datetime date_delta = datetime.timedelta now = datetime.datetime.utcnow() return fmt, date, date_delta, now
python
def time_stamp(): """Setup time functions :returns: ``tuple`` """ # Time constants fmt = '%Y-%m-%dT%H:%M:%S.%f' date = datetime.datetime date_delta = datetime.timedelta now = datetime.datetime.utcnow() return fmt, date, date_delta, now
[ "def", "time_stamp", "(", ")", ":", "# Time constants", "fmt", "=", "'%Y-%m-%dT%H:%M:%S.%f'", "date", "=", "datetime", ".", "datetime", "date_delta", "=", "datetime", ".", "timedelta", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "return",...
Setup time functions :returns: ``tuple``
[ "Setup", "time", "functions" ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/utils.py#L61-L73
44,927
cloudnull/turbolift
turbolift/clouderator/utils.py
unique_list_dicts
def unique_list_dicts(dlist, key): """Return a list of dictionaries which are sorted for only unique entries. :param dlist: :param key: :return list: """ return list(dict((val[key], val) for val in dlist).values())
python
def unique_list_dicts(dlist, key): """Return a list of dictionaries which are sorted for only unique entries. :param dlist: :param key: :return list: """ return list(dict((val[key], val) for val in dlist).values())
[ "def", "unique_list_dicts", "(", "dlist", ",", "key", ")", ":", "return", "list", "(", "dict", "(", "(", "val", "[", "key", "]", ",", "val", ")", "for", "val", "in", "dlist", ")", ".", "values", "(", ")", ")" ]
Return a list of dictionaries which are sorted for only unique entries. :param dlist: :param key: :return list:
[ "Return", "a", "list", "of", "dictionaries", "which", "are", "sorted", "for", "only", "unique", "entries", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/utils.py#L76-L84
44,928
cloudnull/turbolift
turbolift/clouderator/utils.py
quoter
def quoter(obj): """Return a Quoted URL. The quote function will return a URL encoded string. If there is an exception in the job which results in a "KeyError" the original string will be returned as it will be assumed to already be URL encoded. :param obj: ``basestring`` :return: ``str``...
python
def quoter(obj): """Return a Quoted URL. The quote function will return a URL encoded string. If there is an exception in the job which results in a "KeyError" the original string will be returned as it will be assumed to already be URL encoded. :param obj: ``basestring`` :return: ``str``...
[ "def", "quoter", "(", "obj", ")", ":", "try", ":", "try", ":", "return", "urllib", ".", "quote", "(", "obj", ")", "except", "AttributeError", ":", "return", "urllib", ".", "parse", ".", "quote", "(", "obj", ")", "except", "KeyError", ":", "return", "...
Return a Quoted URL. The quote function will return a URL encoded string. If there is an exception in the job which results in a "KeyError" the original string will be returned as it will be assumed to already be URL encoded. :param obj: ``basestring`` :return: ``str``
[ "Return", "a", "Quoted", "URL", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/utils.py#L136-L154
44,929
cloudnull/turbolift
turbolift/methods/clone.py
CloneRunMethod.start
def start(self): """Clone objects from one container to another. This method was built to clone a container between data-centers while using the same credentials. The method assumes that an authentication token will be valid within the two data centers. """ LOG.info('Cl...
python
def start(self): """Clone objects from one container to another. This method was built to clone a container between data-centers while using the same credentials. The method assumes that an authentication token will be valid within the two data centers. """ LOG.info('Cl...
[ "def", "start", "(", "self", ")", ":", "LOG", ".", "info", "(", "'Clone warm up...'", ")", "# Create the target args", "self", ".", "_target_auth", "(", ")", "last_list_obj", "=", "None", "while", "True", ":", "self", ".", "indicator_options", "[", "'msg'", ...
Clone objects from one container to another. This method was built to clone a container between data-centers while using the same credentials. The method assumes that an authentication token will be valid within the two data centers.
[ "Clone", "objects", "from", "one", "container", "to", "another", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/methods/clone.py#L162-L195
44,930
cloudnull/turbolift
turbolift/authentication/auth.py
authenticate
def authenticate(job_args): """Authentication For Openstack API. Pulls the full Openstack Service Catalog Credentials are the Users API Username and Key/Password. Set a DC Endpoint and Authentication URL for the OpenStack environment """ # Load any authentication plugins as needed job_arg...
python
def authenticate(job_args): """Authentication For Openstack API. Pulls the full Openstack Service Catalog Credentials are the Users API Username and Key/Password. Set a DC Endpoint and Authentication URL for the OpenStack environment """ # Load any authentication plugins as needed job_arg...
[ "def", "authenticate", "(", "job_args", ")", ":", "# Load any authentication plugins as needed", "job_args", "=", "utils", ".", "check_auth_plugin", "(", "job_args", ")", "# Set the auth version", "auth_version", "=", "utils", ".", "get_authversion", "(", "job_args", "=...
Authentication For Openstack API. Pulls the full Openstack Service Catalog Credentials are the Users API Username and Key/Password. Set a DC Endpoint and Authentication URL for the OpenStack environment
[ "Authentication", "For", "Openstack", "API", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/authentication/auth.py#L14-L74
44,931
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.getConfig
def getConfig(self, key): """ Get a Config Value """ if hasattr(self, key): return getattr(self, key) else: return False
python
def getConfig(self, key): """ Get a Config Value """ if hasattr(self, key): return getattr(self, key) else: return False
[ "def", "getConfig", "(", "self", ",", "key", ")", ":", "if", "hasattr", "(", "self", ",", "key", ")", ":", "return", "getattr", "(", "self", ",", "key", ")", "else", ":", "return", "False" ]
Get a Config Value
[ "Get", "a", "Config", "Value" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L91-L96
44,932
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.addFilter
def addFilter(self, filter): """ Register Custom Filter """ self.FILTERS.append(filter) return "FILTER#{}".format(len(self.FILTERS) - 1)
python
def addFilter(self, filter): """ Register Custom Filter """ self.FILTERS.append(filter) return "FILTER#{}".format(len(self.FILTERS) - 1)
[ "def", "addFilter", "(", "self", ",", "filter", ")", ":", "self", ".", "FILTERS", ".", "append", "(", "filter", ")", "return", "\"FILTER#{}\"", ".", "format", "(", "len", "(", "self", ".", "FILTERS", ")", "-", "1", ")" ]
Register Custom Filter
[ "Register", "Custom", "Filter" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L103-L106
44,933
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.addAction
def addAction(self, action): """ Register Custom Action """ self.ACTIONS.append(action) return "ACTION#{}".format(len(self.ACTIONS) - 1)
python
def addAction(self, action): """ Register Custom Action """ self.ACTIONS.append(action) return "ACTION#{}".format(len(self.ACTIONS) - 1)
[ "def", "addAction", "(", "self", ",", "action", ")", ":", "self", ".", "ACTIONS", ".", "append", "(", "action", ")", "return", "\"ACTION#{}\"", ".", "format", "(", "len", "(", "self", ".", "ACTIONS", ")", "-", "1", ")" ]
Register Custom Action
[ "Register", "Custom", "Action" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L108-L111
44,934
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.removeFilter
def removeFilter(self, filter): """ Remove Registered Filter """ filter = filter.split('#') del self.FILTERS[int(filter[1])] return True
python
def removeFilter(self, filter): """ Remove Registered Filter """ filter = filter.split('#') del self.FILTERS[int(filter[1])] return True
[ "def", "removeFilter", "(", "self", ",", "filter", ")", ":", "filter", "=", "filter", ".", "split", "(", "'#'", ")", "del", "self", ".", "FILTERS", "[", "int", "(", "filter", "[", "1", "]", ")", "]", "return", "True" ]
Remove Registered Filter
[ "Remove", "Registered", "Filter" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L113-L117
44,935
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.removeAction
def removeAction(self, action): """ Remove Registered Action """ action = action.split('#') del self.ACTIONS[int(action[1])] return True
python
def removeAction(self, action): """ Remove Registered Action """ action = action.split('#') del self.ACTIONS[int(action[1])] return True
[ "def", "removeAction", "(", "self", ",", "action", ")", ":", "action", "=", "action", ".", "split", "(", "'#'", ")", "del", "self", ".", "ACTIONS", "[", "int", "(", "action", "[", "1", "]", ")", "]", "return", "True" ]
Remove Registered Action
[ "Remove", "Registered", "Action" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L119-L123
44,936
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.info
def info(self, msg): """ Log Info Messages """ self._execActions('info', msg) msg = self._execFilters('info', msg) self._processMsg('info', msg) self._sendMsg('info', msg)
python
def info(self, msg): """ Log Info Messages """ self._execActions('info', msg) msg = self._execFilters('info', msg) self._processMsg('info', msg) self._sendMsg('info', msg)
[ "def", "info", "(", "self", ",", "msg", ")", ":", "self", ".", "_execActions", "(", "'info'", ",", "msg", ")", "msg", "=", "self", ".", "_execFilters", "(", "'info'", ",", "msg", ")", "self", ".", "_processMsg", "(", "'info'", ",", "msg", ")", "sel...
Log Info Messages
[ "Log", "Info", "Messages" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L125-L130
44,937
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.warning
def warning(self, msg): """ Log Warning Messages """ self._execActions('warning', msg) msg = self._execFilters('warning', msg) self._processMsg('warning', msg) self._sendMsg('warning', msg)
python
def warning(self, msg): """ Log Warning Messages """ self._execActions('warning', msg) msg = self._execFilters('warning', msg) self._processMsg('warning', msg) self._sendMsg('warning', msg)
[ "def", "warning", "(", "self", ",", "msg", ")", ":", "self", ".", "_execActions", "(", "'warning'", ",", "msg", ")", "msg", "=", "self", ".", "_execFilters", "(", "'warning'", ",", "msg", ")", "self", ".", "_processMsg", "(", "'warning'", ",", "msg", ...
Log Warning Messages
[ "Log", "Warning", "Messages" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L132-L137
44,938
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.error
def error(self, msg): """ Log Error Messages """ self._execActions('error', msg) msg = self._execFilters('error', msg) self._processMsg('error', msg) self._sendMsg('error', msg)
python
def error(self, msg): """ Log Error Messages """ self._execActions('error', msg) msg = self._execFilters('error', msg) self._processMsg('error', msg) self._sendMsg('error', msg)
[ "def", "error", "(", "self", ",", "msg", ")", ":", "self", ".", "_execActions", "(", "'error'", ",", "msg", ")", "msg", "=", "self", ".", "_execFilters", "(", "'error'", ",", "msg", ")", "self", ".", "_processMsg", "(", "'error'", ",", "msg", ")", ...
Log Error Messages
[ "Log", "Error", "Messages" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L139-L144
44,939
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.critical
def critical(self, msg): """ Log Critical Messages """ self._execActions('critical', msg) msg = self._execFilters('critical', msg) self._processMsg('critical', msg) self._sendMsg('critical', msg)
python
def critical(self, msg): """ Log Critical Messages """ self._execActions('critical', msg) msg = self._execFilters('critical', msg) self._processMsg('critical', msg) self._sendMsg('critical', msg)
[ "def", "critical", "(", "self", ",", "msg", ")", ":", "self", ".", "_execActions", "(", "'critical'", ",", "msg", ")", "msg", "=", "self", ".", "_execFilters", "(", "'critical'", ",", "msg", ")", "self", ".", "_processMsg", "(", "'critical'", ",", "msg...
Log Critical Messages
[ "Log", "Critical", "Messages" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L146-L151
44,940
Clivern/PyLogging
pylogging/pylogging.py
PyLogging.log
def log(self, msg): """ Log Normal Messages """ self._execActions('log', msg) msg = self._execFilters('log', msg) self._processMsg('log', msg) self._sendMsg('log', msg)
python
def log(self, msg): """ Log Normal Messages """ self._execActions('log', msg) msg = self._execFilters('log', msg) self._processMsg('log', msg) self._sendMsg('log', msg)
[ "def", "log", "(", "self", ",", "msg", ")", ":", "self", ".", "_execActions", "(", "'log'", ",", "msg", ")", "msg", "=", "self", ".", "_execFilters", "(", "'log'", ",", "msg", ")", "self", ".", "_processMsg", "(", "'log'", ",", "msg", ")", "self", ...
Log Normal Messages
[ "Log", "Normal", "Messages" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L153-L158
44,941
Clivern/PyLogging
pylogging/pylogging.py
PyLogging._processMsg
def _processMsg(self, type, msg): """ Process Debug Messages """ now = datetime.datetime.now() # Check If Path not provided if self.LOG_FILE_PATH == '': self.LOG_FILE_PATH = os.path.dirname(os.path.abspath(__file__)) + '/' # Build absolute Path log_file = se...
python
def _processMsg(self, type, msg): """ Process Debug Messages """ now = datetime.datetime.now() # Check If Path not provided if self.LOG_FILE_PATH == '': self.LOG_FILE_PATH = os.path.dirname(os.path.abspath(__file__)) + '/' # Build absolute Path log_file = se...
[ "def", "_processMsg", "(", "self", ",", "type", ",", "msg", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "# Check If Path not provided", "if", "self", ".", "LOG_FILE_PATH", "==", "''", ":", "self", ".", "LOG_FILE_PATH", "=", "...
Process Debug Messages
[ "Process", "Debug", "Messages" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L160-L196
44,942
Clivern/PyLogging
pylogging/pylogging.py
PyLogging._configMailer
def _configMailer(self): """ Config Mailer Class """ self._MAILER = Mailer(self.MAILER_HOST, self.MAILER_PORT) self._MAILER.login(self.MAILER_USER, self.MAILER_PWD)
python
def _configMailer(self): """ Config Mailer Class """ self._MAILER = Mailer(self.MAILER_HOST, self.MAILER_PORT) self._MAILER.login(self.MAILER_USER, self.MAILER_PWD)
[ "def", "_configMailer", "(", "self", ")", ":", "self", ".", "_MAILER", "=", "Mailer", "(", "self", ".", "MAILER_HOST", ",", "self", ".", "MAILER_PORT", ")", "self", ".", "_MAILER", ".", "login", "(", "self", ".", "MAILER_USER", ",", "self", ".", "MAILE...
Config Mailer Class
[ "Config", "Mailer", "Class" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L198-L201
44,943
Clivern/PyLogging
pylogging/pylogging.py
PyLogging._sendMsg
def _sendMsg(self, type, msg): """ Send Alert Message To Emails """ if self.ALERT_STATUS and type in self.ALERT_TYPES: self._configMailer() self._MAILER.send(self.MAILER_FROM, self.ALERT_EMAIL, self.ALERT_SUBJECT, msg)
python
def _sendMsg(self, type, msg): """ Send Alert Message To Emails """ if self.ALERT_STATUS and type in self.ALERT_TYPES: self._configMailer() self._MAILER.send(self.MAILER_FROM, self.ALERT_EMAIL, self.ALERT_SUBJECT, msg)
[ "def", "_sendMsg", "(", "self", ",", "type", ",", "msg", ")", ":", "if", "self", ".", "ALERT_STATUS", "and", "type", "in", "self", ".", "ALERT_TYPES", ":", "self", ".", "_configMailer", "(", ")", "self", ".", "_MAILER", ".", "send", "(", "self", ".",...
Send Alert Message To Emails
[ "Send", "Alert", "Message", "To", "Emails" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L203-L207
44,944
Clivern/PyLogging
pylogging/pylogging.py
PyLogging._execFilters
def _execFilters(self, type, msg): """ Execute Registered Filters """ for filter in self.FILTERS: msg = filter(type, msg) return msg
python
def _execFilters(self, type, msg): """ Execute Registered Filters """ for filter in self.FILTERS: msg = filter(type, msg) return msg
[ "def", "_execFilters", "(", "self", ",", "type", ",", "msg", ")", ":", "for", "filter", "in", "self", ".", "FILTERS", ":", "msg", "=", "filter", "(", "type", ",", "msg", ")", "return", "msg" ]
Execute Registered Filters
[ "Execute", "Registered", "Filters" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L209-L213
44,945
Clivern/PyLogging
pylogging/pylogging.py
PyLogging._execActions
def _execActions(self, type, msg): """ Execute Registered Actions """ for action in self.ACTIONS: action(type, msg)
python
def _execActions(self, type, msg): """ Execute Registered Actions """ for action in self.ACTIONS: action(type, msg)
[ "def", "_execActions", "(", "self", ",", "type", ",", "msg", ")", ":", "for", "action", "in", "self", ".", "ACTIONS", ":", "action", "(", "type", ",", "msg", ")" ]
Execute Registered Actions
[ "Execute", "Registered", "Actions" ]
46a1442ec63796302ec7fe3d49bd06a0f7a2fe70
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L215-L218
44,946
cloudnull/turbolift
turbolift/__init__.py
auth_plugins
def auth_plugins(auth_plugins=None): """Authentication plugins. Usage, Add any plugin here that will serve as a rapid means to authenticate to an OpenStack environment. Syntax is as follows: >>> __auth_plugins__ = { ... 'new_plugin_name': { ... 'os_auth_url': 'https://localhost...
python
def auth_plugins(auth_plugins=None): """Authentication plugins. Usage, Add any plugin here that will serve as a rapid means to authenticate to an OpenStack environment. Syntax is as follows: >>> __auth_plugins__ = { ... 'new_plugin_name': { ... 'os_auth_url': 'https://localhost...
[ "def", "auth_plugins", "(", "auth_plugins", "=", "None", ")", ":", "__auth_plugins__", "=", "{", "'os_rax_auth'", ":", "{", "'os_auth_url'", ":", "'https://identity.api.rackspacecloud.com/v2.0/'", "'tokens'", ",", "'os_prefix'", ":", "{", "'os_apikey'", ":", "'RAX-KSK...
Authentication plugins. Usage, Add any plugin here that will serve as a rapid means to authenticate to an OpenStack environment. Syntax is as follows: >>> __auth_plugins__ = { ... 'new_plugin_name': { ... 'os_auth_url': 'https://localhost:5000/v2.0/tokens', ... 'os_pref...
[ "Authentication", "plugins", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/__init__.py#L999-L1121
44,947
cloudnull/turbolift
turbolift/utils.py
check_basestring
def check_basestring(item): """Return ``bol`` on string check item. :param item: Item to check if its a string :type item: ``str`` :returns: ``bol`` """ try: return isinstance(item, (basestring, unicode)) except NameError: return isinstance(item, str)
python
def check_basestring(item): """Return ``bol`` on string check item. :param item: Item to check if its a string :type item: ``str`` :returns: ``bol`` """ try: return isinstance(item, (basestring, unicode)) except NameError: return isinstance(item, str)
[ "def", "check_basestring", "(", "item", ")", ":", "try", ":", "return", "isinstance", "(", "item", ",", "(", "basestring", ",", "unicode", ")", ")", "except", "NameError", ":", "return", "isinstance", "(", "item", ",", "str", ")" ]
Return ``bol`` on string check item. :param item: Item to check if its a string :type item: ``str`` :returns: ``bol``
[ "Return", "bol", "on", "string", "check", "item", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/utils.py#L12-L22
44,948
stephantul/somber
somber/sequential.py
SequentialMixin.predict_distance
def predict_distance(self, X, batch_size=1, show_progressbar=False): """Predict distances to some input data.""" X = self._check_input(X) X_shape = reduce(np.multiply, X.shape[:-1], 1) batched = self._create_batches(X, batch_size, shuffle_data=False) activations = [] ...
python
def predict_distance(self, X, batch_size=1, show_progressbar=False): """Predict distances to some input data.""" X = self._check_input(X) X_shape = reduce(np.multiply, X.shape[:-1], 1) batched = self._create_batches(X, batch_size, shuffle_data=False) activations = [] ...
[ "def", "predict_distance", "(", "self", ",", "X", ",", "batch_size", "=", "1", ",", "show_progressbar", "=", "False", ")", ":", "X", "=", "self", ".", "_check_input", "(", "X", ")", "X_shape", "=", "reduce", "(", "np", ".", "multiply", ",", "X", ".",...
Predict distances to some input data.
[ "Predict", "distances", "to", "some", "input", "data", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/sequential.py#L48-L66
44,949
stephantul/somber
somber/sequential.py
SequentialMixin.generate
def generate(self, num_to_generate, starting_place): """Generate data based on some initial position.""" res = [] activ = starting_place[None, :] index = activ.__getattribute__(self.argfunc)(1) item = self.weights[index] for x in range(num_to_generate): activ ...
python
def generate(self, num_to_generate, starting_place): """Generate data based on some initial position.""" res = [] activ = starting_place[None, :] index = activ.__getattribute__(self.argfunc)(1) item = self.weights[index] for x in range(num_to_generate): activ ...
[ "def", "generate", "(", "self", ",", "num_to_generate", ",", "starting_place", ")", ":", "res", "=", "[", "]", "activ", "=", "starting_place", "[", "None", ",", ":", "]", "index", "=", "activ", ".", "__getattribute__", "(", "self", ".", "argfunc", ")", ...
Generate data based on some initial position.
[ "Generate", "data", "based", "on", "some", "initial", "position", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/sequential.py#L68-L80
44,950
stephantul/somber
somber/sequential.py
RecursiveMixin.forward
def forward(self, x, **kwargs): """ Perform a forward pass through the network. The forward pass in recursive som is based on a combination between the activation in the last time-step and the current time-step. Parameters ---------- x : numpy array ...
python
def forward(self, x, **kwargs): """ Perform a forward pass through the network. The forward pass in recursive som is based on a combination between the activation in the last time-step and the current time-step. Parameters ---------- x : numpy array ...
[ "def", "forward", "(", "self", ",", "x", ",", "*", "*", "kwargs", ")", ":", "prev", "=", "kwargs", "[", "'prev_activation'", "]", "# Differences is the components of the weights subtracted from", "# the weight vector.", "distance_x", ",", "diff_x", "=", "self", ".",...
Perform a forward pass through the network. The forward pass in recursive som is based on a combination between the activation in the last time-step and the current time-step. Parameters ---------- x : numpy array The input data. prev_activation : numpy arra...
[ "Perform", "a", "forward", "pass", "through", "the", "network", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/sequential.py#L167-L200
44,951
stephantul/somber
somber/sequential.py
RecursiveMixin.load
def load(cls, path): """ Load a recursive SOM from a JSON file. You can use this function to load weights of other SOMs. If there are no context weights, they will be set to 0. Parameters ---------- path : str The path to the JSON file. Retu...
python
def load(cls, path): """ Load a recursive SOM from a JSON file. You can use this function to load weights of other SOMs. If there are no context weights, they will be set to 0. Parameters ---------- path : str The path to the JSON file. Retu...
[ "def", "load", "(", "cls", ",", "path", ")", ":", "data", "=", "json", ".", "load", "(", "open", "(", "path", ")", ")", "weights", "=", "data", "[", "'weights'", "]", "weights", "=", "np", ".", "asarray", "(", "weights", ",", "dtype", "=", "np", ...
Load a recursive SOM from a JSON file. You can use this function to load weights of other SOMs. If there are no context weights, they will be set to 0. Parameters ---------- path : str The path to the JSON file. Returns ------- s : cls ...
[ "Load", "a", "recursive", "SOM", "from", "a", "JSON", "file", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/sequential.py#L203-L253
44,952
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions._return_base_data
def _return_base_data(self, url, container, container_object=None, container_headers=None, object_headers=None): """Return headers and a parsed url. :param url: :param container: :param container_object: :param container_headers: :return: ``tupl...
python
def _return_base_data(self, url, container, container_object=None, container_headers=None, object_headers=None): """Return headers and a parsed url. :param url: :param container: :param container_object: :param container_headers: :return: ``tupl...
[ "def", "_return_base_data", "(", "self", ",", "url", ",", "container", ",", "container_object", "=", "None", ",", "container_headers", "=", "None", ",", "object_headers", "=", "None", ")", ":", "headers", "=", "self", ".", "job_args", "[", "'base_headers'", ...
Return headers and a parsed url. :param url: :param container: :param container_object: :param container_headers: :return: ``tuple``
[ "Return", "headers", "and", "a", "parsed", "url", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L48-L79
44,953
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions._chunk_putter
def _chunk_putter(self, uri, open_file, headers=None): """Make many PUT request for a single chunked object. Objects that are processed by this method have a SHA256 hash appended to the name as well as a count for object indexing which starts at 0. To make a PUT request pass, ``url`` ...
python
def _chunk_putter(self, uri, open_file, headers=None): """Make many PUT request for a single chunked object. Objects that are processed by this method have a SHA256 hash appended to the name as well as a count for object indexing which starts at 0. To make a PUT request pass, ``url`` ...
[ "def", "_chunk_putter", "(", "self", ",", "uri", ",", "open_file", ",", "headers", "=", "None", ")", ":", "count", "=", "0", "dynamic_hash", "=", "hashlib", ".", "sha256", "(", "self", ".", "job_args", ".", "get", "(", "'container'", ")", ")", "dynamic...
Make many PUT request for a single chunked object. Objects that are processed by this method have a SHA256 hash appended to the name as well as a count for object indexing which starts at 0. To make a PUT request pass, ``url`` :param uri: ``str`` :param open_file: ``object`` ...
[ "Make", "many", "PUT", "request", "for", "a", "single", "chunked", "object", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L102-L153
44,954
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions._putter
def _putter(self, uri, headers, local_object=None): """Place object into the container. :param uri: :param headers: :param local_object: """ if not local_object: return self.http.put(url=uri, headers=headers) with open(local_object, 'rb') as f_open...
python
def _putter(self, uri, headers, local_object=None): """Place object into the container. :param uri: :param headers: :param local_object: """ if not local_object: return self.http.put(url=uri, headers=headers) with open(local_object, 'rb') as f_open...
[ "def", "_putter", "(", "self", ",", "uri", ",", "headers", ",", "local_object", "=", "None", ")", ":", "if", "not", "local_object", ":", "return", "self", ".", "http", ".", "put", "(", "url", "=", "uri", ",", "headers", "=", "headers", ")", "with", ...
Place object into the container. :param uri: :param headers: :param local_object:
[ "Place", "object", "into", "the", "container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L156-L196
44,955
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions._header_poster
def _header_poster(self, uri, headers): """POST Headers on a specified object in the container. :param uri: ``str`` :param headers: ``dict`` """ resp = self.http.post(url=uri, body=None, headers=headers) self._resp_exception(resp=resp) return resp
python
def _header_poster(self, uri, headers): """POST Headers on a specified object in the container. :param uri: ``str`` :param headers: ``dict`` """ resp = self.http.post(url=uri, body=None, headers=headers) self._resp_exception(resp=resp) return resp
[ "def", "_header_poster", "(", "self", ",", "uri", ",", "headers", ")", ":", "resp", "=", "self", ".", "http", ".", "post", "(", "url", "=", "uri", ",", "body", "=", "None", ",", "headers", "=", "headers", ")", "self", ".", "_resp_exception", "(", "...
POST Headers on a specified object in the container. :param uri: ``str`` :param headers: ``dict``
[ "POST", "Headers", "on", "a", "specified", "object", "in", "the", "container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L274-L283
44,956
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions._obj_index
def _obj_index(self, uri, base_path, marked_path, headers, spr=False): """Return an index of objects from within the container. :param uri: :param base_path: :param marked_path: :param headers: :param spr: "single page return" Limit the returned data to one page ...
python
def _obj_index(self, uri, base_path, marked_path, headers, spr=False): """Return an index of objects from within the container. :param uri: :param base_path: :param marked_path: :param headers: :param spr: "single page return" Limit the returned data to one page ...
[ "def", "_obj_index", "(", "self", ",", "uri", ",", "base_path", ",", "marked_path", ",", "headers", ",", "spr", "=", "False", ")", ":", "object_list", "=", "list", "(", ")", "l_obj", "=", "None", "container_uri", "=", "uri", ".", "geturl", "(", ")", ...
Return an index of objects from within the container. :param uri: :param base_path: :param marked_path: :param headers: :param spr: "single page return" Limit the returned data to one page :type spr: ``bol`` :return:
[ "Return", "an", "index", "of", "objects", "from", "within", "the", "container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L296-L344
44,957
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions._list_getter
def _list_getter(self, uri, headers, last_obj=None, spr=False): """Get a list of all objects in a container. :param uri: :param headers: :return list: :param spr: "single page return" Limit the returned data to one page :type spr: ``bol`` """ # Quote the...
python
def _list_getter(self, uri, headers, last_obj=None, spr=False): """Get a list of all objects in a container. :param uri: :param headers: :return list: :param spr: "single page return" Limit the returned data to one page :type spr: ``bol`` """ # Quote the...
[ "def", "_list_getter", "(", "self", ",", "uri", ",", "headers", ",", "last_obj", "=", "None", ",", "spr", "=", "False", ")", ":", "# Quote the file path.", "base_path", "=", "marked_path", "=", "(", "'%s?limit=10000&format=json'", "%", "uri", ".", "path", ")...
Get a list of all objects in a container. :param uri: :param headers: :return list: :param spr: "single page return" Limit the returned data to one page :type spr: ``bol``
[ "Get", "a", "list", "of", "all", "objects", "in", "a", "container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L346-L384
44,958
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions._resp_exception
def _resp_exception(self, resp): """If we encounter an exception in our upload. we will look at how we can attempt to resolve the exception. :param resp: """ message = [ 'Url: [ %s ] Reason: [ %s ] Request: [ %s ] Status Code: [ %s ]. ', resp.url, ...
python
def _resp_exception(self, resp): """If we encounter an exception in our upload. we will look at how we can attempt to resolve the exception. :param resp: """ message = [ 'Url: [ %s ] Reason: [ %s ] Request: [ %s ] Status Code: [ %s ]. ', resp.url, ...
[ "def", "_resp_exception", "(", "self", ",", "resp", ")", ":", "message", "=", "[", "'Url: [ %s ] Reason: [ %s ] Request: [ %s ] Status Code: [ %s ]. '", ",", "resp", ".", "url", ",", "resp", ".", "reason", ",", "resp", ".", "request", ",", "resp", ".", "status_c...
If we encounter an exception in our upload. we will look at how we can attempt to resolve the exception. :param resp:
[ "If", "we", "encounter", "an", "exception", "in", "our", "upload", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L386-L449
44,959
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions.list_items
def list_items(self, url, container=None, last_obj=None, spr=False): """Builds a long list of objects found in a container. NOTE: This could be millions of Objects. :param url: :param container: :param last_obj: :param spr: "single page return" Limit the returned data t...
python
def list_items(self, url, container=None, last_obj=None, spr=False): """Builds a long list of objects found in a container. NOTE: This could be millions of Objects. :param url: :param container: :param last_obj: :param spr: "single page return" Limit the returned data t...
[ "def", "list_items", "(", "self", ",", "url", ",", "container", "=", "None", ",", "last_obj", "=", "None", ",", "spr", "=", "False", ")", ":", "headers", ",", "container_uri", "=", "self", ".", "_return_base_data", "(", "url", "=", "url", ",", "contain...
Builds a long list of objects found in a container. NOTE: This could be millions of Objects. :param url: :param container: :param last_obj: :param spr: "single page return" Limit the returned data to one page :type spr: ``bol`` :return None | list:
[ "Builds", "a", "long", "list", "of", "objects", "found", "in", "a", "container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L452-L481
44,960
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions.update_object
def update_object(self, url, container, container_object, object_headers, container_headers): """Update an existing object in a swift container. This method will place new headers on an existing object or container. :param url: :param container: :param con...
python
def update_object(self, url, container, container_object, object_headers, container_headers): """Update an existing object in a swift container. This method will place new headers on an existing object or container. :param url: :param container: :param con...
[ "def", "update_object", "(", "self", ",", "url", ",", "container", ",", "container_object", ",", "object_headers", ",", "container_headers", ")", ":", "headers", ",", "container_uri", "=", "self", ".", "_return_base_data", "(", "url", "=", "url", ",", "contain...
Update an existing object in a swift container. This method will place new headers on an existing object or container. :param url: :param container: :param container_object:
[ "Update", "an", "existing", "object", "in", "a", "swift", "container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L504-L526
44,961
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions.container_cdn_command
def container_cdn_command(self, url, container, container_object, cdn_headers): """Command your CDN enabled Container. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=con...
python
def container_cdn_command(self, url, container, container_object, cdn_headers): """Command your CDN enabled Container. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=con...
[ "def", "container_cdn_command", "(", "self", ",", "url", ",", "container", ",", "container_object", ",", "cdn_headers", ")", ":", "headers", ",", "container_uri", "=", "self", ".", "_return_base_data", "(", "url", "=", "url", ",", "container", "=", "container"...
Command your CDN enabled Container. :param url: :param container:
[ "Command", "your", "CDN", "enabled", "Container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L529-L553
44,962
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions.put_container
def put_container(self, url, container, container_headers=None): """Create a container if it is not Found. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=container, container_headers=cont...
python
def put_container(self, url, container, container_headers=None): """Create a container if it is not Found. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=container, container_headers=cont...
[ "def", "put_container", "(", "self", ",", "url", ",", "container", ",", "container_headers", "=", "None", ")", ":", "headers", ",", "container_uri", "=", "self", ".", "_return_base_data", "(", "url", "=", "url", ",", "container", "=", "container", ",", "co...
Create a container if it is not Found. :param url: :param container:
[ "Create", "a", "container", "if", "it", "is", "not", "Found", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L556-L576
44,963
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions.put_object
def put_object(self, url, container, container_object, local_object, object_headers, meta=None): """This is the Sync method which uploads files to the swift repository if they are not already found. If a file "name" is found locally and in the swift repository an MD5 comparis...
python
def put_object(self, url, container, container_object, local_object, object_headers, meta=None): """This is the Sync method which uploads files to the swift repository if they are not already found. If a file "name" is found locally and in the swift repository an MD5 comparis...
[ "def", "put_object", "(", "self", ",", "url", ",", "container", ",", "container_object", ",", "local_object", ",", "object_headers", ",", "meta", "=", "None", ")", ":", "headers", ",", "container_uri", "=", "self", ".", "_return_base_data", "(", "url", "=", ...
This is the Sync method which uploads files to the swift repository if they are not already found. If a file "name" is found locally and in the swift repository an MD5 comparison is done between the two files. If the MD5 is miss-matched the local file is uploaded to the repository. If c...
[ "This", "is", "the", "Sync", "method", "which", "uploads", "files", "to", "the", "swift", "repository" ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L579-L606
44,964
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions.get_items
def get_items(self, url, container, container_object, local_object): """Get an objects from a container. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=container, container_object=contain...
python
def get_items(self, url, container, container_object, local_object): """Get an objects from a container. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=container, container_object=contain...
[ "def", "get_items", "(", "self", ",", "url", ",", "container", ",", "container_object", ",", "local_object", ")", ":", "headers", ",", "container_uri", "=", "self", ".", "_return_base_data", "(", "url", "=", "url", ",", "container", "=", "container", ",", ...
Get an objects from a container. :param url: :param container:
[ "Get", "an", "objects", "from", "a", "container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L609-L626
44,965
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions.delete_items
def delete_items(self, url, container, container_object=None): """Deletes an objects in a container. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=container, container_object=container_o...
python
def delete_items(self, url, container, container_object=None): """Deletes an objects in a container. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=container, container_object=container_o...
[ "def", "delete_items", "(", "self", ",", "url", ",", "container", ",", "container_object", "=", "None", ")", ":", "headers", ",", "container_uri", "=", "self", ".", "_return_base_data", "(", "url", "=", "url", ",", "container", "=", "container", ",", "cont...
Deletes an objects in a container. :param url: :param container:
[ "Deletes", "an", "objects", "in", "a", "container", "." ]
da33034e88959226529ce762e2895e6f6356c448
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L642-L655
44,966
stephantul/somber
somber/ng.py
Ng._get_bmu
def _get_bmu(self, activations): """Get indices of bmus, sorted by their distance from input.""" # If the neural gas is a recursive neural gas, we need reverse argsort. if self.argfunc == 'argmax': activations = -activations sort = np.argsort(activations, 1) return so...
python
def _get_bmu(self, activations): """Get indices of bmus, sorted by their distance from input.""" # If the neural gas is a recursive neural gas, we need reverse argsort. if self.argfunc == 'argmax': activations = -activations sort = np.argsort(activations, 1) return so...
[ "def", "_get_bmu", "(", "self", ",", "activations", ")", ":", "# If the neural gas is a recursive neural gas, we need reverse argsort.", "if", "self", ".", "argfunc", "==", "'argmax'", ":", "activations", "=", "-", "activations", "sort", "=", "np", ".", "argsort", "...
Get indices of bmus, sorted by their distance from input.
[ "Get", "indices", "of", "bmus", "sorted", "by", "their", "distance", "from", "input", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/ng.py#L64-L70
44,967
stephantul/somber
somber/ng.py
Ng._calculate_influence
def _calculate_influence(self, influence_lambda): """Calculate the ranking influence.""" return np.exp(-np.arange(self.num_neurons) / influence_lambda)[:, None]
python
def _calculate_influence(self, influence_lambda): """Calculate the ranking influence.""" return np.exp(-np.arange(self.num_neurons) / influence_lambda)[:, None]
[ "def", "_calculate_influence", "(", "self", ",", "influence_lambda", ")", ":", "return", "np", ".", "exp", "(", "-", "np", ".", "arange", "(", "self", ".", "num_neurons", ")", "/", "influence_lambda", ")", "[", ":", ",", "None", "]" ]
Calculate the ranking influence.
[ "Calculate", "the", "ranking", "influence", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/ng.py#L72-L74
44,968
stephantul/somber
somber/plsom.py
PLSom._update_params
def _update_params(self, constants): """Update the params.""" constants = np.max(np.min(constants, 1)) self.params['r']['value'] = max([self.params['r']['value'], constants]) epsilon = constants / self.params['r']['value'] influence = self...
python
def _update_params(self, constants): """Update the params.""" constants = np.max(np.min(constants, 1)) self.params['r']['value'] = max([self.params['r']['value'], constants]) epsilon = constants / self.params['r']['value'] influence = self...
[ "def", "_update_params", "(", "self", ",", "constants", ")", ":", "constants", "=", "np", ".", "max", "(", "np", ".", "min", "(", "constants", ",", "1", ")", ")", "self", ".", "params", "[", "'r'", "]", "[", "'value'", "]", "=", "max", "(", "[", ...
Update the params.
[ "Update", "the", "params", "." ]
b7a13e646239500cc393668c01a7169c3e50b7b5
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/plsom.py#L139-L147
44,969
jbasko/pytest-random-order
random_order/shuffler.py
_shuffle_items
def _shuffle_items(items, bucket_key=None, disable=None, seed=None, session=None): """ Shuffles a list of `items` in place. If `bucket_key` is None, items are shuffled across the entire list. `bucket_key` is an optional function called for each item in `items` to calculate the key of bucket in whi...
python
def _shuffle_items(items, bucket_key=None, disable=None, seed=None, session=None): """ Shuffles a list of `items` in place. If `bucket_key` is None, items are shuffled across the entire list. `bucket_key` is an optional function called for each item in `items` to calculate the key of bucket in whi...
[ "def", "_shuffle_items", "(", "items", ",", "bucket_key", "=", "None", ",", "disable", "=", "None", ",", "seed", "=", "None", ",", "session", "=", "None", ")", ":", "if", "seed", "is", "not", "None", ":", "random", ".", "seed", "(", "seed", ")", "#...
Shuffles a list of `items` in place. If `bucket_key` is None, items are shuffled across the entire list. `bucket_key` is an optional function called for each item in `items` to calculate the key of bucket in which the item falls. Bucket defines the boundaries across which items will not be shuffl...
[ "Shuffles", "a", "list", "of", "items", "in", "place", "." ]
e8ff95fcd097f9f330638cf58cc1b24983fdde15
https://github.com/jbasko/pytest-random-order/blob/e8ff95fcd097f9f330638cf58cc1b24983fdde15/random_order/shuffler.py#L23-L92
44,970
jbasko/pytest-random-order
random_order/bucket_types.py
bucket_type_key
def bucket_type_key(bucket_type): """ Registers a function that calculates test item key for the specified bucket type. """ def decorator(f): @functools.wraps(f) def wrapped(item, session): key = f(item) if session is not None: for handler in se...
python
def bucket_type_key(bucket_type): """ Registers a function that calculates test item key for the specified bucket type. """ def decorator(f): @functools.wraps(f) def wrapped(item, session): key = f(item) if session is not None: for handler in se...
[ "def", "bucket_type_key", "(", "bucket_type", ")", ":", "def", "decorator", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapped", "(", "item", ",", "session", ")", ":", "key", "=", "f", "(", "item", ")", "if", "sessio...
Registers a function that calculates test item key for the specified bucket type.
[ "Registers", "a", "function", "that", "calculates", "test", "item", "key", "for", "the", "specified", "bucket", "type", "." ]
e8ff95fcd097f9f330638cf58cc1b24983fdde15
https://github.com/jbasko/pytest-random-order/blob/e8ff95fcd097f9f330638cf58cc1b24983fdde15/random_order/bucket_types.py#L8-L28
44,971
bitpay/bitpay-python
bitpay/client.py
Client.unsigned_request
def unsigned_request(self, path, payload=None): """ generic bitpay usigned wrapper passing a payload will do a POST, otherwise a GET """ headers = {"content-type": "application/json", "accept": "application/json", "X-accept-version": "2.0.0"} try: if payload: response = requests.po...
python
def unsigned_request(self, path, payload=None): """ generic bitpay usigned wrapper passing a payload will do a POST, otherwise a GET """ headers = {"content-type": "application/json", "accept": "application/json", "X-accept-version": "2.0.0"} try: if payload: response = requests.po...
[ "def", "unsigned_request", "(", "self", ",", "path", ",", "payload", "=", "None", ")", ":", "headers", "=", "{", "\"content-type\"", ":", "\"application/json\"", ",", "\"accept\"", ":", "\"application/json\"", ",", "\"X-accept-version\"", ":", "\"2.0.0\"", "}", ...
generic bitpay usigned wrapper passing a payload will do a POST, otherwise a GET
[ "generic", "bitpay", "usigned", "wrapper", "passing", "a", "payload", "will", "do", "a", "POST", "otherwise", "a", "GET" ]
3f456118bef1c460adf5d4d5546f38dac1e2a5cc
https://github.com/bitpay/bitpay-python/blob/3f456118bef1c460adf5d4d5546f38dac1e2a5cc/bitpay/client.py#L98-L111
44,972
nutechsoftware/alarmdecoder
examples/rf_device.py
main
def main(): """ Example application that watches for an event from a specific RF device. This feature allows you to watch for events from RF devices if you have an RF receiver. This is useful in the case of internal sensors, which don't emit a FAULT if the sensor is tripped and the panel is armed ...
python
def main(): """ Example application that watches for an event from a specific RF device. This feature allows you to watch for events from RF devices if you have an RF receiver. This is useful in the case of internal sensors, which don't emit a FAULT if the sensor is tripped and the panel is armed ...
[ "def", "main", "(", ")", ":", "try", ":", "# Retrieve the first USB device", "device", "=", "AlarmDecoder", "(", "SerialDevice", "(", "interface", "=", "SERIAL_DEVICE", ")", ")", "# Set up an event handler and open the device", "device", ".", "on_rfx_message", "+=", "...
Example application that watches for an event from a specific RF device. This feature allows you to watch for events from RF devices if you have an RF receiver. This is useful in the case of internal sensors, which don't emit a FAULT if the sensor is tripped and the panel is armed STAY. It also will m...
[ "Example", "application", "that", "watches", "for", "an", "event", "from", "a", "specific", "RF", "device", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/examples/rf_device.py#L10-L33
44,973
nutechsoftware/alarmdecoder
examples/rf_device.py
handle_rfx
def handle_rfx(sender, message): """ Handles RF message events from the AlarmDecoder. """ # Check for our target serial number and loop if message.serial_number == RF_DEVICE_SERIAL_NUMBER and message.loop[0] == True: print(message.serial_number, 'triggered loop #1')
python
def handle_rfx(sender, message): """ Handles RF message events from the AlarmDecoder. """ # Check for our target serial number and loop if message.serial_number == RF_DEVICE_SERIAL_NUMBER and message.loop[0] == True: print(message.serial_number, 'triggered loop #1')
[ "def", "handle_rfx", "(", "sender", ",", "message", ")", ":", "# Check for our target serial number and loop", "if", "message", ".", "serial_number", "==", "RF_DEVICE_SERIAL_NUMBER", "and", "message", ".", "loop", "[", "0", "]", "==", "True", ":", "print", "(", ...
Handles RF message events from the AlarmDecoder.
[ "Handles", "RF", "message", "events", "from", "the", "AlarmDecoder", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/examples/rf_device.py#L35-L41
44,974
nutechsoftware/alarmdecoder
alarmdecoder/event/event.py
EventHandler.fire
def fire(self, *args, **kwargs): """Fire event and call all handler functions You can call EventHandler object itself like e(*args, **kwargs) instead of e.fire(*args, **kwargs). """ for func in self._getfunctionlist(): if type(func) == EventHandler: ...
python
def fire(self, *args, **kwargs): """Fire event and call all handler functions You can call EventHandler object itself like e(*args, **kwargs) instead of e.fire(*args, **kwargs). """ for func in self._getfunctionlist(): if type(func) == EventHandler: ...
[ "def", "fire", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "func", "in", "self", ".", "_getfunctionlist", "(", ")", ":", "if", "type", "(", "func", ")", "==", "EventHandler", ":", "func", ".", "fire", "(", "*", "args"...
Fire event and call all handler functions You can call EventHandler object itself like e(*args, **kwargs) instead of e.fire(*args, **kwargs).
[ "Fire", "event", "and", "call", "all", "handler", "functions" ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/event/event.py#L72-L84
44,975
nutechsoftware/alarmdecoder
examples/serialport.py
main
def main(): """ Example application that opens a serial device and prints messages to the terminal. """ try: # Retrieve the specified serial device. device = AlarmDecoder(SerialDevice(interface=SERIAL_DEVICE)) # Set up an event handler and open the device device.on_messa...
python
def main(): """ Example application that opens a serial device and prints messages to the terminal. """ try: # Retrieve the specified serial device. device = AlarmDecoder(SerialDevice(interface=SERIAL_DEVICE)) # Set up an event handler and open the device device.on_messa...
[ "def", "main", "(", ")", ":", "try", ":", "# Retrieve the specified serial device.", "device", "=", "AlarmDecoder", "(", "SerialDevice", "(", "interface", "=", "SERIAL_DEVICE", ")", ")", "# Set up an event handler and open the device", "device", ".", "on_message", "+=",...
Example application that opens a serial device and prints messages to the terminal.
[ "Example", "application", "that", "opens", "a", "serial", "device", "and", "prints", "messages", "to", "the", "terminal", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/examples/serialport.py#L9-L27
44,976
nutechsoftware/alarmdecoder
alarmdecoder/devices/socket_device.py
SocketDevice._init_ssl
def _init_ssl(self): """ Initializes our device as an SSL connection. :raises: :py:class:`~alarmdecoder.util.CommError` """ if not have_openssl: raise ImportError('SSL sockets have been disabled due to missing requirement: pyopenssl.') try: ctx ...
python
def _init_ssl(self): """ Initializes our device as an SSL connection. :raises: :py:class:`~alarmdecoder.util.CommError` """ if not have_openssl: raise ImportError('SSL sockets have been disabled due to missing requirement: pyopenssl.') try: ctx ...
[ "def", "_init_ssl", "(", "self", ")", ":", "if", "not", "have_openssl", ":", "raise", "ImportError", "(", "'SSL sockets have been disabled due to missing requirement: pyopenssl.'", ")", "try", ":", "ctx", "=", "SSL", ".", "Context", "(", "SSL", ".", "TLSv1_METHOD", ...
Initializes our device as an SSL connection. :raises: :py:class:`~alarmdecoder.util.CommError`
[ "Initializes", "our", "device", "as", "an", "SSL", "connection", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/devices/socket_device.py#L379-L417
44,977
phuijse/P4J
P4J/periodogram.py
periodogram.get_best_frequencies
def get_best_frequencies(self): """ Returns the best n_local_max frequencies """ return self.freq[self.best_local_optima], self.per[self.best_local_optima]
python
def get_best_frequencies(self): """ Returns the best n_local_max frequencies """ return self.freq[self.best_local_optima], self.per[self.best_local_optima]
[ "def", "get_best_frequencies", "(", "self", ")", ":", "return", "self", ".", "freq", "[", "self", ".", "best_local_optima", "]", ",", "self", ".", "per", "[", "self", ".", "best_local_optima", "]" ]
Returns the best n_local_max frequencies
[ "Returns", "the", "best", "n_local_max", "frequencies" ]
1ec6b2ac63674ca55aeb2966b9cf40c273d7c203
https://github.com/phuijse/P4J/blob/1ec6b2ac63674ca55aeb2966b9cf40c273d7c203/P4J/periodogram.py#L127-L131
44,978
phuijse/P4J
P4J/periodogram.py
periodogram.finetune_best_frequencies
def finetune_best_frequencies(self, fresolution=1e-5, n_local_optima=10): """ Computes the selected criterion over a grid of frequencies around a specified amount of local optima of the periodograms. This function is intended for additional fine tuning of the results obtained w...
python
def finetune_best_frequencies(self, fresolution=1e-5, n_local_optima=10): """ Computes the selected criterion over a grid of frequencies around a specified amount of local optima of the periodograms. This function is intended for additional fine tuning of the results obtained w...
[ "def", "finetune_best_frequencies", "(", "self", ",", "fresolution", "=", "1e-5", ",", "n_local_optima", "=", "10", ")", ":", "# Find the local optima", "local_optima_index", "=", "[", "]", "for", "k", "in", "range", "(", "1", ",", "len", "(", "self", ".", ...
Computes the selected criterion over a grid of frequencies around a specified amount of local optima of the periodograms. This function is intended for additional fine tuning of the results obtained with grid_search
[ "Computes", "the", "selected", "criterion", "over", "a", "grid", "of", "frequencies", "around", "a", "specified", "amount", "of", "local", "optima", "of", "the", "periodograms", ".", "This", "function", "is", "intended", "for", "additional", "fine", "tuning", ...
1ec6b2ac63674ca55aeb2966b9cf40c273d7c203
https://github.com/phuijse/P4J/blob/1ec6b2ac63674ca55aeb2966b9cf40c273d7c203/P4J/periodogram.py#L137-L173
44,979
nutechsoftware/alarmdecoder
alarmdecoder/messages/lrr/system.py
LRRSystem.update
def update(self, message): """ Updates the states in the primary AlarmDecoder object based on the LRR message provided. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage` """ # Firmware version < 2.2a.8.6 if me...
python
def update(self, message): """ Updates the states in the primary AlarmDecoder object based on the LRR message provided. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage` """ # Firmware version < 2.2a.8.6 if me...
[ "def", "update", "(", "self", ",", "message", ")", ":", "# Firmware version < 2.2a.8.6", "if", "message", ".", "version", "==", "1", ":", "if", "message", ".", "event_type", "==", "'ALARM_PANIC'", ":", "self", ".", "_alarmdecoder", ".", "_update_panic_status", ...
Updates the states in the primary AlarmDecoder object based on the LRR message provided. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage`
[ "Updates", "the", "states", "in", "the", "primary", "AlarmDecoder", "object", "based", "on", "the", "LRR", "message", "provided", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/messages/lrr/system.py#L26-L56
44,980
nutechsoftware/alarmdecoder
alarmdecoder/messages/lrr/system.py
LRRSystem._handle_cid_message
def _handle_cid_message(self, message): """ Handles ContactID LRR events. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage` """ status = self._get_event_status(message) if status is None: return i...
python
def _handle_cid_message(self, message): """ Handles ContactID LRR events. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage` """ status = self._get_event_status(message) if status is None: return i...
[ "def", "_handle_cid_message", "(", "self", ",", "message", ")", ":", "status", "=", "self", ".", "_get_event_status", "(", "message", ")", "if", "status", "is", "None", ":", "return", "if", "message", ".", "event_code", "in", "LRR_FIRE_EVENTS", ":", "if", ...
Handles ContactID LRR events. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage`
[ "Handles", "ContactID", "LRR", "events", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/messages/lrr/system.py#L58-L109
44,981
nutechsoftware/alarmdecoder
alarmdecoder/messages/lrr/system.py
LRRSystem._get_event_status
def _get_event_status(self, message): """ Retrieves the boolean status of an LRR message. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage` :returns: Boolean indicating whether the event was triggered or restored. """ ...
python
def _get_event_status(self, message): """ Retrieves the boolean status of an LRR message. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage` :returns: Boolean indicating whether the event was triggered or restored. """ ...
[ "def", "_get_event_status", "(", "self", ",", "message", ")", ":", "status", "=", "None", "if", "message", ".", "event_status", "==", "LRR_EVENT_STATUS", ".", "TRIGGER", ":", "status", "=", "True", "elif", "message", ".", "event_status", "==", "LRR_EVENT_STATU...
Retrieves the boolean status of an LRR message. :param message: LRR message object :type message: :py:class:`~alarmdecoder.messages.LRRMessage` :returns: Boolean indicating whether the event was triggered or restored.
[ "Retrieves", "the", "boolean", "status", "of", "an", "LRR", "message", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/messages/lrr/system.py#L148-L164
44,982
nutechsoftware/alarmdecoder
alarmdecoder/devices/serial_device.py
SerialDevice.find_all
def find_all(pattern=None): """ Returns all serial ports present. :param pattern: pattern to search for when retrieving serial ports :type pattern: string :returns: list of devices :raises: :py:class:`~alarmdecoder.util.CommError` """ devices = [] ...
python
def find_all(pattern=None): """ Returns all serial ports present. :param pattern: pattern to search for when retrieving serial ports :type pattern: string :returns: list of devices :raises: :py:class:`~alarmdecoder.util.CommError` """ devices = [] ...
[ "def", "find_all", "(", "pattern", "=", "None", ")", ":", "devices", "=", "[", "]", "try", ":", "if", "pattern", ":", "devices", "=", "serial", ".", "tools", ".", "list_ports", ".", "grep", "(", "pattern", ")", "else", ":", "devices", "=", "serial", ...
Returns all serial ports present. :param pattern: pattern to search for when retrieving serial ports :type pattern: string :returns: list of devices :raises: :py:class:`~alarmdecoder.util.CommError`
[ "Returns", "all", "serial", "ports", "present", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/devices/serial_device.py#L30-L51
44,983
nutechsoftware/alarmdecoder
alarmdecoder/messages/panel_message.py
Message._parse_message
def _parse_message(self, data): """ Parse the message from the device. :param data: message data :type data: string :raises: :py:class:`~alarmdecoder.util.InvalidMessageError` """ match = self._regex.match(str(data)) if match is None: raise ...
python
def _parse_message(self, data): """ Parse the message from the device. :param data: message data :type data: string :raises: :py:class:`~alarmdecoder.util.InvalidMessageError` """ match = self._regex.match(str(data)) if match is None: raise ...
[ "def", "_parse_message", "(", "self", ",", "data", ")", ":", "match", "=", "self", ".", "_regex", ".", "match", "(", "str", "(", "data", ")", ")", "if", "match", "is", "None", ":", "raise", "InvalidMessageError", "(", "'Received invalid message: {0}'", "."...
Parse the message from the device. :param data: message data :type data: string :raises: :py:class:`~alarmdecoder.util.InvalidMessageError`
[ "Parse", "the", "message", "from", "the", "device", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/messages/panel_message.py#L87-L131
44,984
nutechsoftware/alarmdecoder
alarmdecoder/messages/panel_message.py
Message.parse_numeric_code
def parse_numeric_code(self, force_hex=False): """ Parses and returns the numeric code as an integer. The numeric code can be either base 10 or base 16, depending on where the message came from. :param force_hex: force the numeric code to be processed as base 16. :type ...
python
def parse_numeric_code(self, force_hex=False): """ Parses and returns the numeric code as an integer. The numeric code can be either base 10 or base 16, depending on where the message came from. :param force_hex: force the numeric code to be processed as base 16. :type ...
[ "def", "parse_numeric_code", "(", "self", ",", "force_hex", "=", "False", ")", ":", "code", "=", "None", "got_error", "=", "False", "if", "not", "force_hex", ":", "try", ":", "code", "=", "int", "(", "self", ".", "numeric_code", ")", "except", "ValueErro...
Parses and returns the numeric code as an integer. The numeric code can be either base 10 or base 16, depending on where the message came from. :param force_hex: force the numeric code to be processed as base 16. :type force_hex: boolean :raises: ValueError
[ "Parses", "and", "returns", "the", "numeric", "code", "as", "an", "integer", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/messages/panel_message.py#L133-L160
44,985
dottedmag/pychm
chm/chm.py
CHMFile.LoadCHM
def LoadCHM(self, archiveName): '''Loads a CHM archive. This function will also call GetArchiveInfo to obtain information such as the index file name and the topics file. It returns 1 on success, and 0 if it fails. ''' if self.filename is not None: self.CloseC...
python
def LoadCHM(self, archiveName): '''Loads a CHM archive. This function will also call GetArchiveInfo to obtain information such as the index file name and the topics file. It returns 1 on success, and 0 if it fails. ''' if self.filename is not None: self.CloseC...
[ "def", "LoadCHM", "(", "self", ",", "archiveName", ")", ":", "if", "self", ".", "filename", "is", "not", "None", ":", "self", ".", "CloseCHM", "(", ")", "self", ".", "file", "=", "chmlib", ".", "chm_open", "(", "archiveName", ")", "if", "self", ".", ...
Loads a CHM archive. This function will also call GetArchiveInfo to obtain information such as the index file name and the topics file. It returns 1 on success, and 0 if it fails.
[ "Loads", "a", "CHM", "archive", ".", "This", "function", "will", "also", "call", "GetArchiveInfo", "to", "obtain", "information", "such", "as", "the", "index", "file", "name", "and", "the", "topics", "file", ".", "It", "returns", "1", "on", "success", "and...
fd87831a8c23498e65304fce341718bd2968211b
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L205-L221
44,986
dottedmag/pychm
chm/chm.py
CHMFile.CloseCHM
def CloseCHM(self): '''Closes the CHM archive. This function will close the CHM file, if it is open. All variables are also reset. ''' if self.filename is not None: chmlib.chm_close(self.file) self.file = None self.filename = '' sel...
python
def CloseCHM(self): '''Closes the CHM archive. This function will close the CHM file, if it is open. All variables are also reset. ''' if self.filename is not None: chmlib.chm_close(self.file) self.file = None self.filename = '' sel...
[ "def", "CloseCHM", "(", "self", ")", ":", "if", "self", ".", "filename", "is", "not", "None", ":", "chmlib", ".", "chm_close", "(", "self", ".", "file", ")", "self", ".", "file", "=", "None", "self", ".", "filename", "=", "''", "self", ".", "title"...
Closes the CHM archive. This function will close the CHM file, if it is open. All variables are also reset.
[ "Closes", "the", "CHM", "archive", ".", "This", "function", "will", "close", "the", "CHM", "file", "if", "it", "is", "open", ".", "All", "variables", "are", "also", "reset", "." ]
fd87831a8c23498e65304fce341718bd2968211b
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L223-L236
44,987
dottedmag/pychm
chm/chm.py
CHMFile.GetTopicsTree
def GetTopicsTree(self): '''Reads and returns the topics tree. This auxiliary function reads and returns the topics tree file contents for the CHM archive. ''' if self.topics is None: return None if self.topics: res, ui = chmlib.chm_resolve_object...
python
def GetTopicsTree(self): '''Reads and returns the topics tree. This auxiliary function reads and returns the topics tree file contents for the CHM archive. ''' if self.topics is None: return None if self.topics: res, ui = chmlib.chm_resolve_object...
[ "def", "GetTopicsTree", "(", "self", ")", ":", "if", "self", ".", "topics", "is", "None", ":", "return", "None", "if", "self", ".", "topics", ":", "res", ",", "ui", "=", "chmlib", ".", "chm_resolve_object", "(", "self", ".", "file", ",", "self", ".",...
Reads and returns the topics tree. This auxiliary function reads and returns the topics tree file contents for the CHM archive.
[ "Reads", "and", "returns", "the", "topics", "tree", ".", "This", "auxiliary", "function", "reads", "and", "returns", "the", "topics", "tree", "file", "contents", "for", "the", "CHM", "archive", "." ]
fd87831a8c23498e65304fce341718bd2968211b
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L321-L338
44,988
dottedmag/pychm
chm/chm.py
CHMFile.GetIndex
def GetIndex(self): '''Reads and returns the index tree. This auxiliary function reads and returns the index tree file contents for the CHM archive. ''' if self.index is None: return None if self.index: res, ui = chmlib.chm_resolve_object(self.fil...
python
def GetIndex(self): '''Reads and returns the index tree. This auxiliary function reads and returns the index tree file contents for the CHM archive. ''' if self.index is None: return None if self.index: res, ui = chmlib.chm_resolve_object(self.fil...
[ "def", "GetIndex", "(", "self", ")", ":", "if", "self", ".", "index", "is", "None", ":", "return", "None", "if", "self", ".", "index", ":", "res", ",", "ui", "=", "chmlib", ".", "chm_resolve_object", "(", "self", ".", "file", ",", "self", ".", "ind...
Reads and returns the index tree. This auxiliary function reads and returns the index tree file contents for the CHM archive.
[ "Reads", "and", "returns", "the", "index", "tree", ".", "This", "auxiliary", "function", "reads", "and", "returns", "the", "index", "tree", "file", "contents", "for", "the", "CHM", "archive", "." ]
fd87831a8c23498e65304fce341718bd2968211b
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L340-L357
44,989
dottedmag/pychm
chm/chm.py
CHMFile.ResolveObject
def ResolveObject(self, document): '''Tries to locate a document in the archive. This function tries to locate the document inside the archive. It returns a tuple where the first element is zero if the function was successful, and the second is the UnitInfo for that document. The...
python
def ResolveObject(self, document): '''Tries to locate a document in the archive. This function tries to locate the document inside the archive. It returns a tuple where the first element is zero if the function was successful, and the second is the UnitInfo for that document. The...
[ "def", "ResolveObject", "(", "self", ",", "document", ")", ":", "if", "self", ".", "file", ":", "path", "=", "os", ".", "path", ".", "abspath", "(", "document", ")", "return", "chmlib", ".", "chm_resolve_object", "(", "self", ".", "file", ",", "path", ...
Tries to locate a document in the archive. This function tries to locate the document inside the archive. It returns a tuple where the first element is zero if the function was successful, and the second is the UnitInfo for that document. The UnitInfo is used to retrieve the document con...
[ "Tries", "to", "locate", "a", "document", "in", "the", "archive", ".", "This", "function", "tries", "to", "locate", "the", "document", "inside", "the", "archive", ".", "It", "returns", "a", "tuple", "where", "the", "first", "element", "is", "zero", "if", ...
fd87831a8c23498e65304fce341718bd2968211b
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L359-L370
44,990
dottedmag/pychm
chm/chm.py
CHMFile.RetrieveObject
def RetrieveObject(self, ui, start=-1, length=-1): '''Retrieves the contents of a document. This function takes a UnitInfo and two optional arguments, the first being the start address and the second is the length. These define the amount of data to be read from the archive. ''' ...
python
def RetrieveObject(self, ui, start=-1, length=-1): '''Retrieves the contents of a document. This function takes a UnitInfo and two optional arguments, the first being the start address and the second is the length. These define the amount of data to be read from the archive. ''' ...
[ "def", "RetrieveObject", "(", "self", ",", "ui", ",", "start", "=", "-", "1", ",", "length", "=", "-", "1", ")", ":", "if", "self", ".", "file", "and", "ui", ":", "if", "length", "==", "-", "1", ":", "len", "=", "ui", ".", "length", "else", "...
Retrieves the contents of a document. This function takes a UnitInfo and two optional arguments, the first being the start address and the second is the length. These define the amount of data to be read from the archive.
[ "Retrieves", "the", "contents", "of", "a", "document", ".", "This", "function", "takes", "a", "UnitInfo", "and", "two", "optional", "arguments", "the", "first", "being", "the", "start", "address", "and", "the", "second", "is", "the", "length", ".", "These", ...
fd87831a8c23498e65304fce341718bd2968211b
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L372-L389
44,991
dottedmag/pychm
chm/chm.py
CHMFile.Search
def Search(self, text, wholewords=0, titleonly=0): '''Performs full-text search on the archive. The first parameter is the word to look for, the second indicates if the search should be for whole words only, and the third parameter indicates if the search should be restricted to ...
python
def Search(self, text, wholewords=0, titleonly=0): '''Performs full-text search on the archive. The first parameter is the word to look for, the second indicates if the search should be for whole words only, and the third parameter indicates if the search should be restricted to ...
[ "def", "Search", "(", "self", ",", "text", ",", "wholewords", "=", "0", ",", "titleonly", "=", "0", ")", ":", "if", "text", "and", "text", "!=", "''", "and", "self", ".", "file", ":", "return", "extra", ".", "search", "(", "self", ".", "file", ",...
Performs full-text search on the archive. The first parameter is the word to look for, the second indicates if the search should be for whole words only, and the third parameter indicates if the search should be restricted to page titles. This method will return a tuple, the firs...
[ "Performs", "full", "-", "text", "search", "on", "the", "archive", ".", "The", "first", "parameter", "is", "the", "word", "to", "look", "for", "the", "second", "indicates", "if", "the", "search", "should", "be", "for", "whole", "words", "only", "and", "t...
fd87831a8c23498e65304fce341718bd2968211b
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L391-L404
44,992
dottedmag/pychm
chm/chm.py
CHMFile.GetEncoding
def GetEncoding(self): '''Returns a string that can be used with the codecs python package to encode or decode the files in the chm archive. If an error is found, or if it is not possible to find the encoding, None is returned.''' if self.encoding: vals = string.split...
python
def GetEncoding(self): '''Returns a string that can be used with the codecs python package to encode or decode the files in the chm archive. If an error is found, or if it is not possible to find the encoding, None is returned.''' if self.encoding: vals = string.split...
[ "def", "GetEncoding", "(", "self", ")", ":", "if", "self", ".", "encoding", ":", "vals", "=", "string", ".", "split", "(", "self", ".", "encoding", ",", "','", ")", "if", "len", "(", "vals", ")", ">", "2", ":", "try", ":", "return", "charset_table"...
Returns a string that can be used with the codecs python package to encode or decode the files in the chm archive. If an error is found, or if it is not possible to find the encoding, None is returned.
[ "Returns", "a", "string", "that", "can", "be", "used", "with", "the", "codecs", "python", "package", "to", "encode", "or", "decode", "the", "files", "in", "the", "chm", "archive", ".", "If", "an", "error", "is", "found", "or", "if", "it", "is", "not", ...
fd87831a8c23498e65304fce341718bd2968211b
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L411-L423
44,993
nutechsoftware/alarmdecoder
examples/socket_example.py
main
def main(): """ Example application that opens a device that has been exposed to the network with ser2sock or similar serial-to-IP software. """ try: # Retrieve an AD2 device that has been exposed with ser2sock on localhost:10000. device = AlarmDecoder(SocketDevice(interface=(HOSTNAM...
python
def main(): """ Example application that opens a device that has been exposed to the network with ser2sock or similar serial-to-IP software. """ try: # Retrieve an AD2 device that has been exposed with ser2sock on localhost:10000. device = AlarmDecoder(SocketDevice(interface=(HOSTNAM...
[ "def", "main", "(", ")", ":", "try", ":", "# Retrieve an AD2 device that has been exposed with ser2sock on localhost:10000.", "device", "=", "AlarmDecoder", "(", "SocketDevice", "(", "interface", "=", "(", "HOSTNAME", ",", "PORT", ")", ")", ")", "# Set up an event handl...
Example application that opens a device that has been exposed to the network with ser2sock or similar serial-to-IP software.
[ "Example", "application", "that", "opens", "a", "device", "that", "has", "been", "exposed", "to", "the", "network", "with", "ser2sock", "or", "similar", "serial", "-", "to", "-", "IP", "software", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/examples/socket_example.py#L9-L25
44,994
nutechsoftware/alarmdecoder
alarmdecoder/messages/expander_message.py
ExpanderMessage._parse_message
def _parse_message(self, data): """ Parse the raw message from the device. :param data: message data :type data: string :raises: :py:class:`~alarmdecoder.util.InvalidMessageError` """ try: header, values = data.split(':') address, channel...
python
def _parse_message(self, data): """ Parse the raw message from the device. :param data: message data :type data: string :raises: :py:class:`~alarmdecoder.util.InvalidMessageError` """ try: header, values = data.split(':') address, channel...
[ "def", "_parse_message", "(", "self", ",", "data", ")", ":", "try", ":", "header", ",", "values", "=", "data", ".", "split", "(", "':'", ")", "address", ",", "channel", ",", "value", "=", "values", ".", "split", "(", "','", ")", "self", ".", "addre...
Parse the raw message from the device. :param data: message data :type data: string :raises: :py:class:`~alarmdecoder.util.InvalidMessageError`
[ "Parse", "the", "raw", "message", "from", "the", "device", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/messages/expander_message.py#L46-L71
44,995
nutechsoftware/alarmdecoder
alarmdecoder/messages/lrr/events.py
get_event_description
def get_event_description(event_type, event_code): """ Retrieves the human-readable description of an LRR event. :param event_type: Base LRR event type. Use LRR_EVENT_TYPE.* :type event_type: int :param event_code: LRR event code :type event_code: int :returns: string """ descript...
python
def get_event_description(event_type, event_code): """ Retrieves the human-readable description of an LRR event. :param event_type: Base LRR event type. Use LRR_EVENT_TYPE.* :type event_type: int :param event_code: LRR event code :type event_code: int :returns: string """ descript...
[ "def", "get_event_description", "(", "event_type", ",", "event_code", ")", ":", "description", "=", "'Unknown'", "lookup_map", "=", "LRR_TYPE_MAP", ".", "get", "(", "event_type", ",", "None", ")", "if", "lookup_map", "is", "not", "None", ":", "description", "=...
Retrieves the human-readable description of an LRR event. :param event_type: Base LRR event type. Use LRR_EVENT_TYPE.* :type event_type: int :param event_code: LRR event code :type event_code: int :returns: string
[ "Retrieves", "the", "human", "-", "readable", "description", "of", "an", "LRR", "event", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/messages/lrr/events.py#L7-L24
44,996
nutechsoftware/alarmdecoder
alarmdecoder/messages/lrr/events.py
get_event_source
def get_event_source(prefix): """ Retrieves the LRR_EVENT_TYPE corresponding to the prefix provided.abs :param prefix: Prefix to convert to event type :type prefix: string :returns: int """ source = LRR_EVENT_TYPE.UNKNOWN if prefix == 'CID': source = LRR_EVENT_TYPE.CID eli...
python
def get_event_source(prefix): """ Retrieves the LRR_EVENT_TYPE corresponding to the prefix provided.abs :param prefix: Prefix to convert to event type :type prefix: string :returns: int """ source = LRR_EVENT_TYPE.UNKNOWN if prefix == 'CID': source = LRR_EVENT_TYPE.CID eli...
[ "def", "get_event_source", "(", "prefix", ")", ":", "source", "=", "LRR_EVENT_TYPE", ".", "UNKNOWN", "if", "prefix", "==", "'CID'", ":", "source", "=", "LRR_EVENT_TYPE", ".", "CID", "elif", "prefix", "==", "'DSC'", ":", "source", "=", "LRR_EVENT_TYPE", ".", ...
Retrieves the LRR_EVENT_TYPE corresponding to the prefix provided.abs :param prefix: Prefix to convert to event type :type prefix: string :returns: int
[ "Retrieves", "the", "LRR_EVENT_TYPE", "corresponding", "to", "the", "prefix", "provided", ".", "abs" ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/messages/lrr/events.py#L26-L46
44,997
nutechsoftware/alarmdecoder
alarmdecoder/decoder.py
AlarmDecoder.send
def send(self, data): """ Sends data to the `AlarmDecoder`_ device. :param data: data to send :type data: string """ if self._device: if isinstance(data, str): data = str.encode(data) # Hack to support unicode under Python 2.x ...
python
def send(self, data): """ Sends data to the `AlarmDecoder`_ device. :param data: data to send :type data: string """ if self._device: if isinstance(data, str): data = str.encode(data) # Hack to support unicode under Python 2.x ...
[ "def", "send", "(", "self", ",", "data", ")", ":", "if", "self", ".", "_device", ":", "if", "isinstance", "(", "data", ",", "str", ")", ":", "data", "=", "str", ".", "encode", "(", "data", ")", "# Hack to support unicode under Python 2.x", "if", "sys", ...
Sends data to the `AlarmDecoder`_ device. :param data: data to send :type data: string
[ "Sends", "data", "to", "the", "AlarmDecoder", "_", "device", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/decoder.py#L287-L304
44,998
nutechsoftware/alarmdecoder
alarmdecoder/decoder.py
AlarmDecoder.get_config_string
def get_config_string(self): """ Build a configuration string that's compatible with the AlarmDecoder configuration command from the current values in the object. :returns: string """ config_entries = [] # HACK: This is ugly.. but I can't think of an elegant way...
python
def get_config_string(self): """ Build a configuration string that's compatible with the AlarmDecoder configuration command from the current values in the object. :returns: string """ config_entries = [] # HACK: This is ugly.. but I can't think of an elegant way...
[ "def", "get_config_string", "(", "self", ")", ":", "config_entries", "=", "[", "]", "# HACK: This is ugly.. but I can't think of an elegant way of doing it.", "config_entries", ".", "append", "(", "(", "'ADDRESS'", ",", "'{0}'", ".", "format", "(", "self", ".", "addre...
Build a configuration string that's compatible with the AlarmDecoder configuration command from the current values in the object. :returns: string
[ "Build", "a", "configuration", "string", "that", "s", "compatible", "with", "the", "AlarmDecoder", "configuration", "command", "from", "the", "current", "values", "in", "the", "object", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/decoder.py#L318-L342
44,999
nutechsoftware/alarmdecoder
alarmdecoder/decoder.py
AlarmDecoder.fault_zone
def fault_zone(self, zone, simulate_wire_problem=False): """ Faults a zone if we are emulating a zone expander. :param zone: zone to fault :type zone: int :param simulate_wire_problem: Whether or not to simulate a wire fault :type simulate_wire_problem: bool """ ...
python
def fault_zone(self, zone, simulate_wire_problem=False): """ Faults a zone if we are emulating a zone expander. :param zone: zone to fault :type zone: int :param simulate_wire_problem: Whether or not to simulate a wire fault :type simulate_wire_problem: bool """ ...
[ "def", "fault_zone", "(", "self", ",", "zone", ",", "simulate_wire_problem", "=", "False", ")", ":", "# Allow ourselves to also be passed an address/channel combination", "# for zone expanders.", "#", "# Format (expander index, channel)", "if", "isinstance", "(", "zone", ",",...
Faults a zone if we are emulating a zone expander. :param zone: zone to fault :type zone: int :param simulate_wire_problem: Whether or not to simulate a wire fault :type simulate_wire_problem: bool
[ "Faults", "a", "zone", "if", "we", "are", "emulating", "a", "zone", "expander", "." ]
b0c014089e24455228cb4402cf30ba98157578cd
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/decoder.py#L356-L377