text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
""" LECO Director instrument plugin are to be used to communicate (and control) remotely real instrument plugin through TCP/IP using the LECO Protocol For this to work a coordinator must be instantiated can be done within the dashboard or directly running: `python -m pyleco.coordinators.coordinator` """ from pymodaq...
PyMoDAQ/pymodaq_plugins_mock
src/pymodaq_plugins_mock/daq_viewer_plugins/plugins_2D/daq_2Dviewer_LECODirector.py
.py
135d15d3358358e2
7.35
4
"""Command-line interface for pycard-validate.""" import argparse from collections.abc import Sequence from typing import Optional from .validator import pycvalid def build_parser() -> argparse.ArgumentParser: """Build the command-line argument parser.""" parser = argparse.ArgumentParser( prog="pyca...
subhajeet2107/pycard-validate
pycardvalidator/__main__.py
.py
b52b864f73d85a94
7.24
2
"""Luhn checksum validation.""" from abc import ABC, abstractmethod class AlgorithmInterface(ABC): """Interface implemented by card-number validation algorithms.""" @abstractmethod def validate(self, value: object) -> bool: """Return whether *value* satisfies the algorithm.""" class Luhn(Algor...
subhajeet2107/pycard-validate
pycardvalidator/algorithm/luhn.py
.py
21cc0a8972cd8a7d
7.24
2
"""Input normalization for payment card numbers.""" from abc import ABC, abstractmethod class FilterInterface(ABC): """Interface implemented by input filters.""" @abstractmethod def filter(self, value: object) -> str: """Normalize *value* into a form accepted by a validator.""" class FilterDef...
subhajeet2107/pycard-validate
pycardvalidator/filter/filter_default.py
.py
9a0255d2c8bdfb01
7.24
2
"""High-level payment card number validation.""" from typing import Optional from .algorithm.luhn import AlgorithmInterface, Luhn from .filter.filter_default import FilterDefault, FilterInterface class Validator: """Normalize card numbers and validate them with a configurable algorithm.""" def __init__( ...
subhajeet2107/pycard-validate
pycardvalidator/validator.py
.py
0d578afd76eeb4a7
7.24
2
import pandas import plotly.subplots import plotly.graph_objects import collections import itertools # A convenience container that links how a metric should be graphed # The name is the column name # The properties is a dict # The dict key is a value found in the column # The dict value is the property (color, shape...
oicr-gsi/dashi
application/dash_application/plots/plot_scatter_subplot.py
.py
44eca1c54ef5984a
7.39
5
from dash import html from dash import dcc as core from dash import dash_table from dash.dependencies import Input, Output import pandas from ..utility import df_manipulation as util from ..dash_id import init_ids page_name = "bcl2barcode-index-qc" title = "Bcl2Barcode Index QC" ids = init_ids( [ "error"...
oicr-gsi/dashi
application/dash_application/views/bcl2barcode.py
.py
6b78ca6f64b78019
7.39
5
# SPDX-FileCopyrightText: 2016-2024 CERN. # SPDX-FileCopyrightText: 2024-2025 Graz University of Technology. # SPDX-License-Identifier: MIT """Localized Extended Date(/Time) Format Level 0 date string field.""" import arrow from babel import Locale from babel.core import negotiate_locale from babel.dates import LC_TI...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/babel.py
.py
2c7ce45cf9f20665
7.15
1
# SPDX-FileCopyrightText: 2018-2019 CERN. # SPDX-License-Identifier: MIT """Contributed Marshmallow fields.""" import functools from inspect import getfullargspec, isfunction, ismethod from marshmallow import fields, utils def _get_func_args(func): """Get a list of the arguments a function or method has.""" ...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/contrib.py
.py
bc545f7441375d85
7.15
1
# SPDX-FileCopyrightText: 2016-2020 CERN. # SPDX-License-Identifier: MIT """Extended Date(/Time) Format Level 0 date string field.""" from babel_edtf import parse_edtf from edtf import ( Date, DateAndTime, Interval, Level1Interval, Level2Interval, OneOfASet, UncertainOrApproximate, ) from ...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/edtfdatestring.py
.py
7296947c02964362
7.65
1
# SPDX-FileCopyrightText: 2016-2020 CERN. # SPDX-FileCopyrightText: 2025 Graz University of Technology. # SPDX-License-Identifier: MIT """Generated field.""" from .contrib import Function, Method class GeneratedValue(object): """Sentinel value class forcing marshmallow missing field generation.""" pass c...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/generated.py
.py
ef1ea134dd2432c3
7.15
1
# SPDX-FileCopyrightText: 2016-2021 CERN. # SPDX-FileCopyrightText: 2021 Northwestern University. # SPDX-License-Identifier: MIT """Date string field.""" import arrow from arrow.parser import ParserError from marshmallow import fields, missing class ISODateString(fields.Date): """ISO8601-formatted date string. ...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/isodate.py
.py
7aee3f917ca8abb0
7.15
1
# SPDX-FileCopyrightText: 2016-2020 CERN. # SPDX-License-Identifier: MIT """ISO language string field.""" import pycountry from marshmallow import ValidationError from .sanitizedunicode import SanitizedUnicode def _(x): return x def validate_iso639_3(value): """Validate that language is ISO 639-3 value."...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/isolanguage.py
.py
9af2dd3771bb540d
7.15
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-FileCopyrightText: 2025-2026 Graz University of Technology. # SPDX-License-Identifier: MIT """Link store and field for generating links.""" from warnings import warn from marshmallow import fields, missing from uritemplate import URITemplate from ..context import context_...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/links.py
.py
1e86d7c730fe2303
7.15
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-License-Identifier: MIT """Nested attribute.""" from marshmallow import fields, missing class AttributeAccessorFieldMixin: """Marshmallow field mixin for attribute-based serialization.""" def get_value(self, obj, attr, accessor=None, default=missing): """...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/nestedattr.py
.py
d6408956d9931da4
7.15
1
# SPDX-FileCopyrightText: 2016-2021 CERN. # SPDX-License-Identifier: MIT """HTML sanitized string field.""" from marshmallow import fields # For backward compatibility we import ALLOWED_* variables. from ..html import ALLOWED_HTML_ATTRS, ALLOWED_HTML_TAGS, sanitize_html class SanitizedHTML(fields.String): """S...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/sanitizedhtml.py
.py
756890739576b668
7.15
1
# SPDX-FileCopyrightText: 2016-2021 CERN. # SPDX-License-Identifier: MIT """Sanitized Unicode string field.""" from marshmallow import fields from ..html import sanitize_unicode class SanitizedUnicode(fields.String): """String field that sanitizes and fixes problematic unicode characters.""" UNWANTED_CHAR...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/sanitizedunicode.py
.py
40de0a0df5d265c1
7.15
1
# SPDX-FileCopyrightText: 2021 CERN. # SPDX-License-Identifier: MIT """HTML sanitized string field.""" from marshmallow import fields from ..html import strip_html class StrippedHTML(fields.String): """String field which strips HTML entities. The value is stripped using the bleach library. Any already esc...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/strippedhtml.py
.py
130d3bbf487b3a91
7.15
1
# SPDX-FileCopyrightText: 2021 CERN. # SPDX-FileCopyrightText: 2025 Graz University of Technology. # SPDX-License-Identifier: MIT """Datetime field which converts naive datetimes to TZ aware datetimes.""" from datetime import datetime, timezone import arrow from marshmallow import fields class TZDateTime(fields.Da...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/tzdatetime.py
.py
e3376435bb66ec4d
7.15
1
# SPDX-FileCopyrightText: 2016-2023 CERN. # SPDX-License-Identifier: MIT """Update URL field.""" from __future__ import annotations import re import typing from marshmallow import types from marshmallow.exceptions import ValidationError from marshmallow.fields import String from marshmallow.validate import Validato...
inveniosoftware/marshmallow-utils
marshmallow_utils/fields/url.py
.py
c2a6f74785aa9474
7.15
1
# SPDX-FileCopyrightText: 2021-2025 CERN. # SPDX-License-Identifier: MIT """HTML utilities.""" import html import bleach from bleach.css_sanitizer import CSSSanitizer from ftfy import fix_text #: Unwanted unicode characters UNWANTED_CHARS = { # Zero-width space "\u200b", } #: Allowed tags used for html sa...
inveniosoftware/marshmallow-utils
marshmallow_utils/html.py
.py
c4dc3297800a7142
7.15
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-FileCopyrightText: 2020 Northwestern University. # SPDX-License-Identifier: MIT """Link store and field for generating links.""" from collections import defaultdict from marshmallow import Schema, fields, missing, post_dump from uritemplate import URITemplate from werkzeug...
inveniosoftware/marshmallow-utils
marshmallow_utils/links.py
.py
447b3397aeae6065
7.15
1
# SPDX-FileCopyrightText: 2023 CERN. # SPDX-FileCopyrightText: 2025-2026 Graz University of Technology. # SPDX-License-Identifier: MIT """Field-level permissions.""" from warnings import warn from marshmallow import post_dump, pre_load from .context import context_schema class FieldPermissionError(Exception): ...
inveniosoftware/marshmallow-utils
marshmallow_utils/permissions.py
.py
9b7b1d62877d12eb
7.15
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-License-Identifier: MIT """GeoJSON Schema.""" from geojson import MultiPoint, Point, Polygon from marshmallow import Schema, ValidationError from marshmallow.fields import Constant, Float, List from marshmallow.validate import Validator from marshmallow_oneofschema import O...
inveniosoftware/marshmallow-utils
marshmallow_utils/schemas/geojson.py
.py
2bc22da43bdf2816
7.15
1
# SPDX-FileCopyrightText: 2021 CERN. # SPDX-License-Identifier: MIT """Persistent identifier Schema with automatic scheme detection. Integrates idutils library to detect the scheme. """ import idutils from marshmallow import Schema, ValidationError, post_load, pre_load, validates_schema from ..fields import Sanitiz...
inveniosoftware/marshmallow-utils
marshmallow_utils/schemas/identifier.py
.py
281c3b668a41e621
7.15
1
# SPDX-FileCopyrightText: 2024-2024 CERN. # SPDX-License-Identifier: MIT """Lazy OneOf validator.""" import typing from marshmallow import validate class LazyOneOf(validate.OneOf): """Lazy version of the default marshmallow OneOf validator.""" def __init__( self, choices: typing.Union[typi...
inveniosoftware/marshmallow-utils
marshmallow_utils/validators/oneof.py
.py
b22651023225d0e0
7.15
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-FileCopyrightText: 2025 Graz University of Technology. # SPDX-License-Identifier: MIT """Pytest configuration.""" import pytest from marshmallow import Schema, fields from marshmallow_utils.permissions import FieldPermissionsMixin, context_schema @pytest.fixture def fiel...
inveniosoftware/marshmallow-utils
tests/conftest.py
.py
a3c8f35810848c09
7.65
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-License-Identifier: MIT """Tests for marshmallow GeoJSON MultiPoint schema.""" import pytest from marshmallow import ValidationError from marshmallow_utils.schemas import MultiPointSchema @pytest.mark.parametrize( "coordinates", [ ([[-32.94682, -60.63932]...
inveniosoftware/marshmallow-utils
tests/schemas/test_multipoint.py
.py
a75c89c3d684cb46
7.65
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-License-Identifier: MIT """Tests for marshmallow GeoJSON Point schema.""" import pytest from marshmallow import ValidationError from marshmallow_utils.schemas import PointSchema @pytest.mark.parametrize( "coordinates", [ ([-32.94682, -60.63932]), ...
inveniosoftware/marshmallow-utils
tests/schemas/test_point.py
.py
848f44cbd914d6e7
7.65
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-License-Identifier: MIT """Tests for marshmallow GeoJSON Polygon schema.""" import pytest from marshmallow import ValidationError from marshmallow_utils.schemas import PolygonSchema @pytest.mark.parametrize( "coordinates", [ ([[[2.38, 57.322], [23.194, -2...
inveniosoftware/marshmallow-utils
tests/schemas/test_polygon.py
.py
7bbe1a70f3adedc9
7.65
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-FileCopyrightText: 2024 Graz University of Technology. # SPDX-License-Identifier: MIT """Test the babel date and time localization.""" from datetime import date, datetime import pytest from babel import Locale from babel.dates import get_timezone from marshmallow import Sc...
inveniosoftware/marshmallow-utils
tests/test_babel.py
.py
19e9fd635532e474
7.65
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-License-Identifier: MIT """Test the localization of EDTF string.""" import pytest from marshmallow import Schema, ValidationError from marshmallow_utils.fields import ( EDTFDateString, EDTFDateTimeString, EDTFLevel2DateString, ) class TestSchemaDate(Schema): ...
inveniosoftware/marshmallow-utils
tests/test_edtfdatestring.py
.py
4ca88d814f80140c
7.65
1
# SPDX-FileCopyrightText: 2016-2020 CERN. # SPDX-License-Identifier: MIT """Test the marshmallow ISO Language.""" import pytest from marshmallow import Schema, ValidationError from marshmallow_utils.fields import ISOLangString class MySchema(Schema): f = ISOLangString() def test_iso639_3_assert(): assert...
inveniosoftware/marshmallow-utils
tests/test_isolanguage.py
.py
4a3d5ef9dc70fd8d
7.65
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-FileCopyrightText: 2020 Northwestern University. # SPDX-FileCopyrightText: 2025 Graz University of Technology. # SPDX-License-Identifier: MIT """Test LinksStore.""" import pytest from marshmallow import Schema from uritemplate import URITemplate from marshmallow_utils impo...
inveniosoftware/marshmallow-utils
tests/test_links.py
.py
08e2134b325980cb
7.65
1
# SPDX-FileCopyrightText: 2020 CERN. # SPDX-License-Identifier: MIT from datetime import date from marshmallow import Schema, fields from marshmallow_utils.fields import nestedattr class ArtistSchema(Schema): """Artist Schema.""" name = fields.Str() class AlbumSchema(Schema): """Album Schema.""" ...
inveniosoftware/marshmallow-utils
tests/test_nestedattr.py
.py
4d65cc70fdf79533
7.65
1
from functools import wraps import logging import time ''' plogger is a module with logging tools which can be either called directly or to be used as decorators timed - logs the time duration of a decorated function func_args - logs the arguments (*args, **kwargs) and results of a dec...
bvermeulen/QGIS
plugins/picture_linker/Utils/plogger.py
.py
822e7fa16db715cb
7.15
1
#!/usr/bin/env python # coding=utf-8 """This script uploads a plugin package to the plugin repository. Authors: A. Pasotti, V. Picavet git sha : $TemplateVCSFormat """ import sys import getpass import xmlrpc.client from optparse import OptionParser standard_library.install_aliases() # Co...
bvermeulen/QGIS
plugins/picture_linker/plugin_upload.py
.py
944218fccc283a6c
7.15
1
# coding=utf-8 """QGIS plugin implementation. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .. note...
bvermeulen/QGIS
plugins/picture_linker/test/qgis_interface.py
.py
5b47622c8070aade
7.65
1
# coding=utf-8 """Tests QGIS plugin init.""" __author__ = 'Tim Sutton <tim@linfiniti.com>' __revision__ = '$Format:%H$' __date__ = '17/10/2010' __license__ = "GPL" __copyright__ = 'Copyright 2012, Australia Indonesia Facility for ' __copyright__ += 'Disaster Reduction' import os import unittest import logging import ...
bvermeulen/QGIS
plugins/picture_linker/test/test_init.py
.py
69ae613770f38207
7.65
1
# coding=utf-8 """Dialog test. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. """ __author__ = 'bru...
bvermeulen/QGIS
plugins/picture_linker/test/test_picture_linker_dialog.py
.py
319e5c30d8cc9d02
7.65
1
# coding=utf-8 """Tests for QGIS functionality. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. """ ...
bvermeulen/QGIS
plugins/picture_linker/test/test_qgis_environment.py
.py
34244bb63cd14e1a
7.65
1
# coding=utf-8 """Resources test. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. """ __author__ = '...
bvermeulen/QGIS
plugins/picture_linker/test/test_resources.py
.py
2f08d6e7d566653f
7.65
1
# coding=utf-8 """Safe Translations Test. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. """ from .u...
bvermeulen/QGIS
plugins/picture_linker/test/test_translations.py
.py
d4055fee7fc6712a
7.65
1
"""Airwallex API-key login and durable bearer-token store. Airwallex authenticates by exchanging client_id + api_key for a short-lived bearer: POST /api/v1/authentication/login with x-client-id / x-api-key returns a ``token`` (~30 min) and an ``expires_at``. There is no OAuth consent, no redirect, and no refresh token...
overseers-desk/crude
src/crude_airwallex/auth.py
.py
671f4c65962b908e
7
0
"""Payouts beneficiary sub-app for crude-airwallex: list/get/create/update/delete. `register(app)` attaches the `beneficiary` sub-app over ``/api/v1/beneficiaries``. Reads render with `emit_list`/`emit_record`; the writes go through `do_write`/ `merge_update`, confirm-before-write (a beneficiary change edits the produ...
overseers-desk/crude
src/crude_airwallex/cli_beneficiaries.py
.py
0336ed61742d6933
7
0
"""Payouts transfer sub-app for crude-airwallex: list/get/create. `register(app)` attaches the `transfer` sub-app over ``/api/v1/transfers``. `list` and `get` are read-only; `create` MOVES REAL MONEY and is confirm-gated with an explicit money warning (mirroring how crude-xero gates `invoice email`). Field names are s...
overseers-desk/crude
src/crude_airwallex/cli_transfers.py
.py
a354b481daa4044c
7
0
"""Local-time rendering helpers shared across the crude-airwallex CLI modules. Every Airwallex resource carries ISO-8601 UTC timestamps; these render them in the machine's local timezone (crude_common.localtime) for list columns and record views, so the binary shows local time everywhere. Kept here, not in cli, so the...
overseers-desk/crude
src/crude_airwallex/render.py
.py
56ba0ffad61a2355
7
0
"""Typer CLI for the ATDW (Australian Tourism Data Warehouse) site: crude-atdw.""" import json import sys from typing import Optional import requests import typer from rich.console import Console from rich.table import Table from crude_common import asof from crude_common.claude_command import register_claude_comman...
overseers-desk/crude
src/crude_atdw/cli.py
.py
0e7d46063b17f1c0
7
0
"""Catalog reads for crude-clover. The orders endpoint omits the category dimension: a line item carries an ``item`` FK into inventory, and the category lives on the inventory item. So a category-split report needs the catalog dumped once and joined against line items. ``dump`` pulls items (with their categories expan...
overseers-desk/crude
src/crude_clover/catalog.py
.py
841e00d7a8dedb9f
7
0
"""The ``catalog`` sub-app for crude-clover: dump items, categories, modifiers. The dump exposes the per-item category the orders endpoint omits, so flatten can resolve a line item's ``item.id`` to its raw Clover category. It does not bucket into report categories; that aggregation lives in the consuming analysis. """...
overseers-desk/crude
src/crude_clover/cli_catalog.py
.py
d4836bf8cbca681a
7
0
"""The ``flatten`` command for crude-clover: orders JSONL to Square-shape CSV. Local file work only — no Clover call, so it needs no client or token. """ from __future__ import annotations import typer from crude_clover.flatten import flatten def register(app: typer.Typer) -> None: """Attach the flatten comma...
overseers-desk/crude
src/crude_clover/cli_flatten.py
.py
c845238cec69c74b
7
0
"""The ``orders`` sub-app for crude-clover: paginated order reads to a file. A year of orders is tens of MB, so range and incremental pulls go to a required ``-o`` file as JSONL (one Order per line), never to stdout. ``get`` prints a single order. ``list`` pulls a date range (``--from``/``--to``), or everything change...
overseers-desk/crude
src/crude_clover/cli_orders.py
.py
e6049830cf326c83
7
0
"""Heartbeat and scope reporting for crude-clover. ``status`` confirms the token resolves a merchant and reports today's order count and revenue. ``scopes`` probes the token against every registry resource and reports which permissions are enabled. Reads are probed with a GET; writes only with ``--probe-writes``, whic...
overseers-desk/crude
src/crude_clover/cli_status.py
.py
ea824ea2046f243f
7
0
"""Clover transport: a Bearer-token requests session over the AP REST API. One CloverSession carries the static API token (issued once from the AP production dashboard) and resolves the merchant id lazily from ``/v3/merchants/current`` on first use, so the token is the single source of truth for which merchant is read...
overseers-desk/crude
src/crude_clover/client.py
.py
ba6def72a668a6eb
7
0
"""Render Clover orders into the Square item-level CSV shape. The venue moved from Square to Clover; the existing sales analysis reads Square item-level CSV exports. flatten lets one analysis span both eras by writing Clover orders in Square's column shape: one row per line item, plus one negative-``Net Sales`` row pe...
overseers-desk/crude
src/crude_clover/flatten.py
.py
87776d74507236f5
7
0
"""Orders reads for crude-clover. The orders endpoint filters by ``createdTime`` (UTC epoch ms) and pages by offset, but Clover caps offset at 10000, so a busy range cannot be read in one pass. ``day_windows`` slices a date range into one window per venue-local day (small enough that a single window practically never ...
overseers-desk/crude
src/crude_clover/orders.py
.py
7dc1c8768644a074
7
0
"""Config discovery and reading shared across the crude site CLIs. One config file (``~/.config/crude/config.toml``) holds a section per site, so locating and parsing it is the same job for every CLI; it lives here rather than being copied into each. """ from __future__ import annotations import os import sys from d...
overseers-desk/crude
src/crude_common/config.py
.py
3e5dfa4c8437f2b2
7
0
"""The crude umbrella command: an index of the per-site CLIs. crude has no resources of its own. Run with no arguments it lists the site commands (crude-atdw, crude-skal, crude-rezdy, crude-deputy, crude-sonas, crude-xero, crude-airwallex, crude-clover, crude-facebook, crude-mautic) and the shared flags; each site is ...
overseers-desk/crude
src/crude_common/launcher.py
.py
1c9b1a18c3d35194
7
0
"""LDIF (inetOrgPerson) rendering for the crude site CLIs. Every site's people-shaped records can be exported as LDIF so that several sites' exports concatenate into one importable file. The contract: - stdout carries LDIF entries and blank separator lines only, nothing else, so the output of several runs can be co...
overseers-desk/crude
src/crude_common/ldif.py
.py
2ca5cca45f7d3655
7
0
"""ISO-8601-UTC to system-local-time conversion for the crude site CLIs. REST APIs return timestamps as ISO-8601 UTC; a CLI run on a user's machine should show them in that machine's local timezone, and read typed --from/--to dates in local time too. This is the dominant wire-format conversion, so it lives here for re...
overseers-desk/crude
src/crude_common/localtime.py
.py
a4875bebf4c4d497
7
0
"""Shared result presentation for the crude site CLIs. The canonical home for rendering a list or a record as a rich table or raw JSON, so every `crude-<site> <resource> list`/`get` honours `--json` and the count line identically. The table-drawing primitives come from rich; this module owns the project's presentation...
overseers-desk/crude
src/crude_common/output.py
.py
2571e8ae40ce39b3
7
0
"""Durable per-account credential files under the XDG state directory. A cached credential (an OAuth refresh token, a session cookie, a Meteor resume token) is XDG *state*: it persists across restarts but is neither config (it is program-managed, not user-authored) nor safe-to-delete cache (losing it costs a re-login,...
overseers-desk/crude
src/crude_common/statestore.py
.py
c2d98fc36eb7a8e4
7.5
0
"""Shared write-verb I/O for the crude site CLIs. The canonical home for the write-command plumbing the rezdy CLI grew first: resolving a write body from --data/-f/stdin, confirm-before-write, and read-merge-write for full-object updates. Result presentation lives in crude_common.output. """ from __future__ import an...
overseers-desk/crude
src/crude_common/writeio.py
.py
f300e2868e2a6dde
7
0
"""Command line interface components.""" from dataclasses import KW_ONLY, dataclass from typing import NamedTuple import defopt from .transfer import CpDef, LsDef, MvDef @dataclass class CLIResult: """The result of a CLI call.""" mover: MvDef | CpDef | None _: KW_ONLY diffs: tuple[str, str] | None...
lmmx/mvdef
src/mvdef/cli.py
.py
75cfed0f6265e0b3
7.15
1
"""Override the pyflakes `Checker` to extract info for our purposes.""" from __future__ import annotations import ast import os from ast import AST from functools import cache import pyflakes from pyflakes import checker from pyflakes.checker import ( Annotation, Builtin, ClassScope, DetectClassScope...
lmmx/mvdef
src/mvdef/core/check.py
.py
6a0e83938f6a7ce9
7.15
1
"""Diff two files (in a way that can be applied as a patch).""" from dataclasses import KW_ONLY, dataclass from pathlib import Path from tempfile import NamedTemporaryFile from .agenda import Agenda from .check import Checker __all__ = ["Differ"] @dataclass class Differ: """Dataclass storing the source (and po...
lmmx/mvdef
src/mvdef/core/diff.py
.py
d87edc3f8a091088
7.15
1
from dataclasses import KW_ONLY, dataclass from pathlib import Path from ..agenda import Agenda from ..check import Checker __all__ = ["Manifest"] @dataclass class Manifest: src: Path _: KW_ONLY matchers: list[str] source_ref: Checker dry_run: bool list: bool escalate: bool = False v...
lmmx/mvdef
src/mvdef/core/manifest/manifest.py
.py
2c61bdb9e19463f9
7.15
1
import ast from pathlib import Path from pyflakes import reporter from ..error_handling.exceptions import SrcNotFound from .check import Checker __all__ = ["parse", "parse_file", "reparse"] def parse( codestring, *, file: str | Path = "", verbose: bool = False, **kwargs, ) -> Checker | None: ...
lmmx/mvdef
src/mvdef/core/parse.py
.py
2f6c1c6183c372d3
7.15
1
from .colours import colour_str as colour __all__ = ["describe_def_name_dict", "pprint_agenda", "pprint_agenda_desc"] def pprint_agenda_desc(category, entry_key, entry_dict, extra_message=""): """ Pretty print an edit agenda entry according to the agenda category. The 7 categories are: move, keep, copy, ...
lmmx/mvdef
src/mvdef/legacy/agenda_util.py
.py
39a537e17b8bb9ae
7.15
1
# flake8: noqa from ast import ClassDef, FunctionDef from ast import Import as IType from ast import ImportFrom as IFType from ast import walk from functools import reduce from asttokens import ASTTokens from .ast_util import ( ClassPath, DefPathTypeEnum, DefTypeEnum, FuncPath, InnerClassPath, ...
lmmx/mvdef
src/mvdef/legacy/ast_tokens.py
.py
52430772d210f00c
7.15
1
from platform import system as platform __all__ = [ "colour_effect_str", "colour_str", "effect_str", "get_colour_codes", "get_effect_codes", "underline", ] def get_colour_codes(colour=None): """ Return a dictionary of ANSI colour codes if no colour specified, if a colour is given ...
lmmx/mvdef
src/mvdef/legacy/colours.py
.py
30af998f96f18df7
7.15
1
# flake8: noqa from ast import ClassDef, FunctionDef from functools import partial __all__ = ["_find_node", "_find_def", "_find_cls"] ### Helper functions used for finding the node given a path within `set_defs_to_move` def _name_check(node, name): "Check whether an AST `node`’s `.name` attribute is `name`" ...
lmmx/mvdef
src/mvdef/legacy/def_helpers.py
.py
006431d5d7baca7c
7.15
1
# flake8: noqa from enum import Enum __all__ = [ "TokenisedStr", "NullPathStr", "UntypedPathStr", "FuncDefPathStr", "InnerFuncDefPathStr", "ClassDefPathStr", "HigherOrderClassDefPathStr", "InnerClassDefPathStr", "MethodDefPathStr", ] class PathPartStr(str): pass class FuncPa...
lmmx/mvdef
src/mvdef/legacy/def_path_util.py
.py
3427b4b36576692b
7.15
1
# flake8: noqa from os import linesep as nl from .io_util import terminal_whitespace __all__ = [ "get_defrange", "get_defstring", "append_def_to_file", "get_def_lines", "excise_def_from_file", "excise_def_lines", "get_borders", "overwrite_import", ] def get_defrange(def_node): ""...
lmmx/mvdef
src/mvdef/legacy/editor_util.py
.py
8a22412b728ea0a1
7.15
1
# flake8: noqa import textwrap as tw from os.path import sep from sys import stderr from ..demo_program import pprint_dict, print_some_url def test_pprint_dict(d={"foo": 1, "bar": 2}): pprint_output = pprint_dict(d, return_string=True) assert pprint_output == "{'foo': 1, 'bar': 2}" return True def test...
lmmx/mvdef
src/mvdef/legacy/example/test/test_demo.py
.py
839e222aea8269c9
7.65
1
from dataclasses import dataclass from ..core.check import Checker from ..error_handling.exceptions import CheckFailure from ..error_handling.failure import FailableMixIn from ..log_utils import set_up_logging __all__ = ["MvDefBase"] @dataclass # TODO: delete this (don't think it's needed) class MvDefBase(Failable...
lmmx/mvdef
src/mvdef/transfer/base.py
.py
5ac77fbfa22e5337
7.15
1
""" Tests for the dry run diff of `__all__` assignments created in 'dry run' mode by :func:`format_all()`. """ from pytest import mark from mvdef.core.manifest.all_fmt import format_all __all__ = ["test_format_long", "test_format_short"] @mark.parametrize( "names", [ [], ["A"], ["fo...
lmmx/mvdef
tests/all_fmt_test.py
.py
6e13132bfa6587eb
7.65
1
"""API for validating questionnaire schemas using an AJV Validator service and a Questionnaire Validator instance. This module provides a FastAPI application for validating questionnaire schemas using both an external AJV Validator service and internal QuestionnaireValidator logic. It exposes endpoints for health check...
ONSdigital/eq-questionnaire-validator
api.py
.py
05c7af718060735d
7.3
3
"""Define the AnswerType and AnswerOptionType enums that are used in validators to specify the types of answers that can be validated. Classes: AnswerType AnswerOptionType """ from enum import Enum class AnswerType(Enum): """Define the types of answers that can be used in validators and reflect the answ...
ONSdigital/eq-questionnaire-validator
app/answer_type.py
.py
7ae9be146abac8d3
7.3
3
"""This module contains the AnswerCodeValidator class which is responsible for validating answer codes in a questionnaire schema. Classes: AnswerCodeValidator """ from app.validators.questionnaire_schema import find_duplicates, get_block_by_answer_id from app.validators.validator import Validator class AnswerCo...
ONSdigital/eq-questionnaire-validator
app/validators/answer_code_validator.py
.py
ba4a73f653c55134
7.3
3
"""This module contains the base AnswerValidator class. All specific answer validators inherit from this class. Classes: AnswerValidator """ from app.answer_type import AnswerType from app.validators.questionnaire_schema import ( get_block_by_answer_id, get_object_containing_key, ) from app.validators.val...
ONSdigital/eq-questionnaire-validator
app/validators/answers/answer_validator.py
.py
bbbb55df546ef721
7.3
3
"""This module contains the DateAnswerValidator class which validates date answers in a questionnaire. Classes: DateAnswerValidator """ import re from datetime import datetime, timezone from dateutil.relativedelta import relativedelta from app.validators.answers.answer_validator import AnswerValidator class D...
ONSdigital/eq-questionnaire-validator
app/validators/answers/date_answer_validator.py
.py
8416467287e527fa
7.3
3
"""This module contains the NumberAnswerValidator class, which is responsible for validating number answers in a questionnaire schema. Classes: NumberAnswerValidator """ from decimal import Decimal from app.validators.answers.answer_validator import AnswerValidator from app.validators.routing.types import TYPE_N...
ONSdigital/eq-questionnaire-validator
app/validators/answers/number_answer_validator.py
.py
488167424724a8e7
7.3
3
"""This module contains the OptionAnswerValidator class, which is responsible for validating answers of type Checkbox, Radio, and Dropdown. Classes: OptionAnswerValidator """ from functools import cached_property from app.answer_type import AnswerType from app.validators.answers.answer_validator import AnswerVal...
ONSdigital/eq-questionnaire-validator
app/validators/answers/option_answer_validator.py
.py
0e40b2b9701ea183
7.3
3
"""This module contains the TextFieldAnswerValidator class, which is responsible for validating answers of type "text_field". Classes: TextFieldAnswerValidator """ import re from urllib.parse import urlparse from app.validators.answers.answer_validator import AnswerValidator class TextFieldAnswerValidator(Answ...
ONSdigital/eq-questionnaire-validator
app/validators/answers/text_field_answer_validator.py
.py
537364a23b092ef2
7.3
3
"""This module contains the CalculatedSummaryBlockValidator class, which is responsible for validating calculated summary blocks in a questionnaire schema. It inherits from the CalculationBlockValidator and adds additional validation specific to calculated summary blocks. Classes: CalculatedSummaryBlockValidator "...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/calculated_summary_block_validator.py
.py
1d74d01f7fdf345f
7.3
3
"""This module contains the CalculationBlockValidator class, which validates that all answers in a calculation block are of the same type, and if they are of type "Unit" or "Currency", that they have the same unit or currency respectively. Classes: CalculationBlockValidator Functions: is_value_for_key_unique ...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/calculation_block_validator.py
.py
e37388349a3eadbb
7.3
3
"""This module contains the GrandCalculatedSummaryBlockValidator class, which is responsible for validating grand calculated summary blocks in a questionnaire schema. Classes: GrandCalculatedSummaryBlockValidator """ from collections.abc import Mapping from app.validators.blocks.calculation_block_validator impor...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/grand_calculated_summary_block_validator.py
.py
413d62f941257e39
7.3
3
"""This module contains the ListCollectorContentValidator class, which validates the content of a list collector block. Classes: ListCollectorContentValidator """ from app.error_messages import FOR_LIST_NEVER_POPULATED from app.validators.blocks.block_validator import BlockValidator class ListCollectorContentVa...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/list_collector_content_validator.py
.py
d72451d524938e7b
7.3
3
"""This module contains the ListCollectorDrivingQuestionValidator class. Classes: ListCollectorDrivingQuestionValidator """ from app.validators.blocks.block_validator import BlockValidator from app.validators.questionnaire_schema import has_single_driving_question class ListCollectorDrivingQuestionValidator(Blo...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/list_collector_driving_question_validator.py
.py
176dce52b89f24c0
7.3
3
"""This module contains the ListCollectorValidator class, parent for different types of list collector validators. Classes: ListCollectorValidator """ from app.validators.blocks.block_validator import BlockValidator from app.validators.blocks.validate_list_collector_quesitons_mixin import ( ValidateListCollec...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/list_collector_validator.py
.py
f912a66ae36a8beb
7.3
3
"""This module contains the PrimaryPersonListCollectorValidator class, which validates primary person list collector blocks in a questionnaire schema. Classes: PrimaryPersonListCollectorValidator """ from app.validators.blocks.block_validator import BlockValidator from app.validators.blocks.validate_list_collecto...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/primary_person_list_collector_validator.py
.py
4fa5b7d3a3908c67
7.3
3
"""This module contains the RelationshipCollectorValidator class, which is responsible for validating blocks of type "RelationshipCollector" in a questionnaire schema. Classes: RelationshipCollectorValidator """ from app import error_messages from app.validators.blocks.block_validator import BlockValidator from a...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/relationship_collector_validator.py
.py
97a5dcdad9eba1db
7.3
3
"""Validator for blocks that contain unrelated relationship actions. Classes: UnrelatedBlockValidator """ from app.validators.blocks.block_validator import BlockValidator class UnrelatedBlockValidator(BlockValidator): """Validate blocks that contain unrelated relationship actions. Methods: vali...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/unrelated_block_validator.py
.py
8aa6a73fe3ccd9da
7.3
3
"""This module contains the ValidateListCollectorQuestionsMixin class, which provides validation methods for list collector questions. Classes: ValidateListCollectorQuestionsMixin Functions: _options_contain_action_type """ from app.validators.validator import Validator def _options_contain_action_type(opt...
ONSdigital/eq-questionnaire-validator
app/validators/blocks/validate_list_collector_quesitons_mixin.py
.py
be7d402cc8ddd36e
7.3
3
"""This module provides the `MetadataValidator` class, which is responsible for validating the metadata field in a questionnaire schema. Classes: MetadataValidator """ from functools import cached_property from app.validators.questionnaire_schema import find_duplicates from app.validators.validator import Valida...
ONSdigital/eq-questionnaire-validator
app/validators/metadata_validator.py
.py
678c6eb8541a60d4
7.3
3
"""This module contains the PlaceholderValidator class, which validates that placeholders in a questionnaire schema match their definitions and that any transforms defined for the placeholders are valid. """ import re from app import error_messages from app.answer_type import AnswerOptionType from app.validators.ques...
ONSdigital/eq-questionnaire-validator
app/validators/placeholders/placeholder_validator.py
.py
52cb0fd68478db34
7.3
3
"""This module provides the `CalculatedQuestionValidator` class, which is responsible for validating calculated questions in a questionnaire schema. Classes: CalculatedQuestionValidator """ from app.validators.questionnaire_schema import ( get_all_dynamic_answer_ids, get_answer_type, get_block_by_answ...
ONSdigital/eq-questionnaire-validator
app/validators/questions/calculated_question_validator.py
.py
b75b674109f1702c
7.3
3
"""This module provides the `DateRangeQuestionValidator` class, which is responsible for validating date range questions in a questionnaire schema. Classes: DateRangeQuestionValidator """ from app.validators.answers.date_answer_validator import DateAnswerValidator from app.validators.questions.question_validator ...
ONSdigital/eq-questionnaire-validator
app/validators/questions/date_range_question_validator.py
.py
120c759822f9c4b6
7.3
3
"""This module provides the `MutuallyExclusiveQuestionValidator` class, which is responsible for validating mutually exclusive questions. Classes: MutuallyExclusiveQuestionValidator """ from app.answer_type import AnswerType from app.validators.questions.question_validator import QuestionValidator class Mutuall...
ONSdigital/eq-questionnaire-validator
app/validators/questions/mutually_exclusive_validator.py
.py
6f4c20a0ae0daa7d
7.3
3