partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
Dataset.get_studies
Get IDs or data for studies that meet specific criteria. If multiple criteria are passed, the set intersection is returned. For example, passing expression='emotion' and mask='my_mask.nii.gz' would return only those studies that are associated with emotion AND report activation within t...
neurosynth/base/dataset.py
def get_studies(self, features=None, expression=None, mask=None, peaks=None, frequency_threshold=0.001, activation_threshold=0.0, func=np.sum, return_type='ids', r=6 ): """ Get IDs or data for studies that meet specific criteria. ...
def get_studies(self, features=None, expression=None, mask=None, peaks=None, frequency_threshold=0.001, activation_threshold=0.0, func=np.sum, return_type='ids', r=6 ): """ Get IDs or data for studies that meet specific criteria. ...
[ "Get", "IDs", "or", "data", "for", "studies", "that", "meet", "specific", "criteria", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L241-L374
[ "def", "get_studies", "(", "self", ",", "features", "=", "None", ",", "expression", "=", "None", ",", "mask", "=", "None", ",", "peaks", "=", "None", ",", "frequency_threshold", "=", "0.001", ",", "activation_threshold", "=", "0.0", ",", "func", "=", "np...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Dataset.add_features
Construct a new FeatureTable from file. Args: features: Feature data to add. Can be: (a) A text file containing the feature data, where each row is a study in the database, with features in columns. The first column must contain the IDs of the studies...
neurosynth/base/dataset.py
def add_features(self, features, append=True, merge='outer', duplicates='ignore', min_studies=0.0, threshold=0.001): """ Construct a new FeatureTable from file. Args: features: Feature data to add. Can be: (a) A text file containing the feature data, whe...
def add_features(self, features, append=True, merge='outer', duplicates='ignore', min_studies=0.0, threshold=0.001): """ Construct a new FeatureTable from file. Args: features: Feature data to add. Can be: (a) A text file containing the feature data, whe...
[ "Construct", "a", "new", "FeatureTable", "from", "file", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L376-L399
[ "def", "add_features", "(", "self", ",", "features", ",", "append", "=", "True", ",", "merge", "=", "'outer'", ",", "duplicates", "=", "'ignore'", ",", "min_studies", "=", "0.0", ",", "threshold", "=", "0.001", ")", ":", "if", "(", "not", "append", ")"...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Dataset.get_image_data
A convenience wrapper for ImageTable.get_image_data(). Args: ids (list, array): A list or 1D numpy array of study ids to return. If None, returns data for all studies. voxels (list, array): A list or 1D numpy array of voxel indices (i.e., rows) to return....
neurosynth/base/dataset.py
def get_image_data(self, ids=None, voxels=None, dense=True): """ A convenience wrapper for ImageTable.get_image_data(). Args: ids (list, array): A list or 1D numpy array of study ids to return. If None, returns data for all studies. voxels (list, array): A list o...
def get_image_data(self, ids=None, voxels=None, dense=True): """ A convenience wrapper for ImageTable.get_image_data(). Args: ids (list, array): A list or 1D numpy array of study ids to return. If None, returns data for all studies. voxels (list, array): A list o...
[ "A", "convenience", "wrapper", "for", "ImageTable", ".", "get_image_data", "()", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L401-L410
[ "def", "get_image_data", "(", "self", ",", "ids", "=", "None", ",", "voxels", "=", "None", ",", "dense", "=", "True", ")", ":", "return", "self", ".", "image_table", ".", "get_image_data", "(", "ids", ",", "voxels", "=", "voxels", ",", "dense", "=", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Dataset.get_feature_names
Returns names of features. If features is None, returns all features. Otherwise assumes the user is trying to find the order of the features.
neurosynth/base/dataset.py
def get_feature_names(self, features=None): """ Returns names of features. If features is None, returns all features. Otherwise assumes the user is trying to find the order of the features. """ if features: return self.feature_table.get_ordered_names(features) else: ...
def get_feature_names(self, features=None): """ Returns names of features. If features is None, returns all features. Otherwise assumes the user is trying to find the order of the features. """ if features: return self.feature_table.get_ordered_names(features) else: ...
[ "Returns", "names", "of", "features", ".", "If", "features", "is", "None", "returns", "all", "features", ".", "Otherwise", "assumes", "the", "user", "is", "trying", "to", "find", "the", "order", "of", "the", "features", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L416-L423
[ "def", "get_feature_names", "(", "self", ",", "features", "=", "None", ")", ":", "if", "features", ":", "return", "self", ".", "feature_table", ".", "get_ordered_names", "(", "features", ")", "else", ":", "return", "self", ".", "feature_table", ".", "feature...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Dataset.get_feature_counts
Returns a dictionary, where the keys are the feature names and the values are the number of studies tagged with the feature.
neurosynth/base/dataset.py
def get_feature_counts(self, threshold=0.001): """ Returns a dictionary, where the keys are the feature names and the values are the number of studies tagged with the feature. """ counts = np.sum(self.get_feature_data() >= threshold, 0) return dict(zip(self.get_feature_names(), list(coun...
def get_feature_counts(self, threshold=0.001): """ Returns a dictionary, where the keys are the feature names and the values are the number of studies tagged with the feature. """ counts = np.sum(self.get_feature_data() >= threshold, 0) return dict(zip(self.get_feature_names(), list(coun...
[ "Returns", "a", "dictionary", "where", "the", "keys", "are", "the", "feature", "names", "and", "the", "values", "are", "the", "number", "of", "studies", "tagged", "with", "the", "feature", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L425-L429
[ "def", "get_feature_counts", "(", "self", ",", "threshold", "=", "0.001", ")", ":", "counts", "=", "np", ".", "sum", "(", "self", ".", "get_feature_data", "(", ")", ">=", "threshold", ",", "0", ")", "return", "dict", "(", "zip", "(", "self", ".", "ge...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Dataset.load
Load a pickled Dataset instance from file.
neurosynth/base/dataset.py
def load(cls, filename): """ Load a pickled Dataset instance from file. """ try: dataset = pickle.load(open(filename, 'rb')) except UnicodeDecodeError: # Need to try this for python3 dataset = pickle.load(open(filename, 'rb'), encoding='latin') if has...
def load(cls, filename): """ Load a pickled Dataset instance from file. """ try: dataset = pickle.load(open(filename, 'rb')) except UnicodeDecodeError: # Need to try this for python3 dataset = pickle.load(open(filename, 'rb'), encoding='latin') if has...
[ "Load", "a", "pickled", "Dataset", "instance", "from", "file", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L432-L442
[ "def", "load", "(", "cls", ",", "filename", ")", ":", "try", ":", "dataset", "=", "pickle", ".", "load", "(", "open", "(", "filename", ",", "'rb'", ")", ")", "except", "UnicodeDecodeError", ":", "# Need to try this for python3", "dataset", "=", "pickle", "...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Dataset.save
Pickle the Dataset instance to the provided file.
neurosynth/base/dataset.py
def save(self, filename): """ Pickle the Dataset instance to the provided file. """ if hasattr(self, 'feature_table'): self.feature_table._sdf_to_csr() pickle.dump(self, open(filename, 'wb'), -1) if hasattr(self, 'feature_table'): self.feature_table._csr...
def save(self, filename): """ Pickle the Dataset instance to the provided file. """ if hasattr(self, 'feature_table'): self.feature_table._sdf_to_csr() pickle.dump(self, open(filename, 'wb'), -1) if hasattr(self, 'feature_table'): self.feature_table._csr...
[ "Pickle", "the", "Dataset", "instance", "to", "the", "provided", "file", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L444-L453
[ "def", "save", "(", "self", ",", "filename", ")", ":", "if", "hasattr", "(", "self", ",", "'feature_table'", ")", ":", "self", ".", "feature_table", ".", "_sdf_to_csr", "(", ")", "pickle", ".", "dump", "(", "self", ",", "open", "(", "filename", ",", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
ImageTable.get_image_data
Slices and returns a subset of image data. Args: ids (list, array): A list or 1D numpy array of study ids to return. If None, returns data for all studies. voxels (list, array): A list or 1D numpy array of voxel indices (i.e., rows) to return. If None, re...
neurosynth/base/dataset.py
def get_image_data(self, ids=None, voxels=None, dense=True): """ Slices and returns a subset of image data. Args: ids (list, array): A list or 1D numpy array of study ids to return. If None, returns data for all studies. voxels (list, array): A list or 1D numpy a...
def get_image_data(self, ids=None, voxels=None, dense=True): """ Slices and returns a subset of image data. Args: ids (list, array): A list or 1D numpy array of study ids to return. If None, returns data for all studies. voxels (list, array): A list or 1D numpy a...
[ "Slices", "and", "returns", "a", "subset", "of", "image", "data", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L507-L537
[ "def", "get_image_data", "(", "self", ",", "ids", "=", "None", ",", "voxels", "=", "None", ",", "dense", "=", "True", ")", ":", "if", "dense", "and", "ids", "is", "None", "and", "voxels", "is", "None", ":", "logger", ".", "warning", "(", "\"Warning: ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
ImageTable.trim
Trim ImageTable to keep only the passed studies. This is a convenience method, and should generally be avoided in favor of non-destructive alternatives that don't require slicing (e.g., matrix multiplication).
neurosynth/base/dataset.py
def trim(self, ids): """ Trim ImageTable to keep only the passed studies. This is a convenience method, and should generally be avoided in favor of non-destructive alternatives that don't require slicing (e.g., matrix multiplication). """ self.data = self.get_image_data(ids, ...
def trim(self, ids): """ Trim ImageTable to keep only the passed studies. This is a convenience method, and should generally be avoided in favor of non-destructive alternatives that don't require slicing (e.g., matrix multiplication). """ self.data = self.get_image_data(ids, ...
[ "Trim", "ImageTable", "to", "keep", "only", "the", "passed", "studies", ".", "This", "is", "a", "convenience", "method", "and", "should", "generally", "be", "avoided", "in", "favor", "of", "non", "-", "destructive", "alternatives", "that", "don", "t", "requi...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L539-L546
[ "def", "trim", "(", "self", ",", "ids", ")", ":", "self", ".", "data", "=", "self", ".", "get_image_data", "(", "ids", ",", "dense", "=", "False", ")", "# .tocoo()", "idxs", "=", "np", ".", "where", "(", "np", ".", "in1d", "(", "np", ".", "array"...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable.add_features
Add new features to FeatureTable. Args: features (str, DataFrame): A filename to load data from, or a pandas DataFrame. In either case, studies are in rows and features are in columns. Values in cells reflect the weight of the intersecting feature for ...
neurosynth/base/dataset.py
def add_features(self, features, merge='outer', duplicates='ignore', min_studies=0, threshold=0.0001): """ Add new features to FeatureTable. Args: features (str, DataFrame): A filename to load data from, or a pandas DataFrame. In either case, studies are ...
def add_features(self, features, merge='outer', duplicates='ignore', min_studies=0, threshold=0.0001): """ Add new features to FeatureTable. Args: features (str, DataFrame): A filename to load data from, or a pandas DataFrame. In either case, studies are ...
[ "Add", "new", "features", "to", "FeatureTable", ".", "Args", ":", "features", "(", "str", "DataFrame", ")", ":", "A", "filename", "to", "load", "data", "from", "or", "a", "pandas", "DataFrame", ".", "In", "either", "case", "studies", "are", "in", "rows",...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L569-L634
[ "def", "add_features", "(", "self", ",", "features", ",", "merge", "=", "'outer'", ",", "duplicates", "=", "'ignore'", ",", "min_studies", "=", "0", ",", "threshold", "=", "0.0001", ")", ":", "if", "isinstance", "(", "features", ",", "string_types", ")", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable.get_feature_data
Slices and returns a subset of feature data. Args: ids (list, array): A list or 1D numpy array of study ids to return rows for. If None, returns data for all studies (i.e., all rows in array). features (list, array): A list or 1D numpy array of named feat...
neurosynth/base/dataset.py
def get_feature_data(self, ids=None, features=None, dense=True): """ Slices and returns a subset of feature data. Args: ids (list, array): A list or 1D numpy array of study ids to return rows for. If None, returns data for all studies (i.e., all rows in array...
def get_feature_data(self, ids=None, features=None, dense=True): """ Slices and returns a subset of feature data. Args: ids (list, array): A list or 1D numpy array of study ids to return rows for. If None, returns data for all studies (i.e., all rows in array...
[ "Slices", "and", "returns", "a", "subset", "of", "feature", "data", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L640-L665
[ "def", "get_feature_data", "(", "self", ",", "ids", "=", "None", ",", "features", "=", "None", ",", "dense", "=", "True", ")", ":", "result", "=", "self", ".", "data", "if", "ids", "is", "not", "None", ":", "result", "=", "result", ".", "ix", "[", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable.get_ordered_names
Given a list of features, returns features in order that they appear in database. Args: features (list): A list or 1D numpy array of named features to return. Returns: A list of features in order they appear in database.
neurosynth/base/dataset.py
def get_ordered_names(self, features): """ Given a list of features, returns features in order that they appear in database. Args: features (list): A list or 1D numpy array of named features to return. Returns: A list of features in order they appear...
def get_ordered_names(self, features): """ Given a list of features, returns features in order that they appear in database. Args: features (list): A list or 1D numpy array of named features to return. Returns: A list of features in order they appear...
[ "Given", "a", "list", "of", "features", "returns", "features", "in", "order", "that", "they", "appear", "in", "database", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L667-L681
[ "def", "get_ordered_names", "(", "self", ",", "features", ")", ":", "idxs", "=", "np", ".", "where", "(", "np", ".", "in1d", "(", "self", ".", "data", ".", "columns", ".", "values", ",", "np", ".", "array", "(", "features", ")", ")", ")", "[", "0...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable.get_ids
Returns a list of all studies in the table that meet the desired feature-based criteria. Will most commonly be used to retrieve studies that use one or more features with some minimum frequency; e.g.,: get_ids(['fear', 'anxiety'], threshold=0.001) Args: feature...
neurosynth/base/dataset.py
def get_ids(self, features, threshold=0.0, func=np.sum, get_weights=False): """ Returns a list of all studies in the table that meet the desired feature-based criteria. Will most commonly be used to retrieve studies that use one or more features with some minimum frequency; e.g.,: ...
def get_ids(self, features, threshold=0.0, func=np.sum, get_weights=False): """ Returns a list of all studies in the table that meet the desired feature-based criteria. Will most commonly be used to retrieve studies that use one or more features with some minimum frequency; e.g.,: ...
[ "Returns", "a", "list", "of", "all", "studies", "in", "the", "table", "that", "meet", "the", "desired", "feature", "-", "based", "criteria", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L683-L720
[ "def", "get_ids", "(", "self", ",", "features", ",", "threshold", "=", "0.0", ",", "func", "=", "np", ".", "sum", ",", "get_weights", "=", "False", ")", ":", "if", "isinstance", "(", "features", ",", "str", ")", ":", "features", "=", "[", "features",...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable.search_features
Returns all features that match any of the elements in the input list. Args: search (str, list): A string or list of strings defining the query. Returns: A list of matching feature names.
neurosynth/base/dataset.py
def search_features(self, search): ''' Returns all features that match any of the elements in the input list. Args: search (str, list): A string or list of strings defining the query. Returns: A list of matching feature names. ''' if isinstance(s...
def search_features(self, search): ''' Returns all features that match any of the elements in the input list. Args: search (str, list): A string or list of strings defining the query. Returns: A list of matching feature names. ''' if isinstance(s...
[ "Returns", "all", "features", "that", "match", "any", "of", "the", "elements", "in", "the", "input", "list", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L722-L739
[ "def", "search_features", "(", "self", ",", "search", ")", ":", "if", "isinstance", "(", "search", ",", "string_types", ")", ":", "search", "=", "[", "search", "]", "search", "=", "[", "s", ".", "replace", "(", "'*'", ",", "'.*'", ")", "for", "s", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable.get_ids_by_expression
Use a PEG to parse expression and return study IDs.
neurosynth/base/dataset.py
def get_ids_by_expression(self, expression, threshold=0.001, func=np.sum): """ Use a PEG to parse expression and return study IDs.""" lexer = lp.Lexer() lexer.build() parser = lp.Parser( lexer, self.dataset, threshold=threshold, func=func) parser.build() retur...
def get_ids_by_expression(self, expression, threshold=0.001, func=np.sum): """ Use a PEG to parse expression and return study IDs.""" lexer = lp.Lexer() lexer.build() parser = lp.Parser( lexer, self.dataset, threshold=threshold, func=func) parser.build() retur...
[ "Use", "a", "PEG", "to", "parse", "expression", "and", "return", "study", "IDs", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L741-L748
[ "def", "get_ids_by_expression", "(", "self", ",", "expression", ",", "threshold", "=", "0.001", ",", "func", "=", "np", ".", "sum", ")", ":", "lexer", "=", "lp", ".", "Lexer", "(", ")", "lexer", ".", "build", "(", ")", "parser", "=", "lp", ".", "Pa...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable.get_features_by_ids
Returns features for which the mean loading across all specified studies (in ids) is >= threshold.
neurosynth/base/dataset.py
def get_features_by_ids(self, ids=None, threshold=0.0001, func=np.mean, get_weights=False): ''' Returns features for which the mean loading across all specified studies (in ids) is >= threshold. ''' weights = self.data.ix[ids].apply(func, 0) above_thresh = wei...
def get_features_by_ids(self, ids=None, threshold=0.0001, func=np.mean, get_weights=False): ''' Returns features for which the mean loading across all specified studies (in ids) is >= threshold. ''' weights = self.data.ix[ids].apply(func, 0) above_thresh = wei...
[ "Returns", "features", "for", "which", "the", "mean", "loading", "across", "all", "specified", "studies", "(", "in", "ids", ")", "is", ">", "=", "threshold", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L750-L756
[ "def", "get_features_by_ids", "(", "self", ",", "ids", "=", "None", ",", "threshold", "=", "0.0001", ",", "func", "=", "np", ".", "mean", ",", "get_weights", "=", "False", ")", ":", "weights", "=", "self", ".", "data", ".", "ix", "[", "ids", "]", "...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable._sdf_to_csr
Convert FeatureTable to SciPy CSR matrix.
neurosynth/base/dataset.py
def _sdf_to_csr(self): """ Convert FeatureTable to SciPy CSR matrix. """ data = self.data.to_dense() self.data = { 'columns': list(data.columns), 'index': list(data.index), 'values': sparse.csr_matrix(data.values) }
def _sdf_to_csr(self): """ Convert FeatureTable to SciPy CSR matrix. """ data = self.data.to_dense() self.data = { 'columns': list(data.columns), 'index': list(data.index), 'values': sparse.csr_matrix(data.values) }
[ "Convert", "FeatureTable", "to", "SciPy", "CSR", "matrix", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L758-L765
[ "def", "_sdf_to_csr", "(", "self", ")", ":", "data", "=", "self", ".", "data", ".", "to_dense", "(", ")", "self", ".", "data", "=", "{", "'columns'", ":", "list", "(", "data", ".", "columns", ")", ",", "'index'", ":", "list", "(", "data", ".", "i...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
FeatureTable._csr_to_sdf
Inverse of _sdf_to_csr().
neurosynth/base/dataset.py
def _csr_to_sdf(self): """ Inverse of _sdf_to_csr(). """ self.data = pd.DataFrame(self.data['values'].todense(), index=self.data['index'], columns=self.data['columns']).to_sparse()
def _csr_to_sdf(self): """ Inverse of _sdf_to_csr(). """ self.data = pd.DataFrame(self.data['values'].todense(), index=self.data['index'], columns=self.data['columns']).to_sparse()
[ "Inverse", "of", "_sdf_to_csr", "()", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L767-L771
[ "def", "_csr_to_sdf", "(", "self", ")", ":", "self", ".", "data", "=", "pd", ".", "DataFrame", "(", "self", ".", "data", "[", "'values'", "]", ".", "todense", "(", ")", ",", "index", "=", "self", ".", "data", "[", "'index'", "]", ",", "columns", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
deprecated
Deprecation warning decorator. Takes optional deprecation message, otherwise will use a generic warning.
neurosynth/utils.py
def deprecated(*args): """ Deprecation warning decorator. Takes optional deprecation message, otherwise will use a generic warning. """ def wrap(func): def wrapped_func(*args, **kwargs): warnings.warn(msg, category=DeprecationWarning) return func(*args, **kwargs) retu...
def deprecated(*args): """ Deprecation warning decorator. Takes optional deprecation message, otherwise will use a generic warning. """ def wrap(func): def wrapped_func(*args, **kwargs): warnings.warn(msg, category=DeprecationWarning) return func(*args, **kwargs) retu...
[ "Deprecation", "warning", "decorator", ".", "Takes", "optional", "deprecation", "message", "otherwise", "will", "use", "a", "generic", "warning", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/utils.py#L3-L18
[ "def", "deprecated", "(", "*", "args", ")", ":", "def", "wrap", "(", "func", ")", ":", "def", "wrapped_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "warnings", ".", "warn", "(", "msg", ",", "category", "=", "DeprecationWarning", ")", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
magic
Execute a full clustering analysis pipeline. Args: dataset: a Dataset instance to extract all data from. method (str): the overall clustering approach to use. Valid options: 'coactivation' (default): Clusters voxel within the ROI mask based on shared pattern of coactivati...
neurosynth/analysis/cluster.py
def magic(dataset, method='coactivation', roi_mask=None, coactivation_mask=None, features=None, feature_threshold=0.05, min_voxels_per_study=None, min_studies_per_voxel=None, reduce_reference='pca', n_components=100, distance_metric='correlation', clustering_algorithm='kmeans', ...
def magic(dataset, method='coactivation', roi_mask=None, coactivation_mask=None, features=None, feature_threshold=0.05, min_voxels_per_study=None, min_studies_per_voxel=None, reduce_reference='pca', n_components=100, distance_metric='correlation', clustering_algorithm='kmeans', ...
[ "Execute", "a", "full", "clustering", "analysis", "pipeline", ".", "Args", ":", "dataset", ":", "a", "Dataset", "instance", "to", "extract", "all", "data", "from", ".", "method", "(", "str", ")", ":", "the", "overall", "clustering", "approach", "to", "use"...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/cluster.py#L72-L219
[ "def", "magic", "(", "dataset", ",", "method", "=", "'coactivation'", ",", "roi_mask", "=", "None", ",", "coactivation_mask", "=", "None", ",", "features", "=", "None", ",", "feature_threshold", "=", "0.05", ",", "min_voxels_per_study", "=", "None", ",", "mi...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Clusterable.transform
Apply a transformation to the Clusterable instance. Accepts any scikit-learn-style class that implements a fit_transform() method.
neurosynth/analysis/cluster.py
def transform(self, transformer, transpose=False): ''' Apply a transformation to the Clusterable instance. Accepts any scikit-learn-style class that implements a fit_transform() method. ''' data = self.data.T if transpose else self.data data = transformer.fit_transform(data) self...
def transform(self, transformer, transpose=False): ''' Apply a transformation to the Clusterable instance. Accepts any scikit-learn-style class that implements a fit_transform() method. ''' data = self.data.T if transpose else self.data data = transformer.fit_transform(data) self...
[ "Apply", "a", "transformation", "to", "the", "Clusterable", "instance", ".", "Accepts", "any", "scikit", "-", "learn", "-", "style", "class", "that", "implements", "a", "fit_transform", "()", "method", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/cluster.py#L63-L69
[ "def", "transform", "(", "self", ",", "transformer", ",", "transpose", "=", "False", ")", ":", "data", "=", "self", ".", "data", ".", "T", "if", "transpose", "else", "self", ".", "data", "data", "=", "transformer", ".", "fit_transform", "(", "data", ")...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
analyze_features
Generate meta-analysis images for a set of features. Args: dataset: A Dataset instance containing feature and activation data. features: A list of named features to generate meta-analysis maps for. If None, analyzes all features in the current dataset. image_type: The type of ima...
neurosynth/analysis/meta.py
def analyze_features(dataset, features=None, image_type='association-test_z', threshold=0.001, q=0.01, output_dir=None, prefix=None): """ Generate meta-analysis images for a set of features. Args: dataset: A Dataset instance containing feature and activation data. features: ...
def analyze_features(dataset, features=None, image_type='association-test_z', threshold=0.001, q=0.01, output_dir=None, prefix=None): """ Generate meta-analysis images for a set of features. Args: dataset: A Dataset instance containing feature and activation data. features: ...
[ "Generate", "meta", "-", "analysis", "images", "for", "a", "set", "of", "features", ".", "Args", ":", "dataset", ":", "A", "Dataset", "instance", "containing", "feature", "and", "activation", "data", ".", "features", ":", "A", "list", "of", "named", "featu...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/meta.py#L14-L54
[ "def", "analyze_features", "(", "dataset", ",", "features", "=", "None", ",", "image_type", "=", "'association-test_z'", ",", "threshold", "=", "0.001", ",", "q", "=", "0.01", ",", "output_dir", "=", "None", ",", "prefix", "=", "None", ")", ":", "if", "f...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
MetaAnalysis.save_results
Write out any images generated by the meta-analysis. Args: output_dir (str): folder to write images to prefix (str): all image files will be prepended with this string prefix_sep (str): glue between the prefix and rest of filename image_list (list): optional list ...
neurosynth/analysis/meta.py
def save_results(self, output_dir='.', prefix='', prefix_sep='_', image_list=None): """ Write out any images generated by the meta-analysis. Args: output_dir (str): folder to write images to prefix (str): all image files will be prepended with this string ...
def save_results(self, output_dir='.', prefix='', prefix_sep='_', image_list=None): """ Write out any images generated by the meta-analysis. Args: output_dir (str): folder to write images to prefix (str): all image files will be prepended with this string ...
[ "Write", "out", "any", "images", "generated", "by", "the", "meta", "-", "analysis", ".", "Args", ":", "output_dir", "(", "str", ")", ":", "folder", "to", "write", "images", "to", "prefix", "(", "str", ")", ":", "all", "image", "files", "will", "be", ...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/meta.py#L201-L226
[ "def", "save_results", "(", "self", ",", "output_dir", "=", "'.'", ",", "prefix", "=", "''", ",", "prefix_sep", "=", "'_'", ",", "image_list", "=", "None", ")", ":", "if", "prefix", "==", "''", ":", "prefix_sep", "=", "''", "if", "not", "exists", "("...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
transform
Convert coordinates from one space to another using provided transformation matrix.
neurosynth/base/transformations.py
def transform(foci, mat): """ Convert coordinates from one space to another using provided transformation matrix. """ t = linalg.pinv(mat) foci = np.hstack((foci, np.ones((foci.shape[0], 1)))) return np.dot(foci, t)[:, 0:3]
def transform(foci, mat): """ Convert coordinates from one space to another using provided transformation matrix. """ t = linalg.pinv(mat) foci = np.hstack((foci, np.ones((foci.shape[0], 1)))) return np.dot(foci, t)[:, 0:3]
[ "Convert", "coordinates", "from", "one", "space", "to", "another", "using", "provided", "transformation", "matrix", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/transformations.py#L10-L15
[ "def", "transform", "(", "foci", ",", "mat", ")", ":", "t", "=", "linalg", ".", "pinv", "(", "mat", ")", "foci", "=", "np", ".", "hstack", "(", "(", "foci", ",", "np", ".", "ones", "(", "(", "foci", ".", "shape", "[", "0", "]", ",", "1", ")...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
xyz_to_mat
Convert an N x 3 array of XYZ coordinates to matrix indices.
neurosynth/base/transformations.py
def xyz_to_mat(foci, xyz_dims=None, mat_dims=None): """ Convert an N x 3 array of XYZ coordinates to matrix indices. """ foci = np.hstack((foci, np.ones((foci.shape[0], 1)))) mat = np.array([[-0.5, 0, 0, 45], [0, 0.5, 0, 63], [0, 0, 0.5, 36]]).T result = np.dot(foci, mat)[:, ::-1] # multiply and revers...
def xyz_to_mat(foci, xyz_dims=None, mat_dims=None): """ Convert an N x 3 array of XYZ coordinates to matrix indices. """ foci = np.hstack((foci, np.ones((foci.shape[0], 1)))) mat = np.array([[-0.5, 0, 0, 45], [0, 0.5, 0, 63], [0, 0, 0.5, 36]]).T result = np.dot(foci, mat)[:, ::-1] # multiply and revers...
[ "Convert", "an", "N", "x", "3", "array", "of", "XYZ", "coordinates", "to", "matrix", "indices", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/transformations.py#L18-L23
[ "def", "xyz_to_mat", "(", "foci", ",", "xyz_dims", "=", "None", ",", "mat_dims", "=", "None", ")", ":", "foci", "=", "np", ".", "hstack", "(", "(", "foci", ",", "np", ".", "ones", "(", "(", "foci", ".", "shape", "[", "0", "]", ",", "1", ")", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Transformer.apply
Apply a named transformation to a set of foci. If the named transformation doesn't exist, return foci untransformed.
neurosynth/base/transformations.py
def apply(self, name, foci): """ Apply a named transformation to a set of foci. If the named transformation doesn't exist, return foci untransformed. """ if name in self.transformations: return transform(foci, self.transformations[name]) else: logger.info...
def apply(self, name, foci): """ Apply a named transformation to a set of foci. If the named transformation doesn't exist, return foci untransformed. """ if name in self.transformations: return transform(foci, self.transformations[name]) else: logger.info...
[ "Apply", "a", "named", "transformation", "to", "a", "set", "of", "foci", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/transformations.py#L59-L70
[ "def", "apply", "(", "self", ",", "name", ",", "foci", ")", ":", "if", "name", "in", "self", ".", "transformations", ":", "return", "transform", "(", "foci", ",", "self", ".", "transformations", "[", "name", "]", ")", "else", ":", "logger", ".", "inf...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Masker.reset
Reset/remove all layers, keeping only the initial volume.
neurosynth/base/mask.py
def reset(self): """ Reset/remove all layers, keeping only the initial volume. """ self.layers = {} self.stack = [] self.set_mask() self.n_vox_in_vol = len(np.where(self.current_mask)[0])
def reset(self): """ Reset/remove all layers, keeping only the initial volume. """ self.layers = {} self.stack = [] self.set_mask() self.n_vox_in_vol = len(np.where(self.current_mask)[0])
[ "Reset", "/", "remove", "all", "layers", "keeping", "only", "the", "initial", "volume", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L32-L37
[ "def", "reset", "(", "self", ")", ":", "self", ".", "layers", "=", "{", "}", "self", ".", "stack", "=", "[", "]", "self", ".", "set_mask", "(", ")", "self", ".", "n_vox_in_vol", "=", "len", "(", "np", ".", "where", "(", "self", ".", "current_mask...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Masker.add
Add one or more layers to the stack of masking layers. Args: layers: A string, NiBabel image, list, or dict. If anything other than a dict is passed, assigns sequential layer names based on the current position in stack; if a dict, uses key as the name ...
neurosynth/base/mask.py
def add(self, layers, above=None, below=None): """ Add one or more layers to the stack of masking layers. Args: layers: A string, NiBabel image, list, or dict. If anything other than a dict is passed, assigns sequential layer names based on the current positio...
def add(self, layers, above=None, below=None): """ Add one or more layers to the stack of masking layers. Args: layers: A string, NiBabel image, list, or dict. If anything other than a dict is passed, assigns sequential layer names based on the current positio...
[ "Add", "one", "or", "more", "layers", "to", "the", "stack", "of", "masking", "layers", ".", "Args", ":", "layers", ":", "A", "string", "NiBabel", "image", "list", "or", "dict", ".", "If", "anything", "other", "than", "a", "dict", "is", "passed", "assig...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L39-L68
[ "def", "add", "(", "self", ",", "layers", ",", "above", "=", "None", ",", "below", "=", "None", ")", ":", "def", "add_named_layer", "(", "name", ",", "image", ")", ":", "image", "=", "self", ".", "get_image", "(", "image", ",", "output", "=", "'vec...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Masker.remove
Remove one or more layers from the stack of masking layers. Args: layers: An int, string or list of strings and/or ints. Ints are interpreted as indices in the stack to remove; strings are interpreted as names of layers to remove. Negative ints will al...
neurosynth/base/mask.py
def remove(self, layers): """ Remove one or more layers from the stack of masking layers. Args: layers: An int, string or list of strings and/or ints. Ints are interpreted as indices in the stack to remove; strings are interpreted as names of layers to remove....
def remove(self, layers): """ Remove one or more layers from the stack of masking layers. Args: layers: An int, string or list of strings and/or ints. Ints are interpreted as indices in the stack to remove; strings are interpreted as names of layers to remove....
[ "Remove", "one", "or", "more", "layers", "from", "the", "stack", "of", "masking", "layers", ".", "Args", ":", "layers", ":", "An", "int", "string", "or", "list", "of", "strings", "and", "/", "or", "ints", ".", "Ints", "are", "interpreted", "as", "indic...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L70-L90
[ "def", "remove", "(", "self", ",", "layers", ")", ":", "if", "not", "isinstance", "(", "layers", ",", "list", ")", ":", "layers", "=", "[", "layers", "]", "for", "l", "in", "layers", ":", "if", "isinstance", "(", "l", ",", "string_types", ")", ":",...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Masker.get_image
A flexible method for transforming between different representations of image data. Args: image: The input image. Can be a string (filename of image), NiBabel image, N-dimensional array (must have same shape as self.volume), or vectorized image data (must have...
neurosynth/base/mask.py
def get_image(self, image, output='vector'): """ A flexible method for transforming between different representations of image data. Args: image: The input image. Can be a string (filename of image), NiBabel image, N-dimensional array (must have same shape as ...
def get_image(self, image, output='vector'): """ A flexible method for transforming between different representations of image data. Args: image: The input image. Can be a string (filename of image), NiBabel image, N-dimensional array (must have same shape as ...
[ "A", "flexible", "method", "for", "transforming", "between", "different", "representations", "of", "image", "data", ".", "Args", ":", "image", ":", "The", "input", "image", ".", "Can", "be", "a", "string", "(", "filename", "of", "image", ")", "NiBabel", "i...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L92-L136
[ "def", "get_image", "(", "self", ",", "image", ",", "output", "=", "'vector'", ")", ":", "if", "isinstance", "(", "image", ",", "string_types", ")", ":", "image", "=", "nb", ".", "load", "(", "image", ")", "if", "type", "(", "image", ")", ".", "__m...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Masker.mask
Vectorize an image and mask out all invalid voxels. Args: images: The image to vectorize and mask. Input can be any object handled by get_image(). layers: Which mask layers to use (specified as int, string, or list of ints and strings). When None, applies...
neurosynth/base/mask.py
def mask(self, image, nan_to_num=True, layers=None, in_global_mask=False): """ Vectorize an image and mask out all invalid voxels. Args: images: The image to vectorize and mask. Input can be any object handled by get_image(). layers: Which mask layers to use (spe...
def mask(self, image, nan_to_num=True, layers=None, in_global_mask=False): """ Vectorize an image and mask out all invalid voxels. Args: images: The image to vectorize and mask. Input can be any object handled by get_image(). layers: Which mask layers to use (spe...
[ "Vectorize", "an", "image", "and", "mask", "out", "all", "invalid", "voxels", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L138-L167
[ "def", "mask", "(", "self", ",", "image", ",", "nan_to_num", "=", "True", ",", "layers", "=", "None", ",", "in_global_mask", "=", "False", ")", ":", "self", ".", "set_mask", "(", "layers", ")", "image", "=", "self", ".", "get_image", "(", "image", ",...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Masker.unmask
Reconstruct a masked vector into the original 3D volume. Args: data: The 1D vector to reconstruct. (Can also be a 2D vector where the second dimension is time, but then output will always be set to 'array'--i.e., a 4D image will be returned.) layers: Which...
neurosynth/base/mask.py
def unmask(self, data, layers=None, output='array'): """ Reconstruct a masked vector into the original 3D volume. Args: data: The 1D vector to reconstruct. (Can also be a 2D vector where the second dimension is time, but then output will always be set to 'arra...
def unmask(self, data, layers=None, output='array'): """ Reconstruct a masked vector into the original 3D volume. Args: data: The 1D vector to reconstruct. (Can also be a 2D vector where the second dimension is time, but then output will always be set to 'arra...
[ "Reconstruct", "a", "masked", "vector", "into", "the", "original", "3D", "volume", ".", "Args", ":", "data", ":", "The", "1D", "vector", "to", "reconstruct", ".", "(", "Can", "also", "be", "a", "2D", "vector", "where", "the", "second", "dimension", "is",...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L169-L195
[ "def", "unmask", "(", "self", ",", "data", ",", "layers", "=", "None", ",", "output", "=", "'array'", ")", ":", "self", ".", "set_mask", "(", "layers", ")", "if", "data", ".", "ndim", "==", "2", ":", "n_volumes", "=", "data", ".", "shape", "[", "...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
Masker.get_mask
Set the current mask by taking the conjunction of all specified layers. Args: layers: Which layers to include. See documentation for add() for format. include_global_mask: Whether or not to automatically include the global mask (i.e., self.volume)...
neurosynth/base/mask.py
def get_mask(self, layers=None, output='vector', in_global_mask=True): """ Set the current mask by taking the conjunction of all specified layers. Args: layers: Which layers to include. See documentation for add() for format. include_global_mask: Whether ...
def get_mask(self, layers=None, output='vector', in_global_mask=True): """ Set the current mask by taking the conjunction of all specified layers. Args: layers: Which layers to include. See documentation for add() for format. include_global_mask: Whether ...
[ "Set", "the", "current", "mask", "by", "taking", "the", "conjunction", "of", "all", "specified", "layers", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/mask.py#L197-L224
[ "def", "get_mask", "(", "self", ",", "layers", "=", "None", ",", "output", "=", "'vector'", ",", "in_global_mask", "=", "True", ")", ":", "if", "in_global_mask", ":", "output", "=", "'vector'", "if", "layers", "is", "None", ":", "layers", "=", "self", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
get_sphere
# Return all points within r mm of coordinates. Generates a cube and then discards all points outside sphere. Only returns values that fall within the dimensions of the image.
neurosynth/base/imageutils.py
def get_sphere(coords, r=4, vox_dims=(2, 2, 2), dims=(91, 109, 91)): """ # Return all points within r mm of coordinates. Generates a cube and then discards all points outside sphere. Only returns values that fall within the dimensions of the image.""" r = float(r) xx, yy, zz = [slice(-r / vox_dims[i...
def get_sphere(coords, r=4, vox_dims=(2, 2, 2), dims=(91, 109, 91)): """ # Return all points within r mm of coordinates. Generates a cube and then discards all points outside sphere. Only returns values that fall within the dimensions of the image.""" r = float(r) xx, yy, zz = [slice(-r / vox_dims[i...
[ "#", "Return", "all", "points", "within", "r", "mm", "of", "coordinates", ".", "Generates", "a", "cube", "and", "then", "discards", "all", "points", "outside", "sphere", ".", "Only", "returns", "values", "that", "fall", "within", "the", "dimensions", "of", ...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L12-L24
[ "def", "get_sphere", "(", "coords", ",", "r", "=", "4", ",", "vox_dims", "=", "(", "2", ",", "2", ",", "2", ")", ",", "dims", "=", "(", "91", ",", "109", ",", "91", ")", ")", ":", "r", "=", "float", "(", "r", ")", "xx", ",", "yy", ",", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
map_peaks_to_image
Take a set of discrete foci (i.e., 2-D array of xyz coordinates) and generate a corresponding image, convolving each focus with a hard sphere of radius r.
neurosynth/base/imageutils.py
def map_peaks_to_image(peaks, r=4, vox_dims=(2, 2, 2), dims=(91, 109, 91), header=None): """ Take a set of discrete foci (i.e., 2-D array of xyz coordinates) and generate a corresponding image, convolving each focus with a hard sphere of radius r.""" data = np.zeros(dims) for ...
def map_peaks_to_image(peaks, r=4, vox_dims=(2, 2, 2), dims=(91, 109, 91), header=None): """ Take a set of discrete foci (i.e., 2-D array of xyz coordinates) and generate a corresponding image, convolving each focus with a hard sphere of radius r.""" data = np.zeros(dims) for ...
[ "Take", "a", "set", "of", "discrete", "foci", "(", "i", ".", "e", ".", "2", "-", "D", "array", "of", "xyz", "coordinates", ")", "and", "generate", "a", "corresponding", "image", "convolving", "each", "focus", "with", "a", "hard", "sphere", "of", "radiu...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L27-L37
[ "def", "map_peaks_to_image", "(", "peaks", ",", "r", "=", "4", ",", "vox_dims", "=", "(", "2", ",", "2", ",", "2", ")", ",", "dims", "=", "(", "91", ",", "109", ",", "91", ")", ",", "header", "=", "None", ")", ":", "data", "=", "np", ".", "...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
load_imgs
Load multiple images from file into an ndarray. Args: filenames: A single filename or list of filenames pointing to valid images. masker: A Masker instance. nan_to_num: Optional boolean indicating whether to convert NaNs to zero. Returns: An m x n 2D numpy array, where m = numb...
neurosynth/base/imageutils.py
def load_imgs(filenames, masker, nan_to_num=True): """ Load multiple images from file into an ndarray. Args: filenames: A single filename or list of filenames pointing to valid images. masker: A Masker instance. nan_to_num: Optional boolean indicating whether to convert NaNs to zero. ...
def load_imgs(filenames, masker, nan_to_num=True): """ Load multiple images from file into an ndarray. Args: filenames: A single filename or list of filenames pointing to valid images. masker: A Masker instance. nan_to_num: Optional boolean indicating whether to convert NaNs to zero. ...
[ "Load", "multiple", "images", "from", "file", "into", "an", "ndarray", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L40-L58
[ "def", "load_imgs", "(", "filenames", ",", "masker", ",", "nan_to_num", "=", "True", ")", ":", "if", "isinstance", "(", "filenames", ",", "string_types", ")", ":", "filenames", "=", "[", "filenames", "]", "data", "=", "np", ".", "zeros", "(", "(", "mas...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
save_img
Save a vectorized image to file.
neurosynth/base/imageutils.py
def save_img(data, filename, masker, header=None): """ Save a vectorized image to file. """ if not header: header = masker.get_header() header.set_data_dtype(data.dtype) # Avoids loss of precision # Update min/max -- this should happen on save, but doesn't seem to header['cal_max'] = data.m...
def save_img(data, filename, masker, header=None): """ Save a vectorized image to file. """ if not header: header = masker.get_header() header.set_data_dtype(data.dtype) # Avoids loss of precision # Update min/max -- this should happen on save, but doesn't seem to header['cal_max'] = data.m...
[ "Save", "a", "vectorized", "image", "to", "file", "." ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L61-L70
[ "def", "save_img", "(", "data", ",", "filename", ",", "masker", ",", "header", "=", "None", ")", ":", "if", "not", "header", ":", "header", "=", "masker", ".", "get_header", "(", ")", "header", ".", "set_data_dtype", "(", "data", ".", "dtype", ")", "...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
threshold_img
Threshold data, setting all values in the array above/below threshold to zero. Args: data (ndarray): The image data to threshold. threshold (float): Numeric threshold to apply to image. mask (ndarray): Optional 1D-array with the same length as the data. If passed, the thresho...
neurosynth/base/imageutils.py
def threshold_img(data, threshold, mask=None, mask_out='below'): """ Threshold data, setting all values in the array above/below threshold to zero. Args: data (ndarray): The image data to threshold. threshold (float): Numeric threshold to apply to image. mask (ndarray): Optional 1D-a...
def threshold_img(data, threshold, mask=None, mask_out='below'): """ Threshold data, setting all values in the array above/below threshold to zero. Args: data (ndarray): The image data to threshold. threshold (float): Numeric threshold to apply to image. mask (ndarray): Optional 1D-a...
[ "Threshold", "data", "setting", "all", "values", "in", "the", "array", "above", "/", "below", "threshold", "to", "zero", ".", "Args", ":", "data", "(", "ndarray", ")", ":", "The", "image", "data", "to", "threshold", ".", "threshold", "(", "float", ")", ...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L73-L95
[ "def", "threshold_img", "(", "data", ",", "threshold", ",", "mask", "=", "None", ",", "mask_out", "=", "'below'", ")", ":", "if", "mask", "is", "not", "None", ":", "mask", "=", "threshold_img", "(", "mask", ",", "threshold", ",", "mask_out", "=", "mask...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
create_grid
Creates an image containing labeled cells in a 3D grid. Args: image: String or nibabel image. The image used to define the grid dimensions. Also used to define the mask to apply to the grid. Only voxels with non-zero values in the mask will be retained; all other voxels w...
neurosynth/base/imageutils.py
def create_grid(image, scale=4, apply_mask=True, save_file=None): """ Creates an image containing labeled cells in a 3D grid. Args: image: String or nibabel image. The image used to define the grid dimensions. Also used to define the mask to apply to the grid. Only voxels with no...
def create_grid(image, scale=4, apply_mask=True, save_file=None): """ Creates an image containing labeled cells in a 3D grid. Args: image: String or nibabel image. The image used to define the grid dimensions. Also used to define the mask to apply to the grid. Only voxels with no...
[ "Creates", "an", "image", "containing", "labeled", "cells", "in", "a", "3D", "grid", ".", "Args", ":", "image", ":", "String", "or", "nibabel", "image", ".", "The", "image", "used", "to", "define", "the", "grid", "dimensions", ".", "Also", "used", "to", ...
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L98-L152
[ "def", "create_grid", "(", "image", ",", "scale", "=", "4", ",", "apply_mask", "=", "True", ",", "save_file", "=", "None", ")", ":", "if", "isinstance", "(", "image", ",", "string_types", ")", ":", "image", "=", "nb", ".", "load", "(", "image", ")", ...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
set_logging_level
Set neurosynth's logging level Args level : str Name of the logging level (warning, error, info, etc) known to logging module. If no level provided, it would get that one from environment variable NEUROSYNTH_LOGLEVEL
neurosynth/__init__.py
def set_logging_level(level=None): """Set neurosynth's logging level Args level : str Name of the logging level (warning, error, info, etc) known to logging module. If no level provided, it would get that one from environment variable NEUROSYNTH_LOGLEVEL """ if level is N...
def set_logging_level(level=None): """Set neurosynth's logging level Args level : str Name of the logging level (warning, error, info, etc) known to logging module. If no level provided, it would get that one from environment variable NEUROSYNTH_LOGLEVEL """ if level is N...
[ "Set", "neurosynth", "s", "logging", "level" ]
neurosynth/neurosynth
python
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/__init__.py#L25-L38
[ "def", "set_logging_level", "(", "level", "=", "None", ")", ":", "if", "level", "is", "None", ":", "level", "=", "os", ".", "environ", ".", "get", "(", "'NEUROSYNTH_LOGLEVEL'", ",", "'warn'", ")", "if", "level", "is", "not", "None", ":", "logger", ".",...
948ce7edce15d7df693446e76834e0c23bfe8f11
test
expand_address
Expand the given address into one or more normalized strings. Required -------- @param address: the address as either Unicode or a UTF-8 encoded string Options ------- @param languages: a tuple or list of ISO language code strings (e.g. "en", "fr", "de", etc.) to use in e...
postal/expand.py
def expand_address(address, languages=None, **kw): """ Expand the given address into one or more normalized strings. Required -------- @param address: the address as either Unicode or a UTF-8 encoded string Options ------- @param languages: a tuple or list of ISO language code strings ...
def expand_address(address, languages=None, **kw): """ Expand the given address into one or more normalized strings. Required -------- @param address: the address as either Unicode or a UTF-8 encoded string Options ------- @param languages: a tuple or list of ISO language code strings ...
[ "Expand", "the", "given", "address", "into", "one", "or", "more", "normalized", "strings", "." ]
openvenues/pypostal
python
https://github.com/openvenues/pypostal/blob/1c0fd96b5e2463b7015cd3625ac276db520c69fe/postal/expand.py#L9-L54
[ "def", "expand_address", "(", "address", ",", "languages", "=", "None", ",", "*", "*", "kw", ")", ":", "address", "=", "safe_decode", "(", "address", ",", "'utf-8'", ")", "return", "_expand", ".", "expand_address", "(", "address", ",", "languages", "=", ...
1c0fd96b5e2463b7015cd3625ac276db520c69fe
test
normalized_tokens
Normalizes a string, tokenizes, and normalizes each token with string and token-level options. This version only uses libpostal's deterministic normalizations i.e. methods with a single output. The string tree version will return multiple normalized strings, each with tokens. Usage: normal...
postal/normalize.py
def normalized_tokens(s, string_options=DEFAULT_STRING_OPTIONS, token_options=DEFAULT_TOKEN_OPTIONS, strip_parentheticals=True, whitespace=False, languages=None): ''' Normalizes a string, tokenizes, and normalizes each token with string and t...
def normalized_tokens(s, string_options=DEFAULT_STRING_OPTIONS, token_options=DEFAULT_TOKEN_OPTIONS, strip_parentheticals=True, whitespace=False, languages=None): ''' Normalizes a string, tokenizes, and normalizes each token with string and t...
[ "Normalizes", "a", "string", "tokenizes", "and", "normalizes", "each", "token", "with", "string", "and", "token", "-", "level", "options", "." ]
openvenues/pypostal
python
https://github.com/openvenues/pypostal/blob/1c0fd96b5e2463b7015cd3625ac276db520c69fe/postal/normalize.py#L57-L78
[ "def", "normalized_tokens", "(", "s", ",", "string_options", "=", "DEFAULT_STRING_OPTIONS", ",", "token_options", "=", "DEFAULT_TOKEN_OPTIONS", ",", "strip_parentheticals", "=", "True", ",", "whitespace", "=", "False", ",", "languages", "=", "None", ")", ":", "s",...
1c0fd96b5e2463b7015cd3625ac276db520c69fe
test
parse_address
Parse address into components. @param address: the address as either Unicode or a UTF-8 encoded string @param language (optional): language code @param country (optional): country code
postal/parser.py
def parse_address(address, language=None, country=None): """ Parse address into components. @param address: the address as either Unicode or a UTF-8 encoded string @param language (optional): language code @param country (optional): country code """ address = safe_decode(address, 'utf-8') ...
def parse_address(address, language=None, country=None): """ Parse address into components. @param address: the address as either Unicode or a UTF-8 encoded string @param language (optional): language code @param country (optional): country code """ address = safe_decode(address, 'utf-8') ...
[ "Parse", "address", "into", "components", "." ]
openvenues/pypostal
python
https://github.com/openvenues/pypostal/blob/1c0fd96b5e2463b7015cd3625ac276db520c69fe/postal/parser.py#L6-L15
[ "def", "parse_address", "(", "address", ",", "language", "=", "None", ",", "country", "=", "None", ")", ":", "address", "=", "safe_decode", "(", "address", ",", "'utf-8'", ")", "return", "_parser", ".", "parse_address", "(", "address", ",", "language", "="...
1c0fd96b5e2463b7015cd3625ac276db520c69fe
test
near_dupe_hashes
Hash the given address into normalized strings that can be used to group similar addresses together for more detailed pairwise comparison. This can be thought of as the blocking function in record linkage or locally-sensitive hashing in the document near-duplicate detection. Required -------- @...
postal/near_dupe.py
def near_dupe_hashes(labels, values, languages=None, **kw): """ Hash the given address into normalized strings that can be used to group similar addresses together for more detailed pairwise comparison. This can be thought of as the blocking function in record linkage or locally-sensitive hashing in the...
def near_dupe_hashes(labels, values, languages=None, **kw): """ Hash the given address into normalized strings that can be used to group similar addresses together for more detailed pairwise comparison. This can be thought of as the blocking function in record linkage or locally-sensitive hashing in the...
[ "Hash", "the", "given", "address", "into", "normalized", "strings", "that", "can", "be", "used", "to", "group", "similar", "addresses", "together", "for", "more", "detailed", "pairwise", "comparison", ".", "This", "can", "be", "thought", "of", "as", "the", "...
openvenues/pypostal
python
https://github.com/openvenues/pypostal/blob/1c0fd96b5e2463b7015cd3625ac276db520c69fe/postal/near_dupe.py#L6-L42
[ "def", "near_dupe_hashes", "(", "labels", ",", "values", ",", "languages", "=", "None", ",", "*", "*", "kw", ")", ":", "return", "_near_dupe", ".", "near_dupe_hashes", "(", "labels", ",", "values", ",", "languages", "=", "languages", ",", "*", "*", "kw",...
1c0fd96b5e2463b7015cd3625ac276db520c69fe
test
has_api_key
Detect whether the file contains an api key in the Token object that is not 40*'0'. See issue #86. :param file: path-to-file to check :return: boolean
tools/api_key_tool.py
def has_api_key(file_name): """ Detect whether the file contains an api key in the Token object that is not 40*'0'. See issue #86. :param file: path-to-file to check :return: boolean """ f = open(file_name, 'r') text = f.read() if re.search(real_api_regex, text) is not None and \ ...
def has_api_key(file_name): """ Detect whether the file contains an api key in the Token object that is not 40*'0'. See issue #86. :param file: path-to-file to check :return: boolean """ f = open(file_name, 'r') text = f.read() if re.search(real_api_regex, text) is not None and \ ...
[ "Detect", "whether", "the", "file", "contains", "an", "api", "key", "in", "the", "Token", "object", "that", "is", "not", "40", "*", "0", ".", "See", "issue", "#86", ".", ":", "param", "file", ":", "path", "-", "to", "-", "file", "to", "check", ":",...
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tools/api_key_tool.py#L16-L28
[ "def", "has_api_key", "(", "file_name", ")", ":", "f", "=", "open", "(", "file_name", ",", "'r'", ")", "text", "=", "f", ".", "read", "(", ")", "if", "re", ".", "search", "(", "real_api_regex", ",", "text", ")", "is", "not", "None", "and", "re", ...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
remove_api_key
Change the api key in the Token object to 40*'0'. See issue #86. :param file: path-to-file to change
tools/api_key_tool.py
def remove_api_key(file_name): """ Change the api key in the Token object to 40*'0'. See issue #86. :param file: path-to-file to change """ with open(file_name, 'r') as fp: text = fp.read() text = re.sub(real_api_regex, zero_token_string, text) with open(file_name, 'w') as fp: ...
def remove_api_key(file_name): """ Change the api key in the Token object to 40*'0'. See issue #86. :param file: path-to-file to change """ with open(file_name, 'r') as fp: text = fp.read() text = re.sub(real_api_regex, zero_token_string, text) with open(file_name, 'w') as fp: ...
[ "Change", "the", "api", "key", "in", "the", "Token", "object", "to", "40", "*", "0", ".", "See", "issue", "#86", ".", ":", "param", "file", ":", "path", "-", "to", "-", "file", "to", "change" ]
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tools/api_key_tool.py#L31-L41
[ "def", "remove_api_key", "(", "file_name", ")", ":", "with", "open", "(", "file_name", ",", "'r'", ")", "as", "fp", ":", "text", "=", "fp", ".", "read", "(", ")", "text", "=", "re", ".", "sub", "(", "real_api_regex", ",", "zero_token_string", ",", "t...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
dict_to_object
Converts a python dict to a namedtuple, saving memory.
tiingo/api.py
def dict_to_object(item, object_name): """Converts a python dict to a namedtuple, saving memory.""" fields = item.keys() values = item.values() return json.loads(json.dumps(item), object_hook=lambda d: namedtuple(object_name, fields)(*values))
def dict_to_object(item, object_name): """Converts a python dict to a namedtuple, saving memory.""" fields = item.keys() values = item.values() return json.loads(json.dumps(item), object_hook=lambda d: namedtuple(object_name, fields)(*values))
[ "Converts", "a", "python", "dict", "to", "a", "namedtuple", "saving", "memory", "." ]
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L44-L50
[ "def", "dict_to_object", "(", "item", ",", "object_name", ")", ":", "fields", "=", "item", ".", "keys", "(", ")", "values", "=", "item", ".", "values", "(", ")", "return", "json", ".", "loads", "(", "json", ".", "dumps", "(", "item", ")", ",", "obj...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
TiingoClient.list_tickers
Return a list of dicts of metadata tickers for all supported tickers of the specified asset type, as well as metadata about each ticker. This includes supported date range, the exchange the ticker is traded on, and the currency the stock is traded on. Tickers for unrelated...
tiingo/api.py
def list_tickers(self, assetType): """Return a list of dicts of metadata tickers for all supported tickers of the specified asset type, as well as metadata about each ticker. This includes supported date range, the exchange the ticker is traded on, and the currency the stock ...
def list_tickers(self, assetType): """Return a list of dicts of metadata tickers for all supported tickers of the specified asset type, as well as metadata about each ticker. This includes supported date range, the exchange the ticker is traded on, and the currency the stock ...
[ "Return", "a", "list", "of", "dicts", "of", "metadata", "tickers", "for", "all", "supported", "tickers", "of", "the", "specified", "asset", "type", "as", "well", "as", "metadata", "about", "each", "ticker", ".", "This", "includes", "supported", "date", "rang...
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L101-L116
[ "def", "list_tickers", "(", "self", ",", "assetType", ")", ":", "listing_file_url", "=", "\"https://apimedia.tiingo.com/docs/tiingo/daily/supported_tickers.zip\"", "response", "=", "requests", ".", "get", "(", "listing_file_url", ")", "zipdata", "=", "get_zipfile_from_respo...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
TiingoClient.get_ticker_metadata
Return metadata for 1 ticker Use TiingoClient.list_tickers() to get available options Args: ticker (str) : Unique identifier for stock
tiingo/api.py
def get_ticker_metadata(self, ticker, fmt='json'): """Return metadata for 1 ticker Use TiingoClient.list_tickers() to get available options Args: ticker (str) : Unique identifier for stock """ url = "tiingo/daily/{}".format(ticker) response = self....
def get_ticker_metadata(self, ticker, fmt='json'): """Return metadata for 1 ticker Use TiingoClient.list_tickers() to get available options Args: ticker (str) : Unique identifier for stock """ url = "tiingo/daily/{}".format(ticker) response = self....
[ "Return", "metadata", "for", "1", "ticker", "Use", "TiingoClient", ".", "list_tickers", "()", "to", "get", "available", "options" ]
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L127-L140
[ "def", "get_ticker_metadata", "(", "self", ",", "ticker", ",", "fmt", "=", "'json'", ")", ":", "url", "=", "\"tiingo/daily/{}\"", ".", "format", "(", "ticker", ")", "response", "=", "self", ".", "_request", "(", "'GET'", ",", "url", ")", "data", "=", "...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
TiingoClient._invalid_frequency
Check to see that frequency was specified correctly :param frequency (string): frequency string :return (boolean):
tiingo/api.py
def _invalid_frequency(self, frequency): """ Check to see that frequency was specified correctly :param frequency (string): frequency string :return (boolean): """ is_valid = self._is_eod_frequency(frequency) or re.match(self._frequency_pattern, frequency) return ...
def _invalid_frequency(self, frequency): """ Check to see that frequency was specified correctly :param frequency (string): frequency string :return (boolean): """ is_valid = self._is_eod_frequency(frequency) or re.match(self._frequency_pattern, frequency) return ...
[ "Check", "to", "see", "that", "frequency", "was", "specified", "correctly", ":", "param", "frequency", "(", "string", ")", ":", "frequency", "string", ":", "return", "(", "boolean", ")", ":" ]
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L142-L149
[ "def", "_invalid_frequency", "(", "self", ",", "frequency", ")", ":", "is_valid", "=", "self", ".", "_is_eod_frequency", "(", "frequency", ")", "or", "re", ".", "match", "(", "self", ".", "_frequency_pattern", ",", "frequency", ")", "return", "not", "is_vali...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
TiingoClient._get_url
Return url based on frequency. Daily, weekly, or yearly use Tiingo EOD api; anything less than daily uses the iex intraday api. :param ticker (string): ticker to be embedded in the url :param frequency (string): valid frequency per Tiingo api :return (string): url
tiingo/api.py
def _get_url(self, ticker, frequency): """ Return url based on frequency. Daily, weekly, or yearly use Tiingo EOD api; anything less than daily uses the iex intraday api. :param ticker (string): ticker to be embedded in the url :param frequency (string): valid frequency per Tiin...
def _get_url(self, ticker, frequency): """ Return url based on frequency. Daily, weekly, or yearly use Tiingo EOD api; anything less than daily uses the iex intraday api. :param ticker (string): ticker to be embedded in the url :param frequency (string): valid frequency per Tiin...
[ "Return", "url", "based", "on", "frequency", ".", "Daily", "weekly", "or", "yearly", "use", "Tiingo", "EOD", "api", ";", "anything", "less", "than", "daily", "uses", "the", "iex", "intraday", "api", ".", ":", "param", "ticker", "(", "string", ")", ":", ...
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L151-L167
[ "def", "_get_url", "(", "self", ",", "ticker", ",", "frequency", ")", ":", "if", "self", ".", "_invalid_frequency", "(", "frequency", ")", ":", "etext", "=", "(", "\"Error: {} is an invalid frequency. Check Tiingo API documentation \"", "\"for valid EOD or intraday frequ...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
TiingoClient.get_ticker_price
By default, return latest EOD Composite Price for a stock ticker. On average, each feed contains 3 data sources. Supported tickers + Available Day Ranges are here: https://apimedia.tiingo.com/docs/tiingo/daily/supported_tickers.zip Args: ticker (string): ...
tiingo/api.py
def get_ticker_price(self, ticker, startDate=None, endDate=None, fmt='json', frequency='daily'): """By default, return latest EOD Composite Price for a stock ticker. On average, each feed contains 3 data sources. Supported tickers + Avail...
def get_ticker_price(self, ticker, startDate=None, endDate=None, fmt='json', frequency='daily'): """By default, return latest EOD Composite Price for a stock ticker. On average, each feed contains 3 data sources. Supported tickers + Avail...
[ "By", "default", "return", "latest", "EOD", "Composite", "Price", "for", "a", "stock", "ticker", ".", "On", "average", "each", "feed", "contains", "3", "data", "sources", "." ]
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L169-L205
[ "def", "get_ticker_price", "(", "self", ",", "ticker", ",", "startDate", "=", "None", ",", "endDate", "=", "None", ",", "fmt", "=", "'json'", ",", "frequency", "=", "'daily'", ")", ":", "url", "=", "self", ".", "_get_url", "(", "ticker", ",", "frequenc...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
TiingoClient.get_dataframe
Return a pandas.DataFrame of historical prices for one or more ticker symbols. By default, return latest EOD Composite Price for a list of stock tickers. On average, each feed contains 3 data sources. Supported tickers + Available Day Ranges are here: https://apimedia.t...
tiingo/api.py
def get_dataframe(self, tickers, startDate=None, endDate=None, metric_name=None, frequency='daily'): """ Return a pandas.DataFrame of historical prices for one or more ticker symbols. By default, return latest EOD Composite Price for a list of stock tickers. On av...
def get_dataframe(self, tickers, startDate=None, endDate=None, metric_name=None, frequency='daily'): """ Return a pandas.DataFrame of historical prices for one or more ticker symbols. By default, return latest EOD Composite Price for a list of stock tickers. On av...
[ "Return", "a", "pandas", ".", "DataFrame", "of", "historical", "prices", "for", "one", "or", "more", "ticker", "symbols", "." ]
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L207-L275
[ "def", "get_dataframe", "(", "self", ",", "tickers", ",", "startDate", "=", "None", ",", "endDate", "=", "None", ",", "metric_name", "=", "None", ",", "frequency", "=", "'daily'", ")", ":", "valid_columns", "=", "[", "'open'", ",", "'high'", ",", "'low'"...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
TiingoClient.get_news
Return list of news articles matching given search terms https://api.tiingo.com/docs/tiingo/news # Dates are in YYYY-MM-DD Format. Args: tickers [string] : List of unique Stock Tickers to search tags [string] : List of topics tagged by Tiingo Algorit...
tiingo/api.py
def get_news(self, tickers=[], tags=[], sources=[], startDate=None, endDate=None, limit=100, offset=0, sortBy="publishedDate", fmt='json'): """Return list of news articles matching given search terms https://api.tiingo.com/docs/tiingo/news # Dates are i...
def get_news(self, tickers=[], tags=[], sources=[], startDate=None, endDate=None, limit=100, offset=0, sortBy="publishedDate", fmt='json'): """Return list of news articles matching given search terms https://api.tiingo.com/docs/tiingo/news # Dates are i...
[ "Return", "list", "of", "news", "articles", "matching", "given", "search", "terms", "https", ":", "//", "api", ".", "tiingo", ".", "com", "/", "docs", "/", "tiingo", "/", "news" ]
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L279-L312
[ "def", "get_news", "(", "self", ",", "tickers", "=", "[", "]", ",", "tags", "=", "[", "]", ",", "sources", "=", "[", "]", ",", "startDate", "=", "None", ",", "endDate", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "sortB...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
TiingoClient.get_bulk_news
Only available to institutional clients. If ID is NOT provided, return array of available file_ids. If ID is provided, provides URL which you can use to download your file, as well as some metadata about that file.
tiingo/api.py
def get_bulk_news(self, file_id=None, fmt='json'): """Only available to institutional clients. If ID is NOT provided, return array of available file_ids. If ID is provided, provides URL which you can use to download your file, as well as some metadata about that file. ...
def get_bulk_news(self, file_id=None, fmt='json'): """Only available to institutional clients. If ID is NOT provided, return array of available file_ids. If ID is provided, provides URL which you can use to download your file, as well as some metadata about that file. ...
[ "Only", "available", "to", "institutional", "clients", ".", "If", "ID", "is", "NOT", "provided", "return", "array", "of", "available", "file_ids", ".", "If", "ID", "is", "provided", "provides", "URL", "which", "you", "can", "use", "to", "download", "your", ...
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/api.py#L314-L330
[ "def", "get_bulk_news", "(", "self", ",", "file_id", "=", "None", ",", "fmt", "=", "'json'", ")", ":", "if", "file_id", ":", "url", "=", "\"tiingo/news/bulk_download/{}\"", ".", "format", "(", "file_id", ")", "else", ":", "url", "=", "\"tiingo/news/bulk_down...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
RestClient._request
Make HTTP request and return response object Args: method (str): GET, POST, PUT, DELETE url (str): path appended to the base_url to create request **kwargs: passed directly to a requests.request object
tiingo/restclient.py
def _request(self, method, url, **kwargs): """Make HTTP request and return response object Args: method (str): GET, POST, PUT, DELETE url (str): path appended to the base_url to create request **kwargs: passed directly to a requests.request object ...
def _request(self, method, url, **kwargs): """Make HTTP request and return response object Args: method (str): GET, POST, PUT, DELETE url (str): path appended to the base_url to create request **kwargs: passed directly to a requests.request object ...
[ "Make", "HTTP", "request", "and", "return", "response", "object" ]
hydrosquall/tiingo-python
python
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tiingo/restclient.py#L39-L58
[ "def", "_request", "(", "self", ",", "method", ",", "url", ",", "*", "*", "kwargs", ")", ":", "resp", "=", "self", ".", "_session", ".", "request", "(", "method", ",", "'{}/{}'", ".", "format", "(", "self", ".", "_base_url", ",", "url", ")", ",", ...
9bb98ca9d24f2e4db651cf0590e4b47184546482
test
HTTPClient.get_bearer_info
Get the application bearer token from client_id and client_secret.
spotify/http.py
async def get_bearer_info(self): """Get the application bearer token from client_id and client_secret.""" if self.client_id is None: raise SpotifyException(_GET_BEARER_ERR % 'client_id') elif self.client_secret is None: raise SpotifyException(_GET_BEARER_ERR % 'client_se...
async def get_bearer_info(self): """Get the application bearer token from client_id and client_secret.""" if self.client_id is None: raise SpotifyException(_GET_BEARER_ERR % 'client_id') elif self.client_secret is None: raise SpotifyException(_GET_BEARER_ERR % 'client_se...
[ "Get", "the", "application", "bearer", "token", "from", "client_id", "and", "client_secret", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L83-L100
[ "async", "def", "get_bearer_info", "(", "self", ")", ":", "if", "self", ".", "client_id", "is", "None", ":", "raise", "SpotifyException", "(", "_GET_BEARER_ERR", "%", "'client_id'", ")", "elif", "self", ".", "client_secret", "is", "None", ":", "raise", "Spot...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.request
Make a request to the spotify API with the current bearer credentials. Parameters ---------- route : Union[tuple[str, str], Route] A tuple of the method and url or a :class:`Route` object. kwargs : Any keyword arguments to pass into :class:`aiohttp.ClientSession....
spotify/http.py
async def request(self, route, **kwargs): """Make a request to the spotify API with the current bearer credentials. Parameters ---------- route : Union[tuple[str, str], Route] A tuple of the method and url or a :class:`Route` object. kwargs : Any keyword ...
async def request(self, route, **kwargs): """Make a request to the spotify API with the current bearer credentials. Parameters ---------- route : Union[tuple[str, str], Route] A tuple of the method and url or a :class:`Route` object. kwargs : Any keyword ...
[ "Make", "a", "request", "to", "the", "spotify", "API", "with", "the", "current", "bearer", "credentials", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L102-L165
[ "async", "def", "request", "(", "self", ",", "route", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "route", ",", "tuple", ")", ":", "method", ",", "url", "=", "route", "else", ":", "method", "=", "route", ".", "method", "url", "=", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.album
Get a spotify album by its ID. Parameters ---------- spotify_id : str The spotify_id to search by. market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ------- album : Dict The album object.
spotify/http.py
def album(self, spotify_id, market='US'): """Get a spotify album by its ID. Parameters ---------- spotify_id : str The spotify_id to search by. market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ------- album : Dic...
def album(self, spotify_id, market='US'): """Get a spotify album by its ID. Parameters ---------- spotify_id : str The spotify_id to search by. market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ------- album : Dic...
[ "Get", "a", "spotify", "album", "by", "its", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L171-L192
[ "def", "album", "(", "self", ",", "spotify_id", ",", "market", "=", "'US'", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/albums/{spotify_id}'", ",", "spotify_id", "=", "spotify_id", ")", "payload", "=", "{", "}", "if", "market", ":", "payload",...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.album_tracks
Get an albums tracks by an ID. Parameters ---------- spotify_id : str The spotify_id to search by. limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset : Optiona[int] The offset of which Spo...
spotify/http.py
def album_tracks(self, spotify_id, limit=20, offset=0, market='US'): """Get an albums tracks by an ID. Parameters ---------- spotify_id : str The spotify_id to search by. limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1...
def album_tracks(self, spotify_id, limit=20, offset=0, market='US'): """Get an albums tracks by an ID. Parameters ---------- spotify_id : str The spotify_id to search by. limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1...
[ "Get", "an", "albums", "tracks", "by", "an", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L194-L214
[ "def", "album_tracks", "(", "self", ",", "spotify_id", ",", "limit", "=", "20", ",", "offset", "=", "0", ",", "market", "=", "'US'", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/albums/{spotify_id}/tracks'", ",", "spotify_id", "=", "spotify_id", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.albums
Get a spotify album by its ID. Parameters ---------- spotify_ids : List[str] The spotify_ids to search by. market : Optional[str] An ISO 3166-1 alpha-2 country code.
spotify/http.py
def albums(self, spotify_ids, market='US'): """Get a spotify album by its ID. Parameters ---------- spotify_ids : List[str] The spotify_ids to search by. market : Optional[str] An ISO 3166-1 alpha-2 country code. """ route = Route('GET', '...
def albums(self, spotify_ids, market='US'): """Get a spotify album by its ID. Parameters ---------- spotify_ids : List[str] The spotify_ids to search by. market : Optional[str] An ISO 3166-1 alpha-2 country code. """ route = Route('GET', '...
[ "Get", "a", "spotify", "album", "by", "its", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L216-L232
[ "def", "albums", "(", "self", ",", "spotify_ids", ",", "market", "=", "'US'", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/albums/'", ")", "payload", "=", "{", "'ids'", ":", "spotify_ids", "}", "if", "market", ":", "payload", "[", "'market'",...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.artist
Get a spotify artist by their ID. Parameters ---------- spotify_id : str The spotify_id to search by.
spotify/http.py
def artist(self, spotify_id): """Get a spotify artist by their ID. Parameters ---------- spotify_id : str The spotify_id to search by. """ route = Route('GET', '/artists/{spotify_id}', spotify_id=spotify_id) return self.request(route)
def artist(self, spotify_id): """Get a spotify artist by their ID. Parameters ---------- spotify_id : str The spotify_id to search by. """ route = Route('GET', '/artists/{spotify_id}', spotify_id=spotify_id) return self.request(route)
[ "Get", "a", "spotify", "artist", "by", "their", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L234-L243
[ "def", "artist", "(", "self", ",", "spotify_id", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/artists/{spotify_id}'", ",", "spotify_id", "=", "spotify_id", ")", "return", "self", ".", "request", "(", "route", ")" ]
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.artist_albums
Get an artists tracks by their ID. Parameters ---------- spotify_id : str The spotify_id to search by. include_groups : INCLUDE_GROUPS_TP INCLUDE_GROUPS limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maxi...
spotify/http.py
def artist_albums(self, spotify_id, include_groups=None, limit=20, offset=0, market='US'): """Get an artists tracks by their ID. Parameters ---------- spotify_id : str The spotify_id to search by. include_groups : INCLUDE_GROUPS_TP INCLUDE_GROUPS ...
def artist_albums(self, spotify_id, include_groups=None, limit=20, offset=0, market='US'): """Get an artists tracks by their ID. Parameters ---------- spotify_id : str The spotify_id to search by. include_groups : INCLUDE_GROUPS_TP INCLUDE_GROUPS ...
[ "Get", "an", "artists", "tracks", "by", "their", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L245-L270
[ "def", "artist_albums", "(", "self", ",", "spotify_id", ",", "include_groups", "=", "None", ",", "limit", "=", "20", ",", "offset", "=", "0", ",", "market", "=", "'US'", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/artists/{spotify_id}/albums'", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.artist_top_tracks
Get an artists top tracks per country with their ID. Parameters ---------- spotify_id : str The spotify_id to search by. country : COUNTRY_TP COUNTRY
spotify/http.py
def artist_top_tracks(self, spotify_id, country): """Get an artists top tracks per country with their ID. Parameters ---------- spotify_id : str The spotify_id to search by. country : COUNTRY_TP COUNTRY """ route = Route('GET', '/artists/{...
def artist_top_tracks(self, spotify_id, country): """Get an artists top tracks per country with their ID. Parameters ---------- spotify_id : str The spotify_id to search by. country : COUNTRY_TP COUNTRY """ route = Route('GET', '/artists/{...
[ "Get", "an", "artists", "top", "tracks", "per", "country", "with", "their", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L272-L284
[ "def", "artist_top_tracks", "(", "self", ",", "spotify_id", ",", "country", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/artists/{spotify_id}/top-tracks'", ",", "spotify_id", "=", "spotify_id", ")", "payload", "=", "{", "'country'", ":", "country", "...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.artist_related_artists
Get related artists for an artist by their ID. Parameters ---------- spotify_id : str The spotify_id to search by.
spotify/http.py
def artist_related_artists(self, spotify_id): """Get related artists for an artist by their ID. Parameters ---------- spotify_id : str The spotify_id to search by. """ route = Route('GET', '/artists/{spotify_id}/related-artists', spotify_id=spotify_id) ...
def artist_related_artists(self, spotify_id): """Get related artists for an artist by their ID. Parameters ---------- spotify_id : str The spotify_id to search by. """ route = Route('GET', '/artists/{spotify_id}/related-artists', spotify_id=spotify_id) ...
[ "Get", "related", "artists", "for", "an", "artist", "by", "their", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L286-L295
[ "def", "artist_related_artists", "(", "self", ",", "spotify_id", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/artists/{spotify_id}/related-artists'", ",", "spotify_id", "=", "spotify_id", ")", "return", "self", ".", "request", "(", "route", ")" ]
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.artists
Get a spotify artists by their IDs. Parameters ---------- spotify_id : List[str] The spotify_ids to search with.
spotify/http.py
def artists(self, spotify_ids): """Get a spotify artists by their IDs. Parameters ---------- spotify_id : List[str] The spotify_ids to search with. """ route = Route('GET', '/artists') payload = {'ids': spotify_ids} return self.request(route, ...
def artists(self, spotify_ids): """Get a spotify artists by their IDs. Parameters ---------- spotify_id : List[str] The spotify_ids to search with. """ route = Route('GET', '/artists') payload = {'ids': spotify_ids} return self.request(route, ...
[ "Get", "a", "spotify", "artists", "by", "their", "IDs", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L297-L307
[ "def", "artists", "(", "self", ",", "spotify_ids", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/artists'", ")", "payload", "=", "{", "'ids'", ":", "spotify_ids", "}", "return", "self", ".", "request", "(", "route", ",", "params", "=", "payloa...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.category
Get a single category used to tag items in Spotify. Parameters ---------- category_id : str The Spotify category ID for the category. country : COUNTRY_TP COUNTRY locale : LOCALE_TP LOCALE
spotify/http.py
def category(self, category_id, country=None, locale=None): """Get a single category used to tag items in Spotify. Parameters ---------- category_id : str The Spotify category ID for the category. country : COUNTRY_TP COUNTRY locale : LOCALE_TP ...
def category(self, category_id, country=None, locale=None): """Get a single category used to tag items in Spotify. Parameters ---------- category_id : str The Spotify category ID for the category. country : COUNTRY_TP COUNTRY locale : LOCALE_TP ...
[ "Get", "a", "single", "category", "used", "to", "tag", "items", "in", "Spotify", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L309-L330
[ "def", "category", "(", "self", ",", "category_id", ",", "country", "=", "None", ",", "locale", "=", "None", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/browse/categories/{category_id}'", ",", "category_id", "=", "category_id", ")", "payload", "="...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.category_playlists
Get a list of Spotify playlists tagged with a particular category. Parameters ---------- category_id : str The Spotify category ID for the category. limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset ...
spotify/http.py
def category_playlists(self, category_id, limit=20, offset=0, country=None): """Get a list of Spotify playlists tagged with a particular category. Parameters ---------- category_id : str The Spotify category ID for the category. limit : Optional[int] The ...
def category_playlists(self, category_id, limit=20, offset=0, country=None): """Get a list of Spotify playlists tagged with a particular category. Parameters ---------- category_id : str The Spotify category ID for the category. limit : Optional[int] The ...
[ "Get", "a", "list", "of", "Spotify", "playlists", "tagged", "with", "a", "particular", "category", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L332-L352
[ "def", "category_playlists", "(", "self", ",", "category_id", ",", "limit", "=", "20", ",", "offset", "=", "0", ",", "country", "=", "None", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/browse/categories/{category_id}/playlists'", ",", "category_id",...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.categories
Get a list of categories used to tag items in Spotify. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset : Optional[int] The index of the first item to return. Default: 0 countr...
spotify/http.py
def categories(self, limit=20, offset=0, country=None, locale=None): """Get a list of categories used to tag items in Spotify. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset : Optional[i...
def categories(self, limit=20, offset=0, country=None, locale=None): """Get a list of categories used to tag items in Spotify. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset : Optional[i...
[ "Get", "a", "list", "of", "categories", "used", "to", "tag", "items", "in", "Spotify", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L354-L377
[ "def", "categories", "(", "self", ",", "limit", "=", "20", ",", "offset", "=", "0", ",", "country", "=", "None", ",", "locale", "=", "None", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/browse/categories'", ")", "payload", "=", "{", "'limit...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.featured_playlists
Get a list of Spotify featured playlists. Parameters ---------- locale : LOCALE_TP LOCALE country : COUNTRY_TP COUNTRY timestamp : TIMESTAMP_TP TIMESTAMP limit : Optional[int] The maximum number of items to return. Default:...
spotify/http.py
def featured_playlists(self, locale=None, country=None, timestamp=None, limit=20, offset=0): """Get a list of Spotify featured playlists. Parameters ---------- locale : LOCALE_TP LOCALE country : COUNTRY_TP COUNTRY timestamp : TIMESTAMP_TP ...
def featured_playlists(self, locale=None, country=None, timestamp=None, limit=20, offset=0): """Get a list of Spotify featured playlists. Parameters ---------- locale : LOCALE_TP LOCALE country : COUNTRY_TP COUNTRY timestamp : TIMESTAMP_TP ...
[ "Get", "a", "list", "of", "Spotify", "featured", "playlists", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L379-L407
[ "def", "featured_playlists", "(", "self", ",", "locale", "=", "None", ",", "country", "=", "None", ",", "timestamp", "=", "None", ",", "limit", "=", "20", ",", "offset", "=", "0", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/browse/featured-p...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.new_releases
Get a list of new album releases featured in Spotify. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset : Optional[int] The index of the first item to return. Default: 0 country...
spotify/http.py
def new_releases(self, *, country=None, limit=20, offset=0): """Get a list of new album releases featured in Spotify. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset : Optional[int] ...
def new_releases(self, *, country=None, limit=20, offset=0): """Get a list of new album releases featured in Spotify. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset : Optional[int] ...
[ "Get", "a", "list", "of", "new", "album", "releases", "featured", "in", "Spotify", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L409-L427
[ "def", "new_releases", "(", "self", ",", "*", ",", "country", "=", "None", ",", "limit", "=", "20", ",", "offset", "=", "0", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/browse/new-releases'", ")", "payload", "=", "{", "'limit'", ":", "limi...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.recommendations
Get Recommendations Based on Seeds. Parameters ---------- seed_artists : str A comma separated list of Spotify IDs for seed artists. Up to 5 seed values may be provided. seed_genres : str A comma separated list of any genres in the set of available genre seeds. U...
spotify/http.py
def recommendations(self, seed_artists, seed_genres, seed_tracks, *, limit=20, market=None, **filters): """Get Recommendations Based on Seeds. Parameters ---------- seed_artists : str A comma separated list of Spotify IDs for seed artists. Up to 5 seed values may be provided...
def recommendations(self, seed_artists, seed_genres, seed_tracks, *, limit=20, market=None, **filters): """Get Recommendations Based on Seeds. Parameters ---------- seed_artists : str A comma separated list of Spotify IDs for seed artists. Up to 5 seed values may be provided...
[ "Get", "Recommendations", "Based", "on", "Seeds", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L429-L460
[ "def", "recommendations", "(", "self", ",", "seed_artists", ",", "seed_genres", ",", "seed_tracks", ",", "*", ",", "limit", "=", "20", ",", "market", "=", "None", ",", "*", "*", "filters", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/recommen...
bb296cac7c3dd289908906b7069bd80f43950515
test
HTTPClient.following_artists_or_users
Check to see if the current user is following one or more artists or other Spotify users. Parameters ---------- ids : List[str] A comma-separated list of the artist or the user Spotify IDs to check. A maximum of 50 IDs can be sent in one request. type : Optional[...
spotify/http.py
def following_artists_or_users(self, ids, *, type='artist'): """Check to see if the current user is following one or more artists or other Spotify users. Parameters ---------- ids : List[str] A comma-separated list of the artist or the user Spotify IDs to check. ...
def following_artists_or_users(self, ids, *, type='artist'): """Check to see if the current user is following one or more artists or other Spotify users. Parameters ---------- ids : List[str] A comma-separated list of the artist or the user Spotify IDs to check. ...
[ "Check", "to", "see", "if", "the", "current", "user", "is", "following", "one", "or", "more", "artists", "or", "other", "Spotify", "users", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L462-L477
[ "def", "following_artists_or_users", "(", "self", ",", "ids", ",", "*", ",", "type", "=", "'artist'", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/me/following/contains'", ")", "payload", "=", "{", "'ids'", ":", "ids", ",", "'type'", ":", "type...
bb296cac7c3dd289908906b7069bd80f43950515
test
Artist.get_albums
Get the albums of a Spotify artist. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. offset : Optiona[int] The offset of which Spotify should start yielding from. include_groups : INC...
spotify/models/artist.py
async def get_albums(self, *, limit: Optional[int] = 20, offset: Optional[int] = 0, include_groups=None, market: Optional[str] = None) -> List[Album]: """Get the albums of a Spotify artist. Parameters ---------- limit : Optional[int] The maximum number of items to return. De...
async def get_albums(self, *, limit: Optional[int] = 20, offset: Optional[int] = 0, include_groups=None, market: Optional[str] = None) -> List[Album]: """Get the albums of a Spotify artist. Parameters ---------- limit : Optional[int] The maximum number of items to return. De...
[ "Get", "the", "albums", "of", "a", "Spotify", "artist", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/artist.py#L52-L74
[ "async", "def", "get_albums", "(", "self", ",", "*", ",", "limit", ":", "Optional", "[", "int", "]", "=", "20", ",", "offset", ":", "Optional", "[", "int", "]", "=", "0", ",", "include_groups", "=", "None", ",", "market", ":", "Optional", "[", "str...
bb296cac7c3dd289908906b7069bd80f43950515
test
Artist.get_all_albums
loads all of the artists albums, depending on how many the artist has this may be a long operation. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ------- albums : List[Album] The albums of the artist.
spotify/models/artist.py
async def get_all_albums(self, *, market='US') -> List[Album]: """loads all of the artists albums, depending on how many the artist has this may be a long operation. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ---...
async def get_all_albums(self, *, market='US') -> List[Album]: """loads all of the artists albums, depending on how many the artist has this may be a long operation. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ---...
[ "loads", "all", "of", "the", "artists", "albums", "depending", "on", "how", "many", "the", "artist", "has", "this", "may", "be", "a", "long", "operation", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/artist.py#L76-L101
[ "async", "def", "get_all_albums", "(", "self", ",", "*", ",", "market", "=", "'US'", ")", "->", "List", "[", "Album", "]", ":", "from", ".", "album", "import", "Album", "albums", "=", "[", "]", "offset", "=", "0", "total", "=", "await", "self", "."...
bb296cac7c3dd289908906b7069bd80f43950515
test
Artist.total_albums
get the total amout of tracks in the album. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ------- total : int The total amount of albums.
spotify/models/artist.py
async def total_albums(self, *, market: str = None) -> int: """get the total amout of tracks in the album. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ------- total : int The total amount of al...
async def total_albums(self, *, market: str = None) -> int: """get the total amout of tracks in the album. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Returns ------- total : int The total amount of al...
[ "get", "the", "total", "amout", "of", "tracks", "in", "the", "album", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/artist.py#L103-L117
[ "async", "def", "total_albums", "(", "self", ",", "*", ",", "market", ":", "str", "=", "None", ")", "->", "int", ":", "data", "=", "await", "self", ".", "__client", ".", "http", ".", "artist_albums", "(", "self", ".", "id", ",", "limit", "=", "1", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
Artist.top_tracks
Get Spotify catalog information about an artist’s top tracks by country. Parameters ---------- country : str The country to search for, it defaults to 'US'. Returns ------- tracks : List[Track] The artists top tracks.
spotify/models/artist.py
async def top_tracks(self, country: str = 'US') -> List[Track]: """Get Spotify catalog information about an artist’s top tracks by country. Parameters ---------- country : str The country to search for, it defaults to 'US'. Returns ------- tracks : L...
async def top_tracks(self, country: str = 'US') -> List[Track]: """Get Spotify catalog information about an artist’s top tracks by country. Parameters ---------- country : str The country to search for, it defaults to 'US'. Returns ------- tracks : L...
[ "Get", "Spotify", "catalog", "information", "about", "an", "artist’s", "top", "tracks", "by", "country", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/artist.py#L119-L135
[ "async", "def", "top_tracks", "(", "self", ",", "country", ":", "str", "=", "'US'", ")", "->", "List", "[", "Track", "]", ":", "from", ".", "track", "import", "Track", "top", "=", "await", "self", ".", "__client", ".", "http", ".", "artist_top_tracks",...
bb296cac7c3dd289908906b7069bd80f43950515
test
Artist.related_artists
Get Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community’s listening history. Returns ------- artists : List[Artits] The artists deemed similar.
spotify/models/artist.py
async def related_artists(self) -> List[Artist]: """Get Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community’s listening history. Returns ------- artists : List[Artits] The artists deemed simil...
async def related_artists(self) -> List[Artist]: """Get Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community’s listening history. Returns ------- artists : List[Artits] The artists deemed simil...
[ "Get", "Spotify", "catalog", "information", "about", "artists", "similar", "to", "a", "given", "artist", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/artist.py#L137-L148
[ "async", "def", "related_artists", "(", "self", ")", "->", "List", "[", "Artist", "]", ":", "related", "=", "await", "self", ".", "__client", ".", "http", ".", "artist_related_artists", "(", "self", ".", "id", ")", "return", "list", "(", "Artist", "(", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.currently_playing
Get the users currently playing track. Returns ------- context, track : Tuple[Context, Track] A tuple of the context and track.
spotify/models/user.py
async def currently_playing(self) -> Tuple[Context, Track]: """Get the users currently playing track. Returns ------- context, track : Tuple[Context, Track] A tuple of the context and track. """ data = await self.http.currently_playing() if data.get(...
async def currently_playing(self) -> Tuple[Context, Track]: """Get the users currently playing track. Returns ------- context, track : Tuple[Context, Track] A tuple of the context and track. """ data = await self.http.currently_playing() if data.get(...
[ "Get", "the", "users", "currently", "playing", "track", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L157-L171
[ "async", "def", "currently_playing", "(", "self", ")", "->", "Tuple", "[", "Context", ",", "Track", "]", ":", "data", "=", "await", "self", ".", "http", ".", "currently_playing", "(", ")", "if", "data", ".", "get", "(", "'item'", ")", ":", "data", "[...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.get_player
Get information about the users current playback. Returns ------- player : Player A player object representing the current playback.
spotify/models/user.py
async def get_player(self) -> Player: """Get information about the users current playback. Returns ------- player : Player A player object representing the current playback. """ self._player = player = Player(self.__client, self, await self.http.current_playe...
async def get_player(self) -> Player: """Get information about the users current playback. Returns ------- player : Player A player object representing the current playback. """ self._player = player = Player(self.__client, self, await self.http.current_playe...
[ "Get", "information", "about", "the", "users", "current", "playback", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L174-L183
[ "async", "def", "get_player", "(", "self", ")", "->", "Player", ":", "self", ".", "_player", "=", "player", "=", "Player", "(", "self", ".", "__client", ",", "self", ",", "await", "self", ".", "http", ".", "current_player", "(", ")", ")", "return", "...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.get_devices
Get information about the users avaliable devices. Returns ------- devices : List[Device] The devices the user has available.
spotify/models/user.py
async def get_devices(self) -> List[Device]: """Get information about the users avaliable devices. Returns ------- devices : List[Device] The devices the user has available. """ data = await self.http.available_devices() return [Device(item) for item ...
async def get_devices(self) -> List[Device]: """Get information about the users avaliable devices. Returns ------- devices : List[Device] The devices the user has available. """ data = await self.http.available_devices() return [Device(item) for item ...
[ "Get", "information", "about", "the", "users", "avaliable", "devices", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L186-L195
[ "async", "def", "get_devices", "(", "self", ")", "->", "List", "[", "Device", "]", ":", "data", "=", "await", "self", ".", "http", ".", "available_devices", "(", ")", "return", "[", "Device", "(", "item", ")", "for", "item", "in", "data", "[", "'devi...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.recently_played
Get tracks from the current users recently played tracks. Returns ------- playlist_history : List[Dict[str, Union[Track, Context, str]]] A list of playlist history object. Each object is a dict with a timestamp, track and context field.
spotify/models/user.py
async def recently_played(self) -> List[Dict[str, Union[Track, Context, str]]]: """Get tracks from the current users recently played tracks. Returns ------- playlist_history : List[Dict[str, Union[Track, Context, str]]] A list of playlist history object. Each obj...
async def recently_played(self) -> List[Dict[str, Union[Track, Context, str]]]: """Get tracks from the current users recently played tracks. Returns ------- playlist_history : List[Dict[str, Union[Track, Context, str]]] A list of playlist history object. Each obj...
[ "Get", "tracks", "from", "the", "current", "users", "recently", "played", "tracks", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L198-L210
[ "async", "def", "recently_played", "(", "self", ")", "->", "List", "[", "Dict", "[", "str", ",", "Union", "[", "Track", ",", "Context", ",", "str", "]", "]", "]", ":", "data", "=", "await", "self", ".", "http", ".", "recently_played", "(", ")", "f"...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.add_tracks
Add one or more tracks to a user’s playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify tracks : Sequence[Union[str, Track]] Tracks to add to the playlistv Returns ------- snapshot_id : str T...
spotify/models/user.py
async def add_tracks(self, playlist: Union[str, Playlist], *tracks) -> str: """Add one or more tracks to a user’s playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify tracks : Sequence[Union[str, Track]] Tracks to add to ...
async def add_tracks(self, playlist: Union[str, Playlist], *tracks) -> str: """Add one or more tracks to a user’s playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify tracks : Sequence[Union[str, Track]] Tracks to add to ...
[ "Add", "one", "or", "more", "tracks", "to", "a", "user’s", "playlist", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L214-L231
[ "async", "def", "add_tracks", "(", "self", ",", "playlist", ":", "Union", "[", "str", ",", "Playlist", "]", ",", "*", "tracks", ")", "->", "str", ":", "tracks", "=", "[", "str", "(", "track", ")", "for", "track", "in", "tracks", "]", "data", "=", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.replace_tracks
Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for replacing tracks, re-ordering existing tracks, or clearing the playlist. Parameters ---------- playlist : Union[str, PLaylist] The playlist to modify track...
spotify/models/user.py
async def replace_tracks(self, playlist, *tracks) -> str: """Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for replacing tracks, re-ordering existing tracks, or clearing the playlist. Parameters ---------- playlist : ...
async def replace_tracks(self, playlist, *tracks) -> str: """Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for replacing tracks, re-ordering existing tracks, or clearing the playlist. Parameters ---------- playlist : ...
[ "Replace", "all", "the", "tracks", "in", "a", "playlist", "overwriting", "its", "existing", "tracks", ".", "This", "powerful", "request", "can", "be", "useful", "for", "replacing", "tracks", "re", "-", "ordering", "existing", "tracks", "or", "clearing", "the",...
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L233-L245
[ "async", "def", "replace_tracks", "(", "self", ",", "playlist", ",", "*", "tracks", ")", "->", "str", ":", "tracks", "=", "[", "str", "(", "track", ")", "for", "track", "in", "tracks", "]", "await", "self", ".", "http", ".", "replace_playlist_tracks", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.remove_tracks
Remove one or more tracks from a user’s playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify tracks : Sequence[Union[str, Track]] Tracks to remove from the playlist Returns ------- snapshot_id : str ...
spotify/models/user.py
async def remove_tracks(self, playlist, *tracks): """Remove one or more tracks from a user’s playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify tracks : Sequence[Union[str, Track]] Tracks to remove from the playlist ...
async def remove_tracks(self, playlist, *tracks): """Remove one or more tracks from a user’s playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify tracks : Sequence[Union[str, Track]] Tracks to remove from the playlist ...
[ "Remove", "one", "or", "more", "tracks", "from", "a", "user’s", "playlist", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L247-L264
[ "async", "def", "remove_tracks", "(", "self", ",", "playlist", ",", "*", "tracks", ")", ":", "tracks", "=", "[", "str", "(", "track", ")", "for", "track", "in", "tracks", "]", "data", "=", "await", "self", ".", "http", ".", "remove_playlist_tracks", "(...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.reorder_tracks
Reorder a track or a group of tracks in a playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify start : int The position of the first track to be reordered. insert_before : int The position where the tracks sho...
spotify/models/user.py
async def reorder_tracks(self, playlist, start, insert_before, length=1, *, snapshot_id=None): """Reorder a track or a group of tracks in a playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify start : int The position of ...
async def reorder_tracks(self, playlist, start, insert_before, length=1, *, snapshot_id=None): """Reorder a track or a group of tracks in a playlist. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify start : int The position of ...
[ "Reorder", "a", "track", "or", "a", "group", "of", "tracks", "in", "a", "playlist", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L266-L288
[ "async", "def", "reorder_tracks", "(", "self", ",", "playlist", ",", "start", ",", "insert_before", ",", "length", "=", "1", ",", "*", ",", "snapshot_id", "=", "None", ")", ":", "data", "=", "await", "self", ".", "http", ".", "reorder_playlists_tracks", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.edit_playlist
Change a playlist’s name and public/private, collaborative state and description. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify name : Optional[str] The new name of the playlist. public : Optional[bool] The publi...
spotify/models/user.py
async def edit_playlist(self, playlist, *, name=None, public=None, collaborative=None, description=None): """Change a playlist’s name and public/private, collaborative state and description. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify ...
async def edit_playlist(self, playlist, *, name=None, public=None, collaborative=None, description=None): """Change a playlist’s name and public/private, collaborative state and description. Parameters ---------- playlist : Union[str, Playlist] The playlist to modify ...
[ "Change", "a", "playlist’s", "name", "and", "public", "/", "private", "collaborative", "state", "and", "description", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L293-L324
[ "async", "def", "edit_playlist", "(", "self", ",", "playlist", ",", "*", ",", "name", "=", "None", ",", "public", "=", "None", ",", "collaborative", "=", "None", ",", "description", "=", "None", ")", ":", "data", "=", "{", "}", "if", "name", ":", "...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.create_playlist
Create a playlist for a Spotify user. Parameters ---------- name : str The name of the playlist. public : Optional[bool] The public/private status of the playlist. `True` for public, `False` for private. collaborative : Optional[bool] ...
spotify/models/user.py
async def create_playlist(self, name, *, public=True, collaborative=False, description=None): """Create a playlist for a Spotify user. Parameters ---------- name : str The name of the playlist. public : Optional[bool] The public/private status of the play...
async def create_playlist(self, name, *, public=True, collaborative=False, description=None): """Create a playlist for a Spotify user. Parameters ---------- name : str The name of the playlist. public : Optional[bool] The public/private status of the play...
[ "Create", "a", "playlist", "for", "a", "Spotify", "user", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L327-L357
[ "async", "def", "create_playlist", "(", "self", ",", "name", ",", "*", ",", "public", "=", "True", ",", "collaborative", "=", "False", ",", "description", "=", "None", ")", ":", "data", "=", "{", "'name'", ":", "name", ",", "'public'", ":", "public", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
User.get_playlists
get the users playlists from spotify. Parameters ---------- limit : Optional[int] The limit on how many playlists to retrieve for this user (default is 20). offset : Optional[int] The offset from where the api should start from in the playlists. Retu...
spotify/models/user.py
async def get_playlists(self, *, limit=20, offset=0): """get the users playlists from spotify. Parameters ---------- limit : Optional[int] The limit on how many playlists to retrieve for this user (default is 20). offset : Optional[int] The offset fro...
async def get_playlists(self, *, limit=20, offset=0): """get the users playlists from spotify. Parameters ---------- limit : Optional[int] The limit on how many playlists to retrieve for this user (default is 20). offset : Optional[int] The offset fro...
[ "get", "the", "users", "playlists", "from", "spotify", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/user.py#L359-L380
[ "async", "def", "get_playlists", "(", "self", ",", "*", ",", "limit", "=", "20", ",", "offset", "=", "0", ")", ":", "if", "hasattr", "(", "self", ",", "'http'", ")", ":", "http", "=", "self", ".", "http", "else", ":", "http", "=", "self", ".", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
Album.get_tracks
get the albums tracks from spotify. Parameters ---------- limit : Optional[int] The limit on how many tracks to retrieve for this album (default is 20). offset : Optional[int] The offset from where the api should start from in the tracks. Returns...
spotify/models/album.py
async def get_tracks(self, *, limit: Optional[int] = 20, offset: Optional[int] = 0) -> List[Track]: """get the albums tracks from spotify. Parameters ---------- limit : Optional[int] The limit on how many tracks to retrieve for this album (default is 20). offset : Op...
async def get_tracks(self, *, limit: Optional[int] = 20, offset: Optional[int] = 0) -> List[Track]: """get the albums tracks from spotify. Parameters ---------- limit : Optional[int] The limit on how many tracks to retrieve for this album (default is 20). offset : Op...
[ "get", "the", "albums", "tracks", "from", "spotify", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/album.py#L73-L89
[ "async", "def", "get_tracks", "(", "self", ",", "*", ",", "limit", ":", "Optional", "[", "int", "]", "=", "20", ",", "offset", ":", "Optional", "[", "int", "]", "=", "0", ")", "->", "List", "[", "Track", "]", ":", "data", "=", "await", "self", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
Album.get_all_tracks
loads all of the albums tracks, depending on how many the album has this may be a long operation. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. Returns ------- ...
spotify/models/album.py
async def get_all_tracks(self, *, market: Optional[str] = 'US') -> List[Track]: """loads all of the albums tracks, depending on how many the album has this may be a long operation. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Provide this ...
async def get_all_tracks(self, *, market: Optional[str] = 'US') -> List[Track]: """loads all of the albums tracks, depending on how many the album has this may be a long operation. Parameters ---------- market : Optional[str] An ISO 3166-1 alpha-2 country code. Provide this ...
[ "loads", "all", "of", "the", "albums", "tracks", "depending", "on", "how", "many", "the", "album", "has", "this", "may", "be", "a", "long", "operation", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/album.py#L91-L120
[ "async", "def", "get_all_tracks", "(", "self", ",", "*", ",", "market", ":", "Optional", "[", "str", "]", "=", "'US'", ")", "->", "List", "[", "Track", "]", ":", "tracks", "=", "[", "]", "offset", "=", "0", "total", "=", "self", ".", "total_tracks"...
bb296cac7c3dd289908906b7069bd80f43950515
test
Client.oauth2_url
Generate an outh2 url for user authentication. Parameters ---------- redirect_uri : str Where spotify should redirect the user to after authentication. scope : Optional[str] Space seperated spotify scopes for different levels of access. state : Optional[s...
spotify/client.py
def oauth2_url(self, redirect_uri: str, scope: Optional[str] = None, state: Optional[str] = None) -> str: """Generate an outh2 url for user authentication. Parameters ---------- redirect_uri : str Where spotify should redirect the user to after authentication. scope ...
def oauth2_url(self, redirect_uri: str, scope: Optional[str] = None, state: Optional[str] = None) -> str: """Generate an outh2 url for user authentication. Parameters ---------- redirect_uri : str Where spotify should redirect the user to after authentication. scope ...
[ "Generate", "an", "outh2", "url", "for", "user", "authentication", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L68-L85
[ "def", "oauth2_url", "(", "self", ",", "redirect_uri", ":", "str", ",", "scope", ":", "Optional", "[", "str", "]", "=", "None", ",", "state", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "str", ":", "return", "OAuth2", ".", "url_", "("...
bb296cac7c3dd289908906b7069bd80f43950515
test
Client.get_album
Retrive an album with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. market : Optional[str] An ISO 3166-1 alpha-2 country code Returns ------- album : Album The album from the ID
spotify/client.py
async def get_album(self, spotify_id: str, *, market: str = 'US') -> Album: """Retrive an album with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. market : Optional[str] An ISO 3166-1 alpha-2 country code Returns ...
async def get_album(self, spotify_id: str, *, market: str = 'US') -> Album: """Retrive an album with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. market : Optional[str] An ISO 3166-1 alpha-2 country code Returns ...
[ "Retrive", "an", "album", "with", "a", "spotify", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L108-L124
[ "async", "def", "get_album", "(", "self", ",", "spotify_id", ":", "str", ",", "*", ",", "market", ":", "str", "=", "'US'", ")", "->", "Album", ":", "data", "=", "await", "self", ".", "http", ".", "album", "(", "to_id", "(", "spotify_id", ")", ",", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
Client.get_artist
Retrive an artist with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- artist : Artist The artist from the ID
spotify/client.py
async def get_artist(self, spotify_id: str) -> Artist: """Retrive an artist with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- artist : Artist The artist from the ID """ data = ...
async def get_artist(self, spotify_id: str) -> Artist: """Retrive an artist with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- artist : Artist The artist from the ID """ data = ...
[ "Retrive", "an", "artist", "with", "a", "spotify", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L126-L140
[ "async", "def", "get_artist", "(", "self", ",", "spotify_id", ":", "str", ")", "->", "Artist", ":", "data", "=", "await", "self", ".", "http", ".", "artist", "(", "to_id", "(", "spotify_id", ")", ")", "return", "Artist", "(", "self", ",", "data", ")"...
bb296cac7c3dd289908906b7069bd80f43950515
test
Client.get_track
Retrive an track with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- track : Track The track from the ID
spotify/client.py
async def get_track(self, spotify_id: str) -> Track: """Retrive an track with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- track : Track The track from the ID """ data = await ...
async def get_track(self, spotify_id: str) -> Track: """Retrive an track with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- track : Track The track from the ID """ data = await ...
[ "Retrive", "an", "track", "with", "a", "spotify", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L142-L156
[ "async", "def", "get_track", "(", "self", ",", "spotify_id", ":", "str", ")", "->", "Track", ":", "data", "=", "await", "self", ".", "http", ".", "track", "(", "to_id", "(", "spotify_id", ")", ")", "return", "Track", "(", "self", ",", "data", ")" ]
bb296cac7c3dd289908906b7069bd80f43950515
test
Client.get_user
Retrive an user with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- user : User The user from the ID
spotify/client.py
async def get_user(self, spotify_id: str) -> User: """Retrive an user with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- user : User The user from the ID """ data = await self.h...
async def get_user(self, spotify_id: str) -> User: """Retrive an user with a spotify ID. Parameters ---------- spotify_id : str The ID to search for. Returns ------- user : User The user from the ID """ data = await self.h...
[ "Retrive", "an", "user", "with", "a", "spotify", "ID", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L158-L172
[ "async", "def", "get_user", "(", "self", ",", "spotify_id", ":", "str", ")", "->", "User", ":", "data", "=", "await", "self", ".", "http", ".", "user", "(", "to_id", "(", "spotify_id", ")", ")", "return", "User", "(", "self", ",", "data", ")" ]
bb296cac7c3dd289908906b7069bd80f43950515
test
Client.get_albums
Retrive multiple albums with a list of spotify IDs. Parameters ---------- ids : List[str] the ID to look for market : Optional[str] An ISO 3166-1 alpha-2 country code Returns ------- albums : List[Album] The albums from the ID...
spotify/client.py
async def get_albums(self, *ids: List[str], market: str = 'US') -> List[Album]: """Retrive multiple albums with a list of spotify IDs. Parameters ---------- ids : List[str] the ID to look for market : Optional[str] An ISO 3166-1 alpha-2 country code ...
async def get_albums(self, *ids: List[str], market: str = 'US') -> List[Album]: """Retrive multiple albums with a list of spotify IDs. Parameters ---------- ids : List[str] the ID to look for market : Optional[str] An ISO 3166-1 alpha-2 country code ...
[ "Retrive", "multiple", "albums", "with", "a", "list", "of", "spotify", "IDs", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L176-L192
[ "async", "def", "get_albums", "(", "self", ",", "*", "ids", ":", "List", "[", "str", "]", ",", "market", ":", "str", "=", "'US'", ")", "->", "List", "[", "Album", "]", ":", "data", "=", "await", "self", ".", "http", ".", "albums", "(", "','", "...
bb296cac7c3dd289908906b7069bd80f43950515
test
Client.get_artists
Retrive multiple artists with a list of spotify IDs. Parameters ---------- ids : List[str] the IDs to look for Returns ------- artists : List[Artist] The artists from the IDs
spotify/client.py
async def get_artists(self, *ids: List[str]) -> List[Artist]: """Retrive multiple artists with a list of spotify IDs. Parameters ---------- ids : List[str] the IDs to look for Returns ------- artists : List[Artist] The artists from the ID...
async def get_artists(self, *ids: List[str]) -> List[Artist]: """Retrive multiple artists with a list of spotify IDs. Parameters ---------- ids : List[str] the IDs to look for Returns ------- artists : List[Artist] The artists from the ID...
[ "Retrive", "multiple", "artists", "with", "a", "list", "of", "spotify", "IDs", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L194-L208
[ "async", "def", "get_artists", "(", "self", ",", "*", "ids", ":", "List", "[", "str", "]", ")", "->", "List", "[", "Artist", "]", ":", "data", "=", "await", "self", ".", "http", ".", "artists", "(", "','", ".", "join", "(", "to_id", "(", "_id", ...
bb296cac7c3dd289908906b7069bd80f43950515
test
Client.search
Access the spotify search functionality. Parameters ---------- q : str the search query types : Optional[Iterable[str]] A sequence of search types (can be any of `track`, `playlist`, `artist` or `album`) to refine the search request. A `ValueError` ma...
spotify/client.py
async def search(self, q: str, *, types: Optional[Iterable[str]] = ['track', 'playlist', 'artist', 'album'], limit: Optional[int] = 20, offset: Optional[int] = 0, market: Optional[str] = None) -> Dict[str, List[Union[Track, Playlist, Artist, Album]]]: """Access the spotify search functionality. Paramet...
async def search(self, q: str, *, types: Optional[Iterable[str]] = ['track', 'playlist', 'artist', 'album'], limit: Optional[int] = 20, offset: Optional[int] = 0, market: Optional[str] = None) -> Dict[str, List[Union[Track, Playlist, Artist, Album]]]: """Access the spotify search functionality. Paramet...
[ "Access", "the", "spotify", "search", "functionality", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/client.py#L210-L254
[ "async", "def", "search", "(", "self", ",", "q", ":", "str", ",", "*", ",", "types", ":", "Optional", "[", "Iterable", "[", "str", "]", "]", "=", "[", "'track'", ",", "'playlist'", ",", "'artist'", ",", "'album'", "]", ",", "limit", ":", "Optional"...
bb296cac7c3dd289908906b7069bd80f43950515
test
Library.contains_albums
Check if one or more albums is already saved in the current Spotify user’s ‘Your Music’ library. Parameters ---------- albums : Union[Album, str] A sequence of artist objects or spotify IDs
spotify/models/library.py
async def contains_albums(self, *albums: Sequence[Union[str, Album]]) -> List[bool]: """Check if one or more albums is already saved in the current Spotify user’s ‘Your Music’ library. Parameters ---------- albums : Union[Album, str] A sequence of artist objects or spotify I...
async def contains_albums(self, *albums: Sequence[Union[str, Album]]) -> List[bool]: """Check if one or more albums is already saved in the current Spotify user’s ‘Your Music’ library. Parameters ---------- albums : Union[Album, str] A sequence of artist objects or spotify I...
[ "Check", "if", "one", "or", "more", "albums", "is", "already", "saved", "in", "the", "current", "Spotify", "user’s", "‘Your", "Music’", "library", "." ]
mental32/spotify.py
python
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/library.py#L29-L38
[ "async", "def", "contains_albums", "(", "self", ",", "*", "albums", ":", "Sequence", "[", "Union", "[", "str", ",", "Album", "]", "]", ")", "->", "List", "[", "bool", "]", ":", "_albums", "=", "[", "(", "obj", "if", "isinstance", "(", "obj", ",", ...
bb296cac7c3dd289908906b7069bd80f43950515