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
import logging import os import subprocess from contextlib import ExitStack, closing, contextmanager from pathlib import Path from tempfile import TemporaryDirectory from threading import Thread from typing import Optional import guestfs @contextmanager def capture_output_fd(): """ Capture stdout and stderr ...
OSWatcher/osw-builder
osw_builder/capture/guest_filesystem.py
.py
0f367d8c5d0f52eb
7
0
"""A module to manipulate Windows Autounattend.xml configuration files""" import xml.etree.ElementTree as ET from contextlib import suppress from copy import deepcopy from pathlib import Path from tempfile import TemporaryDirectory from typing import TYPE_CHECKING, Union if TYPE_CHECKING: from ..settings import B...
OSWatcher/osw-builder
osw_builder/image_builder/autounattend.py
.py
8ca98b8eaa787ac9
7
0
import grp import json import logging import os import shutil from contextlib import ExitStack, contextmanager, suppress from importlib.resources import as_file, files from pathlib import Path from tempfile import NamedTemporaryFile from typing import Generator, Optional from urllib.parse import urlparse import docker...
OSWatcher/osw-builder
osw_builder/image_builder/build.py
.py
5198cc6b3a0bfdd3
7
0
"""Response file abstraction for different operating systems""" from abc import ABC, abstractmethod from contextlib import AbstractContextManager from pathlib import Path from typing import TYPE_CHECKING, Optional, Union if TYPE_CHECKING: from ..settings import BuildConfig class ResponseFile(AbstractContextMana...
OSWatcher/osw-builder
osw_builder/image_builder/response_files.py
.py
4dfcfe4a91757f6a
7
0
"""Ubuntu autoinstall response file handler""" import shutil from pathlib import Path from tempfile import TemporaryDirectory from typing import TYPE_CHECKING, Optional, Union if TYPE_CHECKING: from ..settings import BuildConfig from .response_files import ResponseFile class UbuntuAutoinstall(ResponseFile): ...
OSWatcher/osw-builder
osw_builder/image_builder/ubuntu_autoinstall.py
.py
f59bdfbe51db3f76
7
0
"""Ubuntu preseed.cfg response file handler""" from contextlib import suppress from pathlib import Path from tempfile import TemporaryDirectory from typing import TYPE_CHECKING, Any, Optional, TextIO, Union if TYPE_CHECKING: from ..settings import BuildConfig from .response_files import ResponseFile class Ubun...
OSWatcher/osw-builder
osw_builder/image_builder/ubuntu_preseed.py
.py
1a47c1625ae8aed8
7
0
"""Windows XP WINNT.SIF response file handler""" from contextlib import suppress from pathlib import Path from tempfile import TemporaryDirectory from typing import TYPE_CHECKING, Any, Optional, TextIO, Union if TYPE_CHECKING: from ..settings import BuildConfig from . import build from .response_files import Res...
OSWatcher/osw-builder
osw_builder/image_builder/winxp_sif.py
.py
a5439c76e2355db1
7
0
from pathlib import Path from typing import Any, Dict, List, Optional from attrs import define from dynaconf import Dynaconf CUR_DIR = Path(__file__).parent settings = Dynaconf( envvar_prefix="OSW_BUILDER", environments=False, load_dotenv=True, # use absolute paths to import the conf from parent modu...
OSWatcher/osw-builder
osw_builder/settings.py
.py
9cb91a1314e64519
7
0
import logging import os import re import shutil import subprocess import tempfile from contextlib import contextmanager from datetime import datetime from enum import Enum, auto from pathlib import Path from typing import Dict, Generator, Optional, Tuple from attrs import define from ..settings import BuildConfig, s...
OSWatcher/osw-builder
osw_builder/vagrant/vagrant.py
.py
ad3702b9721d6d82
7
0
"""Tests for updates core module.""" import pytest from osw_builder.updates.core import ( UBUNTU_COUNT_TASK, UBUNTU_LIST_TASK, WINDOWS_SEARCH_TASK, ConnectionInfo, OSType, build_ansible_inventory, create_search_playbook, detect_os_type, parse_ansible_events, parse_ubuntu_update...
OSWatcher/osw-builder
tests/test_updates_core.py
.py
466fd5bb7a4961cf
7.5
0
# -*- coding: utf-8 -*- import utils from botocore.exceptions import ClientError from sceptre.hooks import Hook from exceptions import UndefinedParameterException class S3Notify(Hook): """ Hook for notifying about provisioned resources. :param argument: The Sender name and email :type argument: str...
Sage-Bionetworks/sceptre-provisioner-hooks
s3_notify.py
.py
a1b30532c5d7a648
7
0
# -*- coding: utf-8 -*- import re import utils from botocore.exceptions import ClientError from sceptre.hooks import Hook class S3WebNotify(Hook): """ Hook for notifying about provisioned resources. :param argument: The Sender name and email :type argument: str """ def __init__(self, *args...
Sage-Bionetworks/sceptre-provisioner-hooks
s3_web_notify.py
.py
1162c589d1c9880d
7
0
# -*- coding: utf-8 -*- import utils from botocore.exceptions import ClientError from sceptre.hooks import Hook class SynapseBucketNotify(Hook): """ Hook for notifying about provisioned resources. :param argument: The Sender name and email :type argument: str """ def __init__(self, *args, ...
Sage-Bionetworks/sceptre-provisioner-hooks
synapse_bucket_notify.py
.py
d1ec3aea8152609e
7
0
import logging import click from jccli import helpers as jccli_helpers from jccli.jc_api_v1 import JumpcloudApiV1 from jccli.jc_api_v2 import JumpcloudApiV2 def abort_if_false(ctx, param, value): # pylint: disable=unused-argument """ A click handler for user prompts """ if not value: ctx....
Sage-Bionetworks/jccli
jccli/cli/sync.py
.py
94fb5ed5e9de1bc1
7.24
2
import json import click from jccli.jc_api_v1 import JumpcloudApiV1 @click.group() @click.pass_context def system(ctx): """ Command set for systems. """ pass @system.command("get") @click.option('--id', '-i', 'system_id', required=True, type=str, help="The system ID") @click.pass_context def get_sys...
Sage-Bionetworks/jccli
jccli/cli/system.py
.py
2ff09150fdd6d5b1
7.24
2
import json import click from jccli.jc_api_v1 import JumpcloudApiV1 @click.group() @click.pass_context def user(ctx): """ Command set for users """ pass @user.command('create') @click.option('--username', '-u', required=True, type=str) @click.option('--email', '-e', required=True, type=str) @click....
Sage-Bionetworks/jccli
jccli/cli/user.py
.py
b9d5ae8cf743e655
7.24
2
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. currentmodule:: test_helpers .. moduleauthor:: zaro0508 <zaro0508@gmail.com> This is the test module for the jccli helpers module. """ # fmt: off import pytest # fmt: on import jccli.helpers as jccli_helpers TEST_DATA_PATH = "unit_tests/data/" class TestHelpers:...
Sage-Bionetworks/jccli
unit_tests/test_helpers.py
.py
4928c1ed2faacc3b
7.74
2
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. currentmodule:: test_jc_api_v2 .. moduleauthor:: zaro0508 <zaro0508@gmail.com> This is the test module for the project's JC API V2 module. """ # fmt: off import pytest # fmt: on from mock import patch from jccli.jc_api_v2 import JumpcloudApiV2 class TestJcApiV2:...
Sage-Bionetworks/jccli
unit_tests/test_jc_api_v2.py
.py
3d9159fc04053e4a
7.74
2
"""Common utilities and constants for httpcheck.""" import json from typing import NamedTuple VERSION = "1.4.3" # HTTP status codes - https://en.wikipedia.org/wiki/List_of_HTTP_status_codes STATUS_CODES_JSON = """{ "100": "Continue", "101": "Switching Protocols", "102": "Processing", "200": "OK", ...
docdyhr/httpcheck
httpcheck/common.py
.py
089e017dc05c3bf9
7.24
2
"""Configuration file support for httpcheck. Loads user defaults from ~/.httpcheck.toml and/or ./httpcheck.toml. Project-level config (./httpcheck.toml) takes precedence over user-level (~/.httpcheck.toml). CLI flags always override both. """ import pathlib import warnings from typing import Any try: import toml...
docdyhr/httpcheck
httpcheck/config.py
.py
58160ce60db74947
7.24
2
"""File input handling and URL validation for httpcheck.""" import argparse import re from collections.abc import Iterator from typing import Optional import validators from .validation import ( FileValidationError, InputValidator, URLValidationError, ValidationError, ) def url_validation(site_url)...
docdyhr/httpcheck
httpcheck/file_handler.py
.py
1951d03fc09b5a3a
7.24
2
"""Logging configuration for httpcheck. This module provides a centralized logging system to replace print() statements throughout the codebase, enabling proper log levels, file output, and integration with log aggregation systems. """ import logging import sys from typing import Optional # Global logger instance _l...
docdyhr/httpcheck
httpcheck/logger.py
.py
a60b39b306e7b30d
7.24
2
"""Site checking functionality for httpcheck.""" import time from datetime import datetime from urllib.parse import urlparse import requests from requests.exceptions import ConnectionError as RequestsConnectionError from requests.exceptions import HTTPError, RequestException, Timeout from .common import STATUS_CODES...
docdyhr/httpcheck
httpcheck/site_checker.py
.py
c28ee716dc988f97
7.24
2
"""TLD validation and management for httpcheck.""" import json import os from datetime import datetime from urllib.parse import urlparse import requests from .common import InvalidTLDException class TLDManager: """Manager for TLD (Top-Level Domain) operations with caching and auto-updates.""" _instance = ...
docdyhr/httpcheck
httpcheck/tld_manager.py
.py
50902487c954cf58
7.24
2
#!/usr/bin/env python3 """ Native macOS Notification Center integration for HTTP Check Provides richer notifications with actions, sounds, and proper integration """ import logging import os from enum import Enum from typing import Callable try: import objc from AppKit import NSImage, NSWorkspace from Fou...
docdyhr/httpcheck
macos_notifications.py
.py
81c1522a29c1a9fd
7.24
2
"""Test cases for the common module.""" import pytest from httpcheck.common import VERSION, InvalidTLDException, SiteStatus class TestSiteStatus: """Test cases for the SiteStatus class.""" def test_site_status_creation_basic(self): """Test basic SiteStatus creation.""" status = SiteStatus( ...
docdyhr/httpcheck
tests/test_common.py
.py
7091a5604e1f0956
7.74
2
"""Test cases for httpcheck package initialization.""" import unittest from unittest.mock import MagicMock, patch class TestInit(unittest.TestCase): """Test cases for the httpcheck package initialization.""" def test_package_imports(self): """Test that package imports work correctly.""" from...
docdyhr/httpcheck
tests/test_init.py
.py
9fe8f637f47b56a4
7.74
2
"""Performance regression tests for httpcheck. These tests benchmark critical performance paths to prevent regressions. Run with: pytest tests/test_performance.py --benchmark-only """ import asyncio import io from unittest.mock import AsyncMock, MagicMock, patch import pytest from httpcheck.async_site_checker impor...
docdyhr/httpcheck
tests/test_performance.py
.py
558f0eff7f7a6344
7.74
2
"""Restraint Library.""" from __future__ import annotations import functools import inspect import threading from importlib.metadata import PackageNotFoundError, version from typing import TYPE_CHECKING, Any, Self from restraint.exceptions import ( QuotaExceededError, RestraintConflictError, RestraintErr...
KyleJamesWalker/restraint-py
src/restraint/__init__.py
.py
0d95c97cbcda23b9
7
0
"""Calendar window arithmetic for period-aligned restraints.""" from __future__ import annotations import datetime __all__ = ["PERIODS", "CalendarWindows"] #: Supported window granularities, coarsest first. PERIODS: tuple[str, ...] = ("year", "month", "day", "hour", "minute", "second") #: Fields zeroed (or set to ...
KyleJamesWalker/restraint-py
src/restraint/_calendar.py
.py
8e66479709421271
7
0
"""What happened to a gated call.""" from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Mapping __all__ = ["Outcome"] @dataclass(frozen=True, slots=True) class Outcome: """The result of a call a restrai...
KyleJamesWalker/restraint-py
src/restraint/outcome.py
.py
1a75e3a3610c576c
7
0
"""Manage all active restraints.""" from __future__ import annotations import threading from typing import TYPE_CHECKING from restraint.exceptions import RestraintConflictError, RestraintNotFoundError if TYPE_CHECKING: from collections.abc import Iterator from restraint.restraints import Restraint __all__...
KyleJamesWalker/restraint-py
src/restraint/registry.py
.py
538880c1bca67a00
7
0
"""Pacing driven by the server's own rate-limit signals.""" from __future__ import annotations import email.utils import time from typing import TYPE_CHECKING from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: from collections.abc import Callable, Mapping from restraint.outcome ...
KyleJamesWalker/restraint-py
src/restraint/restraints/adaptive.py
.py
b5a93f4e15f11802
7
0
"""Exponential backoff driven by call outcomes.""" from __future__ import annotations import random from typing import TYPE_CHECKING from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: from collections.abc import Callable from restraint.outcome import Outcome __all__ = ["Backoff...
KyleJamesWalker/restraint-py
src/restraint/restraints/backoff.py
.py
52987ab9ad197df6
7
0
"""Shared machinery for every restraint.""" from __future__ import annotations import asyncio import threading import time from abc import ABC, abstractmethod from typing import TYPE_CHECKING, NamedTuple if TYPE_CHECKING: from collections.abc import Callable from restraint.outcome import Outcome __all__ = ...
KyleJamesWalker/restraint-py
src/restraint/restraints/base.py
.py
6d3994d3039ff74e
7
0
"""Token bucket rate limiting.""" from __future__ import annotations from typing import TYPE_CHECKING from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: from collections.abc import Callable __all__ = ["TokenBucket"] class TokenBucket(Restraint): """Smooth sustained rate with a...
KyleJamesWalker/restraint-py
src/restraint/restraints/bucket.py
.py
0e6fd6160a0f758f
7
0
"""Combining restraints.""" from __future__ import annotations from typing import TYPE_CHECKING from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: from collections.abc import Iterator, Sequence from restraint.outcome import Outcome __all__ = ["Composite"] class Composite(Rest...
KyleJamesWalker/restraint-py
src/restraint/restraints/composite.py
.py
d042fc244aca7c37
7
0
"""Cap on calls in flight at once.""" from __future__ import annotations import asyncio import threading from typing import TYPE_CHECKING from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: from collections.abc import Callable __all__ = ["Concurrency"] #: How often a waiting caller ...
KyleJamesWalker/restraint-py
src/restraint/restraints/concurrency.py
.py
9fa469e15b088f07
7
0
"""Calendar-aligned call limits.""" from __future__ import annotations import datetime from typing import TYPE_CHECKING from restraint._calendar import CalendarWindows from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: from collections.abc import Callable __all__ = ["Limit"] def _...
KyleJamesWalker/restraint-py
src/restraint/restraints/limit.py
.py
f1fce27ca7c0bfe7
7
0
"""Hard budget caps that refuse rather than wait.""" from __future__ import annotations import datetime from typing import TYPE_CHECKING from restraint._calendar import CalendarWindows from restraint.exceptions import QuotaExceededError from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: ...
KyleJamesWalker/restraint-py
src/restraint/restraints/quota.py
.py
12c640f042ae803d
7
0
"""Minimum spacing and random dither between calls.""" from __future__ import annotations import random from typing import TYPE_CHECKING from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: from collections.abc import Callable __all__ = ["Jitter", "Spacing"] class Spacing(Restraint)...
KyleJamesWalker/restraint-py
src/restraint/restraints/spacing.py
.py
8bd238e2ddf61be4
7
0
"""Sliding window rate limiting.""" from __future__ import annotations from collections import deque from typing import TYPE_CHECKING from restraint.restraints.base import Reservation, Restraint if TYPE_CHECKING: from collections.abc import Callable __all__ = ["SlidingWindow"] class SlidingWindow(Restraint):...
KyleJamesWalker/restraint-py
src/restraint/restraints/window.py
.py
a4d2de37d5d71bc1
7
0
"""Global test fixtures.""" import datetime import pytest class FakeClock: """Deterministic wall clock that only moves when a test moves it.""" def __init__(self, start: datetime.datetime) -> None: """Start the clock at ``start``.""" self.moment = start self.slept: list[float] = [] ...
KyleJamesWalker/restraint-py
tests/conftest.py
.py
f527c4ff3180c72b
7.5
0
"""Test async gating.""" import asyncio import pytest from restraint import ( Gate, Limit, Outcome, Reservation, Restraint, RestraintError, add, restrain, ) class Delay(Restraint): """Admits every call, but only after a fixed reserved delay.""" def __init__(self, wait: floa...
KyleJamesWalker/restraint-py
tests/test_async.py
.py
1c072074cf4b49b0
7.5
0
"""Test outcome-driven backoff.""" import random import pytest from restraint import Backoff, Outcome, restrain from .conftest import FakeClock def build(clock: FakeClock, seed: int = 0, **kwargs: object) -> Backoff: """Build a backoff driven by the fake clock and a seeded rng.""" return Backoff( ...
KyleJamesWalker/restraint-py
tests/test_backoff.py
.py
1fc41fe40953acbc
7.5
0
"""Test calendar-aligned limits.""" import datetime import threading import pytest from restraint import Limit from .conftest import FakeClock def build(clock: FakeClock, **caps: int) -> Limit: """Build a Limit driven entirely by the fake clock.""" return Limit(now=clock.now, sleep=clock.sleep, **caps) ...
KyleJamesWalker/restraint-py
tests/test_limit.py
.py
8a2cc67e2a6b94ff
7.5
0
"""Test the restraint registry.""" import pytest from restraint import Limit from restraint.exceptions import RestraintConflictError, RestraintNotFoundError from restraint.registry import Registry @pytest.fixture def registry() -> Registry: """An empty registry.""" return Registry() def test_add_then_get(...
KyleJamesWalker/restraint-py
tests/test_registry.py
.py
3a20a4a9b64eabc8
7.5
0
"""Test the sliding window.""" import pytest from restraint import SlidingWindow from .conftest import FakeClock def build(clock: FakeClock, **kwargs: float) -> SlidingWindow: """Build a window driven by the fake clock.""" return SlidingWindow(clock=clock.monotonic, sleep=clock.sleep, **kwargs) # type: ig...
KyleJamesWalker/restraint-py
tests/test_window.py
.py
a6be8c09528f0284
7.5
0
import base64 from http import HTTPStatus from typing import TYPE_CHECKING from urllib.parse import urljoin import requests from pyotp import TOTP if TYPE_CHECKING: from iress.xplan.session import Session # Xplan uses the below unique string to unpack the password and OTP when authenticating _OTP_SEPARATOR = "\n...
iress/iress-xplan-api-examples
src/iress/xplan/api.py
.py
1d3ea0d9571f13da
7.3
3
import asyncio import logging import warnings from dataclasses import dataclass, field from enum import Enum from typing import ( Any, Callable, Coroutine, Dict, Generator, Hashable, List, Optional, Tuple, Union, ) from cafeteria.logging import LoggedObject CallbackType = Union...
abn/cafeteria-asyncio
src/cafeteria/asyncio/callbacks.py
.py
9cfee18df8305441
7.39
5
import asyncio import signal import warnings from asyncio import AbstractEventLoop from typing import Optional, Union async def cancel_all_tasks( loop: Optional[AbstractEventLoop] = None, *ignore: asyncio.Task ): """ Cancel and wait for all running tasks in the specified or current event loop. :param...
abn/cafeteria-asyncio
src/cafeteria/asyncio/commons.py
.py
e536717f20002c43
7.39
5
import logging import os import pathlib import shutil import subprocess from typing import Self from pysaurus.core import core_exceptions from pysaurus.core.datestring import Date from pysaurus.core.fs_utils import ( WIN_PREFIX, add_win_prefix, normalize_mount_point, strip_win_prefix, ) from pysaurus.c...
notoraptor/pysaurus
pysaurus/core/absolute_path.py
.py
11b39f102bfb9b39
7
0
"""Filesystem utilities for cross-platform filesystem type detection and mtime correction on Windows FAT32/exFAT drives.""" import ctypes import os import sys import time from functools import lru_cache _FAT_FILESYSTEMS = frozenset(("fat", "fat12", "fat16", "fat32", "vfat", "exfat")) # Windows long-path prefixes. WI...
notoraptor/pysaurus
pysaurus/core/fs_utils.py
.py
a01421cbec2e9cd3
7
0
"""Translation system for user-facing strings (i18n). "i18n" abbreviates "internationalization" — a numeronym: initial "i", 18 letters, final "n" (same family as "l10n" for "localization"). The term names this system across the project: this module, the ``poe i18n`` task and the extraction script (``pysaurus/scripts/e...
notoraptor/pysaurus
pysaurus/core/language.py
.py
26978cd6e444fc36
7
0
import base64 import os import platform import sys from html.parser import HTMLParser from io import BytesIO from typing import Iterator, Sequence from PIL import Image from pysaurus.core import core_exceptions from pysaurus.core.constants import THUMBNAIL_EXTENSION ImagePosition = tuple[int, int] class HTMLStripp...
notoraptor/pysaurus
pysaurus/core/modules.py
.py
bae011484792fdc9
7
0
import enum import logging from abc import ABC, abstractmethod from typing import Any, Collection, Iterable, Sequence from pysaurus.application import exceptions from pysaurus.core.absolute_path import AbsolutePath, PathType from pysaurus.core.classes import Selector from pysaurus.core.datestring import Date from pysa...
notoraptor/pysaurus
pysaurus/database/abstract_database.py
.py
e85e4b06e9f96861
7
0
"""Environment variable helpers shared across lemongrass commands.""" import os _LEGACY_TOKEN_VAR = 'RACEMONITOR_TOKEN' def _pool_var() -> str: """Return the configured name of the RaceMonitor token-pool env var.""" from lemongrass import _config return _config.load_config().racemonitor.tokens_env def ...
WOT-Lemons/Lemongrass
src/lemongrass/_env.py
.py
999ced63f4e6a859
7.3
3
"""Top-level Lemongrass TUI: a Home menu routing to the Laps flow and the Races browser, all as Screens under one app. `telem` and `pisugar-monitor` stay CLI-only. """ from typing import ClassVar from textual.app import App from textual.binding import Binding, BindingType from textual.screen import Screen from textua...
WOT-Lemons/Lemongrass
src/lemongrass/_home_tui.py
.py
3e19c7772e3debf2
7.3
3
"""Shared InfluxDB connection settings for lemongrass commands. Centralizes the URL/org (from the config layer, defaulting to prod), the retry policy, and the token-reading client factory so every command constructs its InfluxDBClient the same way. """ import logging import os import re import sys from urllib3 import...
WOT-Lemons/Lemongrass
src/lemongrass/_influx.py
.py
ff57d279ba0dcba9
7.3
3
"""Move race and session rows between the legacy Influx buckets and Postgres. Two directions, one shape: ``import_legacy`` reads the ``races`` and ``race_sessions`` buckets and writes through the same ``_db`` statements the application uses, and ``export_legacy`` renders the tables back out as Influx line protocol. Th...
WOT-Lemons/Lemongrass
src/lemongrass/_legacy_migration.py
.py
1849052534b1fc00
7.3
3
"""Terminal confirmation prompts, with one policy for end of input. Three commands ask the operator to confirm something — `races prune`, `entries propose`, and race-backfill's offer to persist changed settings — and all three have to decide what a closed stdin means. Ctrl-D, a redirect from /dev/null, and cron all ra...
WOT-Lemons/Lemongrass
src/lemongrass/_prompt.py
.py
a5705c513ff2824a
7.3
3
"""Durable on-disk spool for telemetry points during an InfluxDB outage. telem.py's hot tier is an in-memory queue flushed to InfluxDB every 0.5s. When a flush fails (Influx unreachable) the unwritten batch is serialized to InfluxDB line protocol and appended here, on disk, so it survives the watchdog restart a coinci...
WOT-Lemons/Lemongrass
src/lemongrass/_spool.py
.py
b3152c25ca08ad95
7.3
3
"""Shared Textual helpers used by the backfill and laps TUIs.""" import logging import sys import threading from collections import deque from contextlib import contextmanager from datetime import UTC, datetime from textual.widgets import RichLog def launch_tui(run_fn): """Shared bootstrap for the bare-`lemongr...
WOT-Lemons/Lemongrass
src/lemongrass/_tui.py
.py
1cd6c072fc9931dd
7.3
3
"""Entry point for the lemongrass CLI dispatcher.""" import importlib import json import sys from influxdb_client.rest import ApiException from race_monitor import RaceMonitorError, RaceMonitorHTTPError from sqlalchemy.exc import OperationalError, ProgrammingError from urllib3.exceptions import HTTPError # _influx is...
WOT-Lemons/Lemongrass
src/lemongrass/cli.py
.py
1994e3bbb09a5515
7.3
3
#!/usr/bin/env python """lemongrass db subcommand: manage the PostgreSQL schema. Subcommands: upgrade, current, import-legacy, export-legacy. Migrations ship inside the installed package, so this runs from a wheel or a container with no checkout and no alembic.ini present. """ import sys _SUBCOMMANDS = ('upgrade', '...
WOT-Lemons/Lemongrass
src/lemongrass/db.py
.py
b3b7cf4839210f64
7.3
3
"""Alembic environment for the lemongrass relational store. The URL always arrives from the Config the caller built (see ``_db.alembic_config``); this file never reads a database URL of its own. """ from alembic import context from sqlalchemy import engine_from_config, pool from lemongrass._schema import metadata ta...
WOT-Lemons/Lemongrass
src/lemongrass/migrations/env.py
.py
c099aa94154735bb
7.3
3
"""Create races and sessions. Revision ID: 0001 Revises: Create Date: 2026-08-09 """ import sqlalchemy as sa from alembic import op revision = '0001' down_revision = None branch_labels = None depends_on = None def upgrade(): """Create the races and sessions tables.""" op.create_table( 'races', ...
WOT-Lemons/Lemongrass
src/lemongrass/migrations/versions/0001_initial.py
.py
59cef235ffabed92
7.3
3
#!/usr/bin/env python """Sends PiSugar measurements to InfluxDB.""" import base64 import json import logging import os import socket import sys import urllib.error import urllib.parse import urllib.request from datetime import UTC, datetime from time import sleep, time from influxdb_client import Point from influxdb_...
WOT-Lemons/Lemongrass
src/lemongrass/pisugar_monitor.py
.py
83f7ee8ee7d9588f
7.3
3
#!/usr/bin/env python """Diagnose lap data discrepancies for a specific race and car number. Queries both the RaceMonitor API and InfluxDB and prints side-by-side lap counts, session breakdown, and all stored lap numbers so you can pinpoint whether a count mismatch is an API issue or a write issue. Assumes `lemongras...
WOT-Lemons/Lemongrass
src/lemongrass/race_diagnose.py
.py
33d7b6357bf39ca4
7.3
3
#!/usr/bin/env python """lemongrass tracks subcommand: keep the curated track data and the tables in step. Subcommand: sync. `db upgrade` runs the same sync as its final step, and store_race syncs before it writes, so this exists for the case where a curator edits tracks.toml and wants to see the effect without runnin...
WOT-Lemons/Lemongrass
src/lemongrass/tracks.py
.py
7719a9f94f5e2fb1
7.3
3
# obd and race_monitor are real, installed dependencies that import with no # hardware or network side effects (only OBD/Async construction and # RaceMonitorClient calls touch the outside world). Tests mock those I/O seams # individually, so no suite-wide module mock is needed here. import os import pytest @pytest.f...
WOT-Lemons/Lemongrass
tests/conftest.py
.py
183e68735e98d532
7.8
3
import os import subprocess import sys from unittest.mock import MagicMock, patch import pytest import lemongrass.cli as cli class TestConfigErrorHandling: """A broken LEMONGRASS_CONFIG must surface as a one-line error, not a traceback — and must not take down `--help`, which needs no config. Runs in a ...
WOT-Lemons/Lemongrass
tests/test_cli.py
.py
ac8a32f38f453cf2
7.8
3
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/asyncio/event_loop_factory.py
.py
e4fc414150180ed1
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/asyncio/task_executor.py
.py
8fe35c33c097b76d
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/config/config_filter_chain.py
.py
efbaa620595e5a9f
7.24
2
# Copyright © 2023-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/config/config_util.py
.py
c0413a4bf36b3dd6
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/config/environment_defaults.py
.py
af909a184e1974f9
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/config/file_of_class.py
.py
cdfd19af99553c82
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/logging/service_log_record.py
.py
26ec7886ad6dc3d6
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/logging/stream_to_logger.py
.py
80c1e9122dc2e147
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/logging/structured_log_record.py
.py
42f022333daf16da
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/parsers/list_parser.py
.py
20f5736f2d91bad8
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/persistence/easy/easy_hocon_persistence.py
.py
19a3b7f65b077dd7
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/persistence/easy/easy_json_persistence.py
.py
d9b0d0a0781912e3
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/persistence/easy/easy_txt_persistence.py
.py
02a5f109b19b562e
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/persistence/easy/easy_yaml_persistence.py
.py
bcd0c235b4dc7925
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/persistence/factory/hocon_persistence.py
.py
ec264e4cd25b8052
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/persistence/factory/json_gzip_persistence.py
.py
265aa5614cc2438b
7.24
2
# Copyright © 2019-2026 Cognizant Technology Solutions Corp, www.cognizant.com. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
cognizant-ai-lab/leaf-common
leaf_common/persistence/factory/json_persistence.py
.py
3aca7ab392157f11
7.24
2
import os import shutil import yaml import subprocess import sys from pathlib import Path from datetime import datetime import re import concurrent.futures import hashlib from PIL import Image # Mapping Obsidian callouts to Hugo Doks callout contexts and icons doks_callout_mapping = { "info": {"context": "note"...
valeryTech/valerytech.github.io
scripts/convert/convert.py
.py
3c5f271cd11ef50a
7.15
1
""" Resource types generated by the SAM transform. cfn-lint >= 1.54 no longer applies the SAM transform, it validates SAM templates against SAM schemas instead. Rules therefore see the `AWS::Serverless::*` resources of a template and no longer the resources CloudFormation deploys them as. `SAM_GENERATED_RESOURCE_TYPE...
aexeagmbh/cfn-lint-rules
src/cfn_lint_ax/_sam.py
.py
5c6dbee6a5310aba
7.15
1
# Contains code from https://github.com/awslabs/serverless-rules/tree/0344f9426263be9a08873425511228a0a310116e # type: ignore """ Utilities """ import re from typing import TypeVar SUB_PATTERN = re.compile(r"\${(?P<ref>[^}]+)}") TValue = TypeVar("TValue", bound="Value") # pylint: disable=invalid-name class Value...
aexeagmbh/cfn-lint-rules
src/cfn_lint_ax/_utils.py
.py
8eebe4f22cfcfd91
7.15
1
# Contains code from https://github.com/awslabs/serverless-rules/tree/0344f9426263be9a08873425511228a0a310116e # type: ignore """ Rules for AppSync resources """ from cfnlint.rules import CloudFormationLintRule, RuleMatch class AppSyncTracingRule(CloudFormationLintRule): """ Ensure AppSync GraphQL APIs have ...
aexeagmbh/cfn-lint-rules
src/cfn_lint_ax/serverless_rules/appsync.py
.py
c490ad84e2873716
7.15
1
# Contains code from https://github.com/awslabs/serverless-rules/tree/0344f9426263be9a08873425511228a0a310116e # type: ignore """ Rules for EventBridge resources """ from cfnlint.rules import CloudFormationLintRule, RuleMatch from .._sam import SAM_DEAD_LETTER_EVENT_TYPES, serverless_function_events class EventBrid...
aexeagmbh/cfn-lint-rules
src/cfn_lint_ax/serverless_rules/eventbridge.py
.py
2e1c3828410f2109
7.15
1
# Contains code from https://github.com/awslabs/serverless-rules/tree/0344f9426263be9a08873425511228a0a310116e # type: ignore """ Rules for SNS resources """ from cfnlint.rules import CloudFormationLintRule, RuleMatch from .._sam import serverless_function_events class SnsNoRedrivePolicyRule(CloudFormationLintRule)...
aexeagmbh/cfn-lint-rules
src/cfn_lint_ax/serverless_rules/sns.py
.py
fc7b3cb61332be34
7.15
1
# Contains code from https://github.com/awslabs/serverless-rules/tree/0344f9426263be9a08873425511228a0a310116e # type: ignore """ Rules for SQS resources """ # ES6000 needs nothing for SAM: the only `AWS::SQS::Queue` SAM generates is the # destination of an `EventInvokeConfig.DestinationConfig.OnFailure` of type # `SQ...
aexeagmbh/cfn-lint-rules
src/cfn_lint_ax/serverless_rules/sqs.py
.py
7be4ec23706fea2f
7.15
1
# Contains code from https://github.com/awslabs/serverless-rules/tree/0344f9426263be9a08873425511228a0a310116e # type: ignore """ Rules for Step Functions resources """ from cfnlint.rules import CloudFormationLintRule, RuleMatch class StepFunctionsTracingRule(CloudFormationLintRule): """ Ensure Step Function...
aexeagmbh/cfn-lint-rules
src/cfn_lint_ax/serverless_rules/step_functions.py
.py
f13a48a4415923f2
7.15
1
# Contains code from https://github.com/awslabs/serverless-rules/tree/0344f9426263be9a08873425511228a0a310116e # type: ignore """ Testing templates """ import collections import os import cfnlint.core import cfnlint.decode.cfn_yaml import pytest # Loading templates Template = collections.namedtuple("Template", ["fil...
aexeagmbh/cfn-lint-rules
tests/serverless_rules/test_templates.py
.py
0040a89afffa2411
7.65
1
from cfnlint.schema import PROVIDER_SCHEMA_MANAGER from cfn_lint_ax._sam import ( SAM_ASYNC_EVENT_PRINCIPALS, SAM_DEAD_LETTER_EVENT_TYPES, SAM_EVENT_BRIDGE_EVENT_TYPES, SAM_EVENT_PRINCIPALS, SAM_EVENT_SOURCE_MAPPING_DESTINATION_EVENT_TYPES, SAM_EVENT_SOURCE_MAPPING_EVENT_TYPES, SAM_GENERATE...
aexeagmbh/cfn-lint-rules
tests/test_sam.py
.py
4813f6a213ae010f
7.65
1
"""Binomial sequence-distance model used by `ddmc.clustering.DDMC`. Contains: - `AAfreq` / `AAlist`: reference amino acid frequencies and the fixed amino acid ordering used throughout the package. - Position weight matrix helpers (`position_weight_matrix`, `fast_position_weight_matrix`, `frequencie...
meyer-lab/DDMC
ddmc/binomial.py
.py
108bdce4388910f7
7.15
1