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 |
|---|---|---|---|---|---|---|
"""
Abstract timer interface
"""
from abc import ABC, abstractmethod
from dataclasses import dataclass
from enum import Enum
from typing import (
TYPE_CHECKING,
NamedTuple,
Protocol,
)
if TYPE_CHECKING:
from asyncio import Queue
from collections.abc import Callable, Sequence
class BasicSignalDat... | i-am-grub/pulsarity | src/pulsarity/interface/timer_interface.py | .py | c7ff21099ad19653 | 7 | 0 |
"""
Race state/timing management
"""
import asyncio
from collections import defaultdict
from datetime import timedelta
from functools import partial
from typing import TYPE_CHECKING, NamedTuple
from pulsarity._protobuf import database_pb2
from pulsarity.database.lap import Lap
from pulsarity.database.signal import Si... | i-am-grub/pulsarity | src/pulsarity/race/manager.py | .py | 728fc27973eb2cf4 | 7 | 0 |
"""
Asyncio helpers
"""
import asyncio
import inspect
import logging
from typing import TYPE_CHECKING
from pulsarity import ctx
if TYPE_CHECKING:
from collections.abc import Awaitable, Callable, Coroutine, Iterable
from concurrent.futures import Future
logger = logging.getLogger(__name__)
def ensure_async... | i-am-grub/pulsarity | src/pulsarity/utils/asyncio.py | .py | 7874cd3d58b4cb9a | 7 | 0 |
"""
Global configurations
"""
import asyncio
import json
import logging
from dataclasses import asdict, dataclass, field
from datetime import UTC, datetime
from functools import partial
from pathlib import Path
from secrets import token_urlsafe
from typing import Any, Self
import anyio
from pulsarity.utils.logging i... | i-am-grub/pulsarity | src/pulsarity/utils/config.py | .py | e3a18c40f0e220d2 | 7 | 0 |
"""
Custom logging configs
"""
import logging.handlers
class AutoQueueListener(logging.handlers.QueueListener):
"""
Auto starting Queue listener
"""
def __init__(self, queue, *handlers, respect_handler_level=True):
super().__init__(queue, *handlers, respect_handler_level=respect_handler_leve... | i-am-grub/pulsarity | src/pulsarity/utils/logging.py | .py | 2d4c16346c2c83d0 | 7 | 0 |
"""
Endpoint wrappers
"""
from __future__ import annotations
import functools
import inspect
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
NamedTuple,
Self,
dataclass_transform,
)
from google.protobuf.message import DecodeErro... | i-am-grub/pulsarity | src/pulsarity/webserver/_wrapper.py | .py | d4d2b3d1b5f6bcc3 | 7 | 0 |
"""
Webserver Components
"""
import asyncio
import contextlib
import itertools
import logging
from importlib.resources import files
from pathlib import Path
from typing import ClassVar, TypedDict
from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette.middleware.authent... | i-am-grub/pulsarity | src/pulsarity/webserver/application.py | .py | 22b48df493e2b39a | 7 | 0 |
import logging
import pytest
import re
from multitool import comments_mode
def test_comments_mode_retention_stats(tmp_path, caplog):
"""Verify that comments_mode correctly counts lines within multi-line comments for its stats."""
f = tmp_path / "test.py"
f.write_text('"""\nLine 1\nLine 2\nLine 3\n"""\n', e... | RainRat/diff2typo | tests/test_comments_stats_fixed.py | .py | b54c6178aaa64527 | 7.5 | 0 |
import os
import sys
import logging
import re
from unittest.mock import patch
import pytest
# Ensure the repository root is in the Python path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import multitool
import diff2typo
def test_resolve_full_mapping_complex_text(tmp_path):
""... | RainRat/diff2typo | tests/test_coverage_completion_final.py | .py | 4b9a2dcec454e005 | 7.5 | 0 |
import os
import sys
import pytest
import logging
import json
import xml.etree.ElementTree as ET
from unittest.mock import patch, MagicMock
import importlib
# Add current directory to path so we can import the scripts
sys.path.append(os.getcwd())
import multitool
import cmdrunner
def test_write_structured_data_xml_s... | RainRat/diff2typo | tests/test_coverage_completion_v6.py | .py | d4d576cb29b59690 | 7.5 | 0 |
import sys
import logging
from pathlib import Path
from unittest.mock import patch, MagicMock
import pytest
# Add repository root to path
sys.path.append(str(Path(__file__).resolve().parents[1]))
import multitool
import typostats
def test_multitool_main_filenotfounderror(caplog, monkeypatch):
"""Test that multit... | RainRat/diff2typo | tests/test_coverage_gaps_final.py | .py | 6f2cd5808fb4080c | 7.5 | 0 |
import json
import csv
import sys
import logging
import importlib
from pathlib import Path
from unittest.mock import patch
# Add repository root to path
sys.path.append(str(Path(__file__).resolve().parents[1]))
import gentypos
def test_color_initialization_enabled(monkeypatch):
"""Test branch where colors are NOT... | RainRat/diff2typo | tests/test_gentypos_gaps.py | .py | cfc2e4de02111fb3 | 7.5 | 0 |
#!/usr/bin/env python3
import json
import os
import shutil
import subprocess
import sys
from typing import Optional
def should_use_terminal_notifier() -> bool:
if os.environ.get("CODEX_NOTIFY_FORCE_TERMINAL_NOTIFIER") == "1":
return True
if os.environ.get("TERM_PROGRAM") == "ghostty":
return ... | cdenneen/home | modules/hm/users/cdenneen/ai/notify.py | .py | c3865bfa17c9f461 | 7 | 0 |
#!/usr/bin/env python3
"""
Tiny local reverse proxy that fronts GitLab's native MCP server
(https://<gitlab>/api/v4/mcp) and transparently keeps a shared OAuth
access token refreshed, since GitLab MCP access tokens are short-lived
(2h) and Hermes's native MCP client only supports static headers with
no refresh logic.
... | cdenneen/home | modules/hm/users/cdenneen/gitlab-mcp-proxy/proxy.py | .py | 53da84a396472fc5 | 7 | 0 |
"""
Deterministic action-level continuity classification (Bootstrap v1).
Two independent per-request classification inputs, each producing a
continuity_class *ceiling*; the effective continuity_class for a request
is the most restrictive of every ceiling in play (gateway config ceiling,
tool-based ceiling, workload-so... | cdenneen/home | modules/hm/users/cdenneen/hermes-policy-endpoint/action_classification.py | .py | 5c3c0a28bb3cd0e6 | 7 | 0 |
"""
Outage classifier - decides whether Eros is qualified-unavailable, without
depending on Eros, LiteLLM, Postgres, or DNS to make that decision
(execution-contract.md 10.1/10.2).
Two independent, low-level probes:
1. Raw TCP connect to Eros's pinned Tailscale IP:port. This never needs
DNS. It is used ONLY to ... | cdenneen/home | modules/hm/users/cdenneen/hermes-policy-endpoint/classifier.py | .py | fabf5c3789f9841e | 7 | 0 |
"""Module for processing Eva microscope image data."""
from __future__ import annotations
import logging
import re
import typing
from pathlib import Path
from photo.microscopebase import MicroscopeBase
from photo.photo import Photo
from photo.validators import validate_directory
from photo.wells import WellName, Wel... | nadavangel/photo_reader | photo/eva.py | .py | db4e582ac255b851 | 7 | 0 |
"""Module for base class and exception handling for microscope data processing."""
from __future__ import annotations
import abc
import logging
import sys
import traceback
import typing
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from photo.photo import Photo
from photo.v... | nadavangel/photo_reader | photo/microscopebase.py | .py | 1f90396b00b05be9 | 7 | 0 |
"""Module for representing microscope images as Photo objects."""
from __future__ import annotations
import logging
import re
import shutil
import typing
from pathlib import Path
from photo.validators import validate_file
from photo.wells import WellPos
logger = logging.getLogger("mylSplitToWells")
class Photo:
... | nadavangel/photo_reader | photo/photo.py | .py | aea39c022c29e74e | 7 | 0 |
"""Module for processing Spinning Disk microscope image data."""
from __future__ import annotations
import logging
import re
import typing
from pathlib import Path
from photo.microscopebase import MicroscopeBase, MicroscopeException
from photo.photo import Photo
from photo.wells import WellName, WellPos
logger = lo... | nadavangel/photo_reader | photo/spinning_disk.py | .py | 1a3e12f1404af397 | 7 | 0 |
"""Module for handling well position and name mapping."""
from __future__ import annotations
import abc
import logging
import typing
from dataclasses import dataclass, field
logger = logging.getLogger("mylSplitToWells")
@dataclass
class WellPos:
"""Represents a position in a multi-well plate."""
row: str ... | nadavangel/photo_reader | photo/wells.py | .py | fc44bb2d115c581f | 7 | 0 |
"""Module for command-line interface for splitting microscope images into well folders."""
from __future__ import annotations
import argparse
import importlib.metadata
import logging
import pathlib
import sys
import time
from datetime import timedelta
from photo.microscopebase import MicroscopeException, get_excepti... | nadavangel/photo_reader | split_to_wells.py | .py | a398dfc9c65eb3f0 | 7 | 0 |
"""
This module contains the modern GUI application for splitting photos into wells using CustomTkinter.
"""
from __future__ import annotations
import configparser
import logging
import sys
import threading
import tkinter as tk
import webbrowser
from logging import FileHandler, Handler
from pathlib import Path
from t... | nadavangel/photo_reader | window.py | .py | 44b7cea46f1aa6b7 | 7 | 0 |
import os
import utils.constants as constants
from utils.tools import get_real_path, resource_path, format_name
class Alias:
def __init__(self):
self.primary_to_aliases: dict[str, set[str]] = {}
self.alias_to_primary: dict[str, str] = {}
real_path = get_real_path(resource_path(constants.... | zzwh12/TV | utils/alias.py | .py | 300898c81c707a2c | 7 | 0 |
import logging
import random
import re
import requests
from pathlib import PurePosixPath
from typing import Dict, Optional
from urllib.parse import quote
from generate_post.core.domain.interfaces.content_generator_service import (
ContentGeneratorServiceInterface,
)
from generate_post.config.env_config import EnvC... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/adapters/api/gemini_content_service.py | .py | 767a06368b45daa5 | 7 | 0 |
import logging
import random
import re
import requests
from datetime import datetime, timedelta
from typing import Dict, Optional
from generate_post.core.domain.interfaces.content_generator_service import (
ContentGeneratorServiceInterface,
)
from generate_post.config.env_config import EnvConfig
from generate_post... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/adapters/api/gemini_news_digest_service.py | .py | c9257721a61b60c7 | 7 | 0 |
import logging
from typing import Protocol
from generate_post.core.domain.entities.post import Post
from generate_post.config.env_config import EnvConfig
logger = logging.getLogger(__name__)
class _UseCaseProtocol(Protocol):
def execute(self) -> Post: ...
class CLIHandler:
"""Manipulador de linha de coman... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/adapters/cli/cli_handler.py | .py | d56091fea244686e | 7 | 0 |
import logging
from pathlib import Path
from typing import Optional
import re
from datetime import datetime
from generate_post.core.domain.entities.post import Post
from generate_post.core.domain.interfaces.post_repository import (
PostRepositoryInterface,
)
from generate_post.config.constants import POSTS_DIR
lo... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/adapters/repositories/file_post_repository.py | .py | 8027e929366a6ed8 | 7 | 0 |
import os
from dataclasses import dataclass
from typing import Optional
@dataclass(frozen=True)
class EnvConfig:
"""Configurações de ambiente carregadas uma única vez no startup."""
gemini_api_key: Optional[str]
cf_api_token: Optional[str]
cf_account_id: Optional[str]
github_output: Optional[str]... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/config/env_config.py | .py | b83417afcb33e2a9 | 7 | 0 |
from dataclasses import dataclass, asdict
from datetime import datetime
@dataclass
class Post:
"""Entidade que representa um post do blog"""
title: str
categories: str
tags: str
content: str
date: datetime | None = None
image_path: str | None = None
slug: str | None = None
filenam... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/core/domain/entities/post.py | .py | dccf335a3d43fafe | 7 | 0 |
from abc import ABC, abstractmethod
from typing import Optional, Dict
class ContentGeneratorServiceInterface(ABC):
"""Interface para serviço de geração de conteúdo"""
@abstractmethod
def generate_content(self, prompt: str) -> str:
"""Gera conteúdo a partir de um prompt"""
pass
@abstr... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/core/domain/interfaces/content_generator_service.py | .py | 8e790cf78a75ca60 | 7 | 0 |
from abc import ABC, abstractmethod
from typing import Optional
class ImageGeneratorServiceInterface(ABC):
"""Interface para serviço de geração de imagens"""
@abstractmethod
def generate_image(
self, title: str, categories: str, tags: str, content_preview: str
) -> Optional[str]:
"""G... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/core/domain/interfaces/image_generator_service.py | .py | 95c20147b82cb7e5 | 7 | 0 |
import logging
import re
from datetime import datetime
from generate_post.core.domain.entities.post import Post
from generate_post.core.domain.interfaces.post_repository import (
PostRepositoryInterface,
)
from generate_post.core.domain.interfaces.content_generator_service import (
ContentGeneratorServiceInter... | cleissonbarbosa/cleissonbarbosa.github.io | generate_post/core/use_cases/generate_post_use_case.py | .py | 9a3218fbb6e4ba23 | 7 | 0 |
"""Módulo de utilidades para padronização e limpeza de dados.
Este arquivo concentra as funções de processamento de DataFrame que
são reutilizadas pela interface gráfica. O objetivo é manter a lógica
seca, testável e independente da camada visual.
"""
import unicodedata
import pandas as pd
def standardize_text(val... | Lucas1362/DataPolisher | src/cleaner.py | .py | fbb93965012e8fc2 | 7.24 | 2 |
"""Componentes reutilizáveis da interface do DataPolisher.
Este módulo centraliza os widgets visuais que aparecem repetidamente no app,
como botões padronizados e pequenas interações de hover. O objetivo é evitar
repetição de código e deixar a criação de novos controles mais consistente.
"""
import tkinter as tk
imp... | Lucas1362/DataPolisher | src/components.py | .py | 60b8097dc77b1f43 | 7.24 | 2 |
"""Módulo auxiliar de estilo visual do aplicativo.
Este arquivo define a paleta de cores e ajustes de aparência para os widgets
Tkinter. Ele funciona como apoio visual para o fluxo principal do app,
permitindo que a interface ajuste a estética para modo claro ou escuro.
"""
import tkinter as tk
from tkinter import tt... | Lucas1362/DataPolisher | src/estilo.py | .py | 05af984d5e700ad6 | 7.24 | 2 |
import flet as ft
import sys
from pathlib import Path
from interface import DataCleanerApp
def caminho_recurso(nome: str) -> Path:
"""Localiza recursos tanto no código-fonte quanto no executável empacotado."""
if getattr(sys, "frozen", False):
diretorio_base = Path(getattr(sys, "_MEIPASS", Path.cwd())... | Lucas1362/DataPolisher | src/main.py | .py | 3d4ce57f5598db88 | 7.24 | 2 |
#!/usr/bin/env python3
"""Provide changelog, release-note, and Conventional Commit helpers.
Functions
---------
parse_version
Parse a supported PEP 440 release version.
split_changelog
Split changelog Markdown into its preamble and release sections.
archive_changelog
Move inactive minor release lines into ... | geozeke/banip | scripts/changelog_tools.py | .py | 2aeb1eb94fb05525 | 7 | 0 |
"""Verify that every direct dependency has an approved license record."""
from __future__ import annotations
import re
import tomllib
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
NAME = re.compile(r"^[A-Za-z0-9_.-]+")
APPROVED = {
"Apache-2.0",
"Apache-2.0 OR MIT",
"BSD-2-Clause",
... | geozeke/banip | scripts/check_dependency_licenses.py | .py | f38f55743bac981c | 7 | 0 |
#!/usr/bin/env python3
"""Validate, create, and push the current annotated release tag."""
from __future__ import annotations
import argparse
import subprocess
from pathlib import Path
from .changelog_tools import (
extract_release_notes,
validate_changelog_collection,
validate_project_version,
)
PROJEC... | geozeke/banip | scripts/tag_release.py | .py | 24fa9ffc192cf3b1 | 7 | 0 |
#!/usr/bin/env python3
"""Move the mutable latest tag after a successful stable release."""
from __future__ import annotations
import argparse
import subprocess
from pathlib import Path
from .changelog_tools import parse_version
PROJECT_ROOT = Path(__file__).resolve().parents[1]
def update_latest_tag(
candida... | geozeke/banip | scripts/update_latest_tag.py | .py | 0eb6b0ac259ddbdc | 7.5 | 0 |
#!/usr/bin/env python3
"""Validate a release tag against metadata and committed release notes."""
from __future__ import annotations
import argparse
from pathlib import Path
from .changelog_tools import (
Version,
extract_release_notes,
parse_version,
validate_changelog_collection,
validate_proje... | geozeke/banip | scripts/validate_release.py | .py | c9825a53656857f3 | 7 | 0 |
"""Manage crawler and bot provider IP ranges."""
import ipaddress as ipa
import json
import socket
from argparse import Namespace
from collections.abc import Iterable
from datetime import UTC
from datetime import datetime as dt
from typing import Any
from typing import cast
import requests
from rich import box
from r... | geozeke/banip | src/banip/bots.py | .py | 3934cc3d8da0cc4d | 7 | 0 |
"""Initialize and update external banip database files."""
import os
import shutil
import sys
import tempfile
import zipfile
from argparse import Namespace
from datetime import datetime
from pathlib import Path
import requests
from rich import box
from rich.console import Console
from rich.table import Table
from ric... | geozeke/banip | src/banip/database.py | .py | ce1e8dceff9b1647 | 7 | 0 |
"""Data-file loading and generation helpers."""
import csv
import ipaddress as ipa
import mmap
from pathlib import Path
from rich.console import Console
from banip.constants import COUNTRY_NETS_TXT
from banip.constants import GEOLITE_4
from banip.constants import GEOLITE_6
from banip.constants import GEOLITE_LOC
fro... | geozeke/banip | src/banip/utilities/data.py | .py | 5e3e83db779ecce3 | 7 | 0 |
"""Display and terminal helpers."""
import os
from dataclasses import dataclass
def print_docstring(msg: str) -> None:
"""Print a formatted docstring.
This function assumes the docstring is in a very specific format:
>>> msg = \"\"\"
>>> First line (non-blank)
>>>
>>> Subsequent lines
>... | geozeke/banip | src/banip/utilities/display.py | .py | ab16730ff25d6eba | 7 | 0 |
"""IP parsing and rendering helpers."""
import ipaddress as ipa
from collections.abc import Iterable
from banip.constants import AddressType
from banip.constants import AddressTypes
from banip.constants import NetworkType
from banip.constants import NetworkTypes
def split_hybrid(
hybrid_list: Iterable[AddressTy... | geozeke/banip | src/banip/utilities/ip.py | .py | 8095c94f6da3a300 | 7 | 0 |
"""Network lookup and compaction helpers."""
import ipaddress as ipa
from collections.abc import Iterable
from dataclasses import dataclass
from banip.constants import AddressType
from banip.constants import NetworkType
from banip.utilities.ip import split_hybrid
@dataclass(frozen=True)
class NetworkBounds:
"""... | geozeke/banip | src/banip/utilities/lookup.py | .py | 49415bc4adb7b61d | 7 | 0 |
"""Tests for CLI entry points and parser registration."""
import argparse
import runpy
from argparse import _SubParsersAction
from pathlib import Path
import pytest
from banip import app
from banip.parsers import bots_args
from banip.parsers import build_args
from banip.parsers import check_args
from banip.parsers i... | geozeke/banip | tests/test_app_and_parsers.py | .py | 81cd91d64e826865 | 7.5 | 0 |
"""Tests for changelog and release-maintenance helpers."""
from __future__ import annotations
import subprocess
import sys
from pathlib import Path
import pytest
PROJECT_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(PROJECT_ROOT))
from scripts import bump_version as bump_version_script # noqa:... | geozeke/banip | tests/test_changelog_tools.py | .py | ad659adb027c44c3 | 7.5 | 0 |
"""Tests for shared utility functions."""
import ipaddress as ipa
from types import SimpleNamespace
import pytest
from requests.exceptions import RequestException
from banip import utilities
from banip.utilities import data as utility_data
from banip.utilities import display as utility_display
from banip.utilities i... | geozeke/banip | tests/test_utilities.py | .py | 36db0a02ddb8c7e4 | 7.5 | 0 |
"""Trinkey M0:
pin01: VBAT pin10: VBUS (USB?)
pin02: GND pin09: PA08/D0
pin03: PA06/D4 pin08: PA02/DAC/AREF/D1
pin04: PA07/D3 pin07: PA09/D2
pin05: RESET pin06: 3.3V
DotStar: CLK:PA01, Data:PA00,
LED: PA10
"""
import machine
from math import s... | ricksorensen/xiaoexpansion | doexpansion/tools/dosine.py | .py | 275dbed8ceb93a7b | 7.15 | 1 |
"""Run every eval case and compare its output against the case's expected/ files.
Run from the repo root:
pixi run python evals/run_evals.py
Each case's config.yaml names its own working directory, so cases do not clobber
each other. Exit status is non-zero if any case deviates from its expected/ files.
"""
fro... | lanl/HERMES | evals/run_evals.py | .py | 57e7b0f6e8a327ee | 7.24 | 2 |
from __future__ import annotations
import shutil
import sys
from pathlib import Path
from hermes.runner.analysis.empir._errors import EmpirNotInstalledError
from hermes.state_service.state_io import (
load_hermes_record_from_yaml,
save_hermes_record_to_yaml,
)
from hermes.workflows.workflow import Workflow
D... | lanl/HERMES | examples/analysis/empir/run_empir.py | .py | 4d0192a99c83c097 | 7.24 | 2 |
#!/usr/bin/env python3
#
# check-dep-overrides.py
# Verify that [tool.uv] override-dependencies stay in sync with [project] dependencies.
#
# uv treats two different URLs for the same package as a hard conflict, so this
# project pins the PFS git dependencies twice: once in [project].dependencies and
# once in [tool.uv... | Subaru-PFS/spt_target_uploader | scripts/check-dep-overrides.py | .py | c500726e5e7e44cb | 7.15 | 1 |
#!/usr/bin/env python3
"""Configuration management for PFS Target Uploader.
This module provides dataclass-based configuration loading from .env.shared files,
with validation and type conversion.
"""
import os
from dataclasses import dataclass, field
from pprint import pformat
from dotenv import dotenv_values
from l... | Subaru-PFS/spt_target_uploader | src/pfs_target_uploader/utils/config.py | .py | ba63173920aac221 | 7.15 | 1 |
import datetime
import shutil
import sqlite3
from contextlib import closing
import pandas as pd
from loguru import logger
def create_uid_db(db_path):
"""
Create a SQLite database with a table for upload IDs if it does not exist.
Parameters
----------
db_path : str
The file path to the SQL... | Subaru-PFS/spt_target_uploader | src/pfs_target_uploader/utils/db.py | .py | 43228e3de5423729 | 7.15 | 1 |
#!/usr/bin/env python3
from collections import defaultdict, deque
import numpy as np
import pandas as pd
from astropy import units as u
from astropy.coordinates import SkyCoord, search_around_sky
from loguru import logger
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics import pairwise_distanc... | Subaru-PFS/spt_target_uploader | src/pfs_target_uploader/utils/internal_duplication.py | .py | 492ecda50cb67493 | 7.15 | 1 |
from __future__ import annotations
import logging
import os
import sys
from contextlib import contextmanager, redirect_stdout
from typing import Iterator, Sequence
DEFAULT_NOISY_LOGGERS: tuple[str, ...] = (
"cobraCoach",
"butler",
"ics.cobraCharmer",
"ics.cobraOps",
)
@contextmanager
def suppress_st... | Subaru-PFS/spt_target_uploader | src/pfs_target_uploader/utils/suppress_logging.py | .py | dc4fe2e4a824be90 | 7.15 | 1 |
import csv
import json
import logging
from datetime import datetime, timedelta, time
import requests
import urllib3
# Suppress warnings for unverified HTTPS requests since the GFZ and NOAA sources require it
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# --- Configuration Constants ---
GFZ_FORE... | RenanRB/KPIndex | search.py | .py | 1e5fa79c7f3fc2d3 | 7.39 | 5 |
"""Sidebar navigation for the dash-emoji-mart documentation site.
The boilerplate's flat `page_order` list is swapped for category-grouped
sections. Each `docs/<slug>/<slug>.md`'s `category` frontmatter feeds the
grouping, and anything with an unrecognised category falls into "Other" rather
than disappearing from the ... | pip-install-python/dash-emoji-mart | components/navbar.py | .py | 0be7f450666d87e1 | 7.3 | 3 |
"""Turn Iconify icon sets into emoji-mart custom categories.
Iconify hosts 150+ icon sets — including several emoji sets far larger than the
one emoji-mart bundles (twemoji has ~4,000 glyphs, openmoji ~4,200). This module
fetches a set's index from the Iconify API and reshapes it into the structure
``DashEmojiMart(cus... | pip-install-python/dash-emoji-mart | dash_emoji_mart/iconify.py | .py | 44b582ba95dd0bb1 | 7.3 | 3 |
"""Three custom categories — memes, tech and company — with their own nav icons.
The readout branches on `value.startswith("http")` because a custom emoji has no native
glyph: `value` is the image URL. The name underneath comes from `selectedEmoji`, which
identifies the pick without that guesswork.
"""
import dash_ma... | pip-install-python/dash-emoji-mart | docs/custom-emojis/example.py | .py | b4ede6665655d70d | 7.3 | 3 |
import importlib
import inspect
from markdown2dash.src.directives.kwargs import Kwargs as KwargsBase
def convert_docstring_to_dict(docstring):
"""Convert numpy style parameter docstring to a list of dicts with keys name, type, description"""
lines: list[str] = docstring.split("----------\n")[-1].split("\n")
... | pip-install-python/dash-emoji-mart | lib/directives/kwargs.py | .py | 16074e0d087a4214 | 7.3 | 3 |
"""The interactive gate — what a browser sees instead of a page it may not read.
Ported from pip-docs+ (`lib/page_visibility.py`, the gate-layout half) with the
boilerplate's fail postures: the verdict comes from
:func:`lib.access.resolve_page_access`, which falls OPEN for ``auth`` docs when
Clerk is unconfigured and ... | pip-install-python/dash-emoji-mart | lib/gate_layouts.py | .py | e661e04cabf0b48d | 7.3 | 3 |
"""
``/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).
This module serves ALL THREE ba... | pip-install-python/dash-emoji-mart | lib/health.py | .py | c19e83c31110a9a1 | 7.3 | 3 |
"""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-emoji-mart | lib/hub_client.py | .py | cde96a2bf314bfcd | 7.3 | 3 |
"""Make markdown2dash's inline formatters emit `<span>` instead of `<p>`.
markdown2dash's DashRenderer maps `paragraph` to `dmc.Text` — which renders a
`<p>` — and then maps the *inline* runs `**bold**`, `*italic*` and `~~struck~~`
to `dmc.Text` as well. Nesting the second inside the first is invalid HTML, and
React s... | pip-install-python/dash-emoji-mart | lib/markdown_inline.py | .py | 6aa8cda17a2ec1fc | 7.3 | 3 |
"""SPA page-view beacon — the half of the traffic ledger HTTP alone cannot see.
A Dash app serves ONE HTML document per visit and routes every subsequent page
client-side, so per-request tracking (``lib/analytics_tracker``'s hook, wired in
``run.py``) only ever observes the entry page. Left at that, ``pages`` would
li... | pip-install-python/dash-emoji-mart | lib/pageview_beacon.py | .py | 90d33c42458093f4 | 7.3 | 3 |
"""
Daily traffic rollup — the payload 2plot.ai's ``/traffic`` dashboard reads.
This is a deliberate mirror of the hub's own ``lib/traffic_insights.py``
(2plot.ai). The hub charts every satellite on the same axes, so a number only
means something if every app computed it the same way. The rules, copied from
the hub's ... | pip-install-python/dash-emoji-mart | lib/traffic_rollup.py | .py | 65beccc405cbf68f | 7.3 | 3 |
"""Version claims are derived from the installed packages, never written.
Prose that states a package version writes ``{{VERSION:<distribution>}}``
— the name exactly as it appears on PyPI and in ``pip install`` — and the
markdown loaders substitute the version of whatever is actually installed.
The served documents a... | pip-install-python/dash-emoji-mart | lib/versions.py | .py | a03a4311bf4017d7 | 7.3 | 3 |
"""
Discord Bot for Stonks - Cryptocurrency and Stock Price Comparison
This bot responds to Discord messages with price comparison charts
using the stonks module.
"""
from stonks import get_fig, DEFAULT_TICKERS, COMMAND_PREFIX, StonksError
import matplotlib.pyplot as plt
import discord
import os
import io
import logg... | aljazfrancic/stonks-bot | bot.py | .py | ea7f35327e4fbd43 | 7.15 | 1 |
"""
Configuration file for Stonks Bot.
This file contains all the configuration settings for the bot,
making it easy to customize behavior without modifying the main code.
"""
import os
from typing import List, Dict, Any
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Bot Configuration
B... | aljazfrancic/stonks-bot | config.py | .py | dc8165a944b54b2d | 7.15 | 1 |
#!/usr/bin/env python3
"""
Railway Environment Variables Setup Script
This script helps you set up environment variables in Railway
by reading from your local .env file and providing the commands
to run in Railway CLI.
"""
import os
import sys
from pathlib import Path
def read_env_file():
"""Read the .env file a... | aljazfrancic/stonks-bot | setup_railway.py | .py | 1c925fce33061869 | 7.15 | 1 |
import json
import logging
from collections import Counter
from datetime import datetime, timedelta
import pytz
import recurring_ical_events
import utils
from event import Event, _derive_date_fields
logger = logging.getLogger(__name__)
# Sentinel values marking "do not propagate this field" on overwrite carriers.
... | ghxm/mucnoise | parse_cal.py | .py | a1f5d5b27d94c5c0 | 7.39 | 5 |
import numpy as np
import scipy
from scipy.stats import norm
import pandas as pd
"""
The code provides various variables used for black scholes model in order to calculate the call and put price for options
"""
class BlackScholes:
"""
A class implementing the Black-Scholes option pricing model.
The Bl... | sayampalrecha/Black_scholes_algorithm | models/black_scholes_model.py | .py | 764eb8f516daa6fb | 7 | 0 |
import numpy as np
import streamlit as st
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from scipy.stats import norm
from models.black_scholes_model import BlackScholes, BlackScholesAnalyzer
import sys
import os
def plot_normal_distribution(mean,std_dev):
"""Create a plot of normal... | sayampalrecha/Black_scholes_algorithm | pages/1 - Introduction.py | .py | 52e6a64487d4942e | 7 | 0 |
import streamlit as st
import numpy as np
import plotly.graph_objects as go
from models.black_scholes_model import BlackScholes
def create_sensitivity_plot(param_range, base_params, param_name):
"""Create sensitivity analysis plot for a parameter."""
call_prices = []
put_prices = []
for value in par... | sayampalrecha/Black_scholes_algorithm | pages/2 - Calculator.py | .py | 5819cb57ee1f88b0 | 7 | 0 |
import numpy as np
from scipy.stats import norm
import plotly.graph_objects as go
from datetime import datetime
import io
from models.black_scholes_model import BlackScholes, BlackScholesAnalyzer
import streamlit as st
import plotly.express as px
import pandas as pd
def validate_csv_structure(df):
'''
Validate... | sayampalrecha/Black_scholes_algorithm | pages/3 - Data_Analysis.py | .py | e127987cd42d547a | 7 | 0 |
from Boardgamebox.State import State as BaseState
class State(BaseState):
"""Storage object for game state"""
def __init__(self):
BaseState.__init__(self)
self.day = 1 # Indica el día actual, la primera noche es especial
self.phase = 'Noche' # El juego comienza de noche
self.can... | leviatas/MultigamesV2 | BloodClocktower/Boardgamebox/State.py | .py | 6a6310accf619d77 | 7.24 | 2 |
class State(object):
"""Storage object for game state"""
def __init__(self):
# estados generales
self.fase_actual = None
self.active_player = None
self.reviewer_player = None
self.player_counter = 0
self.last_votes = {}
self.removed_votes = {}
... | leviatas/MultigamesV2 | Boardgamebox/State.py | .py | 1fe4f72db7e13491 | 7.24 | 2 |
from Boardgamebox.State import State as BaseState
class State(BaseState):
"""Storage object for game state"""
def __init__(self):
BaseState.__init__(self)
self.forense = None
self.asesino = None
self.forensic_cards = []
# Cartas de escena y evento que quedan en ... | leviatas/MultigamesV2 | Deception/Boardgamebox/State.py | .py | f4d9f6e8daf90286 | 7.24 | 2 |
"""Tests for the conversation agent agenda notifications."""
import datetime
import logging
import pathlib
from typing import Any
from unittest.mock import patch
import pytest
import yaml
from freezegun import freeze_time
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import Platfo... | allenporter/home-assistant-config | tests/blueprints/test_notify_agenda.py | .py | 415439f59eaa84a9 | 7.8 | 3 |
"""Tests for the conversation agent agenda notifications."""
import datetime
import logging
import pathlib
from typing import Any
from unittest.mock import patch
import pytest
import yaml
from freezegun import freeze_time
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import Platfo... | allenporter/home-assistant-config | tests/blueprints/test_notify_conversation.py | .py | c343d80b04bfa33f | 7.8 | 3 |
"""Test fixtures for configuration."""
import logging
import pathlib
from collections.abc import Generator
from unittest.mock import patch
import pytest
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
_LOGGER = logging.getLogger(__name__)
CONFIG_DIR = pathlib.Path(... | allenporter/home-assistant-config | tests/conftest.py | .py | 21e25fa916df66e7 | 7.8 | 3 |
"""Fixtures for setting up a local calendar store."""
import pathlib
from collections.abc import Generator
from unittest.mock import Mock, patch
import pytest
from homeassistant.components.local_calendar.store import LocalCalendarStore
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core ... | allenporter/home-assistant-config | tests/fixtures/local_calendar_fixture.py | .py | 1cabd4c191e76e05 | 7.8 | 3 |
# Copyright © LFV
import os
import shutil
import subprocess
import tarfile
import tempfile
from pathlib import Path
import pytest
from reqstool_python_decorators.decorators.decorators import SVCs
FIXTURE_DIR = Path(__file__).parents[2] / "fixtures" / "test_project"
EXPECTED_IN_TARBALL = [
"reqstool_config.yml",
... | reqstool/reqstool-python-poetry-plugin | tests/e2e/reqstool_python_poetry_plugin/test_build_e2e.py | .py | 9e0baecc9e44e56b | 7.5 | 0 |
"""Checks to perform on the contents of github repository worktree."""
import logging
import pathlib
import tempfile
import urllib.error
import urllib.request
from collections.abc import Generator
from contextlib import contextmanager
from repo_conformance.exceptions import CheckError
from repo_conformance.manifest i... | allenporter/repo-conformance | repo_conformance/checks/worktree.py | .py | 537878da56ed314a | 7.15 | 1 |
"""Module for exceptions related to conformance checks."""
from dataclasses import dataclass, field
@dataclass
class Failure:
"""An individual conformance test failure."""
detail: str
"""A detailed error message about the check failure."""
names: list[str] = field(default_factory=list)
"""The n... | allenporter/repo-conformance | repo_conformance/exceptions.py | .py | bf8e1bc95f04e5c4 | 7.15 | 1 |
"""Action to list contents of the manifest."""
from argparse import ArgumentParser
from argparse import _SubParsersAction as SubParsersAction
from typing import cast
from .manifest import parse_manifest
class ListAction:
"""List action."""
@classmethod
def register(cls, subparsers: SubParsersAction) ->... | allenporter/repo-conformance | repo_conformance/list.py | .py | e885fb8c5d0ac59c | 7.15 | 1 |
"""Action to list github repos for the user."""
from argparse import ArgumentParser
from argparse import _SubParsersAction as SubParsersAction
from typing import cast
from github import Github
from .manifest import parse_manifest
class ListReposAction:
"""List action."""
@classmethod
def register(cls,... | allenporter/repo-conformance | repo_conformance/list_repos.py | .py | 40bb053283614a44 | 7.15 | 1 |
"""Library for parsing the manifest."""
import pathlib
from dataclasses import dataclass, field
from typing import Any
import yaml
from mashumaro import DataClassDictMixin
from mashumaro.codecs.yaml import yaml_decode
from .exceptions import ManifestError
MANIFEST = pathlib.Path("manifest.yaml")
@dataclass
class ... | allenporter/repo-conformance | repo_conformance/manifest.py | .py | 6740d0b3f84afc85 | 7.15 | 1 |
"""A library to create a registry of conformance checks.
This is generic in that it can support different types of inputs/outputs
so that you can have checks at various levels (e.g. reusing state).
"""
import logging
from collections.abc import Callable
from typing import TypeVar
from .exceptions import CheckError, ... | allenporter/repo-conformance | repo_conformance/registry.py | .py | 8eb769319c733f46 | 7.15 | 1 |
"""Command line tool for interacting with repositories."""
import argparse
import logging
import sys
import traceback
from typing import Any
import yaml
from .check import CheckAction
from .list import ListAction
from .list_repos import ListReposAction
from .prs import PrsAction
from .update_repo import UpdateRepoAc... | allenporter/repo-conformance | repo_conformance/repo.py | .py | 99a0b893e1ee565d | 7.15 | 1 |
"""Action to update a github repos using scruft."""
import logging
import pathlib
import re
import tempfile
from argparse import ArgumentParser, BooleanOptionalAction
from argparse import _SubParsersAction as SubParsersAction
from collections.abc import Generator
from contextlib import contextmanager
from subprocess i... | allenporter/repo-conformance | repo_conformance/update_repo.py | .py | 0b94830c85bcdbb6 | 7.15 | 1 |
"""Tests for CheckAction and conformance checks."""
import json
import subprocess
from pathlib import Path
from typing import Self
from unittest.mock import patch
import pytest
from repo_conformance.check import CheckAction
from repo_conformance.checks.cruft import get_latest_commit
from repo_conformance.checks.work... | allenporter/repo-conformance | tests/test_check.py | .py | 216497d424131b61 | 7.65 | 1 |
"""Tests for manifest parsing, data structures, and error handling."""
from unittest.mock import mock_open, patch
import pytest
from repo_conformance.exceptions import ManifestError
from repo_conformance.manifest import CheckContext, Repo, parse_manifest
def test_parse_manifest() -> None:
"""Test parsing the c... | allenporter/repo-conformance | tests/test_manifest.py | .py | 343e2f9858157844 | 7.65 | 1 |
import asyncio
import os
import sys
from logging.config import fileConfig
from sqlalchemy.ext.asyncio import create_async_engine
from sqlmodel import SQLModel
from alembic import context
# Add the project root directory (backend) to the Python path
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__... | mnaimfaizy/fastapi_rbac | backend/alembic/env.py | .py | 58e6f88d42b73feb | 7.3 | 3 |
"""mapping
Revision ID: f222f6b8f5de
Revises: 74a7cd91e8fa
Create Date: 2024-04-24 14:51:27.331801
"""
from typing import Sequence, Union
import sqlalchemy as sa
from sqlalchemy.engine import reflection
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "f222f6b8f5de"
down_revision: U... | mnaimfaizy/fastapi_rbac | backend/alembic/versions/2024_04_24_1451-f222f6b8f5de_mapping.py | .py | 6e219ec1f514d3c3 | 7.3 | 3 |
"""new
Revision ID: 0c11825e2e0c
Revises: f222f6b8f5de
Create Date: 2024-04-24 14:57:10.335750
"""
from typing import Sequence, Union
import sqlalchemy as sa
import sqlmodel
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "0c11825e2e0c"
down_revision: Union[str, None] = "f222f6b8f5... | mnaimfaizy/fastapi_rbac | backend/alembic/versions/2024_04_24_1457-0c11825e2e0c_new.py | .py | 33d295590a772cbc | 7.3 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.