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
""" Reorder the entries of ``Daf`` axes. See the Julia `documentation <https://tanaylab.github.io/DataAxesFormats.jl/v0.3.0/reorder.html>`__ for details. """ from typing import Any from typing import Mapping from typing import Sequence from typing import Union import numpy as np from .data import DafWriter from .jul...
tanaylab/dafpy
dafpy/reorder.py
.py
1a5c7a99932a20a1
7
0
""" Test ``Daf`` concatenation. """ # pylint: disable=wildcard-import,unused-wildcard-import,missing-function-docstring # flake8: noqa: F403,F405 from textwrap import dedent import dafpy as dp def test_prefixed() -> None: # The names to prefix are given either as one set, applying to every concatenation axis, ...
tanaylab/dafpy
tests/test_concat.py
.py
48ea275da0c9859b
7.5
0
""" Test ``Daf`` generic module. """ # pylint: disable=wildcard-import,unused-wildcard-import,missing-function-docstring # flake8: noqa: F403,F405 from sys import stderr from sys import stdout import dafpy as dp from .utilities import assert_raises def test_generic_functions() -> None: assert dp.inefficient_a...
tanaylab/dafpy
tests/test_generic.py
.py
91b1917c48338f49
7.5
0
""" Test the Julia environment set up by ``Daf``. """ # pylint: disable=wildcard-import,unused-wildcard-import,missing-function-docstring # flake8: noqa: F403,F405 from dafpy.julia_import import jl #: Helpers that ``Daf`` defines for its own use. They live in the ``DafPy`` module so that other Python packages #: wra...
tanaylab/dafpy
tests/test_julia_import.py
.py
6fd12cfb8f785aee
7.5
0
""" Test ``Daf`` axis reconstruction. """ # pylint: disable=wildcard-import,unused-wildcard-import,missing-function-docstring # flake8: noqa: F403,F405 from textwrap import dedent import numpy as np import dafpy as dp def test_empty_values() -> None: # The value(s) meaning "there is no batch" may be given as ...
tanaylab/dafpy
tests/test_reconstruction.py
.py
83bef51316406516
7.5
0
""" Test reordering ``Daf`` axes. """ # pylint: disable=wildcard-import,unused-wildcard-import,missing-function-docstring # flake8: noqa: F403,F405 import dafpy as dp def test_reorder_axes(tmp_path) -> None: # The permutation says where each new entry comes from, and is 0-based here, so reversing three entries ...
tanaylab/dafpy
tests/test_reorder.py
.py
8b046d1676c1cee2
7.5
0
""" Abstract interface for video analysis. This module defines the VideoAnalyzer abstract base class, which provides a contract for all video analysis implementations. This abstraction allows: 1. Testing without FFmpeg (using mocks) 2. Multiple implementations (FFmpeg, GPU, cloud, etc.) 3. Dependency injection for be...
NickBorgers/util
smart-crop-video/smart_crop/analysis/analyzer.py
.py
f0478606850135d6
7.3
3
""" FFmpeg-based video analyzer implementation. This module provides a concrete implementation of VideoAnalyzer using FFmpeg for all video analysis operations. """ import subprocess import re from typing import List, Tuple from smart_crop.analysis.analyzer import VideoAnalyzer from smart_crop.core.scoring import Posit...
NickBorgers/util
smart-crop-video/smart_crop/analysis/ffmpeg.py
.py
bb64493ea24de90d
7.3
3
""" Parallel video analysis using multiprocessing. This module provides parallel analysis of multiple crop positions using Python's multiprocessing module. This can provide 4-8x speedup on typical systems by analyzing positions concurrently instead of sequentially. Key benefits: - Utilizes all CPU cores - Maintains s...
NickBorgers/util
smart-crop-video/smart_crop/analysis/parallel.py
.py
a5a9a3a041498d47
7.3
3
""" Scene detection and segmentation for video analysis. This module provides functionality for dividing videos into scenes or segments for intelligent acceleration and analysis. Scenes can be detected automatically using FFmpeg's scene detection, or created as fixed-duration segments. Scene Detection Workflow: 1. At...
NickBorgers/util
smart-crop-video/smart_crop/analysis/scenes.py
.py
89f55645e874f7ec
7.3
3
""" Candidate generation for crop position selection. This module generates a diverse set of candidate crop positions using multiple scoring strategies and spatial diversity. The goal is to provide 10 high-quality candidates that cover different regions and represent different scoring approaches. Candidate Generation...
NickBorgers/util
smart-crop-video/smart_crop/core/candidates.py
.py
71ef7e5dad091cd0
7.3
3
""" Crop dimension calculations - pure functions with no side effects. This module contains pure mathematical functions for calculating crop dimensions based on video size, aspect ratio, and scaling factors. All functions are deterministic and have no I/O side effects, making them highly testable. """ from typing impo...
NickBorgers/util
smart-crop-video/smart_crop/core/dimensions.py
.py
6e3490cdca77818e
7.3
3
import os import re import networkx as nx import plotly.graph_objects as go import numpy as np def find_python_files(directory, ignore_dirs=None): """Recursively find all Python files in a directory, excluding ignored directories.""" python_files = [] ignore_dirs = set(ignore_dirs) if ignore_dirs ...
infinition/PyDep
PyDep.py
.py
900f5dcd30a5879f
7.39
5
from collections.abc import Iterable from cyclopts import App, CycloptsError, CycloptsPanel, Parameter from rich import traceback from remora_cli.commands.download import download from remora_cli.commands.extract import extract from remora_cli.options import DisplayOptions from remora_cli.ui.rich import CONSOLE def...
Rikiub/remora
packages/cli/src/remora_cli/commands/app.py
.py
c3873fc5d1b84494
7
0
from dataclasses import dataclass from typing import TypeVar, cast from remora.models.download_options import DownloadOptions from remora.models.media import Media from remora.models.rank import get_audio_rank, get_video_rank from remora.models.stream import ( AudioStream, MuxedStream, Stream, StreamLi...
Rikiub/remora
packages/lib/src/remora/_internal/downloader/selector.py
.py
0deb4c482c36d1f5
7
0
from abc import ABC, abstractmethod from collections.abc import AsyncGenerator, AsyncIterable from contextlib import asynccontextmanager from typing import Generic, TypeVar import anyio from anyio import AsyncContextManagerMixin, CancelScope from anyio.streams.memory import MemoryObjectSendStream _DEFAULT_BUFFER_SIZE...
Rikiub/remora
packages/lib/src/remora/_internal/downloader/state_streamer.py
.py
7170180b2c4c8267
7
0
import re from yt_dlp.networking.exceptions import HTTPError from yt_dlp.utils import DownloadError, ExtractorError, YoutubeDLError def sanitize_ydl_error(error: YoutubeDLError) -> str: """ Extracts and sanitizes the clean error message from any yt-dlp exception. Strips CLI flags, bug report templates, e...
Rikiub/remora
packages/lib/src/remora/_internal/ydl/messages.py
.py
0acf04f09e01c447
7
0
import tempfile from loguru import logger from yt_dlp.YoutubeDL import YoutubeDL from remora._internal.ydl.types import YDLParams from remora.path import get_cache_dir class _LoguruYDLWrapper: """Intercepts yt-dlp logs and routes them to Loguru strictly in DEBUG mode.""" EXCLUDED_LOGS = ("ffmpeg not found....
Rikiub/remora
packages/lib/src/remora/_internal/ydl/wrapper.py
.py
956bf5d3cf2cf25a
7
0
"""Raw info extractor.""" from typing import overload from anyio.to_thread import run_sync from loguru import logger from remora.models.media import ( LazyMedia, LazyPlaylist, Media, Playlist, SearchList, _ExtractAdapter, ) from remora.models.search import SearchService from remora.models.typ...
Rikiub/remora
packages/lib/src/remora/extractor.py
.py
0c8462a6ea5bbe53
7
0
"""Remora built-in logger.""" import sys import uuid from typing import Literal from loguru import logger from remora.constants import LIBRAY_NAME __all__ = ["LoggingLevels", "disable", "enable", "setup"] LoggingLevels = Literal[ "TRACE", "DEBUG", "SUCCESS", "INFO", "WARNING", "ERROR", "CRITICAL" ] def enabl...
Rikiub/remora
packages/lib/src/remora/logs.py
.py
4e3bd36fbdfa4425
7
0
"""Thread-safe in-memory message bus for the SRT web chat interface. Any thread (command handlers, scheduler, background workers) can call ``post_message()`` to broadcast a message to all connected WebSocket clients. Messages are stored in a bounded deque so new clients can receive recent history. """ import asyncio ...
taylorhogan/srt
cmd_processing/message_bus.py
.py
4db7eac1c84cbaa8
7
0
import os, sys, socket if __package__ is None or __package__ == "": project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if project_root not in sys.path: sys.path.insert(0, project_root) from configs.config_private import PrivateConfig from configs.config_public import Public...
taylorhogan/srt
configs/config.py
.py
43a83f60e3f03bbe
7
0
"""Tonight's selected DSO, published by the imaging grid and read by everyone else. Only one component decides tonight's target: ``best_object_tonight`` in ``iris_astronomy.astro_dso_visibility``. Every other consumer reads that decision from here rather than re-running the selection, for two reasons: 1. **Cost and s...
taylorhogan/srt
control/tonight_target.py
.py
052eb963593d3e68
7
0
"""Convergence persistence — compute, store, and query per-DSO tail slopes. JSON structure (local/convergence.json): { "m31": { "Ha": {"tail_slope_pct": 0.23, "frame_count": 45, "total_frames": 52, "updated": "2026-05-04"}, "R": {"tail_slope_pct": 0.89, "frame_count": 12, "total_frames": 12, ...
taylorhogan/srt
fits_processing/convergence.py
.py
a2c999172e69d770
7
0
#!/usr/bin/env python3 """Read Kasa device state through TP-Link's cloud, because the LAN cannot. A FALLBACK, not the primary route. Read `kasa_utils.make_discovery_map()` first; this exists for when that cannot answer. The failure it was written for, on 2026-08-14: every HS103/HS300 answered discovery with KLAP meta...
taylorhogan/srt
hardware_control/kasa_cloud.py
.py
4d5b88ef980d4c36
7
0
import asyncio import json import logging import socket import struct import time from kasa import Discover # Failures are logged HERE rather than left to each caller. There are fourteen # call sites and every one of them used to log success unconditionally on the # next line, so a device that did nothing produced a ...
taylorhogan/srt
hardware_control/kasa_utils.py
.py
44c4ab9771281262
7
0
import base64 import os import sys from urllib.parse import quote import requests if __package__ is None or __package__ == "": project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if project_root not in sys.path: sys.path.insert(0, project_root) from configs import config _U...
taylorhogan/srt
hardware_control/pegasus.py
.py
047592caf27853c4
7
0
import logging import os, sys if __package__ is None or __package__ == "": project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if project_root not in sys.path: sys.path.insert(0, project_root) import requests from configs import config logger = logging.getLogger(__name__) ...
taylorhogan/srt
hardware_control/utl_shelly.py
.py
5e5581f069dce111
7
0
""" opt_exposure.py — Optimum sub-exposure time calculator for Iris / QHY600M. Theory ------ The total noise per pixel in a single sub-exposure of length *t* seconds is: sigma_total^2 = R^2 + (S + D) * t where R = read noise (electrons RMS) S = sky background rate (electrons / pixel / seco...
taylorhogan/srt
iris_astronomy/opt_exposure.py
.py
9968378010eb6245
7
0
"""Where the sun is, and whether it is dark enough to be observing. The single definition of "night" for the project. Anything that needs to know should call is_night() rather than reimplement the test, so the observatory and the things reporting on it cannot disagree about whether it is working. Built on astropy rat...
taylorhogan/srt
iris_astronomy/sun.py
.py
554196174793f229
7
0
from datetime import datetime from zoneinfo import ZoneInfo import pytz import requests import sys import os from astral import LocationInfo from astral.sun import sun if __package__ is None or __package__ == "": project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if project_root no...
taylorhogan/srt
iris_astronomy/weather.py
.py
c32de52ef2f50692
7
0
"""Module for caching ZoneInfos.""" from __future__ import annotations import asyncio from zoneinfo import ZoneInfo class CachedZoneInfo(ZoneInfo): """Cache ZoneInfo objects.""" _cache: dict[str, ZoneInfo] = {} @classmethod async def get_cached_zone_info(cls, time_zone_str: str) -> ZoneInfo: ...
taylorhogan/srt
kasa_local/kasa/cachedzoneinfo.py
.py
c2bb6dae7051a9b8
7
0
"""Common cli module.""" from __future__ import annotations import asyncio import json import re import sys from collections.abc import Callable from contextlib import contextmanager from functools import singledispatch, update_wrapper, wraps from gettext import gettext from typing import TYPE_CHECKING, Any, Final, N...
taylorhogan/srt
kasa_local/kasa/cli/common.py
.py
ddcb47812014e519
7
0
""" Sphinx extension to combine multiple nested code-blocks into a single one. """ from importlib.metadata import version from docutils import nodes from docutils.nodes import Element, Node from docutils.statemachine import StringList from sphinx.application import Sphinx from sphinx.directives.code import CodeBlock ...
adamtheturtle/sphinx-combine
src/sphinx_combine/__init__.py
.py
f10f5f205766a0fc
7.15
1
import json from abc import ABC, abstractmethod from langchain_ollama.chat_models import ChatOllama # 导入 ChatOllama 模型 from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder # 导入提示模板相关类 from langchain_core.messages import HumanMessage # 导入消息类 from langchain_core.runnables.history import Runnable...
CCcolab/languageMentor
src/agents/agent_base.py
.py
2765d1d4a60ad5a8
7
0
import random from langchain_core.messages import AIMessage # 导入消息类 from .session_history import get_session_history # 导入会话历史相关方法 from .agent_base import AgentBase from utils.logger import LOG class ScenarioAgent(AgentBase): """ 场景代理类,负责处理特定场景下的对话。 """ def __init__(self, scenario_name, session_id=...
CCcolab/languageMentor
src/agents/scenario_agent.py
.py
78d4d33a380d88a1
7
0
from langchain_core.messages import AIMessage # 导入 AI 消息类 from .session_history import get_session_history # 导入用于处理会话历史的方法 from .agent_base import AgentBase # 导入基础代理类 from utils.logger import LOG # 导入日志记录模块 class VocabAgent(AgentBase): """ 词汇学习代理类,负责处理与用户的对话。 继承自 AgentBase 基类。 """ def __init__...
CCcolab/languageMentor
src/agents/vocab_agent.py
.py
0b8237e34c1ddb3b
7
0
#!/usr/bin/env python3 import importlib.metadata import re import os # 解析包的版本规范 def parse_package_spec(spec): """ 解析包名和版本规范。 返回 (name, operator, version)。 """ match = re.match(r'^([^=<>!~]+)\s*([=<>!~]+)\s*(.+)$', spec) if match: name, op, version = match.groups() return name.s...
CCcolab/languageMentor
src/utils/merge_requirements.py
.py
a3bc40b3ce9bdf58
7
0
"""Local smoke test for the AI advisor + AnthropicProvider. Drives the real OrchestratorAI (workflow-resolved provider, local session store) against a stub WorkflowState, simulating a job failing so a turn fires and the Anthropic provider is actually called. Run from the repo root with ANTHROPIC_API_KEY set: ANTH...
ClickHouse/praktika
_local_ai_smoke.py
.py
a8e228f03d53faec
7.3
3
"""Unit tests for adopting a pre-clone bootstrap check run. The controller opens a check run before cloning (so the PR shows CI immediately); the orchestrator then adopts that check-run id and renames it to the matched workflow instead of opening a fresh one. """ import praktika.orchestrator as orch import praktika.o...
ClickHouse/praktika
ci/tests/test_check_run_adopt.py
.py
f8daf3033a5fb45b
7.8
3
"""Tests for the orchestrator's "Finish Workflow always runs" semantics. The behaviour is baked into two DAG rules instead of a special helper: 1. ``get_ready`` promotes any ``always_run=True`` job to READY as soon as every dep reaches *any* terminal state — SUCCESS, FAILURE, SKIPPED, or CANCELLED. Normal jobs ...
ClickHouse/praktika
ci/tests/test_finish_workflow_always_runs.py
.py
4d940e40d457f125
7.8
3
#!/usr/bin/env python3 """Generate a Galaxy resource-limit overlay for the EGAPx Nextflow config. EGAPx ships an authoritative ``process_resources.config`` that defines the process tiers/labels (``single_cpu``, ``multi_cpu``, ``multi_node``, ``gpx_submitter``, ``long_job``, ``small_mem``, ``med_mem``, ``large_mem`` ....
richard-burhans/galaxytools
tools/ncbi_egapx/docker/assets/galaxy-resource-config.py
.py
0e649ea8007e1db9
7.15
1
import os import subprocess import sys import tempfile from typing import List, Optional, Tuple from tqdm import tqdm from paths import ROOT_DIR s4pred_path = ROOT_DIR / "s4pred" S4PRED_PY = sys.executable S4PRED_CWD = s4pred_path S4PRED_EXEC = s4pred_path / "run_model_new.py" def _write_fasta_indexed(indexed_se...
protosome/convergent_overlaps_aa_change
running_s4pred_batch_fast.py
.py
478bfe2a75c130bb
7
0
# -*- coding: utf-8 -*- """ Created on Thu Jun 4 14:55:56 2020 @author: Lewis Moffat Github: limitloss """ from Bio import SeqIO def aas2int(seq): aanumdict = {'A':0, 'R':1, 'N':2, 'D':3, 'C':4, 'Q':5, 'E':6, 'G':7, 'H':8, 'I':9, 'L':10, 'K':11, 'M':12, 'F':13, 'P':14, 'S':1...
protosome/convergent_overlaps_aa_change
s4pred/utilities.py
.py
d55ed97ecefdcfe6
7
0
#!/usr/bin/env python3.12 """Generate the Eclipse Adoptium (Temurin) domains EDL. Source: https://adoptium.net/installation/ The Eclipse Foundation's Adoptium project install-docs page. Adoptium serves binaries from its own API + the Eclipse / GitHub release CDNs; we anchor on the install instructions, extract hostnam...
t11z/pan-edl
adoptium-domains/adoptium-domains.py
.py
1e239f3eb63fa60f
7
0
#!/usr/bin/env python3.12 """Generate the AlmaLinux mirrors EDL. Source: https://mirrors.almalinux.org/ The AlmaLinux OS Foundation's official mirror list page. """ import sys from urllib.parse import urlparse from bs4 import BeautifulSoup from lib.edl_utils import EDLType, fetch_html, write_edl SOURCE_URL = 'http...
t11z/pan-edl
almalinux-mirrors/almalinux-mirrors.py
.py
727a5657a28af3e1
7
0
#!/usr/bin/env python3.12 """Generate the Alpine Linux mirrors EDL. Source: https://mirrors.alpinelinux.org/mirrors.json Authoritative JSON mirror list maintained by the Alpine project itself. Each entry carries a `urls` array (http/https/rsync); we take the hostname of every URL. (The old plain-text MIRRORS.txt endpo...
t11z/pan-edl
alpine-mirrors/alpine-mirrors.py
.py
1af66715b0cda177
7
0
#!/usr/bin/env python3.12 """Generate the Arch Linux mirrors EDL. Source: https://archlinux.org/mirrors/status/json/ This is the canonical, machine-readable mirror status feed maintained by the Arch Linux project itself. """ import sys from typing import Any from urllib.parse import urlparse from lib.edl_utils import...
t11z/pan-edl
arch-mirrors/arch-mirrors.py
.py
61cf437271370641
7
0
#!/usr/bin/env python3.12 """Generate the Azul Zulu / Platform Prime domains EDL. Source: https://docs.azul.com/core/ Azul Systems' own documentation portal. We anchor on the page main container, extract hostname-like tokens, and filter to Azul-owned suffixes. This catches Azul's CDN (cdn.azul.com), API, and download ...
t11z/pan-edl
azul-domains/azul-domains.py
.py
7aaa2e1241a864fc
7
0
#!/usr/bin/env python3.12 """Generate the Google Chrome update domains EDL. Source: https://support.google.com/chrome/a/answer/6350036 Google's Chrome Enterprise admin help page on firewall configuration. We anchor on the article body, extract hostname tokens, and filter to Google-owned suffixes that Chrome update / s...
t11z/pan-edl
chrome-update-domains/chrome-update-domains.py
.py
13b5699d394ae675
7
0
#!/usr/bin/env python3.12 """Generate the Amazon Corretto domains EDL. Source: https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/downloads-list.html AWS's official Corretto download list. We anchor on the docs main container, pull hostname tokens from inline code + download links, and filter to AWS and Corret...
t11z/pan-edl
corretto-domains/corretto-domains.py
.py
498cddac0744da8d
7
0
#!/usr/bin/env python3.12 """Generate the crates.io domains EDL. Primary source: the crates.io sparse-index config at https://index.crates.io/config.json — vendor-native and authoritative, it advertises the registry's `api` and `dl` hosts. We add the sparse index host itself (the endpoint clients fetch that config fro...
t11z/pan-edl
crates-io-domains/crates-io-domains.py
.py
7c7dc389d2de3a5c
7
0
#!/usr/bin/env python3.12 """Generate the Microsoft Edge update / endpoints EDL. Source: https://learn.microsoft.com/en-us/deployedge/microsoft-edge-security-endpoints Microsoft Learn's official Edge security endpoints page. We anchor on the main docs content area, extract hostname tokens, and filter to Microsoft / Ed...
t11z/pan-edl
edge-update-domains/edge-update-domains.py
.py
9a6e24c35de5fff0
7
0
#!/usr/bin/env python3.12 """Generate the Fedora mirrors EDL. Source: https://mirrors.fedoraproject.org/publiclist/ The Fedora Project's MirrorManager public list. We aggregate the per-release public mirror lists from the index page. """ import sys from urllib.parse import urlparse, urljoin from bs4 import BeautifulS...
t11z/pan-edl
fedora-mirrors/fedora-mirrors.py
.py
aa29e3023ebe48a9
7
0
#!/usr/bin/env python3.12 """Generate the Google Container Registry / Artifact Registry domains EDL. Source: https://cloud.google.com/artifact-registry/docs/docker/authentication Google Cloud's official Artifact Registry / GCR Docker auth docs. References the GCR + Artifact Registry regional hosts inline. """ import s...
t11z/pan-edl
gcr-domains/gcr-domains.py
.py
faac15ff5c7ff746
7
0
#!/usr/bin/env python3.12 """Generate the GitHub Container Registry domains EDL. Source: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry GitHub's own container-registry docs. References ghcr.io and the container blob CDN hostnames inline. """ import sys ...
t11z/pan-edl
ghcr-domains/ghcr-domains.py
.py
90ebd1b9628cac21
7
0
#!/usr/bin/env python3.12 """Generate the Go module proxy domains EDL by scraping go.dev. Source: https://go.dev/ref/mod The Go team's official module reference (the canonical place that defines GOPROXY/GOSUMDB defaults and the Go module ecosystem hosts). """ import sys from bs4 import BeautifulSoup from lib.edl_uti...
t11z/pan-edl
go-proxy-domains/go-proxy-domains.py
.py
24ecee9f1ebc8017
7
0
#!/usr/bin/env python3.12 """Generate the Kali Linux mirrors EDL. Source: https://http.kali.org/README.mirrorlist Plain text file from Offensive Security / Kali Linux, listing the official Kali repository mirrors. """ import sys import re from urllib.parse import urlparse from lib.edl_utils import EDLType, fetch_html...
t11z/pan-edl
kali-mirrors/kali-mirrors.py
.py
c10056132a96f18f
7
0
"""Public API for writing PAN-OS External Dynamic Lists.""" from __future__ import annotations import sys from dataclasses import dataclass, field from enum import Enum from typing import Iterable from lib.fetchers import fetch_html, fetch_json from lib.validators import VALIDATORS, ValidationError class EDLType(st...
t11z/pan-edl
lib/edl_utils.py
.py
0dc95423516f0b0d
7
0
"""Shared HTTP fetch helpers for EDL generator scripts.""" from __future__ import annotations import time from typing import Any import requests USER_AGENT = 'pan-edl/1.0 (github.com/t11z/pan-edl)' DEFAULT_TIMEOUT = 30 DEFAULT_RETRIES = 3 def _request(method: str, url: str, **kwargs: Any) -> requests.Response: ...
t11z/pan-edl
lib/fetchers.py
.py
54220f65942dab88
7
0
"""Defensive scraping helpers for vendor documentation pages. Pattern: each generator picks a stable anchor in the vendor's docs HTML (section heading, container div, table) and extracts candidate hostnames from the bounded region. Candidates pass through the URL_LIST validator and an optional allow-suffix filter to r...
t11z/pan-edl
lib/scraping.py
.py
a6e6d44d481fe9b5
7
0
"""Validators for Palo Alto Networks External Dynamic List entries. Rules derived from official PAN-OS documentation: https://docs.paloaltonetworks.com/network-security/security-policy/administration/objects/external-dynamic-lists/formatting-guidelines-for-an-external-dynamic-list """ from __future__ import annotation...
t11z/pan-edl
lib/validators.py
.py
788ef7477c4aadca
7
0
#!/usr/bin/env python3.12 """Generate the Maven Central domains EDL. Source: https://central.sonatype.org/ Sonatype's official Maven Central documentation portal. We anchor on the main content container and extract Sonatype / Apache Maven hosts. """ import sys from bs4 import BeautifulSoup from lib.edl_utils import ...
t11z/pan-edl
maven-central-domains/maven-central-domains.py
.py
62453a699c17a45e
7
0
#!/usr/bin/env python3.12 """Generate the Microsoft Container Registry domains EDL. Source: https://learn.microsoft.com/en-us/azure/container-registry/container-registry-firewall-access-rules Microsoft's own firewall-access-rules article for Azure Container Registry. References MCR + ACR backend hosts in tables. """ i...
t11z/pan-edl
mcr-microsoft-domains/mcr-microsoft-domains.py
.py
b07b761ff4697ed3
7
0
#!/usr/bin/env python3.12 """Generate the npm domains EDL by scraping the official npm config docs. Source: https://docs.npmjs.com/cli/v10/configuring-npm/npmrc npm's own CLI configuration documentation. The page references the default registry and related npm hosts in inline code blocks; we anchor on the article body...
t11z/pan-edl
npm-domains/npm-domains.py
.py
b7753947cba751a8
7
0
#!/usr/bin/env python3.12 """Generate the NuGet domains EDL from the v3 service index JSON. Source: https://api.nuget.org/v3/index.json This is the canonical NuGet v3 service index — a machine-readable JSON document published by NuGet itself that lists every service endpoint URL. Each resource entry has an '@id' URL w...
t11z/pan-edl
nuget-domains/nuget-domains.py
.py
938e2e2dedda7b60
7
0
#!/usr/bin/env python3.12 """Generate the openSUSE mirrors EDL. Source: https://mirrors.opensuse.org/ The SUSE / openSUSE Project's official mirror list page, which links out to every mirror. (The old /list/all.html path was retired and now 404s; the site root serves the full list.) """ import re import sys from urlli...
t11z/pan-edl
opensuse-mirrors/opensuse-mirrors.py
.py
1e53671357f2784b
7
0
#!/usr/bin/env python3.12 """Generate the Quay.io domains EDL by scraping Project Quay docs. Source: https://docs.projectquay.io/welcome.html Project Quay's own documentation. Quay.io is hosted by Red Hat; hosts appear inline in setup / registry-endpoint references. """ import sys from bs4 import BeautifulSoup from ...
t11z/pan-edl
quay-io-domains/quay-io-domains.py
.py
7343c4a6a1692286
7
0
#!/usr/bin/env python3.12 """Generate the Red Hat container registry domains EDL. Source: https://access.redhat.com/RegistryAuthentication Red Hat's own Registry Authentication article — the canonical place that describes registry.redhat.io / registry.access.redhat.com / registry.connect.redhat.com endpoints. """ impo...
t11z/pan-edl
redhat-registry-domains/redhat-registry-domains.py
.py
567fb706d763c85c
7
0
#!/usr/bin/env python3.12 """Generate the Rocky Linux mirrors EDL. Source: https://mirrors.rockylinux.org/mirrormanager/mirrors The Rocky Linux Foundation's MirrorManager instance, the canonical mirror list maintained by the Rocky project itself. """ import sys from urllib.parse import urlparse from bs4 import Beauti...
t11z/pan-edl
rocky-linux-mirrors/rocky-linux-mirrors.py
.py
8e455c5776898475
7
0
#!/usr/bin/env python3.12 """Generate the RubyGems domains EDL. Source: https://guides.rubygems.org/rubygems-org-api/ RubyGems.org's own guides — describes the public API endpoints served by rubygems.org and friends. The guides page is scraped for currently documented hosts, but the core RubyGems.org service hosts ar...
t11z/pan-edl
rubygems-domains/rubygems-domains.py
.py
ad24c431d8b445aa
7
0
"""Tests for Batch D + E vendor-doc scraper parsers. Live fetch + structure detection is exercised in CI. These tests confirm each parser handles the documented page shape correctly and fails loudly when the anchor goes missing. """ import importlib.util import pathlib import pytest from lib.scraping import PageStru...
t11z/pan-edl
tests/test_batch_de_parsers.py
.py
613dd2574380b140
7.5
0
"""Tests for the Batch A + B retrofitted scrapers. Each test feeds the parser realistic fixture HTML from the vendor's docs page and confirms expected hosts make it through the allow-suffix filter. Live fetch is exercised by CI. """ import importlib.util import pathlib import pytest REPO_ROOT = pathlib.Path(__file_...
t11z/pan-edl
tests/test_retrofit_ab_parsers.py
.py
082ced1f34d2b112
7.5
0
#!/usr/bin/env python3.12 """Generate the Tor exit nodes EDL from the official Tor Project bulk exit list. Source: https://check.torproject.org/exit-addresses This is the canonical list maintained by the Tor Project itself. Format: blocks of four lines per relay; the IP appears on 'ExitAddress' lines. """ import sys ...
t11z/pan-edl
tor-exit-nodes/tor-exit-nodes.py
.py
acba2a525479aa4c
7
0
#!/usr/bin/env python3.12 """Generate the Tor relays EDL from the official Onionoo API. Source: https://onionoo.torproject.org/details Onionoo is the Tor Project's own metrics service. We request only the or_addresses field (the relay's OR-port endpoints, host:port form) and only running relays. """ import sys from ty...
t11z/pan-edl
tor-relays/tor-relays.py
.py
ec415e7252211157
7
0
#!/usr/bin/env python3.12 """Generate the VS Code domains EDL by scraping the official network doc. Source: https://code.visualstudio.com/docs/setup/network ("Network connections in Visual Studio Code") Microsoft's own vendor page. We anchor on the main docs container, extract hostname-like tokens, then filte...
t11z/pan-edl
vscode-domains/vscode-domains.py
.py
18b702a1233aca72
7
0
import json from pathlib import Path from common_libs.containers.container import BaseContainer, requires_container from common_libs.logging import get_logger logger = get_logger(__name__) class GCloudSDKContainer(BaseContainer): """GCloud SDK container https://hub.docker.com/r/google/cloud-sdk/ """ ...
yugokato/k8s-connector
src/k8s_connector/gcloud_sdk.py
.py
dc599dd684f4480e
7
0
"""Git push script for automated blocklist updates in CI environment.""" import logging, subprocess, sys from pathlib import Path # Setup logger logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" ) def run_git_command(cmd: list, description: str) -> None: """Run a...
MaximeWewer/HeimdallBlocklists
blocklists_git_push.py
.py
b872751b1a62dc84
7.35
4
"""Blocklist statistics generator with geolocation and AS analysis.""" import logging import re from collections import Counter, defaultdict from datetime import datetime from pathlib import Path from typing import Dict, List, Optional, Set, Tuple import ipaddress import requests import geoip2.database im...
MaximeWewer/HeimdallBlocklists
blocklists_statistics.py
.py
68f77d973f0432f6
7.35
4
"""Blocklist update module for downloading and processing IP blocklists.""" import ipaddress import json import logging import os import re import string import time from concurrent.futures import ThreadPoolExecutor from pathlib import Path import requests # Setup logger logging.basicConfig( leve...
MaximeWewer/HeimdallBlocklists
blocklists_update.py
.py
3298849da50f6d55
7.35
4
"""Update README.md with blocklist URLs from the generated files.""" import logging import re from pathlib import Path from typing import List # Setup logger logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" ) # Constants BLOCKLIST_DIR: Path = Path("./blocklists") S...
MaximeWewer/HeimdallBlocklists
blocklists_update_urls_readme.py
.py
6dae400092daba81
7.35
4
from xsentinels.sentinel import Sentinel from typing import Any, Protocol, Callable from .settings import SettingsField, BaseSettings import os # Tell pdoc3 to document the normally private method __call__. __pdoc__ = { "SettingsRetrieverProtocol.__call__": True, } class SettingsRetrieverProtocol(Protocol): ...
joshorr/xsettings
xsettings/retreivers.py
.py
a5783b03d16899d8
7.15
1
from dataclasses import dataclass import os import sys from typing import Any, Dict, List, Literal, Self, Tuple import spotipy from dotenv import load_dotenv from spotipy.oauth2 import SpotifyOAuth from loguru import logger @dataclass class Album: name: str artists: List[str] @classmethod def from_tr...
usefulalgorithm/usefulalgorithm
scripts/check_spotify.py
.py
979a798d403ffd58
7
0
import copy import datetime import json import os import pathlib import typing import requests import pytz TIMEZONE = pytz.timezone("US/Eastern") DailyEventValueType = str def time_now() -> str: """ Gets the current time in the "US/Eastern" timezone formatted as "YYYY-MM-DD HH:MMAM/PM". :return: A str...
rashaikupenn/daily-pennsylvanian-headline-scraper
daily_event_monitor.py
.py
e4825171f3d800f5
7
0
""" Scrapes a headline from The Daily Pennsylvanian website and saves it to a JSON file that tracks headlines over time. """ import os import sys import daily_event_monitor import bs4 import requests import loguru def scrape_data_point(): """ Scrapes the main headline from The Daily Pennsylvanian home pag...
rashaikupenn/daily-pennsylvanian-headline-scraper
script.py
.py
28d3a4dd6771f880
7
0
""" Test the basic engine functionality. """ import unittest from unittest import TestCase, main from pathlib import Path from shutil import copytree from tempfile import TemporaryDirectory import json import logging import NLPPlus DATADIR = Path(__file__).parent / "data" NLPPLUSDIR = Path(__file__).parent.parent /...
VisualText/py-package-nlpengine
tests/test_engine.py
.py
327614a9c807aeb5
7.8
3
import os import re import sys from typing import IO, Any PATTERN_COLOR_CODE = r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])" class ColorCodes: DEFAULT = "\x1b[0m" DEFAULT2 = "\x1b[m" BLACK = "\x1b[30m" WHITE = "\x1b[97m" RED = "\x1b[31m" GREEN = "\x1b[32m" YELLOW = "\x1b[33m" BLUE = "\x1b[...
yugokato/common-libs
src/common_libs/ansi_colors.py
.py
71b315f2caf8543e
7
0
from __future__ import annotations import os import time from collections.abc import Callable, Iterator, Sequence from contextlib import contextmanager from functools import wraps from typing import Any, ParamSpec, TypeVar, cast import psycopg import tabulate from psycopg import ClientCursor, Cursor from psycopg.abc ...
yugokato/common-libs
src/common_libs/clients/database/postgresql.py
.py
eaa23061638b4af4
7
0
from __future__ import annotations import redis from common_libs.decorators import singleton from common_libs.logging import get_logger logger = get_logger(__name__) @singleton class RedisClient: """Redis client""" def __init__(self, *, host: str = "localhost", port: int = 6379, user: str, password: str):...
yugokato/common-libs
src/common_libs/clients/database/redis.py
.py
7d39028b3ca7cb08
7
0
from __future__ import annotations from collections.abc import Callable from typing import Any from httpx2 import Auth, Timeout from httpx2._types import TimeoutTypes from common_libs.logging import get_logger from .auth import BearerAuth, ClientAuth, TokenProviderAuth from .ext import AsyncHTTPClient, SyncHTTPClie...
yugokato/common-libs
src/common_libs/clients/rest_client/base.py
.py
9510463e05a5f4db
7
0
from __future__ import annotations import traceback import uuid from collections.abc import Generator from contextlib import contextmanager from datetime import UTC, datetime from typing import Any, cast from httpx2 import AsyncClient, TimeoutException, TransportError from httpx2 import Client as SyncClient from http...
yugokato/common-libs
src/common_libs/clients/rest_client/ext.py
.py
3789e017a06e0729
7
0
from __future__ import annotations import asyncio import json import logging import sys from collections.abc import Callable from concurrent.futures import ThreadPoolExecutor from functools import wraps from typing import TYPE_CHECKING, Any, Concatenate, ParamSpec, TypeVar from httpx2 import Request, Response from c...
yugokato/common-libs
src/common_libs/clients/rest_client/hooks.py
.py
1ab00f6e396a6a10
7
0
import asyncio from collections import deque from collections.abc import AsyncIterator from typing import Any import httpx2 from aioquic.asyncio.protocol import QuicConnectionProtocol from aioquic.h3.connection import H3Connection from aioquic.h3.events import DataReceived, H3Event, Headers, HeadersReceived from aioqu...
yugokato/common-libs
src/common_libs/clients/rest_client/http3.py
.py
4c946d4afaa4f416
7
0
from __future__ import annotations import asyncio import threading import time from dataclasses import dataclass from common_libs.logging import get_logger __all__ = ["RateLimit", "RateLimiter"] logger = get_logger(__name__) @dataclass(frozen=True) class RateLimit: """Client-side rate limit configuration (tok...
yugokato/common-libs
src/common_libs/clients/rest_client/rate_limit.py
.py
a292110ab1571998
7
0
from __future__ import annotations from collections.abc import AsyncIterator, Callable, Iterator from dataclasses import dataclass, field from datetime import datetime from functools import partial from typing import Any, Literal, TypeAlias from httpx2 import Request as _Request from httpx2 import Response as _Respon...
yugokato/common-libs
src/common_libs/clients/rest_client/types.py
.py
2831c388fd59f2bc
7
0
from __future__ import annotations import errno import inspect import json from collections.abc import Callable, Iterable from functools import lru_cache, wraps from http import HTTPStatus from json import JSONDecodeError from typing import TYPE_CHECKING, Any, Concatenate, ParamSpec, TypeVar from urllib.parse import p...
yugokato/common-libs
src/common_libs/clients/rest_client/utils.py
.py
d7c024c17fb983f4
7
0
import shlex import grpc from cri_api import ( Container, ContainerFilter, ExecSyncRequest, ExecSyncResponse, ListContainersRequest, RuntimeServiceStub, ) from common_libs.exceptions import CommandError, NotFound from common_libs.logging import get_logger logger = get_logger(__name__) MAX_MES...
yugokato/common-libs
src/common_libs/containers/containerd.py
.py
93e82a67b3e9d830
7
0
import json import re from collections import defaultdict from collections.abc import Generator, Iterator from typing import Any from common_libs.ansi_colors import ColorCodes, remove_color_code from common_libs.logging import get_logger logger = get_logger(__name__) def parse_streamed_logs(logs: Iterator[bytes]) -...
yugokato/common-libs
src/common_libs/containers/utils/log_parser.py
.py
6ecae6c782184ab8
7
0
import inspect from collections.abc import Callable from functools import lru_cache, wraps from threading import RLock from typing import Any, ParamSpec, TypeVar from weakref import WeakValueDictionary from common_libs.hash import freeze, generate_hash T = TypeVar("T") P = ParamSpec("P") def singleton(cls: type[T])...
yugokato/common-libs
src/common_libs/decorators.py
.py
0f5ea6c13dbf0916
7
0
import os import re import tarfile import tempfile from collections.abc import Iterator from contextlib import contextmanager from datetime import datetime from pathlib import Path def generate_filename(base_filename: str, add_msec: bool = True) -> str: """Convert a base filename to a normalized one with timestam...
yugokato/common-libs
src/common_libs/files.py
.py
60993a797d3592b2
7
0