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 |
|---|---|---|---|---|---|---|
"""
Combine image cards into a silent MP4 short video using FFmpeg.
Output format: 1080x1920, H.264, 30fps (suitable for YouTube Shorts / TikTok).
"""
import subprocess
import tempfile
from pathlib import Path
def _check_ffmpeg() -> None:
result = subprocess.run(["ffmpeg", "-version"], capture_output=True)
if... | ultrahikerpp/invest-digest | backend/video_maker.py | .py | 3c3e448e136eb769 | 7.42 | 6 |
"""Regression tests for claude_browser response-completion detection.
Bug: with claude.ai extended thinking, generation (thinking + streaming) can
outlast the Stop-button wait; the old stability check then returned whatever
was on screen — the thinking status label or a truncated partial answer —
which got saved as a ... | ultrahikerpp/invest-digest | tests/test_claude_browser_wait.py | .py | 98babaf91c043385 | 7.92 | 6 |
"""Backtest the bubble composite score as a trading signal."""
import json
import math
import sys
from datetime import datetime, timezone
from pathlib import Path
try:
import numpy as np
except ImportError:
print("numpy not installed. Run: pip install numpy", file=sys.stderr)
sys.exit(1)
def _sanitize(o... | YichengYang-Ethan/Market-Bubble-Index-Dashboard | scripts/backtest_signal.py | .py | af21cab976d3f4d4 | 7.92 | 6 |
#!/usr/bin/env python3
"""AIC/BIC stepwise feature selection + profile likelihood CI for drawdown models.
Compares forward stepwise, backward elimination, and exhaustive search
using AIC and BIC criteria via statsmodels GLM (Binomial/Logit).
Evaluates selected models with purged walk-forward CV matching v3.2 framework... | YichengYang-Ethan/Market-Bubble-Index-Dashboard | scripts/compare_aic_bic.py | .py | c042b331430db947 | 7.42 | 6 |
#!/usr/bin/env python3
"""Compare Lasso / Ridge / ElasticNet logistic regression for drawdown prediction.
Uses the same purged walk-forward CV infrastructure from fit_drawdown_model.py.
Tests all 14 features with regularization doing the selection.
"""
from __future__ import annotations
import json
import sys
import... | YichengYang-Ethan/Market-Bubble-Index-Dashboard | scripts/compare_penalized_linear.py | .py | 59f534eafe11c1d0 | 7.42 | 6 |
#!/usr/bin/env python3
"""Compare tree-based models (XGBoost, Random Forest) against Logistic baseline.
Uses the same purged walk-forward CV infrastructure as fit_drawdown_model.py.
Tests grid of hyperparameters for each model type across 10% and 20% DD thresholds.
"""
from __future__ import annotations
import json
... | YichengYang-Ethan/Market-Bubble-Index-Dashboard | scripts/compare_tree_models.py | .py | 300de6a5b317b2c6 | 7.42 | 6 |
"""GSADF bubble detection test (Phillips-Shi-Yu 2015).
Implements a simplified Generalized Sup ADF test to identify explosive
bubble periods in SPY price data.
"""
import json
import math
import sys
from datetime import datetime, timezone
from pathlib import Path
try:
import numpy as np
except ImportError:
p... | YichengYang-Ethan/Market-Bubble-Index-Dashboard | scripts/gsadf_test.py | .py | c4a2ca4c0f28b1e7 | 7.92 | 6 |
"""Markov Regime-Switching model (Hamilton 1989) for bubble regime classification.
Fits a 3-regime Markov-switching model to the bubble composite score series
and extracts smoothed probabilities and transition dynamics.
"""
import json
import math
import sys
import warnings
from datetime import datetime, timezone
fro... | YichengYang-Ethan/Market-Bubble-Index-Dashboard | scripts/markov_regime.py | .py | c9d704c7f98af8e6 | 7.42 | 6 |
"""Verify all data JSON files are fresh (run after update-data workflow steps)."""
import json
import sys
from datetime import datetime, timezone
from pathlib import Path
DATA_DIR = Path(__file__).resolve().parent.parent / "public" / "data"
# Max age for generated_at (run in same workflow, files just written)
MAX_AG... | YichengYang-Ethan/Market-Bubble-Index-Dashboard | scripts/verify_data_freshness.py | .py | 01129c936f42d63c | 7.42 | 6 |
"""
Strudel MCP Agent - Fixed for Retry Safety
This agent provides Strudel pattern generation via MCP stdio JSON-RPC with proper:
- Health checks before attempting to connect
- Exponential backoff on connection failures
- No GPU hammering on repeated failures
- Graceful degradation when services are unavailable
Autho... | samjd-zz/linkedin_ssi_booster | agents/strudel_mcp_agent.py | .py | 23e6a5d524b52e6d | 7.56 | 12 |
from services.shared import get_ssi_focus_weights
from services.buffer_service import BufferChannelNotConnectedError
"""
Post Scheduler
Pushes generated posts to Buffer with optimal scheduling.
Targets: Tue/Wed/Fri 4:00 PM EST — matching your Buffer posting windows.
"""
import logging
import os
from datetime import da... | samjd-zz/linkedin_ssi_booster | scheduler.py | .py | c910eb71f6093eeb | 7.56 | 12 |
"""Confidence scoring and publish policy for the avatar_intelligence package."""
from __future__ import annotations
import json
import logging
import os
import sys
from collections import Counter
from dataclasses import asdict
from datetime import datetime, timezone
from services.avatar_intelligence._learning import... | samjd-zz/linkedin_ssi_booster | services/avatar_intelligence/_confidence.py | .py | 264e3c44c33ffcb5 | 7.56 | 12 |
"""Grounding context builders for the avatar_intelligence package."""
from __future__ import annotations
import re
import logging
from typing import Union
from services.avatar_intelligence._models import (
AvatarState,
DomainEvidenceFact,
EvidenceFact,
ExternalEvidenceFact,
ExtractedEvidenceFact,... | samjd-zz/linkedin_ssi_booster | services/avatar_intelligence/_grounding.py | .py | fd0f3349498e9aa4 | 7.56 | 12 |
"""Narrative continuity memory for the avatar_intelligence package."""
from __future__ import annotations
import json
import logging
import re
from datetime import datetime, timezone
from pathlib import Path
from services.avatar_intelligence._models import NarrativeMemory
from services.avatar_intelligence._paths imp... | samjd-zz/linkedin_ssi_booster | services/avatar_intelligence/_narrative.py | .py | 7c407b9b3e7e182a | 7.56 | 12 |
"""Evidence fact normalization and ID assignment."""
from __future__ import annotations
import hashlib
import logging
from typing import Any
from services.avatar_intelligence._models import (
AvatarState,
DomainEvidenceFact,
EvidenceFact,
ExtractedEvidenceFact,
)
logger = logging.getLogger(__name__)... | samjd-zz/linkedin_ssi_booster | services/avatar_intelligence/_normalizers.py | .py | 09272c4f3d5471db | 7.56 | 12 |
"""
Buffer GraphQL API Service
Handles all communication with Buffer's beta GraphQL API.
Endpoint: https://api.buffer.com
Docs: https://developers.buffer.com
"""
import requests
import logging
import re
from typing import Any, Optional
logger = logging.getLogger(__name__)
BUFFER_API = "https://api.buffer.com"
_URL_R... | samjd-zz/linkedin_ssi_booster | services/buffer_service.py | .py | a2b5daaac1d3adc9 | 7.56 | 12 |
"""Data models for console grounding."""
from __future__ import annotations
from dataclasses import dataclass, field
@dataclass
class ProjectFact:
project: str
company: str
years: str
details: str
source: str
tags: set[str]
@dataclass
class TruthGateMeta:
"""Metadata about what truth_g... | samjd-zz/linkedin_ssi_booster | services/console_grounding/_models.py | .py | e64d242682b00d68 | 7.56 | 12 |
"""
Curation grounding configuration loaders.
Reads env vars to produce keyword sets and tag-expansion maps used by the
curator's fact retrieval layer.
"""
import os
from services.content_curator._config import KEYWORDS
from services.console_grounding import get_console_grounding_tag_expansions_from_graph
def load_... | samjd-zz/linkedin_ssi_booster | services/content_curator/_grounding.py | .py | eb14ebbc9597da63 | 7.56 | 12 |
"""
RSS article fetching for the content curator.
Fetches and filters articles from configured RSS feeds.
"""
import feedparser
import logging
import re
import requests
try:
import trafilatura as _trafilatura
_TRAFILATURA_AVAILABLE = True
except ImportError: # pragma: no cover
_TRAFILATURA_AVAILABLE = Fa... | samjd-zz/linkedin_ssi_booster | services/content_curator/_rss_fetcher.py | .py | 302fdeea51af7ccc | 7.56 | 12 |
"""
SSI component selection logic.
Picks the LinkedIn SSI pillar to target based on configured weights and
an adaptive topic signal derived from recently extracted facts.
"""
import random
from typing import Any, Optional
from services.content_curator._config import _SSI_WEIGHTS, _SSI_TOPIC_HINTS
def build_topic_si... | samjd-zz/linkedin_ssi_booster | services/content_curator/_ssi_picker.py | .py | 00e7548db1c70296 | 7.56 | 12 |
"""
Text utility helpers for the content curator.
No external service dependencies — pure string manipulation.
"""
import re
def truncate_at_sentence(text: str, budget: int) -> str:
"""Ensure *text* fits within *budget* chars AND ends on a complete sentence.
If the text is already within budget, only cuts a... | samjd-zz/linkedin_ssi_booster | services/content_curator/_text_utils.py | .py | 06aa03cbf1e44d8f | 7.56 | 12 |
"""
Data migration script to import existing JSON files into PostgreSQL.
This script reads avatar data from JSON files and writes them to the database
using the dual-write pattern. Run this once after database setup to migrate
existing data.
Usage:
python -m services.database.migrate_data
python -m services.d... | samjd-zz/linkedin_ssi_booster | services/database/migrate_data.py | .py | 10d16828047a7db5 | 7.56 | 12 |
"""
Database session management and initialization.
Provides connection pooling, session factory, and database initialization
for the LinkedIn SSI Booster PostgreSQL backend.
"""
import logging
import os
from contextlib import contextmanager
from threading import Lock
from typing import Generator
from sqlalchemy imp... | samjd-zz/linkedin_ssi_booster | services/database/session.py | .py | b562aa4bd1dd9517 | 7.56 | 12 |
"""Dataclasses for the Derivative of Truth subsystem."""
from __future__ import annotations
from dataclasses import dataclass, field
from datetime import datetime
from typing import Optional
from services.derivative_of_truth._constants import (
EVIDENCE_TYPE_SECONDARY,
REASONING_TYPE_LOGICAL,
)
@dataclass
... | samjd-zz/linkedin_ssi_booster | services/derivative_of_truth/_models.py | .py | d982fcaaa1fb454f | 7.56 | 12 |
"""Truth gradient scoring core logic."""
from __future__ import annotations
import hashlib
import logging
from typing import Optional
from services.derivative_of_truth._constants import (
EVIDENCE_WEIGHTS,
REASONING_WEIGHTS,
TRACK_TRUTH_TRAJECTORY,
TRUTH_GRADIENT_FLAG_THRESHOLD,
UNCERTAINTY_CONFL... | samjd-zz/linkedin_ssi_booster | services/derivative_of_truth/_scoring.py | .py | 47e4f95eba6a4be4 | 7.56 | 12 |
"""Disposable-lab configuration loader.
This module has no code path capable of loading a production credential
(I2 of disposable_lab_execution_model.md): it never imports
`pfsense_mcp.config` and never references `PFSENSE_API_URL`/
`PFSENSE_API_KEY_FILE` — it defines its own, distinctly-named environment
variables (`... | night4me/pfsense-mcp-server | lab/config.py | .py | 09776f2c89d47ac6 | 7.42 | 6 |
"""Fault injection for disposable-lab scenarios.
See docs/TIER1_LAB_PLAN.md's "Fault scenarios" list — every entry has a
FaultScenario member below. Network-level scenarios are mechanically
injected by FaultProxy, wrapping a Transport (I3: reusing the existing
Transport shape rather than inventing a second mechanism, ... | night4me/pfsense-mcp-server | lab/fault_proxy.py | .py | 8081058742c49849 | 7.42 | 6 |
"""Closed Stage 3D/E/G backend dispatcher.
The dispatcher owns scenario selection, deadline enforcement and result
validation. The execution port is deliberately lab-internal and receives only
the immutable registry object; it has no endpoint, payload, method, candidate,
locator, description or fault-mode parameters.... | night4me/pfsense-mcp-server | lab/stage3_backend.py | .py | 215b66e654364b8f | 7.42 | 6 |
"""Fail-closed construction point for the closed LAB-T1 Stage 3 backend.
The closed CLI imports this module only for ``execute``. The repository has no
configured owner reconciliation verifier/evidence input in LAB-T1, so an
uncertainty-capable live backend cannot yet be safely constructed. Refusing
here preserves t... | night4me/pfsense-mcp-server | lab/stage3_live_runtime.py | .py | 03da1c6b6a10c823 | 7.42 | 6 |
#!/usr/bin/env python3
"""Emit a machine-independent manifest for locally built release artifacts."""
from __future__ import annotations
import argparse
import hashlib
import json
# Fixed local git query; no shell or caller-controlled argv.
import subprocess # nosec B404
import tomllib
from datetime import datetime... | night4me/pfsense-mcp-server | scripts/artifact_manifest.py | .py | c80c78fc363572f7 | 7.42 | 6 |
#!/usr/bin/env python3
"""Fail closed when the live `gh-pages` deployment is stale relative to
`docs/`/`mkdocs.yml` on the checked-out branch.
GitHub Pages here is deployed manually via `mkdocs gh-deploy` (see
`mkdocs.yml`'s own comment) -- nothing redeploys it automatically after
a docs change lands on `main`. That g... | night4me/pfsense-mcp-server | scripts/docs_pages_freshness_check.py | .py | 1750d867c5671e8b | 7.42 | 6 |
#!/usr/bin/env python3
"""fixture_safety.py — deeper, fixture-specific safety checks beyond
the repo-wide security_scan.py: only RFC 5737 IP ranges (or netmask/
loopback, which are structural, not host, values), only locally-
administered MAC placeholders, no real Netgate IDs, no credential
paths, and an advisory (non-... | night4me/pfsense-mcp-server | scripts/fixture_safety.py | .py | ad9957d3f3aa31bd | 7.42 | 6 |
#!/usr/bin/env python3
"""get_only_check.py — static confirmation that only three named,
audited files in src/pfsense_mcp ever call a Transport's request()
method directly: rest_api_client.py (GET-only, enforced dynamically
inside RestApiClient._request(), covered by
test_post_is_rejected_as_unsupported and checked via... | night4me/pfsense-mcp-server | scripts/get_only_check.py | .py | 201ffb3df7b923b9 | 7.42 | 6 |
#!/usr/bin/env python3
"""Fail closed when Git identity (configured or committed) matches a
known-leaked personal identity.
Exists because of a real incident (2026-08-09): the Public Exposure
Audit's history rewrite corrected every historical commit's
author/committer identity, but nothing checked the local clone's ow... | night4me/pfsense-mcp-server | scripts/git_identity_check.py | .py | ef4e17d0d0fad9a3 | 7.42 | 6 |
#!/usr/bin/env python3
"""git_report.py — read-only, informational report of the current
working-tree state. Never gates pass/fail on its own (an untracked
file mid-development is not inherently wrong) and never modifies or
stages anything.
Only ever invokes: `git status --porcelain` and `git diff --stat`.
No other gi... | night4me/pfsense-mcp-server | scripts/git_report.py | .py | 0772a60d182b825b | 7.42 | 6 |
#!/usr/bin/env python3
"""Maintainer-invoked audit: verify every guidance registry entry's pinned
`source_verification_excerpt` (a short, genuinely verbatim anchor phrase --
2026-08-22 provenance revision, see `guidance/models.py`'s module
docstring) is still present, verbatim, on the live page its `canonical_url`
poin... | night4me/pfsense-mcp-server | scripts/guidance_corpus_audit.py | .py | 116077c255ae3adf | 7.42 | 6 |
"""Shared OpenAPI schema loading and inspection helpers.
Used by scripts/discover_endpoints.py today, and intended to be
reused unchanged by future automation scripts (scaffold_capability.py,
capture_fixture.py) so schema-parsing logic is written exactly once.
This module is read-only and inspection-only. It never cl... | night4me/pfsense-mcp-server | scripts/lib/openapi.py | .py | 2def97af97e2d804 | 7.42 | 6 |
"""Recursive fixture sanitizer.
Turns a raw pfSense API response dict into a fully synthetic one,
suitable for a review proposal. Never prints or logs the values it
processes — callers are responsible for keeping raw data out of any
log/stdout path entirely; this module only transforms in memory.
IPv4/IPv6 classifica... | night4me/pfsense-mcp-server | scripts/lib/sanitizer.py | .py | bb89df4dd57adac3 | 7.42 | 6 |
"""General mechanism for detecting upstream OpenAPI schema fields our
Pydantic response models don't account for.
Complements the endpoint-level discovery in `lib/openapi.py` (which
detects new *endpoints* appearing in a re-pinned schema) with
field-level drift detection on response objects this project has
*already* ... | night4me/pfsense-mcp-server | scripts/lib/schema_drift.py | .py | 806297b8213fbcfb | 7.42 | 6 |
"""Low-level, generic pattern helpers shared by security_scan.py and
fixture_safety.py. Deliberately principle-based rather than allow-list
based where possible (e.g. the locally-administered MAC bit check),
so a new synthetic fixture value doesn't require updating a hardcoded
list here.
"""
from __future__ import ann... | night4me/pfsense-mcp-server | scripts/lib/security_patterns.py | .py | 04004aa286a97479 | 7.42 | 6 |
#!/usr/bin/env python3
"""merge_junit_reports.py — combines two `--junit-xml` reports into one.
`make test` runs pytest twice: a parallel (`-n 6`) pass over the bulk of the
suite, and a serial pass over the small handful of tests that cannot safely
collect under xdist (see AGENTS.md's "Test parallelism" note). Both pa... | night4me/pfsense-mcp-server | scripts/merge_junit_reports.py | .py | 95403e22e3da8b9c | 7.42 | 6 |
"""Fail if sync modules export classes with a Sync* prefix."""
from __future__ import annotations
import importlib
import inspect
import pkgutil
import sys
def iter_sync_modules() -> list[str]:
"""Return all module names under spotify_sdk._sync."""
package = importlib.import_module("spotify_sdk._sync")
... | jonathan343/spotify-sdk | scripts/check_no_sync_prefix.py | .py | ec2c4451903ab144 | 7.42 | 6 |
"""Generate sync code from async source using the unasync library."""
import os
import re
import shutil
import subprocess
import sys
from pathlib import Path
import unasync
ROOT_DIR = Path(__file__).absolute().parent.parent
ADDITIONAL_REPLACEMENTS = {
"AsyncSpotifyClient": "SpotifyClient",
"AsyncBaseClient"... | jonathan343/spotify-sdk | scripts/run_unasync.py | .py | 84361f261d0b52a8 | 7.42 | 6 |
"""Base HTTP client for Spotify API communication."""
from __future__ import annotations
import random
from typing import Any
import anyio
import httpx
from ..exceptions import (
AuthenticationError,
BadRequestError,
ForbiddenError,
NotFoundError,
RateLimitError,
ServerError,
SpotifyErro... | jonathan343/spotify-sdk | src/spotify_sdk/_async/_base_client.py | .py | 6a64b514ed0e2450 | 7.42 | 6 |
"""Base service class for API resources."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from ._base_client import AsyncBaseClient
class AsyncBaseService:
"""Base class for API resource services."""
def __init__(self, client: AsyncBaseClient) -> None:
... | jonathan343/spotify-sdk | src/spotify_sdk/_async/_base_service.py | .py | 3dca94007b4e3f7d | 7.42 | 6 |
"""Main Spotify client entry point."""
from __future__ import annotations
from typing import Any
from ._base_client import AsyncBaseClient
from .auth import AsyncAuthProvider, AsyncClientCredentials
from .services.albums import AsyncAlbumService
from .services.artists import AsyncArtistService
from .services.audiobo... | jonathan343/spotify-sdk | src/spotify_sdk/_async/_client.py | .py | dc504e7840e7fd9e | 7.42 | 6 |
"""Album service for Spotify API."""
from __future__ import annotations
from ...models import Album, Page, SavedAlbum, SimplifiedTrack
from .._base_service import AsyncBaseService
class AsyncAlbumService(AsyncBaseService):
"""Operations for Spotify albums."""
async def get(self, id: str, market: str | None... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/albums.py | .py | ebe25d348225237d | 7.42 | 6 |
"""Artist service for Spotify API."""
from __future__ import annotations
from typing import Literal, get_args
from ...models import Artist, Page, SimplifiedAlbum
from .._base_service import AsyncBaseService
IncludeGroup = Literal["album", "single", "appears_on", "compilation"]
VALID_INCLUDE_GROUPS = set(get_args(In... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/artists.py | .py | ef5bae2c32bb7d55 | 7.42 | 6 |
"""Audiobook service for Spotify API."""
from __future__ import annotations
from ...models import Audiobook, Page, SavedAudiobook, SimplifiedChapter
from .._base_service import AsyncBaseService
class AsyncAudiobookService(AsyncBaseService):
"""Operations for Spotify audiobooks."""
async def get(self, id: s... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/audiobooks.py | .py | deca40abd6864ebb | 7.42 | 6 |
"""Chapter service for Spotify API."""
from __future__ import annotations
from ...models import Chapter
from .._base_service import AsyncBaseService
class AsyncChapterService(AsyncBaseService):
"""Operations for Spotify chapters."""
async def get(self, id: str, market: str | None = None) -> Chapter:
... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/chapters.py | .py | 7c9133d737742f0b | 7.42 | 6 |
"""Episode service for Spotify API."""
from __future__ import annotations
from ...models import Episode, Page, SavedEpisode
from .._base_service import AsyncBaseService
class AsyncEpisodeService(AsyncBaseService):
"""Operations for Spotify episodes."""
async def get(self, id: str, market: str | None = None... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/episodes.py | .py | 8ae38a42fb3de9b8 | 7.42 | 6 |
"""Library service for Spotify API."""
from __future__ import annotations
from .._base_service import AsyncBaseService
class AsyncLibraryService(AsyncBaseService):
"""Operations for saving, removing, and checking library items."""
async def save_items(self, uris: list[str]) -> None:
"""Save one or ... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/library.py | .py | cfadab381ca00149 | 7.42 | 6 |
"""Player service for Spotify API."""
from __future__ import annotations
from typing import Literal
from pydantic import TypeAdapter
from ...models import (
CurrentlyPlaying,
PlaybackQueue,
PlaybackState,
PlayerDevice,
RecentlyPlayedPage,
)
from .._base_service import AsyncBaseService
_DEVICE_L... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/player.py | .py | cba343bab2602eab | 7.42 | 6 |
"""Search service for Spotify API."""
from __future__ import annotations
from typing import Literal, get_args
from ...models import SearchResult
from .._base_service import AsyncBaseService
SearchType = Literal[
"album",
"artist",
"playlist",
"track",
"show",
"episode",
"audiobook",
]
In... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/search.py | .py | 96223768d3d0e904 | 7.42 | 6 |
"""Show service for Spotify API."""
from __future__ import annotations
from ...models import Page, SavedShow, Show, SimplifiedEpisode
from .._base_service import AsyncBaseService
class AsyncShowService(AsyncBaseService):
"""Operations for Spotify shows and episodes."""
async def get(self, id: str, market: ... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/shows.py | .py | 05b4c49d4579cc86 | 7.42 | 6 |
"""Track service for Spotify API."""
from __future__ import annotations
from ...models import Page, SavedTrack, Track
from .._base_service import AsyncBaseService
class AsyncTrackService(AsyncBaseService):
"""Operations for Spotify tracks."""
async def get(self, id: str, market: str | None = None) -> Track... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/tracks.py | .py | 57e8e4f1566bb45d | 7.42 | 6 |
"""User service for Spotify API."""
from __future__ import annotations
from typing import Literal, get_args
from ...models import Artist, CurrentUser, CursorPage, Page, Track
from .._base_service import AsyncBaseService
TimeRange = Literal["long_term", "medium_term", "short_term"]
VALID_TIME_RANGES = set(get_args(T... | jonathan343/spotify-sdk | src/spotify_sdk/_async/services/users.py | .py | 73e56be5270ab2f2 | 7.42 | 6 |
"""Shared auth types and helpers used by sync and async auth providers."""
from __future__ import annotations
import asyncio
import inspect
import json
import os
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Awaitable, Protocol, TypeVar, cast
from anyio import from_thread
... | jonathan343/spotify-sdk | src/spotify_sdk/_auth_shared.py | .py | a02b4e035d7c9c95 | 7.42 | 6 |
"""Base HTTP client for Spotify API communication."""
from __future__ import annotations
import random
import time
from typing import Any
import httpx
from ..exceptions import (
AuthenticationError,
BadRequestError,
ForbiddenError,
NotFoundError,
RateLimitError,
ServerError,
SpotifyError... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/_base_client.py | .py | f36a5af354cd0f88 | 7.42 | 6 |
"""Base service class for API resources."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from ._base_client import BaseClient
class BaseService:
"""Base class for API resource services."""
def __init__(self, client: BaseClient) -> None:
self._clien... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/_base_service.py | .py | 898913ba08913727 | 7.42 | 6 |
"""Main Spotify client entry point."""
from __future__ import annotations
from typing import Any
from ._base_client import BaseClient
from .auth import AuthProvider, ClientCredentials
from .services.albums import AlbumService
from .services.artists import ArtistService
from .services.audiobooks import AudiobookServi... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/_client.py | .py | 15b05c57ac4ad058 | 7.42 | 6 |
"""Album service for Spotify API."""
from __future__ import annotations
from ...models import Album, Page, SavedAlbum, SimplifiedTrack
from .._base_service import BaseService
class AlbumService(BaseService):
"""Operations for Spotify albums."""
def get(self, id: str, market: str | None = None) -> Album:
... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/albums.py | .py | 15e0bba9d11452ae | 7.42 | 6 |
"""Artist service for Spotify API."""
from __future__ import annotations
from typing import Literal, get_args
from ...models import Artist, Page, SimplifiedAlbum
from .._base_service import BaseService
IncludeGroup = Literal["album", "single", "appears_on", "compilation"]
VALID_INCLUDE_GROUPS = set(get_args(Include... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/artists.py | .py | a5f14a2f66897c27 | 7.42 | 6 |
"""Audiobook service for Spotify API."""
from __future__ import annotations
from ...models import Audiobook, Page, SavedAudiobook, SimplifiedChapter
from .._base_service import BaseService
class AudiobookService(BaseService):
"""Operations for Spotify audiobooks."""
def get(self, id: str, market: str | Non... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/audiobooks.py | .py | b44a58cf207c438e | 7.42 | 6 |
"""Chapter service for Spotify API."""
from __future__ import annotations
from ...models import Chapter
from .._base_service import BaseService
class ChapterService(BaseService):
"""Operations for Spotify chapters."""
def get(self, id: str, market: str | None = None) -> Chapter:
"""Get a chapter by... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/chapters.py | .py | 1ac15e7a5242f9d7 | 7.42 | 6 |
"""Episode service for Spotify API."""
from __future__ import annotations
from ...models import Episode, Page, SavedEpisode
from .._base_service import BaseService
class EpisodeService(BaseService):
"""Operations for Spotify episodes."""
def get(self, id: str, market: str | None = None) -> Episode:
... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/episodes.py | .py | fc2191c4d74f3906 | 7.42 | 6 |
"""Library service for Spotify API."""
from __future__ import annotations
from .._base_service import BaseService
class LibraryService(BaseService):
"""Operations for saving, removing, and checking library items."""
def save_items(self, uris: list[str]) -> None:
"""Save one or more items to the cur... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/library.py | .py | 5540a3ee6f13c173 | 7.42 | 6 |
"""Player service for Spotify API."""
from __future__ import annotations
from typing import Literal
from pydantic import TypeAdapter
from ...models import (
CurrentlyPlaying,
PlaybackQueue,
PlaybackState,
PlayerDevice,
RecentlyPlayedPage,
)
from .._base_service import BaseService
_DEVICE_LIST_A... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/player.py | .py | 184f0020c817f8ae | 7.42 | 6 |
"""Search service for Spotify API."""
from __future__ import annotations
from typing import Literal, get_args
from ...models import SearchResult
from .._base_service import BaseService
SearchType = Literal[
"album",
"artist",
"playlist",
"track",
"show",
"episode",
"audiobook",
]
Include... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/search.py | .py | a7ba87016d082a61 | 7.42 | 6 |
"""Show service for Spotify API."""
from __future__ import annotations
from ...models import Page, SavedShow, Show, SimplifiedEpisode
from .._base_service import BaseService
class ShowService(BaseService):
"""Operations for Spotify shows and episodes."""
def get(self, id: str, market: str | None = None) ->... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/shows.py | .py | f55e9218c247296f | 7.42 | 6 |
"""Track service for Spotify API."""
from __future__ import annotations
from ...models import Page, SavedTrack, Track
from .._base_service import BaseService
class TrackService(BaseService):
"""Operations for Spotify tracks."""
def get(self, id: str, market: str | None = None) -> Track:
"""Get a tr... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/tracks.py | .py | 02036edadd8e0e47 | 7.42 | 6 |
"""User service for Spotify API."""
from __future__ import annotations
from typing import Literal, get_args
from ...models import Artist, CurrentUser, CursorPage, Page, Track
from .._base_service import BaseService
TimeRange = Literal["long_term", "medium_term", "short_term"]
VALID_TIME_RANGES = set(get_args(TimeRa... | jonathan343/spotify-sdk | src/spotify_sdk/_sync/services/users.py | .py | d54e383260db90f1 | 7.42 | 6 |
"""Public auth exports."""
from __future__ import annotations
from functools import partial
from typing import Callable
from anyio import to_thread
from .._async.auth import (
AsyncAuthorizationCode as _AsyncAuthorizationCode,
)
from .._async.auth import (
AsyncAuthProvider,
AsyncClientCredentials,
)
fr... | jonathan343/spotify-sdk | src/spotify_sdk/auth/__init__.py | .py | de1b8e43b4eec399 | 7.42 | 6 |
"""Album models."""
from datetime import datetime
from typing import TYPE_CHECKING, Literal
from pydantic import Field
from .artist import SimplifiedArtist
from .base import SpotifyModel
from .common import (
Copyright,
ExternalIds,
ExternalUrls,
Image,
Page,
Restriction,
)
if TYPE_CHECKING:... | jonathan343/spotify-sdk | src/spotify_sdk/models/album.py | .py | 159257490181e081 | 7.42 | 6 |
"""Artist models."""
from typing import Literal
from pydantic import Field
from .base import SpotifyModel
from .common import ExternalUrls, Followers, Image
class SimplifiedArtist(SpotifyModel):
"""Basic artist info embedded in other objects."""
external_urls: ExternalUrls
href: str
id: str
na... | jonathan343/spotify-sdk | src/spotify_sdk/models/artist.py | .py | 3f2a821586bef426 | 7.42 | 6 |
"""Player and playback models."""
from __future__ import annotations
from datetime import datetime
from typing import TypeAlias
from pydantic import Field
from .base import SpotifyModel
from .common import Cursor, ExternalUrls
from .show import Episode
from .track import Track
PlaybackItem: TypeAlias = Track | Epi... | jonathan343/spotify-sdk | src/spotify_sdk/models/player.py | .py | 258108a0c8a6a920 | 7.42 | 6 |
"""Playlist models."""
from datetime import datetime
from typing import Literal, TypeAlias
from pydantic import Field
from .base import SpotifyModel
from .common import (
ExternalUrls,
Image,
Page,
)
from .player import PlaybackItem
class PublicUser(SpotifyModel):
"""Public user profile for embedde... | jonathan343/spotify-sdk | src/spotify_sdk/models/playlist.py | .py | eca78bbae43c9faa | 7.42 | 6 |
"""Detect cold start via inject_context."""
from __future__ import annotations
import logging
import types
from azure_functions_logging import get_logger, inject_context, setup_logging
def _make_fake_context(
invocation_id: str,
function_name: str = "TimerTrigger1",
) -> types.SimpleNamespace:
"""Build... | yeongseon/azure-functions-logging-python | examples/cold_start_detection.py | .py | 68fdf9243f2dcd0a | 7.57 | 13 |
"""Inject invocation context into log records."""
from __future__ import annotations
import logging
import types
from azure_functions_logging import get_logger, inject_context, setup_logging
def _make_fake_context(
invocation_id: str = "abc-123",
function_name: str = "HttpTrigger1",
trace_parent: str =... | yeongseon/azure-functions-logging-python | examples/context_injection.py | .py | c5835fe5fb753c10 | 7.57 | 13 |
#!/usr/bin/env python3
"""Assert the correlation claims from the public "How correlation works" docs against a log.
Consumes the ``func`` host log produced by the host-boot matrix smoke after a
request to ``/api/correlation`` (see ``examples/e2e_app/function_app.py``) and
certifies three observable claims (documented ... | yeongseon/azure-functions-logging-python | scripts/assert_correlation.py | .py | e1137efe500a4df8 | 7.57 | 13 |
#!/usr/bin/env python3
"""Render-lint Mermaid diagrams embedded in Markdown to catch syntax errors.
Unlike ``lint_mermaid.py`` (label-hygiene only), this script actually renders
every ```mermaid``` fenced block with the Mermaid CLI (``mmdc``). Invalid
syntax that a text linter cannot detect will fail the render, and t... | yeongseon/azure-functions-logging-python | scripts/render_mermaid.py | .py | cfb971d66abce8fc | 7.57 | 13 |
"""Decorator helper for automatic context injection.
Provides ``with_context`` — a decorator that calls ``inject_context()``
before the handler runs and restores previous context variables after it completes.
Ref: https://github.com/yeongseon/azure-functions-logging-python/issues/22
"""
from __future__ import annota... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_decorator.py | .py | 609dacc95129b806 | 7.57 | 13 |
"""Optional log filters for azure-functions-logging.
Provides:
- ``SamplingFilter``: Rate-limit noisy loggers to reduce gRPC/stdout pressure.
- ``RedactionFilter``: Mask PII / sensitive keys on LogRecord extra fields.
- ``AttributeFlattenFilter``: Flatten nested dict extras to dotted scalar keys
so OpenTelemetry doe... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_filters.py | .py | 437dcdd231f158b1 | 7.57 | 13 |
"""Log formatters for azure-functions-logging."""
from __future__ import annotations
import logging
import os
import sys
from typing import Iterable
from ._constants import _LIBRARY_RESERVED_KEYS, _STDLIB_RECORD_KEYS
from ._redaction import mask_value
# ANSI color codes
_COLORS: dict[int, str] = {
logging.DEBUG... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_formatter.py | .py | 9fb9ca728383cf02 | 7.57 | 13 |
"""host.json logging configuration helpers."""
from __future__ import annotations
from collections.abc import Mapping
import json
import logging
import os
from pathlib import Path
import warnings
_HOST_LEVEL_TO_LOGGING: dict[str, int] = {
"critical": logging.CRITICAL,
"debug": logging.DEBUG,
"error": log... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_host_config.py | .py | 18e8fb8a09be70d2 | 7.57 | 13 |
"""Resolve a stable worker-instance identifier for scaled-out Azure Functions.
Azure Functions is serverless and scales out across worker instances. To let
logs be attributed to the instance that produced them, this module resolves a
``host_instance_id`` from platform-provided environment variables, mirroring the
Azur... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_host_instance.py | .py | ea4d2feb600ed92c | 7.57 | 13 |
"""JSON log formatter for azure-functions-logging."""
from __future__ import annotations
from datetime import datetime, timezone
import json
import logging
from typing import Any
from ._host_instance import get_host_instance_id
from ._logger import _LIBRARY_RESERVED_KEYS, _STDLIB_RECORD_KEYS
_STANDARD_RECORD_FIELDS... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_json_formatter.py | .py | aea332886dc1d057 | 7.57 | 13 |
"""FunctionLogger wrapper for azure-functions-logging."""
from __future__ import annotations
import logging
from typing import Any
from ._constants import _FORWARD_COMPAT_RECORD_KEYS as _FORWARD_COMPAT_RECORD_KEYS
from ._constants import _LIBRARY_RESERVED_KEYS as _LIBRARY_RESERVED_KEYS
from ._constants import _RESER... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_logger.py | .py | 5e8d96503b0316c1 | 7.57 | 13 |
"""Typed cross-package metadata contract for the ``logging`` namespace.
Toolkit convention (shared across the Azure Functions Python DX Toolkit):
decorators attach an ``_azure_functions_metadata`` dict onto the wrapped
handler, keyed by a package-owned *namespace* string, so sibling packages can
discover metadata **wi... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_metadata.py | .py | 0beab941cb7593c7 | 7.57 | 13 |
"""Optional OpenTelemetry trace-context activation for log correlation.
This module lets ``azure-functions-logging`` bind the Azure Functions host's
incoming W3C trace context into the current execution context so that an
OpenTelemetry ``LoggingHandler`` (owned by the host or the user's OTel setup)
stamps emitted log ... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_otel.py | .py | f84170bc9918058b | 7.57 | 13 |
"""Centralized sensitive-key definitions and masking helpers.
Single source of truth for redaction so ``RedactionFilter`` (recursive,
LogRecord-mutating) and ``ColorFormatter`` (inline extra-field masking) share
the same key set and matching rules instead of maintaining separate copies.
"""
from __future__ import ann... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_redaction.py | .py | 0e19c5c0e2e6c9f1 | 7.57 | 13 |
"""Logging setup and environment detection."""
from __future__ import annotations
import contextvars
import logging
import os
from pathlib import Path
import threading
from typing import Any
import warnings
import weakref
from ._context import ContextFilter, _install_context_factory, set_default_trace_context_activa... | yeongseon/azure-functions-logging-python | src/azure_functions_logging/_setup.py | .py | 8b5ba427de4cc7dc | 7.57 | 13 |
"""Regression guard for the documentation external-link tag-integrity lint.
Exercises tools/lint_doc_links.py against this repo (must be clean) and against
synthetic drift (must be caught). Keeps the vendored lint honest.
"""
from __future__ import annotations
import importlib.util
from pathlib import Path
import p... | yeongseon/azure-functions-logging-python | tests/test_doc_link_tag_integrity.py | .py | f01621d87a937135 | 7.07 | 13 |
"""Smoke tests for examples/ scripts.
Each test imports and runs the example's ``main()`` function, verifying that
the public API works end-to-end without crashing. State is reset between tests
so ``setup_logging()`` idempotency and ``_cold_start`` toggling do not leak.
"""
from __future__ import annotations
from im... | yeongseon/azure-functions-logging-python | tests/test_examples.py | .py | e111cc3eb529f23e | 8.07 | 13 |
"""Verification tests for filter attachment on OpenTelemetry logging handlers (#259).
In OpenTelemetry logging mode the entire ``extra`` mapping is emitted as log
**attributes**, so ``RedactionFilter`` (PII) and ``SamplingFilter`` (noise) must
be attached to the OTel ``LoggingHandler`` to have any effect. These tests ... | yeongseon/azure-functions-logging-python | tests/test_otel_filters.py | .py | 425cd4f47a3ceee1 | 8.07 | 13 |
"""OpenTelemetry log-correlation spike, kept as a regression guard (issue #253).
The original spike proved that attaching the host's W3C trace context lets an
OpenTelemetry ``LoggingHandler`` stamp emitted log records with the host span's
``trace_id`` / ``span_id`` — without this package ever creating, recording, or
e... | yeongseon/azure-functions-logging-python | tests/test_otel_spike.py | .py | dddbad28ce2c49d3 | 8.07 | 13 |
"""Regression guard for the release-gate drift-lint.
Exercises tools/lint_release_workflows.py against this repo (must be clean) and
against synthetic drift (must be caught). Keeps the vendored lint honest.
"""
from __future__ import annotations
import importlib.util
from pathlib import Path
_REPO_ROOT = Path(__fil... | yeongseon/azure-functions-logging-python | tests/test_release_workflow_pins.py | .py | 8733c8a8a6d2b810 | 8.07 | 13 |
"""Tests for the _azure_functions_metadata convention on with_context."""
from __future__ import annotations
from azure_functions_logging import get_logging_metadata, with_context
class TestWithContextMetadata:
"""Verify that with_context sets toolkit metadata correctly."""
def test_sync_handler_sets_metad... | yeongseon/azure-functions-logging-python | tests/test_toolkit_metadata.py | .py | a20f56d60cb7c695 | 7.07 | 13 |
#!/usr/bin/env python3
"""Resolve a per-character generated-asset directory under works/<slug>/."""
from __future__ import annotations
import argparse
import json
import re
import unicodedata
from pathlib import Path
WINDOWS_RESERVED = {
"con",
"prn",
"aux",
"nul",
*(f"com{index}" for index in r... | kobingogo/motion-sticker-pack | scripts/character_workspace.py | .py | c1013f39ef495311 | 7.57 | 13 |
#!/usr/bin/env python3
"""Generate a small, license-free playful bed for the promo composition."""
from __future__ import annotations
import argparse
import wave
from pathlib import Path
import numpy as np
SR = 48_000
BPM = 120
BEAT = 60.0 / BPM
def env(length: int, attack: float, release: float) -> np.ndarray:
... | kobingogo/motion-sticker-pack | scripts/generate_promo_bgm.py | .py | 79c72359181963f2 | 7.57 | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.