Search is not available for this dataset
text stringlengths 75 104k |
|---|
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 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 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 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 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 get_recovered_variables_for_magbin(simbasedir,
magbinmedian,
stetson_stdev_min=2.0,
inveta_stdev_min=2.0,
iqr_stdev_min=2.0,
... |
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 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 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 run_periodfinding(simbasedir,
pfmethods=('gls','pdm','bls'),
pfkwargs=({},{},{'startp':1.0,'maxtransitduration':0.3}),
getblssnr=False,
sigclip=5.0,
nperiodworkers=10,
ncontrolworkers=... |
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 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 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 parallel_periodicvar_recovery(simbasedir,
period_tolerance=1.0e-3,
liststartind=None,
listmaxobjects=None,
nworkers=None):
'''This is a parallel driver for `periodicvar_recover... |
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 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 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_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_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 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 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_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 _make_periodogram(axes,
lspinfo,
objectinfo,
findercmap,
finderconvolve,
verbose=True,
findercachedir='~/.astrobase/stamp-cache'):
'''Makes periodogram, objectinfo, and finder tile... |
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_phased_magseries_plot(axes,
periodind,
stimes, smags, serrs,
varperiod, varepoch,
phasewrap, phasesort,
phasebin, minbinelems,
... |
def checkplot_png(lspinfo,
times,
mags,
errs,
varepoch='min',
magsarefluxes=False,
objectinfo=None,
findercmap='gray_r',
finderconvolve=None,
findercachedir='... |
def twolsp_checkplot_png(lspinfo1,
lspinfo2,
times,
mags,
errs,
varepoch='min',
magsarefluxes=False,
objectinfo=None,
fi... |
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 _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 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 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 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 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_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 _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 make_lclist(basedir,
outfile,
use_list_of_filenames=None,
lcformat='hat-sql',
lcformatdir=None,
fileglob=None,
recursive=True,
columns=['objectid',
'objectinfo.ra',
... |
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 _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 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 variability_threshold(featuresdir,
outfile,
magbins=DEFAULT_MAGBINS,
maxobjects=None,
timecols=None,
magcols=None,
errcols=None,
lcfor... |
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 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 _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(MapPolygon, self)._update_proxy(change) |
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 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 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_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_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 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_clicked(self, pos):
""" Called when the map is clicked """
d = self.declaration
d.clicked({
'click': 'short',
'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)
}) |
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 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 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, 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 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 data(self, X=None, y=None, sentences=None):
"""
Add data to flow
"""
self.X = X
self.y = y
self.sentences = sentences |
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 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 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 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(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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 _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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.