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 |
|---|---|---|---|---|---|---|
"""Shared fixture matching and persistence for live odds providers."""
from __future__ import annotations
import datetime as dt
import sqlite3
from pathlib import Path
from ..nrl_data.cache_writer import update_fixture_odds
from . import store
from .team_names import canonical_team
from .validity import valid_price_... | levonrush/footy-tipper | pipeline/common/odds/live.py | .py | 50713a63dcaa428d | 7.39 | 5 |
"""SQLite storage for odds history (backfill + live snapshots).
`odds_history` keeps every observation with its source and timing kind so the
movement features (open vs latest) and any later open-vs-close experiments
have raw material. The `odds_snapshots` ledger written by R remains the
prediction-time observation co... | levonrush/footy-tipper | pipeline/common/odds/store.py | .py | e750dc6c52a06e19 | 7.39 | 5 |
# A script to fail the coverage stage when its PHPUnit run did not pass.
#
# Wikimedia's mwext-phpunit-coverage runs PHPUnit under `set +e`, so that a
# failing suite still publishes the report it produced, and it never looks at
# the exit code again. The container therefore exits 0 whatever PHPUnit did,
# and so does ... | femiwiki/quibble-action | check_junit.py | .py | e3a0cd3a45aea1d2 | 7 | 0 |
# A script to resolve dependencies of a MediaWiki extension/skin for Quibble.
#
# Quibble can do half of this itself, with --resolve-requires, and Wikimedia's
# extension gate uses exactly that. It cannot be delegated here, and the reason
# is structural rather than a matter of wiring: quibble/cmd.py builds
# ResolveRe... | femiwiki/quibble-action | resolve_dependencies.py | .py | adb33fe5b66abb56 | 7 | 0 |
# Tests for check_junit.py, the coverage stage's only record of whether its
# PHPUnit run passed. Its failure paths are what the stage rests on, so they
# are exercised here rather than left to the happy path CI already runs.
#
# The reports below keep the shape PHPUnit 9.6 emits: one <testsuite> per
# --testsuite argu... | femiwiki/quibble-action | test_check_junit.py | .py | cd53d7464e03712b | 7.5 | 0 |
# Tests for resolve_dependencies.py, which turns the dependencies input, a
# manifest's requires clause or a phan config into Gerrit project paths.
#
# The skin half of it had no coverage at all: no job in the suite runs against
# a skin, so `skins/Bar` normalization and the `requires.skins` clause were
# only ever exe... | femiwiki/quibble-action | test_resolve_dependencies.py | .py | 63d0f09867b3fae4 | 7.5 | 0 |
"""Asynchronous Python client for Balena Cloud."""
from __future__ import annotations
import asyncio
import socket
from dataclasses import dataclass
from importlib import metadata
from typing import Any, Self
from aiohttp import ClientError, ClientResponseError, ClientSession
from aiohttp.hdrs import METH_DELETE, ME... | MrGreenBoutiqueOffices/python-balena-cloud | src/balena_cloud/balena_cloud.py | .py | 36bdbc2c3781c2fe | 7 | 0 |
"""Organization resource client."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from balena_cloud.exceptions import (
BalenaCloudParameterValidationError,
BalenaCloudResourceNotFoundError,
)
from balena_cloud.models import Fleet, Organization
@dataclass
class... | MrGreenBoutiqueOffices/python-balena-cloud | src/balena_cloud/resources/organization.py | .py | 514b105fdeff791e | 7 | 0 |
"""Release resource client."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from aiohttp.hdrs import METH_DELETE
from balena_cloud.exceptions import BalenaCloudResourceNotFoundError
from balena_cloud.models import Release
@dataclass
class ReleaseResource:
"""Reso... | MrGreenBoutiqueOffices/python-balena-cloud | src/balena_cloud/resources/release.py | .py | dd865a0dd1aada67 | 7 | 0 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Custom allauth adapters.
django-allauth's default ``SocialAccountAdapter.on_authentication_error`` is a
no-op, so the underlying exception that triggers the stock "Third-Party Login
... | norcalipa/crank | crank/adapters.py | .py | ba784bc2f49e4809 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Model-context construction with deterministic truncation.
The conversation and generated preference markdown are untrusted inputs. They
are bounded to configured character budgets be... | norcalipa/crank | crank/agents/job_search/context.py | .py | 862f27e2573f2862 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Job-search conversation transport: demo provider (Phase 1).
The orchestration service (:mod:`crank.agents.job_search.service`) implements
the real bounded conversation turn. This mod... | norcalipa/crank | crank/agents/job_search/demo.py | .py | a3c4965c69c06c9b | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Typed service errors for the job-search orchestration service.
These error types are the contract that callers (HTTP views, management
commands) can rely on. Timeout, provider failur... | norcalipa/crank | crank/agents/job_search/errors.py | .py | 09d934885c6cfc32 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Provider-independent gateway contract.
The orchestration service talks only to this interface. Concrete providers
(issue #304) translate provider-specific failures into :class:`Provi... | norcalipa/crank | crank/agents/job_search/gateway.py | .py | 5cde2453818c9956 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Assistant quality guardrails (issue #397).
Executable checks that keep the assistant from regressing into a useless echo
of the user's message, plus the helpfulness-gap signal used t... | norcalipa/crank | crank/agents/job_search/quality.py | .py | 0cb64d2fe8284ad5 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Versioned system prompt for the job-search orchestrator.
The prompt is compiled from the model's own configuration and the bounded tool
contracts so that the versioned asset and the ... | norcalipa/crank | crank/agents/job_search/system_prompt.py | .py | 65dccaf4b0f96fd9 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Schema-validated result types for the job-search orchestration service.
Model output is validated against a strict schema before it is allowed to
reach the preference service or pers... | norcalipa/crank | crank/agents/job_search/types.py | .py | 0d3d6b99072f6a1b | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Deterministic resolution of source employer identities."""
from __future__ import annotations
from dataclasses import dataclass
import logging
from typing import Iterable
from djan... | norcalipa/crank | crank/agents/jobs/employer.py | .py | cbde29aa0cbcccba | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Orchestration for fetching and persisting normalized job listings."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from crank.agents.... | norcalipa/crank | crank/agents/jobs/ingest.py | .py | 330efccce210e129 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Persist deterministic job-ranking results for an owner."""
from django.db import transaction
from django.utils import timezone
from crank.agents.jobs.matching import rank_listings
f... | norcalipa/crank | crank/agents/jobs/match_persist.py | .py | 0e861e16484a9001 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Versioned, immutable configuration for deterministic job ranking."""
from __future__ import annotations
from dataclasses import dataclass, field
from math import isfinite
from types... | norcalipa/crank | crank/agents/jobs/ranking_config.py | .py | ce154a9d36beb16f | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Code-owned job adapter registry and policy-gated factory."""
from __future__ import annotations
from crank.agents.jobs.base import JobSourceAdapter
from crank.agents.jobs.errors imp... | norcalipa/crank | crank/agents/jobs/registry.py | .py | 3340060918ade26b | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Code-owned allowlist of approved external rating-source base domains.
Issue #310 owns the decision of which external authority the first source
adapter may lawfully pull from. Until ... | norcalipa/crank | crank/agents/sources/allowlist.py | .py | 90be9c3d76418767 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Typed score-adapter contract for Phase 2 (issue #311).
Defines the exceptions, the immutable :class:`RawScoreObservation` value
object, the :class:`SourceAdapter` protocol, and the b... | norcalipa/crank | crank/agents/sources/base.py | .py | 2f5df35fbecf0842 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Settings-backed default configuration for the score resolution pipeline.
Curated aliases and score-type mappings can be declared in settings as plain
lists of mappings and are valida... | norcalipa/crank | crank/agents/sources/config.py | .py | 1db5cd8c44d326f4 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Immutable typed RawScoreObservation value object.
This is the typed boundary between external source payloads and normalized
application data. It is a *value object*, not a Django mo... | norcalipa/crank | crank/agents/sources/observation.py | .py | 107bc8e9d5acfca2 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Code-owned source-adapter registry and factory (issue #311).
Adapters are registered in code (never dynamically imported from database
supplied paths or URLs). :func:`build_adapter` ... | norcalipa/crank | crank/agents/sources/registry.py | .py | a73a0e7584d069e9 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""App config for the crank application.
Registers the deployment-safety system checks (issue #397). Referencing this
config (``crank.apps.CrankConfig``) in ``INSTALLED_APPS`` ensures `... | norcalipa/crank | crank/apps.py | .py | 99ceec90a3a11be5 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Authentication helpers used by CRank's browser-facing protected views."""
from functools import wraps
from django.contrib import messages
from django.shortcuts import redirect
SESS... | norcalipa/crank | crank/auth.py | .py | 04729c9e51b7f528 | 7.24 | 2 |
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
"""Django system checks for deployment-safety issues (issue #397).
The check here is deliberately a *warning* (not an error): the demo provider is
a legitimate offline/test choice, so a... | norcalipa/crank | crank/checks.py | .py | b8fba0ffea22a276 | 7.24 | 2 |
from pydantic import Field, BaseModel, ConfigDict, AliasChoices
class Response(BaseModel):
model_config = ConfigDict(use_attribute_docstrings=True)
name: str = Field(
...,
title="Name",
description="The name of the response.",
validation_alias=AliasChoices("name", "Name"),
... | Mai0313/repo_template | src/repo_template/cli.py | .py | 5aa909216e8040bf | 7.15 | 1 |
"""loader.py.
Functions relating to loading files.
"""
import csv
import io
import json
import typing as t
from abc import ABC, abstractmethod
from pathlib import Path
from flywheel_gear_toolkit.utils.datatypes import Container
import fw_gear_file_validator.errors as err
PARENT_INCLUDE = [
# General values
... | naccdata/file-validator | fw_gear_file_validator/loader.py | .py | b50d613423c7fda0 | 7 | 0 |
"""Parser module to parse gear config.json."""
from pathlib import Path
from typing import Tuple, Union
from flywheel_gear_toolkit import GearToolkitContext
from fw_gear_file_validator.utils import FwReference
level_dict = {"Validate File Contents": "file", "Validate Flywheel Objects": "flywheel"}
SUPPORTED_FILE_EX... | naccdata/file-validator | fw_gear_file_validator/parser.py | .py | 85e765a5a36d84b4 | 7 | 0 |
"""utils.py.
Commonly used functions to aid in the execution of the main code.
"""
import logging
import typing as t
from dataclasses import dataclass
from functools import cached_property
from pathlib import Path
import flywheel
import flywheel_gear_toolkit
from flywheel_gear_toolkit.utils.datatypes import Containe... | naccdata/file-validator | fw_gear_file_validator/utils.py | .py | c30ed243881c9dd9 | 7 | 0 |
"""validator.py.
Creates validators for different object/file types
"""
import json
import typing as t
from pathlib import Path
import jsonschema
from jsonschema.exceptions import ValidationError
from fw_gear_file_validator import errors as err
from fw_gear_file_validator import utils
# We are not supporting array... | naccdata/file-validator | fw_gear_file_validator/validator.py | .py | b8f0862f1c7e59b5 | 7 | 0 |
"""Main module."""
import logging
import os
import time
from typing import Union
import pandas as pd
from fw_client import FWClient
from . import utils
from .snapshot import snapshot
log = logging.getLogger(__name__)
SNAPSHOT_TIMEOUT = 10 * 60 # ten min
def process_report_for_retry(
report_path: os.PathLike,... | naccdata/sitewide-snapshot | fw_gear_sitewide_snapshot/main.py | .py | 6d77fa1a72e330f9 | 7 | 0 |
import logging
import os
from typing import List, Union
import flywheel
import fw_utils
import pandas as pd
from fw_client import FWClient
from . import snapshot_utils
log = logging.getLogger("TriggerSnapshots")
class Snapshotter:
"""A class for triggering snapshots on projects
Params:
api_key: a ... | naccdata/sitewide-snapshot | fw_gear_sitewide_snapshot/snapshot/snapshot.py | .py | 2afd69ef249b30c2 | 7 | 0 |
import datetime
import logging
import re
from enum import Enum
import pandas as pd
from fw_client import FWClient
from fw_http_client.errors import NotFound
from pydantic import BaseModel, Field
from requests import Response
CONTAINER_ID_FORMAT = "^[0-9a-fA-F]{24}$"
SNAPSHOT_TIMESTAMP_FORMAT = "%Y-%m-%dT%H:%M:%S.%f%z... | naccdata/sitewide-snapshot | fw_gear_sitewide_snapshot/snapshot/snapshot_utils.py | .py | 30747de0b8f47c9e | 7 | 0 |
from unittest.mock import MagicMock, patch
from fw_gear_sitewide_snapshot.snapshot import snapshot
from .snapshot_assets import (
FAKE_BATCH_NAME,
FAKE_DATE,
FAKE_GROUP,
FAKE_KEY,
FAKE_PROJECT_ID,
FAKE_PROJECT_LABEL,
FAKE_RESPONSE,
FAKE_SNAPSHOT_ID,
mock_client,
mock_project,
... | naccdata/sitewide-snapshot | tests/test_snapshot.py | .py | b01d7191eeb46517 | 7.5 | 0 |
from fw_gear_sitewide_snapshot.snapshot import snapshot_utils
from .snapshot_assets import (
FAKE_PROJECT_ID,
FAKE_RESPONSE,
FAKE_SNAPSHOT_ID,
mock_client,
mock_project,
mock_sdk_client,
)
def test_SnapshotRecord_update(mock_client):
"""Test updating a snapshot record"""
fake_respons... | naccdata/sitewide-snapshot | tests/test_snapshot_utils.py | .py | 9c34301d6b5f9656 | 7.5 | 0 |
from itertools import count, takewhile
def make_key_times(num_count):
"""
return: list of key times points
should append `1` because the svg keyTimes rule
5 -> 0;0.2;0.4;0.6;0.8;1
"""
s = list(takewhile(lambda n: n < 1, count(0, 1 / num_count)))
if not round(s[-1], 2) == 1.0:
s... | vkboo/iBeats | heart/utils.py | .py | 1eaca6ff7b266fcf | 7.15 | 1 |
"""Global exception handlers for the FastAPI application.
Centralizes error handling so that route functions can focus on
business logic instead of repetitive try/except blocks.
"""
from core.domain.exceptions import (
DuplicatedFileError,
DuplicatedFileNameError,
DuplicatedUserError,
EntityNotFoundEr... | Leandro-Bertoluzzi/remote-cnc | src/api/api/exceptions.py | .py | 4ef323a11040d03e | 7.15 | 1 |
from core.domain.types import RoleType
from core.utilities.security import generate_token, validate_password
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel, EmailStr
from api.middleware.dbMiddleware import GetUserRepository
rootRoutes = APIRouter()
# Health check
class HealthCheck(BaseM... | Leandro-Bertoluzzi/remote-cnc | src/api/api/routes/rootRoutes.py | .py | c8f36fafa3d40bf3 | 7.15 | 1 |
from core.domain.worker import WorkerStatus
from fastapi import APIRouter, HTTPException
from api.middleware.authMiddleware import GetAdminDep, GetUserDep
from api.middleware.gatewayMiddleware import GetGateway
from api.middleware.workerMiddleware import GetWorker
from api.schemas.worker import (
WorkerAvailableRe... | Leandro-Bertoluzzi/remote-cnc | src/api/api/routes/workerRoutes.py | .py | 1f5adf0ff15366b9 | 7.15 | 1 |
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from core.config import SQLALCHEMY_DATABASE_URI
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Inte... | Leandro-Bertoluzzi/remote-cnc | src/core/alembic/env.py | .py | 8bbb076a6d2196a7 | 7.15 | 1 |
import argparse
import json
import os
from collections import defaultdict
from typing import Dict, List, Optional
import cv2
import tqdm
from mivolo.data.data_reader import PictureInfo, get_all_files
from mivolo.modeling.yolo_detector import Detector, PersonAndFaceResult
from preparation_utils import get_additional_bb... | farfarfun/funmodel-mivolo | example/pre/tools/prepare_cacd.py | .py | c43f08267d17cb42 | 7.15 | 1 |
import argparse
import os
from collections import defaultdict
from typing import Dict, List, Optional, Tuple
import cv2
import pandas as pd
import torch
import tqdm
from mivolo.data.data_reader import PictureInfo, get_all_files
from mivolo.modeling.yolo_detector import Detector, PersonAndFaceResult
from preparation_ut... | farfarfun/funmodel-mivolo | example/pre/tools/prepare_fairface.py | .py | cec552053a284bd6 | 7.15 | 1 |
import logging
import os
from functools import partial
from multiprocessing.pool import ThreadPool
from typing import Dict, List, Optional, Tuple
import cv2
import numpy as np
from funmodel.mivolo.data.data_reader import AnnotType, PictureInfo, get_all_files, read_csv_annotation_file
from funmodel.mivolo.data.misc imp... | farfarfun/funmodel-mivolo | funmodel/mivolo/data/dataset/reader_age_gender.py | .py | dd734115e3c01406 | 7.15 | 1 |
"""
Code adapted from timm https://github.com/huggingface/pytorch-image-models
Modifications and additions for mivolo by / Copyright 2023, Irina Tolstykh, Maxim Kuprashevich
"""
import os
from typing import Any, Dict, Optional, Union
import timm
# register new models
from funmodel.mivolo.model.mivolo_model import... | farfarfun/funmodel-mivolo | funmodel/mivolo/model/create_timm_model.py | .py | 7172545c9adc43ab | 7.15 | 1 |
import math
import os
from copy import deepcopy
from typing import Dict, List, Optional, Tuple
import cv2
import numpy as np
import torch
from funmodel.mivolo.data.misc import aggregate_votes_winsorized, assign_faces, box_iou
from ultralytics.yolo.engine.results import Results
from ultralytics.yolo.utils.plotting impo... | farfarfun/funmodel-mivolo | funmodel/mivolo/structures.py | .py | 671c71e846025d68 | 7.15 | 1 |
from typing import List, Tuple
import cv2
import numpy as np
import onnxruntime as ort
def preprocess(
img: np.ndarray, out_bbox, input_size: Tuple[int, int] = (192, 256)
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""Do preprocessing for RTMPose model inference.
Args:
img (np.ndarray): Input... | farfarfun/funmodel-dwpose | funmodel/dwpose/core/onnxpose.py | .py | 16fb69ab54f5e1ce | 7 | 0 |
#!/usr/bin/env python3
"""
Caveman Compress CLI
Usage:
caveman <filepath>
"""
import sys
# Force UTF-8 on stdout/stderr before any code can print. Windows consoles
# default to cp1252 and crash on the ❌ glyphs in error/validation branches,
# masking the real error and leaving the user with a half-compressed file... | christopherqueenconsulting/linkedin_engagement_manager | .agents/skills/caveman-compress/scripts/cli.py | .py | 17edb6b425adc0ea | 7.35 | 4 |
#!/usr/bin/env python3
"""
Caveman Memory Compression Orchestrator
Usage:
python scripts/compress.py <filepath>
"""
import os
import re
import shutil
import stat
import subprocess
import sys
import tempfile
from pathlib import Path
from typing import List
OUTER_FENCE_REGEX = re.compile(
r"\A\s*(`{3,}|~{3,})[... | christopherqueenconsulting/linkedin_engagement_manager | .agents/skills/caveman-compress/scripts/compress.py | .py | 638dacb2a45a8283 | 7.35 | 4 |
#!/usr/bin/env python3
"""Detect whether a file is natural language (compressible) or code/config (skip)."""
import json
import re
from pathlib import Path
# Extensions that are natural language and compressible
COMPRESSIBLE_EXTENSIONS = {".md", ".txt", ".markdown", ".rst", ".typ", ".typst", ".tex"}
# Extensions tha... | christopherqueenconsulting/linkedin_engagement_manager | .agents/skills/caveman-compress/scripts/detect.py | .py | 0c68b6500dac582b | 7.35 | 4 |
#!/usr/bin/env python3
import re
from collections import Counter
from pathlib import Path
URL_REGEX = re.compile(r"https?://[^\s)]+")
FENCE_OPEN_REGEX = re.compile(r"^(\s{0,3})(`{3,}|~{3,})(.*)$")
HEADING_REGEX = re.compile(r"^(#{1,6})\s+(.*)", re.MULTILINE)
BULLET_REGEX = re.compile(r"^\s*[-*+]\s+", re.MULTILINE)
# ... | christopherqueenconsulting/linkedin_engagement_manager | .agents/skills/caveman-compress/scripts/validate.py | .py | 6098687a5fa374dc | 7.35 | 4 |
"""LiteLLM pre-call hook: resolves the tier a request runs on.
Two stages, in order:
1. **Complexity** (always) — `lem-router` requests are mapped to a tier from prompt shape.
2. **Cost-aware down-routing** (flag-gated, `COST_AWARE_ROUTING_ENABLED`) — the tier from stage 1,
or an explicitly requested `lem-*` tier, ... | christopherqueenconsulting/linkedin_engagement_manager | .litellm/complexity_router.py | .py | ab406b9a36bcf784 | 7.35 | 4 |
"""Keep `$ai_generation` small enough for PostHog to accept the batch (issue #1310).
LiteLLM's PostHog logger sends events 100 at a time to `/batch/`. That endpoint rejects an
oversized request with **413**, and a 413 is a size refusal, not a rate limit — the batch is
dropped outright and never retried. So an unknown ... | christopherqueenconsulting/linkedin_engagement_manager | .litellm/posthog_payload_guard.py | .py | 6b36ef9b602a84c3 | 7.35 | 4 |
"""The owner's way out of a park: reading a Decision-Comment reply.
Parking is the pipeline saying "I stopped". Every park in v2 is written by `actions/park.sh`, whose
own header promises un-parking happens "through the existing answer lane" — and that lane lived
only in v1's `tick.sh`. Once v1 was retired to a heartb... | christopherqueenconsulting/linkedin_engagement_manager | scripts/agent-pipeline/v2/lemd/answers.py | .py | 2ba0f533b5214d4c | 7.35 | 4 |
"""Concurrency caps for the scheduler — v1's CAP arithmetic, kept in step deliberately.
This mirrors `tick.sh`'s formula rather than importing it (bash), so the pair must be changed
together; the migration's shadow phase compares the two, which is what would catch a drift.
The v2 change is not the numbers, it is what... | christopherqueenconsulting/linkedin_engagement_manager | scripts/agent-pipeline/v2/lemd/capacity.py | .py | 0dc39f6db63c34a4 | 7.35 | 4 |
"""Does a pull request touch a path `.github/CODEOWNERS` assigns an owner to?
GitHub will not answer this. With `required_approving_review_count: 0` and
`require_code_owner_reviews: true`, a code-owner-gated PR reports `reviewDecision: null` and an
EMPTY `reviewRequests` list while still sitting `BLOCKED` — measured o... | christopherqueenconsulting/linkedin_engagement_manager | scripts/agent-pipeline/v2/lemd/codeowners.py | .py | 34ffa12f178781b1 | 7.35 | 4 |
"""Configuration for the v2 daemon, read from the SAME `config.env` v1 uses.
One file, one set of knobs, one `PAUSED` switch. During migration both runners are installed and
the owner must not have to remember which world a setting belongs to — and `PAUSED` in particular
has to keep meaning "stop everything" for both,... | christopherqueenconsulting/linkedin_engagement_manager | scripts/agent-pipeline/v2/lemd/config.py | .py | e828982962b108ab | 7.35 | 4 |
"""Which lane runs this mode, and why — one decision, in one place, spoken to bash.
The routing lives here rather than in `lib/dispatch.sh` because the question changed. v1 could only
ask "has the Claude lane been failing?", so it discovered the ceiling by hitting it and its answer
was a health estimate. `spend.py` ca... | christopherqueenconsulting/linkedin_engagement_manager | scripts/agent-pipeline/v2/lemd/lane.py | .py | e0cb821a702ed966 | 7.35 | 4 |
"""Per-mode budgets and timeouts, and a READ-ONLY view of the shared run ledger.
Two rules this module exists to hold:
**The TSV ledger is the only budget store.** `lib/ledger.sh` owns every write; nothing here writes.
v1 and v2 both charge through that script so a cutover — or a rollback — carries budget state in
bo... | christopherqueenconsulting/linkedin_engagement_manager | scripts/agent-pipeline/v2/lemd/policy.py | .py | b6d1ae1dd37bdb5e | 7.35 | 4 |
"""GitHub webhook receiver — the daemon's event source.
Runs as its own process, holding NO GitHub credential and doing NO GitHub work. Its entire job is:
verify the signature, dedupe the delivery, append a trimmed row to SQLite, answer 202. The daemon
and this process meet only in the database, so either can restart ... | christopherqueenconsulting/linkedin_engagement_manager | scripts/agent-pipeline/v2/lemd/receiver.py | .py | 6324c5f7cc058221 | 7.35 | 4 |
"""Lane routing driven by REAL subscription usage.
v1 could not do this. `lib/capacity.sh` states the assumption in its own header — that no API
exposes "remaining this week" — and so it estimates capacity from rolling run outcomes and only
leaves the Claude lane AFTER a run has already been refused. That is reactive ... | christopherqueenconsulting/linkedin_engagement_manager | scripts/agent-pipeline/v2/lemd/spend.py | .py | 539acb87840a8cad | 7.35 | 4 |
#!/usr/bin/env python3
"""Write the published OpenAPI document to the checked-in snapshot the SPA generates types from.
The SPA's TypeScript types are generated from `/api/openapi.json` (issue #1446), and a generator
that has to `docker compose up` first is a generator nobody runs. So the schema is dumped straight
off... | christopherqueenconsulting/linkedin_engagement_manager | scripts/dump_openapi.py | .py | b32918a2d7af656b | 7.35 | 4 |
#!/usr/bin/env python3
"""LinkedIn versioned-API version checker.
LinkedIn retires versioned-API versions on a rolling window (as of 2026-07 only ~7 months
are live at once). A retired ``LI_API_VERSION`` makes every ``/rest/*`` call answer
``426 NONEXISTENT_VERSION`` — which silently demotes native document posts to t... | christopherqueenconsulting/linkedin_engagement_manager | scripts/linkedin_version_check.py | .py | 0bdd767ba2b8bdfa | 7.35 | 4 |
"""Measure what tightening the A2 proof detector (issue #1266) costs in regenerations.
The change stops a spelled quantity acting as a determiner ("one of the biggest challenges",
"dozens of our customers") from counting as concrete specificity. Every draft whose ONLY proof was
that shape now fails `has_first_person_p... | christopherqueenconsulting/linkedin_engagement_manager | scripts/measure_proof_gate_impact.py | .py | b7792b837a24a3c1 | 7.35 | 4 |
#!/usr/bin/env python3
"""Decide whether a PR that modifies the pipeline may merge without a human.
The agent pipeline merges its own PRs. `required_approving_review_count` is **0** on `main`, and
`.github/CODEOWNERS` enforces nothing at that setting (`docs/codeowners-enforcement-limit`). That is
tolerable while a mer... | christopherqueenconsulting/linkedin_engagement_manager | scripts/pipeline_selfmod_gate.py | .py | 7135c875d885cedc | 7.35 | 4 |
#!/usr/bin/env python3
"""Post a release annotation to PostHog at deploy time (issue #654).
LEM ships multiple releases a day (`docs/zero-downtime-deploys.md`), and no dashboard graph showed
when — a metric step-change and a deploy were two facts a human had to correlate by hand.
`build-and-push.yml`'s deploy job call... | christopherqueenconsulting/linkedin_engagement_manager | scripts/posthog_annotate.py | .py | e3daf2fbe4372366 | 7.35 | 4 |
"""Along with functions for permission checking, this has some checks that can be used with `@commands.check(checks.<function>)` if this file is loaded as checks via `import utility.checks as checks`."""
import discord
from discord.ext import commands
import math
import utility.files as u_files
import utility.custom ... | MrSquirrelDeDuck/bingo-bot | utility/checks.py | .py | 7a4d862698a6a49f | 7.3 | 3 |
"""This is a bunch of general converters that can be used in places to check for stuff. There are other, more specific converters in other utility files.
The primary use is in command parameters via typing.Optional, however it can also be used to parse integers that contain commas."""
from discord.ext import commands
... | MrSquirrelDeDuck/bingo-bot | utility/converters.py | .py | 283f1691b28f36aa | 7.3 | 3 |
"""Functions for working with stonks."""
import typing
import discord
import re
import utility.files as u_files
import utility.values as u_values
import utility.text as u_text
def stonk_history(database: u_files.DatabaseInterface) -> list[dict[str, int]]:
"""Returns the entire stonk history."""
get = databas... | MrSquirrelDeDuck/bingo-bot | utility/stonks.py | .py | 2e4f1e813d65833f | 7.3 | 3 |
# Copyright © LFV
import logging
from importlib.resources import Package, files
from pathlib import PosixPath
from jinja2 import (
BaseLoader,
Environment,
FileSystemLoader,
PackageLoader,
Template,
TemplateNotFound,
select_autoescape,
)
class Jinja2Utils:
@staticmethod
def crea... | reqstool/reqstool-client | src/reqstool/common/jinja2.py | .py | 5a46705bb4800656 | 7.35 | 4 |
# Copyright © LFV
import logging
import threading
from datetime import datetime, timezone
from reqstool.common.exceptions import SnapshotReloadError
from reqstool.common.snapshot_fingerprint import SnapshotFingerprint
from reqstool.common.validators.lifecycle_validator import LifecycleValidator
from reqstool.common.... | reqstool/reqstool-client | src/reqstool/common/project_session.py | .py | 9fa00297f43da001 | 7.35 | 4 |
# Copyright © LFV
from pathlib import Path
from typing import Optional
from ruamel.yaml import YAML as _YAML
CONFIG_FILENAME = ".reqstool-ai.yaml"
def find_config(start: Optional[Path] = None) -> Optional[Path]:
"""Walk up from `start` (default cwd) until `.reqstool-ai.yaml` is found.
Returns the absolute... | reqstool/reqstool-client | src/reqstool/common/reqstool_ai_config.py | .py | 0f0348140b2fb777 | 7.35 | 4 |
# Copyright © LFV
"""Fingerprint of the local input files a parsed snapshot was built from.
A long-lived server (MCP) parses once and then serves that snapshot. The fingerprint
records what was read — and what was looked for but absent — so the server can tell,
cheaply and per request, whether the snapshot still matc... | reqstool/reqstool-client | src/reqstool/common/snapshot_fingerprint.py | .py | 4192dfeed983e959 | 7.35 | 4 |
# Copyright © LFV
import logging
import os
import re
import tarfile
import tempfile
from importlib.metadata import version
from itertools import chain
from pathlib import Path
from typing import Dict, Iterable, List, Sequence
from zipfile import ZipFile
import expandvars
import requests
from packaging.version import ... | reqstool/reqstool-client | src/reqstool/common/utils.py | .py | c76bc7c1bd763356 | 7.35 | 4 |
# Copyright © LFV
from collections import namedtuple
import logging
from reqstool.common.models.lifecycle import LIFECYCLESTATE, lifecycle_state_sort_order
from reqstool.common.models.urn_id import UrnId
from reqstool.models.annotations import AnnotationData
from reqstool.models.requirements import RequirementData
f... | reqstool/reqstool-client | src/reqstool/common/validators/lifecycle_validator.py | .py | 5fe942950ba5075c | 7.35 | 4 |
# Copyright © LFV
import re
from abc import ABC, abstractmethod
from enum import Enum, unique
from pydantic import BaseModel, ConfigDict
_SUFFIX_MAX_LEN = 80
_UNSAFE_PATH_CHARS = re.compile(r"[^a-zA-Z0-9._-]")
@unique
class LOCATIONTYPES(Enum):
GIT = "git"
LOCAL = "local"
MAVEN = "maven"
NPM = "npm... | reqstool/reqstool-client | src/reqstool/locations/location.py | .py | a3dc7ed9b4fbab74 | 7.35 | 4 |
# Copyright © LFV
import logging
import tarfile
from typing import Optional
from urllib.parse import quote, urlparse
import requests
from pydantic import SecretStr, field_validator
from reqstool.common.exceptions import ArtifactDownloadError, ArtifactExtractionError
from reqstool.common.utils import Utils
from reqst... | reqstool/reqstool-client | src/reqstool/locations/npm_location.py | .py | 0f5566360db11144 | 7.35 | 4 |
# Copyright © LFV
import re
from dataclasses import dataclass
@dataclass(frozen=True)
class AnnotationMatch:
kind: str # "Requirements" or "SVCs"
raw_id: str # e.g. "REQ_010" or "ms-001:REQ_010"
line: int # 0-based line number
start_col: int # column of ID start
end_col: int # column of ID ... | reqstool/reqstool-client | src/reqstool/lsp/annotation_parser.py | .py | 591e712250fb06f5 | 7.35 | 4 |
import time
import configparser
import random
import uuid
from selenium import webdriver
from selenium.common.exceptions import (
NoSuchElementException,
StaleElementReferenceException,
TimeoutException,
ElementClickInterceptedException,
)
from selenium.webdriver.chrome.options import Options
from sele... | diepxuan/logo | analytic/images.py | .py | df4cca8540e83ac1 | 7 | 0 |
import time
import configparser
import random
from selenium import webdriver
from selenium.common.exceptions import (
NoSuchElementException,
StaleElementReferenceException,
ElementClickInterceptedException,
)
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_pr... | diepxuan/logo | analytic/search.py | .py | 65d31c08f6e8eb7e | 7 | 0 |
"""Commander module.
Adds support for receiving and processing MQTT commands.
"""
from __future__ import annotations
import json
import logging
import shlex
import subprocess
import sys
import time
from datetime import datetime, timezone
from typing import TYPE_CHECKING, Any, Literal
from redreactor.components.mqtt... | mreditor97/redreactor | src/redreactor/components/commander/commander.py | .py | f67568b21b75efcd | 7.15 | 1 |
"""Home Assistant Binary Sensor."""
from __future__ import annotations
from typing import Any
from .common import Base
class BinarySensor(Base):
"""Home Assistant Binary Sensor."""
payload_on: str | None
payload_off: str | None
def __init__(
self,
payload_on: str | None = None,
... | mreditor97/redreactor | src/redreactor/components/homeassistant/binary_sensor.py | .py | 831b025820a3be59 | 7.15 | 1 |
"""Home Assistant Button."""
from __future__ import annotations
from typing import Any
from .common import Base
class Button(Base):
"""Home Assistant Button."""
command_topic: str | None
command_template: str | None
payload_press: str | None
def __init__(
self,
command_topic: ... | mreditor97/redreactor | src/redreactor/components/homeassistant/button.py | .py | 8839727badc4e3ce | 7.15 | 1 |
"""Home Assistant Common."""
from __future__ import annotations
from json import JSONEncoder
from typing import Any
# Home Assistant MQTT Representer object
# Enabled the printing into a dict and to JSON
class Representer:
"""Representer.
Enables printing into a dict and to JSON.
"""
def __repr__(... | mreditor97/redreactor | src/redreactor/components/homeassistant/common.py | .py | 56c66527ea84b12d | 7.15 | 1 |
"""Home Assistant module."""
from __future__ import annotations
import json
import logging
from typing import TYPE_CHECKING, Any
from redreactor.components.mqtt import MQTT
from redreactor.helpers.repeater import RepeatTimer
from .binary_sensor import BinarySensor
from .button import Button
from .common import Avai... | mreditor97/redreactor | src/redreactor/components/homeassistant/homeassistant.py | .py | 56d3cd2f66826015 | 7.15 | 1 |
"""Home Assistant Number."""
from __future__ import annotations
from typing import Any
from .common import Base
class Number(Base):
"""Home Assistant Number."""
command_topic: str | None
command_template: str | None
min: float | None
max: float | None
mode: str | None
optimistic: bool ... | mreditor97/redreactor | src/redreactor/components/homeassistant/number.py | .py | 4458fe9ac7b91ffa | 7.15 | 1 |
"""Home Assistant Sensor."""
from __future__ import annotations
from typing import Any
from .common import Base
class Sensor(Base):
"""Home Assistant Sensor."""
unit_of_measurement: str | None
suggested_display_precision: int | None
state_class: str | None
def __init__(
self,
... | mreditor97/redreactor | src/redreactor/components/homeassistant/sensor.py | .py | 02e28409cd9a72c0 | 7.15 | 1 |
"""Monitor Data file."""
from __future__ import annotations
from redreactor.const import (
DEFAULT_BATTERY_VOLTAGE_MAXIMUM,
DEFAULT_BATTERY_VOLTAGE_MINIMUM,
DEFAULT_BATTERY_WARNING_THRESHOLD,
DEFAULT_REPORT_INTERVAL,
)
class MonitorData:
"""Monitor Data."""
voltage: float
current: float... | mreditor97/redreactor | src/redreactor/components/monitor/data.py | .py | fc4a7fedaa070327 | 7.15 | 1 |
"""Monitor module."""
from __future__ import annotations
import json
import logging
import sys
from typing import TYPE_CHECKING, Any
from ina219 import INA219, DeviceRangeError
from redreactor.components.monitor.data import MonitorData
from redreactor.components.mqtt import MQTT
from redreactor.const import (
D... | mreditor97/redreactor | src/redreactor/components/monitor/monitor.py | .py | 7c00b7b9193a7962 | 7.15 | 1 |
"""MQTT module.
Provides the connection and events around MQTT.
"""
from __future__ import annotations
import logging
import sys
from typing import Any
from paho.mqtt.client import Client, MQTTMessage, MQTTv5, MQTTv311
from redreactor.helpers.emitter import EventEmitter
class MQTT:
"""MQTT module."""
lo... | mreditor97/redreactor | src/redreactor/components/mqtt/mqtt.py | .py | 7c04aa35b2840eef | 7.15 | 1 |
"""Configuration module.
Contains the ability to read the static and dynamic configuration files.
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
import yaml
from redreactor.const import (
DEFAULT_BATTERY_VOLTAGE_MAXIMUM,
DEFAULT_BATTERY_VOLTAGE_MINIMUM,
... | mreditor97/redreactor | src/redreactor/configuration.py | .py | 3302f33e09d74a6c | 7.15 | 1 |
"""CPU Utils."""
from __future__ import annotations
import json
import os
import subprocess
from pathlib import Path
import requests
# Bit positions in the Raspberry Pi firmware throttling bitmask.
# Bits 0-3 reflect the CURRENT state; bits 16-19 reflect whether the condition
# has OCCURRED at any point since the l... | mreditor97/redreactor | src/redreactor/helpers/cpu_utils.py | .py | f946de213d25e93c | 7.15 | 1 |
"""Event Emitter.
Custom event emitter.
"""
from typing import Any
class EventEmitter:
"""Event Emitter module.
Allows the creation of callback style functionality.
"""
def __init__(self) -> None:
"""Initialise Event Emitter."""
self.__callbacks: Any = {}
def on(self, event_na... | mreditor97/redreactor | src/redreactor/helpers/emitter.py | .py | aa117720a2b65e4d | 7.15 | 1 |
"""Repeat Timer module."""
from threading import Timer
from typing import Any
class RepeatTimer:
"""Repeat Timer."""
_timer: Timer
interval: float
function: Any
args: Any
kwargs: Any
is_running: bool
def __init__(
self,
interval: float,
function: Any,
... | mreditor97/redreactor | src/redreactor/helpers/repeater.py | .py | 5451dfa579aea05e | 7.15 | 1 |
"""Tests for MonitorData."""
from __future__ import annotations
from redreactor.components.monitor.data import MonitorData
from redreactor.const import (
DEFAULT_BATTERY_VOLTAGE_MAXIMUM,
DEFAULT_BATTERY_VOLTAGE_MINIMUM,
DEFAULT_BATTERY_WARNING_THRESHOLD,
DEFAULT_REPORT_INTERVAL,
)
def test_monitor_d... | mreditor97/redreactor | tests/components/monitor/test_data.py | .py | 303809fde541886f | 7.65 | 1 |
"""Tests for EventEmitter."""
from __future__ import annotations
from unittest.mock import MagicMock
from redreactor.helpers.emitter import EventEmitter
def test_register_and_fire_callback():
"""Registering and firing a callback calls it."""
emitter = EventEmitter()
cb = MagicMock()
emitter.on("tes... | mreditor97/redreactor | tests/helpers/test_emitter.py | .py | 780e56513359cd20 | 7.65 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.