repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
GeneralGuinierPorod
def GeneralGuinierPorod(q, factor, *args, **kwargs): """Empirical generalized multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``factor``: factor for the first branch other arguments (*args): the defining arguments of the consecutive parts...
python
def GeneralGuinierPorod(q, factor, *args, **kwargs): """Empirical generalized multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``factor``: factor for the first branch other arguments (*args): the defining arguments of the consecutive parts...
[ "def", "GeneralGuinierPorod", "(", "q", ",", "factor", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "'startswithguinier'", ",", "True", ")", ":", "funcs", "=", "[", "lambda", "q", ",", "A", "=", "factor", ":...
Empirical generalized multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``factor``: factor for the first branch other arguments (*args): the defining arguments of the consecutive parts: radius of gyration (``Rg``) and dimensionality ...
[ "Empirical", "generalized", "multi", "-", "part", "Guinier", "-", "Porod", "scattering" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L412-L472
train
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
DebyeChain
def DebyeChain(q, Rg): """Scattering form-factor intensity of a Gaussian chain (Debye) Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration Formula: -------- ``2*(exp(-a)-1+a)/a^2`` where ``a=(q*Rg)^2`` """ a = (q * Rg) ** 2 return 2 * (np.exp(...
python
def DebyeChain(q, Rg): """Scattering form-factor intensity of a Gaussian chain (Debye) Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration Formula: -------- ``2*(exp(-a)-1+a)/a^2`` where ``a=(q*Rg)^2`` """ a = (q * Rg) ** 2 return 2 * (np.exp(...
[ "def", "DebyeChain", "(", "q", ",", "Rg", ")", ":", "a", "=", "(", "q", "*", "Rg", ")", "**", "2", "return", "2", "*", "(", "np", ".", "exp", "(", "-", "a", ")", "-", "1", "+", "a", ")", "/", "a", "**", "2" ]
Scattering form-factor intensity of a Gaussian chain (Debye) Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration Formula: -------- ``2*(exp(-a)-1+a)/a^2`` where ``a=(q*Rg)^2``
[ "Scattering", "form", "-", "factor", "intensity", "of", "a", "Gaussian", "chain", "(", "Debye", ")" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L6-L19
train
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
ExcludedVolumeChain
def ExcludedVolumeChain(q, Rg, nu): """Scattering intensity of a generalized excluded-volume Gaussian chain Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration ``nu``: excluded volume exponent Formula: -------- ``(u^(1/nu)*gamma(0.5/nu)*gammainc_l...
python
def ExcludedVolumeChain(q, Rg, nu): """Scattering intensity of a generalized excluded-volume Gaussian chain Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration ``nu``: excluded volume exponent Formula: -------- ``(u^(1/nu)*gamma(0.5/nu)*gammainc_l...
[ "def", "ExcludedVolumeChain", "(", "q", ",", "Rg", ",", "nu", ")", ":", "u", "=", "(", "q", "*", "Rg", ")", "**", "2", "*", "(", "2", "*", "nu", "+", "1", ")", "*", "(", "2", "*", "nu", "+", "2", ")", "/", "6.", "return", "(", "u", "**"...
Scattering intensity of a generalized excluded-volume Gaussian chain Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration ``nu``: excluded volume exponent Formula: -------- ``(u^(1/nu)*gamma(0.5/nu)*gammainc_lower(0.5/nu,u)- gamma(1/nu)*gam...
[ "Scattering", "intensity", "of", "a", "generalized", "excluded", "-", "volume", "Gaussian", "chain" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L21-L44
train
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
BorueErukhimovich
def BorueErukhimovich(q, C, r0, s, t): """Borue-Erukhimovich model of microphase separation in polyelectrolytes Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``...
python
def BorueErukhimovich(q, C, r0, s, t): """Borue-Erukhimovich model of microphase separation in polyelectrolytes Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``...
[ "def", "BorueErukhimovich", "(", "q", ",", "C", ",", "r0", ",", "s", ",", "t", ")", ":", "x", "=", "q", "*", "r0", "return", "C", "*", "(", "x", "**", "2", "+", "s", ")", "/", "(", "(", "x", "**", "2", "+", "s", ")", "*", "(", "x", "*...
Borue-Erukhimovich model of microphase separation in polyelectrolytes Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensionless temperature Formula: ...
[ "Borue", "-", "Erukhimovich", "model", "of", "microphase", "separation", "in", "polyelectrolytes" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L46-L69
train
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
BorueErukhimovich_Powerlaw
def BorueErukhimovich_Powerlaw(q, C, r0, s, t, nu): """Borue-Erukhimovich model ending in a power-law. Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensi...
python
def BorueErukhimovich_Powerlaw(q, C, r0, s, t, nu): """Borue-Erukhimovich model ending in a power-law. Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensi...
[ "def", "BorueErukhimovich_Powerlaw", "(", "q", ",", "C", ",", "r0", ",", "s", ",", "t", ",", "nu", ")", ":", "def", "get_xsep", "(", "alpha", ",", "s", ",", "t", ")", ":", "A", "=", "alpha", "+", "2", "B", "=", "2", "*", "s", "*", "alpha", ...
Borue-Erukhimovich model ending in a power-law. Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensionless temperature ``nu``: excluded volume paramete...
[ "Borue", "-", "Erukhimovich", "model", "ending", "in", "a", "power", "-", "law", "." ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L71-L104
train
bmcfee/pumpp
pumpp/sampler.py
Sampler.sample
def sample(self, data, interval): '''Sample a patch from the data object Parameters ---------- data : dict A data dict as produced by pumpp.Pump.transform interval : slice The time interval to sample Returns ------- data_slice : ...
python
def sample(self, data, interval): '''Sample a patch from the data object Parameters ---------- data : dict A data dict as produced by pumpp.Pump.transform interval : slice The time interval to sample Returns ------- data_slice : ...
[ "def", "sample", "(", "self", ",", "data", ",", "interval", ")", ":", "data_slice", "=", "dict", "(", ")", "for", "key", "in", "data", ":", "if", "'_valid'", "in", "key", ":", "continue", "index", "=", "[", "slice", "(", "None", ")", "]", "*", "d...
Sample a patch from the data object Parameters ---------- data : dict A data dict as produced by pumpp.Pump.transform interval : slice The time interval to sample Returns ------- data_slice : dict `data` restricted to `interv...
[ "Sample", "a", "patch", "from", "the", "data", "object" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/sampler.py#L87-L120
train
bmcfee/pumpp
pumpp/sampler.py
Sampler.indices
def indices(self, data): '''Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.data_du...
python
def indices(self, data): '''Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.data_du...
[ "def", "indices", "(", "self", ",", "data", ")", ":", "duration", "=", "self", ".", "data_duration", "(", "data", ")", "if", "self", ".", "duration", ">", "duration", ":", "raise", "DataError", "(", "'Data duration={} is less than '", "'sample duration={}'", "...
Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch
[ "Generate", "patch", "indices" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/sampler.py#L122-L143
train
bmcfee/pumpp
pumpp/sampler.py
SequentialSampler.indices
def indices(self, data): '''Generate patch start indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.d...
python
def indices(self, data): '''Generate patch start indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.d...
[ "def", "indices", "(", "self", ",", "data", ")", ":", "duration", "=", "self", ".", "data_duration", "(", "data", ")", "for", "start", "in", "range", "(", "0", ",", "duration", "-", "self", ".", "duration", ",", "self", ".", "stride", ")", ":", "yi...
Generate patch start indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch
[ "Generate", "patch", "start", "indices" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/sampler.py#L210-L226
train
bmcfee/pumpp
pumpp/sampler.py
VariableLengthSampler.indices
def indices(self, data): '''Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.data_du...
python
def indices(self, data): '''Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.data_du...
[ "def", "indices", "(", "self", ",", "data", ")", ":", "duration", "=", "self", ".", "data_duration", "(", "data", ")", "while", "True", ":", "# Generate a sampling interval", "yield", "self", ".", "rng", ".", "randint", "(", "0", ",", "duration", "-", "s...
Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch
[ "Generate", "patch", "indices" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/sampler.py#L279-L296
train
bmcfee/pumpp
pumpp/base.py
Scope.scope
def scope(self, key): '''Apply the name scope to a key Parameters ---------- key : string Returns ------- `name/key` if `name` is not `None`; otherwise, `key`. ''' if self.name is None: return key return '{:s}/{:s}'.fo...
python
def scope(self, key): '''Apply the name scope to a key Parameters ---------- key : string Returns ------- `name/key` if `name` is not `None`; otherwise, `key`. ''' if self.name is None: return key return '{:s}/{:s}'.fo...
[ "def", "scope", "(", "self", ",", "key", ")", ":", "if", "self", ".", "name", "is", "None", ":", "return", "key", "return", "'{:s}/{:s}'", ".", "format", "(", "self", ".", "name", ",", "key", ")" ]
Apply the name scope to a key Parameters ---------- key : string Returns ------- `name/key` if `name` is not `None`; otherwise, `key`.
[ "Apply", "the", "name", "scope", "to", "a", "key" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L36-L50
train
bmcfee/pumpp
pumpp/base.py
Scope.register
def register(self, field, shape, dtype): '''Register a field as a tensor with specified shape and type. A `Tensor` of the given shape and type will be registered in this object's `fields` dict. Parameters ---------- field : str The name of the field ...
python
def register(self, field, shape, dtype): '''Register a field as a tensor with specified shape and type. A `Tensor` of the given shape and type will be registered in this object's `fields` dict. Parameters ---------- field : str The name of the field ...
[ "def", "register", "(", "self", ",", "field", ",", "shape", ",", "dtype", ")", ":", "if", "not", "isinstance", "(", "dtype", ",", "type", ")", ":", "raise", "ParameterError", "(", "'dtype={} must be a type'", ".", "format", "(", "dtype", ")", ")", "if", ...
Register a field as a tensor with specified shape and type. A `Tensor` of the given shape and type will be registered in this object's `fields` dict. Parameters ---------- field : str The name of the field shape : iterable of `int` or `None` The...
[ "Register", "a", "field", "as", "a", "tensor", "with", "specified", "shape", "and", "type", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L52-L84
train
bmcfee/pumpp
pumpp/base.py
Scope.merge
def merge(self, data): '''Merge an array of output dictionaries into a single dictionary with properly scoped names. Parameters ---------- data : list of dict Output dicts as produced by `pumpp.task.BaseTaskTransformer.transform` or `pumpp.feature.Feature...
python
def merge(self, data): '''Merge an array of output dictionaries into a single dictionary with properly scoped names. Parameters ---------- data : list of dict Output dicts as produced by `pumpp.task.BaseTaskTransformer.transform` or `pumpp.feature.Feature...
[ "def", "merge", "(", "self", ",", "data", ")", ":", "data_out", "=", "dict", "(", ")", "# Iterate over all keys in data", "for", "key", "in", "set", "(", ")", ".", "union", "(", "*", "data", ")", ":", "data_out", "[", "self", ".", "scope", "(", "key"...
Merge an array of output dictionaries into a single dictionary with properly scoped names. Parameters ---------- data : list of dict Output dicts as produced by `pumpp.task.BaseTaskTransformer.transform` or `pumpp.feature.FeatureExtractor.transform`. Ret...
[ "Merge", "an", "array", "of", "output", "dictionaries", "into", "a", "single", "dictionary", "with", "properly", "scoped", "names", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L89-L111
train
bmcfee/pumpp
pumpp/base.py
Slicer.add
def add(self, operator): '''Add an operator to the Slicer Parameters ---------- operator : Scope (TaskTransformer or FeatureExtractor) The new operator to add ''' if not isinstance(operator, Scope): raise ParameterError('Operator {} must be a Task...
python
def add(self, operator): '''Add an operator to the Slicer Parameters ---------- operator : Scope (TaskTransformer or FeatureExtractor) The new operator to add ''' if not isinstance(operator, Scope): raise ParameterError('Operator {} must be a Task...
[ "def", "add", "(", "self", ",", "operator", ")", ":", "if", "not", "isinstance", "(", "operator", ",", "Scope", ")", ":", "raise", "ParameterError", "(", "'Operator {} must be a TaskTransformer '", "'or FeatureExtractor'", ".", "format", "(", "operator", ")", ")...
Add an operator to the Slicer Parameters ---------- operator : Scope (TaskTransformer or FeatureExtractor) The new operator to add
[ "Add", "an", "operator", "to", "the", "Slicer" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L132-L148
train
bmcfee/pumpp
pumpp/base.py
Slicer.data_duration
def data_duration(self, data): '''Compute the valid data duration of a dict Parameters ---------- data : dict As produced by pumpp.transform Returns ------- length : int The minimum temporal extent of a dynamic observation in data ...
python
def data_duration(self, data): '''Compute the valid data duration of a dict Parameters ---------- data : dict As produced by pumpp.transform Returns ------- length : int The minimum temporal extent of a dynamic observation in data ...
[ "def", "data_duration", "(", "self", ",", "data", ")", ":", "# Find all the time-like indices of the data", "lengths", "=", "[", "]", "for", "key", "in", "self", ".", "_time", ":", "for", "idx", "in", "self", ".", "_time", ".", "get", "(", "key", ",", "[...
Compute the valid data duration of a dict Parameters ---------- data : dict As produced by pumpp.transform Returns ------- length : int The minimum temporal extent of a dynamic observation in data
[ "Compute", "the", "valid", "data", "duration", "of", "a", "dict" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L150-L169
train
bmcfee/pumpp
pumpp/base.py
Slicer.crop
def crop(self, data): '''Crop a data dictionary down to its common time Parameters ---------- data : dict As produced by pumpp.transform Returns ------- data_cropped : dict Like `data` but with all time-like axes truncated to the ...
python
def crop(self, data): '''Crop a data dictionary down to its common time Parameters ---------- data : dict As produced by pumpp.transform Returns ------- data_cropped : dict Like `data` but with all time-like axes truncated to the ...
[ "def", "crop", "(", "self", ",", "data", ")", ":", "duration", "=", "self", ".", "data_duration", "(", "data", ")", "data_out", "=", "dict", "(", ")", "for", "key", "in", "data", ":", "idx", "=", "[", "slice", "(", "None", ")", "]", "*", "data", ...
Crop a data dictionary down to its common time Parameters ---------- data : dict As produced by pumpp.transform Returns ------- data_cropped : dict Like `data` but with all time-like axes truncated to the minimum common duration
[ "Crop", "a", "data", "dictionary", "down", "to", "its", "common", "time" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L171-L194
train
bmcfee/pumpp
pumpp/feature/mel.py
Mel.transform_audio
def transform_audio(self, y): '''Compute the Mel spectrogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_mels) The Mel spectrogram ...
python
def transform_audio(self, y): '''Compute the Mel spectrogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_mels) The Mel spectrogram ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "mel", "=", "np", ".", "sqrt", "(", "melspectrogram", "(", ...
Compute the Mel spectrogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_mels) The Mel spectrogram
[ "Compute", "the", "Mel", "spectrogram" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/mel.py#L54-L81
train
bmcfee/pumpp
pumpp/task/regression.py
VectorTransformer.empty
def empty(self, duration): '''Empty vector annotations. This returns an annotation with a single observation vector consisting of all-zeroes. Parameters ---------- duration : number >0 Length of the track Returns ------- ann : jams.A...
python
def empty(self, duration): '''Empty vector annotations. This returns an annotation with a single observation vector consisting of all-zeroes. Parameters ---------- duration : number >0 Length of the track Returns ------- ann : jams.A...
[ "def", "empty", "(", "self", ",", "duration", ")", ":", "ann", "=", "super", "(", "VectorTransformer", ",", "self", ")", ".", "empty", "(", "duration", ")", "ann", ".", "append", "(", "time", "=", "0", ",", "duration", "=", "duration", ",", "confiden...
Empty vector annotations. This returns an annotation with a single observation vector consisting of all-zeroes. Parameters ---------- duration : number >0 Length of the track Returns ------- ann : jams.Annotation The empty annota...
[ "Empty", "vector", "annotations", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/regression.py#L42-L62
train
bmcfee/pumpp
pumpp/task/regression.py
VectorTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the vector transformation. Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the track Returns ------- data : dict ...
python
def transform_annotation(self, ann, duration): '''Apply the vector transformation. Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the track Returns ------- data : dict ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "_", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "vector", "=", "np", ".", "asarray", "(", "values", "[", "0", "]", ",", "dtype", "=", "self", ".",...
Apply the vector transformation. Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the track Returns ------- data : dict data['vector'] : np.ndarray, shape=(dimension,) ...
[ "Apply", "the", "vector", "transformation", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/regression.py#L64-L92
train
bmcfee/pumpp
pumpp/task/regression.py
VectorTransformer.inverse
def inverse(self, vector, duration=None): '''Inverse vector transformer''' ann = jams.Annotation(namespace=self.namespace, duration=duration) if duration is None: duration = 0 ann.append(time=0, duration=duration, value=vector) return ann
python
def inverse(self, vector, duration=None): '''Inverse vector transformer''' ann = jams.Annotation(namespace=self.namespace, duration=duration) if duration is None: duration = 0 ann.append(time=0, duration=duration, value=vector) return ann
[ "def", "inverse", "(", "self", ",", "vector", ",", "duration", "=", "None", ")", ":", "ann", "=", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "duration", "=", "duration", ")", "if", "duration", "is", "None", ":", ...
Inverse vector transformer
[ "Inverse", "vector", "transformer" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/regression.py#L94-L103
train
bmcfee/pumpp
pumpp/task/tags.py
DynamicLabelTransformer.set_transition
def set_transition(self, p_self): '''Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding ''' if ...
python
def set_transition(self, p_self): '''Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding ''' if ...
[ "def", "set_transition", "(", "self", ",", "p_self", ")", ":", "if", "p_self", "is", "None", ":", "self", ".", "transition", "=", "None", "else", ":", "self", ".", "transition", "=", "np", ".", "empty", "(", "(", "len", "(", "self", ".", "_classes", ...
Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding
[ "Set", "the", "transition", "matrix", "according", "to", "self", "-", "loop", "probabilities", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L86-L104
train
bmcfee/pumpp
pumpp/task/tags.py
DynamicLabelTransformer.empty
def empty(self, duration): '''Empty label annotations. Constructs a single observation with an empty value (None). Parameters ---------- duration : number > 0 The duration of the annotation ''' ann = super(DynamicLabelTransformer, self).empty(duratio...
python
def empty(self, duration): '''Empty label annotations. Constructs a single observation with an empty value (None). Parameters ---------- duration : number > 0 The duration of the annotation ''' ann = super(DynamicLabelTransformer, self).empty(duratio...
[ "def", "empty", "(", "self", ",", "duration", ")", ":", "ann", "=", "super", "(", "DynamicLabelTransformer", ",", "self", ")", ".", "empty", "(", "duration", ")", "ann", ".", "append", "(", "time", "=", "0", ",", "duration", "=", "duration", ",", "va...
Empty label annotations. Constructs a single observation with an empty value (None). Parameters ---------- duration : number > 0 The duration of the annotation
[ "Empty", "label", "annotations", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L106-L118
train
bmcfee/pumpp
pumpp/task/tags.py
DynamicLabelTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Transform an annotation to dynamic label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
python
def transform_annotation(self, ann, duration): '''Transform an annotation to dynamic label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "intervals", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "# Suppress all intervals not in the encoder", "tags", "=", "[", "]", "for", "v", "in", "values", ":...
Transform an annotation to dynamic label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- data : dict data['tags'] : np.ndarray, s...
[ "Transform", "an", "annotation", "to", "dynamic", "label", "encoding", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L120-L150
train
bmcfee/pumpp
pumpp/task/tags.py
DynamicLabelTransformer.inverse
def inverse(self, encoded, duration=None): '''Inverse transformation''' ann = jams.Annotation(namespace=self.namespace, duration=duration) for start, end, value in self.decode_intervals(encoded, duration=duration, ...
python
def inverse(self, encoded, duration=None): '''Inverse transformation''' ann = jams.Annotation(namespace=self.namespace, duration=duration) for start, end, value in self.decode_intervals(encoded, duration=duration, ...
[ "def", "inverse", "(", "self", ",", "encoded", ",", "duration", "=", "None", ")", ":", "ann", "=", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "duration", "=", "duration", ")", "for", "start", ",", "end", ",", "va...
Inverse transformation
[ "Inverse", "transformation" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L152-L176
train
bmcfee/pumpp
pumpp/task/tags.py
StaticLabelTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Transform an annotation to static label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
python
def transform_annotation(self, ann, duration): '''Transform an annotation to static label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "intervals", "=", "np", ".", "asarray", "(", "[", "[", "0", ",", "1", "]", "]", ")", "values", "=", "list", "(", "[", "obs", ".", "value", "for", "obs", "in", "ann...
Transform an annotation to static label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- data : dict data['tags'] : np.ndarray, sh...
[ "Transform", "an", "annotation", "to", "static", "label", "encoding", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L214-L242
train
bmcfee/pumpp
pumpp/task/tags.py
StaticLabelTransformer.inverse
def inverse(self, encoded, duration=None): '''Inverse static tag transformation''' ann = jams.Annotation(namespace=self.namespace, duration=duration) if np.isrealobj(encoded): detected = (encoded >= 0.5) else: detected = encoded for vd in self.encoder.i...
python
def inverse(self, encoded, duration=None): '''Inverse static tag transformation''' ann = jams.Annotation(namespace=self.namespace, duration=duration) if np.isrealobj(encoded): detected = (encoded >= 0.5) else: detected = encoded for vd in self.encoder.i...
[ "def", "inverse", "(", "self", ",", "encoded", ",", "duration", "=", "None", ")", ":", "ann", "=", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "duration", "=", "duration", ")", "if", "np", ".", "isrealobj", "(", "...
Inverse static tag transformation
[ "Inverse", "static", "tag", "transformation" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L244-L260
train
bmcfee/pumpp
pumpp/feature/time.py
TimePosition.transform_audio
def transform_audio(self, y): '''Compute the time position encoding Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['relative'] = np.ndarray, shape=(n_frames, 2) data['absolute'] = np.ndarray...
python
def transform_audio(self, y): '''Compute the time position encoding Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['relative'] = np.ndarray, shape=(n_frames, 2) data['absolute'] = np.ndarray...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "duration", "=", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", "n_frames", "=", "self", ".", "n_frames", "(", "duration", ")", "relative", "=", "np", ".", "zer...
Compute the time position encoding Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['relative'] = np.ndarray, shape=(n_frames, 2) data['absolute'] = np.ndarray, shape=(n_frames, 2) Re...
[ "Compute", "the", "time", "position", "encoding" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/time.py#L34-L61
train
bmcfee/pumpp
pumpp/core.py
Pump.add
def add(self, operator): '''Add an operation to this pump. Parameters ---------- operator : BaseTaskTransformer, FeatureExtractor The operation to add Raises ------ ParameterError if `op` is not of a correct type ''' if no...
python
def add(self, operator): '''Add an operation to this pump. Parameters ---------- operator : BaseTaskTransformer, FeatureExtractor The operation to add Raises ------ ParameterError if `op` is not of a correct type ''' if no...
[ "def", "add", "(", "self", ",", "operator", ")", ":", "if", "not", "isinstance", "(", "operator", ",", "(", "BaseTaskTransformer", ",", "FeatureExtractor", ")", ")", ":", "raise", "ParameterError", "(", "'operator={} must be one of '", "'(BaseTaskTransformer, Featur...
Add an operation to this pump. Parameters ---------- operator : BaseTaskTransformer, FeatureExtractor The operation to add Raises ------ ParameterError if `op` is not of a correct type
[ "Add", "an", "operation", "to", "this", "pump", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L72-L96
train
bmcfee/pumpp
pumpp/core.py
Pump.transform
def transform(self, audio_f=None, jam=None, y=None, sr=None, crop=False): '''Apply the transformations to an audio file, and optionally JAMS object. Parameters ---------- audio_f : str Path to audio file jam : optional, `jams.JAMS`, str or file-like Opti...
python
def transform(self, audio_f=None, jam=None, y=None, sr=None, crop=False): '''Apply the transformations to an audio file, and optionally JAMS object. Parameters ---------- audio_f : str Path to audio file jam : optional, `jams.JAMS`, str or file-like Opti...
[ "def", "transform", "(", "self", ",", "audio_f", "=", "None", ",", "jam", "=", "None", ",", "y", "=", "None", ",", "sr", "=", "None", ",", "crop", "=", "False", ")", ":", "if", "y", "is", "None", ":", "if", "audio_f", "is", "None", ":", "raise"...
Apply the transformations to an audio file, and optionally JAMS object. Parameters ---------- audio_f : str Path to audio file jam : optional, `jams.JAMS`, str or file-like Optional JAMS object/path to JAMS file/open file descriptor. If provided, th...
[ "Apply", "the", "transformations", "to", "an", "audio", "file", "and", "optionally", "JAMS", "object", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L98-L161
train
bmcfee/pumpp
pumpp/core.py
Pump.sampler
def sampler(self, n_samples, duration, random_state=None): '''Construct a sampler object for this pump's operators. Parameters ---------- n_samples : None or int > 0 The number of samples to generate duration : int > 0 The duration (in frames) of each sa...
python
def sampler(self, n_samples, duration, random_state=None): '''Construct a sampler object for this pump's operators. Parameters ---------- n_samples : None or int > 0 The number of samples to generate duration : int > 0 The duration (in frames) of each sa...
[ "def", "sampler", "(", "self", ",", "n_samples", ",", "duration", ",", "random_state", "=", "None", ")", ":", "return", "Sampler", "(", "n_samples", ",", "duration", ",", "random_state", "=", "random_state", ",", "*", "self", ".", "ops", ")" ]
Construct a sampler object for this pump's operators. Parameters ---------- n_samples : None or int > 0 The number of samples to generate duration : int > 0 The duration (in frames) of each sample patch random_state : None, int, or np.random.RandomState...
[ "Construct", "a", "sampler", "object", "for", "this", "pump", "s", "operators", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L163-L196
train
bmcfee/pumpp
pumpp/core.py
Pump.fields
def fields(self): '''A dictionary of fields constructed by this pump''' out = dict() for operator in self.ops: out.update(**operator.fields) return out
python
def fields(self): '''A dictionary of fields constructed by this pump''' out = dict() for operator in self.ops: out.update(**operator.fields) return out
[ "def", "fields", "(", "self", ")", ":", "out", "=", "dict", "(", ")", "for", "operator", "in", "self", ".", "ops", ":", "out", ".", "update", "(", "*", "*", "operator", ".", "fields", ")", "return", "out" ]
A dictionary of fields constructed by this pump
[ "A", "dictionary", "of", "fields", "constructed", "by", "this", "pump" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L199-L205
train
bmcfee/pumpp
pumpp/core.py
Pump.layers
def layers(self): '''Construct Keras input layers for all feature transformers in the pump. Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding fields. ''' layermap = dict() ...
python
def layers(self): '''Construct Keras input layers for all feature transformers in the pump. Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding fields. ''' layermap = dict() ...
[ "def", "layers", "(", "self", ")", ":", "layermap", "=", "dict", "(", ")", "for", "operator", "in", "self", ".", "ops", ":", "if", "hasattr", "(", "operator", ",", "'layers'", ")", ":", "layermap", ".", "update", "(", "operator", ".", "layers", "(", ...
Construct Keras input layers for all feature transformers in the pump. Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding fields.
[ "Construct", "Keras", "input", "layers", "for", "all", "feature", "transformers", "in", "the", "pump", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L207-L222
train
bmcfee/pumpp
pumpp/task/beat.py
BeatTransformer.set_transition_beat
def set_transition_beat(self, p_self): '''Set the beat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding ...
python
def set_transition_beat(self, p_self): '''Set the beat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding ...
[ "def", "set_transition_beat", "(", "self", ",", "p_self", ")", ":", "if", "p_self", "is", "None", ":", "self", ".", "beat_transition", "=", "None", "else", ":", "self", ".", "beat_transition", "=", "transition_loop", "(", "2", ",", "p_self", ")" ]
Set the beat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding
[ "Set", "the", "beat", "-", "tracking", "transition", "matrix", "according", "to", "self", "-", "loop", "probabilities", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L92-L104
train
bmcfee/pumpp
pumpp/task/beat.py
BeatTransformer.set_transition_down
def set_transition_down(self, p_self): '''Set the downbeat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding...
python
def set_transition_down(self, p_self): '''Set the downbeat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding...
[ "def", "set_transition_down", "(", "self", ",", "p_self", ")", ":", "if", "p_self", "is", "None", ":", "self", ".", "down_transition", "=", "None", "else", ":", "self", ".", "down_transition", "=", "transition_loop", "(", "2", ",", "p_self", ")" ]
Set the downbeat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding
[ "Set", "the", "downbeat", "-", "tracking", "transition", "matrix", "according", "to", "self", "-", "loop", "probabilities", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L106-L118
train
bmcfee/pumpp
pumpp/task/beat.py
BeatTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the beat transformer Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the audio Returns ------- data : dict ...
python
def transform_annotation(self, ann, duration): '''Apply the beat transformer Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the audio Returns ------- data : dict ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "mask_downbeat", "=", "False", "intervals", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "values", "=", "np", ".", "asarray", "(", "values", ")", "beat_ev...
Apply the beat transformer Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the audio Returns ------- data : dict data['beat'] : np.ndarray, shape=(n, 1) B...
[ "Apply", "the", "beat", "transformer" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L120-L171
train
bmcfee/pumpp
pumpp/task/beat.py
BeatTransformer.inverse
def inverse(self, encoded, downbeat=None, duration=None): '''Inverse transformation for beats and optional downbeats''' ann = jams.Annotation(namespace=self.namespace, duration=duration) beat_times = np.asarray([t for t, _ in self.decode_events(encoded, ...
python
def inverse(self, encoded, downbeat=None, duration=None): '''Inverse transformation for beats and optional downbeats''' ann = jams.Annotation(namespace=self.namespace, duration=duration) beat_times = np.asarray([t for t, _ in self.decode_events(encoded, ...
[ "def", "inverse", "(", "self", ",", "encoded", ",", "downbeat", "=", "None", ",", "duration", "=", "None", ")", ":", "ann", "=", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "duration", "=", "duration", ")", "beat_ti...
Inverse transformation for beats and optional downbeats
[ "Inverse", "transformation", "for", "beats", "and", "optional", "downbeats" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L173-L209
train
bmcfee/pumpp
pumpp/task/beat.py
BeatPositionTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Transform an annotation to the beat-position encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns -------...
python
def transform_annotation(self, ann, duration): '''Transform an annotation to the beat-position encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns -------...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "# 1. get all the events", "# 2. find all the downbeats", "# 3. map each downbeat to a subdivision counter", "# number of beats until the next downbeat", "# 4. pad out events to intervals", "# 5. e...
Transform an annotation to the beat-position encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- data : dict data['position'] : np.nda...
[ "Transform", "an", "annotation", "to", "the", "beat", "-", "position", "encoding" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L265-L339
train
bmcfee/pumpp
pumpp/feature/rhythm.py
Tempogram.transform_audio
def transform_audio(self, y): '''Compute the tempogram Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['tempogram'] : np.ndarray, shape=(n_frames, win_length) The tempogram ''' ...
python
def transform_audio(self, y): '''Compute the tempogram Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['tempogram'] : np.ndarray, shape=(n_frames, win_length) The tempogram ''' ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "tgram", "=", "tempogram", "(", "y", "=", "y", ",", "sr", ...
Compute the tempogram Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['tempogram'] : np.ndarray, shape=(n_frames, win_length) The tempogram
[ "Compute", "the", "tempogram" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/rhythm.py#L39-L60
train
bmcfee/pumpp
pumpp/feature/rhythm.py
TempoScale.transform_audio
def transform_audio(self, y): '''Apply the scale transform to the tempogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['temposcale'] : np.ndarray, shape=(n_frames, n_fmt) The sca...
python
def transform_audio(self, y): '''Apply the scale transform to the tempogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['temposcale'] : np.ndarray, shape=(n_frames, n_fmt) The sca...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "TempoScale", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'temposcale'", "]", "=", "np", ".", "abs", "(", "fmt", "(", "data", ".", "pop...
Apply the scale transform to the tempogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['temposcale'] : np.ndarray, shape=(n_frames, n_fmt) The scale transform magnitude coefficients
[ "Apply", "the", "scale", "transform", "to", "the", "tempogram" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/rhythm.py#L93-L111
train
bmcfee/pumpp
pumpp/task/structure.py
StructureTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the structure agreement transformation. Parameters ---------- ann : jams.Annotation The segment annotation duration : number > 0 The target duration Returns ------- data : d...
python
def transform_annotation(self, ann, duration): '''Apply the structure agreement transformation. Parameters ---------- ann : jams.Annotation The segment annotation duration : number > 0 The target duration Returns ------- data : d...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "intervals", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "intervals", ",", "values", "=", "adjust_intervals", "(", "intervals", ",", "values", ",", "t_min"...
Apply the structure agreement transformation. Parameters ---------- ann : jams.Annotation The segment annotation duration : number > 0 The target duration Returns ------- data : dict data['agree'] : np.ndarray, shape=(n, n), ...
[ "Apply", "the", "structure", "agreement", "transformation", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/structure.py#L47-L76
train
bmcfee/pumpp
pumpp/feature/fft.py
STFT.transform_audio
def transform_audio(self, y): '''Compute the STFT magnitude and phase. Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) STFT magnitu...
python
def transform_audio(self, y): '''Compute the STFT magnitude and phase. Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) STFT magnitu...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "D", "=", "stft", "(", "y", ",", "hop_length", "=", "self",...
Compute the STFT magnitude and phase. Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) STFT magnitude data['phase'] : np.ndarra...
[ "Compute", "the", "STFT", "magnitude", "and", "phase", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/fft.py#L51-L80
train
bmcfee/pumpp
pumpp/feature/fft.py
STFTPhaseDiff.transform_audio
def transform_audio(self, y): '''Compute the STFT with phase differentials. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STF...
python
def transform_audio(self, y): '''Compute the STFT with phase differentials. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STF...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "STFTPhaseDiff", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'dphase'", "]", "=", "self", ".", "phase_diff", "(", "data", ".", "pop", "("...
Compute the STFT with phase differentials. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STFT magnitude data['dphase'] :...
[ "Compute", "the", "STFT", "with", "phase", "differentials", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/fft.py#L95-L114
train
bmcfee/pumpp
pumpp/feature/fft.py
STFTMag.transform_audio
def transform_audio(self, y): '''Compute the STFT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STFT magnitude ''' ...
python
def transform_audio(self, y): '''Compute the STFT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STFT magnitude ''' ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "STFTMag", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", ".", "pop", "(", "'phase'", ")", "return", "data" ]
Compute the STFT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STFT magnitude
[ "Compute", "the", "STFT" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/fft.py#L128-L145
train
bmcfee/pumpp
pumpp/task/chord.py
_pad_nochord
def _pad_nochord(target, axis=-1): '''Pad a chord annotation with no-chord flags. Parameters ---------- target : np.ndarray the input data axis : int the axis along which to pad Returns ------- target_pad `target` expanded by 1 along the specified `axis`. ...
python
def _pad_nochord(target, axis=-1): '''Pad a chord annotation with no-chord flags. Parameters ---------- target : np.ndarray the input data axis : int the axis along which to pad Returns ------- target_pad `target` expanded by 1 along the specified `axis`. ...
[ "def", "_pad_nochord", "(", "target", ",", "axis", "=", "-", "1", ")", ":", "ncmask", "=", "~", "np", ".", "max", "(", "target", ",", "axis", "=", "axis", ",", "keepdims", "=", "True", ")", "return", "np", ".", "concatenate", "(", "[", "target", ...
Pad a chord annotation with no-chord flags. Parameters ---------- target : np.ndarray the input data axis : int the axis along which to pad Returns ------- target_pad `target` expanded by 1 along the specified `axis`. The expanded dimension will be 0 when `...
[ "Pad", "a", "chord", "annotation", "with", "no", "-", "chord", "flags", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L24-L44
train
bmcfee/pumpp
pumpp/task/chord.py
ChordTransformer.empty
def empty(self, duration): '''Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisting of a single `no-chord` obser...
python
def empty(self, duration): '''Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisting of a single `no-chord` obser...
[ "def", "empty", "(", "self", ",", "duration", ")", ":", "ann", "=", "super", "(", "ChordTransformer", ",", "self", ")", ".", "empty", "(", "duration", ")", "ann", ".", "append", "(", "time", "=", "0", ",", "duration", "=", "duration", ",", "value", ...
Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisting of a single `no-chord` observation.
[ "Empty", "chord", "annotations" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L92-L111
train
bmcfee/pumpp
pumpp/task/chord.py
ChordTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict ...
python
def transform_annotation(self, ann, duration): '''Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "# Construct a blank annotation with mask = 0", "intervals", ",", "chords", "=", "ann", ".", "to_interval_values", "(", ")", "# Get the dtype for root/bass", "if", "self", ".", "sparse"...
Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict data['pitch'] : np.ndarray, shape=(n, 12) data...
[ "Apply", "the", "chord", "transformation", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L113-L213
train
bmcfee/pumpp
pumpp/task/chord.py
SimpleChordTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict ...
python
def transform_annotation(self, ann, duration): '''Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "data", "=", "super", "(", "SimpleChordTransformer", ",", "self", ")", ".", "transform_annotation", "(", "ann", ",", "duration", ")", "data", ".", "pop", "(", "'root'", ",",...
Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict data['pitch'] : np.ndarray, shape=(n, 12) `pi...
[ "Apply", "the", "chord", "transformation", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L246-L270
train
bmcfee/pumpp
pumpp/task/chord.py
ChordTagTransformer.set_transition
def set_transition(self, p_self): '''Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding ''' if ...
python
def set_transition(self, p_self): '''Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding ''' if ...
[ "def", "set_transition", "(", "self", ",", "p_self", ")", ":", "if", "p_self", "is", "None", ":", "self", ".", "transition", "=", "None", "else", ":", "self", ".", "transition", "=", "transition_loop", "(", "len", "(", "self", ".", "_classes", ")", ","...
Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding
[ "Set", "the", "transition", "matrix", "according", "to", "self", "-", "loop", "probabilities", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L416-L427
train
bmcfee/pumpp
pumpp/task/chord.py
ChordTagTransformer.simplify
def simplify(self, chord): '''Simplify a chord string down to the vocabulary space''' # Drop inversions chord = re.sub(r'/.*$', r'', chord) # Drop any additional or suppressed tones chord = re.sub(r'\(.*?\)', r'', chord) # Drop dangling : indicators chord = re.sub...
python
def simplify(self, chord): '''Simplify a chord string down to the vocabulary space''' # Drop inversions chord = re.sub(r'/.*$', r'', chord) # Drop any additional or suppressed tones chord = re.sub(r'\(.*?\)', r'', chord) # Drop dangling : indicators chord = re.sub...
[ "def", "simplify", "(", "self", ",", "chord", ")", ":", "# Drop inversions", "chord", "=", "re", ".", "sub", "(", "r'/.*$'", ",", "r''", ",", "chord", ")", "# Drop any additional or suppressed tones", "chord", "=", "re", ".", "sub", "(", "r'\\(.*?\\)'", ",",...
Simplify a chord string down to the vocabulary space
[ "Simplify", "a", "chord", "string", "down", "to", "the", "vocabulary", "space" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L475-L498
train
bmcfee/pumpp
pumpp/task/chord.py
ChordTagTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Transform an annotation to chord-tag encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
python
def transform_annotation(self, ann, duration): '''Transform an annotation to chord-tag encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "intervals", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "chords", "=", "[", "]", "for", "v", "in", "values", ":", "chords", ".", "extend", "(", "sel...
Transform an annotation to chord-tag encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- data : dict data['chord'] : np.ndarray, shape...
[ "Transform", "an", "annotation", "to", "chord", "-", "tag", "encoding" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L500-L534
train
bmcfee/pumpp
pumpp/feature/cqt.py
CQT.transform_audio
def transform_audio(self, y): '''Compute the CQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins) The CQT magnitude data['p...
python
def transform_audio(self, y): '''Compute the CQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins) The CQT magnitude data['p...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "C", "=", "cqt", "(", "y", "=", "y", ",", "sr", "=", "s...
Compute the CQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins) The CQT magnitude data['phase']: np.ndarray, shape = mag.shape ...
[ "Compute", "the", "CQT" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L61-L92
train
bmcfee/pumpp
pumpp/feature/cqt.py
CQTMag.transform_audio
def transform_audio(self, y): '''Compute CQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude ''' ...
python
def transform_audio(self, y): '''Compute CQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude ''' ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "CQTMag", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", ".", "pop", "(", "'phase'", ")", "return", "data" ]
Compute CQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude
[ "Compute", "CQT", "magnitude", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L107-L123
train
bmcfee/pumpp
pumpp/feature/cqt.py
CQTPhaseDiff.transform_audio
def transform_audio(self, y): '''Compute the CQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
python
def transform_audio(self, y): '''Compute the CQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "CQTPhaseDiff", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'dphase'", "]", "=", "self", ".", "phase_diff", "(", "data", ".", "pop", "(",...
Compute the CQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude data['dphase'] : np.ndarray, shap...
[ "Compute", "the", "CQT", "with", "unwrapped", "phase" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L141-L160
train
bmcfee/pumpp
pumpp/feature/cqt.py
HCQT.transform_audio
def transform_audio(self, y): '''Compute the HCQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins, n_harmonics) The CQT magnitude ...
python
def transform_audio(self, y): '''Compute the HCQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins, n_harmonics) The CQT magnitude ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "cqtm", ",", "phase", "=", "[", "]", ",", "[", "]", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "for"...
Compute the HCQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins, n_harmonics) The CQT magnitude data['phase']: np.ndarray, shape =...
[ "Compute", "the", "HCQT" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L231-L270
train
bmcfee/pumpp
pumpp/feature/cqt.py
HCQT._index
def _index(self, value): '''Rearrange a tensor according to the convolution mode Input is assumed to be in (channels, bins, time) format. ''' if self.conv in ('channels_last', 'tf'): return np.transpose(value, (2, 1, 0)) else: # self.conv in ('channels_first', 'th...
python
def _index(self, value): '''Rearrange a tensor according to the convolution mode Input is assumed to be in (channels, bins, time) format. ''' if self.conv in ('channels_last', 'tf'): return np.transpose(value, (2, 1, 0)) else: # self.conv in ('channels_first', 'th...
[ "def", "_index", "(", "self", ",", "value", ")", ":", "if", "self", ".", "conv", "in", "(", "'channels_last'", ",", "'tf'", ")", ":", "return", "np", ".", "transpose", "(", "value", ",", "(", "2", ",", "1", ",", "0", ")", ")", "else", ":", "# s...
Rearrange a tensor according to the convolution mode Input is assumed to be in (channels, bins, time) format.
[ "Rearrange", "a", "tensor", "according", "to", "the", "convolution", "mode" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L272-L282
train
bmcfee/pumpp
pumpp/feature/cqt.py
HCQTMag.transform_audio
def transform_audio(self, y): '''Compute HCQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude ''' ...
python
def transform_audio(self, y): '''Compute HCQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude ''' ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "HCQTMag", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", ".", "pop", "(", "'phase'", ")", "return", "data" ]
Compute HCQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude
[ "Compute", "HCQT", "magnitude", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L297-L313
train
bmcfee/pumpp
pumpp/feature/cqt.py
HCQTPhaseDiff.transform_audio
def transform_audio(self, y): '''Compute the HCQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
python
def transform_audio(self, y): '''Compute the HCQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "HCQTPhaseDiff", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'dphase'", "]", "=", "self", ".", "phase_diff", "(", "data", ".", "pop", "("...
Compute the HCQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude data['dphase'] : np.ndarray, sha...
[ "Compute", "the", "HCQT", "with", "unwrapped", "phase" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L332-L351
train
bmcfee/pumpp
pumpp/task/base.py
fill_value
def fill_value(dtype): '''Get a fill-value for a given dtype Parameters ---------- dtype : type Returns ------- `np.nan` if `dtype` is real or complex 0 otherwise ''' if np.issubdtype(dtype, np.floating) or np.issubdtype(dtype, np.complexfloating): return dtype(np.nan)...
python
def fill_value(dtype): '''Get a fill-value for a given dtype Parameters ---------- dtype : type Returns ------- `np.nan` if `dtype` is real or complex 0 otherwise ''' if np.issubdtype(dtype, np.floating) or np.issubdtype(dtype, np.complexfloating): return dtype(np.nan)...
[ "def", "fill_value", "(", "dtype", ")", ":", "if", "np", ".", "issubdtype", "(", "dtype", ",", "np", ".", "floating", ")", "or", "np", ".", "issubdtype", "(", "dtype", ",", "np", ".", "complexfloating", ")", ":", "return", "dtype", "(", "np", ".", ...
Get a fill-value for a given dtype Parameters ---------- dtype : type Returns ------- `np.nan` if `dtype` is real or complex 0 otherwise
[ "Get", "a", "fill", "-", "value", "for", "a", "given", "dtype" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L15-L31
train
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.empty
def empty(self, duration): '''Create an empty jams.Annotation for this task. This method should be overridden by derived classes. Parameters ---------- duration : int >= 0 Duration of the annotation ''' return jams.Annotation(namespace=self.namespace...
python
def empty(self, duration): '''Create an empty jams.Annotation for this task. This method should be overridden by derived classes. Parameters ---------- duration : int >= 0 Duration of the annotation ''' return jams.Annotation(namespace=self.namespace...
[ "def", "empty", "(", "self", ",", "duration", ")", ":", "return", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "time", "=", "0", ",", "duration", "=", "0", ")" ]
Create an empty jams.Annotation for this task. This method should be overridden by derived classes. Parameters ---------- duration : int >= 0 Duration of the annotation
[ "Create", "an", "empty", "jams", ".", "Annotation", "for", "this", "task", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L62-L72
train
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.transform
def transform(self, jam, query=None): '''Transform jam object to make data for this task Parameters ---------- jam : jams.JAMS The jams container object query : string, dict, or callable [optional] An optional query to narrow the elements of `jam.annotat...
python
def transform(self, jam, query=None): '''Transform jam object to make data for this task Parameters ---------- jam : jams.JAMS The jams container object query : string, dict, or callable [optional] An optional query to narrow the elements of `jam.annotat...
[ "def", "transform", "(", "self", ",", "jam", ",", "query", "=", "None", ")", ":", "anns", "=", "[", "]", "if", "query", ":", "results", "=", "jam", ".", "search", "(", "*", "*", "query", ")", "else", ":", "results", "=", "jam", ".", "annotations"...
Transform jam object to make data for this task Parameters ---------- jam : jams.JAMS The jams container object query : string, dict, or callable [optional] An optional query to narrow the elements of `jam.annotations` to be considered. ...
[ "Transform", "jam", "object", "to", "make", "data", "for", "this", "task" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L74-L129
train
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.encode_events
def encode_events(self, duration, events, values, dtype=np.bool): '''Encode labeled events as a time-series matrix. Parameters ---------- duration : number The duration of the track events : ndarray, shape=(n,) Time index of the events values : ...
python
def encode_events(self, duration, events, values, dtype=np.bool): '''Encode labeled events as a time-series matrix. Parameters ---------- duration : number The duration of the track events : ndarray, shape=(n,) Time index of the events values : ...
[ "def", "encode_events", "(", "self", ",", "duration", ",", "events", ",", "values", ",", "dtype", "=", "np", ".", "bool", ")", ":", "frames", "=", "time_to_frames", "(", "events", ",", "sr", "=", "self", ".", "sr", ",", "hop_length", "=", "self", "."...
Encode labeled events as a time-series matrix. Parameters ---------- duration : number The duration of the track events : ndarray, shape=(n,) Time index of the events values : ndarray, shape=(n, m) Values array. Must have the same first ind...
[ "Encode", "labeled", "events", "as", "a", "time", "-", "series", "matrix", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L131-L170
train
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.encode_intervals
def encode_intervals(self, duration, intervals, values, dtype=np.bool, multi=True, fill=None): '''Encode labeled intervals as a time-series matrix. Parameters ---------- duration : number The duration (in frames) of the track intervals : np....
python
def encode_intervals(self, duration, intervals, values, dtype=np.bool, multi=True, fill=None): '''Encode labeled intervals as a time-series matrix. Parameters ---------- duration : number The duration (in frames) of the track intervals : np....
[ "def", "encode_intervals", "(", "self", ",", "duration", ",", "intervals", ",", "values", ",", "dtype", "=", "np", ".", "bool", ",", "multi", "=", "True", ",", "fill", "=", "None", ")", ":", "if", "fill", "is", "None", ":", "fill", "=", "fill_value",...
Encode labeled intervals as a time-series matrix. Parameters ---------- duration : number The duration (in frames) of the track intervals : np.ndarray, shape=(n, 2) The list of intervals values : np.ndarray, shape=(n, m) The (encoded) values...
[ "Encode", "labeled", "intervals", "as", "a", "time", "-", "series", "matrix", "." ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L172-L230
train
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.decode_events
def decode_events(self, encoded, transition=None, p_state=None, p_init=None): '''Decode labeled events into (time, value) pairs Real-valued inputs are thresholded at 0.5. Optionally, viterbi decoding can be applied to each event class. Parameters ---------- encoded : n...
python
def decode_events(self, encoded, transition=None, p_state=None, p_init=None): '''Decode labeled events into (time, value) pairs Real-valued inputs are thresholded at 0.5. Optionally, viterbi decoding can be applied to each event class. Parameters ---------- encoded : n...
[ "def", "decode_events", "(", "self", ",", "encoded", ",", "transition", "=", "None", ",", "p_state", "=", "None", ",", "p_init", "=", "None", ")", ":", "if", "np", ".", "isrealobj", "(", "encoded", ")", ":", "if", "transition", "is", "None", ":", "en...
Decode labeled events into (time, value) pairs Real-valued inputs are thresholded at 0.5. Optionally, viterbi decoding can be applied to each event class. Parameters ---------- encoded : np.ndarray, shape=(n_frames, m) Frame-level annotation encodings as produced b...
[ "Decode", "labeled", "events", "into", "(", "time", "value", ")", "pairs" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L232-L276
train
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.decode_intervals
def decode_intervals(self, encoded, duration=None, multi=True, sparse=False, transition=None, p_state=None, p_init=None): '''Decode labeled intervals into (start, end, value) triples Parameters ---------- encoded : np.ndarray, shape=(n_frames, m) Fra...
python
def decode_intervals(self, encoded, duration=None, multi=True, sparse=False, transition=None, p_state=None, p_init=None): '''Decode labeled intervals into (start, end, value) triples Parameters ---------- encoded : np.ndarray, shape=(n_frames, m) Fra...
[ "def", "decode_intervals", "(", "self", ",", "encoded", ",", "duration", "=", "None", ",", "multi", "=", "True", ",", "sparse", "=", "False", ",", "transition", "=", "None", ",", "p_state", "=", "None", ",", "p_init", "=", "None", ")", ":", "if", "np...
Decode labeled intervals into (start, end, value) triples Parameters ---------- encoded : np.ndarray, shape=(n_frames, m) Frame-level annotation encodings as produced by ``encode_intervals`` duration : None or float > 0 The max duration of the annota...
[ "Decode", "labeled", "intervals", "into", "(", "start", "end", "value", ")", "triples" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L278-L373
train
bmcfee/pumpp
pumpp/feature/base.py
FeatureExtractor.transform
def transform(self, y, sr): '''Transform an audio signal Parameters ---------- y : np.ndarray The audio signal sr : number > 0 The native sampling rate of y Returns ------- dict Data dictionary containing features ext...
python
def transform(self, y, sr): '''Transform an audio signal Parameters ---------- y : np.ndarray The audio signal sr : number > 0 The native sampling rate of y Returns ------- dict Data dictionary containing features ext...
[ "def", "transform", "(", "self", ",", "y", ",", "sr", ")", ":", "if", "sr", "!=", "self", ".", "sr", ":", "y", "=", "resample", "(", "y", ",", "sr", ",", "self", ".", "sr", ")", "return", "self", ".", "merge", "(", "[", "self", ".", "transfor...
Transform an audio signal Parameters ---------- y : np.ndarray The audio signal sr : number > 0 The native sampling rate of y Returns ------- dict Data dictionary containing features extracted from y See Also ...
[ "Transform", "an", "audio", "signal" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/base.py#L71-L94
train
bmcfee/pumpp
pumpp/feature/base.py
FeatureExtractor.phase_diff
def phase_diff(self, phase): '''Compute the phase differential along a given axis Parameters ---------- phase : np.ndarray Input phase (in radians) Returns ------- dphase : np.ndarray like `phase` The phase differential. ''' ...
python
def phase_diff(self, phase): '''Compute the phase differential along a given axis Parameters ---------- phase : np.ndarray Input phase (in radians) Returns ------- dphase : np.ndarray like `phase` The phase differential. ''' ...
[ "def", "phase_diff", "(", "self", ",", "phase", ")", ":", "if", "self", ".", "conv", "is", "None", ":", "axis", "=", "0", "elif", "self", ".", "conv", "in", "(", "'channels_last'", ",", "'tf'", ")", ":", "axis", "=", "0", "elif", "self", ".", "co...
Compute the phase differential along a given axis Parameters ---------- phase : np.ndarray Input phase (in radians) Returns ------- dphase : np.ndarray like `phase` The phase differential.
[ "Compute", "the", "phase", "differential", "along", "a", "given", "axis" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/base.py#L99-L130
train
bmcfee/pumpp
pumpp/feature/base.py
FeatureExtractor.layers
def layers(self): '''Construct Keras input layers for the given transformer Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding field keys. ''' from keras.layers import Input ...
python
def layers(self): '''Construct Keras input layers for the given transformer Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding field keys. ''' from keras.layers import Input ...
[ "def", "layers", "(", "self", ")", ":", "from", "keras", ".", "layers", "import", "Input", "L", "=", "dict", "(", ")", "for", "key", "in", "self", ".", "fields", ":", "L", "[", "key", "]", "=", "Input", "(", "name", "=", "key", ",", "shape", "=...
Construct Keras input layers for the given transformer Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding field keys.
[ "Construct", "Keras", "input", "layers", "for", "the", "given", "transformer" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/base.py#L132-L149
train
bmcfee/pumpp
pumpp/feature/base.py
FeatureExtractor.n_frames
def n_frames(self, duration): '''Get the number of frames for a given duration Parameters ---------- duration : number >= 0 The duration, in seconds Returns ------- n_frames : int >= 0 The number of frames at this extractor's sampling rat...
python
def n_frames(self, duration): '''Get the number of frames for a given duration Parameters ---------- duration : number >= 0 The duration, in seconds Returns ------- n_frames : int >= 0 The number of frames at this extractor's sampling rat...
[ "def", "n_frames", "(", "self", ",", "duration", ")", ":", "return", "int", "(", "time_to_frames", "(", "duration", ",", "sr", "=", "self", ".", "sr", ",", "hop_length", "=", "self", ".", "hop_length", ")", ")" ]
Get the number of frames for a given duration Parameters ---------- duration : number >= 0 The duration, in seconds Returns ------- n_frames : int >= 0 The number of frames at this extractor's sampling rate and hop length
[ "Get", "the", "number", "of", "frames", "for", "a", "given", "duration" ]
06a17b888271dd1f6cd41bddb22b0eb04d494056
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/base.py#L151-L167
train
novopl/peltak
src/peltak/extra/gitflow/logic/release.py
start
def start(component, exact): # type: (str, str) -> None """ Create a new release branch. Args: component (str): Version component to bump when creating the release. Can be *major*, *minor* or *patch*. exact (str): The exact version to set for the release....
python
def start(component, exact): # type: (str, str) -> None """ Create a new release branch. Args: component (str): Version component to bump when creating the release. Can be *major*, *minor* or *patch*. exact (str): The exact version to set for the release....
[ "def", "start", "(", "component", ",", "exact", ")", ":", "# type: (str, str) -> None", "version_file", "=", "conf", ".", "get_path", "(", "'version_file'", ",", "'VERSION'", ")", "develop", "=", "conf", ".", "get", "(", "'git.devel_branch'", ",", "'develop'", ...
Create a new release branch. Args: component (str): Version component to bump when creating the release. Can be *major*, *minor* or *patch*. exact (str): The exact version to set for the release. Overrides the component argument. This allows to re-rel...
[ "Create", "a", "new", "release", "branch", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/release.py#L34-L78
train
novopl/peltak
src/peltak/extra/gitflow/logic/release.py
tag
def tag(message): # type: () -> None """ Tag the current commit with the current version. """ release_ver = versioning.current() message = message or 'v{} release'.format(release_ver) with conf.within_proj_dir(): log.info("Creating release tag") git.tag( author=git.lates...
python
def tag(message): # type: () -> None """ Tag the current commit with the current version. """ release_ver = versioning.current() message = message or 'v{} release'.format(release_ver) with conf.within_proj_dir(): log.info("Creating release tag") git.tag( author=git.lates...
[ "def", "tag", "(", "message", ")", ":", "# type: () -> None", "release_ver", "=", "versioning", ".", "current", "(", ")", "message", "=", "message", "or", "'v{} release'", ".", "format", "(", "release_ver", ")", "with", "conf", ".", "within_proj_dir", "(", "...
Tag the current commit with the current version.
[ "Tag", "the", "current", "commit", "with", "the", "current", "version", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/release.py#L144-L156
train
novopl/peltak
src/peltak/logic/lint.py
lint
def lint(exclude, skip_untracked, commit_only): # type: (List[str], bool, bool) -> None """ Lint python files. Args: exclude (list[str]): A list of glob string patterns to test against. If the file/path matches any of those patters, it will be filtered out. skip_untr...
python
def lint(exclude, skip_untracked, commit_only): # type: (List[str], bool, bool) -> None """ Lint python files. Args: exclude (list[str]): A list of glob string patterns to test against. If the file/path matches any of those patters, it will be filtered out. skip_untr...
[ "def", "lint", "(", "exclude", ",", "skip_untracked", ",", "commit_only", ")", ":", "# type: (List[str], bool, bool) -> None", "exclude", "=", "list", "(", "exclude", ")", "+", "conf", ".", "get", "(", "'lint.exclude'", ",", "[", "]", ")", "runner", "=", "Li...
Lint python files. Args: exclude (list[str]): A list of glob string patterns to test against. If the file/path matches any of those patters, it will be filtered out. skip_untracked (bool): If set to **True** it will skip all files not tracked by git. comm...
[ "Lint", "python", "files", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L41-L58
train
novopl/peltak
src/peltak/logic/lint.py
tool
def tool(name): # type: (str) -> FunctionType """ Decorator for defining lint tools. Args: name (str): The name of the tool. This name will be used to identify the tool in `pelconf.yaml`. """ global g_tools def decorator(fn): # pylint: disable=missing-docstring...
python
def tool(name): # type: (str) -> FunctionType """ Decorator for defining lint tools. Args: name (str): The name of the tool. This name will be used to identify the tool in `pelconf.yaml`. """ global g_tools def decorator(fn): # pylint: disable=missing-docstring...
[ "def", "tool", "(", "name", ")", ":", "# type: (str) -> FunctionType", "global", "g_tools", "def", "decorator", "(", "fn", ")", ":", "# pylint: disable=missing-docstring", "# type: (FunctionType) -> FunctionType", "g_tools", "[", "name", "]", "=", "fn", "return", "fn"...
Decorator for defining lint tools. Args: name (str): The name of the tool. This name will be used to identify the tool in `pelconf.yaml`.
[ "Decorator", "for", "defining", "lint", "tools", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L61-L77
train
novopl/peltak
src/peltak/logic/lint.py
pep8_check
def pep8_check(files): # type: (List[str]) -> int """ Run code checks using pep8. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. pep8 tool is **very** fast. Especially compared to pylint an...
python
def pep8_check(files): # type: (List[str]) -> int """ Run code checks using pep8. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. pep8 tool is **very** fast. Especially compared to pylint an...
[ "def", "pep8_check", "(", "files", ")", ":", "# type: (List[str]) -> int", "files", "=", "fs", ".", "wrap_paths", "(", "files", ")", "cfg_path", "=", "conf", ".", "get_path", "(", "'lint.pep8_cfg'", ",", "'ops/tools/pep8.ini'", ")", "pep8_cmd", "=", "'pep8 --con...
Run code checks using pep8. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. pep8 tool is **very** fast. Especially compared to pylint and the bigger the code base the bigger the difference. If y...
[ "Run", "code", "checks", "using", "pep8", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L208-L229
train
novopl/peltak
src/peltak/logic/lint.py
pylint_check
def pylint_check(files): # type: (List[str]) -> int """ Run code checks using pylint. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. """ files = fs.wrap_paths(files) cfg_path = conf....
python
def pylint_check(files): # type: (List[str]) -> int """ Run code checks using pylint. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. """ files = fs.wrap_paths(files) cfg_path = conf....
[ "def", "pylint_check", "(", "files", ")", ":", "# type: (List[str]) -> int", "files", "=", "fs", ".", "wrap_paths", "(", "files", ")", "cfg_path", "=", "conf", ".", "get_path", "(", "'lint.pylint_cfg'", ",", "'ops/tools/pylint.ini'", ")", "pylint_cmd", "=", "'py...
Run code checks using pylint. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise.
[ "Run", "code", "checks", "using", "pylint", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L233-L248
train
novopl/peltak
src/peltak/logic/lint.py
LintRunner.run
def run(self): # type: () -> bool """ Run all linters and report results. Returns: bool: **True** if all checks were successful, **False** otherwise. """ with util.timed_block() as t: files = self._collect_files() log.info("Collected <33>{} <32>f...
python
def run(self): # type: () -> bool """ Run all linters and report results. Returns: bool: **True** if all checks were successful, **False** otherwise. """ with util.timed_block() as t: files = self._collect_files() log.info("Collected <33>{} <32>f...
[ "def", "run", "(", "self", ")", ":", "# type: () -> bool", "with", "util", ".", "timed_block", "(", ")", "as", "t", ":", "files", "=", "self", ".", "_collect_files", "(", ")", "log", ".", "info", "(", "\"Collected <33>{} <32>files in <33>{}s\"", ".", "format...
Run all linters and report results. Returns: bool: **True** if all checks were successful, **False** otherwise.
[ "Run", "all", "linters", "and", "report", "results", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L118-L152
train
dacker-team/pyzure
pyzure/send/send.py
send_to_azure
def send_to_azure(instance, data, replace=True, types=None, primary_key=(), sub_commit=True): """ data = { "table_name" : 'name_of_the_azure_schema' + '.' + 'name_of_the_azure_table' #Must already exist, "columns_name" : [first_column_name,second_column_name,...,last_column_name], "row...
python
def send_to_azure(instance, data, replace=True, types=None, primary_key=(), sub_commit=True): """ data = { "table_name" : 'name_of_the_azure_schema' + '.' + 'name_of_the_azure_table' #Must already exist, "columns_name" : [first_column_name,second_column_name,...,last_column_name], "row...
[ "def", "send_to_azure", "(", "instance", ",", "data", ",", "replace", "=", "True", ",", "types", "=", "None", ",", "primary_key", "=", "(", ")", ",", "sub_commit", "=", "True", ")", ":", "# Time initialization", "start", "=", "datetime", ".", "datetime", ...
data = { "table_name" : 'name_of_the_azure_schema' + '.' + 'name_of_the_azure_table' #Must already exist, "columns_name" : [first_column_name,second_column_name,...,last_column_name], "rows" : [[first_raw_value,second_raw_value,...,last_raw_value],...] }
[ "data", "=", "{", "table_name", ":", "name_of_the_azure_schema", "+", ".", "+", "name_of_the_azure_table", "#Must", "already", "exist", "columns_name", ":", "[", "first_column_name", "second_column_name", "...", "last_column_name", "]", "rows", ":", "[[", "first_raw_v...
1e6d202f91ca0f080635adc470d9d18585056d53
https://github.com/dacker-team/pyzure/blob/1e6d202f91ca0f080635adc470d9d18585056d53/pyzure/send/send.py#L15-L121
train
cons3rt/pycons3rt
pycons3rt/dyndict.py
getdict
def getdict(source): """Returns a standard python Dict with computed values from the DynDict :param source: (DynDict) input :return: (dict) Containing computed values """ std_dict = {} for var, val in source.iteritems(): std_dict[var] = source[var] return std_dict
python
def getdict(source): """Returns a standard python Dict with computed values from the DynDict :param source: (DynDict) input :return: (dict) Containing computed values """ std_dict = {} for var, val in source.iteritems(): std_dict[var] = source[var] return std_dict
[ "def", "getdict", "(", "source", ")", ":", "std_dict", "=", "{", "}", "for", "var", ",", "val", "in", "source", ".", "iteritems", "(", ")", ":", "std_dict", "[", "var", "]", "=", "source", "[", "var", "]", "return", "std_dict" ]
Returns a standard python Dict with computed values from the DynDict :param source: (DynDict) input :return: (dict) Containing computed values
[ "Returns", "a", "standard", "python", "Dict", "with", "computed", "values", "from", "the", "DynDict", ":", "param", "source", ":", "(", "DynDict", ")", "input", ":", "return", ":", "(", "dict", ")", "Containing", "computed", "values" ]
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/dyndict.py#L20-L29
train
Varkal/chuda
chuda/plugins.py
Plugin.enrich_app
def enrich_app(self, name, value): ''' Add a new property to the app (with setattr) Args: name (str): the name of the new property value (any): the value of the new property ''' #Method shouldn't be added: https://stackoverflow.com/a/28060251/3042398 ...
python
def enrich_app(self, name, value): ''' Add a new property to the app (with setattr) Args: name (str): the name of the new property value (any): the value of the new property ''' #Method shouldn't be added: https://stackoverflow.com/a/28060251/3042398 ...
[ "def", "enrich_app", "(", "self", ",", "name", ",", "value", ")", ":", "#Method shouldn't be added: https://stackoverflow.com/a/28060251/3042398", "if", "type", "(", "value", ")", "==", "type", "(", "self", ".", "enrich_app", ")", ":", "raise", "ValueError", "(",...
Add a new property to the app (with setattr) Args: name (str): the name of the new property value (any): the value of the new property
[ "Add", "a", "new", "property", "to", "the", "app", "(", "with", "setattr", ")" ]
0d93b716dede35231c21be97bcc19a656655983f
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/plugins.py#L21-L33
train
Vital-Fernandez/dazer
bin/lib/Math_Libraries/fitting_methods.py
linfit
def linfit(x_true, y, sigmay=None, relsigma=True, cov=False, chisq=False, residuals=False): """ Least squares linear fit. Fit a straight line `f(x_true) = a + bx` to points `(x_true, y)`. Returns coefficients `a` and `b` that minimize the squared error. Parameters ---------- x_t...
python
def linfit(x_true, y, sigmay=None, relsigma=True, cov=False, chisq=False, residuals=False): """ Least squares linear fit. Fit a straight line `f(x_true) = a + bx` to points `(x_true, y)`. Returns coefficients `a` and `b` that minimize the squared error. Parameters ---------- x_t...
[ "def", "linfit", "(", "x_true", ",", "y", ",", "sigmay", "=", "None", ",", "relsigma", "=", "True", ",", "cov", "=", "False", ",", "chisq", "=", "False", ",", "residuals", "=", "False", ")", ":", "x_true", "=", "asarray", "(", "x_true", ")", "y", ...
Least squares linear fit. Fit a straight line `f(x_true) = a + bx` to points `(x_true, y)`. Returns coefficients `a` and `b` that minimize the squared error. Parameters ---------- x_true : array_like one dimensional array of `x_true` data with `n`>2 data points. y : array_li...
[ "Least", "squares", "linear", "fit", ".", "Fit", "a", "straight", "line", "f", "(", "x_true", ")", "=", "a", "+", "bx", "to", "points", "(", "x_true", "y", ")", ".", "Returns", "coefficients", "a", "and", "b", "that", "minimize", "the", "squared", "e...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/fitting_methods.py#L53-L305
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.set_base_url
def set_base_url(self, platform: str = "prod"): """Set Isogeo base URLs according to platform. :param str platform: platform to use. Options: * prod [DEFAULT] * qa * int """ platform = platform.lower() self.platform = platform if platform =...
python
def set_base_url(self, platform: str = "prod"): """Set Isogeo base URLs according to platform. :param str platform: platform to use. Options: * prod [DEFAULT] * qa * int """ platform = platform.lower() self.platform = platform if platform =...
[ "def", "set_base_url", "(", "self", ",", "platform", ":", "str", "=", "\"prod\"", ")", ":", "platform", "=", "platform", ".", "lower", "(", ")", "self", ".", "platform", "=", "platform", "if", "platform", "==", "\"prod\"", ":", "ssl", "=", "True", "log...
Set Isogeo base URLs according to platform. :param str platform: platform to use. Options: * prod [DEFAULT] * qa * int
[ "Set", "Isogeo", "base", "URLs", "according", "to", "platform", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L121-L155
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.convert_uuid
def convert_uuid(self, in_uuid: str = str, mode: bool = 0): """Convert a metadata UUID to its URI equivalent. And conversely. :param str in_uuid: UUID or URI to convert :param int mode: conversion direction. Options: * 0 to HEX * 1 to URN (RFC4122) * 2 to URN (Iso...
python
def convert_uuid(self, in_uuid: str = str, mode: bool = 0): """Convert a metadata UUID to its URI equivalent. And conversely. :param str in_uuid: UUID or URI to convert :param int mode: conversion direction. Options: * 0 to HEX * 1 to URN (RFC4122) * 2 to URN (Iso...
[ "def", "convert_uuid", "(", "self", ",", "in_uuid", ":", "str", "=", "str", ",", "mode", ":", "bool", "=", "0", ")", ":", "# parameters check", "if", "not", "isinstance", "(", "in_uuid", ",", "str", ")", ":", "raise", "TypeError", "(", "\"'in_uuid' expec...
Convert a metadata UUID to its URI equivalent. And conversely. :param str in_uuid: UUID or URI to convert :param int mode: conversion direction. Options: * 0 to HEX * 1 to URN (RFC4122) * 2 to URN (Isogeo specific style)
[ "Convert", "a", "metadata", "UUID", "to", "its", "URI", "equivalent", ".", "And", "conversely", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L157-L196
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.encoded_words_to_text
def encoded_words_to_text(self, in_encoded_words: str): """Pull out the character set, encoding, and encoded text from the input encoded words. Next, it decodes the encoded words into a byte string, using either the quopri module or base64 module as determined by the encoding. Finally, i...
python
def encoded_words_to_text(self, in_encoded_words: str): """Pull out the character set, encoding, and encoded text from the input encoded words. Next, it decodes the encoded words into a byte string, using either the quopri module or base64 module as determined by the encoding. Finally, i...
[ "def", "encoded_words_to_text", "(", "self", ",", "in_encoded_words", ":", "str", ")", ":", "# handle RFC2047 quoting", "if", "'\"'", "in", "in_encoded_words", ":", "in_encoded_words", "=", "in_encoded_words", ".", "strip", "(", "'\"'", ")", "# regex", "encoded_word...
Pull out the character set, encoding, and encoded text from the input encoded words. Next, it decodes the encoded words into a byte string, using either the quopri module or base64 module as determined by the encoding. Finally, it decodes the byte string using the character set and retur...
[ "Pull", "out", "the", "character", "set", "encoding", "and", "encoded", "text", "from", "the", "input", "encoded", "words", ".", "Next", "it", "decodes", "the", "encoded", "words", "into", "a", "byte", "string", "using", "either", "the", "quopri", "module", ...
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L198-L231
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.get_isogeo_version
def get_isogeo_version(self, component: str = "api", prot: str = "https"): """Get Isogeo components versions. Authentication not required. :param str component: which platform component. Options: * api [default] * db * app """ # which component if...
python
def get_isogeo_version(self, component: str = "api", prot: str = "https"): """Get Isogeo components versions. Authentication not required. :param str component: which platform component. Options: * api [default] * db * app """ # which component if...
[ "def", "get_isogeo_version", "(", "self", ",", "component", ":", "str", "=", "\"api\"", ",", "prot", ":", "str", "=", "\"https\"", ")", ":", "# which component", "if", "component", "==", "\"api\"", ":", "version_url", "=", "\"{}://v1.{}.isogeo.com/about\"", ".",...
Get Isogeo components versions. Authentication not required. :param str component: which platform component. Options: * api [default] * db * app
[ "Get", "Isogeo", "components", "versions", ".", "Authentication", "not", "required", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L233-L266
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.get_edit_url
def get_edit_url( self, md_id: str = None, md_type: str = None, owner_id: str = None, tab: str = "identification", ): """Constructs the edition URL of a metadata. :param str md_id: metadata/resource UUID :param str owner_id: owner UUID :param ...
python
def get_edit_url( self, md_id: str = None, md_type: str = None, owner_id: str = None, tab: str = "identification", ): """Constructs the edition URL of a metadata. :param str md_id: metadata/resource UUID :param str owner_id: owner UUID :param ...
[ "def", "get_edit_url", "(", "self", ",", "md_id", ":", "str", "=", "None", ",", "md_type", ":", "str", "=", "None", ",", "owner_id", ":", "str", "=", "None", ",", "tab", ":", "str", "=", "\"identification\"", ",", ")", ":", "# checks inputs", "if", "...
Constructs the edition URL of a metadata. :param str md_id: metadata/resource UUID :param str owner_id: owner UUID :param str tab: target tab in the web form
[ "Constructs", "the", "edition", "URL", "of", "a", "metadata", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L269-L295
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.get_view_url
def get_view_url(self, webapp: str = "oc", **kwargs): """Constructs the view URL of a metadata. :param str webapp: web app destination :param dict kwargs: web app specific parameters. For example see WEBAPPS """ # build wbeapp URL depending on choosen webapp if webapp in...
python
def get_view_url(self, webapp: str = "oc", **kwargs): """Constructs the view URL of a metadata. :param str webapp: web app destination :param dict kwargs: web app specific parameters. For example see WEBAPPS """ # build wbeapp URL depending on choosen webapp if webapp in...
[ "def", "get_view_url", "(", "self", ",", "webapp", ":", "str", "=", "\"oc\"", ",", "*", "*", "kwargs", ")", ":", "# build wbeapp URL depending on choosen webapp", "if", "webapp", "in", "self", ".", "WEBAPPS", ":", "webapp_args", "=", "self", ".", "WEBAPPS", ...
Constructs the view URL of a metadata. :param str webapp: web app destination :param dict kwargs: web app specific parameters. For example see WEBAPPS
[ "Constructs", "the", "view", "URL", "of", "a", "metadata", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L297-L323
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.register_webapp
def register_webapp(self, webapp_name: str, webapp_args: list, webapp_url: str): """Register a new WEBAPP to use with the view URL builder. :param str webapp_name: name of the web app to register :param list webapp_args: dynamic arguments to complete the URL. Typically 'md_id'. ...
python
def register_webapp(self, webapp_name: str, webapp_args: list, webapp_url: str): """Register a new WEBAPP to use with the view URL builder. :param str webapp_name: name of the web app to register :param list webapp_args: dynamic arguments to complete the URL. Typically 'md_id'. ...
[ "def", "register_webapp", "(", "self", ",", "webapp_name", ":", "str", ",", "webapp_args", ":", "list", ",", "webapp_url", ":", "str", ")", ":", "# check parameters", "for", "arg", "in", "webapp_args", ":", "if", "arg", "not", "in", "webapp_url", ":", "rai...
Register a new WEBAPP to use with the view URL builder. :param str webapp_name: name of the web app to register :param list webapp_args: dynamic arguments to complete the URL. Typically 'md_id'. :param str webapp_url: URL of the web app to register with args tags to replace. E...
[ "Register", "a", "new", "WEBAPP", "to", "use", "with", "the", "view", "URL", "builder", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L325-L345
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.get_url_base_from_url_token
def get_url_base_from_url_token( self, url_api_token: str = "https://id.api.isogeo.com/oauth/token" ): """Returns the Isogeo API root URL (which is not included into credentials file) from the token URL (which is always included). :param url_api_token str: url to Isogeo API ID token...
python
def get_url_base_from_url_token( self, url_api_token: str = "https://id.api.isogeo.com/oauth/token" ): """Returns the Isogeo API root URL (which is not included into credentials file) from the token URL (which is always included). :param url_api_token str: url to Isogeo API ID token...
[ "def", "get_url_base_from_url_token", "(", "self", ",", "url_api_token", ":", "str", "=", "\"https://id.api.isogeo.com/oauth/token\"", ")", ":", "in_parsed", "=", "urlparse", "(", "url_api_token", ")", "api_url_base", "=", "in_parsed", ".", "_replace", "(", "path", ...
Returns the Isogeo API root URL (which is not included into credentials file) from the token URL (which is always included). :param url_api_token str: url to Isogeo API ID token generator
[ "Returns", "the", "Isogeo", "API", "root", "URL", "(", "which", "is", "not", "included", "into", "credentials", "file", ")", "from", "the", "token", "URL", "(", "which", "is", "always", "included", ")", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L347-L359
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.pages_counter
def pages_counter(self, total: int, page_size: int = 100) -> int: """Simple helper to handle pagination. Returns the number of pages for a given number of results. :param int total: count of metadata in a search request :param int page_size: count of metadata to display in each page ...
python
def pages_counter(self, total: int, page_size: int = 100) -> int: """Simple helper to handle pagination. Returns the number of pages for a given number of results. :param int total: count of metadata in a search request :param int page_size: count of metadata to display in each page ...
[ "def", "pages_counter", "(", "self", ",", "total", ":", "int", ",", "page_size", ":", "int", "=", "100", ")", "->", "int", ":", "if", "total", "<=", "page_size", ":", "count_pages", "=", "1", "else", ":", "if", "(", "total", "%", "page_size", ")", ...
Simple helper to handle pagination. Returns the number of pages for a given number of results. :param int total: count of metadata in a search request :param int page_size: count of metadata to display in each page
[ "Simple", "helper", "to", "handle", "pagination", ".", "Returns", "the", "number", "of", "pages", "for", "a", "given", "number", "of", "results", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L362-L377
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.tags_to_dict
def tags_to_dict(self, tags=dict, prev_query=dict, duplicated: str = "rename"): """Reverse search tags dictionary to values as keys. Useful to populate filters comboboxes for example. :param dict tags: tags dictionary from a search request :param dict prev_query: query parameters return...
python
def tags_to_dict(self, tags=dict, prev_query=dict, duplicated: str = "rename"): """Reverse search tags dictionary to values as keys. Useful to populate filters comboboxes for example. :param dict tags: tags dictionary from a search request :param dict prev_query: query parameters return...
[ "def", "tags_to_dict", "(", "self", ",", "tags", "=", "dict", ",", "prev_query", "=", "dict", ",", "duplicated", ":", "str", "=", "\"rename\"", ")", ":", "# for rename option, get workgroups", "if", "duplicated", "==", "\"rename\"", ":", "wgs", "=", "{", "k"...
Reverse search tags dictionary to values as keys. Useful to populate filters comboboxes for example. :param dict tags: tags dictionary from a search request :param dict prev_query: query parameters returned after a search request. Typically `search.get("query")`. :param str duplicated: ...
[ "Reverse", "search", "tags", "dictionary", "to", "values", "as", "keys", ".", "Useful", "to", "populate", "filters", "comboboxes", "for", "example", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L379-L634
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.share_extender
def share_extender(self, share: dict, results_filtered: dict): """Extend share model with additional informations. :param dict share: share returned by API :param dict results_filtered: filtered search result """ # add share administration URL creator_id = share.get("_cr...
python
def share_extender(self, share: dict, results_filtered: dict): """Extend share model with additional informations. :param dict share: share returned by API :param dict results_filtered: filtered search result """ # add share administration URL creator_id = share.get("_cr...
[ "def", "share_extender", "(", "self", ",", "share", ":", "dict", ",", "results_filtered", ":", "dict", ")", ":", "# add share administration URL", "creator_id", "=", "share", ".", "get", "(", "\"_creator\"", ")", ".", "get", "(", "\"_tag\"", ")", "[", "6", ...
Extend share model with additional informations. :param dict share: share returned by API :param dict results_filtered: filtered search result
[ "Extend", "share", "model", "with", "additional", "informations", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L637-L659
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/utils.py
IsogeoUtils.credentials_loader
def credentials_loader(self, in_credentials: str = "client_secrets.json") -> dict: """Loads API credentials from a file, JSON or INI. :param str in_credentials: path to the credentials file. By default, look for a client_secrets.json file. """ accepted_extensions = (".ini", "....
python
def credentials_loader(self, in_credentials: str = "client_secrets.json") -> dict: """Loads API credentials from a file, JSON or INI. :param str in_credentials: path to the credentials file. By default, look for a client_secrets.json file. """ accepted_extensions = (".ini", "....
[ "def", "credentials_loader", "(", "self", ",", "in_credentials", ":", "str", "=", "\"client_secrets.json\"", ")", "->", "dict", ":", "accepted_extensions", "=", "(", "\".ini\"", ",", "\".json\"", ")", "# checks", "if", "not", "path", ".", "isfile", "(", "in_cr...
Loads API credentials from a file, JSON or INI. :param str in_credentials: path to the credentials file. By default, look for a client_secrets.json file.
[ "Loads", "API", "credentials", "from", "a", "file", "JSON", "or", "INI", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/utils.py#L662-L751
train
novopl/peltak
src/peltak/extra/pypi/commands.py
configure
def configure(username, password): # type: (str, str) -> None """ Generate .pypirc config with the given credentials. Example: $ peltak pypi configure my_pypi_user my_pypi_pass """ from peltak.extra.pypi import logic logic.gen_pypirc(username, password)
python
def configure(username, password): # type: (str, str) -> None """ Generate .pypirc config with the given credentials. Example: $ peltak pypi configure my_pypi_user my_pypi_pass """ from peltak.extra.pypi import logic logic.gen_pypirc(username, password)
[ "def", "configure", "(", "username", ",", "password", ")", ":", "# type: (str, str) -> None", "from", "peltak", ".", "extra", ".", "pypi", "import", "logic", "logic", ".", "gen_pypirc", "(", "username", ",", "password", ")" ]
Generate .pypirc config with the given credentials. Example: $ peltak pypi configure my_pypi_user my_pypi_pass
[ "Generate", ".", "pypirc", "config", "with", "the", "given", "credentials", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/pypi/commands.py#L58-L69
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/translator.py
IsogeoTranslator.tr
def tr(self, subdomain: str, string_to_translate: str = "") -> str: """Returns translation of string passed. :param str subdomain: subpart of strings dictionary. Must be one of self.translations.keys() i.e. 'restrictions' :param str string_to_translate: string you want to translate ...
python
def tr(self, subdomain: str, string_to_translate: str = "") -> str: """Returns translation of string passed. :param str subdomain: subpart of strings dictionary. Must be one of self.translations.keys() i.e. 'restrictions' :param str string_to_translate: string you want to translate ...
[ "def", "tr", "(", "self", ",", "subdomain", ":", "str", ",", "string_to_translate", ":", "str", "=", "\"\"", ")", "->", "str", ":", "if", "subdomain", "not", "in", "self", ".", "translations", ".", "keys", "(", ")", ":", "raise", "ValueError", "(", "...
Returns translation of string passed. :param str subdomain: subpart of strings dictionary. Must be one of self.translations.keys() i.e. 'restrictions' :param str string_to_translate: string you want to translate
[ "Returns", "translation", "of", "string", "passed", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/translator.py#L197-L217
train
praekeltfoundation/seed-identity-store
identities/models.py
optout_saved
def optout_saved(sender, instance, **kwargs): """ This is a duplicte of the view code for DRF to stop future internal Django implementations breaking. """ if instance.identity is None: # look up using the address_type and address identities = Identity.objects.filter_by_addr( ...
python
def optout_saved(sender, instance, **kwargs): """ This is a duplicte of the view code for DRF to stop future internal Django implementations breaking. """ if instance.identity is None: # look up using the address_type and address identities = Identity.objects.filter_by_addr( ...
[ "def", "optout_saved", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "if", "instance", ".", "identity", "is", "None", ":", "# look up using the address_type and address", "identities", "=", "Identity", ".", "objects", ".", "filter_by_addr", ...
This is a duplicte of the view code for DRF to stop future internal Django implementations breaking.
[ "This", "is", "a", "duplicte", "of", "the", "view", "code", "for", "DRF", "to", "stop", "future", "internal", "Django", "implementations", "breaking", "." ]
194e5756b5a74ebce9798c390de958cf5305b105
https://github.com/praekeltfoundation/seed-identity-store/blob/194e5756b5a74ebce9798c390de958cf5305b105/identities/models.py#L397-L408
train
cons3rt/pycons3rt
pycons3rt/awsapi/ec2util.py
get_ec2_client
def get_ec2_client(region_name=None, aws_access_key_id=None, aws_secret_access_key=None): """Gets an EC2 client :return: boto3.client object :raises: AWSAPIError """ log = logging.getLogger(mod_logger + '.get_ec2_client') # Connect to EC2 API try: client = boto3.client('ec2', region...
python
def get_ec2_client(region_name=None, aws_access_key_id=None, aws_secret_access_key=None): """Gets an EC2 client :return: boto3.client object :raises: AWSAPIError """ log = logging.getLogger(mod_logger + '.get_ec2_client') # Connect to EC2 API try: client = boto3.client('ec2', region...
[ "def", "get_ec2_client", "(", "region_name", "=", "None", ",", "aws_access_key_id", "=", "None", ",", "aws_secret_access_key", "=", "None", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.get_ec2_client'", ")", "# Connect to EC2 API",...
Gets an EC2 client :return: boto3.client object :raises: AWSAPIError
[ "Gets", "an", "EC2", "client" ]
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/awsapi/ec2util.py#L954-L973
train
cons3rt/pycons3rt
pycons3rt/awsapi/ec2util.py
EC2Util.get_vpc_id
def get_vpc_id(self): """Gets the VPC ID for this EC2 instance :return: String instance ID or None """ log = logging.getLogger(self.cls_logger + '.get_vpc_id') # Exit if not running on AWS if not self.is_aws: log.info('This machine is not running in AWS, exi...
python
def get_vpc_id(self): """Gets the VPC ID for this EC2 instance :return: String instance ID or None """ log = logging.getLogger(self.cls_logger + '.get_vpc_id') # Exit if not running on AWS if not self.is_aws: log.info('This machine is not running in AWS, exi...
[ "def", "get_vpc_id", "(", "self", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.get_vpc_id'", ")", "# Exit if not running on AWS", "if", "not", "self", ".", "is_aws", ":", "log", ".", "info", "(", "'This machine i...
Gets the VPC ID for this EC2 instance :return: String instance ID or None
[ "Gets", "the", "VPC", "ID", "for", "this", "EC2", "instance" ]
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/awsapi/ec2util.py#L73-L107
train
cons3rt/pycons3rt
pycons3rt/awsapi/ec2util.py
EC2Util.get_eni_id
def get_eni_id(self, interface=1): """Given an interface number, gets the AWS elastic network interface associated with the interface. :param interface: Integer associated to the interface/device number :return: String Elastic Network Interface ID or None if not found :raises OS...
python
def get_eni_id(self, interface=1): """Given an interface number, gets the AWS elastic network interface associated with the interface. :param interface: Integer associated to the interface/device number :return: String Elastic Network Interface ID or None if not found :raises OS...
[ "def", "get_eni_id", "(", "self", ",", "interface", "=", "1", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.get_eni_id'", ")", "# Get the instance-id", "if", "self", ".", "instance_id", "is", "None", ":", "msg",...
Given an interface number, gets the AWS elastic network interface associated with the interface. :param interface: Integer associated to the interface/device number :return: String Elastic Network Interface ID or None if not found :raises OSError, AWSAPIError, EC2UtilError
[ "Given", "an", "interface", "number", "gets", "the", "AWS", "elastic", "network", "interface", "associated", "with", "the", "interface", "." ]
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/awsapi/ec2util.py#L109-L156
train
cons3rt/pycons3rt
pycons3rt/awsapi/ec2util.py
EC2Util.add_secondary_ip
def add_secondary_ip(self, ip_address, interface=1): """Adds an IP address as a secondary IP address :param ip_address: String IP address to add as a secondary IP :param interface: Integer associated to the interface/device number :return: None :raises: AWSAPIError, EC2UtilError...
python
def add_secondary_ip(self, ip_address, interface=1): """Adds an IP address as a secondary IP address :param ip_address: String IP address to add as a secondary IP :param interface: Integer associated to the interface/device number :return: None :raises: AWSAPIError, EC2UtilError...
[ "def", "add_secondary_ip", "(", "self", ",", "ip_address", ",", "interface", "=", "1", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.add_secondary_ip'", ")", "# Get the ENI ID", "eni_id", "=", "self", ".", "get_en...
Adds an IP address as a secondary IP address :param ip_address: String IP address to add as a secondary IP :param interface: Integer associated to the interface/device number :return: None :raises: AWSAPIError, EC2UtilError
[ "Adds", "an", "IP", "address", "as", "a", "secondary", "IP", "address" ]
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/awsapi/ec2util.py#L158-L196
train
cons3rt/pycons3rt
pycons3rt/awsapi/ec2util.py
EC2Util.associate_elastic_ip
def associate_elastic_ip(self, allocation_id, interface=1, private_ip=None): """Given an elastic IP address and an interface number, associates the elastic IP to the interface number on this host. :param allocation_id: String ID for the elastic IP :param interface: Integer associated to...
python
def associate_elastic_ip(self, allocation_id, interface=1, private_ip=None): """Given an elastic IP address and an interface number, associates the elastic IP to the interface number on this host. :param allocation_id: String ID for the elastic IP :param interface: Integer associated to...
[ "def", "associate_elastic_ip", "(", "self", ",", "allocation_id", ",", "interface", "=", "1", ",", "private_ip", "=", "None", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.associate_elastic_ip'", ")", "if", "priva...
Given an elastic IP address and an interface number, associates the elastic IP to the interface number on this host. :param allocation_id: String ID for the elastic IP :param interface: Integer associated to the interface/device number :param private_ip: String IP address of the private...
[ "Given", "an", "elastic", "IP", "address", "and", "an", "interface", "number", "associates", "the", "elastic", "IP", "to", "the", "interface", "number", "on", "this", "host", "." ]
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/awsapi/ec2util.py#L198-L254
train
cons3rt/pycons3rt
pycons3rt/awsapi/ec2util.py
EC2Util.allocate_elastic_ip
def allocate_elastic_ip(self): """Allocates an elastic IP address :return: Dict with allocation ID and Public IP that were created :raises: AWSAPIError, EC2UtilError """ log = logging.getLogger(self.cls_logger + '.allocate_elastic_ip') # Attempt to allocate a new elasti...
python
def allocate_elastic_ip(self): """Allocates an elastic IP address :return: Dict with allocation ID and Public IP that were created :raises: AWSAPIError, EC2UtilError """ log = logging.getLogger(self.cls_logger + '.allocate_elastic_ip') # Attempt to allocate a new elasti...
[ "def", "allocate_elastic_ip", "(", "self", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.allocate_elastic_ip'", ")", "# Attempt to allocate a new elastic IP", "log", ".", "info", "(", "'Attempting to allocate an elastic IP......
Allocates an elastic IP address :return: Dict with allocation ID and Public IP that were created :raises: AWSAPIError, EC2UtilError
[ "Allocates", "an", "elastic", "IP", "address" ]
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/awsapi/ec2util.py#L256-L311
train
cons3rt/pycons3rt
pycons3rt/awsapi/ec2util.py
EC2Util.attach_new_eni
def attach_new_eni(self, subnet_name, security_group_ids, device_index=2, allocation_id=None, description=''): """Creates a new Elastic Network Interface on the Subnet matching the subnet_name, with Security Group identified by the security_group_name, then attaches an Elastic IP address ...
python
def attach_new_eni(self, subnet_name, security_group_ids, device_index=2, allocation_id=None, description=''): """Creates a new Elastic Network Interface on the Subnet matching the subnet_name, with Security Group identified by the security_group_name, then attaches an Elastic IP address ...
[ "def", "attach_new_eni", "(", "self", ",", "subnet_name", ",", "security_group_ids", ",", "device_index", "=", "2", ",", "allocation_id", "=", "None", ",", "description", "=", "''", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_...
Creates a new Elastic Network Interface on the Subnet matching the subnet_name, with Security Group identified by the security_group_name, then attaches an Elastic IP address if specified in the allocation_id parameter, and finally attaches the new ENI to the EC2 instance instance_id at ...
[ "Creates", "a", "new", "Elastic", "Network", "Interface", "on", "the", "Subnet", "matching", "the", "subnet_name", "with", "Security", "Group", "identified", "by", "the", "security_group_name", "then", "attaches", "an", "Elastic", "IP", "address", "if", "specified...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/awsapi/ec2util.py#L313-L489
train