Search is not available for this dataset
text stringlengths 75 104k |
|---|
def get_available_reports(self, account_id):
"""
Returns the list of reports for the canvas account id.
https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.available_reports
"""
url = ACCOUNTS_API.format(account_id) + "/reports"
report_typ... |
def get_reports_by_type(self, account_id, report_type):
"""
Shows all reports of the passed report_type that have been run
for the canvas account id.
https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.index
"""
url = ACCOUNTS_API.format(ac... |
def create_report(self, report_type, account_id, term_id=None, params={}):
"""
Generates a report instance for the canvas account id.
https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create
"""
if term_id is not None:
params["enrollm... |
def create_course_provisioning_report(self, account_id, term_id=None,
params={}):
"""
Convenience method for create_report, for creating a course
provisioning report.
"""
params["courses"] = True
return self.create_report(ReportTy... |
def create_course_sis_export_report(self, account_id, term_id=None,
params={}):
"""
Convenience method for create_report, for creating a course sis export
report.
"""
params["courses"] = True
return self.create_report(ReportType.SIS... |
def create_unused_courses_report(self, account_id, term_id=None):
"""
Convenience method for create_report, for creating an unused courses
report.
"""
return self.create_report(ReportType.UNUSED_COURSES, account_id,
term_id) |
def get_report_data(self, report):
"""
Returns a completed report as a list of csv strings.
"""
if report.report_id is None or report.status is None:
raise ReportFailureException(report)
interval = getattr(settings, 'CANVAS_REPORT_POLLING_INTERVAL', 5)
while ... |
def get_report_status(self, report):
"""
Returns the status of a report.
https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.show
"""
if (report.account_id is None or report.type is None or
report.report_id is None):
rai... |
def delete_report(self, report):
"""
Deletes a generated report instance.
https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.destroy
"""
url = ACCOUNTS_API.format(report.account_id) + "/reports/{}/{}".format(
report.type, report.report... |
def crop_image(img, start_y, start_x, h, w):
"""
Crop an image given the top left corner.
:param img: The image
:param start_y: The top left corner y coord
:param start_x: The top left corner x coord
:param h: The result height
:param w: The result width
:return: The cropped image.
"... |
def move_detections(label, dy, dx):
"""
Move detections in direction dx, dy.
:param label: The label dict containing all detection lists.
:param dy: The delta in y direction as a number.
:param dx: The delta in x direction as a number.
:return:
"""
for k in label.keys():
if k.st... |
def hflip_detections(label, w):
"""
Horizontally flip detections according to an image flip.
:param label: The label dict containing all detection lists.
:param w: The width of the image as a number.
:return:
"""
for k in label.keys():
if k.startswith("detection"):
detec... |
def augment_detections(hyper_params, feature, label):
"""
Augment the detection dataset.
In your hyper_parameters.problem.augmentation add configurations to enable features.
Supports "enable_horizontal_flip", "enable_micro_translation", "random_crop" : {"shape": { "width", "height" }}
and "enable_t... |
def get_dict_from_obj(obj):
'''
Edit to get the dict even when the object is a GenericRelatedObjectManager.
Added the try except.
'''
obj_dict = obj.__dict__
obj_dict_result = obj_dict.copy()
for key, value in obj_dict.items():
if key.endswith('_id'):
key2 = key.replace('... |
def get_config(self, request, **kwargs):
"""
Get the arguments given to the template tag element and complete these
with the ones from the settings.py if necessary.
"""
config = kwargs
config_from_settings = deepcopy(inplace_settings.DEFAULT_INPLACE_EDIT_OPTIONS)
... |
def empty_value(self):
'''
Get the text to display when the field is empty.
'''
edit_empty_value = self.config.get('edit_empty_value', False)
if edit_empty_value:
return edit_empty_value
else:
return unicode(inplace_settings.INPLACEEDIT_EDIT_EMPTY_... |
def do_eval(parser, token):
"Usage: {% eval %}1 + 1{% endeval %}"
nodelist = parser.parse(('endeval',))
class EvalNode(template.Node):
def render(self, context):
return template.Template(nodelist.render(context)).render(template.Context(context))
parser.delete_first_token()
ret... |
def parse_args_kwargs(parser, token):
"""
Parse uniformly args and kwargs from a templatetag
Usage::
For parsing a template like this:
{% footag my_contents,height=10,zoom=20 as myvar %}
You simply do this:
@register.tag
def footag(parser, token):
args, kwargs = ... |
def create_metrics(
self, metric_configs: Iterable[MetricConfig]) -> Dict[str, Metric]:
"""Create and register metrics from a list of MetricConfigs."""
return self.registry.create_metrics(metric_configs) |
def _setup_logging(self, log_level: str):
"""Setup logging for the application and aiohttp."""
level = getattr(logging, log_level)
names = (
'aiohttp.access', 'aiohttp.internal', 'aiohttp.server',
'aiohttp.web', self.name)
for name in names:
setup_logg... |
def _configure_registry(self, include_process_stats: bool = False):
"""Configure the MetricRegistry."""
if include_process_stats:
self.registry.register_additional_collector(
ProcessCollector(registry=None)) |
def _get_exporter(self, args: argparse.Namespace) -> PrometheusExporter:
"""Return a :class:`PrometheusExporter` configured with args."""
exporter = PrometheusExporter(
self.name, self.description, args.host, args.port, self.registry)
exporter.app.on_startup.append(self.on_applicatio... |
def create_metrics(self,
configs: Iterable[MetricConfig]) -> Dict[str, Metric]:
"""Create Prometheus metrics from a list of MetricConfigs."""
metrics: Dict[str, Metric] = {
config.name: self._register_metric(config)
for config in configs
}
s... |
def get_metric(
self, name: str,
labels: Union[Dict[str, str], None] = None) -> Metric:
"""Return a metric, optionally configured with labels."""
metric = self._metrics[name]
if labels:
return metric.labels(**labels)
return metric |
def run(self):
"""Run the :class:`aiohttp.web.Application` for the exporter."""
run_app(
self.app,
host=self.host,
port=self.port,
print=lambda *args, **kargs: None,
access_log_format='%a "%r" %s %b "%{Referrer}i" "%{User-Agent}i"') |
def _make_application(self) -> Application:
"""Setup an :class:`aiohttp.web.Application`."""
app = Application()
app['exporter'] = self
app.router.add_get('/', self._handle_home)
app.router.add_get('/metrics', self._handle_metrics)
app.on_startup.append(self._log_startup_... |
async def _handle_home(self, request: Request) -> Response:
"""Home page request handler."""
if self.description:
title = f'{self.name} - {self.description}'
else:
title = self.name
text = dedent(
f'''<!DOCTYPE html>
<html>
<... |
async def _handle_metrics(self, request: Request) -> Response:
"""Handler for metrics."""
if self._update_handler:
await self._update_handler(self.registry.get_metrics())
response = Response(body=self.registry.generate_metrics())
response.content_type = CONTENT_TYPE_LATEST
... |
def wa(client, event, channel, nick, rest):
"""
A free-text query resolver by Wolfram|Alpha. Returns the first
result, if available.
"""
client = wolframalpha.Client(pmxbot.config['Wolfram|Alpha API key'])
res = client.query(rest)
return next(res.results).text |
def fix_HTTPMessage():
"""
Python 2 uses a deprecated method signature and doesn't provide the
forward compatibility.
Add it.
"""
if six.PY3:
return
http_client.HTTPMessage.get_content_type = http_client.HTTPMessage.gettype
http_client.HTTPMessage.get_param = http_client.HTTPMessage.getparam |
def query(self, input, params=(), **kwargs):
"""
Query Wolfram|Alpha using the v2.0 API
Allows for arbitrary parameters to be passed in
the query. For example, to pass assumptions:
client.query(input='pi', assumption='*C.pi-_*NamedConstant-')
To pass multiple assum... |
def info(self):
"""
The pods, assumptions, and warnings of this result.
"""
return itertools.chain(self.pods, self.assumptions, self.warnings) |
def results(self):
"""
The pods that hold the response to a simple, discrete query.
"""
return (
pod
for pod in self.pods
if pod.primary
or pod.title == 'Result'
) |
def encode(request, data):
""" Add request content data to request body, set Content-type header.
Should be overridden by subclasses if not using JSON encoding.
Args:
request (HTTPRequest): The request object.
data (dict, None): Data to be encoded.
Returns:
... |
def call_api(
self,
method,
url,
headers=None,
params=None,
data=None,
files=None,
timeout=None,
):
""" Call API.
This returns object containing data, with error details if applicable.
Args:
... |
def get(self, url, params=None, **kwargs):
""" Call the API with a GET request.
Args:
url (str): Resource location relative to the base URL.
params (dict or None): Query-string parameters.
Returns:
ResultParser or ErrorParser.
"""
return self... |
def delete(self, url, params=None, **kwargs):
""" Call the API with a DELETE request.
Args:
url (str): Resource location relative to the base URL.
params (dict or None): Query-string parameters.
Returns:
ResultParser or ErrorParser.
"""
retur... |
def put(self, url, params=None, data=None, files=None, **kwargs):
""" Call the API with a PUT request.
Args:
url (str): Resource location relative to the base URL.
params (dict or None): Query-string parameters.
data (dict or None): Request body contents.
... |
def post(self, url, params=None, data=None, files=None, **kwargs):
""" Call the API with a POST request.
Args:
url (str): Resource location relative to the base URL.
params (dict or None): Query-string parameters.
data (dict or None): Request body contents.
... |
def _process_query(self, query, prepared=False):
""" Process query recursively, if the text is too long,
it is split and processed bit a bit.
Args:
query (sdict): Text to be processed.
prepared (bool): True when the query is ready to be submitted via
POST req... |
def _group_sentences(total_nb_sentences, group_length):
""" Split sentences in groups, given a specific group length.
Args:
total_nb_sentences (int): Total available sentences.
group_length (int): Limit of length for each group.
Returns:
list: Contains group... |
def disambiguate_pdf(self, file, language=None, entities=None):
""" Call the disambiguation service in order to process a pdf file .
Args:
pdf (file): PDF file to be disambiguated.
language (str): language of text (if known)
Returns:
dict, int: API response ... |
def disambiguate_terms(self, terms, language="en", entities=None):
""" Call the disambiguation service in order to get meanings.
Args:
terms (obj): list of objects of term, weight
language (str): language of text, english if not specified
entities (li... |
def disambiguate_text(self, text, language=None, entities=None):
""" Call the disambiguation service in order to get meanings.
Args:
text (str): Text to be disambiguated.
language (str): language of text (if known)
entities (list): list of entities or mentions to be ... |
def disambiguate_query(self, query, language=None, entities=None):
""" Call the disambiguation service in order to disambiguate a search query.
Args:
text (str): Query to be disambiguated.
language (str): language of text (if known)
entities (list): list of entities ... |
def segment(self, text):
""" Call the segmenter in order to split text in sentences.
Args:
text (str): Text to be segmented.
Returns:
dict, int: A dict containing a list of dicts with the offsets of
each sentence; an integer representing the response cod... |
def get_language(self, text):
""" Recognise the language of the text in input
Args:
id (str): The text whose the language needs to be recognised
Returns:
dict, int: A dict containing the recognised language and the
confidence score.
"""
... |
def get_concept(self, conceptId, lang='en'):
""" Fetch the concept from the Knowledge base
Args:
id (str): The concept id to be fetched, it can be Wikipedia
page id or Wikiedata id.
Returns:
dict, int: A dict containing the concept information; an inte... |
def fit(self, features, classes):
"""Constructs the MDR ensemble from the provided training data
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
classes: array-like {n_samples}
List of class labels for prediction
... |
def score(self, features, classes, scoring_function=None, **scoring_function_kwargs):
"""Estimates the accuracy of the predictions from the MDR ensemble
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix to predict from
classes: array-l... |
def fit(self, features, class_labels):
"""Constructs the MDR feature map from the provided training data.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
class_labels: array-like {n_samples}
List of true class labels
... |
def fit_transform(self, features, class_labels):
"""Convenience function that fits the provided data then constructs a new feature from the provided features.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
class_labels: array-like {... |
def fit_predict(self, features, class_labels):
"""Convenience function that fits the provided data then constructs predictions from the provided features.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
class_labels: array-like {n_sa... |
def score(self, features, class_labels, scoring_function=None, **scoring_function_kwargs):
"""Estimates the accuracy of the predictions from the constructed feature.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix to predict from
cla... |
def fit(self, features, targets):
"""Constructs the Continuous MDR feature map from the provided training data.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
targets: array-like {n_samples}
List of target values for pre... |
def transform(self, features):
"""Uses the Continuous MDR feature map to construct a new feature from the provided features.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix to transform
Returns
----------
array-like:... |
def fit_transform(self, features, targets):
"""Convenience function that fits the provided data then constructs a new feature from the provided features.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
targets: array-like {n_samples}... |
def score(self, features, targets):
"""Estimates the quality of the ContinuousMDR model using a t-statistic.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix to predict from
targets: array-like {n_samples}
List of true tar... |
def entropy(X, base=2):
"""Calculates the entropy, H(X), in the given base
Parameters
----------
X: array-like (# samples)
An array of values for which to compute the entropy
base: integer (default: 2)
The base in which to calculate entropy
Returns
----------
entropy: f... |
def joint_entropy(X, Y, base=2):
"""Calculates the joint entropy, H(X,Y), in the given base
Parameters
----------
X: array-like (# samples)
An array of values for which to compute the joint entropy
Y: array-like (# samples)
An array of values for which to compute the joint entropy
... |
def conditional_entropy(X, Y, base=2):
"""Calculates the conditional entropy, H(X|Y), in the given base
Parameters
----------
X: array-like (# samples)
An array of values for which to compute the conditional entropy
Y: array-like (# samples)
An array of values for which to compute t... |
def mutual_information(X, Y, base=2):
"""Calculates the mutual information between two variables, I(X;Y), in the given base
Parameters
----------
X: array-like (# samples)
An array of values for which to compute the mutual information
Y: array-like (# samples)
An array of values for... |
def two_way_information_gain(X, Y, Z, base=2):
"""Calculates the two-way information gain between three variables, I(X;Y;Z), in the given base
IG(X;Y;Z) indicates the information gained about variable Z by the joint variable X_Y, after removing
the information that X and Y have about Z individually. Thus, ... |
def three_way_information_gain(W, X, Y, Z, base=2):
"""Calculates the three-way information gain between three variables, I(W;X;Y;Z), in the given base
IG(W;X;Y;Z) indicates the information gained about variable Z by the joint variable W_X_Y, after removing
the information that W, X, and Y have about Z ind... |
def _mdr_predict(X, Y, labels):
"""Fits a MDR model to variables X and Y with the given labels, then returns the resulting predictions
This is a convenience method that should only be used internally.
Parameters
----------
X: array-like (# samples)
An array of values corresponding to one f... |
def mdr_entropy(X, Y, labels, base=2):
"""Calculates the MDR entropy, H(XY), in the given base
MDR entropy is calculated by combining variables X and Y into a single MDR model then calculating
the entropy of the resulting model's predictions.
Parameters
----------
X: array-like (# samples)
... |
def mdr_conditional_entropy(X, Y, labels, base=2):
"""Calculates the MDR conditional entropy, H(XY|labels), in the given base
MDR conditional entropy is calculated by combining variables X and Y into a single MDR model then calculating
the entropy of the resulting model's predictions conditional on the pro... |
def mdr_mutual_information(X, Y, labels, base=2):
"""Calculates the MDR mutual information, I(XY;labels), in the given base
MDR mutual information is calculated by combining variables X and Y into a single MDR model then calculating
the mutual information between the resulting model's predictions and the l... |
def n_way_models(mdr_instance, X, y, n=[2], feature_names=None):
"""Fits a MDR model to all n-way combinations of the features in X.
Note that this function performs an exhaustive search through all feature combinations and can be computationally expensive.
Parameters
----------
mdr_instance: obje... |
def plot_mdr_grid(mdr_instance):
"""Visualizes the MDR grid of a given fitted MDR instance. Only works for 2-way MDR models.
This function is currently incomplete.
Parameters
----------
mdr_instance: object
A fitted instance of the MDR type to visualize.
Returns
----------
... |
def makemigrations(migrations_root):
"""等价于 django makemigrations 操作"""
from flask_migrate import (Migrate, init as migrate_init,
migrate as migrate_exec)
migrations_root = migrations_root or os.path.join(
os.environ.get('FANTASY_MIGRATION_PATH',
... |
def migrate(migrations_root):
"""等价于 django migrate 操作"""
from flask_migrate import Migrate, upgrade as migrate_upgrade
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.engine.url import make_url
from sqlalchemy_utils import database_exists, create_database
db = SQLAlchemy()
dsn = ma... |
def requirements(work_dir, hive_root, with_requirements,
with_dockerfile, active_module, active_module_file):
"""编译全新依赖文件"""
import sys
sys.path.insert(0, hive_root)
hive_root = os.path.abspath(os.path.expanduser(hive_root))
work_dir = work_dir or os.path.join(
os.environ.... |
def queue(celery_arguments):
"""启动队列服务[开发中]"""
if not app.celery:
return click.echo(
click.style('No celery config found,skip start...', fg='yellow'))
celery = app.celery
celery.autodiscover_tasks()
argv = celery_arguments.split()
argv.insert(0, 'worker')
argv.insert(0... |
def smart_database(app):
"""尝试对数据库做初始化操作"""
from sqlalchemy.engine.url import make_url
from sqlalchemy_utils import database_exists, create_database
# 如果数据库不存在,则尝试创建数据
dsn = make_url(app.config['SQLALCHEMY_DATABASE_URI'])
if not database_exists(dsn):
create_database(dsn)
pass
... |
def smart_migrate(app, migrations_root):
"""如果存在migration且指定为primary_node则执行migrate操作"""
db = app.db
if os.path.exists(migrations_root) and \
os.environ['FANTASY_PRIMARY_NODE'] != 'no':
from flask_migrate import (Migrate,
upgrade as migrate_upgrade)
... |
def smart_account(app):
"""尝试使用内置方式构建账户"""
if os.environ['FANTASY_ACTIVE_ACCOUNT'] == 'no':
return
from flask_security import SQLAlchemyUserDatastore, Security
account_module_name, account_class_name = os.environ[
'FANTASY_ACCOUNT_MODEL'].rsplit('.', 1)
account_module = importlib.... |
def load_tasks(app, entry_file=None):
"""装载任务,解决celery无法自动装载的问题"""
from celery import Task
tasks_txt = os.path.join(os.path.dirname(entry_file), 'migrations',
'tasks.txt')
if not os.path.exists(tasks_txt):
import sys
print('Tasks file not found:%s' % tasks_t... |
def create_app(app_name, config={}, db=None, celery=None):
"""
App Factory 工具
策略是:
- 初始化app
- 根据app_name,装载指定的模块
- 尝试装载app.run_app
- 如果指定了`FANTASY_PRIMARY_NODE`,则尝试进行migrate操作
- 装载error handler
:return:
"""
track_mode = os.environ['FANTASY_TRACK_MODE'] ... |
def get_config(app, prefix='hive_'):
"""Conveniently get the security configuration for the specified
application without the annoying 'SECURITY_' prefix.
:param app: The application to inspect
"""
items = app.config.items()
prefix = prefix.upper()
def strip_prefix(tup):
return (tu... |
def config_value(key, app=None, default=None, prefix='hive_'):
"""Get a Flask-Security configuration value.
:param key: The configuration key without the prefix `SECURITY_`
:param app: An optional specific application to inspect. Defaults to
Flask's `current_app`
:param default: An opti... |
def random_str(length=16, only_digits=False):
"""
生成随机字符串
:return:
"""
choices = string.digits
if not only_digits:
choices += string.ascii_uppercase
return ''.join(random.SystemRandom().choice(choices)
for _ in range(length)) |
def vector(members: Iterable[T], meta: Optional[IPersistentMap] = None) -> Vector[T]:
"""Creates a new vector."""
return Vector(pvector(members), meta=meta) |
def v(*members: T, meta: Optional[IPersistentMap] = None) -> Vector[T]:
"""Creates a new vector from members."""
return Vector(pvector(members), meta=meta) |
def eval_file(filename: str, ctx: compiler.CompilerContext, module: types.ModuleType):
"""Evaluate a file with the given name into a Python module AST node."""
last = None
for form in reader.read_file(filename, resolver=runtime.resolve_alias):
last = compiler.compile_and_exec_form(form, ctx, module)... |
def eval_stream(stream, ctx: compiler.CompilerContext, module: types.ModuleType):
"""Evaluate the forms in stdin into a Python module AST node."""
last = None
for form in reader.read(stream, resolver=runtime.resolve_alias):
last = compiler.compile_and_exec_form(form, ctx, module)
return last |
def eval_str(s: str, ctx: compiler.CompilerContext, module: types.ModuleType, eof: Any):
"""Evaluate the forms in a string into a Python module AST node."""
last = eof
for form in reader.read_str(s, resolver=runtime.resolve_alias, eof=eof):
last = compiler.compile_and_exec_form(form, ctx, module)
... |
def bootstrap_repl(which_ns: str) -> types.ModuleType:
"""Bootstrap the REPL with a few useful vars and returned the
bootstrapped module so it's functions can be used by the REPL
command."""
repl_ns = runtime.Namespace.get_or_create(sym.symbol("basilisp.repl"))
ns = runtime.Namespace.get_or_create(s... |
def run( # pylint: disable=too-many-arguments
file_or_code,
code,
in_ns,
use_var_indirection,
warn_on_shadowed_name,
warn_on_shadowed_var,
warn_on_var_indirection,
):
"""Run a Basilisp script or a line of code, if it is provided."""
basilisp.init()
ctx = compiler.CompilerContext... |
def multifn(dispatch: DispatchFunction, default=None) -> MultiFunction[T]:
"""Decorator function which can be used to make Python multi functions."""
name = sym.symbol(dispatch.__qualname__, ns=dispatch.__module__)
return MultiFunction(name, dispatch, default) |
def __add_method(m: lmap.Map, key: T, method: Method) -> lmap.Map:
"""Swap the methods atom to include method with key."""
return m.assoc(key, method) |
def add_method(self, key: T, method: Method) -> None:
"""Add a new method to this function which will respond for
key returned from the dispatch function."""
self._methods.swap(MultiFunction.__add_method, key, method) |
def get_method(self, key: T) -> Optional[Method]:
"""Return the method which would handle this dispatch key or
None if no method defined for this key and no default."""
method_cache = self.methods
# The 'type: ignore' comment below silences a spurious MyPy error
# about having a ... |
def __remove_method(m: lmap.Map, key: T) -> lmap.Map:
"""Swap the methods atom to remove method with key."""
return m.dissoc(key) |
def remove_method(self, key: T) -> Optional[Method]:
"""Remove the method defined for this key and return it."""
method = self.methods.entry(key, None)
if method:
self._methods.swap(MultiFunction.__remove_method, key)
return method |
def _is_async(o: IMeta) -> bool:
"""Return True if the meta contains :async keyword."""
return ( # type: ignore
Maybe(o.meta)
.map(lambda m: m.entry(SYM_ASYNC_META_KEY, None))
.or_else_get(False)
) |
def _is_macro(v: Var) -> bool:
"""Return True if the Var holds a macro function."""
return (
Maybe(v.meta)
.map(lambda m: m.entry(SYM_MACRO_META_KEY, None)) # type: ignore
.or_else_get(False)
) |
def _loc(form: Union[LispForm, ISeq]) -> Optional[Tuple[int, int]]:
"""Fetch the location of the form in the original filename from the
input form, if it has metadata."""
try:
meta = form.meta # type: ignore
line = meta.get(reader.READER_LINE_KW) # type: ignore
col = meta.get(reade... |
def _with_loc(f: ParseFunction):
"""Attach any available location information from the input form to
the node environment returned from the parsing function."""
@wraps(f)
def _parse_form(ctx: ParserContext, form: Union[LispForm, ISeq]) -> Node:
form_loc = _loc(form)
if form_loc is None:... |
def _clean_meta(meta: Optional[lmap.Map]) -> Optional[lmap.Map]:
"""Remove reader metadata from the form's meta map."""
if meta is None:
return None
else:
new_meta = meta.dissoc(reader.READER_LINE_KW, reader.READER_COL_KW)
return None if len(new_meta) == 0 else new_meta |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.