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
"""empty message Revision ID: 727eb738db92 Revises: Create Date: 2025-10-02 14:54:26.247464 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '727eb738db92' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
godotengine/godot-showreel-voting
migrations/versions/727eb738db92_.py
.py
917728d3c2ef95ca
7.66
20
"""empty message Revision ID: 7c6cc24c9d34 Revises: 727eb738db92 Create Date: 2026-08-05 12:54:04.147726 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '7c6cc24c9d34' down_revision = '727eb738db92' branch_labels = None depends_on = None def upgrade(): # ...
godotengine/godot-showreel-voting
migrations/versions/7c6cc24c9d34_.py
.py
865ce57e548a68f8
7.66
20
""" Sphinx extension to add ReadTheDocs-style "Edit on GitHub" links to the sidebar. Loosely based on https://github.com/astropy/astropy/pull/347 """ import os import warnings __licence__ = "BSD (3 clause)" def get_github_url(app, view, path): return f"https://github.com/{app.config.edit_on_github_project}/{vi...
fvaleye/metadata-guardian
python/docs/source/_ext/edit_on_github.py
.py
12b5c9e0ad3cfb74
7.64
18
import importlib.resources from collections.abc import Generator from enum import Enum from typing import Any from loguru import logger from pydantic import BaseModel, PrivateAttr from .metadata_guardian import RawDataRule, RawDataRules class AvailableCategory(Enum): """Available Data Rules Categories.""" ...
fvaleye/metadata-guardian
python/metadata_guardian/data_rules.py
.py
b11c70ed22e0b821
7.64
18
import pyarrow from pyarrow import csv from pydantic import BaseModel, Field from rich.console import Console from rich.markup import escape from rich.progress import ( BarColumn, Progress, SpinnerColumn, TaskID, TimeRemainingColumn, ) from rich.table import Table from .data_rules import MetadataGu...
fvaleye/metadata-guardian
python/metadata_guardian/report.py
.py
8d50f7973b049dcb
7.64
18
from collections.abc import Iterator from typing import Any from loguru import logger from pydantic import Field from ..metadata_source import ColumnMetadata from .external_metadata_source import ( ExternalMetadataSource, ExternalMetadataSourceException, ) try: from deltalake import DeltaTable DELTA...
fvaleye/metadata-guardian
python/metadata_guardian/source/external/deltatable_source.py
.py
a324c27a3b0bc6dc
7.64
18
from collections.abc import Iterator from typing import Any from loguru import logger from pydantic import Field from ..metadata_source import ColumnMetadata from .external_metadata_source import ( ExternalMetadataSource, ExternalMetadataSourceException, ) try: from google.cloud import bigquery GCP_...
fvaleye/metadata-guardian
python/metadata_guardian/source/external/gcp_source.py
.py
9c7dce0ba191e760
7.64
18
import json from collections.abc import Iterator from enum import Enum from typing import Any from loguru import logger from pydantic import Field from ..metadata_source import ColumnMetadata from .external_metadata_source import ( ExternalMetadataSource, ExternalMetadataSourceException, ) try: from conf...
fvaleye/metadata-guardian
python/metadata_guardian/source/external/kafka_schema_registry_source.py
.py
60a2abcf78311584
7.64
18
from collections.abc import Iterator from enum import Enum from typing import Any from loguru import logger from pydantic import Field from ..metadata_source import ColumnMetadata from .external_metadata_source import ( ExternalMetadataSource, ExternalMetadataSourceException, ) try: import pymysql M...
fvaleye/metadata-guardian
python/metadata_guardian/source/external/mysql_source.py
.py
54e3192ecb2c77c5
7.64
18
from collections.abc import Iterator from enum import Enum from typing import Any from loguru import logger from pydantic import Field from ..metadata_source import ColumnMetadata from .external_metadata_source import ( ExternalMetadataSource, ExternalMetadataSourceException, ) try: import snowflake.conn...
fvaleye/metadata-guardian
python/metadata_guardian/source/external/snowflake_source.py
.py
75535c108ef01897
7.64
18
from collections.abc import Iterator from loguru import logger from .local_metadata_source import ColumnMetadata, LocalMetadataSource try: from avro.schema import parse AVRO_INSTALLED = True except ImportError: logger.warning("AVRO optional dependency is not installed.") AVRO_INSTALLED = False if ...
fvaleye/metadata-guardian
python/metadata_guardian/source/local/avro_schema_source.py
.py
8c19ddb71a612f02
7.64
18
import json from collections.abc import Iterator from loguru import logger from .local_metadata_source import ColumnMetadata, LocalMetadataSource try: from avro.datafile import DataFileReader from avro.io import DatumReader AVRO_INSTALLED = True except ImportError: logger.warning("AVRO optional dep...
fvaleye/metadata-guardian
python/metadata_guardian/source/local/avro_source.py
.py
410fd2ea5219e04d
7.64
18
from collections.abc import Iterator from typing import Any import pyarrow from pyarrow.dataset import Dataset from pyarrow.fs import FileSystem, LocalFileSystem from pydantic import Field from ..metadata_source import ColumnMetadata, MetadataSource class LocalMetadataSource(MetadataSource): """LocalMetadata So...
fvaleye/metadata-guardian
python/metadata_guardian/source/local/local_metadata_source.py
.py
d67ce76b27d2d056
7.64
18
from .local_metadata_source import LocalMetadataSource class ParquetSource(LocalMetadataSource): """Instance for a local Parquet file.""" @classmethod def type(cls) -> str: """ The type of the source. :return: the name of the source. """ return "Parquet"
fvaleye/metadata-guardian
python/metadata_guardian/source/local/parquet_source.py
.py
fac11bfb5e7d76fa
7.14
18
"""Library of loader functions for loading gachapy objects from json files. These functions can be used to save and load Controller objects to and from json files. This should be used to save and load game state of active gachapy games. Loading and saving objects lower than the Controller (Items, Banners, Players) s...
jakejack13/gachapy
gachapy/loader.py
.py
5f663f1d1ae9d276
7.64
18
"""The test suite for keylang.py Author: Jacob Kerr, 2021 """ import sys sys.path.insert(1, ".") from gachapy import * import unittest def test_lang(test: unittest.TestCase, program: str, rarity: float, expected: float): """Asserts that the program parses and interprets to the expected result Paramters...
jakejack13/gachapy
tests/test_keylang.py
.py
2ede657e5f8f3ce2
8.14
18
"""The test suite for objects.py Author: Jacob Kerr, 2021 """ import sys sys.path.insert(1, ".") from gachapy import * import unittest def test_item_change_rarity(test: unittest.TestCase, item: Item, rarity: float): """Asserts that the changed rarity of the item is equal to the inputted rarity or if the out...
jakejack13/gachapy
tests/test_objects.py
.py
fc275b66bbf5021e
7.14
18
#!python3 # coding=UTF-8 class MyPriorityQueue: '''使用二叉堆的最小优先队列的python3.6.9实现,方便做A* search和Mondrian\\ 优先级函数f(a,b)返回"(a优先级比b高)?"''' def __init__(self, f): '''初始化最小优先队列为空,二元优先级函数为f(a,b)''' self.queue = [] self.function = f def father(self, i): '''得到queue[i-1]在二叉堆中的父...
yzj2019/k_anonymity
k_anonymity/MyPriorityQueue.py
.py
9c9f9a1e12d3a746
7.64
18
#!python3 # coding=UTF-8 class MyTree: '''泛化树形结构的python3.6.9实现\\ 构建树的步骤:init -> add_relation*n -> build_h2node -> build_node2leaf -> build_isdigit -> (not digit)build_h2GeneralizationDict -> build_node2LM\\ 最终只剩下树高h、isdigit、h2node、高度到泛化字典的映射h2GeneralizationDict、node2LM这五个属性''' def __init__(self, name...
yzj2019/k_anonymity
k_anonymity/MyTree.py
.py
8e82582e0cfba25a
7.64
18
#!python3 # coding=UTF-8 # 打算最后再做成一个class发布出去 from k_anonymity.load import loaddata import os import k_anonymity from k_anonymity.MyPriorityQueue import MyPriorityQueue import numpy as np import pandas as pd import random from utils.arg_parser import parse_args def multiply(x,y): return x*y def bigger(a,b): ...
yzj2019/k_anonymity
test2.py
.py
55ab655c750ddb46
7.14
18
import urllib from .common_dictionaries import ATLAS_GEO_NAMES, QGIS_SOURCE_TYPE_ID, SOURCE_TYPE_ID from .galah_filter import check_for_duplicate_filters, galah_filter, process_or_filters from .galah_geolocate import galah_geolocate from .search_taxa import generate_list_taxonConceptIDs, search_taxa def add_extras_t...
AtlasOfLivingAustralia/galah-python
galah/src/galah/common_add_functions.py
.py
3a20c6047c76f22f
7.54
11
def print_if_verbose(verbose=False, headers=None, URL=None, method=None, payload=None): """Print the headers, URL, method and payload for debugging""" if verbose: print() print("headers: {}".format(headers)) print() print("URL for querying: {}".format(URL)) print("Method:...
AtlasOfLivingAustralia/galah-python
galah/src/galah/common_functions.py
.py
e8d98a4ecbd3eaf1
7.54
11
import geopandas as gpd import pandas as pd import shapely import shapely.wkt from shapely import MultiPolygon, Polygon from .common_dictionaries import ATLAS_CRS from .galah_config import check_atlas def galah_geolocate(polygon=None, bbox=None, atlas=None, crs=None): """ Restrict results to those from a spe...
AtlasOfLivingAustralia/galah-python
galah/src/galah/galah_geolocate.py
.py
1f7b890a9f3eae11
7.54
11
from pandas.api.types import is_numeric_dtype from .galah_config import get_config_values from .show_all import ( show_all_apis, show_all_assertions, show_all_atlases, show_all_collections, show_all_datasets, show_all_fields, show_all_licences, show_all_lists, show_all_profiles, ...
AtlasOfLivingAustralia/galah-python
galah/src/galah/search_all.py
.py
3d7ea5c04a3c28d6
7.54
11
import pandas as pd import requests from .common_functions import kvp_to_columns, print_if_verbose from .galah_config import get_api_url, get_config_values def show_values(field=None, lists=False, config_file=None): """ Users may wish to see the specific values within a chosen field, profile or list to narro...
AtlasOfLivingAustralia/galah-python
galah/src/galah/show_values.py
.py
fcb609f63028ca8a
7.54
11
"""Perceptual colour difference and colour-vision-deficiency simulation. Module type: Functions These turn "this palette looks good" into a measured claim. ``deltaE_ok`` is plain Euclidean distance in OKLab -- that is the entire point of a perceptually uniform space, and it is why the module works in OKLab rather tha...
AntoineBellemare/biotuner
biotuner/biocolors/color/difference.py
.py
91ee964501bf5859
7.52
10
"""sRGB gamut boundary and gamut mapping in OKLCh. Module type: Functions The sRGB chroma ceiling varies by more than 5x across the OKLCh hue circle: measured, it runs from 0.048 (L=0.90, h=270) to 0.296 (L=0.60, h=315). A fixed absolute chroma range therefore cannot be right everywhere -- it is several times over bu...
AntoineBellemare/biotuner
biotuner/biocolors/color/gamut.py
.py
f04fbd6a783636af
7.52
10
"""Wavelength -> colour, and audible frequency -> wavelength. Module type: Functions Two spectral renderers: - ``'cie1931'`` (default) -- CIE 1931 colour matching functions -> XYZ -> sRGB. The CMFs use the Wyman, Sloan & Shirley (2013) analytic multi-lobe Gaussian fit, so this costs ~15 lines and no data table. ...
AntoineBellemare/biotuner
biotuner/biocolors/color/spectral.py
.py
7f520936527446da
8.02
10
"""biotuner.biocolors — map biosignal frequencies to visible-light wavelengths and RGB colors. Module type: Functions """ import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation from matplotlib.colors import hsv_to_rgb import colorsys from mpl_toolkits.axes_grid1 import Image...
AntoineBellemare/biotuner
biotuner/biocolors/legacy.py
.py
8e61282db23e6036
7.52
10
"""Relative-tolerance matching of biosignal peaks to element/material lines. The original matcher used an *absolute* wavelength tolerance, meaningless across a table spanning 56–46 525 Å (a plausible peak set returned 0 matches). Matching here is **relative** — a musical-cents window — the same discipline the rest of ...
AntoineBellemare/biotuner
biotuner/bioelements/matching.py
.py
c0cc964727ef703a
7.52
10
"""Periodic-table geometry — element name -> (row, col) on the standard table. Used to render a biosignal's element resonance *as the periodic table itself*. Lanthanides and actinides are placed in the two detached f-block rows (rows 7-8). """ from __future__ import annotations # Z-ordered symbols and NIST-style full...
AntoineBellemare/biotuner
biotuner/bioelements/periodic.py
.py
94535ba1f315c5c6
7.52
10
"""Access the NIST emission-line tables shipped inside the package. Two tables are available, named as in NIST: ``"air"`` (air-wavelength lines, the terrestrial default) and ``"vacuum"`` (vacuum-wavelength lines, for astrophysical work / the ``ether`` archetype). Both are loaded lazily and cached. Columns: ``element,...
AntoineBellemare/biotuner
biotuner/bioelements/tables.py
.py
f8a247b7dae7a2c1
7.52
10
""" Internal helpers for :mod:`biotuner.harmonic_geometry`. These utilities are not part of the public API. They handle ratio normalization, coprime checks, and log-space conversions used across the geometry submodules. """ from __future__ import annotations import math from fractions import Fraction from typing imp...
AntoineBellemare/biotuner
biotuner/harmonic_geometry/_utils.py
.py
e77297e6ec64e835
7.52
10
"""Python host runtime for downloading, staging, and installing retro distros. The ``retro`` workflow resolves one ``RetroConfig`` and passes it through ``Downloader``, ``MediaStager``, and ``QemuRuntime``. Most host work is synchronous. A live VM introduces one event loop for the QEMU process, QMP, serial input, and ...
jblang/retrodist
hostlib/__init__.py
.py
afcb3e789c94e821
7.56
12
"""Load and validate the declarative configuration used by every host subsystem. Configuration is read from ``config.toml`` in the selected directory and its immediate parent. The selected config inherits parent values; child scalars and arrays replace them, while nested tables retain keys the child does not override....
jblang/retrodist
hostlib/config.py
.py
677a98c9e2f9707a
7.56
12
"""Resolve a selected distro config and the filesystem paths derived from it. ``Context`` is deliberately configuration-agnostic. It identifies the repo, selected config, current command, and temporary directory, and implements the local-then-parent file lookup shared by TOML inheritance and custom assets. """ from _...
jblang/retrodist
hostlib/context.py
.py
5fd7cc35d42a313c
7.56
12
"""Parse Debian package indexes and generate dependency-ordered guest installers.""" from __future__ import annotations from dataclasses import dataclass import gzip from pathlib import Path, PurePosixPath import re from . import ConfigError from .schemas.postinst import DebianPackagesConfig @dataclass(frozen=True...
jblang/retrodist
hostlib/debian_packages.py
.py
44d4b81c3f573287
7.56
12
"""Materialize the source media declared by a distro's ``[download]`` table. The downloader supports direct URL/path pairs, official Slackware mirrors, archived Debian release trees, and references to shared CD-ROM configs. It is idempotent at the file level and uses wget to traverse HTTP directory indexes. """ from ...
jblang/retrodist
hostlib/download.py
.py
8ee2c983de72a6da
7.56
12
"""Validate and dispatch installer drivers.""" from __future__ import annotations from pathlib import Path from typing import Callable from ..config import RetroConfig from .. import ConfigError from ..qmp import Monitor from ..session import QemuSession, run_script from .debian_091 import run_debian_091 from .debia...
jblang/retrodist
hostlib/install/__init__.py
.py
e886a4d136290ebf
7.56
12
"""Automate Debian 0.91's prompt-driven ``dinstall`` shell script.""" from __future__ import annotations from ..config import RetroConfig from ..schemas.debian import Debian091InstallConfig from ..session import Match, QemuSession from .fdisk import Fdisk from .postinst import run_postinst class Debian091Installer:...
jblang/retrodist
hostlib/install/debian_091.py
.py
b168baf53e80613d
7.56
12
"""Automate Debian releases built around the menu-driven Dinstall program. The driver combines VGA menu navigation with the guestlib dialog adapter on ``ttyS3``. A named variant selects the fixed release workflow, while partitioning, first boot, account setup, and staged post-installation remain shared. """ from __fu...
jblang/retrodist
hostlib/install/debian_dialog.py
.py
be575092d72aa1e4
7.56
12
"""Drive the guestlib ``dialog`` line protocol over the automation serial port. The in-guest adapter emits widget metadata and pauses at ``RESPONSE:``. Choices match title, widget type, and optional item text; answers may be literal values, callbacks for nested flows, or ``None`` to leave input for another handler. ""...
jblang/retrodist
hostlib/install/dialog.py
.py
58ee7d95cc22962a
7.56
12
"""Automate the classic interactive ``fdisk`` bundled with early installers. The driver communicates through an active serial shell and uses prompts common to the fdisk variants supplied by configured installers. It replaces the first two primary partitions with swap and root partitions. """ from __future__ import an...
jblang/retrodist
hostlib/install/fdisk.py
.py
da02c281189bd3eb
7.56
12
"""Shared guest commands and post-installation helpers for installer drivers.""" from __future__ import annotations import shlex from ..config import RetroConfig from ..session import Match, QemuSession def fat_mount_command(mount: str, partition: str, filesystem: str) -> str: """Return a quoted command that m...
jblang/retrodist
hostlib/install/postinst.py
.py
525a7c192b363621
7.56
12
"""Automate Red Hat 1.x through 3.x dialog-based installer drivers. The early Red Hat installer is a Perl program which delegates its UI to the ``dialog`` executable. Replacing that executable with guestlib's serial adapter makes the widgets observable and avoids brittle VGA screen matching. Screens that do not use t...
jblang/retrodist
hostlib/install/redhat_dialog.py
.py
fedf9fb9b2312107
7.56
12
"""Automate Slackware releases that use Pkgtool's ``setup`` program. The guestlib dialog adapter makes setup menus observable on ``ttyS3``. One driver covers releases from early floppy sets through CD-ROM distributions by selecting a named Python workflow profile. Source layout and package selection remain declarative...
jblang/retrodist
hostlib/install/slackware_dialog.py
.py
10144dbf2977ff73
7.56
12
"""Automate Slackware ``doinstall`` and ``syssetup`` releases with Sysinstall. These installers are serial prompt streams rather than menus. The driver boots to a shell, partitions and formats the target, selects an install type from the staged package layout, answers package prompts, and performs system setup. """ f...
jblang/retrodist
hostlib/install/slackware_sysinstall.py
.py
60f86557c20997fc
7.56
12
"""Automate Slackware 1.1.1's serial prompt-driven setup program.""" from __future__ import annotations from ..config import RetroConfig from ..schemas.slackware import SlackwareTtyInstallConfig from ..session import Match, QemuSession from .fdisk import Fdisk from .postinst import run_postinst class SlackwareTtyIn...
jblang/retrodist
hostlib/install/slackware_tty.py
.py
7b33e3c80dc59700
7.56
12
"""Provide case-tolerant file access to ISO images.""" from __future__ import annotations import fnmatch from pathlib import Path, PurePosixPath from . import CommandError, ConfigError def _key(path: str) -> str: """Normalize an ISO path for case-insensitive lookup.""" return "/" + "/".join( part.s...
jblang/retrodist
hostlib/iso.py
.py
68fd6a16d2c58764
7.56
12
"""Coordinate downloaded-media staging into ``qemu.d``. The public stager sequences source extraction, exceptional custom hooks, image transformations, kickstart injection, and guestlib refresh. Format-specific extraction and guestlib assembly live behind focused collaborators. """ from __future__ import annotations ...
jblang/retrodist
hostlib/media.py
.py
cf36fdfc2d674ee7
7.56
12
"""Extract selected files and package trees from supported source media.""" from __future__ import annotations import fnmatch from pathlib import Path, PurePosixPath import shutil import tarfile import zipfile import py7zr from .config import RetroConfig from .context import Context from . import ConfigError from ....
jblang/retrodist
hostlib/media_extract.py
.py
5cea5d0b5f9201b1
7.56
12
"""Translate resolved host configuration and staged media into a QEMU process. This module owns disk creation, conventional media attachment, loopback port forward allocation, Unix-socket character devices, startup reporting, and the race between QMP readiness and premature emulator exit. """ from __future__ import a...
jblang/retrodist
hostlib/qemu.py
.py
346eb5f75997bf99
7.56
12
"""Provide the narrow QMP interface used by VM automation and the ``qmp`` CLI. The third-party client stays behind ``Monitor`` so connection retries, command timeouts, HMP tunneling, key pacing, and test doubles have one project-owned boundary. """ from __future__ import annotations import asyncio import logging fro...
jblang/retrodist
hostlib/qmp.py
.py
ad4489884dc45919
7.56
12
"""Expose focused inspection and device-control commands for a running VM.""" from __future__ import annotations import argparse import asyncio import logging import math from pathlib import Path from . import RetroError from .qmp import Monitor, encode_key from .vga import ScreenObserver log = logging.getLogger(__...
jblang/retrodist
hostlib/qmp_cli.py
.py
34f6410ca2cb85a1
7.56
12
"""Orchestrate the synchronous ``retro`` workflow and live QEMU lifecycle. Commands share one ``Context`` and resolved ``RetroConfig``. Download, staging, and packaging remain synchronous; an event loop is created only while QEMU and installer transports are live. """ from __future__ import annotations import argpar...
jblang/retrodist
hostlib/retro_cli.py
.py
adb33a5bd498bdce
7.56
12
"""Shared strict-model base and user-facing validation error translation.""" from __future__ import annotations from typing import TypeVar from pydantic import BaseModel, ConfigDict, ValidationError from .. import ConfigError class ConfigModel(BaseModel): """Base schema that rejects coercion and unknown confi...
jblang/retrodist
hostlib/schemas/base.py
.py
162f0a8d199098ed
7.56
12
"""Typed configuration for Debian installer drivers.""" from __future__ import annotations from typing import Literal from pydantic import Field from .base import ConfigModel from .install import InstallDiskConfig, InstallLocaleConfig from .network import NetworkConfig class DebianDialogNetworkConfig(NetworkConfi...
jblang/retrodist
hostlib/schemas/debian.py
.py
544532809d59deb9
7.56
12
"""Typed configuration for source-media downloads.""" from __future__ import annotations from pydantic import Field from .base import ConfigModel class DownloadFile(ConfigModel): """Validate one direct download declaration.""" path: str url: str class DownloadConfig(ConfigModel): """Configure di...
jblang/retrodist
hostlib/schemas/download.py
.py
479f9100fa6f6e35
7.56
12
"""Configuration shared by installer families.""" from __future__ import annotations from typing import Literal from .base import ConfigModel class InstallDiskConfig(ConfigModel): """Configure paths and partition defaults shared by installer drivers.""" target_disk: str = "/dev/hda" swap_mb: int = 64 ...
jblang/retrodist
hostlib/schemas/install.py
.py
4bb252cbca67655d
7.56
12
"""Typed configuration for declarative media extraction.""" from __future__ import annotations from pydantic import Field, model_validator from .base import ConfigModel class Overlay(ConfigModel): """Validate one staged-media overlay operation.""" source: str destination: str class ExtractionConfig(...
jblang/retrodist
hostlib/schemas/media.py
.py
b698e3a80368bde8
7.56
12
"""Typed configuration for generated post-install behavior.""" from __future__ import annotations from typing import Literal from pydantic import Field, model_validator from .base import ConfigModel from .network import NetworkConfig class PostinstNetworkConfig(NetworkConfig): """Add guestlib compatibility co...
jblang/retrodist
hostlib/schemas/postinst.py
.py
281cdc91f467655c
7.56
12
"""Typed configuration models for QEMU hardware and runtime settings.""" from __future__ import annotations from dataclasses import dataclass from typing import Annotated, Literal from pydantic import Field from .base import ConfigModel class QemuDisk(ConfigModel): """Validate the nested QEMU disk table.""" ...
jblang/retrodist
hostlib/schemas/qemu.py
.py
e08bb7547394de95
7.56
12
"""Typed configuration for Red Hat installer drivers.""" from __future__ import annotations from typing import Literal from pydantic import Field from .base import ConfigModel from .install import InstallDiskConfig, InstallLocaleConfig, InstallPromptsConfig from .network import NetworkConfig class RedHatNewtPacka...
jblang/retrodist
hostlib/schemas/redhat.py
.py
d0c6eb6642e88366
7.56
12
"""Typed configuration for Slackware installer drivers.""" from __future__ import annotations from typing import Literal from pydantic import Field from .base import ConfigModel from .install import InstallDiskConfig, InstallLocaleConfig, InstallPromptsConfig from .network import NetworkConfig class SlackwareDial...
jblang/retrodist
hostlib/schemas/slackware.py
.py
5b6ac67a4beb2991
7.56
12
"""Manage buffered installer communication over QEMU's automation serial port. One background task drains ``ttyS3.sock`` into an append-only text buffer and a raw log. Wait operations advance an independent consumption offset, allowing dialog automation to mark and rewind input without losing the transcript. Keyboard ...
jblang/retrodist
hostlib/serial.py
.py
ec1d998b699a0d32
7.56
12
"""Expose synchronous QEMU scripting over event-loop-owned VM transports.""" from __future__ import annotations import asyncio from enum import Enum import logging from pathlib import Path import re import shlex import time from typing import Any, Callable, Coroutine, TypeVar from .qmp import Monitor, encode_key fro...
jblang/retrodist
hostlib/session.py
.py
98519a79c5dc308d
7.56
12
"""Build Slackware package-selection files from staged package inventories. Tagset rules inherit at the same parent/variant boundary as config TOML. Package inventories may come from extracted disk directories or directly from an ISO; the result is written in the per-disk format expected by Pkgtool. """ from __future...
jblang/retrodist
hostlib/slackware_tagfiles.py
.py
2da3f076829e2d4c
7.56
12
"""Observe VGA text screens by reading guest memory through QMP. The observer is demand-driven: each wait dumps VGA memory with ``pmemsave`` and decodes character bytes. Invalidation prevents a prompt that was just answered from matching again before the guest redraws. """ from __future__ import annotations import a...
jblang/retrodist
hostlib/vga.py
.py
0083de98f3ee8b46
7.56
12
"""This module provides async utility functions for interacting with the Aca-Py Admin API. Functions: - get_acapy_headers: Generates HTTP headers required for Aca-Py admin API calls, including authentication tokens. - acapy_admin_request: Makes a generic API request to the Aca-Py admin endpoint, ...
openwallet-foundation/acapy-endorser-service
endorser/api/acapy_utils.py
.py
e7ca9e89fdc291ca
7.45
7
import sys from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context from sqlmodel.sql.sqltypes import AutoString sys.path = ["", ".."] + sys.path[1:] # TODO: Fix it from api.config import settings # noqa from api.db.models import BaseT...
openwallet-foundation/acapy-endorser-service
endorser/api/db/migrations/env.py
.py
af702e7fb7d87e76
7.45
7
"""Added details field for the /allow/ endpoints Revision ID: 9a8ef028a751 Revises: fb66f2d55aee Create Date: 2024-02-22 19:49:54.326215 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '9a8ef028a751' down_revision = 'fb66f2d55aee' branch_labels = None depends_o...
openwallet-foundation/acapy-endorser-service
endorser/api/db/migrations/versions/added_details_field_for_the_allow__9a8ef028a751.py
.py
726f5623a6640093
7.45
7
"""make connection_id unique Revision ID: f4e857e3d8eb Revises: b1e41d72f00e Create Date: 2024-09-16 17:33:30.156800 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'f4e857e3d8eb' down_revision = 'b1e41d72f00e' branch_labels = None depends_on = None def upgra...
openwallet-foundation/acapy-endorser-service
endorser/api/db/migrations/versions/make_connection_id_unique_f4e857e3d8eb.py
.py
d6f9a368002725bf
7.45
7
"""rename author_did to creddef_author_did and issuer_did to schema_issuer_did Revision ID: b1e41d72f00e Revises: 9a8ef028a751 Create Date: 2024-09-12 00:02:34.371864 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'b1e41d72f00e' down_revision = '9a8ef028a751' ...
openwallet-foundation/acapy-endorser-service
endorser/api/db/migrations/versions/rename_author_did_to_creddef_author_did__b1e41d72f00e.py
.py
db0183451e6f69fd
7.45
7
"""Defines base classes for schemas and ORM models with common fields and configurations. This module provides foundational classes using SQLModel and Pydantic. The base classes define UUID, created_at, and updated_at fields, which are automatically generated and managed on the server side. """ import uuid from date...
openwallet-foundation/acapy-endorser-service
endorser/api/db/models/base.py
.py
da889aef881a32eb
7.45
7
"""JWT Access Token Management. This module provides functions and classes to create and manage JWT access tokens, including their encoding and expiration handling. """ from datetime import datetime, timedelta, timezone from fastapi import Depends, HTTPException, status from fastapi.security import OAuth2PasswordBea...
openwallet-foundation/acapy-endorser-service
endorser/api/endpoints/dependencies/jwt_security.py
.py
ecd0c198d974c2f0
7.45
7
"""Configuration management for the Aries Endorser Service. This module handles the configuration settings for the Aries Endorser Service, providing classes and methods to manage configurations from different sources, such as environment variables, databases, and wallets. It includes conversion functions to translate ...
openwallet-foundation/acapy-endorser-service
endorser/api/endpoints/models/configurations.py
.py
7f8c218ac42d49bc
7.45
7
"""This module defines connection-related models and utility functions. Includes models for connections, enums for various connection states, roles, and status types, and functions to convert between webhook payloads, Connection objects, and database models. Additionally, it logs the conversion process. """ import lo...
openwallet-foundation/acapy-endorser-service
endorser/api/endpoints/models/connections.py
.py
df0badd2ce10b6f8
7.45
7
"""Module for handling endorsement transactions in the Aries Endorser Service. This module includes enumerations for endorser role types, transaction states and types, and models for representing and converting endorsement transactions between various forms, such as payloads, model objects, and database entities. It p...
openwallet-foundation/acapy-endorser-service
endorser/api/endpoints/models/endorse.py
.py
504b5c4ee2b2a815
7.45
7
"""Module for handling webvh witnessing in the Aries Endorser Service.""" import logging import json from pydantic import BaseModel from api.db.models.witness_request import WitnessRequestDbRecord logger = logging.getLogger(__name__) class WitnessRequest(BaseModel): """Represent a witnessing request.""" s...
openwallet-foundation/acapy-endorser-service
endorser/api/endpoints/models/witness.py
.py
918e73d18efa499e
7.45
7
"""Module for handling Aca-Py WebHook endpoints in the Endorser Agent. This module defines a FastAPI application and router to process incoming webhook events from an Aries Cloudagent (Aca-Py). It provides endpoints for validating and processing webhook data based on various topics and state changes, and includes depe...
openwallet-foundation/acapy-endorser-service
endorser/api/endpoints/routes/webhooks.py
.py
15b7b7c208859dd6
7.45
7
"""Main module for initializing and running the Aries Endorser Service. This module sets up a FastAPI server to host the Endorser service. It configures logging, sets environment variables, and mounts the main application along with webhook and endorser routes. The application responds to startup and shutdown events t...
openwallet-foundation/acapy-endorser-service
endorser/api/main.py
.py
85bff223ca313281
7.45
7
"""Endorser configuration management module for Aries Endorser Service.""" import logging from sqlalchemy.ext.asyncio import AsyncSession import api.acapy_utils as au from api.endpoints.models.configurations import ( ConfigurationType, ) from api.endpoints.models.endorse import ( EndorseTransactionType, ) fr...
openwallet-foundation/acapy-endorser-service
endorser/api/services/admin.py
.py
0214e6c209ad3f39
7.45
7
# Copyright 2019, by the California Institute of Technology. # ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged. # Any commercial use must be negotiated with the Office of Technology # Transfer at the California Institute of Technology. # # This software may be subject to U.S. export control laws....
podaac/l2ss-py
podaac/subsetter/subset_harmony.py
.py
f517d3b354636c7a
7.6
15
""" Converts the time variable to datetime if xarray doesn't decode times Parameters ---------- dataset : xr.Dataset time_vars : list instrument_type: string Returns ------- xr.Dataset datetime.datetime """ import datetime import numpy as np import xarray as xr def compute_utc_name(group: xr.Dataset) -> str | Non...
podaac/l2ss-py
podaac/subsetter/tree_time_converting.py
.py
5a0878b4ff827615
7.6
15
""" =============== coordinate_utils.py =============== Utility functions for coordinate operations and transformations. """ import numpy as np import xarray as xr from podaac.subsetter import datatree_subset def _apply_scale_offset(scale: float, offset: float, value: float) -> float: """Apply scale and offset...
podaac/l2ss-py
podaac/subsetter/utils/coordinate_utils.py
.py
37f4ecf8c4e423d2
7.6
15
""" =============== file_utils.py =============== Utility functions for file and dataset handling. """ from collections.abc import Hashable, Mapping import cftime import dateutil import xarray as xr import xarray.coding.times from dateutil import parser from xarray import DataTree def chunk_datatree(datatree: xr.D...
podaac/l2ss-py
podaac/subsetter/utils/file_utils.py
.py
77fdb2bb3e2af7e5
7.6
15
""" =============== hdf_utils.py =============== Utility functions for handling HDF files, and dimension recovery """ import re import warnings import numpy as np import xarray as xr from xarray import DataTree _PHONY_RE = re.compile(r"^phony_dim_(\d+)$") def _is_phony(dim: str) -> bool: return _PHONY_RE.matc...
podaac/l2ss-py
podaac/subsetter/utils/hdf_utils.py
.py
aac69c982ea42680
7.6
15
""" mask_utils.py ------------- Utilities for creating and applying masks for subsetting operations. Place all mask creation, manipulation, and application functions here. """ import xarray as xr def align_time_to_lon_dim(time_data, lon_data, temporal_cond): """ Aligns a 1D time_data variable to one of the ...
podaac/l2ss-py
podaac/subsetter/utils/mask_utils.py
.py
9f49b0071d5e547d
7.6
15
""" =============== metadata_utils.py =============== Utility functions for metadata operations and history management. """ import datetime import json import os import re from typing import Any import importlib_metadata import netCDF4 as nc import numpy as np import xarray as xr from xarray import DataTree from po...
podaac/l2ss-py
podaac/subsetter/utils/metadata_utils.py
.py
76eff45624b5e8a3
7.6
15
""" =============== spatial_utils.py =============== Utility functions for geospatial calculations and polygon operations. """ import numpy as np from shapely.geometry import MultiPolygon, Point, Polygon from podaac.subsetter.utils import coordinate_utils def create_geospatial_bounding_box(spatial_bounds_array, ea...
podaac/l2ss-py
podaac/subsetter/utils/spatial_utils.py
.py
ea15d92d15d29252
7.6
15
""" =============== time_utils.py =============== Utility functions for time and temporal condition handling. """ import datetime import functools import operator import re from typing import get_args import julian import numpy as np import pandas as pd import xarray as xr from dateutil import parser from xarray.cor...
podaac/l2ss-py
podaac/subsetter/utils/time_utils.py
.py
f84ad49eb127faaa
7.6
15
""" =============== variables_utils.py =============== Utility functions to get variables and normalize variables for a granule files. """ import xarray as xr def get_vars_with_paths(tree: xr.DataTree) -> set[str]: """ Get all variables and coordinates with their full paths from a DataTree Parameters ...
podaac/l2ss-py
podaac/subsetter/utils/variables_utils.py
.py
8b9731953896ec59
7.6
15
# Copyright 2019, by the California Institute of Technology. # ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged. # Any commercial use must be negotiated with the Office of Technology # Transfer at the California Institute of Technology. # # This software may be subject to U.S. export control laws....
podaac/l2ss-py
tests/benchmark_subset.py
.py
0bcac9ec016943fb
7.1
15
import numpy as np import pytest import xarray as xr from podaac.subsetter.utils.file_utils import calculate_chunks, chunk_datatree @pytest.fixture def small_dataset() -> xr.Dataset: return xr.Dataset({"var": (["x", "y"], np.zeros((100, 100)))}) @pytest.fixture def large_dataset() -> xr.Dataset: return xr.D...
podaac/l2ss-py
tests/test_chunk.py
.py
9abc05592efc2a6f
7.1
15
import xarray as xr from xarray import DataTree from podaac.subsetter.datatree_subset import find_fully_empty_paths, is_empty, subtree_is_empty def make_simple_tree(): ds = xr.Dataset({"a": ("x", [1, 2]), "b": ("x", [3, 4])}) ds.attrs["foo bar"] = "baz" tree = DataTree(ds) tree["child"] = DataTree(xr...
podaac/l2ss-py
tests/test_datatree_subset_utils.py
.py
bbce5335352be4ad
7.1
15
import numpy as np import xarray as xr from podaac.subsetter import dimension_cleanup def test_sync_dims_inplace(): # original: variable 'a' with dims ('x',) orig = xr.Dataset({'a': (('x',), [1, 2, 3])}) # new: variable 'a' with dims ('x', 'y') new = xr.Dataset({'a': (('x', 'y'), np.ones((3, 2)))}) ...
podaac/l2ss-py
tests/test_dimension_cleanup.py
.py
f6a9d176a8838b0f
7.1
15
import operator import numpy as np import xarray as xr from podaac.subsetter.datatree_subset import get_indexers_from_nd def create_lon_lat_condition_dataset( lon_bounds, lat_bounds, lon_var_name='longitude', lat_var_name='latitude', lon_dim_name='lon', lat_dim_name='lat', third_dim_name='level', ...
podaac/l2ss-py
tests/test_get_indexers.py
.py
722f96c57fc01b22
7.1
15
import traceback from podaac.subsetter.subset_harmony import L2SSException def test_exception_message_formatting(): """ Test that the L2SSException correctly formats the error message with file, line, function, and original error details. """ try: # Simulate an error by intentionally caus...
podaac/l2ss-py
tests/test_l2ss_py_exception.py
.py
3f628ea1f0789b5e
8.1
15
import numpy as np import pytest import xarray as xr from podaac.subsetter.utils.time_utils import build_temporal_cond class TestNewBuildTemporalCond: """Test cases for build_temporal_cond function.""" def test_float64_with_description_attribute(self): """ Test the case where time_data is f...
podaac/l2ss-py
tests/test_new_build_temporal_cond.py
.py
09b5cfe4c2d593fc
7.1
15
"""Tests covering new lines introduced in issue/441 branch.""" import numpy as np import xarray as xr from xarray import DataTree from podaac.subsetter.datatree_subset import apply_indexers_to_tree class TestApplyIndexersToTreeWithParentDs: """Tests for apply_indexers_to_tree when parent_ds is provided.""" ...
podaac/l2ss-py
tests/test_parent_alignment_and_time_broadcast.py
.py
84a1c05501bd2716
7.1
15