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 |
|---|---|---|---|---|---|---|
"""PDF text extraction with section detection."""
import re
def extract_sections_from_pdf(pdf_path: str) -> list[dict]:
"""Extract text from PDF, split by major section headings.
Returns: [{"title": "SECTION NAME", "text": "section body...", "page_start": 1, "page_end": 3}, ...]
"""
import pdfplumbe... | Junior81195/athenaeum | src/ingestion/pdf_loader.py | .py | 22cf2122b000d795 | 7.15 | 1 |
"""Pluggable LLM backend — supports Anthropic, OpenAI-compatible, Ollama, Gemini, and OpenRouter."""
import logging
import os
from abc import ABC, abstractmethod
logger = logging.getLogger(__name__)
class LLMProvider(ABC):
@abstractmethod
def generate(self, system: str, user: str, max_tokens: int = 1500) ->... | Junior81195/athenaeum | src/llm/provider.py | .py | 6805c790163e7d60 | 7.15 | 1 |
"""Flask REST API for ConfigGuard.
Endpoints:
POST /api/v1/scan — Submit config text for scanning
POST /api/v1/scan/file — Upload config file for scanning
GET /api/v1/findings — Query findings
GET /api/v1/findings/<id> — Get a specific finding with explanation
GET /api/v1/report/... | michusSq/configguard | src/configguard/api/app.py | .py | bcef906dd0a9a435 | 7 | 0 |
"""Compliance checking engine — orchestrates rule evaluation."""
from __future__ import annotations
import logging
from datetime import datetime
from pathlib import Path
from configguard.ingest.parser import ConfigParser
from configguard.models import (
ComplianceReport,
ComplianceRule,
Finding,
Fram... | michusSq/configguard | src/configguard/check/checker.py | .py | 2dcb21197b1b00c7 | 7 | 0 |
"""Configuration inventory management."""
from __future__ import annotations
import json
from dataclasses import dataclass, field
from datetime import datetime
from pathlib import Path
from typing import Any
from configguard.models import ParsedConfig, Vendor
@dataclass
class InventoryEntry:
"""An entry in the... | michusSq/configguard | src/configguard/ingest/inventory.py | .py | 1fb9621000b86ee7 | 7 | 0 |
"""Directory and Git repository scanners for config files."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import Iterator
from configguard.ingest.parser import ConfigParser
from configguard.models import ParsedConfig
logger = logging.getLogger(__name__)
CONFIG_EXTENSIONS ... | michusSq/configguard | src/configguard/ingest/scanner.py | .py | c4a2ba47f676664f | 7 | 0 |
"""Core data models for ConfigGuard."""
from __future__ import annotations
import enum
import hashlib
import uuid
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any
class Vendor(enum.Enum):
"""Supported network device vendors."""
CISCO_IOS = "cisco_ios"
CISCO_... | michusSq/configguard | src/configguard/models.py | .py | f2f073760b242299 | 7 | 0 |
"""YAML rule loader — loads compliance rules from YAML files."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import Any
import yaml
from configguard.models import ComplianceRule, Framework, Severity
logger = logging.getLogger(__name__)
FRAMEWORK_MAP = {
"nist_800_53"... | michusSq/configguard | src/configguard/rules/loader.py | .py | bbb374e6c07a1f46 | 7 | 0 |
"""Configuration drift detection from compliant baselines."""
from __future__ import annotations
import difflib
import hashlib
import logging
from datetime import datetime
from pathlib import Path
from typing import Any
logger = logging.getLogger(__name__)
class DriftDetector:
"""Detects configuration drift fr... | michusSq/configguard | src/configguard/scan/drift.py | .py | 11cda7d1b6949c89 | 7 | 0 |
from typing import Union
from pyrogram.enums import ChatMemberStatus, ChatType
from pyrogram.types import Message, CallbackQuery
#from stream.core.config_manager import Config
async def isAdmin(message_or_callback: Union[Message, CallbackQuery]) -> bool:
if isinstance(message_or_callback, CallbackQuery):
m... | Ali1gamer7798/StreamXBot | stream/helpers/functions.py | .py | 57bdb1a1a885c72f | 7 | 0 |
"""Drift AI module — ask, classify, embed, see, predict, enrich, score.
All AI primitives dispatch through _call_model(), which routes to
Anthropic or OpenAI based on drift.config.
"""
import json
import os
import base64
from drift_runtime.config import get_config
from drift_runtime.types import (
ConfidentValue... | miguelito0204/drift | drift_runtime/ai.py | .py | af2a15c4ddc25749 | 7 | 0 |
"""Drift config loader.
Reads drift.config (YAML) from the project directory.
Caches result after first load. Call _reset_config() in tests.
"""
import os
import yaml
_config = None
DEFAULTS = {
"ai": {
"provider": "anthropic",
"default_model": "claude-sonnet-4-5-20250929",
"fallback_mod... | miguelito0204/drift | drift_runtime/config.py | .py | 732e0b0981883b75 | 7 | 0 |
"""Drift runtime data operations — file I/O, HTTP, merge, query."""
import os
import csv
import json
import sqlite3
import dataclasses
import httpx
from drift_runtime.exceptions import DriftNetworkError, DriftFileError
from drift_runtime.types import _to_drift_dict
def read(path: str):
"""Read a file from disk... | miguelito0204/drift | drift_runtime/data.py | .py | f2154c31739fab88 | 7 | 0 |
"""Drift pipeline helper functions.
Used by transpiled pipeline code for deduplicate and group_by stages.
"""
from drift_runtime.types import _to_drift_dict
def deduplicate(items: list, key: str) -> list:
"""Remove duplicates from a list by a key field. Keeps the first occurrence."""
seen = {}
for item ... | miguelito0204/drift | drift_runtime/pipeline.py | .py | ab63ee8342a36b9d | 7 | 0 |
"""Drift runtime types.
DriftDict — dict subclass with attribute access for Drift dot notation.
ConfidentValue — wraps a value + confidence score, supports numeric comparisons.
schema_to_json_description — introspects dataclass fields for AI prompting.
parse_ai_response_to_schema — parses AI JSON responses (handles co... | miguelito0204/drift | drift_runtime/types.py | .py | 74898fa1bf1a45a9 | 7 | 0 |
"""End-to-end tests for the Drift pipeline: lex -> parse -> transpile -> valid Python."""
import ast as python_ast
import os
import glob
from drift.lexer import Lexer
from drift.parser import Parser
from drift.transpiler import Transpiler
EXAMPLES_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "exampl... | miguelito0204/drift | tests/test_end_to_end.py | .py | 04eb6e289da6b48d | 7.5 | 0 |
#!/usr/bin/env python
# coding: utf-8
import os
from datetime import datetime
from typing import Dict, Optional
from paperbot import hosadigantha, kannada_prabha, prajavani, vishwavani
from paperbot.utils import (
cleanup_old_files,
cleanup_temp_dir,
ensure_dirs_exist,
get_date_string,
get_india_t... | sankethsj/newspaper-bot | bot.py | .py | 359e95479fe4acbb | 7.24 | 2 |
#!/usr/bin/env python
# coding: utf-8
import os
from multiprocessing.dummy import Pool as ThreadPool
from typing import Optional
import requests
from bs4 import BeautifulSoup
import re
# User agent
HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/1... | sankethsj/newspaper-bot | paperbot/hosadigantha.py | .py | 23b1eef56ecba8b1 | 7.24 | 2 |
#!/usr/bin/env python
# coding: utf-8
import os
from functools import partial
from multiprocessing.dummy import Pool as ThreadPool
from typing import Optional
import requests
def get_page_count(issue_id: str, date_string: str) -> int:
"""Get total number of pages for given issue and date."""
url = f"https:/... | sankethsj/newspaper-bot | paperbot/kannada_prabha.py | .py | 8375a66819183e5b | 7.24 | 2 |
#!/usr/bin/env python
# coding: utf-8
import os
from multiprocessing.dummy import Pool as ThreadPool
from typing import Optional
import requests
# User agent
HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
}
def get_page... | sankethsj/newspaper-bot | paperbot/prajavani.py | .py | 681856b8ce367d35 | 7.24 | 2 |
#!/usr/bin/env python
# coding: utf-8
import datetime as dt
import os
import shutil
from typing import Optional
import img2pdf
from pypdf import PdfWriter
def get_india_time() -> dt.datetime:
"""Get current time in India (UTC+5:30)."""
return dt.datetime.now(dt.timezone.utc) + dt.timedelta(hours=5, minutes=... | sankethsj/newspaper-bot | paperbot/utils.py | .py | 78e54067cc975a2e | 7.24 | 2 |
#!/usr/bin/env python
# coding: utf-8
import os
from multiprocessing.dummy import Pool as ThreadPool
from typing import Dict, List, Optional
import requests
BASE_URL = "https://epaper.vishwavani.news"
USER_AGENT = (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/1... | sankethsj/newspaper-bot | paperbot/vishwavani.py | .py | caa7c8da6b4e142f | 7.24 | 2 |
# main.py
"""
Main entry point for Vendor API Specification Generator.
Command-line interface for discovering and exporting API specifications.
"""
import argparse
import sys
from pathlib import Path
from config.settings import VENDORS, DATABASE_PATH, OUTPUT_DIR, OUTPUT_CONFIG
from src.database.db_manager import Data... | ArmanKyro/crypto-exchange-api-catalog | main.py | .py | 7fcca908c273558a | 7 | 0 |
# src/adapters/base_adapter.py
"""
Base adapter interface for vendor API discovery.
All vendor-specific adapters must inherit from this class.
"""
from abc import ABC, abstractmethod
from typing import Dict, List, Any, Optional
from src.utils.http_client import HTTPClient
from src.utils.logger import get_logger
logg... | ArmanKyro/crypto-exchange-api-catalog | src/adapters/base_adapter.py | .py | d6c08a204a3df7ed | 7 | 0 |
# src/database/db_manager.py
"""
Database connection and initialization management.
"""
import sqlite3
from pathlib import Path
from typing import Optional
from config.settings import DATABASE_PATH, PROJECT_ROOT
from src.utils.logger import get_logger
logger = get_logger(__name__)
class DatabaseManager:
"""
... | ArmanKyro/crypto-exchange-api-catalog | src/database/db_manager.py | .py | 41fbf0c512716d7f | 7 | 0 |
# src/export/json_exporter.py
"""
JSON export functionality for vendor API specifications.
"""
import json
import sqlite3
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Any, Optional
from config.settings import OUTPUT_CONFIG
from src.utils.naming import convert_dict_keys
from sr... | ArmanKyro/crypto-exchange-api-catalog | src/export/json_exporter.py | .py | 2f1363e32718d282 | 7 | 0 |
"""
Normalization module for vendor API field mapping.
This module provides functionality to map vendor-specific field names
to canonical, exchange-agnostic field names for consistent data processing.
"""
from typing import Dict, List, Optional, Any
import json
__version__ = "1.0.0"
__all__ = [
"NormalizationEng... | ArmanKyro/crypto-exchange-api-catalog | src/normalization/__init__.py | .py | 6dcc9430fcb3c1fb | 7 | 0 |
#!/usr/bin/env python3
"""
Create Binance WebSocket ticker field mappings to canonical fields.
Maps Binance-specific field names (single letters) to industry-standard canonical field names.
"""
import sqlite3
import json
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
# Add project ... | ArmanKyro/crypto-exchange-api-catalog | src/scripts/create_binance_mappings.py | .py | 03616a391d461c83 | 7 | 0 |
#!/usr/bin/env python3
"""
Create Bitfinex WebSocket ticker field mappings to canonical fields.
Maps Bitfinex-specific field names to industry-standard canonical field names.
Bitfinex has more descriptive field names already (BID, ASK, etc.).
"""
import sqlite3
import json
import sys
from pathlib import Path
from typi... | ArmanKyro/crypto-exchange-api-catalog | src/scripts/create_bitfinex_mappings.py | .py | 688a283fcac687c6 | 7 | 0 |
#!/usr/bin/env python3
"""
Create Bitget WebSocket ticker field mappings to canonical fields.
Maps Bitget-specific field names to industry-standard canonical field names.
"""
import sqlite3
import json
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
# Add project root to path
projec... | ArmanKyro/crypto-exchange-api-catalog | src/scripts/create_bitget_mappings.py | .py | 2e04e27bee3a22e7 | 7 | 0 |
#!/usr/bin/env python3
"""
Create Bithumb WebSocket ticker field mappings to canonical fields.
Maps Bithumb-specific field names to industry-standard canonical field names.
"""
import argparse
import sqlite3
import json
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
# Add project r... | ArmanKyro/crypto-exchange-api-catalog | src/scripts/create_bithumb_mappings.py | .py | f30af7195e04ba86 | 7 | 0 |
#!/usr/bin/env python3
"""
Create BitMart WebSocket ticker field mappings to canonical fields.
Maps BitMart-specific field names to industry-standard canonical field names.
"""
import argparse
import sqlite3
import json
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
# Add project r... | ArmanKyro/crypto-exchange-api-catalog | src/scripts/create_bitmart_mappings.py | .py | 0e3427475bb11c8d | 7 | 0 |
#!/usr/bin/env python3
"""
Create Bybit WebSocket ticker field mappings to canonical fields.
Maps Bybit-specific field names to industry-standard canonical field names.
"""
import sqlite3
import json
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
# Add project root to path
project_... | ArmanKyro/crypto-exchange-api-catalog | src/scripts/create_bybit_mappings.py | .py | 9f25ba46f1deaa92 | 7 | 0 |
#!/usr/bin/env python3
"""
Create Coinbase WebSocket ticker field mappings to canonical fields.
Maps Coinbase-specific field names to industry-standard canonical field names.
"""
import sqlite3
import json
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
# Add project root to path
pr... | ArmanKyro/crypto-exchange-api-catalog | src/scripts/create_coinbase_mappings.py | .py | 39914ea487459643 | 7 | 0 |
#!/usr/bin/env python3
"""
Create Crypto.com Exchange WebSocket ticker field mappings to canonical fields.
Maps Crypto.com-specific field names to industry-standard canonical field names.
"""
import argparse
import sqlite3
import json
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
... | ArmanKyro/crypto-exchange-api-catalog | src/scripts/create_crypto_com_mappings.py | .py | 8573a18a6f9ef8c0 | 7 | 0 |
"""
LLM-Powered Data Normalization ETL Pattern - Architecture Diagrams
This script generates PNG architecture diagrams using the diagrams library.
Requires: pip install diagrams
Requires: graphviz installed (brew install graphviz on macOS)
Usage:
cd docs/oss-patterns/diagrams
python architecture.py
"""
from ... | ywn7/llm-data-normalization-pattern | diagrams/architecture.py | .py | efe7f6f5b663fa9b | 7.15 | 1 |
import subprocess
import sys
import importlib.util
def check_ffmpeg():
"""
Check if FFmpeg is installed and accessible via command line.
"""
try:
# Redirect output to DEVNULL to keep the console clean
subprocess.run(
["ffmpeg", "-version"],
stdout=subprocess.DEV... | Prani11/yt-heatmap-clipper | check_setup.py | .py | 6fdb056f865ed8ed | 7.39 | 5 |
import os
import re
import json
import sys
import subprocess
import requests
import shutil
from urllib.parse import urlparse, parse_qs
import warnings
warnings.filterwarnings("ignore")
OUTPUT_DIR = "clips" # Directory where generated clips will be saved
MAX_DURATION = 60 # Maximum duration (in seconds) fo... | Prani11/yt-heatmap-clipper | run.py | .py | d003db56e72ced4a | 7.39 | 5 |
"""Comparador de resultados entre emuladores"""
from typing import Dict, List
class Comparator:
"""Compara resultados de múltiples emuladores"""
def compare(self, parsed_results: Dict[str, Dict]) -> List[Dict]:
"""
Compara resultados parseados de diferentes emuladores
Ar... | pablocssousa/Neuro-probe | analyzers/comparator.py | .py | 00077c3ba4eca60b | 7.3 | 3 |
"""Analizador de salida serial para Neuro-Probe"""
from typing import List, Dict
class SerialAnalyzer:
"""Analiza la salida serial y extrae markers"""
def __init__(self, markers: str):
"""
Inicializa el analizador con los markers esperados
Args:
markers: Stri... | pablocssousa/Neuro-probe | analyzers/serial.py | .py | b5ebf8e476380e0f | 7.3 | 3 |
"""Base emulator class for Neuro-Probe"""
from abc import ABC, abstractmethod
from typing import Dict
import subprocess
import time
class Emulator(ABC):
"""Abstract base class for emulator wrappers"""
def __init__(self, image_path: str, config: dict):
self.image_path = image_path
self.co... | pablocssousa/Neuro-probe | emulators/base.py | .py | e73667e93b32c2d7 | 7.3 | 3 |
"""QEMU emulator wrapper for Neuro-Probe"""
import subprocess
import os
import time
from pathlib import Path
from .base import Emulator
class QEMUEmulator(Emulator):
"""QEMU emulator wrapper"""
def __init__(self, image_path: str, config: dict):
super().__init__(image_path, config)
self.s... | pablocssousa/Neuro-probe | emulators/qemu.py | .py | 536c833b76952ed0 | 7.3 | 3 |
"""VirtualBox emulator wrapper for Neuro-Probe"""
import subprocess
import os
import time
from pathlib import Path
from .base import Emulator
class VirtualBoxEmulator(Emulator):
"""VirtualBox emulator wrapper"""
def __init__(self, image_path: str, config: dict):
super().__init__(image_path, conf... | pablocssousa/Neuro-probe | emulators/virtualbox.py | .py | c11d49ab2f8f5be6 | 7.3 | 3 |
#!/usr/bin/env python3
"""
Neuro-Probe Launcher
Unified entry point - choose CLI or GUI
"""
import sys
import argparse
def print_banner():
"""Show welcome banner"""
print()
print("=" * 60)
print(" NEURO-PROBE v1.0.0")
print(" Emulator Behavior Analysis Tool")
print("=" * 60)
... | pablocssousa/Neuro-probe | neuro-probe.py | .py | 8c62e3e160b6c2ca | 7.3 | 3 |
"""
Neuro-Probe: Emulator Behavior Analyzer
Main entry point for running kernel tests across multiple emulators
"""
import argparse
import sys
import json
from pathlib import Path
from typing import List, Dict
from datetime import datetime
from emulators import QEMUEmulator, VirtualBoxEmulator
from analyzers import S... | pablocssousa/Neuro-probe | probe.py | .py | 8861e0f74c4c004e | 7.3 | 3 |
"""Reporter JSON para Neuro-Probe"""
import json
from typing import Dict, List
from datetime import datetime
class JSONReporter:
"""Genera reporte en formato JSON"""
def generate(self, results: Dict, divergences: List[Dict], output_path: str):
"""
Genera reporte JSON
Arg... | pablocssousa/Neuro-probe | reporters/json_report.py | .py | 8a93080e9837b676 | 7.3 | 3 |
"""Reporter de terminal SIMPLE para Neuro-Probe - Solo ASCII"""
from typing import Dict, List
class TerminalReporter:
"""Genera reporte visual en la terminal - SOLO ASCII"""
# Colores ANSI
RESET = "\033[0m"
BOLD = "\033[1m"
RED = "\033[91m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
... | pablocssousa/Neuro-probe | reporters/terminal.py | .py | ceb569ed64550b96 | 7.3 | 3 |
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
from math import exp
import math
import os
from PIL import Image
import argparse
from metrics_single import SSIM, PSNR
NAME = 'RealDOF'
def load_image_as_tensor(image_path):
"""Load image and convert to PyTorch tensor... | mpahlevi64/LowLevelBanana | eval/defocus_deblurring/metrics_batch.py | .py | b5fffb34accff158 | 7.24 | 2 |
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
from math import exp
import math
import os
import re
from PIL import Image
import argparse
from metrics_single import SSIM, PSNR
NAME = 'DPDD'
def extract_number_from_filename(filename):
"""
Extract the numeric part ... | mpahlevi64/LowLevelBanana | eval/defocus_deblurring/metrics_dpdd.py | .py | fba4bcaf0b71cfd6 | 7.24 | 2 |
import numpy as np
from basicsr.utils.matlab_functions import bgr2ycbcr
def reorder_image(img, input_order='HWC'):
"""Reorder images to 'HWC' order.
If the input_order is (h, w), return (h, w, 1);
If the input_order is (c, h, w), return (h, w, c);
If the input_order is (h, w, c), return as it is.
... | mpahlevi64/LowLevelBanana | eval/dehazing/basicsr/metrics/metric_util.py | .py | 9b9a585e55d81489 | 7.24 | 2 |
# Modified from https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/dist_utils.py # noqa: E501
import functools
import os
import subprocess
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
def init_dist(launcher, backend='nccl', **kwargs):
if mp.get_start_method(allow_none=... | mpahlevi64/LowLevelBanana | eval/dehazing/basicsr/utils/dist_util.py | .py | 8be49ebc8c1d0498 | 7.24 | 2 |
import cv2
import math
import numpy as np
import os
from typing import Iterable, Union, Optional, MutableMapping
import torch
from torchvision.utils import make_grid
def img2tensor(imgs, bgr2rgb=True, float32=True):
"""Numpy array to tensor.
Args:
imgs (list[ndarray] | ndarray): Input images.
... | mpahlevi64/LowLevelBanana | eval/dehazing/basicsr/utils/img_util.py | .py | 0cc73f90e045e363 | 7.24 | 2 |
import datetime
import logging
import time
from .dist_util import get_dist_info, master_only
initialized_logger = {}
class MessageLogger():
"""Message logger for printing.
Args:
opt (dict): Config. It contains the following keys:
name (str): Exp name.
logger (dict): Contains... | mpahlevi64/LowLevelBanana | eval/dehazing/basicsr/utils/logger.py | .py | fb69cd002650ce0f | 7.24 | 2 |
import numpy as np
import os
import random
import time
import torch
from os import path as osp
from .dist_util import master_only
from .logger import get_root_logger
def set_random_seed(seed):
"""Set random seeds."""
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual... | mpahlevi64/LowLevelBanana | eval/dehazing/basicsr/utils/misc.py | .py | c3aaf4c8a3deb14f | 7.24 | 2 |
import asyncio
import getopt
from sys import argv, exit
import aiohttp
from onyx_client.client import create
from onyx_client.data.device_command import DeviceCommand
class LoggingClientSession(aiohttp.ClientSession):
"""Used to intercept requests and to be logged."""
def __init__(self, enable_logging: boo... | muhlba91/onyx-client | examples/events/main.py | .py | c0d5091db7f1fa8d | 7.3 | 3 |
import asyncio
import getopt
from sys import argv, exit
import aiohttp
from onyx_client.client import create
from onyx_client.data.device_command import DeviceCommand
class LoggingClientSession(aiohttp.ClientSession):
"""Used to intercept requests and to be logged."""
def __init__(self, enable_logging: boo... | muhlba91/onyx-client | examples/streaming/main.py | .py | a9728875feec9b88 | 7.3 | 3 |
"""Onyx Client authorizer."""
import logging
import aiohttp
from ..client import OnyxClient
from ..configuration.configuration import Configuration
from ..utils.const import API_HEADERS, API_URL, API_VERSION
from ..utils.response import check
_LOGGER = logging.getLogger(__name__)
async def exchange_code(
code... | muhlba91/onyx-client | onyx_client/authorizer/__init__.py | .py | e85d239e36bad128 | 7.3 | 3 |
"""Onyx Client API configuration."""
class Configuration:
"""The API connection configuration."""
def __init__(
self, fingerprint: str, access_token: str, local_address: str | None = None
):
"""Initialize the configuration.
fingerprint: the ONYX.CENTER device fingerprint
... | muhlba91/onyx-client | onyx_client/configuration/configuration.py | .py | 42774cd77ce2c8ad | 7.3 | 3 |
"""Animation Keyframe of Onyx devices."""
class AnimationKeyframe:
"""The representation of an animation keyframe."""
def __init__(self, interpolation: str, delay: int, duration: float, value: int):
"""Initialize the animation keyframe.
interpolation: the interpolation algorithm
dela... | muhlba91/onyx-client | onyx_client/data/animation_keyframe.py | .py | e3bbfc25dddd58f9 | 7.3 | 3 |
"""Animation Values of Onyx devices."""
from typing import Optional
from ..data.animation_keyframe import AnimationKeyframe
class AnimationValue:
"""The representation of an animation value."""
def __init__(self, start: float, current_value: int, keyframes: list):
"""Initialize the animation value.... | muhlba91/onyx-client | onyx_client/data/animation_value.py | .py | 8acfb8d7c81e7171 | 7.3 | 3 |
"""Boolean Values of Onyx devices."""
from typing import Optional
class BooleanValue:
"""The representation of a boolean value."""
def __init__(self, value: bool, read_only: bool):
"""Initialize the boolean value.
value: the value
read_only: set if the value is read only"""
... | muhlba91/onyx-client | onyx_client/data/boolean_value.py | .py | e28e4d9c01f50c72 | 7.3 | 3 |
"""Date Information (date, time, timezone, ...) class."""
class DateInformation:
"""Container for all date related information of the ONYX.CENTER."""
def __init__(self, time: float, timezone: str, timezone_offset: int):
"""Initialize the date information.
time: the value
timezone: th... | muhlba91/onyx-client | onyx_client/data/date_information.py | .py | 7cb0c0b9e35f2701 | 7.3 | 3 |
"""Device Command for an Onyx device."""
from ..enum.action import Action
from ..exception.invalid_command import InvalidCommandException
class DeviceCommand:
"""The representation of a device command."""
def __init__(
self,
properties: dict | None = None,
action: Action = None,
... | muhlba91/onyx-client | onyx_client/data/device_command.py | .py | fb8421defeb9cc5d | 7.3 | 3 |
"""Numeric Values of Onyx devices."""
from typing import Optional
from ..data.animation_value import AnimationValue
class NumericValue:
"""The representation of a numeric value."""
def __init__(
self,
value: int,
minimum: int,
maximum: int,
read_only: bool,
a... | muhlba91/onyx-client | onyx_client/data/numeric_value.py | .py | 0c8d74b167587757 | 7.3 | 3 |
"""Click class."""
from ..data.device_mode import DeviceMode
from ..device.device import Device
from ..enum.device_type import DeviceType
class Click(Device):
"""A ONYX controlled click device."""
def __init__(
self, identifier: str, name: str, device_type: DeviceType, offline: bool
):
"... | muhlba91/onyx-client | onyx_client/device/click.py | .py | d62e610be120cdc7 | 7.3 | 3 |
"""Device class."""
from typing import Optional
from ..data.device_mode import DeviceMode
from ..enum.device_type import DeviceType
from ..exception.update_exception import UpdateException
class Device:
"""A ONYX controlled device."""
def __init__(
self,
identifier: str,
name: str,
... | muhlba91/onyx-client | onyx_client/device/device.py | .py | 8b6db962ea34481b | 7.3 | 3 |
"""Light class."""
from typing import Optional
from ..data.device_mode import DeviceMode
from ..data.numeric_value import NumericValue
from ..device.device import Device
from ..enum.device_type import DeviceType
class Light(Device):
"""A ONYX controlled light."""
def __init__(
self,
identif... | muhlba91/onyx-client | onyx_client/device/light.py | .py | 92111122bdbc0139 | 7.3 | 3 |
"""Shutter class."""
from typing import Optional
from ..data.device_mode import DeviceMode
from ..data.numeric_value import NumericValue
from ..device.device import Device
from ..enum.device_type import DeviceType
# not mapped properties:
# - auto_calibration
# - heart_beat_enabled
# - sun_guard_lower_action
# - su... | muhlba91/onyx-client | onyx_client/device/shutter.py | .py | ff758ed2e91f7a37 | 7.3 | 3 |
"""Switch class."""
from typing import Optional
from ..data.device_mode import DeviceMode
from ..device.device import Device
from ..enum.device_type import DeviceType
class Switch(Device):
"""A ONYX controlled switch device."""
def __init__(self, identifier: str, name: str, device_type: DeviceType):
... | muhlba91/onyx-client | onyx_client/device/switch.py | .py | af4efe7ffcf19865 | 7.3 | 3 |
"""Weather class."""
from typing import Optional
from ..data.device_mode import DeviceMode
from ..data.numeric_value import NumericValue
from ..device.device import Device
from ..enum.device_type import DeviceType
class Weather(Device):
"""A ONYX controlled weather station."""
def __init__(
self,
... | muhlba91/onyx-client | onyx_client/device/weather.py | .py | 006d7e935ae0d65f | 7.3 | 3 |
"""Device Actions of Onyx devices."""
from enum import Enum, auto
class Action(Enum):
"""The actions supported by Onyx."""
CLOSE = auto()
OPEN = auto()
STOP = auto()
TILT_DOWN = auto()
TILT_UP = auto()
WINK = auto()
LIGHT_ON = auto()
LIGHT_OFF = auto()
def string(self) -> st... | muhlba91/onyx-client | onyx_client/enum/action.py | .py | b1800fbc3272fad4 | 7.3 | 3 |
"""Device Types of Onyx devices."""
from enum import Enum, auto
class DeviceType(Enum):
"""The device types supported by Onyx."""
ROLLERSHUTTER = auto()
AWNING = auto()
RAFFSTORE_90 = auto()
RAFFSTORE_180 = auto()
WEATHER = auto()
VENEER = auto()
BASIC_LIGHT = auto()
CLICK = auto... | muhlba91/onyx-client | onyx_client/enum/device_type.py | .py | 933486f7afd13fa9 | 7.3 | 3 |
"""Group class."""
class Group:
"""A ONYX controlled group."""
def __init__(
self,
identifier: str,
name: str,
devices: list,
):
"""Initialize the group.
identifier: the group identifier
name: the group name
devices: the list of devices bel... | muhlba91/onyx-client | onyx_client/group/group.py | .py | 2192a90a20844ea6 | 7.3 | 3 |
"""Onyx Client URL helper."""
from typing import Any
import aiohttp
from ..configuration.configuration import Configuration
from ..utils.const import API_HEADERS, API_URL, API_VERSION
from ..utils.response import check
class UrlHelper:
"""URL helper for performing requests against the HELLA.ONYX API."""
d... | muhlba91/onyx-client | onyx_client/helpers/url.py | .py | 2510053119d332c2 | 7.3 | 3 |
"""Tests for the DateInformation data class."""
from onyx_client.data.date_information import DateInformation
class TestDateInformation:
def test_init(self):
date = DateInformation(10.9, "zone", 100)
assert date.time == 10.9
assert date.timezone == "zone"
assert date.timezone_offs... | muhlba91/onyx-client | tests/data/test_date_information.py | .py | 203ad82c198ce6a2 | 7.3 | 3 |
"""Agent implementation with Claude API and tools."""
import asyncio
import os
from contextlib import AsyncExitStack
from dataclasses import dataclass
from typing import Any
from anthropic import Anthropic
from .tools.base import Tool
from .utils.connections import setup_mcp_connections
from .utils.history_util impo... | abusufiannn/claude-quickstarts | agents/agent.py | .py | 3d1b108f582d6446 | 7 | 0 |
#!/usr/bin/env python3
"""Test suite for Agent message_params functionality.
This module tests the ability to pass custom parameters to the Claude API
through the Agent's message_params argument, including headers, metadata,
and API parameters.
"""
import os
import sys
# Add parent directory to path for imports
sys.p... | abusufiannn/claude-quickstarts | agents/test_message_params.py | .py | c7081e958cdcd74d | 7.5 | 0 |
"""Base tool definitions for the agent framework."""
from dataclasses import dataclass
from typing import Any
@dataclass
class Tool:
"""Base class for all agent tools."""
name: str
description: str
input_schema: dict[str, Any]
def to_dict(self) -> dict[str, Any]:
"""Convert tool to Clau... | abusufiannn/claude-quickstarts | agents/tools/base.py | .py | c042b8e51f88901c | 7 | 0 |
"""Code execution server tool for the agent framework."""
from dataclasses import dataclass
from typing import Any
@dataclass
class CodeExecutionServerTool:
"""Code execution server tool that uses Anthropic's server tool format."""
name: str = "code_execution"
type: str = "code_execution_20250522"
... | abusufiannn/claude-quickstarts | agents/tools/code_execution.py | .py | 1da2b3d6389987f2 | 7 | 0 |
"""Tools that interface with MCP servers."""
from typing import Any
from .base import Tool
from ..utils.connections import MCPConnection
class MCPTool(Tool):
def __init__(
self,
name: str,
description: str,
input_schema: dict[str, Any],
connection: "MCPConnection",
):
... | abusufiannn/claude-quickstarts | agents/tools/mcp_tool.py | .py | 35b45058ac442caa | 7 | 0 |
"""Think tool for internal reasoning."""
from .base import Tool
class ThinkTool(Tool):
"""Tool for internal reasoning without executing external actions."""
def __init__(self):
super().__init__(
name="think",
description=(
"Use the tool to think about somethin... | abusufiannn/claude-quickstarts | agents/tools/think.py | .py | ac867359c98bec89 | 7 | 0 |
"""Web search server tool for the agent framework."""
from dataclasses import dataclass
from typing import Any, Optional
@dataclass
class WebSearchServerTool:
"""Web search server tool that uses Anthropic's server tool format."""
name: str = "web_search"
type: str = "web_search_20250305"
max_use... | abusufiannn/claude-quickstarts | agents/tools/web_search.py | .py | 230888e50f40a14e | 7 | 0 |
"""Connection handling for MCP servers."""
from abc import ABC, abstractmethod
from contextlib import AsyncExitStack
from typing import Any
from mcp import ClientSession, StdioServerParameters
from mcp.client.sse import sse_client
from mcp.client.stdio import stdio_client
from ..tools.mcp_tool import MCPTool
class... | abusufiannn/claude-quickstarts | agents/utils/connections.py | .py | cab67f298cb581df | 7 | 0 |
#!/usr/bin/env python3
"""
Autonomous Coding Agent Demo
============================
A minimal harness demonstrating long-running autonomous coding with Claude.
This script implements the two-agent pattern (initializer + coding agent) and
incorporates all the strategies from the long-running agents guide.
Example Usa... | abusufiannn/claude-quickstarts | autonomous-coding/autonomous_agent_demo.py | .py | 13dab897acc43709 | 7 | 0 |
"""
Progress Tracking Utilities
===========================
Functions for tracking and displaying progress of the autonomous coding agent.
"""
import json
from pathlib import Path
def count_passing_tests(project_dir: Path) -> tuple[int, int]:
"""
Count passing and total tests in feature_list.json.
Args... | abusufiannn/claude-quickstarts | autonomous-coding/progress.py | .py | bee445bd3890274f | 7 | 0 |
"""
Prompt Loading Utilities
========================
Functions for loading prompt templates from the prompts directory.
"""
import shutil
from pathlib import Path
PROMPTS_DIR = Path(__file__).parent / "prompts"
def load_prompt(name: str) -> str:
"""Load a prompt template from the prompts directory."""
pr... | abusufiannn/claude-quickstarts | autonomous-coding/prompts.py | .py | 38a1009ad2d77376 | 7 | 0 |
#!/usr/bin/env python3
"""
Security Hook Tests
===================
Tests for the bash command security validation logic.
Run with: python test_security.py
"""
import asyncio
import sys
from security import (
bash_security_hook,
extract_commands,
validate_chmod_command,
validate_init_script,
)
def t... | abusufiannn/claude-quickstarts | autonomous-coding/test_security.py | .py | 760b9db3ad3d9f36 | 7.5 | 0 |
"""
Sampling loop for browser automation with Claude
"""
import os
from collections.abc import Callable
from datetime import datetime
from enum import StrEnum
from typing import Optional
import httpx
from anthropic import (
Anthropic,
AnthropicBedrock,
AnthropicVertex,
)
from anthropic.types.beta import ... | abusufiannn/claude-quickstarts | browser-use-demo/browser_use_demo/loop.py | .py | f91db7eda9ad7c8e | 7 | 0 |
"""
Message handling abstractions for proper API response processing.
This module provides clean abstractions for processing API responses and building
messages that preserve both text explanations and tool uses together, matching
the Chrome extension's behavior.
"""
from collections.abc import Callable
from dataclas... | abusufiannn/claude-quickstarts | browser-use-demo/browser_use_demo/message_handler.py | .py | 0c64f2fe51b2dc3e | 7 | 0 |
"""
Message rendering functionality for the Browser Use Demo.
This module handles all message rendering logic for the Streamlit interface,
separating presentation concerns from the main application logic.
"""
import base64
from typing import cast
import streamlit as st
from anthropic.types.beta import BetaContentBlo... | abusufiannn/claude-quickstarts | browser-use-demo/browser_use_demo/message_renderer.py | .py | 49a7ad6c8d68e2a3 | 7 | 0 |
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass, fields, replace
from typing import Any
from anthropic.types.beta import BetaToolUnionParam
class BaseAnthropicTool(metaclass=ABCMeta):
"""Abstract base class for Anthropic-defined tools."""
@abstractmethod
def __call__(self, **kw... | abusufiannn/claude-quickstarts | browser-use-demo/browser_use_demo/tools/base.py | .py | 403aa9bae2a58542 | 7 | 0 |
"""
Coordinate scaling utilities for browser tool.
This module handles the scaling of coordinates from Claude's vision model
resolution to the actual browser viewport resolution.
"""
class CoordinateScaler:
"""Handles coordinate scaling between Claude's vision and actual viewport."""
# Claude's image proces... | abusufiannn/claude-quickstarts | browser-use-demo/browser_use_demo/tools/coordinate_scaling.py | .py | aa5cf3a464bbf494 | 7 | 0 |
"""Integration tests for the refactored Browser Use Demo."""
from unittest.mock import AsyncMock, MagicMock, Mock, patch
import pytest
from browser_use_demo.loop import APIProvider
from browser_use_demo.message_renderer import MessageRenderer
from browser_use_demo.streamlit import (
get_or_create_event_loop,
... | abusufiannn/claude-quickstarts | browser-use-demo/tests/test_integration.py | .py | 2653b8fccf6a4e12 | 7.5 | 0 |
"""
Agentic sampling loop that calls the Claude API and local implementation of anthropic-defined computer use tools.
"""
import platform
from collections.abc import Callable
from datetime import datetime
from enum import StrEnum
from typing import Any, cast
import httpx
from anthropic import (
Anthropic,
Ant... | abusufiannn/claude-quickstarts | computer-use-demo/computer_use_demo/loop.py | .py | b5c5e78439814baa | 7 | 0 |
"""
Data loading utilities for FACTOID Reddit dataset and Reuters news articles.
This module provides functions to load and perform initial cleaning of the
FACTOID dataset and Reuters corpus.
"""
import pandas as pd
import numpy as np
from typing import Dict, Any
import warnings
def load_factoid(path: str) -> pd.Da... | melove297/reddit-factuality-detection | src/data_loader.py | .py | 17ccd9feec7ab53e | 7.15 | 1 |
"""
Model evaluation utilities for computing metrics and visualizing results.
This module provides functions for computing classification metrics,
generating confusion matrices, and saving evaluation results.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from typing ... | melove297/reddit-factuality-detection | src/evaluate_models.py | .py | e3971069dfeb68e5 | 7.15 | 1 |
"""
TF-IDF feature extraction utilities for text classification.
This module provides functions for building and applying TF-IDF vectorization
and combining text features with metadata features.
"""
import numpy as np
import pandas as pd
from typing import List, Tuple, Dict
from sklearn.feature_extraction.text import... | melove297/reddit-factuality-detection | src/features_tfidf.py | .py | 89a56a4d4600bd1d | 7.15 | 1 |
"""
DistilBERT-based transformer model for factuality classification.
This module provides a PyTorch model class using DistilBERT from Hugging Face
for post-level factuality classification.
"""
import torch
import torch.nn as nn
from transformers import (
DistilBertModel,
DistilBertTokenizerFast,
DistilBe... | melove297/reddit-factuality-detection | src/model_distilbert.py | .py | 25c0dde27186feed | 7.15 | 1 |
"""
Logistic Regression model wrapper for factuality classification.
This module provides a wrapper class around sklearn's LogisticRegression
with methods for training, prediction, and model persistence.
"""
import numpy as np
import pickle
from typing import Optional, Tuple
from sklearn.linear_model import LogisticR... | melove297/reddit-factuality-detection | src/model_logreg.py | .py | 1a99ee5cd4738984 | 7.15 | 1 |
"""
Text preprocessing and data splitting utilities.
This module provides functions for cleaning text data and splitting datasets
into train, validation, and test sets with stratification support.
"""
import re
import pandas as pd
import numpy as np
from typing import Tuple, List
from sklearn.model_selection import t... | melove297/reddit-factuality-detection | src/preprocess.py | .py | 39ba375eb22f4b18 | 7.15 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.