repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
annayqho/TheCannon
TheCannon/helpers/corner/corner.py
hist2d
def hist2d(x, y, bins=20, range=None, weights=None, levels=None, smooth=None, ax=None, color=None, plot_datapoints=True, plot_density=True, plot_contours=True, no_fill_contours=False, fill_contours=False, contour_kwargs=None, contourf_kwargs=None, data_kwargs=None, **kwargs):...
python
def hist2d(x, y, bins=20, range=None, weights=None, levels=None, smooth=None, ax=None, color=None, plot_datapoints=True, plot_density=True, plot_contours=True, no_fill_contours=False, fill_contours=False, contour_kwargs=None, contourf_kwargs=None, data_kwargs=None, **kwargs):...
[ "def", "hist2d", "(", "x", ",", "y", ",", "bins", "=", "20", ",", "range", "=", "None", ",", "weights", "=", "None", ",", "levels", "=", "None", ",", "smooth", "=", "None", ",", "ax", "=", "None", ",", "color", "=", "None", ",", "plot_datapoints"...
Plot a 2-D histogram of samples. Parameters ---------- x, y : array_like (nsamples,) The samples. levels : array_like The contour levels to draw. ax : matplotlib.Axes (optional) A axes instance on which to add the 2-D histogram. plot_datapoints : bool (optional) ...
[ "Plot", "a", "2", "-", "D", "histogram", "of", "samples", "." ]
8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/helpers/corner/corner.py#L414-L592
train
annayqho/TheCannon
code/lamost/xcalib_5labels/paper_plots/distance_cut.py
calc_dist
def calc_dist(lamost_point, training_points, coeffs): """ avg dist from one lamost point to nearest 10 training points """ diff2 = (training_points - lamost_point)**2 dist = np.sqrt(np.sum(diff2*coeffs, axis=1)) return np.mean(dist[dist.argsort()][0:10])
python
def calc_dist(lamost_point, training_points, coeffs): """ avg dist from one lamost point to nearest 10 training points """ diff2 = (training_points - lamost_point)**2 dist = np.sqrt(np.sum(diff2*coeffs, axis=1)) return np.mean(dist[dist.argsort()][0:10])
[ "def", "calc_dist", "(", "lamost_point", ",", "training_points", ",", "coeffs", ")", ":", "diff2", "=", "(", "training_points", "-", "lamost_point", ")", "**", "2", "dist", "=", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "diff2", "*", "coeffs", ","...
avg dist from one lamost point to nearest 10 training points
[ "avg", "dist", "from", "one", "lamost", "point", "to", "nearest", "10", "training", "points" ]
8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/code/lamost/xcalib_5labels/paper_plots/distance_cut.py#L12-L16
train
datosgobar/textar
textar/text_classifier.py
TextClassifier.make_classifier
def make_classifier(self, name, ids, labels): """Entrenar un clasificador SVM sobre los textos cargados. Crea un clasificador que se guarda en el objeto bajo el nombre `name`. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de tex...
python
def make_classifier(self, name, ids, labels): """Entrenar un clasificador SVM sobre los textos cargados. Crea un clasificador que se guarda en el objeto bajo el nombre `name`. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de tex...
[ "def", "make_classifier", "(", "self", ",", "name", ",", "ids", ",", "labels", ")", ":", "if", "not", "all", "(", "np", ".", "in1d", "(", "ids", ",", "self", ".", "ids", ")", ")", ":", "raise", "ValueError", "(", "\"Hay ids de textos que no se encuentran...
Entrenar un clasificador SVM sobre los textos cargados. Crea un clasificador que se guarda en el objeto bajo el nombre `name`. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de textos ya almacenados en el TextClassifier. ...
[ "Entrenar", "un", "clasificador", "SVM", "sobre", "los", "textos", "cargados", "." ]
44fb5b537561facae0cdfe4fe1d108dfa26cfc6b
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L63-L83
train
datosgobar/textar
textar/text_classifier.py
TextClassifier.retrain
def retrain(self, name, ids, labels): """Reentrenar parcialmente un clasificador SVM. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de textos ya almacenados en el TextClassifier. labels (list): Se espera una l...
python
def retrain(self, name, ids, labels): """Reentrenar parcialmente un clasificador SVM. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de textos ya almacenados en el TextClassifier. labels (list): Se espera una l...
[ "def", "retrain", "(", "self", ",", "name", ",", "ids", ",", "labels", ")", ":", "if", "not", "all", "(", "np", ".", "in1d", "(", "ids", ",", "self", ".", "ids", ")", ")", ":", "raise", "ValueError", "(", "\"Hay ids de textos que no se encuentran \\\n ...
Reentrenar parcialmente un clasificador SVM. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de textos ya almacenados en el TextClassifier. labels (list): Se espera una lista de N etiquetas. Una por cada id ...
[ "Reentrenar", "parcialmente", "un", "clasificador", "SVM", "." ]
44fb5b537561facae0cdfe4fe1d108dfa26cfc6b
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L85-L107
train
datosgobar/textar
textar/text_classifier.py
TextClassifier.classify
def classify(self, classifier_name, examples, max_labels=None, goodness_of_fit=False): """Usar un clasificador SVM para etiquetar textos nuevos. Args: classifier_name (str): Nombre del clasidicador a usar. examples (list or str): Se espera un ejemplo o una lista...
python
def classify(self, classifier_name, examples, max_labels=None, goodness_of_fit=False): """Usar un clasificador SVM para etiquetar textos nuevos. Args: classifier_name (str): Nombre del clasidicador a usar. examples (list or str): Se espera un ejemplo o una lista...
[ "def", "classify", "(", "self", ",", "classifier_name", ",", "examples", ",", "max_labels", "=", "None", ",", "goodness_of_fit", "=", "False", ")", ":", "classifier", "=", "getattr", "(", "self", ",", "classifier_name", ")", "texts_vectors", "=", "self", "."...
Usar un clasificador SVM para etiquetar textos nuevos. Args: classifier_name (str): Nombre del clasidicador a usar. examples (list or str): Se espera un ejemplo o una lista de ejemplos a clasificar en texto plano o en ids. max_labels (int, optional): Cantidad...
[ "Usar", "un", "clasificador", "SVM", "para", "etiquetar", "textos", "nuevos", "." ]
44fb5b537561facae0cdfe4fe1d108dfa26cfc6b
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L109-L135
train
datosgobar/textar
textar/text_classifier.py
TextClassifier._make_text_vectors
def _make_text_vectors(self, examples): """Funcion para generar los vectores tf-idf de una lista de textos. Args: examples (list or str): Se espera un ejemplo o una lista de: o bien ids, o bien textos. Returns: textvec (sparse matrix): Devuelve una matriz...
python
def _make_text_vectors(self, examples): """Funcion para generar los vectores tf-idf de una lista de textos. Args: examples (list or str): Se espera un ejemplo o una lista de: o bien ids, o bien textos. Returns: textvec (sparse matrix): Devuelve una matriz...
[ "def", "_make_text_vectors", "(", "self", ",", "examples", ")", ":", "if", "isinstance", "(", "examples", ",", "str", ")", ":", "if", "examples", "in", "self", ".", "ids", ":", "textvec", "=", "self", ".", "tfidf_mat", "[", "self", ".", "ids", "==", ...
Funcion para generar los vectores tf-idf de una lista de textos. Args: examples (list or str): Se espera un ejemplo o una lista de: o bien ids, o bien textos. Returns: textvec (sparse matrix): Devuelve una matriz sparse que contiene los vectores T...
[ "Funcion", "para", "generar", "los", "vectores", "tf", "-", "idf", "de", "una", "lista", "de", "textos", "." ]
44fb5b537561facae0cdfe4fe1d108dfa26cfc6b
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L137-L167
train
datosgobar/textar
textar/text_classifier.py
TextClassifier.get_similar
def get_similar(self, example, max_similars=3, similarity_cutoff=None, term_diff_max_rank=10, filter_list=None, term_diff_cutoff=None): """Devuelve textos similares al ejemplo dentro de los textos entrenados. Nota: Usa la distancia de coseno del vecto...
python
def get_similar(self, example, max_similars=3, similarity_cutoff=None, term_diff_max_rank=10, filter_list=None, term_diff_cutoff=None): """Devuelve textos similares al ejemplo dentro de los textos entrenados. Nota: Usa la distancia de coseno del vecto...
[ "def", "get_similar", "(", "self", ",", "example", ",", "max_similars", "=", "3", ",", "similarity_cutoff", "=", "None", ",", "term_diff_max_rank", "=", "10", ",", "filter_list", "=", "None", ",", "term_diff_cutoff", "=", "None", ")", ":", "if", "term_diff_c...
Devuelve textos similares al ejemplo dentro de los textos entrenados. Nota: Usa la distancia de coseno del vector de features TF-IDF Args: example (str): Se espera un id de texto o un texto a partir del cual se buscaran otros textos similares. max_si...
[ "Devuelve", "textos", "similares", "al", "ejemplo", "dentro", "de", "los", "textos", "entrenados", "." ]
44fb5b537561facae0cdfe4fe1d108dfa26cfc6b
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L169-L274
train
datosgobar/textar
textar/text_classifier.py
TextClassifier.reload_texts
def reload_texts(self, texts, ids, vocabulary=None): """Calcula los vectores de terminos de textos y los almacena. A diferencia de :func:`~TextClassifier.TextClassifier.store_text` esta funcion borra cualquier informacion almacenada y comienza el conteo desde cero. Se usa para redefinir...
python
def reload_texts(self, texts, ids, vocabulary=None): """Calcula los vectores de terminos de textos y los almacena. A diferencia de :func:`~TextClassifier.TextClassifier.store_text` esta funcion borra cualquier informacion almacenada y comienza el conteo desde cero. Se usa para redefinir...
[ "def", "reload_texts", "(", "self", ",", "texts", ",", "ids", ",", "vocabulary", "=", "None", ")", ":", "self", ".", "_check_id_length", "(", "ids", ")", "self", ".", "ids", "=", "np", ".", "array", "(", "sorted", "(", "ids", ")", ")", "if", "vocab...
Calcula los vectores de terminos de textos y los almacena. A diferencia de :func:`~TextClassifier.TextClassifier.store_text` esta funcion borra cualquier informacion almacenada y comienza el conteo desde cero. Se usa para redefinir el vocabulario sobre el que se construyen los vectores....
[ "Calcula", "los", "vectores", "de", "terminos", "de", "textos", "y", "los", "almacena", "." ]
44fb5b537561facae0cdfe4fe1d108dfa26cfc6b
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L276-L294
train
sckott/pygbif
pygbif/species/name_suggest.py
name_suggest
def name_suggest(q=None, datasetKey=None, rank=None, limit=100, offset=None, **kwargs): ''' A quick and simple autocomplete service that returns up to 20 name usages by doing prefix matching against the scientific name. Results are ordered by relevance. :param q: [str] Simple search parameter. The value for th...
python
def name_suggest(q=None, datasetKey=None, rank=None, limit=100, offset=None, **kwargs): ''' A quick and simple autocomplete service that returns up to 20 name usages by doing prefix matching against the scientific name. Results are ordered by relevance. :param q: [str] Simple search parameter. The value for th...
[ "def", "name_suggest", "(", "q", "=", "None", ",", "datasetKey", "=", "None", ",", "rank", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'species/suggest'", "ar...
A quick and simple autocomplete service that returns up to 20 name usages by doing prefix matching against the scientific name. Results are ordered by relevance. :param q: [str] Simple search parameter. The value for this parameter can be a simple word or a phrase. Wildcards can be added to the simple word pa...
[ "A", "quick", "and", "simple", "autocomplete", "service", "that", "returns", "up", "to", "20", "name", "usages", "by", "doing", "prefix", "matching", "against", "the", "scientific", "name", ".", "Results", "are", "ordered", "by", "relevance", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_suggest.py#L3-L39
train
sckott/pygbif
pygbif/registry/datasets.py
dataset_metrics
def dataset_metrics(uuid, **kwargs): ''' Get details on a GBIF dataset. :param uuid: [str] One or more dataset UUIDs. See examples. References: http://www.gbif.org/developer/registry#datasetMetrics Usage:: from pygbif import registry registry.dataset_metrics(uuid='3f8a1297-3259-4700-91fc-acc4170b27ce') ...
python
def dataset_metrics(uuid, **kwargs): ''' Get details on a GBIF dataset. :param uuid: [str] One or more dataset UUIDs. See examples. References: http://www.gbif.org/developer/registry#datasetMetrics Usage:: from pygbif import registry registry.dataset_metrics(uuid='3f8a1297-3259-4700-91fc-acc4170b27ce') ...
[ "def", "dataset_metrics", "(", "uuid", ",", "*", "*", "kwargs", ")", ":", "def", "getdata", "(", "x", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'dataset/'", "+", "x", "+", "'/metrics'", "return", "gbif_GET", "(", "url", ","...
Get details on a GBIF dataset. :param uuid: [str] One or more dataset UUIDs. See examples. References: http://www.gbif.org/developer/registry#datasetMetrics Usage:: from pygbif import registry registry.dataset_metrics(uuid='3f8a1297-3259-4700-91fc-acc4170b27ce') registry.dataset_metrics(uuid='66dd0960-2...
[ "Get", "details", "on", "a", "GBIF", "dataset", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/datasets.py#L4-L26
train
sckott/pygbif
pygbif/registry/datasets.py
datasets
def datasets(data = 'all', type = None, uuid = None, query = None, id = None, limit = 100, offset = None, **kwargs): ''' Search for datasets and dataset metadata. :param data: [str] The type of data to get. Default: ``all`` :param type: [str] Type of dataset, options include ``OCCURRENCE``, etc. :param uui...
python
def datasets(data = 'all', type = None, uuid = None, query = None, id = None, limit = 100, offset = None, **kwargs): ''' Search for datasets and dataset metadata. :param data: [str] The type of data to get. Default: ``all`` :param type: [str] Type of dataset, options include ``OCCURRENCE``, etc. :param uui...
[ "def", "datasets", "(", "data", "=", "'all'", ",", "type", "=", "None", ",", "uuid", "=", "None", ",", "query", "=", "None", ",", "id", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "args"...
Search for datasets and dataset metadata. :param data: [str] The type of data to get. Default: ``all`` :param type: [str] Type of dataset, options include ``OCCURRENCE``, etc. :param uuid: [str] UUID of the data node provider. This must be specified if data is anything other than ``all``. :param query: [str] Qu...
[ "Search", "for", "datasets", "and", "dataset", "metadata", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/datasets.py#L28-L63
train
sckott/pygbif
pygbif/registry/datasets.py
dataset_suggest
def dataset_suggest(q=None, type=None, keyword=None, owningOrg=None, publishingOrg=None, hostingOrg=None, publishingCountry=None, decade=None, limit = 100, offset = None, **kwargs): ''' Search that returns up to 20 matching datasets. Results are ordered by relevance. :param q: [str] Query term(s) for full text s...
python
def dataset_suggest(q=None, type=None, keyword=None, owningOrg=None, publishingOrg=None, hostingOrg=None, publishingCountry=None, decade=None, limit = 100, offset = None, **kwargs): ''' Search that returns up to 20 matching datasets. Results are ordered by relevance. :param q: [str] Query term(s) for full text s...
[ "def", "dataset_suggest", "(", "q", "=", "None", ",", "type", "=", "None", ",", "keyword", "=", "None", ",", "owningOrg", "=", "None", ",", "publishingOrg", "=", "None", ",", "hostingOrg", "=", "None", ",", "publishingCountry", "=", "None", ",", "decade"...
Search that returns up to 20 matching datasets. Results are ordered by relevance. :param q: [str] Query term(s) for full text search. The value for this parameter can be a simple word or a phrase. Wildcards can be added to the simple word parameters only, e.g. ``q=*puma*`` :param type: [str] Type of dataset, optio...
[ "Search", "that", "returns", "up", "to", "20", "matching", "datasets", ".", "Results", "are", "ordered", "by", "relevance", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/datasets.py#L88-L143
train
sckott/pygbif
pygbif/registry/datasets.py
dataset_search
def dataset_search(q=None, type=None, keyword=None, owningOrg=None, publishingOrg=None, hostingOrg=None, decade=None, publishingCountry = None, facet = None, facetMincount=None, facetMultiselect = None, hl = False, limit = 100, offset = None, **kwargs): ''' Full text search across all datasets. Results are ordere...
python
def dataset_search(q=None, type=None, keyword=None, owningOrg=None, publishingOrg=None, hostingOrg=None, decade=None, publishingCountry = None, facet = None, facetMincount=None, facetMultiselect = None, hl = False, limit = 100, offset = None, **kwargs): ''' Full text search across all datasets. Results are ordere...
[ "def", "dataset_search", "(", "q", "=", "None", ",", "type", "=", "None", ",", "keyword", "=", "None", ",", "owningOrg", "=", "None", ",", "publishingOrg", "=", "None", ",", "hostingOrg", "=", "None", ",", "decade", "=", "None", ",", "publishingCountry",...
Full text search across all datasets. Results are ordered by relevance. :param q: [str] Query term(s) for full text search. The value for this parameter can be a simple word or a phrase. Wildcards can be added to the simple word parameters only, e.g. ``q=*puma*`` :param type: [str] Type of dataset, options in...
[ "Full", "text", "search", "across", "all", "datasets", ".", "Results", "are", "ordered", "by", "relevance", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/datasets.py#L145-L257
train
sckott/pygbif
pygbif/utils/wkt_rewind.py
wkt_rewind
def wkt_rewind(x, digits = None): ''' reverse WKT winding order :param x: [str] WKT string :param digits: [int] number of digits after decimal to use for the return string. by default, we use the mean number of digits in your string. :return: a string Usage:: from py...
python
def wkt_rewind(x, digits = None): ''' reverse WKT winding order :param x: [str] WKT string :param digits: [int] number of digits after decimal to use for the return string. by default, we use the mean number of digits in your string. :return: a string Usage:: from py...
[ "def", "wkt_rewind", "(", "x", ",", "digits", "=", "None", ")", ":", "z", "=", "wkt", ".", "loads", "(", "x", ")", "if", "digits", "is", "None", ":", "coords", "=", "z", "[", "'coordinates'", "]", "nums", "=", "__flatten", "(", "coords", ")", "de...
reverse WKT winding order :param x: [str] WKT string :param digits: [int] number of digits after decimal to use for the return string. by default, we use the mean number of digits in your string. :return: a string Usage:: from pygbif import wkt_rewind x = 'POLYGON((1...
[ "reverse", "WKT", "winding", "order" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/utils/wkt_rewind.py#L6-L36
train
sckott/pygbif
pygbif/gbifissues.py
occ_issues_lookup
def occ_issues_lookup(issue=None, code=None): ''' Lookup occurrence issue definitions and short codes :param issue: Full name of issue, e.g, CONTINENT_COUNTRY_MISMATCH :param code: an issue short code, e.g. ccm Usage pygbif.occ_issues_lookup(issue = 'CONTINENT_COUNTRY_MISMATCH') pygbif.occ...
python
def occ_issues_lookup(issue=None, code=None): ''' Lookup occurrence issue definitions and short codes :param issue: Full name of issue, e.g, CONTINENT_COUNTRY_MISMATCH :param code: an issue short code, e.g. ccm Usage pygbif.occ_issues_lookup(issue = 'CONTINENT_COUNTRY_MISMATCH') pygbif.occ...
[ "def", "occ_issues_lookup", "(", "issue", "=", "None", ",", "code", "=", "None", ")", ":", "if", "code", "is", "None", ":", "bb", "=", "[", "trymatch", "(", "issue", ",", "x", ")", "for", "x", "in", "gbifissues", "[", "'issue'", "]", "]", "tmp", ...
Lookup occurrence issue definitions and short codes :param issue: Full name of issue, e.g, CONTINENT_COUNTRY_MISMATCH :param code: an issue short code, e.g. ccm Usage pygbif.occ_issues_lookup(issue = 'CONTINENT_COUNTRY_MISMATCH') pygbif.occ_issues_lookup(issue = 'MULTIMEDIA_DATE_INVALID') pygb...
[ "Lookup", "occurrence", "issue", "definitions", "and", "short", "codes" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/gbifissues.py#L3-L22
train
sckott/pygbif
pygbif/occurrences/search.py
search
def search(taxonKey=None, repatriated=None, kingdomKey=None, phylumKey=None, classKey=None, orderKey=None, familyKey=None, genusKey=None, subgenusKey=None, scientificName=None, country=None, publishingCountry=None, hasCoordinate=None, typeStatus=None, recordNumber=None, lastInterpreted=None, continent=N...
python
def search(taxonKey=None, repatriated=None, kingdomKey=None, phylumKey=None, classKey=None, orderKey=None, familyKey=None, genusKey=None, subgenusKey=None, scientificName=None, country=None, publishingCountry=None, hasCoordinate=None, typeStatus=None, recordNumber=None, lastInterpreted=None, continent=N...
[ "def", "search", "(", "taxonKey", "=", "None", ",", "repatriated", "=", "None", ",", "kingdomKey", "=", "None", ",", "phylumKey", "=", "None", ",", "classKey", "=", "None", ",", "orderKey", "=", "None", ",", "familyKey", "=", "None", ",", "genusKey", "...
Search GBIF occurrences :param taxonKey: [int] A GBIF occurrence identifier :param q: [str] Simple search parameter. The value for this parameter can be a simple word or a phrase. :param spellCheck: [bool] If ``True`` ask GBIF to check your spelling of the value passed to the ``search`` parameter. ...
[ "Search", "GBIF", "occurrences" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/search.py#L4-L334
train
sckott/pygbif
pygbif/registry/networks.py
networks
def networks(data = 'all', uuid = None, q = None, identifier = None, identifierType = None, limit = 100, offset = None, **kwargs): ''' Networks metadata. Note: there's only 1 network now, so there's not a lot you can do with this method. :param data: [str] The type of data to get. Default: ``all`` :param ...
python
def networks(data = 'all', uuid = None, q = None, identifier = None, identifierType = None, limit = 100, offset = None, **kwargs): ''' Networks metadata. Note: there's only 1 network now, so there's not a lot you can do with this method. :param data: [str] The type of data to get. Default: ``all`` :param ...
[ "def", "networks", "(", "data", "=", "'all'", ",", "uuid", "=", "None", ",", "q", "=", "None", ",", "identifier", "=", "None", ",", "identifierType", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "None", ",", "*", "*", "kwargs", ")", ...
Networks metadata. Note: there's only 1 network now, so there's not a lot you can do with this method. :param data: [str] The type of data to get. Default: ``all`` :param uuid: [str] UUID of the data network provider. This must be specified if data is anything other than ``all``. :param q: [str] Query ne...
[ "Networks", "metadata", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/networks.py#L3-L56
train
sckott/pygbif
pygbif/maps/map.py
map
def map(source = 'density', z = 0, x = 0, y = 0, format = '@1x.png', srs='EPSG:4326', bin=None, hexPerTile=None, style='classic.point', taxonKey=None, country=None, publishingCountry=None, publisher=None, datasetKey=None, year=None, basisOfRecord=None, **kwargs): ''' GBIF maps API :param sou...
python
def map(source = 'density', z = 0, x = 0, y = 0, format = '@1x.png', srs='EPSG:4326', bin=None, hexPerTile=None, style='classic.point', taxonKey=None, country=None, publishingCountry=None, publisher=None, datasetKey=None, year=None, basisOfRecord=None, **kwargs): ''' GBIF maps API :param sou...
[ "def", "map", "(", "source", "=", "'density'", ",", "z", "=", "0", ",", "x", "=", "0", ",", "y", "=", "0", ",", "format", "=", "'@1x.png'", ",", "srs", "=", "'EPSG:4326'", ",", "bin", "=", "None", ",", "hexPerTile", "=", "None", ",", "style", "...
GBIF maps API :param source: [str] Either ``density`` for fast, precalculated tiles, or ``adhoc`` for any search :param z: [str] zoom level :param x: [str] longitude :param y: [str] latitude :param format: [str] format of returned data. One of: - ``.mvt`` - vector tile - ``@Hx....
[ "GBIF", "maps", "API" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/maps/map.py#L8-L145
train
sckott/pygbif
pygbif/species/name_usage.py
name_usage
def name_usage(key = None, name = None, data = 'all', language = None, datasetKey = None, uuid = None, sourceId = None, rank = None, shortname = None, limit = 100, offset = None, **kwargs): ''' Lookup details for specific names in all taxonomies in GBIF. :param key: [fixnum] A GBIF key for a taxon :param name: [...
python
def name_usage(key = None, name = None, data = 'all', language = None, datasetKey = None, uuid = None, sourceId = None, rank = None, shortname = None, limit = 100, offset = None, **kwargs): ''' Lookup details for specific names in all taxonomies in GBIF. :param key: [fixnum] A GBIF key for a taxon :param name: [...
[ "def", "name_usage", "(", "key", "=", "None", ",", "name", "=", "None", ",", "data", "=", "'all'", ",", "language", "=", "None", ",", "datasetKey", "=", "None", ",", "uuid", "=", "None", ",", "sourceId", "=", "None", ",", "rank", "=", "None", ",", ...
Lookup details for specific names in all taxonomies in GBIF. :param key: [fixnum] A GBIF key for a taxon :param name: [str] Filters by a case insensitive, canonical namestring, e.g. 'Puma concolor' :param data: [str] The type of data to get. Default: ``all``. Options: ``all``, ``verbatim``, ``name``, ``parents...
[ "Lookup", "details", "for", "specific", "names", "in", "all", "taxonomies", "in", "GBIF", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_usage.py#L3-L76
train
sckott/pygbif
pygbif/occurrences/download.py
_check_environ
def _check_environ(variable, value): """check if a variable is present in the environmental variables""" if is_not_none(value): return value else: value = os.environ.get(variable) if is_none(value): stop(''.join([variable, """ not supplied and no...
python
def _check_environ(variable, value): """check if a variable is present in the environmental variables""" if is_not_none(value): return value else: value = os.environ.get(variable) if is_none(value): stop(''.join([variable, """ not supplied and no...
[ "def", "_check_environ", "(", "variable", ",", "value", ")", ":", "if", "is_not_none", "(", "value", ")", ":", "return", "value", "else", ":", "value", "=", "os", ".", "environ", ".", "get", "(", "variable", ")", "if", "is_none", "(", "value", ")", "...
check if a variable is present in the environmental variables
[ "check", "if", "a", "variable", "is", "present", "in", "the", "environmental", "variables" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L18-L29
train
sckott/pygbif
pygbif/occurrences/download.py
download
def download(queries, user=None, pwd=None, email=None, pred_type='and'): """ Spin up a download request for GBIF occurrence data. :param queries: One or more of query arguments to kick of a download job. See Details. :type queries: str or list :param pred_type: (character) One ...
python
def download(queries, user=None, pwd=None, email=None, pred_type='and'): """ Spin up a download request for GBIF occurrence data. :param queries: One or more of query arguments to kick of a download job. See Details. :type queries: str or list :param pred_type: (character) One ...
[ "def", "download", "(", "queries", ",", "user", "=", "None", ",", "pwd", "=", "None", ",", "email", "=", "None", ",", "pred_type", "=", "'and'", ")", ":", "user", "=", "_check_environ", "(", "'GBIF_USER'", ",", "user", ")", "pwd", "=", "_check_environ"...
Spin up a download request for GBIF occurrence data. :param queries: One or more of query arguments to kick of a download job. See Details. :type queries: str or list :param pred_type: (character) One of ``equals`` (``=``), ``and`` (``&``), `or`` (``|``), ``lessThan`` (``<``), ``lessThanOrE...
[ "Spin", "up", "a", "download", "request", "for", "GBIF", "occurrence", "data", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L32-L143
train
sckott/pygbif
pygbif/occurrences/download.py
download_list
def download_list(user=None, pwd=None, limit=20, offset=0): """ Lists the downloads created by a user. :param user: [str] A user name, look at env var ``GBIF_USER`` first :param pwd: [str] Your password, look at env var ``GBIF_PWD`` first :param limit: [int] Number of records to return. Default: ``...
python
def download_list(user=None, pwd=None, limit=20, offset=0): """ Lists the downloads created by a user. :param user: [str] A user name, look at env var ``GBIF_USER`` first :param pwd: [str] Your password, look at env var ``GBIF_PWD`` first :param limit: [int] Number of records to return. Default: ``...
[ "def", "download_list", "(", "user", "=", "None", ",", "pwd", "=", "None", ",", "limit", "=", "20", ",", "offset", "=", "0", ")", ":", "user", "=", "_check_environ", "(", "'GBIF_USER'", ",", "user", ")", "pwd", "=", "_check_environ", "(", "'GBIF_PWD'",...
Lists the downloads created by a user. :param user: [str] A user name, look at env var ``GBIF_USER`` first :param pwd: [str] Your password, look at env var ``GBIF_PWD`` first :param limit: [int] Number of records to return. Default: ``20`` :param offset: [int] Record number to start at. Default: ``0`` ...
[ "Lists", "the", "downloads", "created", "by", "a", "user", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L331-L358
train
sckott/pygbif
pygbif/occurrences/download.py
download_get
def download_get(key, path=".", **kwargs): """ Get a download from GBIF. :param key: [str] A key generated from a request, like that from ``download`` :param path: [str] Path to write zip file to. Default: ``"."``, with a ``.zip`` appended to the end. :param **kwargs**: Further named arguments pass...
python
def download_get(key, path=".", **kwargs): """ Get a download from GBIF. :param key: [str] A key generated from a request, like that from ``download`` :param path: [str] Path to write zip file to. Default: ``"."``, with a ``.zip`` appended to the end. :param **kwargs**: Further named arguments pass...
[ "def", "download_get", "(", "key", ",", "path", "=", "\".\"", ",", "*", "*", "kwargs", ")", ":", "meta", "=", "pygbif", ".", "occurrences", ".", "download_meta", "(", "key", ")", "if", "meta", "[", "'status'", "]", "!=", "'SUCCEEDED'", ":", "raise", ...
Get a download from GBIF. :param key: [str] A key generated from a request, like that from ``download`` :param path: [str] Path to write zip file to. Default: ``"."``, with a ``.zip`` appended to the end. :param **kwargs**: Further named arguments passed on to ``requests.get`` Downloads the zip file t...
[ "Get", "a", "download", "from", "GBIF", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L361-L391
train
sckott/pygbif
pygbif/occurrences/download.py
GbifDownload.main_pred_type
def main_pred_type(self, value): """set main predicate combination type :param value: (character) One of ``equals`` (``=``), ``and`` (``&``), ``or`` (``|``), ``lessThan`` (``<``), ``lessThanOrEquals`` (``<=``), ``greaterThan`` (``>``), ``greaterThanOrEquals`` (``>=``), ``in``, ``within`...
python
def main_pred_type(self, value): """set main predicate combination type :param value: (character) One of ``equals`` (``=``), ``and`` (``&``), ``or`` (``|``), ``lessThan`` (``<``), ``lessThanOrEquals`` (``<=``), ``greaterThan`` (``>``), ``greaterThanOrEquals`` (``>=``), ``in``, ``within`...
[ "def", "main_pred_type", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "operators", ":", "value", "=", "operator_lkup", ".", "get", "(", "value", ")", "if", "value", ":", "self", ".", "_main_pred_type", "=", "value", "self", ".", "pa...
set main predicate combination type :param value: (character) One of ``equals`` (``=``), ``and`` (``&``), ``or`` (``|``), ``lessThan`` (``<``), ``lessThanOrEquals`` (``<=``), ``greaterThan`` (``>``), ``greaterThanOrEquals`` (``>=``), ``in``, ``within``, ``not`` (``!``), ``like``
[ "set", "main", "predicate", "combination", "type" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L193-L206
train
sckott/pygbif
pygbif/occurrences/download.py
GbifDownload.add_predicate
def add_predicate(self, key, value, predicate_type='equals'): """ add key, value, type combination of a predicate :param key: query KEY parameter :param value: the value used in the predicate :param predicate_type: the type of predicate (e.g. ``equals``) """ if p...
python
def add_predicate(self, key, value, predicate_type='equals'): """ add key, value, type combination of a predicate :param key: query KEY parameter :param value: the value used in the predicate :param predicate_type: the type of predicate (e.g. ``equals``) """ if p...
[ "def", "add_predicate", "(", "self", ",", "key", ",", "value", ",", "predicate_type", "=", "'equals'", ")", ":", "if", "predicate_type", "not", "in", "operators", ":", "predicate_type", "=", "operator_lkup", ".", "get", "(", "predicate_type", ")", "if", "pre...
add key, value, type combination of a predicate :param key: query KEY parameter :param value: the value used in the predicate :param predicate_type: the type of predicate (e.g. ``equals``)
[ "add", "key", "value", "type", "combination", "of", "a", "predicate" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L208-L224
train
sckott/pygbif
pygbif/occurrences/download.py
GbifDownload._extract_values
def _extract_values(values_list): """extract values from either file or list :param values_list: list or file name (str) with list of values """ values = [] # check if file or list of values to iterate if isinstance(values_list, str): with open(values_list) a...
python
def _extract_values(values_list): """extract values from either file or list :param values_list: list or file name (str) with list of values """ values = [] # check if file or list of values to iterate if isinstance(values_list, str): with open(values_list) a...
[ "def", "_extract_values", "(", "values_list", ")", ":", "values", "=", "[", "]", "# check if file or list of values to iterate", "if", "isinstance", "(", "values_list", ",", "str", ")", ":", "with", "open", "(", "values_list", ")", "as", "ff", ":", "reading", ...
extract values from either file or list :param values_list: list or file name (str) with list of values
[ "extract", "values", "from", "either", "file", "or", "list" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L227-L243
train
sckott/pygbif
pygbif/occurrences/download.py
GbifDownload.add_iterative_predicate
def add_iterative_predicate(self, key, values_list): """add an iterative predicate with a key and set of values which it can be equal to in and or function. The individual predicates are specified with the type ``equals`` and combined with a type ``or``. The main reason for this...
python
def add_iterative_predicate(self, key, values_list): """add an iterative predicate with a key and set of values which it can be equal to in and or function. The individual predicates are specified with the type ``equals`` and combined with a type ``or``. The main reason for this...
[ "def", "add_iterative_predicate", "(", "self", ",", "key", ",", "values_list", ")", ":", "values", "=", "self", ".", "_extract_values", "(", "values_list", ")", "predicate", "=", "{", "'type'", ":", "'equals'", ",", "'key'", ":", "key", ",", "'value'", ":"...
add an iterative predicate with a key and set of values which it can be equal to in and or function. The individual predicates are specified with the type ``equals`` and combined with a type ``or``. The main reason for this addition is the inability of using ``in`` as predicate ...
[ "add", "an", "iterative", "predicate", "with", "a", "key", "and", "set", "of", "values", "which", "it", "can", "be", "equal", "to", "in", "and", "or", "function", ".", "The", "individual", "predicates", "are", "specified", "with", "the", "type", "equals", ...
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L245-L267
train
sckott/pygbif
pygbif/occurrences/get.py
get
def get(key, **kwargs): ''' Gets details for a single, interpreted occurrence :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get(key = 1258202889) occurrences.get(key = 1227768771) occur...
python
def get(key, **kwargs): ''' Gets details for a single, interpreted occurrence :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get(key = 1258202889) occurrences.get(key = 1227768771) occur...
[ "def", "get", "(", "key", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/'", "+", "str", "(", "key", ")", "out", "=", "gbif_GET", "(", "url", ",", "{", "}", ",", "*", "*", "kwargs", ")", "return", "out" ]
Gets details for a single, interpreted occurrence :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get(key = 1258202889) occurrences.get(key = 1227768771) occurrences.get(key = 1227769518)
[ "Gets", "details", "for", "a", "single", "interpreted", "occurrence" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/get.py#L3-L20
train
sckott/pygbif
pygbif/occurrences/get.py
get_verbatim
def get_verbatim(key, **kwargs): ''' Gets a verbatim occurrence record without any interpretation :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_verbatim(key = 1258202889) occurrences.get_ve...
python
def get_verbatim(key, **kwargs): ''' Gets a verbatim occurrence record without any interpretation :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_verbatim(key = 1258202889) occurrences.get_ve...
[ "def", "get_verbatim", "(", "key", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/'", "+", "str", "(", "key", ")", "+", "'/verbatim'", "out", "=", "gbif_GET", "(", "url", ",", "{", "}", ",", "*", "*", "kwargs", ")"...
Gets a verbatim occurrence record without any interpretation :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_verbatim(key = 1258202889) occurrences.get_verbatim(key = 1227768771) occurrences....
[ "Gets", "a", "verbatim", "occurrence", "record", "without", "any", "interpretation" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/get.py#L22-L39
train
sckott/pygbif
pygbif/occurrences/get.py
get_fragment
def get_fragment(key, **kwargs): ''' Get a single occurrence fragment in its raw form (xml or json) :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_fragment(key = 1052909293) occurrences.get_...
python
def get_fragment(key, **kwargs): ''' Get a single occurrence fragment in its raw form (xml or json) :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_fragment(key = 1052909293) occurrences.get_...
[ "def", "get_fragment", "(", "key", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/'", "+", "str", "(", "key", ")", "+", "'/fragment'", "out", "=", "gbif_GET", "(", "url", ",", "{", "}", ",", "*", "*", "kwargs", ")"...
Get a single occurrence fragment in its raw form (xml or json) :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_fragment(key = 1052909293) occurrences.get_fragment(key = 1227768771) occurrence...
[ "Get", "a", "single", "occurrence", "fragment", "in", "its", "raw", "form", "(", "xml", "or", "json", ")" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/get.py#L41-L58
train
sckott/pygbif
pygbif/species/name_backbone.py
name_backbone
def name_backbone(name, rank=None, kingdom=None, phylum=None, clazz=None, order=None, family=None, genus=None, strict=False, verbose=False, offset=None, limit=100, **kwargs): ''' Lookup names in the GBIF backbone taxonomy. :param name: [str] Full scientific name potentially with authorship (required) :para...
python
def name_backbone(name, rank=None, kingdom=None, phylum=None, clazz=None, order=None, family=None, genus=None, strict=False, verbose=False, offset=None, limit=100, **kwargs): ''' Lookup names in the GBIF backbone taxonomy. :param name: [str] Full scientific name potentially with authorship (required) :para...
[ "def", "name_backbone", "(", "name", ",", "rank", "=", "None", ",", "kingdom", "=", "None", ",", "phylum", "=", "None", ",", "clazz", "=", "None", ",", "order", "=", "None", ",", "family", "=", "None", ",", "genus", "=", "None", ",", "strict", "=",...
Lookup names in the GBIF backbone taxonomy. :param name: [str] Full scientific name potentially with authorship (required) :param rank: [str] The rank given as our rank enum. (optional) :param kingdom: [str] If provided default matching will also try to match against this if no direct match is found for the...
[ "Lookup", "names", "in", "the", "GBIF", "backbone", "taxonomy", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_backbone.py#L3-L63
train
sckott/pygbif
pygbif/species/name_parser.py
name_parser
def name_parser(name, **kwargs): ''' Parse taxon names using the GBIF name parser :param name: [str] A character vector of scientific names. (required) reference: http://www.gbif.org/developer/species#parser Usage:: from pygbif import species species.name_parser('x Agropogon littoralis') ...
python
def name_parser(name, **kwargs): ''' Parse taxon names using the GBIF name parser :param name: [str] A character vector of scientific names. (required) reference: http://www.gbif.org/developer/species#parser Usage:: from pygbif import species species.name_parser('x Agropogon littoralis') ...
[ "def", "name_parser", "(", "name", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'parser/name'", "if", "name", ".", "__class__", "==", "str", ":", "name", "=", "[", "name", "]", "return", "gbif_POST", "(", "url", ",", "name", "...
Parse taxon names using the GBIF name parser :param name: [str] A character vector of scientific names. (required) reference: http://www.gbif.org/developer/species#parser Usage:: from pygbif import species species.name_parser('x Agropogon littoralis') species.name_parser(['Arrhenatherum elat...
[ "Parse", "taxon", "names", "using", "the", "GBIF", "name", "parser" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_parser.py#L3-L22
train
sckott/pygbif
pygbif/species/name_lookup.py
name_lookup
def name_lookup(q=None, rank=None, higherTaxonKey=None, status=None, isExtinct=None, habitat=None, nameType=None, datasetKey=None, nomenclaturalStatus=None, limit=100, offset=None, facet=False, facetMincount=None, facetMultiselect=None, type=None, hl=False, verbose=False, **kwargs): ''' Lookup names in all taxonom...
python
def name_lookup(q=None, rank=None, higherTaxonKey=None, status=None, isExtinct=None, habitat=None, nameType=None, datasetKey=None, nomenclaturalStatus=None, limit=100, offset=None, facet=False, facetMincount=None, facetMultiselect=None, type=None, hl=False, verbose=False, **kwargs): ''' Lookup names in all taxonom...
[ "def", "name_lookup", "(", "q", "=", "None", ",", "rank", "=", "None", ",", "higherTaxonKey", "=", "None", ",", "status", "=", "None", ",", "isExtinct", "=", "None", ",", "habitat", "=", "None", ",", "nameType", "=", "None", ",", "datasetKey", "=", "...
Lookup names in all taxonomies in GBIF. This service uses fuzzy lookup so that you can put in partial names and you should get back those things that match. See examples below. :param q: [str] Query term(s) for full text search (optional) :param rank: [str] ``CLASS``, ``CULTIVAR``, ``CULTIVAR_GROUP``, ``DOMAIN``,...
[ "Lookup", "names", "in", "all", "taxonomies", "in", "GBIF", "." ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_lookup.py#L3-L141
train
sckott/pygbif
pygbif/occurrences/count.py
count
def count(taxonKey=None, basisOfRecord=None, country=None, isGeoreferenced=None, datasetKey=None, publishingCountry=None, typeStatus=None, issue=None, year=None, **kwargs): ''' Returns occurrence counts for a predefined set of dimensions :param taxonKey: [int] A GBIF occurrence identifier :para...
python
def count(taxonKey=None, basisOfRecord=None, country=None, isGeoreferenced=None, datasetKey=None, publishingCountry=None, typeStatus=None, issue=None, year=None, **kwargs): ''' Returns occurrence counts for a predefined set of dimensions :param taxonKey: [int] A GBIF occurrence identifier :para...
[ "def", "count", "(", "taxonKey", "=", "None", ",", "basisOfRecord", "=", "None", ",", "country", "=", "None", ",", "isGeoreferenced", "=", "None", ",", "datasetKey", "=", "None", ",", "publishingCountry", "=", "None", ",", "typeStatus", "=", "None", ",", ...
Returns occurrence counts for a predefined set of dimensions :param taxonKey: [int] A GBIF occurrence identifier :param basisOfRecord: [str] A GBIF occurrence identifier :param country: [str] A GBIF occurrence identifier :param isGeoreferenced: [bool] A GBIF occurrence identifier :param datasetKey:...
[ "Returns", "occurrence", "counts", "for", "a", "predefined", "set", "of", "dimensions" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L3-L34
train
sckott/pygbif
pygbif/occurrences/count.py
count_year
def count_year(year, **kwargs): ''' Lists occurrence counts by year :param year: [int] year range, e.g., ``1990,2000``. Does not support ranges like ``asterisk,2010`` :return: dict Usage:: from pygbif import occurrences occurrences.count_year(year = '1990,2000') ''' ...
python
def count_year(year, **kwargs): ''' Lists occurrence counts by year :param year: [int] year range, e.g., ``1990,2000``. Does not support ranges like ``asterisk,2010`` :return: dict Usage:: from pygbif import occurrences occurrences.count_year(year = '1990,2000') ''' ...
[ "def", "count_year", "(", "year", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/counts/year'", "out", "=", "gbif_GET", "(", "url", ",", "{", "'year'", ":", "year", "}", ",", "*", "*", "kwargs", ")", "return", "out" ]
Lists occurrence counts by year :param year: [int] year range, e.g., ``1990,2000``. Does not support ranges like ``asterisk,2010`` :return: dict Usage:: from pygbif import occurrences occurrences.count_year(year = '1990,2000')
[ "Lists", "occurrence", "counts", "by", "year" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L51-L66
train
sckott/pygbif
pygbif/occurrences/count.py
count_datasets
def count_datasets(taxonKey = None, country = None, **kwargs): ''' Lists occurrence counts for datasets that cover a given taxon or country :param taxonKey: [int] Taxon key :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences ...
python
def count_datasets(taxonKey = None, country = None, **kwargs): ''' Lists occurrence counts for datasets that cover a given taxon or country :param taxonKey: [int] Taxon key :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences ...
[ "def", "count_datasets", "(", "taxonKey", "=", "None", ",", "country", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/counts/datasets'", "out", "=", "gbif_GET", "(", "url", ",", "{", "'taxonKey'", ":", "taxonK...
Lists occurrence counts for datasets that cover a given taxon or country :param taxonKey: [int] Taxon key :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences occurrences.count_datasets(country = "DE")
[ "Lists", "occurrence", "counts", "for", "datasets", "that", "cover", "a", "given", "taxon", "or", "country" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L68-L84
train
sckott/pygbif
pygbif/occurrences/count.py
count_countries
def count_countries(publishingCountry, **kwargs): ''' Lists occurrence counts for all countries covered by the data published by the given country :param publishingCountry: [str] A two letter country code :return: dict Usage:: from pygbif import occurrences occurrences.co...
python
def count_countries(publishingCountry, **kwargs): ''' Lists occurrence counts for all countries covered by the data published by the given country :param publishingCountry: [str] A two letter country code :return: dict Usage:: from pygbif import occurrences occurrences.co...
[ "def", "count_countries", "(", "publishingCountry", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/counts/countries'", "out", "=", "gbif_GET", "(", "url", ",", "{", "'publishingCountry'", ":", "publishingCountry", "}", ",", "*",...
Lists occurrence counts for all countries covered by the data published by the given country :param publishingCountry: [str] A two letter country code :return: dict Usage:: from pygbif import occurrences occurrences.count_countries(publishingCountry = "DE")
[ "Lists", "occurrence", "counts", "for", "all", "countries", "covered", "by", "the", "data", "published", "by", "the", "given", "country" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L86-L101
train
sckott/pygbif
pygbif/occurrences/count.py
count_publishingcountries
def count_publishingcountries(country, **kwargs): ''' Lists occurrence counts for all countries that publish data about the given country :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences occurrences.count_publishingcoun...
python
def count_publishingcountries(country, **kwargs): ''' Lists occurrence counts for all countries that publish data about the given country :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences occurrences.count_publishingcoun...
[ "def", "count_publishingcountries", "(", "country", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/counts/publishingCountries'", "out", "=", "gbif_GET", "(", "url", ",", "{", "\"country\"", ":", "country", "}", ",", "*", "*", ...
Lists occurrence counts for all countries that publish data about the given country :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences occurrences.count_publishingcountries(country = "DE")
[ "Lists", "occurrence", "counts", "for", "all", "countries", "that", "publish", "data", "about", "the", "given", "country" ]
bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L103-L118
train
jwkvam/plotlywrapper
plotlywrapper.py
_detect_notebook
def _detect_notebook() -> bool: """Detect if code is running in a Jupyter Notebook. This isn't 100% correct but seems good enough Returns ------- bool True if it detects this is a notebook, otherwise False. """ try: from IPython import get_ipython from ipykernel im...
python
def _detect_notebook() -> bool: """Detect if code is running in a Jupyter Notebook. This isn't 100% correct but seems good enough Returns ------- bool True if it detects this is a notebook, otherwise False. """ try: from IPython import get_ipython from ipykernel im...
[ "def", "_detect_notebook", "(", ")", "->", "bool", ":", "try", ":", "from", "IPython", "import", "get_ipython", "from", "ipykernel", "import", "zmqshell", "except", "ImportError", ":", "return", "False", "kernel", "=", "get_ipython", "(", ")", "try", ":", "f...
Detect if code is running in a Jupyter Notebook. This isn't 100% correct but seems good enough Returns ------- bool True if it detects this is a notebook, otherwise False.
[ "Detect", "if", "code", "is", "running", "in", "a", "Jupyter", "Notebook", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L31-L55
train
jwkvam/plotlywrapper
plotlywrapper.py
_merge_layout
def _merge_layout(x: go.Layout, y: go.Layout) -> go.Layout: """Merge attributes from two layouts.""" xjson = x.to_plotly_json() yjson = y.to_plotly_json() if 'shapes' in yjson and 'shapes' in xjson: xjson['shapes'] += yjson['shapes'] yjson.update(xjson) return go.Layout(yjson)
python
def _merge_layout(x: go.Layout, y: go.Layout) -> go.Layout: """Merge attributes from two layouts.""" xjson = x.to_plotly_json() yjson = y.to_plotly_json() if 'shapes' in yjson and 'shapes' in xjson: xjson['shapes'] += yjson['shapes'] yjson.update(xjson) return go.Layout(yjson)
[ "def", "_merge_layout", "(", "x", ":", "go", ".", "Layout", ",", "y", ":", "go", ".", "Layout", ")", "->", "go", ".", "Layout", ":", "xjson", "=", "x", ".", "to_plotly_json", "(", ")", "yjson", "=", "y", ".", "to_plotly_json", "(", ")", "if", "'s...
Merge attributes from two layouts.
[ "Merge", "attributes", "from", "two", "layouts", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L58-L65
train
jwkvam/plotlywrapper
plotlywrapper.py
_try_pydatetime
def _try_pydatetime(x): """Try to convert to pandas objects to datetimes. Plotly doesn't know how to handle them. """ try: # for datetimeindex x = [y.isoformat() for y in x.to_pydatetime()] except AttributeError: pass try: # for generic series x = [y.isof...
python
def _try_pydatetime(x): """Try to convert to pandas objects to datetimes. Plotly doesn't know how to handle them. """ try: # for datetimeindex x = [y.isoformat() for y in x.to_pydatetime()] except AttributeError: pass try: # for generic series x = [y.isof...
[ "def", "_try_pydatetime", "(", "x", ")", ":", "try", ":", "# for datetimeindex", "x", "=", "[", "y", ".", "isoformat", "(", ")", "for", "y", "in", "x", ".", "to_pydatetime", "(", ")", "]", "except", "AttributeError", ":", "pass", "try", ":", "# for gen...
Try to convert to pandas objects to datetimes. Plotly doesn't know how to handle them.
[ "Try", "to", "convert", "to", "pandas", "objects", "to", "datetimes", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L68-L83
train
jwkvam/plotlywrapper
plotlywrapper.py
spark_shape
def spark_shape(points, shapes, fill=None, color='blue', width=5, yindex=0, heights=None): """TODO: Docstring for spark. Parameters ---------- points : array-like shapes : array-like fill : array-like, optional Returns ------- Chart """ assert len(points) == len(shapes) + ...
python
def spark_shape(points, shapes, fill=None, color='blue', width=5, yindex=0, heights=None): """TODO: Docstring for spark. Parameters ---------- points : array-like shapes : array-like fill : array-like, optional Returns ------- Chart """ assert len(points) == len(shapes) + ...
[ "def", "spark_shape", "(", "points", ",", "shapes", ",", "fill", "=", "None", ",", "color", "=", "'blue'", ",", "width", "=", "5", ",", "yindex", "=", "0", ",", "heights", "=", "None", ")", ":", "assert", "len", "(", "points", ")", "==", "len", "...
TODO: Docstring for spark. Parameters ---------- points : array-like shapes : array-like fill : array-like, optional Returns ------- Chart
[ "TODO", ":", "Docstring", "for", "spark", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L472-L519
train
jwkvam/plotlywrapper
plotlywrapper.py
vertical
def vertical(x, ymin=0, ymax=1, color=None, width=None, dash=None, opacity=None): """Draws a vertical line from `ymin` to `ymax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart """ li...
python
def vertical(x, ymin=0, ymax=1, color=None, width=None, dash=None, opacity=None): """Draws a vertical line from `ymin` to `ymax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart """ li...
[ "def", "vertical", "(", "x", ",", "ymin", "=", "0", ",", "ymax", "=", "1", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ")", ":", "lineattr", "=", "{", "}", "if", "color", ":", "...
Draws a vertical line from `ymin` to `ymax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart
[ "Draws", "a", "vertical", "line", "from", "ymin", "to", "ymax", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L522-L548
train
jwkvam/plotlywrapper
plotlywrapper.py
horizontal
def horizontal(y, xmin=0, xmax=1, color=None, width=None, dash=None, opacity=None): """Draws a horizontal line from `xmin` to `xmax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart """ ...
python
def horizontal(y, xmin=0, xmax=1, color=None, width=None, dash=None, opacity=None): """Draws a horizontal line from `xmin` to `xmax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart """ ...
[ "def", "horizontal", "(", "y", ",", "xmin", "=", "0", ",", "xmax", "=", "1", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ")", ":", "lineattr", "=", "{", "}", "if", "color", ":", ...
Draws a horizontal line from `xmin` to `xmax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart
[ "Draws", "a", "horizontal", "line", "from", "xmin", "to", "xmax", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L551-L577
train
jwkvam/plotlywrapper
plotlywrapper.py
line
def line( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', yaxis=1, fill=None, text="", markersize=6, ): """Draws connected dots. Parameters ---------- x : array-like, optional y : array-like, optional...
python
def line( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', yaxis=1, fill=None, text="", markersize=6, ): """Draws connected dots. Parameters ---------- x : array-like, optional y : array-like, optional...
[ "def", "line", "(", "x", "=", "None", ",", "y", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode", "=", "'lines+markers'", ",", "yaxis"...
Draws connected dots. Parameters ---------- x : array-like, optional y : array-like, optional label : array-like, optional Returns ------- Chart
[ "Draws", "connected", "dots", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L580-L665
train
jwkvam/plotlywrapper
plotlywrapper.py
line3d
def line3d( x, y, z, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers' ): """Create a 3d line chart.""" x = np.atleast_1d(x) y = np.atleast_1d(y) z = np.atleast_1d(z) assert x.shape == y.shape assert y.shape == z.shape lineattr = {} if color: l...
python
def line3d( x, y, z, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers' ): """Create a 3d line chart.""" x = np.atleast_1d(x) y = np.atleast_1d(y) z = np.atleast_1d(z) assert x.shape == y.shape assert y.shape == z.shape lineattr = {} if color: l...
[ "def", "line3d", "(", "x", ",", "y", ",", "z", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode", "=", "'lines+markers'", ")", ":", "x", "=", "np"...
Create a 3d line chart.
[ "Create", "a", "3d", "line", "chart", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L668-L696
train
jwkvam/plotlywrapper
plotlywrapper.py
scatter
def scatter( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, markersize=6, yaxis=1, fill=None, text="", mode='markers', ): """Draws dots. Parameters ---------- x : array-like, optional y : array-like, optional label : ...
python
def scatter( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, markersize=6, yaxis=1, fill=None, text="", mode='markers', ): """Draws dots. Parameters ---------- x : array-like, optional y : array-like, optional label : ...
[ "def", "scatter", "(", "x", "=", "None", ",", "y", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "markersize", "=", "6", ",", "yaxis", "...
Draws dots. Parameters ---------- x : array-like, optional y : array-like, optional label : array-like, optional Returns ------- Chart
[ "Draws", "dots", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L746-L786
train
jwkvam/plotlywrapper
plotlywrapper.py
bar
def bar(x=None, y=None, label=None, mode='group', yaxis=1, opacity=None): """Create a bar chart. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional mode : 'group' or 'stack', default 'group' opacity : TODO, optional Returns ------- Char...
python
def bar(x=None, y=None, label=None, mode='group', yaxis=1, opacity=None): """Create a bar chart. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional mode : 'group' or 'stack', default 'group' opacity : TODO, optional Returns ------- Char...
[ "def", "bar", "(", "x", "=", "None", ",", "y", "=", "None", ",", "label", "=", "None", ",", "mode", "=", "'group'", ",", "yaxis", "=", "1", ",", "opacity", "=", "None", ")", ":", "assert", "x", "is", "not", "None", "or", "y", "is", "not", "No...
Create a bar chart. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional mode : 'group' or 'stack', default 'group' opacity : TODO, optional Returns ------- Chart A Chart with bar graph data.
[ "Create", "a", "bar", "chart", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L789-L829
train
jwkvam/plotlywrapper
plotlywrapper.py
heatmap
def heatmap(z, x=None, y=None, colorscale='Viridis'): """Create a heatmap. Parameters ---------- z : TODO x : TODO, optional y : TODO, optional colorscale : TODO, optional Returns ------- Chart """ z = np.atleast_1d(z) data = [go.Heatmap(z=z, x=x, y=y, colorscale=...
python
def heatmap(z, x=None, y=None, colorscale='Viridis'): """Create a heatmap. Parameters ---------- z : TODO x : TODO, optional y : TODO, optional colorscale : TODO, optional Returns ------- Chart """ z = np.atleast_1d(z) data = [go.Heatmap(z=z, x=x, y=y, colorscale=...
[ "def", "heatmap", "(", "z", ",", "x", "=", "None", ",", "y", "=", "None", ",", "colorscale", "=", "'Viridis'", ")", ":", "z", "=", "np", ".", "atleast_1d", "(", "z", ")", "data", "=", "[", "go", ".", "Heatmap", "(", "z", "=", "z", ",", "x", ...
Create a heatmap. Parameters ---------- z : TODO x : TODO, optional y : TODO, optional colorscale : TODO, optional Returns ------- Chart
[ "Create", "a", "heatmap", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L832-L850
train
jwkvam/plotlywrapper
plotlywrapper.py
fill_zero
def fill_zero( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', **kargs ): """Fill to zero. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional Returns ------- ...
python
def fill_zero( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', **kargs ): """Fill to zero. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional Returns ------- ...
[ "def", "fill_zero", "(", "x", "=", "None", ",", "y", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode", "=", "'lines+markers'", ",", "*...
Fill to zero. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional Returns ------- Chart
[ "Fill", "to", "zero", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L853-L888
train
jwkvam/plotlywrapper
plotlywrapper.py
fill_between
def fill_between( x=None, ylow=None, yhigh=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', **kargs ): """Fill between `ylow` and `yhigh`. Parameters ---------- x : array-like, optional ylow : TODO, optional yhigh :...
python
def fill_between( x=None, ylow=None, yhigh=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', **kargs ): """Fill between `ylow` and `yhigh`. Parameters ---------- x : array-like, optional ylow : TODO, optional yhigh :...
[ "def", "fill_between", "(", "x", "=", "None", ",", "ylow", "=", "None", ",", "yhigh", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode"...
Fill between `ylow` and `yhigh`. Parameters ---------- x : array-like, optional ylow : TODO, optional yhigh : TODO, optional Returns ------- Chart
[ "Fill", "between", "ylow", "and", "yhigh", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L891-L940
train
jwkvam/plotlywrapper
plotlywrapper.py
rug
def rug(x, label=None, opacity=None): """Rug chart. Parameters ---------- x : array-like, optional label : TODO, optional opacity : TODO, optional Returns ------- Chart """ x = _try_pydatetime(x) x = np.atleast_1d(x) data = [ go.Scatter( x=x, ...
python
def rug(x, label=None, opacity=None): """Rug chart. Parameters ---------- x : array-like, optional label : TODO, optional opacity : TODO, optional Returns ------- Chart """ x = _try_pydatetime(x) x = np.atleast_1d(x) data = [ go.Scatter( x=x, ...
[ "def", "rug", "(", "x", ",", "label", "=", "None", ",", "opacity", "=", "None", ")", ":", "x", "=", "_try_pydatetime", "(", "x", ")", "x", "=", "np", ".", "atleast_1d", "(", "x", ")", "data", "=", "[", "go", ".", "Scatter", "(", "x", "=", "x"...
Rug chart. Parameters ---------- x : array-like, optional label : TODO, optional opacity : TODO, optional Returns ------- Chart
[ "Rug", "chart", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L943-L984
train
jwkvam/plotlywrapper
plotlywrapper.py
surface
def surface(x, y, z): """Surface plot. Parameters ---------- x : array-like, optional y : array-like, optional z : array-like, optional Returns ------- Chart """ data = [go.Surface(x=x, y=y, z=z)] return Chart(data=data)
python
def surface(x, y, z): """Surface plot. Parameters ---------- x : array-like, optional y : array-like, optional z : array-like, optional Returns ------- Chart """ data = [go.Surface(x=x, y=y, z=z)] return Chart(data=data)
[ "def", "surface", "(", "x", ",", "y", ",", "z", ")", ":", "data", "=", "[", "go", ".", "Surface", "(", "x", "=", "x", ",", "y", "=", "y", ",", "z", "=", "z", ")", "]", "return", "Chart", "(", "data", "=", "data", ")" ]
Surface plot. Parameters ---------- x : array-like, optional y : array-like, optional z : array-like, optional Returns ------- Chart
[ "Surface", "plot", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L987-L1002
train
jwkvam/plotlywrapper
plotlywrapper.py
hist
def hist(x, mode='overlay', label=None, opacity=None, horz=False, histnorm=None): """Histogram. Parameters ---------- x : array-like mode : str, optional label : TODO, optional opacity : float, optional horz : bool, optional histnorm : None, "percent", "probability", "density", "pro...
python
def hist(x, mode='overlay', label=None, opacity=None, horz=False, histnorm=None): """Histogram. Parameters ---------- x : array-like mode : str, optional label : TODO, optional opacity : float, optional horz : bool, optional histnorm : None, "percent", "probability", "density", "pro...
[ "def", "hist", "(", "x", ",", "mode", "=", "'overlay'", ",", "label", "=", "None", ",", "opacity", "=", "None", ",", "horz", "=", "False", ",", "histnorm", "=", "None", ")", ":", "x", "=", "np", ".", "atleast_1d", "(", "x", ")", "if", "horz", "...
Histogram. Parameters ---------- x : array-like mode : str, optional label : TODO, optional opacity : float, optional horz : bool, optional histnorm : None, "percent", "probability", "density", "probability density", optional Specifies the type of normalization used for this his...
[ "Histogram", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L1005-L1040
train
jwkvam/plotlywrapper
plotlywrapper.py
hist2d
def hist2d(x, y, label=None, opacity=None): """2D Histogram. Parameters ---------- x : array-like, optional y : array-like, optional label : TODO, optional opacity : float, optional Returns ------- Chart """ x = np.atleast_1d(x) y = np.atleast_1d(y) data = [go....
python
def hist2d(x, y, label=None, opacity=None): """2D Histogram. Parameters ---------- x : array-like, optional y : array-like, optional label : TODO, optional opacity : float, optional Returns ------- Chart """ x = np.atleast_1d(x) y = np.atleast_1d(y) data = [go....
[ "def", "hist2d", "(", "x", ",", "y", ",", "label", "=", "None", ",", "opacity", "=", "None", ")", ":", "x", "=", "np", ".", "atleast_1d", "(", "x", ")", "y", "=", "np", ".", "atleast_1d", "(", "y", ")", "data", "=", "[", "go", ".", "Histogram...
2D Histogram. Parameters ---------- x : array-like, optional y : array-like, optional label : TODO, optional opacity : float, optional Returns ------- Chart
[ "2D", "Histogram", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L1043-L1061
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ytickangle
def ytickangle(self, angle, index=1): """Set the angle of the y-axis tick labels. Parameters ---------- value : int Angle in degrees index : int, optional Y-axis index Returns ------- Chart """ self.layout['yaxis'...
python
def ytickangle(self, angle, index=1): """Set the angle of the y-axis tick labels. Parameters ---------- value : int Angle in degrees index : int, optional Y-axis index Returns ------- Chart """ self.layout['yaxis'...
[ "def", "ytickangle", "(", "self", ",", "angle", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'tickangle'", "]", "=", "angle", "return", "self" ]
Set the angle of the y-axis tick labels. Parameters ---------- value : int Angle in degrees index : int, optional Y-axis index Returns ------- Chart
[ "Set", "the", "angle", "of", "the", "y", "-", "axis", "tick", "labels", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L221-L237
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ylabelsize
def ylabelsize(self, size, index=1): """Set the size of the label. Parameters ---------- size : int Returns ------- Chart """ self.layout['yaxis' + str(index)]['titlefont']['size'] = size return self
python
def ylabelsize(self, size, index=1): """Set the size of the label. Parameters ---------- size : int Returns ------- Chart """ self.layout['yaxis' + str(index)]['titlefont']['size'] = size return self
[ "def", "ylabelsize", "(", "self", ",", "size", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'titlefont'", "]", "[", "'size'", "]", "=", "size", "return", "self" ]
Set the size of the label. Parameters ---------- size : int Returns ------- Chart
[ "Set", "the", "size", "of", "the", "label", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L254-L267
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.yticksize
def yticksize(self, size, index=1): """Set the tick font size. Parameters ---------- size : int Returns ------- Chart """ self.layout['yaxis' + str(index)]['tickfont']['size'] = size return self
python
def yticksize(self, size, index=1): """Set the tick font size. Parameters ---------- size : int Returns ------- Chart """ self.layout['yaxis' + str(index)]['tickfont']['size'] = size return self
[ "def", "yticksize", "(", "self", ",", "size", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'tickfont'", "]", "[", "'size'", "]", "=", "size", "return", "self" ]
Set the tick font size. Parameters ---------- size : int Returns ------- Chart
[ "Set", "the", "tick", "font", "size", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L284-L297
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ytickvals
def ytickvals(self, values, index=1): """Set the tick values. Parameters ---------- values : array-like Returns ------- Chart """ self.layout['yaxis' + str(index)]['tickvals'] = values return self
python
def ytickvals(self, values, index=1): """Set the tick values. Parameters ---------- values : array-like Returns ------- Chart """ self.layout['yaxis' + str(index)]['tickvals'] = values return self
[ "def", "ytickvals", "(", "self", ",", "values", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'tickvals'", "]", "=", "values", "return", "self" ]
Set the tick values. Parameters ---------- values : array-like Returns ------- Chart
[ "Set", "the", "tick", "values", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L299-L312
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.yticktext
def yticktext(self, labels, index=1): """Set the tick labels. Parameters ---------- labels : array-like Returns ------- Chart """ self.layout['yaxis' + str(index)]['ticktext'] = labels return self
python
def yticktext(self, labels, index=1): """Set the tick labels. Parameters ---------- labels : array-like Returns ------- Chart """ self.layout['yaxis' + str(index)]['ticktext'] = labels return self
[ "def", "yticktext", "(", "self", ",", "labels", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'ticktext'", "]", "=", "labels", "return", "self" ]
Set the tick labels. Parameters ---------- labels : array-like Returns ------- Chart
[ "Set", "the", "tick", "labels", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L314-L327
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ylim
def ylim(self, low, high, index=1): """Set yaxis limits. Parameters ---------- low : number high : number index : int, optional Returns ------- Chart """ self.layout['yaxis' + str(index)]['range'] = [low, high] return sel...
python
def ylim(self, low, high, index=1): """Set yaxis limits. Parameters ---------- low : number high : number index : int, optional Returns ------- Chart """ self.layout['yaxis' + str(index)]['range'] = [low, high] return sel...
[ "def", "ylim", "(", "self", ",", "low", ",", "high", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'range'", "]", "=", "[", "low", ",", "high", "]", "return", "self" ]
Set yaxis limits. Parameters ---------- low : number high : number index : int, optional Returns ------- Chart
[ "Set", "yaxis", "limits", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L345-L360
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ydtick
def ydtick(self, dtick, index=1): """Set the tick distance.""" self.layout['yaxis' + str(index)]['dtick'] = dtick return self
python
def ydtick(self, dtick, index=1): """Set the tick distance.""" self.layout['yaxis' + str(index)]['dtick'] = dtick return self
[ "def", "ydtick", "(", "self", ",", "dtick", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'dtick'", "]", "=", "dtick", "return", "self" ]
Set the tick distance.
[ "Set", "the", "tick", "distance", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L367-L370
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ynticks
def ynticks(self, nticks, index=1): """Set the number of ticks.""" self.layout['yaxis' + str(index)]['nticks'] = nticks return self
python
def ynticks(self, nticks, index=1): """Set the number of ticks.""" self.layout['yaxis' + str(index)]['nticks'] = nticks return self
[ "def", "ynticks", "(", "self", ",", "nticks", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'nticks'", "]", "=", "nticks", "return", "self" ]
Set the number of ticks.
[ "Set", "the", "number", "of", "ticks", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L377-L380
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.show
def show( self, filename: Optional[str] = None, show_link: bool = True, auto_open: bool = True, detect_notebook: bool = True, ) -> None: """Display the chart. Parameters ---------- filename : str, optional Save plot to this filenam...
python
def show( self, filename: Optional[str] = None, show_link: bool = True, auto_open: bool = True, detect_notebook: bool = True, ) -> None: """Display the chart. Parameters ---------- filename : str, optional Save plot to this filenam...
[ "def", "show", "(", "self", ",", "filename", ":", "Optional", "[", "str", "]", "=", "None", ",", "show_link", ":", "bool", "=", "True", ",", "auto_open", ":", "bool", "=", "True", ",", "detect_notebook", ":", "bool", "=", "True", ",", ")", "->", "N...
Display the chart. Parameters ---------- filename : str, optional Save plot to this filename, otherwise it's saved to a temporary file. show_link : bool, optional Show link to plotly. auto_open : bool, optional Automatically open the plot (in ...
[ "Display", "the", "chart", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L410-L442
train
jwkvam/plotlywrapper
plotlywrapper.py
Chart.save
def save( self, filename: Optional[str] = None, show_link: bool = True, auto_open: bool = False, output: str = 'file', plotlyjs: bool = True, ) -> str: """Save the chart to an html file.""" if filename is None: filename = NamedTemporaryFile...
python
def save( self, filename: Optional[str] = None, show_link: bool = True, auto_open: bool = False, output: str = 'file', plotlyjs: bool = True, ) -> str: """Save the chart to an html file.""" if filename is None: filename = NamedTemporaryFile...
[ "def", "save", "(", "self", ",", "filename", ":", "Optional", "[", "str", "]", "=", "None", ",", "show_link", ":", "bool", "=", "True", ",", "auto_open", ":", "bool", "=", "False", ",", "output", ":", "str", "=", "'file'", ",", "plotlyjs", ":", "bo...
Save the chart to an html file.
[ "Save", "the", "chart", "to", "an", "html", "file", "." ]
762b42912e824fecb1212c186900f2ebdd0ab12b
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L444-L464
train
cgarciae/phi
phi/builder.py
Builder.RegisterMethod
def RegisterMethod(cls, *args, **kwargs): """ **RegisterMethod** RegisterMethod(f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True) `classmethod` for registering functions as methods of this class. **Arguments** * **f** : the...
python
def RegisterMethod(cls, *args, **kwargs): """ **RegisterMethod** RegisterMethod(f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True) `classmethod` for registering functions as methods of this class. **Arguments** * **f** : the...
[ "def", "RegisterMethod", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "unpack_error", "=", "True", "try", ":", "f", ",", "library_path", "=", "args", "unpack_error", "=", "False", "cls", ".", "_RegisterMethod", "(", "f", ",", "libra...
**RegisterMethod** RegisterMethod(f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True) `classmethod` for registering functions as methods of this class. **Arguments** * **f** : the particular function being registered as a method * **...
[ "**", "RegisterMethod", "**" ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/builder.py#L71-L205
train
cgarciae/phi
phi/builder.py
Builder.RegisterAt
def RegisterAt(cls, *args, **kwargs): """ **RegisterAt** RegisterAt(n, f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True, _return_type=None) Most of the time you don't want to register an method as such, that is, you don't car...
python
def RegisterAt(cls, *args, **kwargs): """ **RegisterAt** RegisterAt(n, f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True, _return_type=None) Most of the time you don't want to register an method as such, that is, you don't car...
[ "def", "RegisterAt", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "unpack_error", "=", "True", "try", ":", "n", ",", "f", ",", "library_path", "=", "args", "unpack_error", "=", "False", "cls", ".", "_RegisterAt", "(", "n", ",", ...
**RegisterAt** RegisterAt(n, f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True, _return_type=None) Most of the time you don't want to register an method as such, that is, you don't care about the `self` builder object, instead you wan...
[ "**", "RegisterAt", "**" ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/builder.py#L238-L285
train
cgarciae/phi
phi/builder.py
Builder.PatchAt
def PatchAt(cls, n, module, method_wrapper=None, module_alias=None, method_name_modifier=utils.identity, blacklist_predicate=_False, whitelist_predicate=_True, return_type_predicate=_None, getmembers_predicate=inspect.isfunction, admit_private=False, explanation=""): """ This classmethod lets you easily patch a...
python
def PatchAt(cls, n, module, method_wrapper=None, module_alias=None, method_name_modifier=utils.identity, blacklist_predicate=_False, whitelist_predicate=_True, return_type_predicate=_None, getmembers_predicate=inspect.isfunction, admit_private=False, explanation=""): """ This classmethod lets you easily patch a...
[ "def", "PatchAt", "(", "cls", ",", "n", ",", "module", ",", "method_wrapper", "=", "None", ",", "module_alias", "=", "None", ",", "method_name_modifier", "=", "utils", ".", "identity", ",", "blacklist_predicate", "=", "_False", ",", "whitelist_predicate", "=",...
This classmethod lets you easily patch all of functions/callables from a module or class as methods a Builder class. **Arguments** * **n** : the position the the object being piped will take in the arguments when the function being patched is applied. See `RegisterMethod` and `ThenAt`. * **module** : a module or clas...
[ "This", "classmethod", "lets", "you", "easily", "patch", "all", "of", "functions", "/", "callables", "from", "a", "module", "or", "class", "as", "methods", "a", "Builder", "class", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/builder.py#L360-L434
train
cgarciae/phi
phi/utils.py
get_method_sig
def get_method_sig(method): """ Given a function, it returns a string that pretty much looks how the function signature_ would be written in python. :param method: a python method :return: A string similar describing the pythong method signature_. eg: "my_method(first_argArg, second_arg=42, third_a...
python
def get_method_sig(method): """ Given a function, it returns a string that pretty much looks how the function signature_ would be written in python. :param method: a python method :return: A string similar describing the pythong method signature_. eg: "my_method(first_argArg, second_arg=42, third_a...
[ "def", "get_method_sig", "(", "method", ")", ":", "# The return value of ArgSpec is a bit weird, as the list of arguments and", "# list of defaults are returned in separate array.", "# eg: ArgSpec(args=['first_arg', 'second_arg', 'third_arg'],", "# varargs=None, keywords=None, defaults=(42, 'somet...
Given a function, it returns a string that pretty much looks how the function signature_ would be written in python. :param method: a python method :return: A string similar describing the pythong method signature_. eg: "my_method(first_argArg, second_arg=42, third_arg='something')"
[ "Given", "a", "function", "it", "returns", "a", "string", "that", "pretty", "much", "looks", "how", "the", "function", "signature_", "would", "be", "written", "in", "python", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/utils.py#L64-L90
train
cgarciae/phi
phi/dsl.py
Expression.Pipe
def Pipe(self, *sequence, **kwargs): """ `Pipe` runs any `phi.dsl.Expression`. Its highly inspired by Elixir's [|> (pipe)](https://hexdocs.pm/elixir/Kernel.html#%7C%3E/2) operator. **Arguments** * ***sequence**: any variable amount of expressions. All expressions inside of `sequence` will be composed together...
python
def Pipe(self, *sequence, **kwargs): """ `Pipe` runs any `phi.dsl.Expression`. Its highly inspired by Elixir's [|> (pipe)](https://hexdocs.pm/elixir/Kernel.html#%7C%3E/2) operator. **Arguments** * ***sequence**: any variable amount of expressions. All expressions inside of `sequence` will be composed together...
[ "def", "Pipe", "(", "self", ",", "*", "sequence", ",", "*", "*", "kwargs", ")", ":", "state", "=", "kwargs", ".", "pop", "(", "\"refs\"", ",", "{", "}", ")", "return", "self", ".", "Seq", "(", "*", "sequence", ",", "*", "*", "kwargs", ")", "(",...
`Pipe` runs any `phi.dsl.Expression`. Its highly inspired by Elixir's [|> (pipe)](https://hexdocs.pm/elixir/Kernel.html#%7C%3E/2) operator. **Arguments** * ***sequence**: any variable amount of expressions. All expressions inside of `sequence` will be composed together using `phi.dsl.Expression.Seq`. * ****kwargs**: ...
[ "Pipe", "runs", "any", "phi", ".", "dsl", ".", "Expression", ".", "Its", "highly", "inspired", "by", "Elixir", "s", "[", "|", ">", "(", "pipe", ")", "]", "(", "https", ":", "//", "hexdocs", ".", "pm", "/", "elixir", "/", "Kernel", ".", "html#%7C%3E...
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L468-L522
train
cgarciae/phi
phi/dsl.py
Expression.ThenAt
def ThenAt(self, n, f, *_args, **kwargs): """ `ThenAt` enables you to create a partially apply many arguments to a function, the returned partial expects a single arguments which will be applied at the `n`th position of the original function. **Arguments** * **n**: position at which the created partial will a...
python
def ThenAt(self, n, f, *_args, **kwargs): """ `ThenAt` enables you to create a partially apply many arguments to a function, the returned partial expects a single arguments which will be applied at the `n`th position of the original function. **Arguments** * **n**: position at which the created partial will a...
[ "def", "ThenAt", "(", "self", ",", "n", ",", "f", ",", "*", "_args", ",", "*", "*", "kwargs", ")", ":", "_return_type", "=", "None", "n_args", "=", "n", "-", "1", "if", "'_return_type'", "in", "kwargs", ":", "_return_type", "=", "kwargs", "[", "'_r...
`ThenAt` enables you to create a partially apply many arguments to a function, the returned partial expects a single arguments which will be applied at the `n`th position of the original function. **Arguments** * **n**: position at which the created partial will apply its awaited argument on the original function. * ...
[ "ThenAt", "enables", "you", "to", "create", "a", "partially", "apply", "many", "arguments", "to", "a", "function", "the", "returned", "partial", "expects", "a", "single", "arguments", "which", "will", "be", "applied", "at", "the", "n", "th", "position", "of"...
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L524-L638
train
cgarciae/phi
phi/dsl.py
Expression.Then0
def Then0(self, f, *args, **kwargs): """ `Then0(f, ...)` is equivalent to `ThenAt(0, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ return self.ThenAt(0, f, *args, **kwargs)
python
def Then0(self, f, *args, **kwargs): """ `Then0(f, ...)` is equivalent to `ThenAt(0, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ return self.ThenAt(0, f, *args, **kwargs)
[ "def", "Then0", "(", "self", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "ThenAt", "(", "0", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
`Then0(f, ...)` is equivalent to `ThenAt(0, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then0", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "0", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L640-L644
train
cgarciae/phi
phi/dsl.py
Expression.Then
def Then(self, f, *args, **kwargs): """ `Then(f, ...)` is equivalent to `ThenAt(1, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ return self.ThenAt(1, f, *args, **kwargs)
python
def Then(self, f, *args, **kwargs): """ `Then(f, ...)` is equivalent to `ThenAt(1, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ return self.ThenAt(1, f, *args, **kwargs)
[ "def", "Then", "(", "self", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "ThenAt", "(", "1", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
`Then(f, ...)` is equivalent to `ThenAt(1, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "1", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L646-L650
train
cgarciae/phi
phi/dsl.py
Expression.Then2
def Then2(self, f, arg1, *args, **kwargs): """ `Then2(f, ...)` is equivalent to `ThenAt(2, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1,) + args return self.ThenAt(2, f, *args, **kwargs)
python
def Then2(self, f, arg1, *args, **kwargs): """ `Then2(f, ...)` is equivalent to `ThenAt(2, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1,) + args return self.ThenAt(2, f, *args, **kwargs)
[ "def", "Then2", "(", "self", ",", "f", ",", "arg1", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "(", "arg1", ",", ")", "+", "args", "return", "self", ".", "ThenAt", "(", "2", ",", "f", ",", "*", "args", ",", "*", "*", ...
`Then2(f, ...)` is equivalent to `ThenAt(2, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then2", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "2", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L654-L659
train
cgarciae/phi
phi/dsl.py
Expression.Then3
def Then3(self, f, arg1, arg2, *args, **kwargs): """ `Then3(f, ...)` is equivalent to `ThenAt(3, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2) + args return self.ThenAt(3, f, *args, **kwargs)
python
def Then3(self, f, arg1, arg2, *args, **kwargs): """ `Then3(f, ...)` is equivalent to `ThenAt(3, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2) + args return self.ThenAt(3, f, *args, **kwargs)
[ "def", "Then3", "(", "self", ",", "f", ",", "arg1", ",", "arg2", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "(", "arg1", ",", "arg2", ")", "+", "args", "return", "self", ".", "ThenAt", "(", "3", ",", "f", ",", "*", "a...
`Then3(f, ...)` is equivalent to `ThenAt(3, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then3", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "3", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L661-L666
train
cgarciae/phi
phi/dsl.py
Expression.Then4
def Then4(self, f, arg1, arg2, arg3, *args, **kwargs): """ `Then4(f, ...)` is equivalent to `ThenAt(4, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2, arg3) + args return self.ThenAt(4, f, *args, **kwargs)
python
def Then4(self, f, arg1, arg2, arg3, *args, **kwargs): """ `Then4(f, ...)` is equivalent to `ThenAt(4, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2, arg3) + args return self.ThenAt(4, f, *args, **kwargs)
[ "def", "Then4", "(", "self", ",", "f", ",", "arg1", ",", "arg2", ",", "arg3", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "(", "arg1", ",", "arg2", ",", "arg3", ")", "+", "args", "return", "self", ".", "ThenAt", "(", "4"...
`Then4(f, ...)` is equivalent to `ThenAt(4, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then4", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "4", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L668-L673
train
cgarciae/phi
phi/dsl.py
Expression.Then5
def Then5(self, f, arg1, arg2, arg3, arg4, *args, **kwargs): """ `Then5(f, ...)` is equivalent to `ThenAt(5, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2, arg3, arg4) + args return self.ThenAt(5, f, *args, **kwargs)
python
def Then5(self, f, arg1, arg2, arg3, arg4, *args, **kwargs): """ `Then5(f, ...)` is equivalent to `ThenAt(5, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2, arg3, arg4) + args return self.ThenAt(5, f, *args, **kwargs)
[ "def", "Then5", "(", "self", ",", "f", ",", "arg1", ",", "arg2", ",", "arg3", ",", "arg4", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "(", "arg1", ",", "arg2", ",", "arg3", ",", "arg4", ")", "+", "args", "return", "self...
`Then5(f, ...)` is equivalent to `ThenAt(5, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then5", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "5", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L675-L680
train
cgarciae/phi
phi/dsl.py
Expression.List
def List(self, *branches, **kwargs): """ While `Seq` is sequential, `phi.dsl.Expression.List` allows you to split the computation and get back a list with the result of each path. While the list literal should be the most incarnation of this expresion, it can actually be any iterable (implements `__iter__`) tha...
python
def List(self, *branches, **kwargs): """ While `Seq` is sequential, `phi.dsl.Expression.List` allows you to split the computation and get back a list with the result of each path. While the list literal should be the most incarnation of this expresion, it can actually be any iterable (implements `__iter__`) tha...
[ "def", "List", "(", "self", ",", "*", "branches", ",", "*", "*", "kwargs", ")", ":", "gs", "=", "[", "_parse", "(", "code", ")", ".", "_f", "for", "code", "in", "branches", "]", "def", "h", "(", "x", ",", "state", ")", ":", "ys", "=", "[", ...
While `Seq` is sequential, `phi.dsl.Expression.List` allows you to split the computation and get back a list with the result of each path. While the list literal should be the most incarnation of this expresion, it can actually be any iterable (implements `__iter__`) that is not a tuple and yields a valid expresion. T...
[ "While", "Seq", "is", "sequential", "phi", ".", "dsl", ".", "Expression", ".", "List", "allows", "you", "to", "split", "the", "computation", "and", "get", "back", "a", "list", "with", "the", "result", "of", "each", "path", ".", "While", "the", "list", ...
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L682-L793
train
cgarciae/phi
phi/dsl.py
Expression.Seq
def Seq(self, *sequence, **kwargs): """ `Seq` is used to express function composition. The expression Seq(f, g) be equivalent to lambda x: g(f(x)) As you see, its a little different from the mathematical definition. Excecution order flow from left to right, this makes reading and reasoning about cod...
python
def Seq(self, *sequence, **kwargs): """ `Seq` is used to express function composition. The expression Seq(f, g) be equivalent to lambda x: g(f(x)) As you see, its a little different from the mathematical definition. Excecution order flow from left to right, this makes reading and reasoning about cod...
[ "def", "Seq", "(", "self", ",", "*", "sequence", ",", "*", "*", "kwargs", ")", ":", "fs", "=", "[", "_parse", "(", "elem", ")", ".", "_f", "for", "elem", "in", "sequence", "]", "def", "g", "(", "x", ",", "state", ")", ":", "return", "functools"...
`Seq` is used to express function composition. The expression Seq(f, g) be equivalent to lambda x: g(f(x)) As you see, its a little different from the mathematical definition. Excecution order flow from left to right, this makes reading and reasoning about code way more easy. This bahaviour is based upon th...
[ "Seq", "is", "used", "to", "express", "function", "composition", ".", "The", "expression" ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L801-L869
train
cgarciae/phi
phi/dsl.py
Expression.With
def With(self, context_manager, *body, **kwargs): """ **With** def With(context_manager, *body): **Arguments** * **context_manager**: a [context manager](https://docs.python.org/2/reference/datamodel.html#context-managers) object or valid expression from the DSL that returns a context manager. * ***body*...
python
def With(self, context_manager, *body, **kwargs): """ **With** def With(context_manager, *body): **Arguments** * **context_manager**: a [context manager](https://docs.python.org/2/reference/datamodel.html#context-managers) object or valid expression from the DSL that returns a context manager. * ***body*...
[ "def", "With", "(", "self", ",", "context_manager", ",", "*", "body", ",", "*", "*", "kwargs", ")", ":", "context_f", "=", "_parse", "(", "context_manager", ")", ".", "_f", "body_f", "=", "E", ".", "Seq", "(", "*", "body", ")", ".", "_f", "def", ...
**With** def With(context_manager, *body): **Arguments** * **context_manager**: a [context manager](https://docs.python.org/2/reference/datamodel.html#context-managers) object or valid expression from the DSL that returns a context manager. * ***body**: any valid expression of the DSL to be evaluated inside the ...
[ "**", "With", "**" ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L930-L973
train
cgarciae/phi
phi/dsl.py
Expression.ReadList
def ReadList(self, *branches, **kwargs): """ Same as `phi.dsl.Expression.List` but any string argument `x` is translated to `Read(x)`. """ branches = map(lambda x: E.Read(x) if isinstance(x, str) else x, branches) return self.List(*branches, **kwargs)
python
def ReadList(self, *branches, **kwargs): """ Same as `phi.dsl.Expression.List` but any string argument `x` is translated to `Read(x)`. """ branches = map(lambda x: E.Read(x) if isinstance(x, str) else x, branches) return self.List(*branches, **kwargs)
[ "def", "ReadList", "(", "self", ",", "*", "branches", ",", "*", "*", "kwargs", ")", ":", "branches", "=", "map", "(", "lambda", "x", ":", "E", ".", "Read", "(", "x", ")", "if", "isinstance", "(", "x", ",", "str", ")", "else", "x", ",", "branche...
Same as `phi.dsl.Expression.List` but any string argument `x` is translated to `Read(x)`.
[ "Same", "as", "phi", ".", "dsl", ".", "Expression", ".", "List", "but", "any", "string", "argument", "x", "is", "translated", "to", "Read", "(", "x", ")", "." ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L1021-L1027
train
cgarciae/phi
phi/dsl.py
Expression.Write
def Write(self, *state_args, **state_dict): """See `phi.dsl.Expression.Read`""" if len(state_dict) + len(state_args) < 1: raise Exception("Please include at-least 1 state variable, got {0} and {1}".format(state_args, state_dict)) if len(state_dict) > 1: raise Exception("...
python
def Write(self, *state_args, **state_dict): """See `phi.dsl.Expression.Read`""" if len(state_dict) + len(state_args) < 1: raise Exception("Please include at-least 1 state variable, got {0} and {1}".format(state_args, state_dict)) if len(state_dict) > 1: raise Exception("...
[ "def", "Write", "(", "self", ",", "*", "state_args", ",", "*", "*", "state_dict", ")", ":", "if", "len", "(", "state_dict", ")", "+", "len", "(", "state_args", ")", "<", "1", ":", "raise", "Exception", "(", "\"Please include at-least 1 state variable, got {0...
See `phi.dsl.Expression.Read`
[ "See", "phi", ".", "dsl", ".", "Expression", ".", "Read" ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L1030-L1061
train
cgarciae/phi
phi/dsl.py
Expression.Val
def Val(self, val, **kwargs): """ The expression Val(a) is equivalent to the constant function lambda x: a All expression in this module interprete values that are not functions as constant functions using `Val`, for example Seq(1, P + 1) is equivalent to Seq(Val(1), P + 1) The previous ...
python
def Val(self, val, **kwargs): """ The expression Val(a) is equivalent to the constant function lambda x: a All expression in this module interprete values that are not functions as constant functions using `Val`, for example Seq(1, P + 1) is equivalent to Seq(Val(1), P + 1) The previous ...
[ "def", "Val", "(", "self", ",", "val", ",", "*", "*", "kwargs", ")", ":", "f", "=", "utils", ".", "lift", "(", "lambda", "z", ":", "val", ")", "return", "self", ".", "__then__", "(", "f", ",", "*", "*", "kwargs", ")" ]
The expression Val(a) is equivalent to the constant function lambda x: a All expression in this module interprete values that are not functions as constant functions using `Val`, for example Seq(1, P + 1) is equivalent to Seq(Val(1), P + 1) The previous expression as a whole is a constant functi...
[ "The", "expression" ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L1181-L1203
train
cgarciae/phi
phi/dsl.py
Expression.If
def If(self, condition, *then, **kwargs): """ **If** If(Predicate, *Then) Having conditionals expressions a necesity in every language, Phi includes the `If` expression for such a purpose. **Arguments** * **Predicate** : a predicate expression uses to determine if the `Then` or `Else` branches should be...
python
def If(self, condition, *then, **kwargs): """ **If** If(Predicate, *Then) Having conditionals expressions a necesity in every language, Phi includes the `If` expression for such a purpose. **Arguments** * **Predicate** : a predicate expression uses to determine if the `Then` or `Else` branches should be...
[ "def", "If", "(", "self", ",", "condition", ",", "*", "then", ",", "*", "*", "kwargs", ")", ":", "cond_f", "=", "_parse", "(", "condition", ")", ".", "_f", "then_f", "=", "E", ".", "Seq", "(", "*", "then", ")", ".", "_f", "else_f", "=", "utils"...
**If** If(Predicate, *Then) Having conditionals expressions a necesity in every language, Phi includes the `If` expression for such a purpose. **Arguments** * **Predicate** : a predicate expression uses to determine if the `Then` or `Else` branches should be used. * ***Then** : an expression to be excecuted if ...
[ "**", "If", "**" ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L1206-L1253
train
cgarciae/phi
phi/dsl.py
Expression.Else
def Else(self, *Else, **kwargs): """See `phi.dsl.Expression.If`""" root = self._root ast = self._ast next_else = E.Seq(*Else)._f ast = _add_else(ast, next_else) g = _compile_if(ast) return root.__then__(g, **kwargs)
python
def Else(self, *Else, **kwargs): """See `phi.dsl.Expression.If`""" root = self._root ast = self._ast next_else = E.Seq(*Else)._f ast = _add_else(ast, next_else) g = _compile_if(ast) return root.__then__(g, **kwargs)
[ "def", "Else", "(", "self", ",", "*", "Else", ",", "*", "*", "kwargs", ")", ":", "root", "=", "self", ".", "_root", "ast", "=", "self", ".", "_ast", "next_else", "=", "E", ".", "Seq", "(", "*", "Else", ")", ".", "_f", "ast", "=", "_add_else", ...
See `phi.dsl.Expression.If`
[ "See", "phi", ".", "dsl", ".", "Expression", ".", "If" ]
87fd7100a76f823232f4fd8360498b4b80675265
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L1255-L1265
train
alvinlindstam/grapheme
grapheme/api.py
length
def length(string, until=None): """ Returns the number of graphemes in the string. Note that this functions needs to traverse the full string to calculate the length, unlike `len(string)` and it's time consumption is linear to the length of the string (up to the `until` value). Only counts up ...
python
def length(string, until=None): """ Returns the number of graphemes in the string. Note that this functions needs to traverse the full string to calculate the length, unlike `len(string)` and it's time consumption is linear to the length of the string (up to the `until` value). Only counts up ...
[ "def", "length", "(", "string", ",", "until", "=", "None", ")", ":", "if", "until", "is", "None", ":", "return", "sum", "(", "1", "for", "_", "in", "GraphemeIterator", "(", "string", ")", ")", "iterator", "=", "graphemes", "(", "string", ")", "count"...
Returns the number of graphemes in the string. Note that this functions needs to traverse the full string to calculate the length, unlike `len(string)` and it's time consumption is linear to the length of the string (up to the `until` value). Only counts up to the `until` argument, if given. This is u...
[ "Returns", "the", "number", "of", "graphemes", "in", "the", "string", "." ]
45cd9b8326ddf96d2618406724a7ebf273cbde03
https://github.com/alvinlindstam/grapheme/blob/45cd9b8326ddf96d2618406724a7ebf273cbde03/grapheme/api.py#L21-L55
train
alvinlindstam/grapheme
grapheme/api.py
slice
def slice(string, start=None, end=None): """ Returns a substring of the given string, counting graphemes instead of codepoints. Negative indices is currently not supported. >>> string = "tamil நி (ni)" >>> string[:7] 'tamil ந' >>> grapheme.slice(string, end=7) 'tamil நி' >>> string...
python
def slice(string, start=None, end=None): """ Returns a substring of the given string, counting graphemes instead of codepoints. Negative indices is currently not supported. >>> string = "tamil நி (ni)" >>> string[:7] 'tamil ந' >>> grapheme.slice(string, end=7) 'tamil நி' >>> string...
[ "def", "slice", "(", "string", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "if", "start", "is", "None", ":", "start", "=", "0", "if", "end", "is", "not", "None", "and", "start", ">=", "end", ":", "return", "\"\"", "if", "start",...
Returns a substring of the given string, counting graphemes instead of codepoints. Negative indices is currently not supported. >>> string = "tamil நி (ni)" >>> string[:7] 'tamil ந' >>> grapheme.slice(string, end=7) 'tamil நி' >>> string[7:] 'ி (ni)' >>> grapheme.slice(string, 7) ...
[ "Returns", "a", "substring", "of", "the", "given", "string", "counting", "graphemes", "instead", "of", "codepoints", "." ]
45cd9b8326ddf96d2618406724a7ebf273cbde03
https://github.com/alvinlindstam/grapheme/blob/45cd9b8326ddf96d2618406724a7ebf273cbde03/grapheme/api.py#L66-L103
train
alvinlindstam/grapheme
grapheme/api.py
contains
def contains(string, substring): """ Returns true if the sequence of graphemes in substring is also present in string. This differs from the normal python `in` operator, since the python operator will return true if the sequence of codepoints are withing the other string without considering graphem...
python
def contains(string, substring): """ Returns true if the sequence of graphemes in substring is also present in string. This differs from the normal python `in` operator, since the python operator will return true if the sequence of codepoints are withing the other string without considering graphem...
[ "def", "contains", "(", "string", ",", "substring", ")", ":", "if", "substring", "not", "in", "string", ":", "return", "False", "substr_graphemes", "=", "list", "(", "graphemes", "(", "substring", ")", ")", "if", "len", "(", "substr_graphemes", ")", "==", ...
Returns true if the sequence of graphemes in substring is also present in string. This differs from the normal python `in` operator, since the python operator will return true if the sequence of codepoints are withing the other string without considering grapheme boundaries. Performance notes: Very fa...
[ "Returns", "true", "if", "the", "sequence", "of", "graphemes", "in", "substring", "is", "also", "present", "in", "string", "." ]
45cd9b8326ddf96d2618406724a7ebf273cbde03
https://github.com/alvinlindstam/grapheme/blob/45cd9b8326ddf96d2618406724a7ebf273cbde03/grapheme/api.py#L105-L147
train
alvinlindstam/grapheme
grapheme/api.py
startswith
def startswith(string, prefix): """ Like str.startswith, but also checks that the string starts with the given prefixes sequence of graphemes. str.startswith may return true for a prefix that is not visually represented as a prefix if a grapheme cluster is continued after the prefix ends. >>> grap...
python
def startswith(string, prefix): """ Like str.startswith, but also checks that the string starts with the given prefixes sequence of graphemes. str.startswith may return true for a prefix that is not visually represented as a prefix if a grapheme cluster is continued after the prefix ends. >>> grap...
[ "def", "startswith", "(", "string", ",", "prefix", ")", ":", "return", "string", ".", "startswith", "(", "prefix", ")", "and", "safe_split_index", "(", "string", ",", "len", "(", "prefix", ")", ")", "==", "len", "(", "prefix", ")" ]
Like str.startswith, but also checks that the string starts with the given prefixes sequence of graphemes. str.startswith may return true for a prefix that is not visually represented as a prefix if a grapheme cluster is continued after the prefix ends. >>> grapheme.startswith("✊🏾", "✊") False >>...
[ "Like", "str", ".", "startswith", "but", "also", "checks", "that", "the", "string", "starts", "with", "the", "given", "prefixes", "sequence", "of", "graphemes", "." ]
45cd9b8326ddf96d2618406724a7ebf273cbde03
https://github.com/alvinlindstam/grapheme/blob/45cd9b8326ddf96d2618406724a7ebf273cbde03/grapheme/api.py#L150-L162
train
alvinlindstam/grapheme
grapheme/api.py
endswith
def endswith(string, suffix): """ Like str.endswith, but also checks that the string ends with the given prefixes sequence of graphemes. str.endswith may return true for a suffix that is not visually represented as a suffix if a grapheme cluster is initiated before the suffix starts. >>> grapheme....
python
def endswith(string, suffix): """ Like str.endswith, but also checks that the string ends with the given prefixes sequence of graphemes. str.endswith may return true for a suffix that is not visually represented as a suffix if a grapheme cluster is initiated before the suffix starts. >>> grapheme....
[ "def", "endswith", "(", "string", ",", "suffix", ")", ":", "expected_index", "=", "len", "(", "string", ")", "-", "len", "(", "suffix", ")", "return", "string", ".", "endswith", "(", "suffix", ")", "and", "safe_split_index", "(", "string", ",", "expected...
Like str.endswith, but also checks that the string ends with the given prefixes sequence of graphemes. str.endswith may return true for a suffix that is not visually represented as a suffix if a grapheme cluster is initiated before the suffix starts. >>> grapheme.endswith("🏳️‍🌈", "🌈") False >>>...
[ "Like", "str", ".", "endswith", "but", "also", "checks", "that", "the", "string", "ends", "with", "the", "given", "prefixes", "sequence", "of", "graphemes", "." ]
45cd9b8326ddf96d2618406724a7ebf273cbde03
https://github.com/alvinlindstam/grapheme/blob/45cd9b8326ddf96d2618406724a7ebf273cbde03/grapheme/api.py#L165-L178
train
alvinlindstam/grapheme
grapheme/api.py
safe_split_index
def safe_split_index(string, max_len): """ Returns the highest index up to `max_len` at which the given string can be sliced, without breaking a grapheme. This is useful for when you want to split or take a substring from a string, and don't really care about the exact grapheme length, but don't want t...
python
def safe_split_index(string, max_len): """ Returns the highest index up to `max_len` at which the given string can be sliced, without breaking a grapheme. This is useful for when you want to split or take a substring from a string, and don't really care about the exact grapheme length, but don't want t...
[ "def", "safe_split_index", "(", "string", ",", "max_len", ")", ":", "last_index", "=", "get_last_certain_break_index", "(", "string", ",", "max_len", ")", "for", "l", "in", "grapheme_lengths", "(", "string", "[", "last_index", ":", "]", ")", ":", "if", "last...
Returns the highest index up to `max_len` at which the given string can be sliced, without breaking a grapheme. This is useful for when you want to split or take a substring from a string, and don't really care about the exact grapheme length, but don't want to risk breaking existing graphemes. This funct...
[ "Returns", "the", "highest", "index", "up", "to", "max_len", "at", "which", "the", "given", "string", "can", "be", "sliced", "without", "breaking", "a", "grapheme", "." ]
45cd9b8326ddf96d2618406724a7ebf273cbde03
https://github.com/alvinlindstam/grapheme/blob/45cd9b8326ddf96d2618406724a7ebf273cbde03/grapheme/api.py#L181-L209
train
awacha/sastool
sastool/io/header.py
readB1logfile
def readB1logfile(filename): """Read B1 logfile (*.log) Inputs: filename: the file name Output: A dictionary. """ dic = dict() # try to open. If this fails, an exception is raised with open(filename, 'rt', encoding='utf-8') as f: for l in f: l = l.strip() ...
python
def readB1logfile(filename): """Read B1 logfile (*.log) Inputs: filename: the file name Output: A dictionary. """ dic = dict() # try to open. If this fails, an exception is raised with open(filename, 'rt', encoding='utf-8') as f: for l in f: l = l.strip() ...
[ "def", "readB1logfile", "(", "filename", ")", ":", "dic", "=", "dict", "(", ")", "# try to open. If this fails, an exception is raised", "with", "open", "(", "filename", ",", "'rt'", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "for", "l", "in", "f"...
Read B1 logfile (*.log) Inputs: filename: the file name Output: A dictionary.
[ "Read", "B1", "logfile", "(", "*", ".", "log", ")" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/header.py#L142-L203
train
awacha/sastool
sastool/io/header.py
writeB1logfile
def writeB1logfile(filename, data): """Write a header structure into a B1 logfile. Inputs: filename: name of the file. data: header dictionary Notes: exceptions pass through to the caller. """ allkeys = list(data.keys()) f = open(filename, 'wt', encoding='utf-8') fo...
python
def writeB1logfile(filename, data): """Write a header structure into a B1 logfile. Inputs: filename: name of the file. data: header dictionary Notes: exceptions pass through to the caller. """ allkeys = list(data.keys()) f = open(filename, 'wt', encoding='utf-8') fo...
[ "def", "writeB1logfile", "(", "filename", ",", "data", ")", ":", "allkeys", "=", "list", "(", "data", ".", "keys", "(", ")", ")", "f", "=", "open", "(", "filename", ",", "'wt'", ",", "encoding", "=", "'utf-8'", ")", "for", "ld", "in", "_logfile_data"...
Write a header structure into a B1 logfile. Inputs: filename: name of the file. data: header dictionary Notes: exceptions pass through to the caller.
[ "Write", "a", "header", "structure", "into", "a", "B1", "logfile", "." ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/header.py#L206-L275
train
awacha/sastool
sastool/io/header.py
readB1header
def readB1header(filename): """Read beamline B1 (HASYLAB, Hamburg) header data Input ----- filename: string the file name. If ends with ``.gz``, it is fed through a ``gunzip`` filter Output ------ A header dictionary. Examples -------- read header data from 'OR...
python
def readB1header(filename): """Read beamline B1 (HASYLAB, Hamburg) header data Input ----- filename: string the file name. If ends with ``.gz``, it is fed through a ``gunzip`` filter Output ------ A header dictionary. Examples -------- read header data from 'OR...
[ "def", "readB1header", "(", "filename", ")", ":", "# Planck's constant times speed of light: incorrect", "# constant in the old program on hasjusi1, which was", "# taken over by the measurement program, to keep", "# compatibility with that.", "hed", "=", "{", "}", "if", "libconfig", ...
Read beamline B1 (HASYLAB, Hamburg) header data Input ----- filename: string the file name. If ends with ``.gz``, it is fed through a ``gunzip`` filter Output ------ A header dictionary. Examples -------- read header data from 'ORG000123.DAT':: header=read...
[ "Read", "beamline", "B1", "(", "HASYLAB", "Hamburg", ")", "header", "data" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/header.py#L278-L369
train
awacha/sastool
sastool/io/header.py
_readedf_extractline
def _readedf_extractline(left, right): """Helper function to interpret lines in an EDF file header. """ functions = [int, float, lambda l:float(l.split(None, 1)[0]), lambda l:int(l.split(None, 1)[0]), dateutil.parser.parse, lambda x:str(x)] for f in functions: t...
python
def _readedf_extractline(left, right): """Helper function to interpret lines in an EDF file header. """ functions = [int, float, lambda l:float(l.split(None, 1)[0]), lambda l:int(l.split(None, 1)[0]), dateutil.parser.parse, lambda x:str(x)] for f in functions: t...
[ "def", "_readedf_extractline", "(", "left", ",", "right", ")", ":", "functions", "=", "[", "int", ",", "float", ",", "lambda", "l", ":", "float", "(", "l", ".", "split", "(", "None", ",", "1", ")", "[", "0", "]", ")", ",", "lambda", "l", ":", "...
Helper function to interpret lines in an EDF file header.
[ "Helper", "function", "to", "interpret", "lines", "in", "an", "EDF", "file", "header", "." ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/header.py#L372-L384
train
awacha/sastool
sastool/io/header.py
readehf
def readehf(filename): """Read EDF header (ESRF data format, as of beamline ID01 and ID02) Input ----- filename: string the file name to load Output ------ the EDF header structure in a dictionary """ f = open(filename, 'r') edf = {} if not f.readline().strip().star...
python
def readehf(filename): """Read EDF header (ESRF data format, as of beamline ID01 and ID02) Input ----- filename: string the file name to load Output ------ the EDF header structure in a dictionary """ f = open(filename, 'r') edf = {} if not f.readline().strip().star...
[ "def", "readehf", "(", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "'r'", ")", "edf", "=", "{", "}", "if", "not", "f", ".", "readline", "(", ")", ".", "strip", "(", ")", ".", "startswith", "(", "'{'", ")", ":", "raise", "Value...
Read EDF header (ESRF data format, as of beamline ID01 and ID02) Input ----- filename: string the file name to load Output ------ the EDF header structure in a dictionary
[ "Read", "EDF", "header", "(", "ESRF", "data", "format", "as", "of", "beamline", "ID01", "and", "ID02", ")" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/header.py#L387-L428
train
awacha/sastool
sastool/io/header.py
readbhfv1
def readbhfv1(filename, load_data=False, bdfext='.bdf', bhfext='.bhf'): """Read header data from bdf/bhf file (Bessy Data Format v1) Input: filename: the name of the file load_data: if the matrices are to be loaded Output: bdf: the BDF header structure Adapted the bdf_read.m m...
python
def readbhfv1(filename, load_data=False, bdfext='.bdf', bhfext='.bhf'): """Read header data from bdf/bhf file (Bessy Data Format v1) Input: filename: the name of the file load_data: if the matrices are to be loaded Output: bdf: the BDF header structure Adapted the bdf_read.m m...
[ "def", "readbhfv1", "(", "filename", ",", "load_data", "=", "False", ",", "bdfext", "=", "'.bdf'", ",", "bhfext", "=", "'.bhf'", ")", ":", "# strip the bhf or bdf extension if there.", "if", "filename", ".", "endswith", "(", "bdfext", ")", ":", "basename", "="...
Read header data from bdf/bhf file (Bessy Data Format v1) Input: filename: the name of the file load_data: if the matrices are to be loaded Output: bdf: the BDF header structure Adapted the bdf_read.m macro from Sylvio Haas.
[ "Read", "header", "data", "from", "bdf", "/", "bhf", "file", "(", "Bessy", "Data", "Format", "v1", ")" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/header.py#L545-L678
train
awacha/sastool
sastool/io/header.py
readmarheader
def readmarheader(filename): """Read a header from a MarResearch .image file.""" with open(filename, 'rb') as f: intheader = np.fromstring(f.read(10 * 4), np.int32) floatheader = np.fromstring(f.read(15 * 4), '<f4') strheader = f.read(24) f.read(4) otherstrings = [f.read(...
python
def readmarheader(filename): """Read a header from a MarResearch .image file.""" with open(filename, 'rb') as f: intheader = np.fromstring(f.read(10 * 4), np.int32) floatheader = np.fromstring(f.read(15 * 4), '<f4') strheader = f.read(24) f.read(4) otherstrings = [f.read(...
[ "def", "readmarheader", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "f", ":", "intheader", "=", "np", ".", "fromstring", "(", "f", ".", "read", "(", "10", "*", "4", ")", ",", "np", ".", "int32", ")", "float...
Read a header from a MarResearch .image file.
[ "Read", "a", "header", "from", "a", "MarResearch", ".", "image", "file", "." ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/header.py#L745-L760
train
awacha/sastool
sastool/io/header.py
readBerSANS
def readBerSANS(filename): """Read a header from a SANS file (produced usually by BerSANS)""" hed = {'Comment': ''} translate = {'Lambda': 'Wavelength', 'Title': 'Owner', 'SampleName': 'Title', 'BeamcenterX': 'BeamPosY', 'BeamcenterY': 'Bea...
python
def readBerSANS(filename): """Read a header from a SANS file (produced usually by BerSANS)""" hed = {'Comment': ''} translate = {'Lambda': 'Wavelength', 'Title': 'Owner', 'SampleName': 'Title', 'BeamcenterX': 'BeamPosY', 'BeamcenterY': 'Bea...
[ "def", "readBerSANS", "(", "filename", ")", ":", "hed", "=", "{", "'Comment'", ":", "''", "}", "translate", "=", "{", "'Lambda'", ":", "'Wavelength'", ",", "'Title'", ":", "'Owner'", ",", "'SampleName'", ":", "'Title'", ",", "'BeamcenterX'", ":", "'BeamPos...
Read a header from a SANS file (produced usually by BerSANS)
[ "Read", "a", "header", "from", "a", "SANS", "file", "(", "produced", "usually", "by", "BerSANS", ")" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/header.py#L763-L817
train
awacha/sastool
sastool/fitting/fitfunctions/basic.py
Sine
def Sine(x, a, omega, phi, y0): """Sine function Inputs: ------- ``x``: independent variable ``a``: amplitude ``omega``: circular frequency ``phi``: phase ``y0``: offset Formula: -------- ``a*sin(x*omega + phi)+y0`` """ return a * np.sin(x * ...
python
def Sine(x, a, omega, phi, y0): """Sine function Inputs: ------- ``x``: independent variable ``a``: amplitude ``omega``: circular frequency ``phi``: phase ``y0``: offset Formula: -------- ``a*sin(x*omega + phi)+y0`` """ return a * np.sin(x * ...
[ "def", "Sine", "(", "x", ",", "a", ",", "omega", ",", "phi", ",", "y0", ")", ":", "return", "a", "*", "np", ".", "sin", "(", "x", "*", "omega", "+", "phi", ")", "+", "y0" ]
Sine function Inputs: ------- ``x``: independent variable ``a``: amplitude ``omega``: circular frequency ``phi``: phase ``y0``: offset Formula: -------- ``a*sin(x*omega + phi)+y0``
[ "Sine", "function" ]
deaddfa3002f3f6818697e36139633b7e30427a3
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/basic.py#L23-L38
train