partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | read_fakelc | This just reads a pickled fake LC.
Parameters
----------
fakelcfile : str
The fake LC file to read.
Returns
-------
dict
This returns an lcdict. | astrobase/fakelcs/recovery.py | def read_fakelc(fakelcfile):
'''
This just reads a pickled fake LC.
Parameters
----------
fakelcfile : str
The fake LC file to read.
Returns
-------
dict
This returns an lcdict.
'''
try:
with open(fakelcfile,'rb') as infd:
lcdict = pickle... | def read_fakelc(fakelcfile):
'''
This just reads a pickled fake LC.
Parameters
----------
fakelcfile : str
The fake LC file to read.
Returns
-------
dict
This returns an lcdict.
'''
try:
with open(fakelcfile,'rb') as infd:
lcdict = pickle... | [
"This",
"just",
"reads",
"a",
"pickled",
"fake",
"LC",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L84-L109 | [
"def",
"read_fakelc",
"(",
"fakelcfile",
")",
":",
"try",
":",
"with",
"open",
"(",
"fakelcfile",
",",
"'rb'",
")",
"as",
"infd",
":",
"lcdict",
"=",
"pickle",
".",
"load",
"(",
"infd",
")",
"except",
"UnicodeDecodeError",
":",
"with",
"open",
"(",
"fa... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | get_varfeatures | This runs `lcproc.lcvfeatures.parallel_varfeatures` on fake LCs in
`simbasedir`.
Parameters
----------
simbasedir : str
The directory containing the fake LCs to process.
mindet : int
The minimum number of detections needed to accept an LC and process it.
nworkers : int or Non... | astrobase/fakelcs/recovery.py | def get_varfeatures(simbasedir,
mindet=1000,
nworkers=None):
'''This runs `lcproc.lcvfeatures.parallel_varfeatures` on fake LCs in
`simbasedir`.
Parameters
----------
simbasedir : str
The directory containing the fake LCs to process.
mindet : in... | def get_varfeatures(simbasedir,
mindet=1000,
nworkers=None):
'''This runs `lcproc.lcvfeatures.parallel_varfeatures` on fake LCs in
`simbasedir`.
Parameters
----------
simbasedir : str
The directory containing the fake LCs to process.
mindet : in... | [
"This",
"runs",
"lcproc",
".",
"lcvfeatures",
".",
"parallel_varfeatures",
"on",
"fake",
"LCs",
"in",
"simbasedir",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L117-L186 | [
"def",
"get_varfeatures",
"(",
"simbasedir",
",",
"mindet",
"=",
"1000",
",",
"nworkers",
"=",
"None",
")",
":",
"# get the info from the simbasedir",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"simbasedir",
",",
"'fakelcs-info.pkl'",
")",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | precision | This calculates precision.
https://en.wikipedia.org/wiki/Precision_and_recall
Parameters
----------
ntp : int
The number of true positives.
nfp : int
The number of false positives.
Returns
-------
float
The precision calculated using `ntp/(ntp + nfp)`. | astrobase/fakelcs/recovery.py | def precision(ntp, nfp):
'''
This calculates precision.
https://en.wikipedia.org/wiki/Precision_and_recall
Parameters
----------
ntp : int
The number of true positives.
nfp : int
The number of false positives.
Returns
-------
float
The precision calc... | def precision(ntp, nfp):
'''
This calculates precision.
https://en.wikipedia.org/wiki/Precision_and_recall
Parameters
----------
ntp : int
The number of true positives.
nfp : int
The number of false positives.
Returns
-------
float
The precision calc... | [
"This",
"calculates",
"precision",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L190-L216 | [
"def",
"precision",
"(",
"ntp",
",",
"nfp",
")",
":",
"if",
"(",
"ntp",
"+",
"nfp",
")",
">",
"0",
":",
"return",
"ntp",
"/",
"(",
"ntp",
"+",
"nfp",
")",
"else",
":",
"return",
"np",
".",
"nan"
] | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | recall | This calculates recall.
https://en.wikipedia.org/wiki/Precision_and_recall
Parameters
----------
ntp : int
The number of true positives.
nfn : int
The number of false negatives.
Returns
-------
float
The precision calculated using `ntp/(ntp + nfn)`. | astrobase/fakelcs/recovery.py | def recall(ntp, nfn):
'''
This calculates recall.
https://en.wikipedia.org/wiki/Precision_and_recall
Parameters
----------
ntp : int
The number of true positives.
nfn : int
The number of false negatives.
Returns
-------
float
The precision calculated... | def recall(ntp, nfn):
'''
This calculates recall.
https://en.wikipedia.org/wiki/Precision_and_recall
Parameters
----------
ntp : int
The number of true positives.
nfn : int
The number of false negatives.
Returns
-------
float
The precision calculated... | [
"This",
"calculates",
"recall",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L220-L246 | [
"def",
"recall",
"(",
"ntp",
",",
"nfn",
")",
":",
"if",
"(",
"ntp",
"+",
"nfn",
")",
">",
"0",
":",
"return",
"ntp",
"/",
"(",
"ntp",
"+",
"nfn",
")",
"else",
":",
"return",
"np",
".",
"nan"
] | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | matthews_correl_coeff | This calculates the Matthews correlation coefficent.
https://en.wikipedia.org/wiki/Matthews_correlation_coefficient
Parameters
----------
ntp : int
The number of true positives.
ntn : int
The number of true negatives
nfp : int
The number of false positives.
nfn ... | astrobase/fakelcs/recovery.py | def matthews_correl_coeff(ntp, ntn, nfp, nfn):
'''
This calculates the Matthews correlation coefficent.
https://en.wikipedia.org/wiki/Matthews_correlation_coefficient
Parameters
----------
ntp : int
The number of true positives.
ntn : int
The number of true negatives
... | def matthews_correl_coeff(ntp, ntn, nfp, nfn):
'''
This calculates the Matthews correlation coefficent.
https://en.wikipedia.org/wiki/Matthews_correlation_coefficient
Parameters
----------
ntp : int
The number of true positives.
ntn : int
The number of true negatives
... | [
"This",
"calculates",
"the",
"Matthews",
"correlation",
"coefficent",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L250-L285 | [
"def",
"matthews_correl_coeff",
"(",
"ntp",
",",
"ntn",
",",
"nfp",
",",
"nfn",
")",
":",
"mcc_top",
"=",
"(",
"ntp",
"*",
"ntn",
"-",
"nfp",
"*",
"nfn",
")",
"mcc_bot",
"=",
"msqrt",
"(",
"(",
"ntp",
"+",
"nfp",
")",
"*",
"(",
"ntp",
"+",
"nfn... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | get_recovered_variables_for_magbin | This runs variability selection for the given magbinmedian.
To generate a full recovery matrix over all magnitude bins, run this
function for each magbin over the specified stetson_stdev_min and
inveta_stdev_min grid.
Parameters
----------
simbasedir : str
The input directory of fake ... | astrobase/fakelcs/recovery.py | def get_recovered_variables_for_magbin(simbasedir,
magbinmedian,
stetson_stdev_min=2.0,
inveta_stdev_min=2.0,
iqr_stdev_min=2.0,
... | def get_recovered_variables_for_magbin(simbasedir,
magbinmedian,
stetson_stdev_min=2.0,
inveta_stdev_min=2.0,
iqr_stdev_min=2.0,
... | [
"This",
"runs",
"variability",
"selection",
"for",
"the",
"given",
"magbinmedian",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L293-L657 | [
"def",
"get_recovered_variables_for_magbin",
"(",
"simbasedir",
",",
"magbinmedian",
",",
"stetson_stdev_min",
"=",
"2.0",
",",
"inveta_stdev_min",
"=",
"2.0",
",",
"iqr_stdev_min",
"=",
"2.0",
",",
"statsonly",
"=",
"True",
")",
":",
"# get the info from the simbased... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | magbin_varind_gridsearch_worker | This is a parallel grid search worker for the function below. | astrobase/fakelcs/recovery.py | def magbin_varind_gridsearch_worker(task):
'''
This is a parallel grid search worker for the function below.
'''
simbasedir, gridpoint, magbinmedian = task
try:
res = get_recovered_variables_for_magbin(simbasedir,
magbinmedian,
... | def magbin_varind_gridsearch_worker(task):
'''
This is a parallel grid search worker for the function below.
'''
simbasedir, gridpoint, magbinmedian = task
try:
res = get_recovered_variables_for_magbin(simbasedir,
magbinmedian,
... | [
"This",
"is",
"a",
"parallel",
"grid",
"search",
"worker",
"for",
"the",
"function",
"below",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L661-L679 | [
"def",
"magbin_varind_gridsearch_worker",
"(",
"task",
")",
":",
"simbasedir",
",",
"gridpoint",
",",
"magbinmedian",
"=",
"task",
"try",
":",
"res",
"=",
"get_recovered_variables_for_magbin",
"(",
"simbasedir",
",",
"magbinmedian",
",",
"stetson_stdev_min",
"=",
"g... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | variable_index_gridsearch_magbin | This runs a variable index grid search per magbin.
For each magbin, this does a grid search using the stetson and inveta ranges
provided and tries to optimize the Matthews Correlation Coefficient (best
value is +1.0), indicating the best possible separation of variables
vs. nonvariables. The thresholds... | astrobase/fakelcs/recovery.py | def variable_index_gridsearch_magbin(simbasedir,
stetson_stdev_range=(1.0,20.0),
inveta_stdev_range=(1.0,20.0),
iqr_stdev_range=(1.0,20.0),
ngridpoints=32,
... | def variable_index_gridsearch_magbin(simbasedir,
stetson_stdev_range=(1.0,20.0),
inveta_stdev_range=(1.0,20.0),
iqr_stdev_range=(1.0,20.0),
ngridpoints=32,
... | [
"This",
"runs",
"a",
"variable",
"index",
"grid",
"search",
"per",
"magbin",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L683-L831 | [
"def",
"variable_index_gridsearch_magbin",
"(",
"simbasedir",
",",
"stetson_stdev_range",
"=",
"(",
"1.0",
",",
"20.0",
")",
",",
"inveta_stdev_range",
"=",
"(",
"1.0",
",",
"20.0",
")",
",",
"iqr_stdev_range",
"=",
"(",
"1.0",
",",
"20.0",
")",
",",
"ngridp... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | plot_varind_gridsearch_magbin_results | This plots the gridsearch results from `variable_index_gridsearch_magbin`.
Parameters
----------
gridsearch_results : dict
This is the dict produced by `variable_index_gridsearch_magbin` above.
Returns
-------
dict
The returned dict contains filenames of the recovery rate plo... | astrobase/fakelcs/recovery.py | def plot_varind_gridsearch_magbin_results(gridsearch_results):
'''This plots the gridsearch results from `variable_index_gridsearch_magbin`.
Parameters
----------
gridsearch_results : dict
This is the dict produced by `variable_index_gridsearch_magbin` above.
Returns
-------
dict... | def plot_varind_gridsearch_magbin_results(gridsearch_results):
'''This plots the gridsearch results from `variable_index_gridsearch_magbin`.
Parameters
----------
gridsearch_results : dict
This is the dict produced by `variable_index_gridsearch_magbin` above.
Returns
-------
dict... | [
"This",
"plots",
"the",
"gridsearch",
"results",
"from",
"variable_index_gridsearch_magbin",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L835-L1430 | [
"def",
"plot_varind_gridsearch_magbin_results",
"(",
"gridsearch_results",
")",
":",
"# get the result pickle/dict",
"if",
"(",
"isinstance",
"(",
"gridsearch_results",
",",
"str",
")",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"gridsearch_results",
")",
")",
":... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | run_periodfinding | This runs periodfinding using several period-finders on a collection of
fake LCs.
As a rough benchmark, 25000 fake LCs with 10000--50000 points per LC take
about 26 days in total to run on an invocation of this function using
GLS+PDM+BLS and 10 periodworkers and 4 controlworkers (so all 40 'cores') on
... | astrobase/fakelcs/recovery.py | def run_periodfinding(simbasedir,
pfmethods=('gls','pdm','bls'),
pfkwargs=({},{},{'startp':1.0,'maxtransitduration':0.3}),
getblssnr=False,
sigclip=5.0,
nperiodworkers=10,
ncontrolworkers=... | def run_periodfinding(simbasedir,
pfmethods=('gls','pdm','bls'),
pfkwargs=({},{},{'startp':1.0,'maxtransitduration':0.3}),
getblssnr=False,
sigclip=5.0,
nperiodworkers=10,
ncontrolworkers=... | [
"This",
"runs",
"periodfinding",
"using",
"several",
"period",
"-",
"finders",
"on",
"a",
"collection",
"of",
"fake",
"LCs",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L1454-L1574 | [
"def",
"run_periodfinding",
"(",
"simbasedir",
",",
"pfmethods",
"=",
"(",
"'gls'",
",",
"'pdm'",
",",
"'bls'",
")",
",",
"pfkwargs",
"=",
"(",
"{",
"}",
",",
"{",
"}",
",",
"{",
"'startp'",
":",
"1.0",
",",
"'maxtransitduration'",
":",
"0.3",
"}",
"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | check_periodrec_alias | This determines what kind of aliasing (if any) exists between
`recoveredperiod` and `actualperiod`.
Parameters
----------
actualperiod : float
The actual period of the object.
recoveredperiod : float
The recovered period of the object.
tolerance : float
The absolute d... | astrobase/fakelcs/recovery.py | def check_periodrec_alias(actualperiod,
recoveredperiod,
tolerance=1.0e-3):
'''This determines what kind of aliasing (if any) exists between
`recoveredperiod` and `actualperiod`.
Parameters
----------
actualperiod : float
The actual perio... | def check_periodrec_alias(actualperiod,
recoveredperiod,
tolerance=1.0e-3):
'''This determines what kind of aliasing (if any) exists between
`recoveredperiod` and `actualperiod`.
Parameters
----------
actualperiod : float
The actual perio... | [
"This",
"determines",
"what",
"kind",
"of",
"aliasing",
"(",
"if",
"any",
")",
"exists",
"between",
"recoveredperiod",
"and",
"actualperiod",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L1578-L1675 | [
"def",
"check_periodrec_alias",
"(",
"actualperiod",
",",
"recoveredperiod",
",",
"tolerance",
"=",
"1.0e-3",
")",
":",
"if",
"not",
"(",
"np",
".",
"isfinite",
"(",
"actualperiod",
")",
"and",
"np",
".",
"isfinite",
"(",
"recoveredperiod",
")",
")",
":",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | periodicvar_recovery | Recovers the periodic variable status/info for the simulated PF result.
- Uses simbasedir and the lcfbasename stored in fakepfpkl to figure out
where the LC for this object is.
- Gets the actual_varparams, actual_varperiod, actual_vartype,
actual_varamplitude elements from the LC.
- Figures out... | astrobase/fakelcs/recovery.py | def periodicvar_recovery(fakepfpkl,
simbasedir,
period_tolerance=1.0e-3):
'''Recovers the periodic variable status/info for the simulated PF result.
- Uses simbasedir and the lcfbasename stored in fakepfpkl to figure out
where the LC for this object is.
... | def periodicvar_recovery(fakepfpkl,
simbasedir,
period_tolerance=1.0e-3):
'''Recovers the periodic variable status/info for the simulated PF result.
- Uses simbasedir and the lcfbasename stored in fakepfpkl to figure out
where the LC for this object is.
... | [
"Recovers",
"the",
"periodic",
"variable",
"status",
"/",
"info",
"for",
"the",
"simulated",
"PF",
"result",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L1679-L1911 | [
"def",
"periodicvar_recovery",
"(",
"fakepfpkl",
",",
"simbasedir",
",",
"period_tolerance",
"=",
"1.0e-3",
")",
":",
"if",
"fakepfpkl",
".",
"endswith",
"(",
"'.gz'",
")",
":",
"infd",
"=",
"gzip",
".",
"open",
"(",
"fakepfpkl",
",",
"'rb'",
")",
"else",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | periodrec_worker | This is a parallel worker for running period-recovery.
Parameters
----------
task : tuple
This is used to pass args to the `periodicvar_recovery` function::
task[0] = period-finding result pickle to work on
task[1] = simbasedir
task[2] = period_tolerance
R... | astrobase/fakelcs/recovery.py | def periodrec_worker(task):
'''This is a parallel worker for running period-recovery.
Parameters
----------
task : tuple
This is used to pass args to the `periodicvar_recovery` function::
task[0] = period-finding result pickle to work on
task[1] = simbasedir
... | def periodrec_worker(task):
'''This is a parallel worker for running period-recovery.
Parameters
----------
task : tuple
This is used to pass args to the `periodicvar_recovery` function::
task[0] = period-finding result pickle to work on
task[1] = simbasedir
... | [
"This",
"is",
"a",
"parallel",
"worker",
"for",
"running",
"period",
"-",
"recovery",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L1915-L1946 | [
"def",
"periodrec_worker",
"(",
"task",
")",
":",
"pfpkl",
",",
"simbasedir",
",",
"period_tolerance",
"=",
"task",
"try",
":",
"return",
"periodicvar_recovery",
"(",
"pfpkl",
",",
"simbasedir",
",",
"period_tolerance",
"=",
"period_tolerance",
")",
"except",
"E... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | parallel_periodicvar_recovery | This is a parallel driver for `periodicvar_recovery`.
Parameters
----------
simbasedir : str
The base directory where all of the fake LCs and period-finding results
are.
period_tolerance : float
The maximum difference that this function will consider between an
actual ... | astrobase/fakelcs/recovery.py | def parallel_periodicvar_recovery(simbasedir,
period_tolerance=1.0e-3,
liststartind=None,
listmaxobjects=None,
nworkers=None):
'''This is a parallel driver for `periodicvar_recover... | def parallel_periodicvar_recovery(simbasedir,
period_tolerance=1.0e-3,
liststartind=None,
listmaxobjects=None,
nworkers=None):
'''This is a parallel driver for `periodicvar_recover... | [
"This",
"is",
"a",
"parallel",
"driver",
"for",
"periodicvar_recovery",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L1950-L2064 | [
"def",
"parallel_periodicvar_recovery",
"(",
"simbasedir",
",",
"period_tolerance",
"=",
"1.0e-3",
",",
"liststartind",
"=",
"None",
",",
"listmaxobjects",
"=",
"None",
",",
"nworkers",
"=",
"None",
")",
":",
"# figure out the periodfinding pickles directory",
"pfpkldir... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | plot_periodicvar_recovery_results | This plots the results of periodic var recovery.
This function makes plots for periodicvar recovered fraction as a function
of:
- magbin
- periodbin
- amplitude of variability
- ndet
with plot lines broken down by:
- magcol
- periodfinder
- vartype
- recovery status
... | astrobase/fakelcs/recovery.py | def plot_periodicvar_recovery_results(
precvar_results,
aliases_count_as_recovered=None,
magbins=None,
periodbins=None,
amplitudebins=None,
ndetbins=None,
minbinsize=1,
plotfile_ext='png',
):
'''This plots the results of periodic var recovery.
Thi... | def plot_periodicvar_recovery_results(
precvar_results,
aliases_count_as_recovered=None,
magbins=None,
periodbins=None,
amplitudebins=None,
ndetbins=None,
minbinsize=1,
plotfile_ext='png',
):
'''This plots the results of periodic var recovery.
Thi... | [
"This",
"plots",
"the",
"results",
"of",
"periodic",
"var",
"recovery",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/fakelcs/recovery.py#L2073-L3700 | [
"def",
"plot_periodicvar_recovery_results",
"(",
"precvar_results",
",",
"aliases_count_as_recovered",
"=",
"None",
",",
"magbins",
"=",
"None",
",",
"periodbins",
"=",
"None",
",",
"amplitudebins",
"=",
"None",
",",
"ndetbins",
"=",
"None",
",",
"minbinsize",
"="... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | mast_query | This queries the STScI MAST service for catalog data.
All results are downloaded as JSON files that are written to `cachedir`.
Parameters
----------
service : str
This is the name of the service to use. See
https://mast.stsci.edu/api/v0/_services.html for a list of all available
... | astrobase/services/mast.py | def mast_query(service,
params,
data=None,
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=10.0,
refresh=5.0,
maxtimeout=90.0,
... | def mast_query(service,
params,
data=None,
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=10.0,
refresh=5.0,
maxtimeout=90.0,
... | [
"This",
"queries",
"the",
"STScI",
"MAST",
"service",
"for",
"catalog",
"data",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/mast.py#L78-L338 | [
"def",
"mast_query",
"(",
"service",
",",
"params",
",",
"data",
"=",
"None",
",",
"apiversion",
"=",
"'v0'",
",",
"forcefetch",
"=",
"False",
",",
"cachedir",
"=",
"'~/.astrobase/mast-cache'",
",",
"verbose",
"=",
"True",
",",
"timeout",
"=",
"10.0",
",",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | tic_conesearch | This runs a TESS Input Catalog cone search on MAST.
If you use this, please cite the TIC paper (Stassun et al 2018;
http://adsabs.harvard.edu/abs/2018AJ....156..102S). Also see the "living"
TESS input catalog docs:
https://docs.google.com/document/d/1zdiKMs4Ld4cXZ2DW4lMX-fuxAF6hPHTjqjIwGqnfjqI
Al... | astrobase/services/mast.py | def tic_conesearch(
ra,
decl,
radius_arcmin=5.0,
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=10.0,
refresh=5.0,
maxtimeout=90.0,
maxtries=3,
jitter=5.0,
raiseonfail=Fa... | def tic_conesearch(
ra,
decl,
radius_arcmin=5.0,
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=10.0,
refresh=5.0,
maxtimeout=90.0,
maxtries=3,
jitter=5.0,
raiseonfail=Fa... | [
"This",
"runs",
"a",
"TESS",
"Input",
"Catalog",
"cone",
"search",
"on",
"MAST",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/mast.py#L342-L448 | [
"def",
"tic_conesearch",
"(",
"ra",
",",
"decl",
",",
"radius_arcmin",
"=",
"5.0",
",",
"apiversion",
"=",
"'v0'",
",",
"forcefetch",
"=",
"False",
",",
"cachedir",
"=",
"'~/.astrobase/mast-cache'",
",",
"verbose",
"=",
"True",
",",
"timeout",
"=",
"10.0",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | tic_xmatch | This does a cross-match with TIC.
Parameters
----------
ra,decl : np.arrays or lists of floats
The coordinates that will be cross-matched against the TIC.
radius_arcsec : float
The cross-match radius in arcseconds.
apiversion : str
The API version of the MAST service to u... | astrobase/services/mast.py | def tic_xmatch(
ra,
decl,
radius_arcsec=5.0,
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=90.0,
refresh=5.0,
maxtimeout=180.0,
maxtries=3,
jitter=5.0,
raiseonfail=False... | def tic_xmatch(
ra,
decl,
radius_arcsec=5.0,
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=90.0,
refresh=5.0,
maxtimeout=180.0,
maxtries=3,
jitter=5.0,
raiseonfail=False... | [
"This",
"does",
"a",
"cross",
"-",
"match",
"with",
"TIC",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/mast.py#L452-L554 | [
"def",
"tic_xmatch",
"(",
"ra",
",",
"decl",
",",
"radius_arcsec",
"=",
"5.0",
",",
"apiversion",
"=",
"'v0'",
",",
"forcefetch",
"=",
"False",
",",
"cachedir",
"=",
"'~/.astrobase/mast-cache'",
",",
"verbose",
"=",
"True",
",",
"timeout",
"=",
"90.0",
","... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | tic_objectsearch | This runs a TIC search for a specified TIC ID.
Parameters
----------
objectid : str
The object ID to look up information for.
idcol_to_use : str
This is the name of the object ID column to use when looking up the
provided `objectid`. This is one of {'ID', 'HIP', 'TYC', 'UCAC',... | astrobase/services/mast.py | def tic_objectsearch(
objectid,
idcol_to_use="ID",
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=90.0,
refresh=5.0,
maxtimeout=180.0,
maxtries=3,
jitter=5.0,
raiseonfail=False
)... | def tic_objectsearch(
objectid,
idcol_to_use="ID",
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=90.0,
refresh=5.0,
maxtimeout=180.0,
maxtries=3,
jitter=5.0,
raiseonfail=False
)... | [
"This",
"runs",
"a",
"TIC",
"search",
"for",
"a",
"specified",
"TIC",
"ID",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/mast.py#L558-L659 | [
"def",
"tic_objectsearch",
"(",
"objectid",
",",
"idcol_to_use",
"=",
"\"ID\"",
",",
"apiversion",
"=",
"'v0'",
",",
"forcefetch",
"=",
"False",
",",
"cachedir",
"=",
"'~/.astrobase/mast-cache'",
",",
"verbose",
"=",
"True",
",",
"timeout",
"=",
"90.0",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | send_email | This sends an email to addresses, informing them about events.
The email account settings are retrieved from the settings file as described
above.
Parameters
----------
sender : str
The name of the sender to use in the email header.
subject : str
Subject of the email.
co... | astrobase/emailutils.py | def send_email(sender,
subject,
content,
email_recipient_list,
email_address_list,
email_user=None,
email_pass=None,
email_server=None):
'''This sends an email to addresses, informing them about events.
The... | def send_email(sender,
subject,
content,
email_recipient_list,
email_address_list,
email_user=None,
email_pass=None,
email_server=None):
'''This sends an email to addresses, informing them about events.
The... | [
"This",
"sends",
"an",
"email",
"to",
"addresses",
"informing",
"them",
"about",
"events",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/emailutils.py#L110-L260 | [
"def",
"send_email",
"(",
"sender",
",",
"subject",
",",
"content",
",",
"email_recipient_list",
",",
"email_address_list",
",",
"email_user",
"=",
"None",
",",
"email_pass",
"=",
"None",
",",
"email_server",
"=",
"None",
")",
":",
"if",
"not",
"email_user",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | fourier_sinusoidal_func | This generates a sinusoidal light curve using a Fourier cosine series.
Parameters
----------
fourierparams : list
This MUST be a list of the following form like so::
[period,
epoch,
[amplitude_1, amplitude_2, amplitude_3, ..., amplitude_X],
[phas... | astrobase/lcmodels/sinusoidal.py | def fourier_sinusoidal_func(fourierparams, times, mags, errs):
'''This generates a sinusoidal light curve using a Fourier cosine series.
Parameters
----------
fourierparams : list
This MUST be a list of the following form like so::
[period,
epoch,
[amplit... | def fourier_sinusoidal_func(fourierparams, times, mags, errs):
'''This generates a sinusoidal light curve using a Fourier cosine series.
Parameters
----------
fourierparams : list
This MUST be a list of the following form like so::
[period,
epoch,
[amplit... | [
"This",
"generates",
"a",
"sinusoidal",
"light",
"curve",
"using",
"a",
"Fourier",
"cosine",
"series",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcmodels/sinusoidal.py#L16-L73 | [
"def",
"fourier_sinusoidal_func",
"(",
"fourierparams",
",",
"times",
",",
"mags",
",",
"errs",
")",
":",
"period",
",",
"epoch",
",",
"famps",
",",
"fphases",
"=",
"fourierparams",
"# figure out the order from the length of the Fourier param list",
"forder",
"=",
"le... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | fourier_sinusoidal_residual | This returns the residual between the model mags and the actual mags.
Parameters
----------
fourierparams : list
This MUST be a list of the following form like so::
[period,
epoch,
[amplitude_1, amplitude_2, amplitude_3, ..., amplitude_X],
[phase... | astrobase/lcmodels/sinusoidal.py | def fourier_sinusoidal_residual(fourierparams, times, mags, errs):
'''
This returns the residual between the model mags and the actual mags.
Parameters
----------
fourierparams : list
This MUST be a list of the following form like so::
[period,
epoch,
... | def fourier_sinusoidal_residual(fourierparams, times, mags, errs):
'''
This returns the residual between the model mags and the actual mags.
Parameters
----------
fourierparams : list
This MUST be a list of the following form like so::
[period,
epoch,
... | [
"This",
"returns",
"the",
"residual",
"between",
"the",
"model",
"mags",
"and",
"the",
"actual",
"mags",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcmodels/sinusoidal.py#L77-L114 | [
"def",
"fourier_sinusoidal_residual",
"(",
"fourierparams",
",",
"times",
",",
"mags",
",",
"errs",
")",
":",
"modelmags",
",",
"phase",
",",
"ptimes",
",",
"pmags",
",",
"perrs",
"=",
"(",
"fourier_sinusoidal_func",
"(",
"fourierparams",
",",
"times",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _make_periodogram | Makes periodogram, objectinfo, and finder tile for `checkplot_png` and
`twolsp_checkplot_png`.
Parameters
----------
axes : matplotlib.axes.Axes object
The Axes object which will contain the plot being made.
lspinfo : dict
Dict containing results from a period-finder in `astrobase... | astrobase/checkplot/png.py | def _make_periodogram(axes,
lspinfo,
objectinfo,
findercmap,
finderconvolve,
verbose=True,
findercachedir='~/.astrobase/stamp-cache'):
'''Makes periodogram, objectinfo, and finder tile... | def _make_periodogram(axes,
lspinfo,
objectinfo,
findercmap,
finderconvolve,
verbose=True,
findercachedir='~/.astrobase/stamp-cache'):
'''Makes periodogram, objectinfo, and finder tile... | [
"Makes",
"periodogram",
"objectinfo",
"and",
"finder",
"tile",
"for",
"checkplot_png",
"and",
"twolsp_checkplot_png",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/png.py#L108-L364 | [
"def",
"_make_periodogram",
"(",
"axes",
",",
"lspinfo",
",",
"objectinfo",
",",
"findercmap",
",",
"finderconvolve",
",",
"verbose",
"=",
"True",
",",
"findercachedir",
"=",
"'~/.astrobase/stamp-cache'",
")",
":",
"# get the appropriate plot ylabel",
"pgramylabel",
"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _make_magseries_plot | Makes the mag-series plot tile for `checkplot_png` and
`twolsp_checkplot_png`.
axes : matplotlib.axes.Axes object
The Axes object where the generated plot will go.
stimes,smags,serrs : np.array
The mag/flux time-series arrays along with associated errors. These
should all have been... | astrobase/checkplot/png.py | def _make_magseries_plot(axes,
stimes,
smags,
serrs,
magsarefluxes=False,
ms=2.0):
'''Makes the mag-series plot tile for `checkplot_png` and
`twolsp_checkplot_png`.
axes : matplotlib... | def _make_magseries_plot(axes,
stimes,
smags,
serrs,
magsarefluxes=False,
ms=2.0):
'''Makes the mag-series plot tile for `checkplot_png` and
`twolsp_checkplot_png`.
axes : matplotlib... | [
"Makes",
"the",
"mag",
"-",
"series",
"plot",
"tile",
"for",
"checkplot_png",
"and",
"twolsp_checkplot_png",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/png.py#L368-L437 | [
"def",
"_make_magseries_plot",
"(",
"axes",
",",
"stimes",
",",
"smags",
",",
"serrs",
",",
"magsarefluxes",
"=",
"False",
",",
"ms",
"=",
"2.0",
")",
":",
"scaledplottime",
"=",
"stimes",
"-",
"npmin",
"(",
"stimes",
")",
"axes",
".",
"plot",
"(",
"sc... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _make_phased_magseries_plot | Makes the phased magseries plot tile for the `checkplot_png` and
`twolsp_checkplot_png` functions.
Parameters
----------
axes : matplotlib.axes.Axes object
The Axes object where the generated plot will be written.
periodind : int
The index of the current best period being processe... | astrobase/checkplot/png.py | def _make_phased_magseries_plot(axes,
periodind,
stimes, smags, serrs,
varperiod, varepoch,
phasewrap, phasesort,
phasebin, minbinelems,
... | def _make_phased_magseries_plot(axes,
periodind,
stimes, smags, serrs,
varperiod, varepoch,
phasewrap, phasesort,
phasebin, minbinelems,
... | [
"Makes",
"the",
"phased",
"magseries",
"plot",
"tile",
"for",
"the",
"checkplot_png",
"and",
"twolsp_checkplot_png",
"functions",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/png.py#L441-L786 | [
"def",
"_make_phased_magseries_plot",
"(",
"axes",
",",
"periodind",
",",
"stimes",
",",
"smags",
",",
"serrs",
",",
"varperiod",
",",
"varepoch",
",",
"phasewrap",
",",
"phasesort",
",",
"phasebin",
",",
"minbinelems",
",",
"plotxlim",
",",
"lspmethod",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | checkplot_png | This makes a checkplot PNG using the output from a period-finder routine.
A checkplot is a 3 x 3 grid of plots like so::
[periodogram + objectinfo] [ unphased LC ] [period 1 phased LC]
[ period 1 phased LC /2 ] [period 1 phased LC x2] [period 2 phased LC]
[ period 3 phased LC ... | astrobase/checkplot/png.py | def checkplot_png(lspinfo,
times,
mags,
errs,
varepoch='min',
magsarefluxes=False,
objectinfo=None,
findercmap='gray_r',
finderconvolve=None,
findercachedir='... | def checkplot_png(lspinfo,
times,
mags,
errs,
varepoch='min',
magsarefluxes=False,
objectinfo=None,
findercmap='gray_r',
finderconvolve=None,
findercachedir='... | [
"This",
"makes",
"a",
"checkplot",
"PNG",
"using",
"the",
"output",
"from",
"a",
"period",
"-",
"finder",
"routine",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/png.py#L794-L1172 | [
"def",
"checkplot_png",
"(",
"lspinfo",
",",
"times",
",",
"mags",
",",
"errs",
",",
"varepoch",
"=",
"'min'",
",",
"magsarefluxes",
"=",
"False",
",",
"objectinfo",
"=",
"None",
",",
"findercmap",
"=",
"'gray_r'",
",",
"finderconvolve",
"=",
"None",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | twolsp_checkplot_png | This makes a checkplot using results from two independent period-finders.
Adapted from Luke Bouma's implementation of a similar function in his
work. This makes a special checkplot that uses two lspinfo dictionaries,
from two independent period-finding methods. For EBs, it's probably best to
use Stelli... | astrobase/checkplot/png.py | def twolsp_checkplot_png(lspinfo1,
lspinfo2,
times,
mags,
errs,
varepoch='min',
magsarefluxes=False,
objectinfo=None,
fi... | def twolsp_checkplot_png(lspinfo1,
lspinfo2,
times,
mags,
errs,
varepoch='min',
magsarefluxes=False,
objectinfo=None,
fi... | [
"This",
"makes",
"a",
"checkplot",
"using",
"results",
"from",
"two",
"independent",
"period",
"-",
"finders",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/png.py#L1176-L1638 | [
"def",
"twolsp_checkplot_png",
"(",
"lspinfo1",
",",
"lspinfo2",
",",
"times",
",",
"mags",
",",
"errs",
",",
"varepoch",
"=",
"'min'",
",",
"magsarefluxes",
"=",
"False",
",",
"objectinfo",
"=",
"None",
",",
"findercmap",
"=",
"'gray_r'",
",",
"finderconvol... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | precess_coordinates | Precesses target coordinates `ra`, `dec` from `epoch_one` to `epoch_two`.
This takes into account the jd of the observations, as well as the proper
motion of the target mu_ra, mu_dec. Adapted from J. D. Hartman's
VARTOOLS/converttime.c [coordprecess].
Parameters
----------
ra,dec : float
... | astrobase/timeutils.py | def precess_coordinates(ra, dec,
epoch_one, epoch_two,
jd=None,
mu_ra=0.0,
mu_dec=0.0,
outscalar=False):
'''Precesses target coordinates `ra`, `dec` from `epoch_one` to `epoch_two`.
This take... | def precess_coordinates(ra, dec,
epoch_one, epoch_two,
jd=None,
mu_ra=0.0,
mu_dec=0.0,
outscalar=False):
'''Precesses target coordinates `ra`, `dec` from `epoch_one` to `epoch_two`.
This take... | [
"Precesses",
"target",
"coordinates",
"ra",
"dec",
"from",
"epoch_one",
"to",
"epoch_two",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/timeutils.py#L137-L257 | [
"def",
"precess_coordinates",
"(",
"ra",
",",
"dec",
",",
"epoch_one",
",",
"epoch_two",
",",
"jd",
"=",
"None",
",",
"mu_ra",
"=",
"0.0",
",",
"mu_dec",
"=",
"0.0",
",",
"outscalar",
"=",
"False",
")",
":",
"raproc",
",",
"decproc",
"=",
"np",
".",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _single_true | This returns True if only one True-ish element exists in `iterable`.
Parameters
----------
iterable : iterable
Returns
-------
bool
True if only one True-ish element exists in `iterable`. False otherwise. | astrobase/timeutils.py | def _single_true(iterable):
'''This returns True if only one True-ish element exists in `iterable`.
Parameters
----------
iterable : iterable
Returns
-------
bool
True if only one True-ish element exists in `iterable`. False otherwise.
'''
# return True if exactly one t... | def _single_true(iterable):
'''This returns True if only one True-ish element exists in `iterable`.
Parameters
----------
iterable : iterable
Returns
-------
bool
True if only one True-ish element exists in `iterable`. False otherwise.
'''
# return True if exactly one t... | [
"This",
"returns",
"True",
"if",
"only",
"one",
"True",
"-",
"ish",
"element",
"exists",
"in",
"iterable",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/timeutils.py#L265-L290 | [
"def",
"_single_true",
"(",
"iterable",
")",
":",
"# return True if exactly one true found",
"iterator",
"=",
"iter",
"(",
"iterable",
")",
"# consume from \"i\" until first true or it's exhausted",
"has_true",
"=",
"any",
"(",
"iterator",
")",
"# carry on consuming until ano... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | get_epochs_given_midtimes_and_period | This calculates the future epochs for a transit, given a period and a
starting epoch
The equation used is::
t_mid = period*epoch + t0
Default behavior if no kwargs are used is to define `t0` as the median
finite time of the passed `t_mid` array.
Only one of `err_t_mid` or `t0_fixed` shou... | astrobase/timeutils.py | def get_epochs_given_midtimes_and_period(
t_mid,
period,
err_t_mid=None,
t0_fixed=None,
t0_percentile=None,
verbose=False
):
'''This calculates the future epochs for a transit, given a period and a
starting epoch
The equation used is::
t_mid = period... | def get_epochs_given_midtimes_and_period(
t_mid,
period,
err_t_mid=None,
t0_fixed=None,
t0_percentile=None,
verbose=False
):
'''This calculates the future epochs for a transit, given a period and a
starting epoch
The equation used is::
t_mid = period... | [
"This",
"calculates",
"the",
"future",
"epochs",
"for",
"a",
"transit",
"given",
"a",
"period",
"and",
"a",
"starting",
"epoch"
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/timeutils.py#L294-L388 | [
"def",
"get_epochs_given_midtimes_and_period",
"(",
"t_mid",
",",
"period",
",",
"err_t_mid",
"=",
"None",
",",
"t0_fixed",
"=",
"None",
",",
"t0_percentile",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"kwargarr",
"=",
"np",
".",
"array",
"(",
"[... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | unixtime_to_jd | This converts UNIX time in seconds to a Julian date in UTC (JD_UTC).
Parameters
----------
unix_time : float
A UNIX time in decimal seconds since the 1970 UNIX epoch.
Returns
-------
jd : float
The Julian date corresponding to the provided UNIX time. | astrobase/timeutils.py | def unixtime_to_jd(unix_time):
'''This converts UNIX time in seconds to a Julian date in UTC (JD_UTC).
Parameters
----------
unix_time : float
A UNIX time in decimal seconds since the 1970 UNIX epoch.
Returns
-------
jd : float
The Julian date corresponding to the provide... | def unixtime_to_jd(unix_time):
'''This converts UNIX time in seconds to a Julian date in UTC (JD_UTC).
Parameters
----------
unix_time : float
A UNIX time in decimal seconds since the 1970 UNIX epoch.
Returns
-------
jd : float
The Julian date corresponding to the provide... | [
"This",
"converts",
"UNIX",
"time",
"in",
"seconds",
"to",
"a",
"Julian",
"date",
"in",
"UTC",
"(",
"JD_UTC",
")",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/timeutils.py#L396-L415 | [
"def",
"unixtime_to_jd",
"(",
"unix_time",
")",
":",
"# use astropy's time module",
"jdutc",
"=",
"astime",
".",
"Time",
"(",
"unix_time",
",",
"format",
"=",
"'unix'",
",",
"scale",
"=",
"'utc'",
")",
"return",
"jdutc",
".",
"jd"
] | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | datetime_to_jd | This converts a Python datetime object (naive, time in UT) to JD_UTC.
Parameters
----------
dt : datetime
A naive Python `datetime` object (e.g. with no tz attribute) measured at
UTC.
Returns
-------
jd : float
The Julian date corresponding to the `datetime` object. | astrobase/timeutils.py | def datetime_to_jd(dt):
'''This converts a Python datetime object (naive, time in UT) to JD_UTC.
Parameters
----------
dt : datetime
A naive Python `datetime` object (e.g. with no tz attribute) measured at
UTC.
Returns
-------
jd : float
The Julian date correspond... | def datetime_to_jd(dt):
'''This converts a Python datetime object (naive, time in UT) to JD_UTC.
Parameters
----------
dt : datetime
A naive Python `datetime` object (e.g. with no tz attribute) measured at
UTC.
Returns
-------
jd : float
The Julian date correspond... | [
"This",
"converts",
"a",
"Python",
"datetime",
"object",
"(",
"naive",
"time",
"in",
"UT",
")",
"to",
"JD_UTC",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/timeutils.py#L419-L438 | [
"def",
"datetime_to_jd",
"(",
"dt",
")",
":",
"jdutc",
"=",
"astime",
".",
"Time",
"(",
"dt",
",",
"format",
"=",
"'datetime'",
",",
"scale",
"=",
"'utc'",
")",
"return",
"jdutc",
".",
"jd"
] | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | jd_to_datetime | This converts a UTC JD to a Python `datetime` object or ISO date string.
Parameters
----------
jd : float
The Julian date measured at UTC.
returniso : bool
If False, returns a naive Python `datetime` object corresponding to
`jd`. If True, returns the ISO format string correspo... | astrobase/timeutils.py | def jd_to_datetime(jd, returniso=False):
'''This converts a UTC JD to a Python `datetime` object or ISO date string.
Parameters
----------
jd : float
The Julian date measured at UTC.
returniso : bool
If False, returns a naive Python `datetime` object corresponding to
`jd`.... | def jd_to_datetime(jd, returniso=False):
'''This converts a UTC JD to a Python `datetime` object or ISO date string.
Parameters
----------
jd : float
The Julian date measured at UTC.
returniso : bool
If False, returns a naive Python `datetime` object corresponding to
`jd`.... | [
"This",
"converts",
"a",
"UTC",
"JD",
"to",
"a",
"Python",
"datetime",
"object",
"or",
"ISO",
"date",
"string",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/timeutils.py#L442-L469 | [
"def",
"jd_to_datetime",
"(",
"jd",
",",
"returniso",
"=",
"False",
")",
":",
"tt",
"=",
"astime",
".",
"Time",
"(",
"jd",
",",
"format",
"=",
"'jd'",
",",
"scale",
"=",
"'utc'",
")",
"if",
"returniso",
":",
"return",
"tt",
".",
"iso",
"else",
":",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | jd_corr | Returns BJD_TDB or HJD_TDB for input JD_UTC.
The equation used is::
BJD_TDB = JD_UTC + JD_to_TDB_corr + romer_delay
where:
- JD_to_TDB_corr is the difference between UTC and TDB JDs
- romer_delay is the delay caused by finite speed of light from Earth-Sun
This is based on the code at:
... | astrobase/timeutils.py | def jd_corr(jd,
ra, dec,
obslon=None,
obslat=None,
obsalt=None,
jd_type='bjd'):
'''Returns BJD_TDB or HJD_TDB for input JD_UTC.
The equation used is::
BJD_TDB = JD_UTC + JD_to_TDB_corr + romer_delay
where:
- JD_to_TDB_corr is the di... | def jd_corr(jd,
ra, dec,
obslon=None,
obslat=None,
obsalt=None,
jd_type='bjd'):
'''Returns BJD_TDB or HJD_TDB for input JD_UTC.
The equation used is::
BJD_TDB = JD_UTC + JD_to_TDB_corr + romer_delay
where:
- JD_to_TDB_corr is the di... | [
"Returns",
"BJD_TDB",
"or",
"HJD_TDB",
"for",
"input",
"JD_UTC",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/timeutils.py#L535-L668 | [
"def",
"jd_corr",
"(",
"jd",
",",
"ra",
",",
"dec",
",",
"obslon",
"=",
"None",
",",
"obslat",
"=",
"None",
",",
"obsalt",
"=",
"None",
",",
"jd_type",
"=",
"'bjd'",
")",
":",
"if",
"not",
"HAVEKERNEL",
":",
"LOGERROR",
"(",
"'no JPL kernel available, ... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _lclist_parallel_worker | This is a parallel worker for makelclist.
Parameters
----------
task : tuple
This is a tuple containing the following items:
task[0] = lcf
task[1] = columns
task[2] = lcformat
task[3] = lcformatdir
task[4] = lcndetkey
Returns
-------
dict or N... | astrobase/lcproc/catalogs.py | def _lclist_parallel_worker(task):
'''This is a parallel worker for makelclist.
Parameters
----------
task : tuple
This is a tuple containing the following items:
task[0] = lcf
task[1] = columns
task[2] = lcformat
task[3] = lcformatdir
task[4] = lcndetk... | def _lclist_parallel_worker(task):
'''This is a parallel worker for makelclist.
Parameters
----------
task : tuple
This is a tuple containing the following items:
task[0] = lcf
task[1] = columns
task[2] = lcformat
task[3] = lcformatdir
task[4] = lcndetk... | [
"This",
"is",
"a",
"parallel",
"worker",
"for",
"makelclist",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/catalogs.py#L116-L228 | [
"def",
"_lclist_parallel_worker",
"(",
"task",
")",
":",
"lcf",
",",
"columns",
",",
"lcformat",
",",
"lcformatdir",
",",
"lcndetkey",
"=",
"task",
"# get the bits needed for lcformat handling",
"# NOTE: we re-import things in this worker function because sometimes",
"# functio... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | make_lclist | This generates a light curve catalog for all light curves in a directory.
Given a base directory where all the files are, and a light curve format,
this will find all light curves, pull out the keys in each lcdict requested
in the `columns` kwarg for each object, and write them to the requested
output ... | astrobase/lcproc/catalogs.py | def make_lclist(basedir,
outfile,
use_list_of_filenames=None,
lcformat='hat-sql',
lcformatdir=None,
fileglob=None,
recursive=True,
columns=['objectid',
'objectinfo.ra',
... | def make_lclist(basedir,
outfile,
use_list_of_filenames=None,
lcformat='hat-sql',
lcformatdir=None,
fileglob=None,
recursive=True,
columns=['objectid',
'objectinfo.ra',
... | [
"This",
"generates",
"a",
"light",
"curve",
"catalog",
"for",
"all",
"light",
"curves",
"in",
"a",
"directory",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/catalogs.py#L232-L743 | [
"def",
"make_lclist",
"(",
"basedir",
",",
"outfile",
",",
"use_list_of_filenames",
"=",
"None",
",",
"lcformat",
"=",
"'hat-sql'",
",",
"lcformatdir",
"=",
"None",
",",
"fileglob",
"=",
"None",
",",
"recursive",
"=",
"True",
",",
"columns",
"=",
"[",
"'ob... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | filter_lclist | This is used to perform cone-search, cross-match, and column-filter
operations on a light curve catalog generated by `make_lclist`.
Uses the output of `make_lclist` above. This function returns a list of
light curves matching various criteria specified by the `xmatchexternal`,
`conesearch`, and `column... | astrobase/lcproc/catalogs.py | def filter_lclist(lc_catalog,
objectidcol='objectid',
racol='ra',
declcol='decl',
xmatchexternal=None,
xmatchdistarcsec=3.0,
externalcolnums=(0,1,2),
externalcolnames=['objectid','ra','decl'],
... | def filter_lclist(lc_catalog,
objectidcol='objectid',
racol='ra',
declcol='decl',
xmatchexternal=None,
xmatchdistarcsec=3.0,
externalcolnums=(0,1,2),
externalcolnames=['objectid','ra','decl'],
... | [
"This",
"is",
"used",
"to",
"perform",
"cone",
"-",
"search",
"cross",
"-",
"match",
"and",
"column",
"-",
"filter",
"operations",
"on",
"a",
"light",
"curve",
"catalog",
"generated",
"by",
"make_lclist",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/catalogs.py#L747-L1214 | [
"def",
"filter_lclist",
"(",
"lc_catalog",
",",
"objectidcol",
"=",
"'objectid'",
",",
"racol",
"=",
"'ra'",
",",
"declcol",
"=",
"'decl'",
",",
"xmatchexternal",
"=",
"None",
",",
"xmatchdistarcsec",
"=",
"3.0",
",",
"externalcolnums",
"=",
"(",
"0",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _cpinfo_key_worker | This wraps `checkplotlist.checkplot_infokey_worker`.
This is used to get the correct dtype for each element in retrieved results.
Parameters
----------
task : tuple
task[0] = cpfile
task[1] = keyspeclist (infokeys kwarg from `add_cpinfo_to_lclist`)
Returns
-------
dict
... | astrobase/lcproc/catalogs.py | def _cpinfo_key_worker(task):
'''This wraps `checkplotlist.checkplot_infokey_worker`.
This is used to get the correct dtype for each element in retrieved results.
Parameters
----------
task : tuple
task[0] = cpfile
task[1] = keyspeclist (infokeys kwarg from `add_cpinfo_to_lclist`)... | def _cpinfo_key_worker(task):
'''This wraps `checkplotlist.checkplot_infokey_worker`.
This is used to get the correct dtype for each element in retrieved results.
Parameters
----------
task : tuple
task[0] = cpfile
task[1] = keyspeclist (infokeys kwarg from `add_cpinfo_to_lclist`)... | [
"This",
"wraps",
"checkplotlist",
".",
"checkplot_infokey_worker",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/catalogs.py#L1222-L1283 | [
"def",
"_cpinfo_key_worker",
"(",
"task",
")",
":",
"cpfile",
",",
"keyspeclist",
"=",
"task",
"keystoget",
"=",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"keyspeclist",
"]",
"nonesubs",
"=",
"[",
"x",
"[",
"-",
"2",
"]",
"for",
"x",
"in",
"keyspe... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | add_cpinfo_to_lclist | This adds checkplot info to the initial light curve catalogs generated by
`make_lclist`.
This is used to incorporate all the extra info checkplots can have for
objects back into columns in the light curve catalog produced by
`make_lclist`. Objects are matched between the checkplots and the light
cu... | astrobase/lcproc/catalogs.py | def add_cpinfo_to_lclist(
checkplots, # list or a directory path
initial_lc_catalog,
magcol, # to indicate checkplot magcol
outfile,
checkplotglob='checkplot*.pkl*',
infokeys=CPINFO_DEFAULTKEYS,
nworkers=NCPUS
):
'''This adds checkplot info to the initial li... | def add_cpinfo_to_lclist(
checkplots, # list or a directory path
initial_lc_catalog,
magcol, # to indicate checkplot magcol
outfile,
checkplotglob='checkplot*.pkl*',
infokeys=CPINFO_DEFAULTKEYS,
nworkers=NCPUS
):
'''This adds checkplot info to the initial li... | [
"This",
"adds",
"checkplot",
"info",
"to",
"the",
"initial",
"light",
"curve",
"catalogs",
"generated",
"by",
"make_lclist",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/catalogs.py#L1451-L1661 | [
"def",
"add_cpinfo_to_lclist",
"(",
"checkplots",
",",
"# list or a directory path",
"initial_lc_catalog",
",",
"magcol",
",",
"# to indicate checkplot magcol",
"outfile",
",",
"checkplotglob",
"=",
"'checkplot*.pkl*'",
",",
"infokeys",
"=",
"CPINFO_DEFAULTKEYS",
",",
"nwor... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | variability_threshold | This generates a list of objects with stetson J, IQR, and 1.0/eta
above some threshold value to select them as potential variable stars.
Use this to pare down the objects to review and put through
period-finding. This does the thresholding per magnitude bin; this should be
better than one single cut th... | astrobase/lcproc/varthreshold.py | def variability_threshold(featuresdir,
outfile,
magbins=DEFAULT_MAGBINS,
maxobjects=None,
timecols=None,
magcols=None,
errcols=None,
lcfor... | def variability_threshold(featuresdir,
outfile,
magbins=DEFAULT_MAGBINS,
maxobjects=None,
timecols=None,
magcols=None,
errcols=None,
lcfor... | [
"This",
"generates",
"a",
"list",
"of",
"objects",
"with",
"stetson",
"J",
"IQR",
"and",
"1",
".",
"0",
"/",
"eta",
"above",
"some",
"threshold",
"value",
"to",
"select",
"them",
"as",
"potential",
"variable",
"stars",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/varthreshold.py#L96-L699 | [
"def",
"variability_threshold",
"(",
"featuresdir",
",",
"outfile",
",",
"magbins",
"=",
"DEFAULT_MAGBINS",
",",
"maxobjects",
"=",
"None",
",",
"timecols",
"=",
"None",
",",
"magcols",
"=",
"None",
",",
"errcols",
"=",
"None",
",",
"lcformat",
"=",
"'hat-sq... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | plot_variability_thresholds | This makes plots for the variability threshold distributions.
Parameters
----------
varthreshpkl : str
The pickle produced by the function above.
xmin_lcmad_stdev,xmin_stetj_stdev,xmin_iqr_stdev,xmin_inveta_stdev : float or np.array
Values of the threshold values to override the ones ... | astrobase/lcproc/varthreshold.py | def plot_variability_thresholds(varthreshpkl,
xmin_lcmad_stdev=5.0,
xmin_stetj_stdev=2.0,
xmin_iqr_stdev=2.0,
xmin_inveta_stdev=2.0,
lcformat='hat-sql',
... | def plot_variability_thresholds(varthreshpkl,
xmin_lcmad_stdev=5.0,
xmin_stetj_stdev=2.0,
xmin_iqr_stdev=2.0,
xmin_inveta_stdev=2.0,
lcformat='hat-sql',
... | [
"This",
"makes",
"plots",
"for",
"the",
"variability",
"threshold",
"distributions",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/varthreshold.py#L703-L885 | [
"def",
"plot_variability_thresholds",
"(",
"varthreshpkl",
",",
"xmin_lcmad_stdev",
"=",
"5.0",
",",
"xmin_stetj_stdev",
"=",
"2.0",
",",
"xmin_iqr_stdev",
"=",
"2.0",
",",
"xmin_inveta_stdev",
"=",
"2.0",
",",
"lcformat",
"=",
"'hat-sql'",
",",
"lcformatdir",
"="... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | get_stamp | This gets a FITS cutout from the NASA GSFC SkyView service.
This downloads stamps in FITS format from the NASA SkyView service:
https://skyview.gsfc.nasa.gov/current/cgi/query.pl
Parameters
----------
ra,decl : float
These are decimal equatorial coordinates for the cutout center.
s... | astrobase/services/skyview.py | def get_stamp(ra, decl,
survey='DSS2 Red',
scaling='Linear',
sizepix=300,
forcefetch=False,
cachedir='~/.astrobase/stamp-cache',
timeout=10.0,
retry_failed=True,
verbose=True,
jitter=5.0):
'... | def get_stamp(ra, decl,
survey='DSS2 Red',
scaling='Linear',
sizepix=300,
forcefetch=False,
cachedir='~/.astrobase/stamp-cache',
timeout=10.0,
retry_failed=True,
verbose=True,
jitter=5.0):
'... | [
"This",
"gets",
"a",
"FITS",
"cutout",
"from",
"the",
"NASA",
"GSFC",
"SkyView",
"service",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/skyview.py#L93-L307 | [
"def",
"get_stamp",
"(",
"ra",
",",
"decl",
",",
"survey",
"=",
"'DSS2 Red'",
",",
"scaling",
"=",
"'Linear'",
",",
"sizepix",
"=",
"300",
",",
"forcefetch",
"=",
"False",
",",
"cachedir",
"=",
"'~/.astrobase/stamp-cache'",
",",
"timeout",
"=",
"10.0",
","... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | MapPolyline._update_proxy | An observer which sends the state change to the proxy. | src/googlemaps/widgets/map_view.py | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] == 'container':
#: Only update what's needed
self.proxy.update_points(change)
else:
super(MapPolyline, self)._update_proxy(change) | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] == 'container':
#: Only update what's needed
self.proxy.update_points(change)
else:
super(MapPolyline, self)._update_proxy(change) | [
"An",
"observer",
"which",
"sends",
"the",
"state",
"change",
"to",
"the",
"proxy",
"."
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/widgets/map_view.py#L512-L520 | [
"def",
"_update_proxy",
"(",
"self",
",",
"change",
")",
":",
"if",
"change",
"[",
"'type'",
"]",
"==",
"'container'",
":",
"#: Only update what's needed",
"self",
".",
"proxy",
".",
"update_points",
"(",
"change",
")",
"else",
":",
"super",
"(",
"MapPolylin... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | MapPolygon._update_proxy | An observer which sends the state change to the proxy. | src/googlemaps/widgets/map_view.py | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] == 'container':
#: Only update what's needed
self.proxy.update_points(change)
else:
super(MapPolygon, self)._update_proxy(change) | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] == 'container':
#: Only update what's needed
self.proxy.update_points(change)
else:
super(MapPolygon, self)._update_proxy(change) | [
"An",
"observer",
"which",
"sends",
"the",
"state",
"change",
"to",
"the",
"proxy",
"."
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/widgets/map_view.py#L567-L575 | [
"def",
"_update_proxy",
"(",
"self",
",",
"change",
")",
":",
"if",
"change",
"[",
"'type'",
"]",
"==",
"'container'",
":",
"#: Only update what's needed",
"self",
".",
"proxy",
".",
"update_points",
"(",
"change",
")",
"else",
":",
"super",
"(",
"MapPolygon... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | LatLngList.handle_change | Handle changes from atom ContainerLists | src/googlemaps/android/android_map_view.py | def handle_change(self, change):
""" Handle changes from atom ContainerLists """
op = change['operation']
if op in 'append':
self.add(len(change['value']), LatLng(*change['item']))
elif op == 'insert':
self.add(change['index'], LatLng(*change['item']))
eli... | def handle_change(self, change):
""" Handle changes from atom ContainerLists """
op = change['operation']
if op in 'append':
self.add(len(change['value']), LatLng(*change['item']))
elif op == 'insert':
self.add(change['index'], LatLng(*change['item']))
eli... | [
"Handle",
"changes",
"from",
"atom",
"ContainerLists"
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L62-L78 | [
"def",
"handle_change",
"(",
"self",
",",
"change",
")",
":",
"op",
"=",
"change",
"[",
"'operation'",
"]",
"if",
"op",
"in",
"'append'",
":",
"self",
".",
"add",
"(",
"len",
"(",
"change",
"[",
"'value'",
"]",
")",
",",
"LatLng",
"(",
"*",
"change... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapView.create_widget | Create the underlying widget. | src/googlemaps/android/android_map_view.py | def create_widget(self):
""" Create the underlying widget.
"""
self.init_options()
#: Retrieve the actual map
MapFragment.newInstance(self.options).then(
self.on_map_fragment_created)
# Holder for the fragment
self.widget = FrameLayout(self.get_cont... | def create_widget(self):
""" Create the underlying widget.
"""
self.init_options()
#: Retrieve the actual map
MapFragment.newInstance(self.options).then(
self.on_map_fragment_created)
# Holder for the fragment
self.widget = FrameLayout(self.get_cont... | [
"Create",
"the",
"underlying",
"widget",
"."
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L440-L464 | [
"def",
"create_widget",
"(",
"self",
")",
":",
"self",
".",
"init_options",
"(",
")",
"#: Retrieve the actual map",
"MapFragment",
".",
"newInstance",
"(",
"self",
".",
"options",
")",
".",
"then",
"(",
"self",
".",
"on_map_fragment_created",
")",
"# Holder for ... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapView.init_options | Initialize the underlying map options. | src/googlemaps/android/android_map_view.py | def init_options(self):
""" Initialize the underlying map options.
"""
self.options = GoogleMapOptions()
d = self.declaration
self.set_map_type(d.map_type)
if d.ambient_mode:
self.set_ambient_mode(d.ambient_mode)
if (d.camera_position or d.camera_zoom... | def init_options(self):
""" Initialize the underlying map options.
"""
self.options = GoogleMapOptions()
d = self.declaration
self.set_map_type(d.map_type)
if d.ambient_mode:
self.set_ambient_mode(d.ambient_mode)
if (d.camera_position or d.camera_zoom... | [
"Initialize",
"the",
"underlying",
"map",
"options",
"."
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L466-L499 | [
"def",
"init_options",
"(",
"self",
")",
":",
"self",
".",
"options",
"=",
"GoogleMapOptions",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"set_map_type",
"(",
"d",
".",
"map_type",
")",
"if",
"d",
".",
"ambient_mode",
":",
"self",
"."... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapView.init_map | Add markers, polys, callouts, etc.. | src/googlemaps/android/android_map_view.py | def init_map(self):
""" Add markers, polys, callouts, etc.."""
d = self.declaration
if d.show_location:
self.set_show_location(d.show_location)
if d.show_traffic:
self.set_show_traffic(d.show_traffic)
if d.show_indoors:
self.set_show_indoors(d.... | def init_map(self):
""" Add markers, polys, callouts, etc.."""
d = self.declaration
if d.show_location:
self.set_show_location(d.show_location)
if d.show_traffic:
self.set_show_traffic(d.show_traffic)
if d.show_indoors:
self.set_show_indoors(d.... | [
"Add",
"markers",
"polys",
"callouts",
"etc",
".."
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L501-L558 | [
"def",
"init_map",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"if",
"d",
".",
"show_location",
":",
"self",
".",
"set_show_location",
"(",
"d",
".",
"show_location",
")",
"if",
"d",
".",
"show_traffic",
":",
"self",
".",
"set_show_traff... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapView.init_info_window_adapter | Initialize the info window adapter. Should only be done if one of
the markers defines a custom view. | src/googlemaps/android/android_map_view.py | def init_info_window_adapter(self):
""" Initialize the info window adapter. Should only be done if one of
the markers defines a custom view.
"""
adapter = self.adapter
if adapter:
return #: Already initialized
adapter = GoogleMap.InfoWindowAdapter()
... | def init_info_window_adapter(self):
""" Initialize the info window adapter. Should only be done if one of
the markers defines a custom view.
"""
adapter = self.adapter
if adapter:
return #: Already initialized
adapter = GoogleMap.InfoWindowAdapter()
... | [
"Initialize",
"the",
"info",
"window",
"adapter",
".",
"Should",
"only",
"be",
"done",
"if",
"one",
"of",
"the",
"markers",
"defines",
"a",
"custom",
"view",
"."
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L560-L570 | [
"def",
"init_info_window_adapter",
"(",
"self",
")",
":",
"adapter",
"=",
"self",
".",
"adapter",
"if",
"adapter",
":",
"return",
"#: Already initialized",
"adapter",
"=",
"GoogleMap",
".",
"InfoWindowAdapter",
"(",
")",
"adapter",
".",
"getInfoContents",
".",
"... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapView.on_map_fragment_created | Create the fragment and pull the map reference when it's loaded. | src/googlemaps/android/android_map_view.py | def on_map_fragment_created(self, obj_id):
""" Create the fragment and pull the map reference when it's loaded.
"""
self.fragment = MapFragment(__id__=obj_id)
#: Setup callback so we know when the map is ready
self.map.onMapReady.connect(self.on_map_ready)
self.fragment... | def on_map_fragment_created(self, obj_id):
""" Create the fragment and pull the map reference when it's loaded.
"""
self.fragment = MapFragment(__id__=obj_id)
#: Setup callback so we know when the map is ready
self.map.onMapReady.connect(self.on_map_ready)
self.fragment... | [
"Create",
"the",
"fragment",
"and",
"pull",
"the",
"map",
"reference",
"when",
"it",
"s",
"loaded",
"."
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L575-L595 | [
"def",
"on_map_fragment_created",
"(",
"self",
",",
"obj_id",
")",
":",
"self",
".",
"fragment",
"=",
"MapFragment",
"(",
"__id__",
"=",
"obj_id",
")",
"#: Setup callback so we know when the map is ready",
"self",
".",
"map",
".",
"onMapReady",
".",
"connect",
"("... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapView.on_map_clicked | Called when the map is clicked | src/googlemaps/android/android_map_view.py | def on_map_clicked(self, pos):
""" Called when the map is clicked """
d = self.declaration
d.clicked({
'click': 'short',
'position': tuple(pos)
}) | def on_map_clicked(self, pos):
""" Called when the map is clicked """
d = self.declaration
d.clicked({
'click': 'short',
'position': tuple(pos)
}) | [
"Called",
"when",
"the",
"map",
"is",
"clicked"
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L629-L635 | [
"def",
"on_map_clicked",
"(",
"self",
",",
"pos",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"d",
".",
"clicked",
"(",
"{",
"'click'",
":",
"'short'",
",",
"'position'",
":",
"tuple",
"(",
"pos",
")",
"}",
")"
] | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapView.on_map_long_clicked | Called when the map is clicked | src/googlemaps/android/android_map_view.py | def on_map_long_clicked(self, pos):
""" Called when the map is clicked """
d = self.declaration
d.clicked({
'click': 'long',
'position': tuple(pos)
}) | def on_map_long_clicked(self, pos):
""" Called when the map is clicked """
d = self.declaration
d.clicked({
'click': 'long',
'position': tuple(pos)
}) | [
"Called",
"when",
"the",
"map",
"is",
"clicked"
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L637-L643 | [
"def",
"on_map_long_clicked",
"(",
"self",
",",
"pos",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"d",
".",
"clicked",
"(",
"{",
"'click'",
":",
"'long'",
",",
"'position'",
":",
"tuple",
"(",
"pos",
")",
"}",
")"
] | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapItemBase.destroy | Remove the marker if it was added to the map when destroying | src/googlemaps/android/android_map_view.py | def destroy(self):
""" Remove the marker if it was added to the map when destroying"""
marker = self.marker
parent = self.parent()
if marker:
if parent:
del parent.markers[marker.__id__]
marker.remove()
super(AndroidMapItemBase, self).destr... | def destroy(self):
""" Remove the marker if it was added to the map when destroying"""
marker = self.marker
parent = self.parent()
if marker:
if parent:
del parent.markers[marker.__id__]
marker.remove()
super(AndroidMapItemBase, self).destr... | [
"Remove",
"the",
"marker",
"if",
"it",
"was",
"added",
"to",
"the",
"map",
"when",
"destroying"
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L911-L919 | [
"def",
"destroy",
"(",
"self",
")",
":",
"marker",
"=",
"self",
".",
"marker",
"parent",
"=",
"self",
".",
"parent",
"(",
")",
"if",
"marker",
":",
"if",
"parent",
":",
"del",
"parent",
".",
"markers",
"[",
"marker",
".",
"__id__",
"]",
"marker",
"... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapMarker.child_added | If a child is added we have to make sure the map adapter exists | src/googlemaps/android/android_map_view.py | def child_added(self, child):
""" If a child is added we have to make sure the map adapter exists """
if child.widget:
# TODO: Should we keep count and remove the adapter if not all
# markers request it?
self.parent().init_info_window_adapter()
super(AndroidMa... | def child_added(self, child):
""" If a child is added we have to make sure the map adapter exists """
if child.widget:
# TODO: Should we keep count and remove the adapter if not all
# markers request it?
self.parent().init_info_window_adapter()
super(AndroidMa... | [
"If",
"a",
"child",
"is",
"added",
"we",
"have",
"to",
"make",
"sure",
"the",
"map",
"adapter",
"exists"
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L969-L975 | [
"def",
"child_added",
"(",
"self",
",",
"child",
")",
":",
"if",
"child",
".",
"widget",
":",
"# TODO: Should we keep count and remove the adapter if not all",
"# markers request it?",
"self",
".",
"parent",
"(",
")",
".",
"init_info_window_adapter",
"(",
")",
"super"... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapMarker.on_marker | Convert our options into the actual marker object | src/googlemaps/android/android_map_view.py | def on_marker(self, marker):
""" Convert our options into the actual marker object"""
mid, pos = marker
self.marker = Marker(__id__=mid)
mapview = self.parent()
# Save ref
mapview.markers[mid] = self
# Required so the packer can pass the id
self.marker.se... | def on_marker(self, marker):
""" Convert our options into the actual marker object"""
mid, pos = marker
self.marker = Marker(__id__=mid)
mapview = self.parent()
# Save ref
mapview.markers[mid] = self
# Required so the packer can pass the id
self.marker.se... | [
"Convert",
"our",
"options",
"into",
"the",
"actual",
"marker",
"object"
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L980-L1002 | [
"def",
"on_marker",
"(",
"self",
",",
"marker",
")",
":",
"mid",
",",
"pos",
"=",
"marker",
"self",
".",
"marker",
"=",
"Marker",
"(",
"__id__",
"=",
"mid",
")",
"mapview",
"=",
"self",
".",
"parent",
"(",
")",
"# Save ref",
"mapview",
".",
"markers"... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | AndroidMapCircle.on_marker | Convert our options into the actual circle object | src/googlemaps/android/android_map_view.py | def on_marker(self, mid):
""" Convert our options into the actual circle object"""
self.marker = Circle(__id__=mid)
self.parent().markers[mid] = self
#: Required so the packer can pass the id
self.marker.setTag(mid)
d = self.declaration
if d.clickable:
... | def on_marker(self, mid):
""" Convert our options into the actual circle object"""
self.marker = Circle(__id__=mid)
self.parent().markers[mid] = self
#: Required so the packer can pass the id
self.marker.setTag(mid)
d = self.declaration
if d.clickable:
... | [
"Convert",
"our",
"options",
"into",
"the",
"actual",
"circle",
"object"
] | codelv/enaml-native-maps | python | https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L1151-L1164 | [
"def",
"on_marker",
"(",
"self",
",",
"mid",
")",
":",
"self",
".",
"marker",
"=",
"Circle",
"(",
"__id__",
"=",
"mid",
")",
"self",
".",
"parent",
"(",
")",
".",
"markers",
"[",
"mid",
"]",
"=",
"self",
"#: Required so the packer can pass the id",
"self... | 5b6dda745cede05755dd40d29775cc0544226c29 |
valid | CountVectorizer.fit_transform | Learn the vocabulary dictionary and return term-document matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Parameters
----------
raw_documents : iterable
An iterable which yields either str, unicode or file objects.
R... | languageflow/transformer/count.py | def fit_transform(self, raw_documents, y=None):
""" Learn the vocabulary dictionary and return term-document matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Parameters
----------
raw_documents : iterable
An iterable ... | def fit_transform(self, raw_documents, y=None):
""" Learn the vocabulary dictionary and return term-document matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Parameters
----------
raw_documents : iterable
An iterable ... | [
"Learn",
"the",
"vocabulary",
"dictionary",
"and",
"return",
"term",
"-",
"document",
"matrix",
".",
"This",
"is",
"equivalent",
"to",
"fit",
"followed",
"by",
"transform",
"but",
"more",
"efficiently",
"implemented",
"."
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/transformer/count.py#L145-L167 | [
"def",
"fit_transform",
"(",
"self",
",",
"raw_documents",
",",
"y",
"=",
"None",
")",
":",
"documents",
"=",
"super",
"(",
"CountVectorizer",
",",
"self",
")",
".",
"fit_transform",
"(",
"raw_documents",
"=",
"raw_documents",
",",
"y",
"=",
"y",
")",
"s... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | Flow.data | Add data to flow | languageflow/flow.py | def data(self, X=None, y=None, sentences=None):
"""
Add data to flow
"""
self.X = X
self.y = y
self.sentences = sentences | def data(self, X=None, y=None, sentences=None):
"""
Add data to flow
"""
self.X = X
self.y = y
self.sentences = sentences | [
"Add",
"data",
"to",
"flow"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/flow.py#L38-L45 | [
"def",
"data",
"(",
"self",
",",
"X",
"=",
"None",
",",
"y",
"=",
"None",
",",
"sentences",
"=",
"None",
")",
":",
"self",
".",
"X",
"=",
"X",
"self",
".",
"y",
"=",
"y",
"self",
".",
"sentences",
"=",
"sentences"
] | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | Flow.transform | Add transformer to flow and apply transformer to data in flow
Parameters
----------
transformer : Transformer
a transformer to transform data | languageflow/flow.py | def transform(self, transformer):
"""
Add transformer to flow and apply transformer to data in flow
Parameters
----------
transformer : Transformer
a transformer to transform data
"""
self.transformers.append(transformer)
from languageflow.tra... | def transform(self, transformer):
"""
Add transformer to flow and apply transformer to data in flow
Parameters
----------
transformer : Transformer
a transformer to transform data
"""
self.transformers.append(transformer)
from languageflow.tra... | [
"Add",
"transformer",
"to",
"flow",
"and",
"apply",
"transformer",
"to",
"data",
"in",
"flow"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/flow.py#L47-L69 | [
"def",
"transform",
"(",
"self",
",",
"transformer",
")",
":",
"self",
".",
"transformers",
".",
"append",
"(",
"transformer",
")",
"from",
"languageflow",
".",
"transformer",
".",
"tagged",
"import",
"TaggedTransformer",
"if",
"isinstance",
"(",
"transformer",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | Flow.train | Train model with transformed data | languageflow/flow.py | def train(self):
"""
Train model with transformed data
"""
for i, model in enumerate(self.models):
N = [int(i * len(self.y)) for i in self.lc_range]
for n in N:
X = self.X[:n]
y = self.y[:n]
e = Experiment(X, y, mode... | def train(self):
"""
Train model with transformed data
"""
for i, model in enumerate(self.models):
N = [int(i * len(self.y)) for i in self.lc_range]
for n in N:
X = self.X[:n]
y = self.y[:n]
e = Experiment(X, y, mode... | [
"Train",
"model",
"with",
"transformed",
"data"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/flow.py#L86-L98 | [
"def",
"train",
"(",
"self",
")",
":",
"for",
"i",
",",
"model",
"in",
"enumerate",
"(",
"self",
".",
"models",
")",
":",
"N",
"=",
"[",
"int",
"(",
"i",
"*",
"len",
"(",
"self",
".",
"y",
")",
")",
"for",
"i",
"in",
"self",
".",
"lc_range",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | Flow.export | Export model and transformers to export_folder
Parameters
----------
model_name: string
name of model to export
export_folder: string
folder to store exported model and transformers | languageflow/flow.py | def export(self, model_name, export_folder):
"""
Export model and transformers to export_folder
Parameters
----------
model_name: string
name of model to export
export_folder: string
folder to store exported model and transformers
"""
... | def export(self, model_name, export_folder):
"""
Export model and transformers to export_folder
Parameters
----------
model_name: string
name of model to export
export_folder: string
folder to store exported model and transformers
"""
... | [
"Export",
"model",
"and",
"transformers",
"to",
"export_folder"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/flow.py#L100-L131 | [
"def",
"export",
"(",
"self",
",",
"model_name",
",",
"export_folder",
")",
":",
"for",
"transformer",
"in",
"self",
".",
"transformers",
":",
"if",
"isinstance",
"(",
"transformer",
",",
"MultiLabelBinarizer",
")",
":",
"joblib",
".",
"dump",
"(",
"transfor... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | TfidfVectorizer.fit_transform | Learn vocabulary and idf, return term-document matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Parameters
----------
raw_documents : iterable
an iterable which yields either str, unicode or file objects
Returns
... | languageflow/transformer/tfidf.py | def fit_transform(self, raw_documents, y=None):
"""Learn vocabulary and idf, return term-document matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Parameters
----------
raw_documents : iterable
an iterable which yields... | def fit_transform(self, raw_documents, y=None):
"""Learn vocabulary and idf, return term-document matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Parameters
----------
raw_documents : iterable
an iterable which yields... | [
"Learn",
"vocabulary",
"and",
"idf",
"return",
"term",
"-",
"document",
"matrix",
".",
"This",
"is",
"equivalent",
"to",
"fit",
"followed",
"by",
"transform",
"but",
"more",
"efficiently",
"implemented",
".",
"Parameters",
"----------",
"raw_documents",
":",
"it... | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/transformer/tfidf.py#L138-L173 | [
"def",
"fit_transform",
"(",
"self",
",",
"raw_documents",
",",
"y",
"=",
"None",
")",
":",
"documents",
"=",
"super",
"(",
"TfidfVectorizer",
",",
"self",
")",
".",
"fit_transform",
"(",
"raw_documents",
"=",
"raw_documents",
",",
"y",
"=",
"y",
")",
"c... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | SGDClassifier.fit | Fit linear model with Stochastic Gradient Descent.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data
y : numpy array, shape (n_samples,)
Target values
coef_init : array, shape (n_classes, n_features)
... | languageflow/model/sgd.py | def fit(self, X, y, coef_init=None, intercept_init=None,
sample_weight=None):
"""Fit linear model with Stochastic Gradient Descent.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data
y : numpy array, shape ... | def fit(self, X, y, coef_init=None, intercept_init=None,
sample_weight=None):
"""Fit linear model with Stochastic Gradient Descent.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data
y : numpy array, shape ... | [
"Fit",
"linear",
"model",
"with",
"Stochastic",
"Gradient",
"Descent",
"."
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/model/sgd.py#L21-L50 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"coef_init",
"=",
"None",
",",
"intercept_init",
"=",
"None",
",",
"sample_weight",
"=",
"None",
")",
":",
"super",
"(",
"SGDClassifier",
",",
"self",
")",
".",
"fit",
"(",
"X",
",",
"y",
",",
"... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | print_cm | pretty print for confusion matrixes | languageflow/evaluation/__init__.py | def print_cm(cm, labels, hide_zeroes=False, hide_diagonal=False, hide_threshold=None):
"""pretty print for confusion matrixes"""
columnwidth = max([len(x) for x in labels] + [5]) # 5 is value length
empty_cell = " " * columnwidth
# Print header
print(" " + empty_cell, end=" ")
for label in l... | def print_cm(cm, labels, hide_zeroes=False, hide_diagonal=False, hide_threshold=None):
"""pretty print for confusion matrixes"""
columnwidth = max([len(x) for x in labels] + [5]) # 5 is value length
empty_cell = " " * columnwidth
# Print header
print(" " + empty_cell, end=" ")
for label in l... | [
"pretty",
"print",
"for",
"confusion",
"matrixes"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/evaluation/__init__.py#L3-L24 | [
"def",
"print_cm",
"(",
"cm",
",",
"labels",
",",
"hide_zeroes",
"=",
"False",
",",
"hide_diagonal",
"=",
"False",
",",
"hide_threshold",
"=",
"None",
")",
":",
"columnwidth",
"=",
"max",
"(",
"[",
"len",
"(",
"x",
")",
"for",
"x",
"in",
"labels",
"]... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | load_big_file | Workaround for loading a big pickle file. Files over 2GB cause pickle errors on certin Mac and Windows distributions.
:param f:
:return: | languageflow/file_utils.py | def load_big_file(f):
"""
Workaround for loading a big pickle file. Files over 2GB cause pickle errors on certin Mac and Windows distributions.
:param f:
:return:
"""
logger.info(f'loading file {f}')
with open(f, 'r+b') as f_in:
# mmap seems to be much more memory efficient
b... | def load_big_file(f):
"""
Workaround for loading a big pickle file. Files over 2GB cause pickle errors on certin Mac and Windows distributions.
:param f:
:return:
"""
logger.info(f'loading file {f}')
with open(f, 'r+b') as f_in:
# mmap seems to be much more memory efficient
b... | [
"Workaround",
"for",
"loading",
"a",
"big",
"pickle",
"file",
".",
"Files",
"over",
"2GB",
"cause",
"pickle",
"errors",
"on",
"certin",
"Mac",
"and",
"Windows",
"distributions",
".",
":",
"param",
"f",
":",
":",
"return",
":"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/file_utils.py#L26-L37 | [
"def",
"load_big_file",
"(",
"f",
")",
":",
"logger",
".",
"info",
"(",
"f'loading file {f}'",
")",
"with",
"open",
"(",
"f",
",",
"'r+b'",
")",
"as",
"f_in",
":",
"# mmap seems to be much more memory efficient",
"bf",
"=",
"mmap",
".",
"mmap",
"(",
"f_in",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | url_to_filename | Converts a url into a filename in a reversible way.
If `etag` is specified, add it on the end, separated by a period
(which necessarily won't appear in the base64-encoded filename).
Get rid of the quotes in the etag, since Windows doesn't like them. | languageflow/file_utils.py | def url_to_filename(url: str, etag: str = None) -> str:
"""
Converts a url into a filename in a reversible way.
If `etag` is specified, add it on the end, separated by a period
(which necessarily won't appear in the base64-encoded filename).
Get rid of the quotes in the etag, since Windows doesn't l... | def url_to_filename(url: str, etag: str = None) -> str:
"""
Converts a url into a filename in a reversible way.
If `etag` is specified, add it on the end, separated by a period
(which necessarily won't appear in the base64-encoded filename).
Get rid of the quotes in the etag, since Windows doesn't l... | [
"Converts",
"a",
"url",
"into",
"a",
"filename",
"in",
"a",
"reversible",
"way",
".",
"If",
"etag",
"is",
"specified",
"add",
"it",
"on",
"the",
"end",
"separated",
"by",
"a",
"period",
"(",
"which",
"necessarily",
"won",
"t",
"appear",
"in",
"the",
"b... | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/file_utils.py#L40-L56 | [
"def",
"url_to_filename",
"(",
"url",
":",
"str",
",",
"etag",
":",
"str",
"=",
"None",
")",
"->",
"str",
":",
"url_bytes",
"=",
"url",
".",
"encode",
"(",
"'utf-8'",
")",
"b64_bytes",
"=",
"base64",
".",
"b64encode",
"(",
"url_bytes",
")",
"decoded",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | filename_to_url | Recovers the the url from the encoded filename. Returns it and the ETag
(which may be ``None``) | languageflow/file_utils.py | def filename_to_url(filename: str) -> Tuple[str, str]:
"""
Recovers the the url from the encoded filename. Returns it and the ETag
(which may be ``None``)
"""
try:
# If there is an etag, it's everything after the first period
decoded, etag = filename.split(".", 1)
except ValueErr... | def filename_to_url(filename: str) -> Tuple[str, str]:
"""
Recovers the the url from the encoded filename. Returns it and the ETag
(which may be ``None``)
"""
try:
# If there is an etag, it's everything after the first period
decoded, etag = filename.split(".", 1)
except ValueErr... | [
"Recovers",
"the",
"the",
"url",
"from",
"the",
"encoded",
"filename",
".",
"Returns",
"it",
"and",
"the",
"ETag",
"(",
"which",
"may",
"be",
"None",
")"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/file_utils.py#L59-L73 | [
"def",
"filename_to_url",
"(",
"filename",
":",
"str",
")",
"->",
"Tuple",
"[",
"str",
",",
"str",
"]",
":",
"try",
":",
"# If there is an etag, it's everything after the first period",
"decoded",
",",
"etag",
"=",
"filename",
".",
"split",
"(",
"\".\"",
",",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | cached_path | Given something that might be a URL (or might be a local path),
determine which. If it's a URL, download the file and cache it, and
return the path to the cached file. If it's already a local path,
make sure the file exists and then return the path. | languageflow/file_utils.py | def cached_path(url_or_filename: str, cache_dir: Path) -> Path:
"""
Given something that might be a URL (or might be a local path),
determine which. If it's a URL, download the file and cache it, and
return the path to the cached file. If it's already a local path,
make sure the file exists and then... | def cached_path(url_or_filename: str, cache_dir: Path) -> Path:
"""
Given something that might be a URL (or might be a local path),
determine which. If it's a URL, download the file and cache it, and
return the path to the cached file. If it's already a local path,
make sure the file exists and then... | [
"Given",
"something",
"that",
"might",
"be",
"a",
"URL",
"(",
"or",
"might",
"be",
"a",
"local",
"path",
")",
"determine",
"which",
".",
"If",
"it",
"s",
"a",
"URL",
"download",
"the",
"file",
"and",
"cache",
"it",
"and",
"return",
"the",
"path",
"to... | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/file_utils.py#L76-L98 | [
"def",
"cached_path",
"(",
"url_or_filename",
":",
"str",
",",
"cache_dir",
":",
"Path",
")",
"->",
"Path",
":",
"dataset_cache",
"=",
"Path",
"(",
"CACHE_ROOT",
")",
"/",
"cache_dir",
"parsed",
"=",
"urlparse",
"(",
"url_or_filename",
")",
"if",
"parsed",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | get_from_cache | Given a URL, look for the corresponding dataset in the local cache.
If it's not there, download it. Then return the path to the cached file. | languageflow/file_utils.py | def get_from_cache(url: str, cache_dir: Path = None) -> Path:
"""
Given a URL, look for the corresponding dataset in the local cache.
If it's not there, download it. Then return the path to the cached file.
"""
cache_dir.mkdir(parents=True, exist_ok=True)
filename = re.sub(r'.+/', '', url)
... | def get_from_cache(url: str, cache_dir: Path = None) -> Path:
"""
Given a URL, look for the corresponding dataset in the local cache.
If it's not there, download it. Then return the path to the cached file.
"""
cache_dir.mkdir(parents=True, exist_ok=True)
filename = re.sub(r'.+/', '', url)
... | [
"Given",
"a",
"URL",
"look",
"for",
"the",
"corresponding",
"dataset",
"in",
"the",
"local",
"cache",
".",
"If",
"it",
"s",
"not",
"there",
"download",
"it",
".",
"Then",
"return",
"the",
"path",
"to",
"the",
"cached",
"file",
"."
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/file_utils.py#L102-L153 | [
"def",
"get_from_cache",
"(",
"url",
":",
"str",
",",
"cache_dir",
":",
"Path",
"=",
"None",
")",
"->",
"Path",
":",
"cache_dir",
".",
"mkdir",
"(",
"parents",
"=",
"True",
",",
"exist_ok",
"=",
"True",
")",
"filename",
"=",
"re",
".",
"sub",
"(",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | CRF.fit | Fit CRF according to X, y
Parameters
----------
X : list of text
each item is a text
y: list
each item is either a label (in multi class problem) or list of
labels (in multi label problem) | languageflow/model/crf.py | def fit(self, X, y):
"""Fit CRF according to X, y
Parameters
----------
X : list of text
each item is a text
y: list
each item is either a label (in multi class problem) or list of
labels (in multi label problem)
"""
trainer = py... | def fit(self, X, y):
"""Fit CRF according to X, y
Parameters
----------
X : list of text
each item is a text
y: list
each item is either a label (in multi class problem) or list of
labels (in multi label problem)
"""
trainer = py... | [
"Fit",
"CRF",
"according",
"to",
"X",
"y"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/model/crf.py#L10-L33 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"trainer",
"=",
"pycrfsuite",
".",
"Trainer",
"(",
"verbose",
"=",
"True",
")",
"for",
"xseq",
",",
"yseq",
"in",
"zip",
"(",
"X",
",",
"y",
")",
":",
"trainer",
".",
"append",
"(",
"xseq... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | CRF.predict | Predict class labels for samples in X.
Parameters
----------
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Samples. | languageflow/model/crf.py | def predict(self, X):
"""Predict class labels for samples in X.
Parameters
----------
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Samples.
"""
if isinstance(X[0], list):
return [self.estimator.tag(x) for x in X]
return... | def predict(self, X):
"""Predict class labels for samples in X.
Parameters
----------
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Samples.
"""
if isinstance(X[0], list):
return [self.estimator.tag(x) for x in X]
return... | [
"Predict",
"class",
"labels",
"for",
"samples",
"in",
"X",
"."
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/model/crf.py#L35-L45 | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"if",
"isinstance",
"(",
"X",
"[",
"0",
"]",
",",
"list",
")",
":",
"return",
"[",
"self",
".",
"estimator",
".",
"tag",
"(",
"x",
")",
"for",
"x",
"in",
"X",
"]",
"return",
"self",
".",
"est... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | Board.serve | Start LanguageBoard web application
Parameters
----------
port: int
port to serve web application | languageflow/board/__init__.py | def serve(self, port=62000):
""" Start LanguageBoard web application
Parameters
----------
port: int
port to serve web application
"""
from http.server import HTTPServer, CGIHTTPRequestHandler
os.chdir(self.log_folder)
httpd = HTTPServer((''... | def serve(self, port=62000):
""" Start LanguageBoard web application
Parameters
----------
port: int
port to serve web application
"""
from http.server import HTTPServer, CGIHTTPRequestHandler
os.chdir(self.log_folder)
httpd = HTTPServer((''... | [
"Start",
"LanguageBoard",
"web",
"application"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/board/__init__.py#L47-L62 | [
"def",
"serve",
"(",
"self",
",",
"port",
"=",
"62000",
")",
":",
"from",
"http",
".",
"server",
"import",
"HTTPServer",
",",
"CGIHTTPRequestHandler",
"os",
".",
"chdir",
"(",
"self",
".",
"log_folder",
")",
"httpd",
"=",
"HTTPServer",
"(",
"(",
"''",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | TaggedCorpus.analyze | :type auto_remove: boolean
:param boolean auto_remove: auto remove previous files in analyze folder | languageflow/reader/tagged_corpus.py | def analyze(self, output_folder=".", auto_remove=False):
"""
:type auto_remove: boolean
:param boolean auto_remove: auto remove previous files in analyze folder
"""
if auto_remove:
try:
shutil.rmtree(output_folder)
except:
p... | def analyze(self, output_folder=".", auto_remove=False):
"""
:type auto_remove: boolean
:param boolean auto_remove: auto remove previous files in analyze folder
"""
if auto_remove:
try:
shutil.rmtree(output_folder)
except:
p... | [
":",
"type",
"auto_remove",
":",
"boolean",
":",
"param",
"boolean",
"auto_remove",
":",
"auto",
"remove",
"previous",
"files",
"in",
"analyze",
"folder"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/reader/tagged_corpus.py#L70-L94 | [
"def",
"analyze",
"(",
"self",
",",
"output_folder",
"=",
"\".\"",
",",
"auto_remove",
"=",
"False",
")",
":",
"if",
"auto_remove",
":",
"try",
":",
"shutil",
".",
"rmtree",
"(",
"output_folder",
")",
"except",
":",
"pass",
"try",
":",
"mkdir",
"(",
"o... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | FastTextClassifier.predict | In order to obtain the most likely label for a list of text
Parameters
----------
X : list of string
Raw texts
Returns
-------
C : list of string
List labels | languageflow/model/fasttext.py | def predict(self, X):
""" In order to obtain the most likely label for a list of text
Parameters
----------
X : list of string
Raw texts
Returns
-------
C : list of string
List labels
"""
x = X
if not isinstance(X,... | def predict(self, X):
""" In order to obtain the most likely label for a list of text
Parameters
----------
X : list of string
Raw texts
Returns
-------
C : list of string
List labels
"""
x = X
if not isinstance(X,... | [
"In",
"order",
"to",
"obtain",
"the",
"most",
"likely",
"label",
"for",
"a",
"list",
"of",
"text"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/model/fasttext.py#L45-L66 | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"x",
"=",
"X",
"if",
"not",
"isinstance",
"(",
"X",
",",
"list",
")",
":",
"x",
"=",
"[",
"X",
"]",
"y",
"=",
"self",
".",
"estimator",
".",
"predict",
"(",
"x",
")",
"y",
"=",
"[",
"item",... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | CountLogger.log | Parameters
----------
model_folder : string
folder contains binaries file of model
binary_file : string
file path to count transformer binary file
log_folder : string
log folder | languageflow/log/count.py | def log(model_folder, binary_file="count.transformer.bin",
log_folder="analyze"):
"""
Parameters
----------
model_folder : string
folder contains binaries file of model
binary_file : string
file path to count transformer binary file
log... | def log(model_folder, binary_file="count.transformer.bin",
log_folder="analyze"):
"""
Parameters
----------
model_folder : string
folder contains binaries file of model
binary_file : string
file path to count transformer binary file
log... | [
"Parameters",
"----------",
"model_folder",
":",
"string",
"folder",
"contains",
"binaries",
"file",
"of",
"model",
"binary_file",
":",
"string",
"file",
"path",
"to",
"count",
"transformer",
"binary",
"file",
"log_folder",
":",
"string",
"log",
"folder"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/log/count.py#L13-L40 | [
"def",
"log",
"(",
"model_folder",
",",
"binary_file",
"=",
"\"count.transformer.bin\"",
",",
"log_folder",
"=",
"\"analyze\"",
")",
":",
"file",
"=",
"join",
"(",
"model_folder",
",",
"binary_file",
")",
"vectorizer",
"=",
"joblib",
".",
"load",
"(",
"file",
... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | KimCNNClassifier.fit | Fit KimCNNClassifier according to X, y
Parameters
----------
X : list of string
each item is a raw text
y : list of string
each item is a label | languageflow/model/cnn.py | def fit(self, X, y):
"""Fit KimCNNClassifier according to X, y
Parameters
----------
X : list of string
each item is a raw text
y : list of string
each item is a label
"""
####################
# Data Loader
################... | def fit(self, X, y):
"""Fit KimCNNClassifier according to X, y
Parameters
----------
X : list of string
each item is a raw text
y : list of string
each item is a label
"""
####################
# Data Loader
################... | [
"Fit",
"KimCNNClassifier",
"according",
"to",
"X",
"y"
] | undertheseanlp/languageflow | python | https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/model/cnn.py#L103-L177 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"####################",
"# Data Loader",
"####################",
"word_vector_transformer",
"=",
"WordVectorTransformer",
"(",
"padding",
"=",
"'max'",
")",
"X",
"=",
"word_vector_transformer",
".",
"fit_trans... | 1436e0bf72803e02ccf727f41e8fc85ba167d9fe |
valid | config_sources | Return the config files for an environment & cluster specific app. | yoconfigurator/smush.py | def config_sources(app, environment, cluster, configs_dirs, app_dir,
local=False, build=False):
"""Return the config files for an environment & cluster specific app."""
sources = [
# Machine-specific
(configs_dirs, 'hostname'),
(configs_dirs, 'hostname-local'),
... | def config_sources(app, environment, cluster, configs_dirs, app_dir,
local=False, build=False):
"""Return the config files for an environment & cluster specific app."""
sources = [
# Machine-specific
(configs_dirs, 'hostname'),
(configs_dirs, 'hostname-local'),
... | [
"Return",
"the",
"config",
"files",
"for",
"an",
"environment",
"&",
"cluster",
"specific",
"app",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/smush.py#L19-L60 | [
"def",
"config_sources",
"(",
"app",
",",
"environment",
",",
"cluster",
",",
"configs_dirs",
",",
"app_dir",
",",
"local",
"=",
"False",
",",
"build",
"=",
"False",
")",
":",
"sources",
"=",
"[",
"# Machine-specific",
"(",
"configs_dirs",
",",
"'hostname'",... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | available_sources | Yield the sources that are present. | yoconfigurator/smush.py | def available_sources(sources):
"""Yield the sources that are present."""
for dirs, name in sources:
for directory in dirs:
fn = os.path.join(directory, name) + '.py'
if os.path.isfile(fn):
yield fn | def available_sources(sources):
"""Yield the sources that are present."""
for dirs, name in sources:
for directory in dirs:
fn = os.path.join(directory, name) + '.py'
if os.path.isfile(fn):
yield fn | [
"Yield",
"the",
"sources",
"that",
"are",
"present",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/smush.py#L63-L69 | [
"def",
"available_sources",
"(",
"sources",
")",
":",
"for",
"dirs",
",",
"name",
"in",
"sources",
":",
"for",
"directory",
"in",
"dirs",
":",
"fn",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"name",
")",
"+",
"'.py'",
"if",
"os",
... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | smush_config | Merge the configuration sources and return the resulting DotDict. | yoconfigurator/smush.py | def smush_config(sources, initial=None):
"""Merge the configuration sources and return the resulting DotDict."""
if initial is None:
initial = {}
config = DotDict(initial)
for fn in sources:
log.debug('Merging %s', fn)
mod = get_config_module(fn)
config = mod.update(conf... | def smush_config(sources, initial=None):
"""Merge the configuration sources and return the resulting DotDict."""
if initial is None:
initial = {}
config = DotDict(initial)
for fn in sources:
log.debug('Merging %s', fn)
mod = get_config_module(fn)
config = mod.update(conf... | [
"Merge",
"the",
"configuration",
"sources",
"and",
"return",
"the",
"resulting",
"DotDict",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/smush.py#L72-L84 | [
"def",
"smush_config",
"(",
"sources",
",",
"initial",
"=",
"None",
")",
":",
"if",
"initial",
"is",
"None",
":",
"initial",
"=",
"{",
"}",
"config",
"=",
"DotDict",
"(",
"initial",
")",
"for",
"fn",
"in",
"sources",
":",
"log",
".",
"debug",
"(",
... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | merge_dicts | Merge dictionary d2 into d1, overriding entries in d1 with values from d2.
d1 is mutated.
_path is for internal, recursive use. | yoconfigurator/dicts.py | def merge_dicts(d1, d2, _path=None):
"""
Merge dictionary d2 into d1, overriding entries in d1 with values from d2.
d1 is mutated.
_path is for internal, recursive use.
"""
if _path is None:
_path = ()
if isinstance(d1, dict) and isinstance(d2, dict):
for k, v in d2.items()... | def merge_dicts(d1, d2, _path=None):
"""
Merge dictionary d2 into d1, overriding entries in d1 with values from d2.
d1 is mutated.
_path is for internal, recursive use.
"""
if _path is None:
_path = ()
if isinstance(d1, dict) and isinstance(d2, dict):
for k, v in d2.items()... | [
"Merge",
"dictionary",
"d2",
"into",
"d1",
"overriding",
"entries",
"in",
"d1",
"with",
"values",
"from",
"d2",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/dicts.py#L101-L141 | [
"def",
"merge_dicts",
"(",
"d1",
",",
"d2",
",",
"_path",
"=",
"None",
")",
":",
"if",
"_path",
"is",
"None",
":",
"_path",
"=",
"(",
")",
"if",
"isinstance",
"(",
"d1",
",",
"dict",
")",
"and",
"isinstance",
"(",
"d2",
",",
"dict",
")",
":",
"... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | filter_dict | Return a subset of a dictionary using the specified keys. | yoconfigurator/dicts.py | def filter_dict(unfiltered, filter_keys):
"""Return a subset of a dictionary using the specified keys."""
filtered = DotDict()
for k in filter_keys:
filtered[k] = unfiltered[k]
return filtered | def filter_dict(unfiltered, filter_keys):
"""Return a subset of a dictionary using the specified keys."""
filtered = DotDict()
for k in filter_keys:
filtered[k] = unfiltered[k]
return filtered | [
"Return",
"a",
"subset",
"of",
"a",
"dictionary",
"using",
"the",
"specified",
"keys",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/dicts.py#L144-L149 | [
"def",
"filter_dict",
"(",
"unfiltered",
",",
"filter_keys",
")",
":",
"filtered",
"=",
"DotDict",
"(",
")",
"for",
"k",
"in",
"filter_keys",
":",
"filtered",
"[",
"k",
"]",
"=",
"unfiltered",
"[",
"k",
"]",
"return",
"filtered"
] | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | DotDict._convert_item | Convert obj into a DotDict, or list of DotDict.
Directly nested lists aren't supported.
Returns the result | yoconfigurator/dicts.py | def _convert_item(self, obj):
"""
Convert obj into a DotDict, or list of DotDict.
Directly nested lists aren't supported.
Returns the result
"""
if isinstance(obj, dict) and not isinstance(obj, DotDict):
obj = DotDict(obj)
elif isinstance(obj, list):
... | def _convert_item(self, obj):
"""
Convert obj into a DotDict, or list of DotDict.
Directly nested lists aren't supported.
Returns the result
"""
if isinstance(obj, dict) and not isinstance(obj, DotDict):
obj = DotDict(obj)
elif isinstance(obj, list):
... | [
"Convert",
"obj",
"into",
"a",
"DotDict",
"or",
"list",
"of",
"DotDict",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/dicts.py#L49-L64 | [
"def",
"_convert_item",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"dict",
")",
"and",
"not",
"isinstance",
"(",
"obj",
",",
"DotDict",
")",
":",
"obj",
"=",
"DotDict",
"(",
"obj",
")",
"elif",
"isinstance",
"(",
"obj",
... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | filter_config | Return a config subset using the filter defined in the deploy config. | yoconfigurator/filter.py | def filter_config(config, deploy_config):
"""Return a config subset using the filter defined in the deploy config."""
if not os.path.isfile(deploy_config):
return DotDict()
config_module = get_config_module(deploy_config)
return config_module.filter(config) | def filter_config(config, deploy_config):
"""Return a config subset using the filter defined in the deploy config."""
if not os.path.isfile(deploy_config):
return DotDict()
config_module = get_config_module(deploy_config)
return config_module.filter(config) | [
"Return",
"a",
"config",
"subset",
"using",
"the",
"filter",
"defined",
"in",
"the",
"deploy",
"config",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/filter.py#L8-L13 | [
"def",
"filter_config",
"(",
"config",
",",
"deploy_config",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"deploy_config",
")",
":",
"return",
"DotDict",
"(",
")",
"config_module",
"=",
"get_config_module",
"(",
"deploy_config",
")",
"return... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | seeded_auth_token | Return an auth token based on the client+service+seed tuple. | yoconfigurator/credentials.py | def seeded_auth_token(client, service, seed):
"""Return an auth token based on the client+service+seed tuple."""
hash_func = hashlib.md5()
token = ','.join((client, service, seed)).encode('utf-8')
hash_func.update(token)
return hash_func.hexdigest() | def seeded_auth_token(client, service, seed):
"""Return an auth token based on the client+service+seed tuple."""
hash_func = hashlib.md5()
token = ','.join((client, service, seed)).encode('utf-8')
hash_func.update(token)
return hash_func.hexdigest() | [
"Return",
"an",
"auth",
"token",
"based",
"on",
"the",
"client",
"+",
"service",
"+",
"seed",
"tuple",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/credentials.py#L4-L9 | [
"def",
"seeded_auth_token",
"(",
"client",
",",
"service",
",",
"seed",
")",
":",
"hash_func",
"=",
"hashlib",
".",
"md5",
"(",
")",
"token",
"=",
"','",
".",
"join",
"(",
"(",
"client",
",",
"service",
",",
"seed",
")",
")",
".",
"encode",
"(",
"'... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | write_config | Write configuration to the applicaiton directory. | yoconfigurator/base.py | def write_config(config, app_dir, filename='configuration.json'):
"""Write configuration to the applicaiton directory."""
path = os.path.join(app_dir, filename)
with open(path, 'w') as f:
json.dump(
config, f, indent=4, cls=DetectMissingEncoder,
separators=(',', ': ')) | def write_config(config, app_dir, filename='configuration.json'):
"""Write configuration to the applicaiton directory."""
path = os.path.join(app_dir, filename)
with open(path, 'w') as f:
json.dump(
config, f, indent=4, cls=DetectMissingEncoder,
separators=(',', ': ')) | [
"Write",
"configuration",
"to",
"the",
"applicaiton",
"directory",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/base.py#L27-L33 | [
"def",
"write_config",
"(",
"config",
",",
"app_dir",
",",
"filename",
"=",
"'configuration.json'",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"app_dir",
",",
"filename",
")",
"with",
"open",
"(",
"path",
",",
"'w'",
")",
"as",
"f",
... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | get_config_module | Imports the config file to yoconfigurator.configs.<config_basename>. | yoconfigurator/base.py | def get_config_module(config_pathname):
"""Imports the config file to yoconfigurator.configs.<config_basename>."""
configs_mod = 'yoconfigurator.configs'
if configs_mod not in sys.modules:
sys.modules[configs_mod] = types.ModuleType(configs_mod)
module_name = os.path.basename(config_pathname).rs... | def get_config_module(config_pathname):
"""Imports the config file to yoconfigurator.configs.<config_basename>."""
configs_mod = 'yoconfigurator.configs'
if configs_mod not in sys.modules:
sys.modules[configs_mod] = types.ModuleType(configs_mod)
module_name = os.path.basename(config_pathname).rs... | [
"Imports",
"the",
"config",
"file",
"to",
"yoconfigurator",
".",
"configs",
".",
"<config_basename",
">",
"."
] | yola/yoconfigurator | python | https://github.com/yola/yoconfigurator/blob/dfb60fa1e30ae7cfec2526bb101fc205f5952639/yoconfigurator/base.py#L42-L49 | [
"def",
"get_config_module",
"(",
"config_pathname",
")",
":",
"configs_mod",
"=",
"'yoconfigurator.configs'",
"if",
"configs_mod",
"not",
"in",
"sys",
".",
"modules",
":",
"sys",
".",
"modules",
"[",
"configs_mod",
"]",
"=",
"types",
".",
"ModuleType",
"(",
"c... | dfb60fa1e30ae7cfec2526bb101fc205f5952639 |
valid | validate_date | Return True if valid, raise ValueError if not | pypinfo/core.py | def validate_date(date_text):
"""Return True if valid, raise ValueError if not"""
try:
if int(date_text) < 0:
return True
except ValueError:
pass
try:
datetime.strptime(date_text, '%Y-%m-%d')
return True
except ValueError:
pass
raise ValueErr... | def validate_date(date_text):
"""Return True if valid, raise ValueError if not"""
try:
if int(date_text) < 0:
return True
except ValueError:
pass
try:
datetime.strptime(date_text, '%Y-%m-%d')
return True
except ValueError:
pass
raise ValueErr... | [
"Return",
"True",
"if",
"valid",
"raise",
"ValueError",
"if",
"not"
] | ofek/pypinfo | python | https://github.com/ofek/pypinfo/blob/48d56e690d7667ae5854752c3a2dc07e321d5637/pypinfo/core.py#L48-L62 | [
"def",
"validate_date",
"(",
"date_text",
")",
":",
"try",
":",
"if",
"int",
"(",
"date_text",
")",
"<",
"0",
":",
"return",
"True",
"except",
"ValueError",
":",
"pass",
"try",
":",
"datetime",
".",
"strptime",
"(",
"date_text",
",",
"'%Y-%m-%d'",
")",
... | 48d56e690d7667ae5854752c3a2dc07e321d5637 |
valid | get_download_total | Return the total downloads, and the downloads column | pypinfo/core.py | def get_download_total(rows):
"""Return the total downloads, and the downloads column"""
headers = rows.pop(0)
index = headers.index('download_count')
total_downloads = sum(int(row[index]) for row in rows)
rows.insert(0, headers)
return total_downloads, index | def get_download_total(rows):
"""Return the total downloads, and the downloads column"""
headers = rows.pop(0)
index = headers.index('download_count')
total_downloads = sum(int(row[index]) for row in rows)
rows.insert(0, headers)
return total_downloads, index | [
"Return",
"the",
"total",
"downloads",
"and",
"the",
"downloads",
"column"
] | ofek/pypinfo | python | https://github.com/ofek/pypinfo/blob/48d56e690d7667ae5854752c3a2dc07e321d5637/pypinfo/core.py#L163-L170 | [
"def",
"get_download_total",
"(",
"rows",
")",
":",
"headers",
"=",
"rows",
".",
"pop",
"(",
"0",
")",
"index",
"=",
"headers",
".",
"index",
"(",
"'download_count'",
")",
"total_downloads",
"=",
"sum",
"(",
"int",
"(",
"row",
"[",
"index",
"]",
")",
... | 48d56e690d7667ae5854752c3a2dc07e321d5637 |
valid | add_download_total | Add a final row to rows showing the total downloads | pypinfo/core.py | def add_download_total(rows):
"""Add a final row to rows showing the total downloads"""
total_row = [""] * len(rows[0])
total_row[0] = "Total"
total_downloads, downloads_column = get_download_total(rows)
total_row[downloads_column] = str(total_downloads)
rows.append(total_row)
return rows | def add_download_total(rows):
"""Add a final row to rows showing the total downloads"""
total_row = [""] * len(rows[0])
total_row[0] = "Total"
total_downloads, downloads_column = get_download_total(rows)
total_row[downloads_column] = str(total_downloads)
rows.append(total_row)
return rows | [
"Add",
"a",
"final",
"row",
"to",
"rows",
"showing",
"the",
"total",
"downloads"
] | ofek/pypinfo | python | https://github.com/ofek/pypinfo/blob/48d56e690d7667ae5854752c3a2dc07e321d5637/pypinfo/core.py#L173-L181 | [
"def",
"add_download_total",
"(",
"rows",
")",
":",
"total_row",
"=",
"[",
"\"\"",
"]",
"*",
"len",
"(",
"rows",
"[",
"0",
"]",
")",
"total_row",
"[",
"0",
"]",
"=",
"\"Total\"",
"total_downloads",
",",
"downloads_column",
"=",
"get_download_total",
"(",
... | 48d56e690d7667ae5854752c3a2dc07e321d5637 |
valid | pypinfo | Valid fields are:\n
project | version | file | pyversion | percent3 | percent2 | impl | impl-version |\n
openssl | date | month | year | country | installer | installer-version |\n
setuptools-version | system | system-release | distro | distro-version | cpu | pypinfo/cli.py | def pypinfo(
ctx,
project,
fields,
auth,
run,
json,
indent,
timeout,
limit,
days,
start_date,
end_date,
where,
order,
all_installers,
percent,
markdown,
):
"""Valid fields are:\n
project | version | file | pyversion | percent3 | percent2 | impl... | def pypinfo(
ctx,
project,
fields,
auth,
run,
json,
indent,
timeout,
limit,
days,
start_date,
end_date,
where,
order,
all_installers,
percent,
markdown,
):
"""Valid fields are:\n
project | version | file | pyversion | percent3 | percent2 | impl... | [
"Valid",
"fields",
"are",
":",
"\\",
"n",
"project",
"|",
"version",
"|",
"file",
"|",
"pyversion",
"|",
"percent3",
"|",
"percent2",
"|",
"impl",
"|",
"impl",
"-",
"version",
"|",
"\\",
"n",
"openssl",
"|",
"date",
"|",
"month",
"|",
"year",
"|",
... | ofek/pypinfo | python | https://github.com/ofek/pypinfo/blob/48d56e690d7667ae5854752c3a2dc07e321d5637/pypinfo/cli.py#L89-L194 | [
"def",
"pypinfo",
"(",
"ctx",
",",
"project",
",",
"fields",
",",
"auth",
",",
"run",
",",
"json",
",",
"indent",
",",
"timeout",
",",
"limit",
",",
"days",
",",
"start_date",
",",
"end_date",
",",
"where",
",",
"order",
",",
"all_installers",
",",
"... | 48d56e690d7667ae5854752c3a2dc07e321d5637 |
valid | find_and_patch_entry | Modify soup so Dash.app can generate TOCs on the fly. | src/doc2dash/parsers/intersphinx.py | def find_and_patch_entry(soup, entry):
"""
Modify soup so Dash.app can generate TOCs on the fly.
"""
link = soup.find("a", {"class": "headerlink"}, href="#" + entry.anchor)
tag = soup.new_tag("a")
tag["name"] = APPLE_REF_TEMPLATE.format(entry.type, entry.name)
if link:
link.parent.in... | def find_and_patch_entry(soup, entry):
"""
Modify soup so Dash.app can generate TOCs on the fly.
"""
link = soup.find("a", {"class": "headerlink"}, href="#" + entry.anchor)
tag = soup.new_tag("a")
tag["name"] = APPLE_REF_TEMPLATE.format(entry.type, entry.name)
if link:
link.parent.in... | [
"Modify",
"soup",
"so",
"Dash",
".",
"app",
"can",
"generate",
"TOCs",
"on",
"the",
"fly",
"."
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/parsers/intersphinx.py#L104-L118 | [
"def",
"find_and_patch_entry",
"(",
"soup",
",",
"entry",
")",
":",
"link",
"=",
"soup",
".",
"find",
"(",
"\"a\"",
",",
"{",
"\"class\"",
":",
"\"headerlink\"",
"}",
",",
"href",
"=",
"\"#\"",
"+",
"entry",
".",
"anchor",
")",
"tag",
"=",
"soup",
".... | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | inv_entry_to_path | Determine the path from the intersphinx inventory entry
Discard the anchors between head and tail to make it
compatible with situations where extra meta information is encoded. | src/doc2dash/parsers/intersphinx.py | def inv_entry_to_path(data):
"""
Determine the path from the intersphinx inventory entry
Discard the anchors between head and tail to make it
compatible with situations where extra meta information is encoded.
"""
path_tuple = data[2].split("#")
if len(path_tuple) > 1:
path_str = "#... | def inv_entry_to_path(data):
"""
Determine the path from the intersphinx inventory entry
Discard the anchors between head and tail to make it
compatible with situations where extra meta information is encoded.
"""
path_tuple = data[2].split("#")
if len(path_tuple) > 1:
path_str = "#... | [
"Determine",
"the",
"path",
"from",
"the",
"intersphinx",
"inventory",
"entry"
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/parsers/intersphinx.py#L121-L133 | [
"def",
"inv_entry_to_path",
"(",
"data",
")",
":",
"path_tuple",
"=",
"data",
"[",
"2",
"]",
".",
"split",
"(",
"\"#\"",
")",
"if",
"len",
"(",
"path_tuple",
")",
">",
"1",
":",
"path_str",
"=",
"\"#\"",
".",
"join",
"(",
"(",
"path_tuple",
"[",
"0... | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | main | Convert docs from SOURCE to Dash.app's docset format. | src/doc2dash/__main__.py | def main(
source,
force,
name,
quiet,
verbose,
destination,
add_to_dash,
add_to_global,
icon,
index_page,
enable_js,
online_redirect_url,
parser,
):
"""
Convert docs from SOURCE to Dash.app's docset format.
"""
try:
logging.config.dictConfig(
... | def main(
source,
force,
name,
quiet,
verbose,
destination,
add_to_dash,
add_to_global,
icon,
index_page,
enable_js,
online_redirect_url,
parser,
):
"""
Convert docs from SOURCE to Dash.app's docset format.
"""
try:
logging.config.dictConfig(
... | [
"Convert",
"docs",
"from",
"SOURCE",
"to",
"Dash",
".",
"app",
"s",
"docset",
"format",
"."
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/__main__.py#L140-L236 | [
"def",
"main",
"(",
"source",
",",
"force",
",",
"name",
",",
"quiet",
",",
"verbose",
",",
"destination",
",",
"add_to_dash",
",",
"add_to_global",
",",
"icon",
",",
"index_page",
",",
"enable_js",
",",
"online_redirect_url",
",",
"parser",
",",
")",
":",... | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | create_log_config | We use logging's levels as an easy-to-use verbosity controller. | src/doc2dash/__main__.py | def create_log_config(verbose, quiet):
"""
We use logging's levels as an easy-to-use verbosity controller.
"""
if verbose and quiet:
raise ValueError(
"Supplying both --quiet and --verbose makes no sense."
)
elif verbose:
level = logging.DEBUG
elif quiet:
... | def create_log_config(verbose, quiet):
"""
We use logging's levels as an easy-to-use verbosity controller.
"""
if verbose and quiet:
raise ValueError(
"Supplying both --quiet and --verbose makes no sense."
)
elif verbose:
level = logging.DEBUG
elif quiet:
... | [
"We",
"use",
"logging",
"s",
"levels",
"as",
"an",
"easy",
"-",
"to",
"-",
"use",
"verbosity",
"controller",
"."
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/__main__.py#L239-L267 | [
"def",
"create_log_config",
"(",
"verbose",
",",
"quiet",
")",
":",
"if",
"verbose",
"and",
"quiet",
":",
"raise",
"ValueError",
"(",
"\"Supplying both --quiet and --verbose makes no sense.\"",
")",
"elif",
"verbose",
":",
"level",
"=",
"logging",
".",
"DEBUG",
"e... | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | setup_paths | Determine source and destination using the options. | src/doc2dash/__main__.py | def setup_paths(source, destination, name, add_to_global, force):
"""
Determine source and destination using the options.
"""
if source[-1] == "/":
source = source[:-1]
if not name:
name = os.path.split(source)[-1]
elif name.endswith(".docset"):
name = name.replace(".docs... | def setup_paths(source, destination, name, add_to_global, force):
"""
Determine source and destination using the options.
"""
if source[-1] == "/":
source = source[:-1]
if not name:
name = os.path.split(source)[-1]
elif name.endswith(".docset"):
name = name.replace(".docs... | [
"Determine",
"source",
"and",
"destination",
"using",
"the",
"options",
"."
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/__main__.py#L270-L293 | [
"def",
"setup_paths",
"(",
"source",
",",
"destination",
",",
"name",
",",
"add_to_global",
",",
"force",
")",
":",
"if",
"source",
"[",
"-",
"1",
"]",
"==",
"\"/\"",
":",
"source",
"=",
"source",
"[",
":",
"-",
"1",
"]",
"if",
"not",
"name",
":",
... | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | prepare_docset | Create boilerplate files & directories and copy vanilla docs inside.
Return a tuple of path to resources and connection to sqlite db. | src/doc2dash/__main__.py | def prepare_docset(
source, dest, name, index_page, enable_js, online_redirect_url
):
"""
Create boilerplate files & directories and copy vanilla docs inside.
Return a tuple of path to resources and connection to sqlite db.
"""
resources = os.path.join(dest, "Contents", "Resources")
docs = ... | def prepare_docset(
source, dest, name, index_page, enable_js, online_redirect_url
):
"""
Create boilerplate files & directories and copy vanilla docs inside.
Return a tuple of path to resources and connection to sqlite db.
"""
resources = os.path.join(dest, "Contents", "Resources")
docs = ... | [
"Create",
"boilerplate",
"files",
"&",
"directories",
"and",
"copy",
"vanilla",
"docs",
"inside",
"."
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/__main__.py#L308-L346 | [
"def",
"prepare_docset",
"(",
"source",
",",
"dest",
",",
"name",
",",
"index_page",
",",
"enable_js",
",",
"online_redirect_url",
")",
":",
"resources",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dest",
",",
"\"Contents\"",
",",
"\"Resources\"",
")",
"doc... | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | add_icon | Add icon to docset | src/doc2dash/__main__.py | def add_icon(icon_data, dest):
"""
Add icon to docset
"""
with open(os.path.join(dest, "icon.png"), "wb") as f:
f.write(icon_data) | def add_icon(icon_data, dest):
"""
Add icon to docset
"""
with open(os.path.join(dest, "icon.png"), "wb") as f:
f.write(icon_data) | [
"Add",
"icon",
"to",
"docset"
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/__main__.py#L349-L354 | [
"def",
"add_icon",
"(",
"icon_data",
",",
"dest",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dest",
",",
"\"icon.png\"",
")",
",",
"\"wb\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"icon_data",
")"
] | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | patch_anchors | Consume ``ParseEntry``s then patch docs for TOCs by calling
*parser*'s ``find_and_patch_entry``. | src/doc2dash/parsers/utils.py | def patch_anchors(parser, show_progressbar):
"""
Consume ``ParseEntry``s then patch docs for TOCs by calling
*parser*'s ``find_and_patch_entry``.
"""
files = defaultdict(list)
try:
while True:
pentry = (yield)
try:
fname, anchor = pentry.path.split... | def patch_anchors(parser, show_progressbar):
"""
Consume ``ParseEntry``s then patch docs for TOCs by calling
*parser*'s ``find_and_patch_entry``.
"""
files = defaultdict(list)
try:
while True:
pentry = (yield)
try:
fname, anchor = pentry.path.split... | [
"Consume",
"ParseEntry",
"s",
"then",
"patch",
"docs",
"for",
"TOCs",
"by",
"calling",
"*",
"parser",
"*",
"s",
"find_and_patch_entry",
"."
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/parsers/utils.py#L89-L133 | [
"def",
"patch_anchors",
"(",
"parser",
",",
"show_progressbar",
")",
":",
"files",
"=",
"defaultdict",
"(",
"list",
")",
"try",
":",
"while",
"True",
":",
"pentry",
"=",
"(",
"yield",
")",
"try",
":",
"fname",
",",
"anchor",
"=",
"pentry",
".",
"path",... | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | has_file_with | Check whether *filename* in *path* contains the string *content*. | src/doc2dash/parsers/utils.py | def has_file_with(path, filename, content):
"""
Check whether *filename* in *path* contains the string *content*.
"""
try:
with open(os.path.join(path, filename), "rb") as f:
return content in f.read()
except IOError as e:
if e.errno == errno.ENOENT:
return Fa... | def has_file_with(path, filename, content):
"""
Check whether *filename* in *path* contains the string *content*.
"""
try:
with open(os.path.join(path, filename), "rb") as f:
return content in f.read()
except IOError as e:
if e.errno == errno.ENOENT:
return Fa... | [
"Check",
"whether",
"*",
"filename",
"*",
"in",
"*",
"path",
"*",
"contains",
"the",
"string",
"*",
"content",
"*",
"."
] | hynek/doc2dash | python | https://github.com/hynek/doc2dash/blob/659a66e237eb0faa08e81094fc4140623b418952/src/doc2dash/parsers/utils.py#L136-L147 | [
"def",
"has_file_with",
"(",
"path",
",",
"filename",
",",
"content",
")",
":",
"try",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"filename",
")",
",",
"\"rb\"",
")",
"as",
"f",
":",
"return",
"content",
"in",
"f",
... | 659a66e237eb0faa08e81094fc4140623b418952 |
valid | Bdb.run_cell | Run the Cell code using the IPython globals and locals
Args:
cell (str): Python code to be executed | nbtutor/ipython/debugger.py | def run_cell(self, cell):
"""Run the Cell code using the IPython globals and locals
Args:
cell (str): Python code to be executed
"""
globals = self.ipy_shell.user_global_ns
locals = self.ipy_shell.user_ns
globals.update({
"__ipy_scope__": None,
... | def run_cell(self, cell):
"""Run the Cell code using the IPython globals and locals
Args:
cell (str): Python code to be executed
"""
globals = self.ipy_shell.user_global_ns
locals = self.ipy_shell.user_ns
globals.update({
"__ipy_scope__": None,
... | [
"Run",
"the",
"Cell",
"code",
"using",
"the",
"IPython",
"globals",
"and",
"locals"
] | lgpage/nbtutor | python | https://github.com/lgpage/nbtutor/blob/07798a044cf6e1fd4eaac2afddeef3e13348dbcd/nbtutor/ipython/debugger.py#L35-L54 | [
"def",
"run_cell",
"(",
"self",
",",
"cell",
")",
":",
"globals",
"=",
"self",
".",
"ipy_shell",
".",
"user_global_ns",
"locals",
"=",
"self",
".",
"ipy_shell",
".",
"user_ns",
"globals",
".",
"update",
"(",
"{",
"\"__ipy_scope__\"",
":",
"None",
",",
"}... | 07798a044cf6e1fd4eaac2afddeef3e13348dbcd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.