text stringlengths 185 73.3k | repo stringlengths 7 100 | path stringlengths 4 146 | language stringclasses 7
values | hash stringlengths 16 16 | score float64 7 8.5 | stars int64 0 237k |
|---|---|---|---|---|---|---|
"""Shared utilities for consumer repository update scripts.
Provides common helpers for:
- Running gh/git CLI commands
- GitHub Actions step summary
- Auto-merge configuration
- Stale PR management (close superseded PRs)
- Standardized result formatting
"""
import json
import os
import subprocess
import sys
from path... | cuioss/cuioss-organization | workflow-scripts/consumer_update_utils.py | .py | e24e415c03bef001 | 7 | 0 |
#!/usr/bin/env python3
"""Merge Dependabot PRs that the auto-merge workflow marked eligible.
reusable-dependabot-auto-merge.yml runs under GITHUB_TOKEN and can only label.
GitHub does not start workflow runs for events created by GITHUB_TOKEN, so under
a required merge queue that token cannot land a PR: either its que... | cuioss/cuioss-organization | workflow-scripts/sweep-dependabot-prs.py | .py | 3f699b1b94e48cba | 7 | 0 |
#!/usr/bin/env python3
"""Update a Maven dependency version in a consumer repository.
Supports two scopes:
- parent: Updates the <parent> POM version directly
- dependency: Updates a named version property across all POM files
(requires --version-property)
Usage:
# Parent scope: updates <parent><version> in roo... | cuioss/cuioss-organization | workflow-scripts/update-consumer-dependency.py | .py | 5813c278a76cc906 | 7 | 0 |
#!/usr/bin/env python3
"""Update a single consumer repository with new workflow references.
This script encapsulates the per-repository update logic from the release
workflow. It clones a repository, runs the update-workflow-references.py
script, and creates a PR if changes were made.
When the consumer repo has auto-... | cuioss/cuioss-organization | workflow-scripts/update-consumer-repo.py | .py | c8127e55a7232024 | 7 | 0 |
#!/usr/bin/env python3
"""
Update cuioss-organization workflow references to SHA-pinned format.
Since all files share the same SHA after a release, this script discovers the
old SHA from existing files and does a simple global replacement — no need to
enumerate specific directories.
Usage:
# Standard release upda... | cuioss/cuioss-organization | workflow-scripts/update-workflow-references.py | .py | dd6a691f358b22b8 | 7 | 0 |
#!/usr/bin/env python3
"""Verify auto-merge status of consumer repo PRs after batch creation.
After all consumer PRs are created with `gh pr merge --auto` enabled,
this script polls them in batch and reports final status.
Usage:
./verify-consumer-prs.py --results-file results.json --timeout 300
"""
import argpar... | cuioss/cuioss-organization | workflow-scripts/verify-consumer-prs.py | .py | 9cb3d06175fece8e | 7 | 0 |
import os
import subprocess
import time
class AHKPluginManager:
"""
Manages the lifecycle and generation of AutoHotkey (AHK) scripts for OS-Level Macros.
"""
def __init__(self, plugin_dir="plugins/ahk"):
# Resolve AppData safely with a hard fallback to User Directory
default_appdata = o... | TDD131/HELXAID | python/AHKPluginManager.py | .py | ec4b843f9dccb766 | 7.3 | 3 |
# pyright: reportUndefinedVariable=false
"""
CrosshairGL - GPU-accelerated crosshair overlay using OpenGL.
Provides smooth, low-latency crosshair rendering with hardware anti-aliasing.
Falls back to QPainter if OpenGL is not available.
"""
from PySide6.QtOpenGLWidgets import QOpenGLWidget
from PySide6.QtCore import Qt... | TDD131/HELXAID | python/CrosshairGL.py | .py | c452ab9ce4b1d6b2 | 7.3 | 3 |
"""
CrosshairOverlay - Transparent always-on-top crosshair window.
Provides a click-through overlay that displays a customizable crosshair.
Supports GPU-accelerated OpenGL rendering with automatic QPainter fallback.
"""
from PySide6.QtWidgets import QWidget, QApplication, QVBoxLayout
from PySide6.QtCore import Qt, QTi... | TDD131/HELXAID | python/CrosshairOverlay.py | .py | 9b95286ca851951d | 7.3 | 3 |
"""
Debug Console Window Widget
A floating window that displays print() output when running as .exe.
Can be toggled with F12.
Component Name: DebugConsoleWidget
"""
import sys
import json
import re
from PySide6.QtWidgets import (
QWidget, QVBoxLayout, QTextEdit, QPushButton, QHBoxLayout
)
from PySide6.QtCore imp... | TDD131/HELXAID | python/DebugConsoleWidget.py | .py | 3406d0bd1852b12a | 7.3 | 3 |
"""
LibreHardwareMonitor Sensor Panel Dialog - High-Tech Interactive Hardware Monitor
Displays live CPU/GPU temperatures, clocks, loads, power wattage, fan speeds,
and storage health in a sleek dark Orbitron PySide6 UI inside HELXAID.
Component Name: LHMSensorPanelDialog
"""
import sys
import os
import math
from PyS... | TDD131/HELXAID | python/LHMSensorPanelDialog.py | .py | bfb2273d5c2f609c | 7.3 | 3 |
import os
import json
from PySide6.QtWidgets import (
QDialog, QVBoxLayout, QLabel, QComboBox, QPushButton, QHBoxLayout,
QFrame, QWidget
)
from PySide6.QtCore import Qt, Signal
from PySide6.QtMultimedia import QMediaDevices, QAudioDevice, QAudioOutput
class MusicSettingsDialog(QDialog):
# Signal emitted w... | TDD131/HELXAID | python/MusicSettingsDialog.py | .py | 59d85bc6d33667a5 | 7.3 | 3 |
"""
Network History Analytics Engine for HELXTATS.
Provides high-performance analytical queries, timeline aggregations,
and export utilities for historical network data stored in SQLite.
Component Name: NetworkHistoryEngine
"""
import os
import sqlite3
import time
import csv
import json
from datetime import datetime,... | TDD131/HELXAID | python/NetworkHistoryEngine.py | .py | f76199d2f4e841e7 | 7.3 | 3 |
"""
Network Historical Usage & Timeline Analytics Panel for HELXTATS.
Provides interactive SQLite timeline charts, per-app bandwidth attribution,
peak day summaries, and CSV/JSON export capabilities matching HELXAIRO style.
Component Name: NetworkHistoryPanel
"""
import os
import re
from typing import Dict, Any, List... | TDD131/HELXAID | python/NetworkHistoryPanel.py | .py | 420bdb8f2fc9a06c | 7.3 | 3 |
"""
High-Tech Vector Speed Gauge Widget for HELXTATS Speedtest Lab.
Custom Tachometer & Real-time Throughput Gauge built purely with QPainter,
Orbitron typography, and smooth hardware-accelerated animations.
Component Name: SpeedGaugeWidget
"""
import math
import time
from PySide6.QtWidgets import QWidget
from PySide... | TDD131/HELXAID | python/SpeedGaugeWidget.py | .py | 519cf21ad180a6e9 | 7.3 | 3 |
from PySide6.QtWidgets import QWidget, QGraphicsOpacityEffect, QLabel, QVBoxLayout
from PySide6.QtCore import Qt, QPropertyAnimation, QEasingCurve, QRect, QPoint, QRectF, QTimer
from PySide6.QtGui import QPainter, QColor, QPainterPath, QFont
class SpotlightOverlay(QWidget):
"""
A full-screen (or full-dialog) ... | TDD131/HELXAID | python/SpotlightOverlay.py | .py | 3555e5b6d50d9f8e | 7.3 | 3 |
#!/usr/bin/env python3
"""
Chelsea FC News -> Atom feed generator
Source: Chelsea FC's internal news-listing JSON API (found in the page's
inline __webSettings__ / NewsListModule data-props, not publicly documented,
so it may change without notice).
API: https://www.chelseafc.com/en/api/news/listing/7rJyiGvKIDGe6kNF0... | thechelsuk/cfc_news_as_atom_feed | chelsea_rss.py | .py | 9e4529aa0bb7588c | 7.15 | 1 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""Re-check tests/_data/README.md's vendored pin against upstream.
That file documents its own procedure under "Re-checking a pin": a local
`... | btclib-org/btclib-node | .github/scripts/check_vendored_pin.py | .py | 10f509d91d5bde4e | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""Rewrite an sdist so that two builds of one commit are the same bytes.
The backend already does that, and this runs anyway. `uv_build` writ... | btclib-org/btclib-node | .github/scripts/normalize_sdist.py | .py | dbf5dba6dd9adb20 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""An atheris harness fuzzing BIP61's `reject` payload parser.
`Reject.parse` is the deserializer of a peer's own octets this tree
owns. `p2p... | btclib-org/btclib-node | fuzz/fuzz_reject.py | .py | 5968d9cf37313aa8 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`BlockDB`: blocks and their undo data on disk.
Blocks and reverse patches (`RevBlock`) are appended to flat, rotating
files under `data_di... | btclib-org/btclib-node | src/btclib_node/block_db/__init__.py | .py | 0ce4155b61fd90c7 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""The networks this node can join, and the genesis block of each.
`Chain` and its four leaves -- `Main`, `TestNet`, `SigNet`, `RegTest` --
c... | btclib-org/btclib-node | src/btclib_node/chains.py | .py | 8ed2260bcd28d435 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`Chainstate`: the block index, the UTXO set and the compact filter index.
All three share the one `db.KeyValueStore` `Chainstate` opens, t... | btclib-org/btclib-node | src/btclib_node/chainstate/__init__.py | .py | 76bfa31f6d736a05 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""What the chain before a header requires of that header.
Bitcoin Core's `ContextualCheckBlockHeader` and the two answers it asks
for: `GetN... | btclib-org/btclib-node | src/btclib_node/chainstate/contextual.py | .py | 4e4b108afba14305 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""The BIP158 filter of every connected block, and its filter header.
What a node holds that `btclib.block.block_filter` does not: the
arithm... | btclib-org/btclib-node | src/btclib_node/chainstate/filter_index.py | .py | da7d31db9563d42f | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`UtxoIndex`, the set of transaction outputs a spend may still reference.
`add_block` applies one block's own spends and creations, returni... | btclib-org/btclib-node | src/btclib_node/chainstate/utxo_index.py | .py | b6ece4e7b2fd99a2 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`Config`, the settings one `Node` is built from.
Which chain to join, where its data lives, which listeners to start and
on which interfac... | btclib-org/btclib-node | src/btclib_node/config.py | .py | d046cf6f03ea35ea | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""The small enumerations shared across this package.
`ProtocolVersion`, `P2pConnStatus` for a single peer connection's own
handshake state, ... | btclib-org/btclib-node | src/btclib_node/constants.py | .py | 6e03ad7ece790e15 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""The ordered key-value store every index of this node is kept in.
Read a key, write one, delete one, write several as one, walk the whole
s... | btclib-org/btclib-node | src/btclib_node/db.py | .py | f3bd2d7390ee3563 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""Exception classes.
`TRY002`/`TRY003` (issue #284) ask two things of a `raise`: that its
class not be the bare `Exception`/`BaseException` ... | btclib-org/btclib-node | src/btclib_node/exceptions.py | .py | ac5e45d125ea527f | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""Script and transaction validation, dispatched across `Node.worker_pool`.
`get_flags` reads which script rules are active at a given height... | btclib-org/btclib-node | src/btclib_node/interpreter.py | .py | 9e3de2bb605f5037 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`Logger`, a `logging.Logger` writing to a file or to a stream.
A file handler where a caller names a path -- `Node.__init__` resolves
one ... | btclib-org/btclib-node | src/btclib_node/log.py | .py | fd66683448052e40 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`update_chain`, called once per pass of `Node`'s own loop.
Builds a fork's contextual detail, validates it block by block through
`interpr... | btclib-org/btclib-node | src/btclib_node/main.py | .py | 81a469b66e480969 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`handle_p2p`, `handle_p2p_handshake`, `resume_cfilters` and `resume_getdata`.
The first two pop one message off their own queue -- `P2pMan... | btclib-org/btclib-node | src/btclib_node/p2p/main.py | .py | 3299f0280b8d3bf5 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`Reject`, BIP61's message, and the codes it carries.
`p2p.callbacks.reject` is the only handler that reads one, logging what
a peer sent; ... | btclib-org/btclib-node | src/btclib_node/p2p/messages/errors.py | .py | 34c632d66ca5c748 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`RpcConnection`, one HTTP socket carrying a JSON-RPC request and reply.
Parses the header section off the wire, bounded by `MAX_HEADER_BYT... | btclib-org/btclib-node | src/btclib_node/rpc/connection.py | .py | 03db03d296752d41 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""How a callback refuses a request rather than failing on it."""
import enum
from typing import Any
__all__ = ["RpcError", "RpcErrorCode", ... | btclib-org/btclib-node | src/btclib_node/rpc/errors.py | .py | 50def0bf634ff112 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""`handle_rpc`, called once per pass of `Node`'s loop.
Pops one request off `RpcManager.messages`, validates its JSON-RPC
shape with `is_val... | btclib-org/btclib-node | src/btclib_node/rpc/main.py | .py | db2a7ebc23374723 | 7.45 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""What the test suite shares, and how a vendored vector is read.
Vectors live in `tests/**/_data/` and are vendored rather than fetched:
a t... | btclib-org/btclib-node | tests/__init__.py | .py | 68292229377b40ba | 7.95 | 7 |
# Copyright (c) The btclib developers
# Distributed under the MIT software license, see the accompanying
# LICENSE file or https://opensource.org/license/mit for the full text.
"""Suite-wide pytest hooks and node fixtures used across the tests.
The hooks keep the coverage floor from firing on a run that could not
hav... | btclib-org/btclib-node | tests/conftest.py | .py | 4267ea2818d61777 | 7.95 | 7 |
"""
https://docs.couchbase.com/enterprise-analytics/current/reference/rest-intro.html#enterprise-analytics-admin-api
"""
import json
from cb_server_rest_util.connection import CBRestConnection
class AnalyticsAdminAPI(CBRestConnection):
def __init__(self):
super(AnalyticsAdminAPI, self).__init__()
de... | couchbaselabs/TAF | couchbase_utils/cb_server_rest_util/analytics/analytics_admin.py | .py | c1c08c559f0f7aea | 7.52 | 10 |
"""
https://docs.couchbase.com/server/current/analytics/rest-settings.html
"""
from cb_server_rest_util.connection import CBRestConnection
class AnalyticsSettingsAPI(CBRestConnection):
def __init__(self):
super(AnalyticsSettingsAPI, self).__init__()
def set_analytics_debug_settings_in_metakv(
... | couchbaselabs/TAF | couchbase_utils/cb_server_rest_util/analytics/analytics_settings.py | .py | 5e18f44eed1765b0 | 7.52 | 10 |
from cb_server_rest_util.connection import CBRestConnection
class BackupManageAndConfigAPIs(CBRestConnection):
def __init__(self):
super(BackupManageAndConfigAPIs, self).__init__()
def get_cluster_info(self):
"""
GET /cluster/self
docs.couchbase.com/server/current/rest-api/bac... | couchbaselabs/TAF | couchbase_utils/cb_server_rest_util/backup/manage_and_config.py | .py | cd6560f838115a09 | 7.52 | 10 |
from cb_server_rest_util.connection import CBRestConnection
class BucketGuardrailsAPI(CBRestConnection):
def __init__(self):
super(BucketGuardrailsAPI, self).__init__()
def set_bucket_rr_guardrails(self, couch_min_rr=None, magma_min_rr=None):
"""
POST /settings/resourceManagement/buck... | couchbaselabs/TAF | couchbase_utils/cb_server_rest_util/buckets/bucket_guardrails.py | .py | 305638ea911ce994 | 7.52 | 10 |
from requests.utils import quote
from cb_server_rest_util.connection import CBRestConnection
class BucketInfo(CBRestConnection):
def __init__(self):
super(BucketInfo, self).__init__()
def get_bucket_cccp(self, bucket_name):
"""
GET /pools/default/b/<bucket_name>
Returns the CC... | couchbaselabs/TAF | couchbase_utils/cb_server_rest_util/buckets/bucket_info.py | .py | cc9d694972fd1ddd | 7.52 | 10 |
from requests.utils import quote
from cb_server_rest_util.connection import CBRestConnection
class DocOpAPI(CBRestConnection):
def __init__(self):
super(DocOpAPI, self).__init__()
def get_random_key(self, bucket_name):
"""
GET /pools/default/buckets/<bucket_name>/localRandomKey
... | couchbaselabs/TAF | couchbase_utils/cb_server_rest_util/buckets/doc_ops.py | .py | a6e2ba7f24d23146 | 7.52 | 10 |
"""An example file to use this library."""
import asyncio
import datetime
import logging
import time
from pathlib import Path
from pprint import pprint
from typing import cast
import yaml
from aiohttp import ClientSession
from aioautomower.auth import AbstractAuth
from aioautomower.const import API_BASE_URL
from aio... | Thomas55555/aioautomower | example.py | .py | 61ec7c0d8fad44ee | 7.52 | 10 |
"""Module for AbstractAuth for Husqvarna Automower."""
import asyncio
import logging
from abc import ABC, abstractmethod
from http import HTTPStatus
from typing import Any
import orjson
from aiohttp import (
ClientError,
ClientResponse,
ClientResponseError,
ClientSession,
ClientWebSocketResponse,
... | Thomas55555/aioautomower | src/aioautomower/auth.py | .py | 3bcc211198d8428e | 7.52 | 10 |
"""The constants for aioautomower."""
from enum import IntEnum, StrEnum
API_BASE_URL = "https://api.amc.husqvarna.dev/v1"
AUTH_API_BASE_URL = "https://api.authentication.husqvarnagroup.dev/v1"
AUTH_API_TOKEN_URL = f"{AUTH_API_BASE_URL}/oauth2/token"
AUTH_API_REVOKE_URL = f"{AUTH_API_BASE_URL}/oauth2/revoke"
AUTH_HEAD... | Thomas55555/aioautomower | src/aioautomower/const.py | .py | 8a947b08b16c776b | 7.52 | 10 |
"""Models for Husqvarna Automower data."""
from __future__ import annotations
import logging
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any
from mashumaro import DataClassDictMixin, field_options
from .model_battery import Battery # noqa: TC001
from .model_calendar import Tasks # n... | Thomas55555/aioautomower | src/aioautomower/model/model.py | .py | de335d030098f936 | 7.52 | 10 |
"""Models for Automower Connect API - Calendar."""
from dataclasses import dataclass, field, fields
from datetime import datetime, time, timedelta
from typing import TYPE_CHECKING
from ical.iter import (
MergedIterable,
SortableItem,
)
from mashumaro import DataClassDictMixin, field_options
from mashumaro.con... | Thomas55555/aioautomower | src/aioautomower/model/model_calendar.py | .py | a3a85917070b39a1 | 7.52 | 10 |
"""Models for Husqvarna Automower data."""
from __future__ import annotations
from dataclasses import dataclass, field
from datetime import datetime # noqa:TC003
from enum import StrEnum
from mashumaro import DataClassDictMixin, field_options
from .model_mower import (
ERRORCODES,
snake_case,
)
from .utils... | Thomas55555/aioautomower | src/aioautomower/model/model_message.py | .py | 8b90a2cb1ec90239 | 7.52 | 10 |
"""Models for Automower Connect API - Planner."""
from dataclasses import dataclass, field
from datetime import datetime
from enum import StrEnum
from mashumaro import DataClassDictMixin, field_options
from .utils import convert_timestamp_to_aware_datetime
class Actions(StrEnum):
"""Actions in the planner of l... | Thomas55555/aioautomower | src/aioautomower/model/model_planner.py | .py | 8df8027c6c7b69ac | 7.52 | 10 |
"""Models for Automower Connect API - Settings."""
from dataclasses import dataclass, field
from enum import StrEnum
from mashumaro import DataClassDictMixin, field_options
class HeadlightModes(StrEnum):
"""Headlight modes of a lawn mower."""
ALWAYS_ON = "always_on"
ALWAYS_OFF = "always_off"
EVENIN... | Thomas55555/aioautomower | src/aioautomower/model/model_settings.py | .py | 394c941d58e232b8 | 7.52 | 10 |
"""Models for Automower Connect API - StayOutZones."""
from dataclasses import dataclass, field
from mashumaro import DataClassDictMixin, field_options
@dataclass
class Zone(DataClassDictMixin):
"""DataClass for Zone values."""
name: str
enabled: bool
@dataclass
class StayOutZones(DataClassDictMixin)... | Thomas55555/aioautomower | src/aioautomower/model/model_stay_out_zones.py | .py | 7798c58ca47c7fb3 | 7.52 | 10 |
"""Models for Husqvarna Authentication API."""
from dataclasses import dataclass
from mashumaro import DataClassDictMixin
@dataclass
class User(DataClassDictMixin):
"""The user details of the JWT."""
first_name: str
last_name: str
custom_attributes: dict[str, str]
customer_id: str
@dataclass
... | Thomas55555/aioautomower | src/aioautomower/model/model_token.py | .py | 620f4a7a85386ad4 | 7.52 | 10 |
"""Models for Automower Connect API - WorkAreas."""
import warnings
from dataclasses import dataclass, field
from datetime import datetime
from enum import StrEnum
from mashumaro import DataClassDictMixin, field_options
from .utils import convert_timestamp_to_aware_datetime
class WorkAreaType(StrEnum):
"""Type... | Thomas55555/aioautomower | src/aioautomower/model/model_work_areas.py | .py | 05429cb2f3f5493b | 7.52 | 10 |
"""Models for Automower Connect API messages."""
from typing import Literal, TypedDict
class Message(TypedDict):
"""A single message containing error or warning information."""
time: int
code: int
severity: Literal["FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "SW", "UNKNOWN"]
latitude: float
... | Thomas55555/aioautomower | src/aioautomower/model_input/model_message.py | .py | 9784200a5c603a68 | 7.52 | 10 |
"""Models for Automower Connect API for endpoint /mowers."""
from typing import Any, TypedDict
from .model_message import Message
class SystemAttributes(TypedDict):
"""Represents system attributes of the mower."""
name: str
model: str
serialNumber: int
class BatteryAttributes(TypedDict):
"""R... | Thomas55555/aioautomower | src/aioautomower/model_input/model_rest.py | .py | 65c0fc423c4dee7e | 7.52 | 10 |
"""A timeline is a set of events on a calendar.
This timeline is used to iterate over program runtime events, managing
the logic for interpreting recurring events for the Husqvarna Automower
calendar. Only upcoming events will be shown.
"""
import datetime
import logging
from collections.abc import Iterable
from data... | Thomas55555/aioautomower | src/aioautomower/timeline.py | .py | 162a3c257e4023ab | 7.52 | 10 |
"""Utils for Husqvarna Automower."""
import logging
from datetime import UTC, tzinfo
from functools import lru_cache
_LOGGER = logging.getLogger(__name__)
MOWER_TIME_ZONE: tzinfo = UTC
@lru_cache(maxsize=1)
def get_mower_time_zone() -> tzinfo:
"""Get the default time zone."""
return MOWER_TIME_ZONE
def s... | Thomas55555/aioautomower | src/aioautomower/tz_util.py | .py | 59445587f69aa42c | 7.52 | 10 |
"""Utils for Husqvarna Automower."""
import logging
import time
import zoneinfo
from datetime import timedelta
from typing import cast
from urllib.parse import quote_plus, urlencode
import aiohttp
import jwt
from . import tz_util
from .const import AUTH_API_REVOKE_URL, AUTH_API_TOKEN_URL, AUTH_HEADERS
from .exceptio... | Thomas55555/aioautomower | src/aioautomower/utils.py | .py | 777accc9de1bc8b8 | 7.52 | 10 |
"""Tests for asynchronous Python client for aioautomower.
Run tests with `uv run pytest`
and to update snapshots `uv run pytest --snapshot-update`
"""
import json
import zoneinfo
from pathlib import Path
from typing import Any
from aiointercept import aiointercept
from aioautomower.const import API_BASE_URL
from ai... | Thomas55555/aioautomower | tests/__init__.py | .py | 84a5d0003db7f5f7 | 8.02 | 10 |
"""Test helpers for Husqvarna Automower."""
import zoneinfo
from collections.abc import AsyncGenerator, Callable, Generator
from types import TracebackType
from typing import Self
from unittest.mock import AsyncMock, patch
import aiohttp
import pytest
import pytest_asyncio
from aiointercept import aiointercept
from s... | Thomas55555/aioautomower | tests/conftest.py | .py | 60e00920304bee5d | 8.02 | 10 |
"""Config for syrupy."""
from __future__ import annotations
from dataclasses import asdict, is_dataclass
from typing import TYPE_CHECKING, Any
from syrupy.extensions import AmberSnapshotExtension
from syrupy.extensions.amber import AmberDataSerializer
if TYPE_CHECKING:
from syrupy.types import (
Propert... | Thomas55555/aioautomower | tests/syrupy.py | .py | 7f7e9e1024262ec2 | 8.02 | 10 |
"""Tests for aioautomower utils."""
import unittest
from unittest.mock import AsyncMock, MagicMock, patch
import aiohttp
import pytest
from aiointercept import aiointercept
from aioautomower.exceptions import (
ApiError,
)
from aioautomower.utils import (
async_get_access_token,
async_invalidate_access_t... | Thomas55555/aioautomower | tests/test_utils.py | .py | a497ec0a14622c70 | 8.02 | 10 |
"""Tests for the WorkAreaType enum."""
import warnings
import pytest
from aioautomower.model import WorkArea, WorkAreaType
def test_work_area_type_values() -> None:
"""Verify the public string values map to the Husqvarna API payload."""
assert WorkAreaType.RANDOM.value == "random"
assert WorkAreaType.S... | Thomas55555/aioautomower | tests/test_work_area_type.py | .py | d030a06244b3d639 | 8.02 | 10 |
import io
import pathlib
from zipfile import ZipFile
import pytest
from transx2gtfs.data import get_path
DATA_DIR = pathlib.Path(__file__).parent / "data"
UNPACKED_DIR = DATA_DIR / "unpacked"
TXC24_ZIP = DATA_DIR / "txc24" / "fixtures.zip"
def txc24_fixture(name):
"""A TransXChange 2.4/2.5 fixture from fixture... | HTenkanen/transx2gtfs | tests/conftest.py | .py | ac75fe986025a524 | 7.06 | 12 |
"""Regenerate the golden GTFS tables of every fixture (run after a deliberate
output change): python tests/regenerate_goldens.py"""
import os
import pathlib
import sys
from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo
TESTS_DIR = pathlib.Path(__file__).resolve().parent
sys.path.insert(0, str(TESTS_DIR))
sys.path.ins... | HTenkanen/transx2gtfs | tests/regenerate_goldens.py | .py | 876054768c3c49cc | 8.06 | 12 |
"""The GTFS tables produced for the fixtures must not change.
The TfL goldens were generated with the DOM-based implementation of 0.5.0 (and
regenerated deliberately when bank-holiday operation days and wait times were
implemented); the TXC 2.4/2.5 goldens were generated by this implementation and
reviewed by hand. Th... | HTenkanen/transx2gtfs | tests/test_golden.py | .py | eef9112a85b0fa3d | 8.06 | 12 |
"""Tests for the selection of current file versions (transx2gtfs.superseded)."""
from transx2gtfs.superseded import select_current_files
from transx2gtfs.txc import ServiceHeader, TxcHeader
def header(
name,
revision="1",
modified="2026-01-01T00:00:00",
services=(("S1", "2026-01-01", "2026-06-30"),),... | HTenkanen/transx2gtfs | tests/test_superseded.py | .py | c1902608842e3125 | 8.06 | 12 |
import pandas as pd
# Where the registered services of every operator are published; used when an
# operator has no URL of its own in the table (agency_url must be a URL)
DEFAULT_AGENCY_URL = "https://data.bus-data.dft.gov.uk/"
def get_agency_url(operator_code):
"""URL of an operator: its own for the known ones,... | HTenkanen/transx2gtfs | transx2gtfs/agency.py | .py | 6c0f2678247c37fb | 7.56 | 12 |
"""
UK bank holidays as TransXChange names.
The table for a division ("england-and-wales" or "scotland") maps every
TransXChange bank-holiday element name to the dates it denotes within a period,
except OtherPublicHoliday, whose dates are given in the operating profile itself.
Fixed-date holidays are generated for eac... | HTenkanen/transx2gtfs | transx2gtfs/bank_holidays.py | .py | b44eb96cb7ec6c0f | 7.56 | 12 |
import pandas as pd
WEEKDAYS = [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday",
]
_WEEKDAY_NUMBERS = {day: i for i, day in enumerate(WEEKDAYS)}
_RANGES = {
"mondaytofriday": [0, 1, 2, 3, 4],
"mondaytosaturday": [0, 1, 2, 3, 4, 5],
"mondaytosunday":... | HTenkanen/transx2gtfs | transx2gtfs/calendar.py | .py | 60f4bee2f2655db1 | 7.56 | 12 |
import pandas as pd
from transx2gtfs.calendar import join_names
def get_calendar_dates_exceptions(operating_profile):
"""Bank holiday non-operation days ('AllBankHolidays', 'ChristmasDay|BoxingDay',
...) of an OperatingProfile, or None if it has no DaysOfNonOperation"""
if operating_profile is None:
... | HTenkanen/transx2gtfs | transx2gtfs/calendar_dates.py | .py | db607f3ac6d00402 | 7.56 | 12 |
import math
from multiprocessing import cpu_count
class Parallel:
def __init__(self, input_files, file_size_limit, gtfs_db):
self.input_files = input_files
self.file_size_limit = file_size_limit
self.gtfs_db = gtfs_db
def create_workers(input_files, worker_cnt=None, gtfs_db=None, file_si... | HTenkanen/transx2gtfs | transx2gtfs/distribute.py | .py | fcd0d32e36c2f7b5 | 7.56 | 12 |
"""
Logging of the conversion: the ``transx2gtfs`` logger, a console handler used
when nobody configured logging, an optional log file, and a mirror that also
writes the data warnings (``warnings.warn``) into the log.
"""
import logging
import sys
import warnings
LOGGER_NAME = "transx2gtfs"
log = logging.getLogger(LO... | HTenkanen/transx2gtfs | transx2gtfs/logs.py | .py | d05ff6c0349cefd4 | 7.56 | 12 |
import warnings
import pandas as pd
def get_mode(mode):
"""Parse mode from TransXChange value; a missing mode is treated as bus"""
if mode is None or mode == "":
warnings.warn("Service has no Mode, assuming bus.", UserWarning, stacklevel=2)
return 3
key = mode.strip().lower()
if key i... | HTenkanen/transx2gtfs | transx2gtfs/routes.py | .py | f9ffa5501523e71e | 7.56 | 12 |
import logging
import hashlib
import warnings
import pandas as pd
log = logging.getLogger("transx2gtfs")
DIRECTIONS = {
"inbound": 0,
"outbound": 1,
"inboundAndOutbound": 0,
"circular": 0,
"clockwise": 0,
"antiClockwise": 0,
}
def get_direction(direction_id):
"""Return boolean direction... | HTenkanen/transx2gtfs | transx2gtfs/stop_times.py | .py | 2fd2b8ee2370b412 | 7.56 | 12 |
import logging
import http.client
import os
import sys
import tempfile
import time
import urllib.request
import warnings
from datetime import datetime
from urllib.error import URLError
import pandas as pd
from pyproj import Transformer
log = logging.getLogger("transx2gtfs")
NAPTAN_URL = "https://naptan.api.dft.gov.u... | HTenkanen/transx2gtfs | transx2gtfs/stops.py | .py | 7f42d1a28b6c8594 | 7.56 | 12 |
"""
Selection of the current version of every service among a set of TransXChange
files.
Change archives (the Bus Open Data Service bulk download, TNDS) hold several
revisions of one service. For each ServiceCode, a file version is superseded
when another version whose operating period overlaps outranks it: a higher
R... | HTenkanen/transx2gtfs | transx2gtfs/superseded.py | .py | b4a0039e6bbe1332 | 7.56 | 12 |
def get_trip_headsign(doc, service_ref):
"""Parse trip headsign (service description) based on service reference id"""
for service in doc.services:
if service.code == service_ref:
return service.description
raise ValueError("Could not find trip headsign for %s" % service_ref)
def get_t... | HTenkanen/transx2gtfs | transx2gtfs/trips.py | .py | d9dab25278c32e79 | 7.56 | 12 |
"""Async-capable Typer wrapper used by the Fumis CLI.
Adaptation of the snippet/code from:
- https://github.com/tiangolo/typer/issues/88#issuecomment-1613013597
- https://github.com/argilla-io/argilla/blob/e77ca86c629a492019f230ac55ebde207b280xc9c/src/argilla/cli/typer_ext.py
"""
# Copyright 2021-present, the Recogn... | frenck/python-fumis | src/fumis/cli/async_typer.py | .py | 2dde5eb6e5bc0236 | 7.52 | 10 |
"""Live TUI dashboard for the Fumis WiRCU."""
# pylint: disable=import-error,too-few-public-methods
from __future__ import annotations
import asyncio
from collections import deque
from typing import TYPE_CHECKING, ClassVar
from textual import work
from textual.app import App, ComposeResult
from textual.binding impor... | frenck/python-fumis | src/fumis/cli/tui.py | .py | 7ec8a96bc107ad83 | 7.52 | 10 |
"""Constants for the Fumis WiRCU API."""
from __future__ import annotations
from dataclasses import dataclass
from enum import IntEnum, StrEnum
from typing import Any
class StoveStatus(IntEnum):
"""Stove operational status (from controller.status)."""
OFF = 0
"""Stove is off and idle."""
COLD_STAR... | frenck/python-fumis | src/fumis/const.py | .py | 8968a9d841146c99 | 7.52 | 10 |
"""Asynchronous Python client for the Fumis WiRCU API."""
from __future__ import annotations
import logging
import socket
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Self
import aiohttp
import orjson
from yarl import URL
from .exceptions import (
FumisAuthenticationError,
... | frenck/python-fumis | src/fumis/fumis.py | .py | 26204cd6dccc6e16 | 7.52 | 10 |
"""Tests for the Fumis CLI."""
# pylint: disable=redefined-outer-name,protected-access
from __future__ import annotations
import json
from pathlib import Path
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, MagicMock, patch
import click
import pytest
from typer.main import get_command
from type... | frenck/python-fumis | tests/cli/test_cli.py | .py | c72ad3b3c2866c13 | 7.02 | 10 |
"""Common fixtures and helpers for Fumis WiRCU tests."""
from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any
import aiohttp
import pytest
from aioresponses import aioresponses
from aioresponses import core as aioresponses_core
from fumi... | frenck/python-fumis | tests/conftest.py | .py | a7c9dd937954206e | 8.02 | 10 |
from itertools import repeat
from types import MappingProxyType
from typing import Optional, Sequence, cast
import numpy as np
import scipy.sparse as sp
def freeze(x):
"""Freeze a mutable object.
"""
if isinstance(x, (int, float, complex, str, bytes, type(None))):
pass
elif isinstance(x, (lis... | feihoo87/waveforms | waveforms/utils.py | .py | 727f36ba16008f19 | 7.6 | 15 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José Moreno Reyes
"""Common data structures for the accounting engines."""
from __future__ import annotations
from dataclasses import dataclass, field
from decimal import Decimal
from typing import Any, List, Optional, Dict
from datet... | cacao-accounting/cacao-accounting | cacao_accounting/accounting_engine/common/context.py | .py | 15ead6c7996a14d4 | 7.5 | 9 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José Moreno Reyes
"""Rounding management for accounting engines."""
from __future__ import annotations
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_CEILING, ROUND_FLOOR
from typing import Dict, Any, Optional
cl... | cacao-accounting/cacao-accounting | cacao_accounting/accounting_engine/common/rounding.py | .py | d94c2de25fad7844 | 7.5 | 9 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José Moreno Reyes
"""Fiscal Engine implementation."""
from __future__ import annotations
from decimal import Decimal
from heapq import heappop, heappush
from typing import Dict, Optional
from cacao_accounting.accounting_engine.common... | cacao-accounting/cacao-accounting | cacao_accounting/accounting_engine/fiscal/engine.py | .py | a2fae1a51877fef2 | 7.5 | 9 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José Moreno Reyes
"""Tax rule resolver logic."""
from __future__ import annotations
from typing import Optional
from cacao_accounting.accounting_engine.common.context import (
CalculationContext,
TaxRuleContext,
)
class Ru... | cacao-accounting/cacao-accounting | cacao_accounting/accounting_engine/fiscal/resolver.py | .py | 831576841f8641d9 | 7.5 | 9 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José Moreno Reyes
"""Convert accounting-engine proformas into persisted GL entries."""
from __future__ import annotations
from dataclasses import replace
from decimal import Decimal
from typing import Any, cast
from sqlalchemy impor... | cacao-accounting/cacao-accounting | cacao_accounting/accounting_engine/gl_posting_builder.py | .py | 7dbc2d72cace662e | 7.5 | 9 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José Moreno Reyes
"""Landed Cost Engine implementation."""
from __future__ import annotations
from decimal import Decimal
from typing import List, Dict, Any, Optional
from cacao_accounting.accounting_engine.common.context import (
... | cacao-accounting/cacao-accounting | cacao_accounting/accounting_engine/landed_cost/engine.py | .py | 46e602a713ec6a47 | 7.5 | 9 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José Moreno Reyes
"""Snapshot serialization logic."""
from __future__ import annotations
import json
import hashlib
from decimal import Decimal
from datetime import date, datetime
from dataclasses import is_dataclass, asdict
from typi... | cacao-accounting/cacao-accounting | cacao_accounting/accounting_engine/snapshots/serializer.py | .py | 879f992065afaae2 | 7.5 | 9 |
"""Fachada de compatibilidad para el módulo admin."""
from __future__ import annotations
from typing import Any
from cacao_accounting.admin import routes as _routes
from cacao_accounting.admin import services as _services
from cacao_accounting.admin.routes import ( # noqa: F401
admin as admin,
)
_MODULES = (_... | cacao-accounting/cacao-accounting | cacao_accounting/admin/__init__.py | .py | f9d1460f551b3ce5 | 7.5 | 9 |
"""Modulo administrativo."""
from decimal import Decimal
from datetime import date
from flask import Blueprint, abort, flash, redirect, request, url_for
from flask_login import current_user
from sqlalchemy.exc import SQLAlchemyError
from cacao_accounting.auth import helpers, proteger_passwd
from cacao_accountin... | cacao-accounting/cacao-accounting | cacao_accounting/admin/services.py | .py | 5f3c339a50b323a8 | 7.5 | 9 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José Moreno Reyes
"""Servicio administrativo de seguridad de sesión."""
from __future__ import annotations
from flask import request
from sqlalchemy import select
from cacao_accounting.database import CacaoConfig, RecognizedDevice, U... | cacao-accounting/cacao-accounting | cacao_accounting/admin/session_security_service.py | .py | eb4dfd8f688ad83e | 7.5 | 9 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 - 2026 William José MORENO Reyes
"""Logic for importing detail lines from external sources."""
from dataclasses import dataclass
from datetime import date
from decimal import Decimal, InvalidOperation
from typing import Any, cast
from flask import ... | cacao-accounting/cacao-accounting | cacao_accounting/api/line_import.py | .py | b9b8965a8aa39cac | 7.5 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.