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
"""Unit tests for EpiAutoGP data preparation date exclusion functionality. This module tests the Polars-based date exclusion filtering used in prep_epiautogp_data._apply_date_exclusions(). It includes both direct tests of the actual production implementation and cross-validation against a reference list-based implemen...
CDCgov/cfa-stf-routine-forecasting
tests/epiautogp/test_prep_epiautogp_data.py
.py
554aa499245c48e2
8.12
16
"""Unit tests for nowcast sources and reporting-delay helpers.""" import datetime as dt import math import pytest from cfa.stf.routine.data.nowcast import NowcastData from cfa.stf.routine.epiautogp.config import EpiAutoGPConfig from cfa.stf.routine.epiautogp.nowcast import FixedNowcast from cfa.stf.routine.epiautogp...
CDCgov/cfa-stf-routine-forecasting
tests/epiautogp/test_reporting_delay_nowcast.py
.py
e50cd46bdfddbc11
8.12
16
import csv import re # --- Optional Dependency Handling --- try: from khmernltk import pos_tag as khmernltk_pos_tag KHMERNLTK_AVAILABLE = True except ImportError: KHMERNLTK_AVAILABLE = False try: import pytesseract from PIL import Image OCR_AVAILABLE = True except ImportError: ...
back-kh/KSWv2-Stop-Word-Dictionary-for-Khmer-Document
tools/kh-segmentation.py
.py
d2201e816d312e4e
7.54
11
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Endpoint testing script This script tests a list of endpoints to ensure they are working as expected. """ import json import re from dataclasses import dataclass from enum import Enum from typing import Any, List, Optional import requests class ExpectedResponseType(En...
rios0rios0/boss
scripts/test_endpoints.py
.py
667460ddd0e7e371
7.92
6
"""The Emerald Hot Water System integration.""" from __future__ import annotations import logging from collections.abc import Mapping from typing import Any from emerald_hws.emeraldhws import EmeraldHWS from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform from homeassistant.c...
ross-w/emerald-hws-ha
custom_components/emeraldenergy/__init__.py
.py
6a2aac56673b4521
7.6
15
"""Config flow for Emerald Hot Water System integration.""" from __future__ import annotations import logging from collections.abc import Mapping from typing import Any import voluptuous as vol from homeassistant import config_entries from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.c...
ross-w/emerald-hws-ha
custom_components/emeraldenergy/config_flow.py
.py
58d190c060e228a8
7.6
15
"""Shared helpers for the Emerald Hot Water System integration.""" from __future__ import annotations import re from collections.abc import Iterator, Mapping from pathlib import PurePath from typing import Any from emerald_hws.emeraldhws import EmeraldHWS from .const import ( CONF_CONNECTION_TIMEOUT, CONF_H...
ross-w/emerald-hws-ha
custom_components/emeraldenergy/helpers.py
.py
2532da62a147cb60
7.6
15
"""Implementation of the Sensor platform for Emerald HWS energy monitoring.""" from __future__ import annotations import logging from datetime import datetime, date from homeassistant import config_entries from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorStateClass, ) ...
ross-w/emerald-hws-ha
custom_components/emeraldenergy/sensor.py
.py
63bbd8111b70ea9d
7.6
15
"""Implementation of the Water Heater type for Emerald HWS.""" import logging import homeassistant.helpers.config_validation as cv import voluptuous as vol from homeassistant import config_entries from homeassistant.components.water_heater import ( STATE_ECO, STATE_HEAT_PUMP, STATE_OFF, STATE_PERFORMA...
ross-w/emerald-hws-ha
custom_components/emeraldenergy/water_heater.py
.py
7168eef9d4b49bb9
7.6
15
# Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. """## Overview. This document explains how to use the `CertHandler` class to create and manage TLS certificates through the `tls_certificates` interface. The goal of the CertHandler is to provide a wrapper to the `tls_certificates` library func...
canonical/grafana-agent-operator
lib/charms/observability_libs/v0/cert_handler.py
.py
8406d461f74e3094
7.42
6
#!/usr/bin/env python3 # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. # Learn more at: https://juju.is/docs/sdk """Snap Installation Module. Modified from https://github.com/canonical/k8s-operator/blob/main/charms/worker/k8s/src/snap.py """ import logging import platform import subproces...
canonical/grafana-agent-operator
src/snap_management.py
.py
8ac5722bbbf33f7c
7.42
6
# Copyright 2021 Canonical Ltd. # See LICENSE file for licensing details. import functools import logging import os from collections import defaultdict from datetime import datetime from pathlib import Path import pytest import sh from pytest_operator.plugin import OpsTest logger = logging.getLogger(__name__) class...
canonical/grafana-agent-operator
tests/integration/conftest.py
.py
1502435bb853a810
7.92
6
# Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. from unittest.mock import PropertyMock, patch import pytest from charms.tempo_coordinator_k8s.v0.charm_tracing import charm_tracing_disabled @pytest.fixture def placeholder_cfg_path(tmp_path): return tmp_path / "foo.yaml" @pytest.fixture...
canonical/grafana-agent-operator
tests/unit/conftest.py
.py
4b3d03a49aa9743a
7.92
6
import tempfile import unittest from pathlib import Path from unittest.mock import patch import yaml from ops import ActiveStatus, BlockedStatus from ops.testing import Harness from charm import GrafanaAgentMachineCharm as GrafanaAgentCharm class TestUpdateStatus(unittest.TestCase): def setUp(self, *unused): ...
canonical/grafana-agent-operator
tests/unit/test_cloud_integration.py
.py
58882bd17e26f09f
7.92
6
# Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. from unittest.mock import patch import pytest import yaml from ops import BlockedStatus from ops.testing import Context, State import charm @pytest.fixture(autouse=True) def patch_all(placeholder_cfg_path): with patch("grafana_agent.CONFI...
canonical/grafana-agent-operator
tests/unit/test_config.py
.py
f8ba89f5741f43c6
7.92
6
import dash_mantine_components as dmc from dash_iconify import DashIconify from lib.constants import HEADER_HEIGHT excluded_links = [ "/404", "/styles-api", "/style-props", "/dash-iconify", "/migration", "/learning-resources", ] # A page excluded from the sidebar is excluded from the MACHINE ...
pip-install-python/Dash-Documentation-Boilerplate
components/navbar.py
.py
7b0cf25972cf054f
7.56
12
""" ASGI/Starlette middleware ports of Flask-only hooks used in this boilerplate. When the Dash backend is FastAPI, these slot in where the Flask ``before_request`` decorator was used. """ from __future__ import annotations from starlette.middleware.base import BaseHTTPMiddleware from starlette.requests import Reques...
pip-install-python/Dash-Documentation-Boilerplate
lib/asgi_middleware.py
.py
7c61973d63eee567
7.56
12
""" ``/healthz`` liveness probe for the Flask and Quart backends. The 2plot.ai hub sweeps every satellite's ``/healthz`` once an hour and records up/down + latency — that's the "Satellite health & reach" panel on ``/traffic`` (the traffic rollup this app POSTs supplies the other half). The FastAPI build declares a typ...
pip-install-python/Dash-Documentation-Boilerplate
lib/health.py
.py
2ed871c1d2af1d55
7.56
12
"""Client for the network hub's agent-key and page-tier endpoints. Three calls, all satellite → hub, never browser → hub:: POST {hub}/api/agent-key/current -> {"key": "k2p_..."} for the copy button POST {hub}/api/agent-key/verify -> {"verdict": ..., "ttl": ...} POST {hub}/api/page-tiers ->...
pip-install-python/Dash-Documentation-Boilerplate
lib/hub_client.py
.py
5007b381595584fe
7.56
12
""" Create a GitHub issue from a Discord message. This script is run by the discord-issue GitHub Action. It: 1. Fetches the target message and surrounding context from Discord 2. Calls Claude to summarise into a structured GitHub issue 3. Creates the issue via GitHub API 4. Posts a visible reply in the channel with th...
gyrinx-app/gyrinx
.github/scripts/discord_issue.py
.py
0d8b3e6d42da1e2a
7.57
13
"""Shared configuration for the analytics dashboard.""" from datetime import datetime, timedelta import streamlit as st from sqlalchemy import create_engine, text DB_HOST = "localhost" DB_PORT = 5433 DB_USER = "postgres" DB_PASSWORD = "postgres" # nosec B105 - local dev only @st.cache_resource def get_engine(db_n...
gyrinx-app/gyrinx
analytics/streamlit/config.py
.py
8cac65ce579f90e0
7.57
13
"""Lore/narrative usage analysis.""" import pandas as pd import streamlit as st from config import setup_sidebar st.set_page_config(page_title="Lore Usage", page_icon="📖", layout="wide") st.title("📖 Lore Usage") st.caption("Lists and fighters with narrative/about text filled in") engine, start_date, date_trunc, ti...
gyrinx-app/gyrinx
analytics/streamlit/pages/4_Lore_Usage.py
.py
28053608b70cf74f
7.57
13
"""Cached facts analysis - lists with dirty=False.""" import pandas as pd import streamlit as st from config import setup_sidebar st.set_page_config(page_title="Cached Facts", page_icon="💾", layout="wide") st.title("💾 Cached Facts (dirty=False)") st.caption("Analysis of lists with cached rating/stash/credits values...
gyrinx-app/gyrinx
analytics/streamlit/pages/5_Cached_Facts.py
.py
566fadae8e9acb54
7.57
13
"""Content library changes analysis using django-simple-history tables.""" import pandas as pd import plotly.express as px import streamlit as st from config import setup_sidebar st.set_page_config(page_title="Content Library Changes", page_icon="📚", layout="wide") st.title("📚 Content Library Changes") st.caption("...
gyrinx-app/gyrinx
analytics/streamlit/pages/6_Content_Library_Changes.py
.py
272660ae8607dd3e
7.57
13
""" Campaign Seasonality & Community Activity Analysis Investigates two hypotheses: 1. The community goes quiet between campaign seasons 2. Campaigns run end-to-end in around 6 weeks """ import pandas as pd import plotly.express as px import plotly.graph_objects as go import streamlit as st from config import setup_s...
gyrinx-app/gyrinx
analytics/streamlit/pages/7_Campaign_Seasonality.py
.py
33db393e200ea543
7.57
13
"""Platform account forms. The allauth overrides named in ``settings.ACCOUNT_FORMS`` plus the username-change form. None of these touch edition models. ``BadgeSelectionForm`` lives here too, now that ``UserProfile`` is a platform model. """ from allauth.account.forms import LoginForm, ResetPasswordForm, SignupForm f...
gyrinx-app/gyrinx
gyrinx/account_forms.py
.py
b5575784723b30b8
7.57
13
# A group planted by data migration rather than by a fixture, so every # environment has it the moment it deploys, with nothing to remember to click. # Nothing in the app reads it: who may see the n26 edition is decided by each # view's own guard. from django.db import migrations GROUP_NAME = "N26 Testers" def crea...
gyrinx-app/gyrinx
gyrinx/accounts/migrations/0002_n26_testers_group.py
.py
4923a831ca8726bb
7.07
13
from django.conf import settings from django.core.exceptions import ValidationError from django.db import models from django.db.models.signals import post_delete, post_save from django.dispatch import receiver from django.utils import timezone from django.utils.functional import cached_property from simple_history.mode...
gyrinx-app/gyrinx
gyrinx/accounts/models.py
.py
9ae6041a2fc68589
7.57
13
import json import logging from allauth.account.adapter import DefaultAccountAdapter from django.conf import settings from django.contrib.sites.shortcuts import get_current_site logger = logging.getLogger(__name__) class CustomAccountAdapter(DefaultAccountAdapter): def is_open_for_signup(self, request): ...
gyrinx-app/gyrinx
gyrinx/adapter.py
.py
27c32b4e9b6f3945
7.57
13
"""Admin site that hands authentication to django-allauth. Django's own admin login view authenticates against a username and password and nothing else. It knows nothing about allauth's login stages, so a staff account with TOTP configured could sign in at ``/admin/login/`` without ever being asked for a second factor...
gyrinx-app/gyrinx
gyrinx/admin_site.py
.py
9617c86b77971423
7.57
13
import json import logging from collections import defaultdict from datetime import timedelta from django.contrib import admin from django.contrib.auth import get_user_model from django.db.models import Count from django.db.models.functions import TruncDate from django.shortcuts import render from django.urls import p...
gyrinx-app/gyrinx
gyrinx/analytics/admin.py
.py
df885dbfa81089c6
7.57
13
from django.db import migrations, models import gyrinx.analytics.nouns # Which edition each noun already in the table belongs to. Spelled out here # rather than read from the registry so that re-running this migration on an # old database keeps giving the same answer as it did the first time, # whatever the registry ...
gyrinx-app/gyrinx
gyrinx/analytics/migrations/0002_event_edition.py
.py
f9ead3f579f3a190
7.57
13
import json import logging import re from enum import Enum from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from gyrinx.analytics.nouns import Edition, edition_for_noun, noun_choices from gyrinx.base_models import ...
gyrinx-app/gyrinx
gyrinx/analytics/models.py
.py
5e53ce2817af7192
7.57
13
"""Extension point: the nouns an event may be recorded against, and the edition each noun belongs to. The platform owns the event log, but it does not own the words. "List" and "fighter" mean something in one edition; "gang" and "model" mean something in another; "user" and "banner" belong to neither, because an accou...
gyrinx-app/gyrinx
gyrinx/analytics/nouns.py
.py
86854aa14469fe4e
7.57
13
"""Extension point: the lines plotted on the dashboard's growth chart. The platform owns the analytics dashboard, but it has no idea what a gang or a fighter is — only an edition does. So the dashboard asks: each edition registers one :class:`GrowthSeries` per line it wants on the cumulative-growth chart, carrying a c...
gyrinx-app/gyrinx
gyrinx/analytics/registry.py
.py
28af6dca1a7b167a
7.57
13
""" Register Discord application commands. Creates the "Create Issue" message context menu command that allows users to right-click a message and file a GitHub issue from it. Usage: manage register_discord_commands Requires DISCORD_BOT_TOKEN and DISCORD_APPLICATION_ID in settings. """ import requests from djang...
gyrinx-app/gyrinx
gyrinx/api/management/commands/register_discord_commands.py
.py
2edf018c58581a75
7.57
13
from django.db import models from gyrinx.models import Base class WebhookRequest(Base): """ Webhook is a URL that will receive POST requests when certain events occur. """ source = models.CharField(max_length=150, blank=False, null=False) event = models.CharField(max_length=150, blank=True, null...
gyrinx-app/gyrinx
gyrinx/api/models.py
.py
66fee092706e76f7
7.57
13
import logging from allauth.account.models import EmailAddress from gyrinx.accounts.models import PatreonStatus, UserProfile from gyrinx.badges import rank_for_tier_title logger = logging.getLogger(__name__) DELETE_EVENTS = {"members:delete", "members:pledge:delete"} PATREON_STATUS_MAP = { "active_patron": Pat...
gyrinx-app/gyrinx
gyrinx/api/patreon.py
.py
dbfc1afd19a7ff86
7.57
13
"""Background tasks for the platform's outward integrations. ``trigger_discord_issue_action`` bridges Discord to GitHub: it turns a message in the project's Discord into a GitHub issue on this repository. That is project tooling, not game content, which is why it lives beside the API views that receive the Discord int...
gyrinx-app/gyrinx
gyrinx/api/tasks.py
.py
5d3fd729d9199acf
7.57
13
""" Common IO Helper functionality """ import numpy as np MAX_READ_SIZE = 2**27 def fromfile(file_obj, dtype, count, out=None): # Read as bytes because some io libraries (eg smart_open) don't always like buffers with uncommon dtypes if out is not None: out = out.view(np.uint8) values = ensure_ar...
ValkyrieSystems/sarkit
sarkit/_iohelp.py
.py
6ce5b94db85d829e
7.62
16
import lxml.etree import numpy as np from . import _io as cphdio from . import _xml as cphdxml def get_pvp_dtype(cphd_xmltree: lxml.etree.ElementTree) -> np.dtype: """Get a structured datatype for the Per Vector Parameter set defined in ``cphd_xmltree``. Parameters ---------- cphd_xmltree : lxml.etr...
ValkyrieSystems/sarkit
sarkit/cphd/_pvps.py
.py
045ab7db2f1fdb7a
7.62
16
import copy import lxml.etree import numpy as np import numpy.polynomial.polynomial as npp import sarkit.wgs84 from . import _scenecoords as skcphd_sc from . import _xml as skcphd_xml def compute_reference_geometry( cphd_xmltree: lxml.etree.ElementTree, pvps: np.ndarray ) -> lxml.etree.Element: """Return a...
ValkyrieSystems/sarkit
sarkit/cphd/_refgeom.py
.py
93798550526c7890
7.62
16
"""Calculations related to the CPHD signal model.""" import numpy as np import numpy.typing as npt def compute_t_ref( xmt: npt.ArrayLike, rcv: npt.ArrayLike, srp: npt.ArrayLike, txc: npt.ArrayLike, trc: npt.ArrayLike, ) -> np.ndarray: """Compute the reference times for the given collection ge...
ValkyrieSystems/sarkit
sarkit/cphd/_sigmodel.py
.py
7ad1b96cc314f26a
7.62
16
"""Calculations related to geographic coordinates in the imaged scene. CRSD D&I DD explicitly states equivalence to CPHD. """ import lxml.etree import numpy as np import numpy.typing as npt import sarkit.cphd._scenecoords as cphd_scenecoords import sarkit.crsd._xml as crsd_xml def ecf_to_iac(crsd_xmltree: lxml.etr...
ValkyrieSystems/sarkit
sarkit/crsd/_scenecoords.py
.py
26929510d68958f5
7.62
16
""" Functions for interacting with SICD XML """ import copy import importlib.resources import pathlib from collections.abc import Sequence import lxml.etree import numpy as np import numpy.polynomial.polynomial as npp import numpy.typing as npt import sarkit.sicd.projection as ss_proj import sarkit.xmlhelp as skxml ...
ValkyrieSystems/sarkit
sarkit/sicd/_xml.py
.py
2111bb777da8727f
7.62
16
"""Functions that can select monostatic or bistatic methods.""" from collections.abc import Callable import lxml.etree import numpy as np import numpy.typing as npt from . import _calc as calc from . import _params as params def _get_projsets(sicd_xmltree, image_grid_locations): """Extract metadata params and ...
ValkyrieSystems/sarkit
sarkit/sicd/projection/_derived.py
.py
b787d42a7556b3b4
7.62
16
"""Calculations described in SIDD Volume 1 section 7.""" import dataclasses import numpy as np import numpy.typing as npt import sarkit.wgs84 @dataclasses.dataclass(kw_only=True) class Angles: """Angles defined in SIDD Volume 1, ExploitationFeatures Calculations""" # Geometry Azimuth: float # 7.5.1 -...
ValkyrieSystems/sarkit
sarkit/sidd/calculations/exploitation_features.py
.py
c20321254ff000f5
7.62
16
"""Image Pixel Array information from SIDD Volume 1 section 2""" import enum import lxml.etree class CoordinateSystem(enum.StrEnum): """Enumeration of Coordinate Systems supported by SIDD .. autoattribute:: CoordinateSystem.PGD :no-index: .. autoattribute:: CoordinateSystem.PFGD :no-ind...
ValkyrieSystems/sarkit
sarkit/sidd/calculations/image_pixel_array.py
.py
143b3afe7f165491
7.62
16
""" Regression test: decoding a malformed input from bytearray/memoryview must release the underlying buffer so the bytearray can be resized afterwards. """ import pytest from bencode2 import COMPILED, BencodeDecodeError, bdecode @pytest.mark.skipif( not COMPILED, reason="only relevant to compiled extension...
trim21/bencode-py
tests/test_buffer_leak.py
.py
70c915f7e6dff8a6
7.92
6
from typing import Any import pytest from typing_extensions import Buffer from bencode2 import BencodeDecodeError, bdecode def test_non_bytes_input(): with pytest.raises(TypeError): bdecode("s") # type: ignore with pytest.raises(TypeError): bdecode(1) # type: ignore @pytest.mark.paramet...
trim21/bencode-py
tests/test_decode.py
.py
14b1fb18c2423ae4
7.92
6
from typing import AsyncGenerator import structlog import re import sqlalchemy as sa from alembic import op import os from fastapi import Request from sqlalchemy import text from sqlalchemy.engine import make_url from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine from sqlalchemy.pool import NullPool ...
bcgov/lcfs
backend/lcfs/db/dependencies.py
.py
07e4559e46bb76c4
7.42
6
import asyncio import alembic_postgresql_enum from logging.config import fileConfig from alembic import context from sqlalchemy.ext.asyncio.engine import create_async_engine from sqlalchemy.pool import NullPool from sqlalchemy.future import Connection from lcfs.db.meta import meta from lcfs.db.models import load_all_...
bcgov/lcfs
backend/lcfs/db/migrations/env.py
.py
d9ef1ed4021c85e8
7.42
6
"""Add renewable to Fuel Types Revision ID: 0576833c005d Revises: ec826b9226df Create Date: 2025-01-22 00:04:37.043142 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "0576833c005d" down_revision = "ec826b9226df" branch_labels = None depends_on = None def upg...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-01-22-00-04_0576833c005d.py
.py
90790e2a701152c8
7.42
6
""" Add role reference to notification_type This migration adds a required 'role_id' foreign key to the 'notification_type' table, linking it to the 'role' table. It also populates 'role_id' for existing notification types based on their 'notification_type_id'. Additionally, it updates the 'IN_APP' notification chann...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-01-23-15-38_7f7b03241d7f.py
.py
f1e2b19d43476ce2
7.42
6
"""Add Transaction trigger for CR Revision ID: 66b4ae533e8d Revises: 7f7b03241d7f Create Date: 2025-01-27 19:01:02.908162 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "66b4ae533e8d" down_revision = "7f7b03241d7f" branch_labels = None depends_on = None def ...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-01-27-19-01_66b4ae533e8d.py
.py
780c01fe99db69e6
7.42
6
"""Update intended use flags Revision ID: 0d8e7ee6a6e0 Revises: 26bb41f15dc4 Create Date: 2025-01-28 16:15:20.208093 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "0d8e7ee6a6e0" down_revision = "26bb41f15dc4" branch_labels = None depends_on = None def upgra...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-01-28-16-15_0d8e7ee6a6e0.py
.py
8a884050274dcd29
7.42
6
""" Add 'Rejected' Status to ComplianceReportStatusEnum Revision ID: d4f91d033ac7 Revises: 0d8e7ee6a6e0 Create Date: 2025-01-31 10:48:30.770439 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "d4f91d033ac7" down_revision = "0d8e7ee6a6e0" branch_labels = None dep...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-01-31-10-48_d4f91d033ac7.py
.py
dbc51b7583a718e9
7.42
6
"""Allow null values for provision_of_the_act_id and ci_of_fuel in other_uses table - TFRS migration Revision ID: e50534b604f2 Revises: 0d8e7ee6a6e0 Create Date: 2025-02-03 22:44:16.180111 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "e50534b604f2" down_revi...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-02-03-22-44_e50534b604f2.py
.py
58b18ea1f1833746
7.42
6
"""Add early issuance flag Revision ID: 6231e628ae7d Revises: e50534b604f2 Create Date: 2025-02-04 19:20:29.373450 """ import sqlalchemy as sa from alembic import op from alembic_postgresql_enum import TableReference # revision identifiers, used by Alembic. revision = "6231e628ae7d" down_revision = "e50534b604f2" b...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-02-04-19-20_6231e628ae7d.py
.py
877ac2539cd89050
7.42
6
""" Add new transfer_comment table and migrate existing comment fields. Revision ID: 145e5501e322 Revises: 6231e628ae7d Create Date: 2025-02-06 22:29:53.919293 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "145e5501e...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-02-06-22-29_145e5501e322.py
.py
f7e05dd380b1d7ff
7.42
6
"""Link documents to AA and IA Revision ID: 775db18a959a Revises: 0bfaff83e51e Create Date: 2025-02-10 01:01:12.679938 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "775db18a959a" down_revision = "0bfaff83e51e" branch_labels = None depends_on = None def upg...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-02-10-01-01_775db18a959a.py
.py
0193b428defca0ee
7.42
6
"""add compliance period to uci Revision ID: 44c6f23b71d3 Revises: f0d95904a9dd Create Date: 2025-02-11 23:51:48.841478 """ from alembic import op import sqlalchemy as sa from sqlalchemy import text from datetime import datetime # revision identifiers, used by Alembic. revision = "44c6f23b71d3" down_revision = "f0d...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-02-11-23-51_44c6f23b71d3.py
.py
4e41e732dbaed39e
7.42
6
"""Add compliance period to energy tables Revision ID: 9e1da9e38f20 Revises: 44c6f23b71d3 Create Date: 2025-02-12 11:01:01.472659 """ import sqlalchemy as sa from alembic import op from sqlalchemy import text # revision identifiers, used by Alembic. revision = "9e1da9e38f20" down_revision = "0d5836bb1bf8" branch_la...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-02-12-18-16_9e1da9e38f20.py
.py
b11a723ee94b3069
7.42
6
"""Re-calculate Summaries Revision ID: 985de92bdf83 Revises: 16e4ebc2d6a5 Create Date: 2025-02-25 20:59:28.890262 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "985de92bdf83" down_revision = "16e4ebc2d6a5" branch_lab...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-02-25-20-59_985de92bdf83.py
.py
cd9fdff039a47263
7.42
6
"""Add not recommended Revision ID: d21997277eca Revises: c1e2d64aeea4 Create Date: 2025-02-28 18:38:10.952016 """ from alembic import op from sqlalchemy import text # revision identifiers, used by Alembic. revision = "d21997277eca" down_revision = "c1e2d64aeea4" branch_labels = None depends_on = None def upgrade...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-02-28-18-38_d21997277eca.py
.py
62f19c826e8b6324
7.42
6
"""Add versioning to allocation agreement Revision ID: 173179aeed95 Revises: 9e1da9e38f20 Create Date: 2025-03-05 14:00:17.134309 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "173179aeed95" down_revision = "4a34a520...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-03-05-14-00_173179aeed95.py
.py
f6e4480efb8b5a09
7.42
6
"""Increase NUMERIC precision for fuel_export.energy Revision ID: 937c793bf7b8 Revises: 173179aeed95 Create Date: 2025-03-05 17:20:42.573152 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "937c793bf7b8" down_revision = "173179aeed95" branch_labels = None depen...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-03-05-17-20_937c793bf7b8.py
.py
06061488784a2b96
7.42
6
"""assessment statement Revision ID: 6c427c10a63d Revises: 937c793bf7b8 Create Date: 2025-03-11 19:53:16.260428 """ import sqlalchemy as sa from alembic import op from alembic_postgresql_enum import TableReference from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "6c427c...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-03-11-19-53_6c427c10a63d.py
.py
308aa2f06c3a5f52
7.42
6
"""Remove fuel codes with default ci Revision ID: 67e5de628cef Revises: fd8ee994668c Create Date: 2025-03-14 16:34:17.478471 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "67e5de628cef" down_revision = "ffe9e3da563b" branch_labels = None depends_on = None de...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-03-14-16-34_67e5de628cef.py
.py
ddb0003eb932e22f
7.42
6
"""Delete Dead Links Revision ID: e77de76bb555 Revises: 67e5de628cef Create Date: 2025-03-17 20:44:00.115397 """ from alembic import op # revision identifiers, used by Alembic. revision = "e77de76bb555" down_revision = "67e5de628cef" branch_labels = None depends_on = None def upgrade() -> None: # Delete Dead ...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-03-17-20-44_e77de76bb555.py
.py
017eeea36e818fd6
7.42
6
""" Add is_user_safe_to_remove function that checks references in create_user/update_user columns Revision ID: 278193278eff Revises: 594e7a7af9f1 Create Date: 2025-03-25 13:18:24.603159 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "278193278eff" down_revision...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-03-25-13-18_278193278eff.py
.py
8c659063ebb17f59
7.42
6
"""Create Location table Revision ID: ac0ac5d0c81b Revises: 278193278eff Create Date: 2025-03-25 15:38:31.943374 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "ac0ac5d0c81b" down_revision = "278193278eff" branch_labels = None depends_on = None def upgrade()...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-03-25-15-38_ac0ac5d0c81b.py
.py
99ee1a4aa3f54b19
7.42
6
"""Make export_date in the fuel_export table nullable and add 'Unknown' record to the provision_of_the_act table. Revision ID: 7769d03605d8 Revises: ac0ac5d0c81b Create Date: 2025-03-25 21:52:53.119756 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic revision = "7769d03605d...
bcgov/lcfs
backend/lcfs/db/migrations/versions/2025-03-25-21-52_7769d03605d8.py
.py
fdd2a906147ac049
7.42
6
#!/usr/bin/env python3 from i18n import LANGUAGE_DEFAULT from models.mod import MetaStatusEnum from scripts.utils import ModManager from settings import DB_PATH DATA_SEP = ";" def build_line(line_number: int, mod_id: int, field_type: str, idx: int) -> str: return DATA_SEP.join([str(line_number), str(mod_id), fie...
RiwsPy/lcc-docs
scripts/i18n/extract_tra_text.py
.py
0b86ad45797f8533
7.42
6
#!/usr/bin/env python3 import logging from i18n import LANGUAGE_DEFAULT from models.mod import MetaStatusEnum from scripts.i18n.extract_tra_text import DATA_SEP from scripts.utils import ModManager from settings import DB_PATH logger = logging.getLogger(__name__) def parse_line(line: str) -> tuple[int, int, str, in...
RiwsPy/lcc-docs
scripts/i18n/merge_tra_text.py
.py
3d8e0d838328c449
7.42
6
from collections import Counter from itertools import combinations import numpy as np import pandas as pd import anndata as ad from sklearn.preprocessing import LabelEncoder import scanpy as sc def maximal_patterns(fp, key: str = 'itemsets', ): """ Retrieve the maxima...
ShaokunAn/Spatial-Query
SpatialQuery/utils.py
.py
f27e3aa2310e6695
7.5
9
#!/usr/bin/env python3 """One-shot migration scan for a nominal bindings bump. Resolves versions, installs both versions of the bindings into temp dirs (via uv), extracts each API surface, diffs them, scans the client for references, and writes a markdown report. uv run --no-project python bump_scan.py conjure --re...
nominal-io/nominal-client
.agents/skills/reviewing-nominal-api-bumps/bump_scan.py
.py
68061fc7d6da6027
7.56
12
#!/usr/bin/env python3 """Serve a built HTML report on localhost. python serve_report.py <dir> [--file report.html] [--port N] [--open] Binds 127.0.0.1 on a free port (or --port), serves <dir>, and prints the URL. Runs until interrupted, so launch it in the background; the report is self-contained, so `file://` wor...
nominal-io/nominal-client
.agents/skills/reviewing-nominal-api-bumps/serve_report.py
.py
9de0abf4f4adc6c8
7.56
12
from __future__ import annotations from threading import Lock from typing import Callable, Generic, Iterable, TypeVar, cast T = TypeVar("T") _UNSET = object() class LazyField(Generic[T]): """Thread-safe container for lazily initialized dataclass state.""" def __init__(self) -> None: self._lock = Lo...
nominal-io/nominal-client
nominal/_utils/dataclass_tools.py
.py
10a86a2770b50142
7.56
12
from __future__ import annotations import inspect import logging import warnings from functools import wraps from typing import Callable, ParamSpec, TypeVar logger = logging.getLogger(__name__) Param = ParamSpec("Param") T = TypeVar("T") _WARN_ON_DEPRECATED_MARKER = "__warn_on_deprecated_argument_wrapper__" _WARN_O...
nominal-io/nominal-client
nominal/_utils/deprecation_tools.py
.py
a89cb5d7b572b34c
7.56
12
from __future__ import annotations import contextlib import logging import time from types import TracebackType from typing import Type from typing_extensions import Self logger = logging.getLogger(__name__) class LogTiming(contextlib.ContextDecorator): """Timing manager that provides logged timing information...
nominal-io/nominal-client
nominal/_utils/timing_tools.py
.py
5c73b52612f1b1a4
7.56
12
from __future__ import annotations from pathlib import Path import click from nominal.cli.util.global_decorators import client_options, global_options from nominal.core.client import NominalClient from nominal.core.filetype import FileType @click.group(name="attachment") def attachment_cmd() -> None: pass @a...
nominal-io/nominal-client
nominal/cli/attachment.py
.py
2c537c2b264b98a9
7.56
12
from __future__ import annotations import logging from pathlib import Path import click import pandas as pd from nominal.cli.util.format import table_data_to_string from nominal.cli.util.global_decorators import client_options, global_options from nominal.core import NominalClient logger = logging.getLogger(__name_...
nominal-io/nominal-client
nominal/cli/mis.py
.py
35e3a1d773de8973
7.56
12
from __future__ import annotations import pathlib from typing import Mapping import click import tabulate def table_data_to_string(table_data: Mapping[str, list[str]], format: str) -> str: """Render columnar data (column name -> values) as `csv` or a human-readable `table`.""" import pandas as pd if fo...
nominal-io/nominal-client
nominal/cli/util/format.py
.py
7165c18a04fc6992
7.56
12
from __future__ import annotations import functools import logging import pathlib import pdb # noqa: T100 import typing import click from nominal.core.client import NominalClient from nominal.experimental.logging import install_click_log_handler logger = logging.getLogger(__name__) Param = typing.ParamSpec("Param...
nominal-io/nominal-client
nominal/cli/util/global_decorators.py
.py
481c61cf829b3255
7.56
12
from __future__ import annotations import re import time from dataclasses import dataclass, field from typing import Protocol, TypeVar from conjure_python_client import Service, ServiceConfiguration from nominal_api import ( attachments_api, authentication_api, ingest_api, scout, scout_assets, ...
nominal-io/nominal-client
nominal/core/_clientsbunch.py
.py
64a7a7dadcee549e
7.56
12
from __future__ import annotations from enum import Enum from typing import Iterable, NamedTuple from typing_extensions import assert_never from nominal.protos.event.v2 import event_pb2 class EventType(Enum): """Categorization for Nominal Core events.""" INFO = "INFO" """Informational event.""" FL...
nominal-io/nominal-client
nominal/core/_event_types.py
.py
2afc6b66bbf3575b
7.56
12
from __future__ import annotations import concurrent.futures import logging import threading import time from dataclasses import dataclass from datetime import datetime, timedelta from enum import Enum from types import TracebackType from typing import Any, Callable, Generic, Mapping, Sequence, Type, TypeAlias from t...
nominal-io/nominal-client
nominal/core/_stream/write_stream.py
.py
c2020897b56288ff
7.56
12
from __future__ import annotations import abc import importlib.metadata import logging import platform import sys from typing import Any, Generic, Literal, Mapping, Protocol, Sequence, TypeAlias, TypedDict, TypeVar, runtime_checkable from nominal_api import scout_asset_api, scout_compute_api, scout_run_api from typin...
nominal-io/nominal-client
nominal/core/_utils/api_tools.py
.py
b09ee774f8e55382
7.56
12
"""Filename safety rules for object-store uploads. Single source of truth for which characters are unsafe in an upload filename. Two policies share the same rule: the upload path *validates* (raises) so callers fix bad names up front, while migration *sanitizes* (replaces) so a bulk migration is never blocked by one b...
nominal-io/nominal-client
nominal/core/_utils/filenames.py
.py
a00ecdacd97cc656
7.56
12
"""gRPC transport plumbing for the Nominal client. This module is the gRPC analogue of the conjure transport in `_utils.networking`: it builds a single, shared, fully-configured `grpc.Channel` (`create_grpc_channel`) that each backend gRPC service binds its generated stub to, so every stub shares that one channel. Th...
nominal-io/nominal-client
nominal/core/_utils/grpc_tools.py
.py
6291d8a26dd7fda7
7.56
12
from __future__ import annotations import concurrent.futures import logging import pathlib from functools import partial from queue import Queue from typing import BinaryIO, Iterable, Mapping import requests from nominal_api import ingest_api, upload_api from nominal.core._utils.filenames import validate_upload_file...
nominal-io/nominal-client
nominal/core/_utils/multipart.py
.py
285a6539b2370bc1
7.56
12
from __future__ import annotations import dataclasses import logging import math import multiprocessing import pathlib import threading import time from concurrent.futures import Future, ThreadPoolExecutor, as_completed from dataclasses import dataclass, field from types import TracebackType from typing import Callabl...
nominal-io/nominal-client
nominal/core/_utils/multipart_downloader.py
.py
0a6205247cb9d9c2
7.56
12
from __future__ import annotations import gzip import logging import ssl import threading from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Any, Callable, Mapping, Type, TypeVar import requests import truststore import typing_extensions from conjure_python_client import ServiceC...
nominal-io/nominal-client
nominal/core/_utils/networking.py
.py
d3f0efcd2d7b5e2c
7.56
12
from __future__ import annotations import threading import time from dataclasses import dataclass from datetime import timedelta from queue import Empty, Queue from typing import Generic, Iterable, List, Protocol, TypeVar from nominal.core._stream.write_stream import BatchItem from nominal.ts import IntegralNanosecon...
nominal-io/nominal-client
nominal/core/_utils/queueing.py
.py
dea96373b7452355
7.56
12
from __future__ import annotations from dataclasses import dataclass from nominal_api import scout_video_api from nominal.core.exceptions import NominalVideoScaleModeError from nominal.ts import IntegralNanosecondsUTC, _InferrableTimestampType, _SecondsNanos @dataclass(init=True, repr=False, eq=False, order=False,...
nominal-io/nominal-client
nominal/core/_video_types.py
.py
fc2d42a900b0ba8d
7.56
12
"""Filename conventions for cross-study mapping outputs. Keep this module free of heavy imports — backend/src/mapping.py imports it on the cache-check path, which must answer immediately. """ from typing import Optional from .src.data_model import EmbeddingType, MappingType DEFAULT_EMBED_MODEL = "biolord" DEFAULT_E...
MaastrichtU-IDS/cohort-explorer
backend/CohortVarLinker/naming.py
.py
e266123eb800315e
7.42
6
from typing import List, Set, Tuple, Optional import re from .config import settings from .utils import ( canonical_visit_period, is_interval_period, is_determinate_canonical_period, ) _nlp = None class FuzzyMatcher: @staticmethod def check_visit_string(visit_str_1: str, visit_str_2:...
MaastrichtU-IDS/cohort-explorer
backend/CohortVarLinker/src/fuzz_match.py
.py
c7edcda936ee0485
7.42
6
""" study_context.py — Extract Studies design protocol Metadata to use as LLM validation as context """ from __future__ import annotations from typing import Dict, Optional import logging from .query_builder import SPARQLQueryBuilder from .utils import execute_query logger = logging.getLogger(__name__) def fetch_s...
MaastrichtU-IDS/cohort-explorer
backend/CohortVarLinker/src/study_context.py
.py
bce59771e2816bc0
7.42
6
""" verdict.py — Immutable contracts for the matching pipeline. These dataclasses define the data flow between pipeline stages: StructuralEvidence ← produced by handlers in constraints.py LLMEvidence ← produced by llm_call.py (when LLM is consulted) Verdict ← produced once, by policy.decide...
MaastrichtU-IDS/cohort-explorer
backend/CohortVarLinker/src/verdict.py
.py
b9caf13025fc3d99
7.42
6