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 |
|---|---|---|---|---|---|---|
from pathlib import Path
from typing import TYPE_CHECKING
from ceres.__internal__.utilities.platforms import UNIX
from ceres.data import to_json, validate_json
from ceres.directory import Directory
if TYPE_CHECKING:
from ceres.__internal__.server import CLIServerInfo
from ceres.config import ConfigMeta
clas... | OOI-RCA-APL/ceres | ceres/__internal__/project.py | .py | a7dbafd7e1548e3a | 7 | 0 |
from typing import Self
from pydantic import Field, NonNegativeInt, PositiveInt, model_validator
from ceres.__internal__.entity import (
BaseAddressEntity,
BaseAddressEntityCreate,
BaseAddressEntityField,
BaseAddressEntityFilter,
BaseAddressEntityFilterArgs,
BaseAddressEntityOrder,
BaseAdd... | OOI-RCA-APL/ceres | ceres/__internal__/record.py | .py | 5f0241d7517707b3 | 7 | 0 |
import traceback
from pathlib import Path
from typing import TYPE_CHECKING, Final, override
from ceres.concurrency import concurrently
from ceres.data import DataObject, uuid4
from ceres.tasklet import Tasklet
if TYPE_CHECKING:
from ceres.__internal__.core import NativeServer as Native
from ceres.__internal__... | OOI-RCA-APL/ceres | ceres/__internal__/server.py | .py | 12780ce4eea93fdd | 7 | 0 |
import operator
from collections.abc import Callable, Iterator, MutableMapping, ValuesView
from typing import Any, cast, overload, override
from ceres.__internal__.utilities.undefined import Undefined
@overload
def cached[T: Callable[..., Any]](
function: None = None,
/,
storage: MutableMapping[Any, Any]... | OOI-RCA-APL/ceres | ceres/__internal__/utilities/caching.py | .py | b1d1cc9f2d12e572 | 7 | 0 |
from collections.abc import Callable, Hashable
from functools import partial
from typing import TYPE_CHECKING, Any, Final, overload, override
from ceres.__internal__.utilities.undefined import Undefined
def class_property[C, V](
fget: Callable[[type[C]], V] | classmethod[C, Any, V],
) -> ClassProperty[C, V]:
... | OOI-RCA-APL/ceres | ceres/__internal__/utilities/classes.py | .py | 0ab2f97f63816118 | 7 | 0 |
from collections.abc import Callable
from typing import Any
def get_function_name(function: Callable[..., Any], /) -> str:
"""Return the effective name of ``function``, accounting for Python name-mangling.
For functions whose names start with ``__`` (but do not end with ``__``), reconstruct the
mangled n... | OOI-RCA-APL/ceres | ceres/__internal__/utilities/functions.py | .py | 97eaeae1f4290cf3 | 7 | 0 |
def strify(value: object, /) -> str:
"""Call ``str()`` on ``value``, returning a fallback message if it raises an exception.
Args:
value: The object to convert to a string.
Returns:
The string representation, or a placeholder if ``__str__`` raises.
"""
try:
return str(value... | OOI-RCA-APL/ceres | ceres/__internal__/utilities/text.py | .py | ecf7a31acc7df540 | 7 | 0 |
"""The Ampio integration."""
import logging
from ampio_mqtt import (
AccessTier,
AmpioAuthError,
AmpioClient,
AmpioConnectionError,
AmpioTimeoutError,
AuthFailed,
AvailabilityChanged,
ConnectionDied,
InputKind,
SensorKind,
)
from homeassistant.const import (
CONF_HOST,
... | pszypowicz/ampio-homeassistant | custom_components/ampio/__init__.py | .py | 16066ae19e5a4d68 | 7.24 | 2 |
"""Binary sensor platform for the Ampio integration."""
from typing import override
from ampio_mqtt import AmpioObject, InputKind
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.core import HomeAssistant... | pszypowicz/ampio-homeassistant | custom_components/ampio/binary_sensor.py | .py | 52e51f0f9fd8e33f | 7.24 | 2 |
"""Climate platform for the Ampio integration."""
from typing import Any, override
from ampio_mqtt import ThermostatKind, ThermostatState
from homeassistant.components.climate import (
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.const import ATTR_TEMPERATURE, UnitO... | pszypowicz/ampio-homeassistant | custom_components/ampio/climate.py | .py | 171b5e37e1d8de71 | 7.24 | 2 |
"""Cover platform for the Ampio integration."""
from typing import Any, override
from ampio_mqtt import AmpioObject, OutputKind
from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_POSITION,
CoverDeviceClass,
CoverEntity,
CoverEntityFeature,
)
from homeassistant.core import HomeA... | pszypowicz/ampio-homeassistant | custom_components/ampio/cover.py | .py | 209ad7d508bc1281 | 7.24 | 2 |
"""Base entity for the Ampio integration."""
from collections.abc import Iterator
from typing import override
from ampio_mqtt import (
AmpioClient,
AmpioObject,
AvailabilityChanged,
InputKind,
ObjectRemoved,
ObjectUpdated,
SensorKind,
)
from homeassistant.core import callback
from homeass... | pszypowicz/ampio-homeassistant | custom_components/ampio/entity.py | .py | 8b16b6e615c82c1e | 7.24 | 2 |
"""Light platform for the Ampio integration."""
from typing import Any, override
from ampio_mqtt import AmpioObject, OutputKind
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_RGBW_COLOR,
ColorMode,
LightEntity,
)
from homeassistant.core import HomeAssistant
from homeassistant.help... | pszypowicz/ampio-homeassistant | custom_components/ampio/light.py | .py | cbc367477b5b0700 | 7.24 | 2 |
"""Scene platform for the Ampio integration."""
from typing import Any
from ampio_mqtt import AmpioConnectionError, AmpioScene
from homeassistant.components.scene import Scene
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.device_registry... | pszypowicz/ampio-homeassistant | custom_components/ampio/scene.py | .py | 6e2f277d3b988672 | 7.24 | 2 |
"""Sensor platform for the Ampio integration."""
from typing import override
from ampio_mqtt import AmpioObject, SensorKind
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import (
LIGHT_LUX,
... | pszypowicz/ampio-homeassistant | custom_components/ampio/sensor.py | .py | 46e2a0b47e6e4aa2 | 7.24 | 2 |
"""Switch platform for the Ampio integration."""
from typing import Any, override
from ampio_mqtt import AmpioObject, InputKind, OutputKind
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ServiceValidationEr... | pszypowicz/ampio-homeassistant | custom_components/ampio/switch.py | .py | cd9b8bfe5719ca32 | 7.24 | 2 |
"""Fixtures for the Ampio integration tests.
The library client is mocked at the integration boundary and seeded with
real ``ampio_mqtt`` model instances, so tests drive the integration through
the same public surface the library exposes: the state properties and the
``subscribe`` event stream (dispatched via :func:`e... | pszypowicz/ampio-homeassistant | tests/conftest.py | .py | a02a80302dece3eb | 7.74 | 2 |
"""Tests for the Ampio binary sensor platform."""
from collections.abc import Generator
from dataclasses import replace
from unittest.mock import MagicMock, patch
from ampio_mqtt import INPUT_KIND_KEYS, InputKind, ObjectRemoved, ObjectUpdated
import pytest
from pytest_homeassistant_custom_component.common import (
... | pszypowicz/ampio-homeassistant | tests/test_binary_sensor.py | .py | 15ae485dd149c6fe | 7.74 | 2 |
"""Tests for the Ampio scene platform."""
from collections.abc import Generator
from unittest.mock import MagicMock, patch
from ampio_mqtt import AmpioTimeoutError
import pytest
from pytest_homeassistant_custom_component.common import (
MockConfigEntry,
snapshot_platform,
)
from syrupy.assertion import Snapsh... | pszypowicz/ampio-homeassistant | tests/test_scene.py | .py | 6a19a9a5a4a2336a | 7.74 | 2 |
"""Tests for the node_funcs utility module.
(C) 2025 Stephen Jenkins
"""
from utils.node_funcs import get_valid_node_address, get_valid_node_name
class TestGetValidNodeAddress:
"""Tests for get_valid_node_address function."""
def test_simple_name_lowercase(self):
"""Test that simple name is convert... | UniversalDevicesInc-PG3/udi-hunterdouglas-pg3 | test/test_node_funcs.py | .py | 896047e9b3aa71ef | 7.65 | 1 |
"""Tests for the time utility module.
(C) 2025 Stephen Jenkins
"""
import pytest
from datetime import datetime, timezone, timedelta
from utils.time import get_iso_utc_now, convert_to_iso_utc_z, check_timedelta_iso
class TestGetIsoUtcNow:
"""Tests for get_iso_utc_now function."""
def test_returns_string(se... | UniversalDevicesInc-PG3/udi-hunterdouglas-pg3 | test/test_time_utils.py | .py | fe3c744b6c4a0d66 | 7.65 | 1 |
"""Helpers for searching and ordering gateway event queues."""
GATEWAY_EVENT_WAIT_TIMEOUT = 60.0
def find_event_by_field(events, field, value):
"""Return the first event whose field matches value."""
for event in events:
if event.get(field) == value:
return event
return None
def fin... | UniversalDevicesInc-PG3/udi-hunterdouglas-pg3 | utils/gateway_events.py | .py | ae54fdae855845f9 | 7.15 | 1 |
# utils/time.py
from datetime import datetime, timezone, timedelta
def get_iso_utc_now():
"""Returns current UTC time in ISO 8601 format with 'Z' suffix and millisecond precision."""
return (
datetime.now(timezone.utc)
.isoformat(timespec="milliseconds")
.replace("+00:00", "Z")
)
... | UniversalDevicesInc-PG3/udi-hunterdouglas-pg3 | utils/time.py | .py | 73b82b1787602120 | 7.15 | 1 |
from __future__ import annotations
from typing import Any
NGINX_AUTH_REQUIRE_TOOLS = "tools"
NGINX_AUTH_REQUIRE_OVERSEERR = "overseerr"
NGINX_AUTH_REQUIRE_VALUES = {
NGINX_AUTH_REQUIRE_TOOLS,
NGINX_AUTH_REQUIRE_OVERSEERR,
}
def user_can_use_tools(user: Any | None) -> bool:
"""Return True when the user ... | schleising/website3 | website/account/nginx_auth.py | .py | e69c8f2fc7db11a6 | 7 | 0 |
from datetime import datetime
from typing import TypeVar
import logging
from motor.motor_asyncio import (
AsyncIOMotorClient,
AsyncIOMotorDatabase,
AsyncIOMotorCollection,
)
from pydantic import BaseModel
from pymongo import ASCENDING
from bson.codec_options import CodecOptions
T = TypeVar("T", bound=Base... | schleising/website3 | website/database/database.py | .py | c58b3e760b95de0c | 7 | 0 |
from __future__ import annotations
import re
from html import unescape
from typing import Any
from urllib.parse import unquote, urljoin, urlparse
IMG_TAG_RE = re.compile(r"<img\b[^>]*>", re.IGNORECASE)
SRC_ATTR_RE = re.compile(
r"\bsrc\s*=\s*(?:\"([^\"]*)\"|'([^']*)'|([^\s\"'=<>`]+))",
re.IGNORECASE,
)
def ... | schleising/website3 | website/feeds/feed_summary_images.py | .py | 40468a1472260a7d | 7 | 0 |
from __future__ import annotations
from functools import lru_cache
import hashlib
import ipaddress
import socket
from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
import xml.etree.ElementTree as ET
from defusedxml import ElementTree as DefusedElementTree
from defusedxml.common import DefusedXmlExcep... | schleising/website3 | website/feeds/feed_utils.py | .py | 7b2121c3434f7c6a | 7 | 0 |
from pathlib import Path
import sys
from types import SimpleNamespace
from unittest.mock import MagicMock, Mock, patch
import pytest
from selenium.common.exceptions import NoAlertPresentException, NoSuchElementException, StaleElementReferenceException, TimeoutException
sys.path.insert(0, str(Path(__file__).resolve().... | workingyifei/container_crawler | tests/test_wisegrid.py | .py | 550b0653118f6fae | 7.5 | 0 |
"""
This module defines the VirtualGeneric class for the udi-Virtual-pg3 NodeServer.
This node represents a virtual generic switch or dimmer, providing a flexible
device for scenes, programs, and status indication.
(C) 2025 Stephen Jenkins
"""
# std libraries
# none
# external libraries
from udi_interface import No... | UniversalDevicesInc-PG3/Virtual | nodes/VirtualGeneric.py | .py | 7a3c24a7ed3608dd | 7.15 | 1 |
"""
This module defines the VirtualSwitch class for the udi-Virtual-pg3 NodeServer.
This node represents a simple virtual on/off switch, relay, or light.
(C) 2025 Stephen Jenkins
"""
# std libraries
# none
# external libraries
from udi_interface import Node, LOGGER
# personal libraries
from utils.node_funcs import... | UniversalDevicesInc-PG3/Virtual | nodes/VirtualSwitch.py | .py | ad9d11415008f1a5 | 7.15 | 1 |
"""
This module defines the VirtualTemp and VirtualTempC classes for the udi-Virtual-pg3 NodeServer.
These nodes represent virtual temperature sensors, supporting direct value setting,
variable integration, and temperature unit conversions.
(C) 2025 Stephen Jenkins
"""
# std libraries
import time
from typing import ... | UniversalDevicesInc-PG3/Virtual | nodes/VirtualTemp.py | .py | f176e13f0a1d1311 | 7.15 | 1 |
"""
This module defines the VirtualToggle class for the udi-Virtual-pg3 NodeServer.
This node represents a virtual toggling switch that cycles on and off
at configurable intervals.
(C) 2025 Stephen Jenkins
"""
# std libraries
from threading import Timer
# external libraries
from udi_interface import Node, LOGGER
#... | UniversalDevicesInc-PG3/Virtual | nodes/VirtualToggle.py | .py | 660f40a794d58575 | 7.15 | 1 |
"""
This module defines the VirtualoffDelay class for the udi-Virtual-pg3 NodeServer.
This node represents a virtual switch that automatically turns off after a
configurable delay.
(C) 2025 Stephen Jenkins
"""
# std libraries
from threading import Timer
# external libraries
from udi_interface import Node, LOGGER
#... | UniversalDevicesInc-PG3/Virtual | nodes/VirtualoffDelay.py | .py | fc370d42be808276 | 7.15 | 1 |
"""
This module defines the VirtualonDelay class for the udi-Virtual-pg3 NodeServer.
This node represents a virtual switch that automatically turns on after a
configurable delay.
(C) 2025 Stephen Jenkins
"""
# std libraries
from threading import Timer
# external libraries
from udi_interface import Node, LOGGER
# l... | UniversalDevicesInc-PG3/Virtual | nodes/VirtualonDelay.py | .py | 1a4191f49ad57be4 | 7.15 | 1 |
"""
This module defines the VirtualonOnly class for the udi-Virtual-pg3 NodeServer.
This node represents a virtual switch that can only be turned on, acting
as a momentary trigger.
(C) 2025 Stephen Jenkins
"""
# std libraries
# none
# external libraries
from udi_interface import Node, LOGGER
# local imports
from u... | UniversalDevicesInc-PG3/Virtual | nodes/VirtualonOnly.py | .py | 3fe8de29efc172fe | 7.15 | 1 |
"""Pytest configuration shared across the test suite.
Node tests import node classes at module scope, before per-test fixtures run.
If udi_interface fails to initialize in a dev environment (partial import leaving
no ``Node`` export), collection fails before any mocks apply. Install a lightweight
stub when the real pa... | UniversalDevicesInc-PG3/Virtual | test/conftest.py | .py | 71c76344e8836b98 | 7.65 | 1 |
"""
Unit tests for the VirtualSwitch node.
"""
import pytest
from unittest.mock import MagicMock, patch
# To allow imports from the 'nodes' directory, you might need a conftest.py
# or to run pytest from the project root directory.
from nodes.VirtualSwitch import VirtualSwitch, ON, OFF, FIELDS
# This fixture automa... | UniversalDevicesInc-PG3/Virtual | test/test_VirtualSwitch.py | .py | 2b7c92b64f892324 | 7.65 | 1 |
"""
Unit tests for the VirtualTemp node.
"""
import pytest
from unittest.mock import MagicMock, patch
from nodes.VirtualTemp import VirtualTemp, VirtualTempC, FIELDS
# This fixture automatically mocks the udi_interface dependencies for all tests.
@pytest.fixture(autouse=True)
def mock_udi_interface():
"""Automa... | UniversalDevicesInc-PG3/Virtual | test/test_VirtualTemp.py | .py | ce87ab8558610cbb | 7.65 | 1 |
"""
Unit tests for the VirtualoffDelay node.
"""
import pytest
from unittest.mock import MagicMock, patch
from nodes.VirtualoffDelay import VirtualoffDelay, OFF, TIMER, RESET, FIELDS
# This fixture automatically mocks the udi_interface dependencies for all tests.
@pytest.fixture(autouse=True)
def mock_udi_interface... | UniversalDevicesInc-PG3/Virtual | test/test_VirtualoffDelay.py | .py | e3780452e26ae5cb | 7.65 | 1 |
"""
Unit tests for the VirtualonOnly node.
"""
import pytest
from unittest.mock import MagicMock, patch
from nodes.VirtualonOnly import VirtualonOnly, ON, OFF, FIELDS
# This fixture automatically mocks the udi_interface dependencies for all tests.
@pytest.fixture(autouse=True)
def mock_udi_interface():
"""Autom... | UniversalDevicesInc-PG3/Virtual | test/test_VirtualonOnly.py | .py | 36702a5dee13c55e | 7.65 | 1 |
"""Tests for the time utility module.
(C) 2025 Stephen Jenkins
"""
import pytest
from datetime import datetime, timezone, timedelta
from utils.time import get_iso_utc_now, convert_to_iso_utc_z, check_timedelta_iso
class TestGetIsoUtcNow:
"""Tests for get_iso_utc_now function."""
def test_returns_string(se... | UniversalDevicesInc-PG3/Virtual | test/test_time_utils.py | .py | ae9d611564d5aaa2 | 7.65 | 1 |
#!/usr/bin/env python3
"""
These are helper functions for use in a Plugin/NodeServer
for Polyglot v3 written in Python3
utils/node_funcs.py for NodeServer/Plugin for EISY/Polisy
(C) 2025 Stephen Jenkins
"""
# standard imports
import shelve
import xml.etree.ElementTree as ET
from typing import Any, Dict, Iterable, T... | UniversalDevicesInc-PG3/Virtual | utils/node_funcs.py | .py | 5db5e436d1428382 | 7.15 | 1 |
#!/usr/bin/env python3
"""
These are helper functions for use in a Plugin/NodeServer
for Polyglot v3 written in Python3
utils/time.py for NodeServer/Plugin for EISY/Polisy
(C) 2025 Stephen Jenkins
"""
from datetime import datetime, timezone, timedelta
def get_iso_utc_now():
"""Returns current UTC time in ISO... | UniversalDevicesInc-PG3/Virtual | utils/time.py | .py | b2a11a8b42617f85 | 7.15 | 1 |
"""
This library allows you to send emails through the Paubox Transactional Email
API application and get the email disposition of sent emails.
Paubox Mail
"""
import base64
class Mail(object):
"""Paubox API send request formatter."""
def __init__(
self,
from_=None,
subje... | Paubox/paubox-python3 | paubox/helpers/mail.py | .py | 514634d6aa75a97b | 7.3 | 3 |
"""
This library allows you to send emails through the Paubox Transactional Email
API application and get the email disposition of sent emails.
Paubox Client
"""
import json
import os
import requests
from .helpers.errors import handle_error
PAUBOX_API_BASE_URL = "https://api.paubox.com/v1/email"
class Response(objec... | Paubox/paubox-python3 | paubox/paubox.py | .py | 94f1a19ac8b36e47 | 7.3 | 3 |
"""
This library allows you to send emails through the Paubox Transactional Email
API application and get the email disposition of sent emails.
Paubox Test Suite
"""
import unittest
from unittest import TestCase
import base64
from paubox import paubox
from paubox.helpers.mail import Mail
from config import Config
wi... | Paubox/paubox-python3 | tests/test_paubox.py | .py | 28bc048e39c12ec2 | 7.8 | 3 |
"""Provide a CLI for aiortm."""
import asyncio
from collections.abc import Callable, Coroutine
import json
import logging
from pathlib import Path
from typing import Annotated, Any, cast
import webbrowser
import aiohttp
from rich import print as rich_print
import typer
from aiortm.client import Auth
cli = typer.Typ... | MartinHjelmare/aiortm | src/aiortm/cli/__init__.py | .py | a3655e92d6d1de8a | 7.24 | 2 |
"""Provide a client for aiortm."""
from __future__ import annotations
import hashlib
from http import HTTPStatus
import json
import logging
from typing import Any, cast
from aiohttp import ClientError, ClientResponse, ClientResponseError, ClientSession
from yarl import URL
from .exceptions import (
APIAuthError... | MartinHjelmare/aiortm | src/aiortm/client.py | .py | ada5c2c154c1c3a5 | 7.24 | 2 |
"""Provide a model for the RTM API."""
from dataclasses import dataclass, field
from typing import TYPE_CHECKING
from .contacts import Contacts
from .lists import Lists
from .tasks import Tasks
from .timelines import Timelines
if TYPE_CHECKING:
from aiortm.client import Auth
@dataclass
class RTM:
"""Repres... | MartinHjelmare/aiortm | src/aiortm/model/__init__.py | .py | 2084d5a0ba367206 | 7.24 | 2 |
"""Provide a model for contacts."""
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
from mashumaro.mixins.json import DataClassJSONMixin
from .response import BaseResponse, TransactionResponse
if TYPE_CHECKING:
from aiortm.client import Auth
@datacla... | MartinHjelmare/aiortm | src/aiortm/model/contacts.py | .py | 1e39a04aa7497495 | 7.24 | 2 |
"""Provide a model for lists."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any
from mashumaro import field_options
from mashumaro.mixins.json import DataClassJSONMixin
from .response import BaseResponse, TransactionResponse
if TYPE_CHECKING:
f... | MartinHjelmare/aiortm | src/aiortm/model/lists.py | .py | b9bae30a688f1524 | 7.24 | 2 |
"""Provide a model for timelines."""
from dataclasses import dataclass
from typing import TYPE_CHECKING
from .response import BaseResponse
if TYPE_CHECKING:
from aiortm.client import Auth
@dataclass
class TimelineResponse(BaseResponse):
"""Represent a response for a timeline."""
timeline: int
@datac... | MartinHjelmare/aiortm | src/aiortm/model/timelines.py | .py | 6c711afe7a12b140 | 7.24 | 2 |
"""Provide common pytest fixtures."""
from collections.abc import AsyncGenerator, Callable
import logging
from typing import Any
from aiohttp import ClientSession
from aiointercept import aiointercept
import pytest
from yarl import URL
from aiortm.client import REST_URL, AioRTMClient, Auth
from .util import load_fi... | MartinHjelmare/aiortm | tests/conftest.py | .py | deba985a0f6c6bc1 | 7.74 | 2 |
"""CLI for the VLC client."""
import asyncio
from collections.abc import Awaitable, Callable
from typing import Annotated
from rich import print as rich_print
import typer
from .client import Client
from .exceptions import AIOVLCError
from .model.command import Info, Status
app = typer.Typer()
ClientFactory = Call... | MartinHjelmare/aiovlc | src/aiovlc/cli.py | .py | 5bfad5ffd5745cad | 7.3 | 3 |
"""Provide a client for aiovlc."""
from __future__ import annotations
import asyncio
from types import TracebackType
from typing import Literal, Self
from .const import LOGGER
from .exceptions import ConnectError, ConnectReadError
from .model.command import (
Add,
Clear,
Enqueue,
GetLength,
GetLe... | MartinHjelmare/aiovlc | src/aiovlc/client.py | .py | fd172cf673a17766 | 7.3 | 3 |
"""Provide common fixtures."""
from __future__ import annotations
import asyncio
from collections.abc import Generator
from unittest.mock import AsyncMock, patch
import pytest
from aiovlc.client import Client
@pytest.fixture(name="transport")
def transport_fixture() -> Generator[AsyncMock]:
"""Mock the transp... | MartinHjelmare/aiovlc | tests/conftest.py | .py | 5917b2fab5998bb0 | 7.8 | 3 |
from django.contrib.auth import authenticate
from django.contrib.auth import login as auth_login
from django.contrib.auth.backends import BaseBackend
from .models import UserProfile
class SettingsBackend(BaseBackend):
"""Extends authentication backend for authenticating custom user
Methods
-------
a... | UBC-LFS/Canvas-Flexible-Assessment | flexible_assessment/flexible_assessment/auth.py | .py | 26884b248e88f5ab | 7.35 | 4 |
import uuid
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
PermissionsMixin,
)
from django.db import models
class UserProfileManager(BaseUserManager):
"""Extends Base User Manager for creating users and superusers
of type UserProfile
Methods
-------
creat... | UBC-LFS/Canvas-Flexible-Assessment | flexible_assessment/flexible_assessment/models.py | .py | 9a422d808240fe06 | 7.35 | 4 |
import logging
from django.forms import ValidationError
from instructor.canvas_api import FlexCanvas
import flexible_assessment.models as models
logger = logging.getLogger(__name__)
def update_students(request, course):
"""Updates student list in database to match that of the Canvas course."""
students_can... | UBC-LFS/Canvas-Flexible-Assessment | flexible_assessment/flexible_assessment/utils.py | .py | 7c61b4c1eb9dadef | 7.35 | 4 |
"""Command-line entry point: scrape all sources, then publish.
Usage
-----
concertscrape run # scrape -> write docs/calendar.ics
concertscrape run --gcal # also mirror into Google Calendar
concertscrape run -o public # write to a different output dir
"""
from __future__ impo... | ipozdeev/concertscrape | src/concertscrape/cli.py | .py | 03fd7c0b5232a48e | 7 | 0 |
"""Typed settings loaded from the environment (optionally via a .env file).
Replaces the old ``from config import *`` star-import. Import ``settings`` for a
lazily-populated singleton, or call ``load_settings()`` for a fresh read.
"""
from __future__ import annotations
import os
from dataclasses import dataclass
fr... | ipozdeev/concertscrape | src/concertscrape/config.py | .py | 636efae9e35c9f06 | 7 | 0 |
"""Normalized event model shared by every scraper and every publish sink.
This is the single data shape that fixes the old interface mismatch: scrapers
returned two incompatible dict shapes (``start`` as an ISO string vs. as a
``{dateTime, timeZone}`` dict). Now every scraper returns ``list[Event]`` and
every sink (``... | ipozdeev/concertscrape | src/concertscrape/models.py | .py | 10f58ee912ad0a06 | 7 | 0 |
"""Optional Google Calendar mirror.
This is an *optional* sink kept for users who still want events pushed into a
Google Calendar (e.g. running locally on a RaspberryPi with stored OAuth
tokens). It is not needed for the public .ics feed. Requires the ``gcal`` extra
(``uv sync --extra gcal``) and OAuth client secrets.... | ipozdeev/concertscrape | src/concertscrape/publish/gcal_sink.py | .py | 87f554bad01c1177 | 7 | 0 |
"""Build and write the canonical ``calendar.ics`` feed from a list of events.
The feed is a full snapshot of currently-known upcoming livestreams, so it is
regenerated from scratch each run. Stable per-event ``UID``s (see
``Event._make_uid``) keep event identity across regenerations for subscribers.
Times are emitted ... | ipozdeev/concertscrape | src/concertscrape/publish/ics_sink.py | .py | b464377aa6de5418 | 7 | 0 |
"""A tiny registry so contributors add a scraper with one decorator.
Example
-------
from concertscrape.registry import register
from concertscrape.scrapers.base import PageScraper
@register("myvenue")
class MyVenueScraper(PageScraper):
...
The live scrapers are registered by importing them i... | ipozdeev/concertscrape | src/concertscrape/registry.py | .py | 4de8c41486c3df0a | 7 | 0 |
"""Scraper base classes. Every scraper produces ``list[Event]``.
Two families:
* ``PageScraper`` -- HTML venue pages. Subclasses implement
``get_upcoming_livestreams()`` (collect items/links) and
``get_livestream_details(item)`` (parse one item into a *naive* start +
summary + description). The base localizes t... | ipozdeev/concertscrape | src/concertscrape/scrapers/base.py | .py | 9115356dfadc0c5f | 7 | 0 |
"""Template for a new venue scraper.
Copy this file to ``concertscrape/scrapers/<venue>.py``, fill in the two
methods, then register it by adding an import in
``concertscrape/scrapers/__init__.py``:
from . import <venue> # noqa: F401
See ``stmary.py`` and ``pcms.py`` for real, working examples.
"""
from __futu... | ipozdeev/concertscrape | src/concertscrape/scrapers/contrib/TEMPLATE.py | .py | 782c9fc32304b803 | 7 | 0 |
"""Philadelphia Chamber Music Society -- livestream schedule from the website."""
from __future__ import annotations
import dateutil.parser
import pytz
from ..registry import register
from .base import PageScraper
SCHEDULE_URL = "https://www.pcmsconcerts.org/concerts/livestreams/"
@register("pcms")
class PCMSScra... | ipozdeev/concertscrape | src/concertscrape/scrapers/pcms.py | .py | facfbc8dff7b7570 | 7 | 0 |
"""St. Mary's Perivale (London) -- livestream schedule from the venue website.
The schedule page (``SCHEDULE_URL``) lists the whole season; each concert links
to a per-event detail page whose URL carries the full date
(``events-YYYY-MM-DD.shtml``) and whose body carries the start time
(e.g. "... 2 pm ..."). We collect... | ipozdeev/concertscrape | src/concertscrape/scrapers/stmary.py | .py | dadb00611c9b51b5 | 7 | 0 |
"""Low-level YouTube Data API v3 helpers.
Every call here reads *public* data (channels / playlistItems / videos / search
``.list``), so a plain **API key** suffices -- no OAuth, which is what lets the
scraper run headless in CI. Set ``YOUTUBE_API_KEY`` in the environment.
"""
from __future__ import annotations
impo... | ipozdeev/concertscrape | src/concertscrape/youtube.py | .py | a9fc8310597e6fdb | 7 | 0 |
from pathlib import Path
import pytest
from bs4 import BeautifulSoup
FIXTURES = Path(__file__).parent / "fixtures"
@pytest.fixture
def fixture_soup():
"""Return a callable that loads a fixture HTML file as BeautifulSoup."""
def _load(name: str) -> BeautifulSoup:
html = (FIXTURES / name).read_text(e... | ipozdeev/concertscrape | tests/conftest.py | .py | 7bb9eec871b6b069 | 7 | 0 |
"""Offline scraper tests: parsing is exercised against saved HTML fixtures,
with ``get_soup`` monkeypatched so no network is touched.
"""
import datetime as dt
import pytz
from concertscrape.scrapers.pcms import SCHEDULE_URL as PCMS_URL
from concertscrape.scrapers.pcms import PCMSScraper
from concertscrape.scrapers.... | ipozdeev/concertscrape | tests/test_scrapers.py | .py | 3717f440cde750d7 | 7.5 | 0 |
"""Module to handle building docker containers."""
import subprocess
from os.path import split
from pathlib import Path
from subprocess import PIPE
from docker_build.dockerfile import Dockerfile
from docker_build.exceptions import DockerException
from docker_build.models import ExposedPortDetails, FileDetails, Respons... | petermcd/docker-build | docker_build/docker.py | .py | 5db970c7029b2203 | 7 | 0 |
"""Module to build dockerfiles."""
from pathlib import Path
from docker_build.models import ExposedPortDetails, FileDetails
class Dockerfile(object):
"""Class to handle building a Dockerfile."""
__slots__ = (
'_base_image',
'_commands',
'_exposed_ports',
'_files',
)
... | petermcd/docker-build | docker_build/dockerfile.py | .py | f367b49c7060f889 | 7 | 0 |
"""Date classes used by the package."""
from dataclasses import dataclass
from pathlib import Path
@dataclass
class ExposedPortDetails(object):
"""Dataclass for the exposed ports."""
port: int
protocol: str
@dataclass
class FileDetails(object):
"""Dataclass for the details of files to copy from a c... | petermcd/docker-build | docker_build/models.py | .py | 4b582c2264b11a42 | 7 | 0 |
"""Entry point for the viewer."""
from datetime import datetime, timedelta
from json import dumps, loads
from typing import Any, Dict, Optional
from flask import Flask, escape, redirect, render_template, request
from monzo.authentication import Authentication
from monzo.endpoints.account import Account
from monzo.endp... | petermcd/Monzo-API-Viewer | monzo_viewer/app.py | .py | fdd61642652c04d1 | 7 | 0 |
import asyncio
import logging
from hat import aio
from hat import json
from hat.drivers import chatter
from hat.drivers import tcp
from hat.gateway.adminer import common
mlog: logging.Logger = logging.getLogger(__name__)
"""Module logger"""
class AdminerError(Exception):
"""Errors reported by Gateway Adminer ... | hat-open/hat-gateway | src_py/hat/gateway/adminer/client.py | .py | 35b1ee77787978a8 | 7.3 | 3 |
import logging
import typing
from hat import aio
from hat import json
from hat.drivers import chatter
from hat.drivers import tcp
from hat.gateway.adminer import common
mlog: logging.Logger = logging.getLogger(__name__)
"""Module logger"""
GetLogConfCb: typing.TypeAlias = aio.AsyncCallable[[None], json.Data]
"""Ge... | hat-open/hat-gateway | src_py/hat/gateway/adminer/server.py | .py | caeda225d8beee20 | 7.3 | 3 |
"""Gateway main"""
from pathlib import Path
import argparse
import asyncio
import contextlib
import logging.config
import sys
import appdirs
from hat import aio
from hat import json
from hat.gateway import common
from hat.gateway.runner import MainRunner
mlog: logging.Logger = logging.getLogger('hat.gateway.main'... | hat-open/hat-gateway | src_py/hat/gateway/main.py | .py | 925d6588c07572c8 | 7.3 | 3 |
"""Modbus TCP client for KEBA KeContact wallboxes."""
from collections.abc import Sequence
from enum import IntEnum
from typing import Literal, Protocol, cast
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
from pymodbus import pymodbus_apply_logging_config
from pymodbus.clie... | senfomat/PythonKebaClient | src/python_keba_client/keba_modbus_client.py | .py | 81149c7f846b2d1e | 7 | 0 |
"""Shared pytest fixtures for the python_keba_client test suite."""
from types import SimpleNamespace
import pytest
from pymodbus.client.mixin import ModbusClientMixin
from python_keba_client.keba_modbus_client import KebaModbusClient
SLAVE_ID = 255
# Default register values, matching a real KEBA KeContact P30 c-... | senfomat/PythonKebaClient | tests/conftest.py | .py | 72f618904c538e13 | 7.5 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Fraction utilities for symbolic fraction operations.
Provides helper functions for detecting, extracting, and normalizing
fractions in the notation graph.
"""
from notation import Symbol, Notation
from value import FracValue, IntegerValue, Value, division
# All frac... | semyonc/toymath | engine/frac_utils.py | .py | a033d64af471d421 | 7.15 | 1 |
# -*- coding: utf-8 -*-
"""Configured OpenRouter models for notebook-local model selection."""
import os
import re
from collections import namedtuple
import yaml
try:
from dotenv import load_dotenv
load_dotenv()
except ImportError: # pragma: no cover - dotenv ships with the kernel env
pass
MODEL_VAR =... | semyonc/toymath | engine/model_config.py | .py | b708d346ec3688ff | 7.15 | 1 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""observability.py - optional Langfuse tracing for the do! agent endpoint.
Off by default. Set TOYMATH_OBSERVABILITY=on (with LANGFUSE_PUBLIC_KEY /
LANGFUSE_SECRET_KEY / LANGFUSE_BASE_URL in the environment or .env) to send
one trace per do! run to Langfuse: the agent tu... | semyonc/toymath | engine/observability.py | .py | 5daf63d74709f212 | 7.15 | 1 |
# -*- coding: utf-8 -*-
"""
prompt_commands.py - discoverable, user-defined `do!`-style commands.
A prompt-command is a Markdown file (in the repo `commands/` directory) with
a SKILL-compatible YAML frontmatter and a body that is an instruction
template containing the `$ARGUMENTS` placeholder. Dropping
---
na... | semyonc/toymath | engine/prompt_commands.py | .py | 4cbc55c344e1ef7f | 7.15 | 1 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Progressively disclosed Markdown skills for the tactic registry."""
from dataclasses import dataclass
import glob
import os
import yaml
import tactic_registry
SKILL_ROOT = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'.claude', ... | semyonc/toymath | engine/tactic_skills.py | .py | 18ccccd35cecf321 | 7.15 | 1 |
"""Core utility functions for EMG/force signal processing and analysis.
Provides Butterworth filters, EMG preprocessing, feature extraction
(time and frequency domain), stiffness estimation, regression metrics,
and ML classification helpers.
"""
from typing import Tuple
import numpy as np
import pandas as pd
from sc... | batuhantoker/finger-impedance-analysis | finger_impedance/core/functions.py | .py | d0b70ead581d366e | 7 | 0 |
"""Frequency-response and parametric transfer-function estimation."""
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from scipy.optimize import minimize
class tfest:
"""Estimate a SISO transfer function from synchronized one-dimensional signals."""
def __init__(self, u, y):
... | batuhantoker/finger-impedance-analysis | finger_impedance/core/tfestimate.py | .py | 1db247374066d1f9 | 7 | 0 |
"""Interactive matplotlib visualization for 8x8 HD-sEMG grid data.
Displays extensor/flexor activation maps with slider-based time navigation,
contraction percentages, local maxima detection, and image feature extraction
(HoG, Harris corners, Canny edges, MeanShift clustering).
"""
import argparse
from pathlib import... | batuhantoker/finger-impedance-analysis | finger_impedance/visualization/interactive_plot.py | .py | 35bcb7956e055bbb | 7 | 0 |
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 Ilia Sotnikov
"""
Alarm control panel component.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import logging
from homeassistant.core import HomeAssistant, callback
from homeassistant.components.alarm_control_panel import (
AlarmControlP... | hostcc/hass-gs-alarm | custom_components/gs_alarm/alarm_control_panel.py | .py | d128484a32c13c84 | 7.39 | 5 |
# SPDX-License-Identifier: MIT
# Copyright (c) 2024 Ilia Sotnikov
"""
Config flow for `gs_alarm` integrarion.
"""
from __future__ import annotations
import logging
from typing import Any, Self, Dict
import voluptuous as vol
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowRe... | hostcc/hass-gs-alarm | custom_components/gs_alarm/config_flow.py | .py | 55d0da8a1b22fe6b | 7.39 | 5 |
# SPDX-License-Identifier: MIT
# Copyright (c) 2025 Ilia Sotnikov
"""
Data update coordinator for the `gs-alarm` integration.
"""
from __future__ import annotations
from typing import List, TYPE_CHECKING, Optional
import logging
from dataclasses import dataclass
from datetime import datetime
from pyg90alarm import (
... | hostcc/hass-gs-alarm | custom_components/gs_alarm/coordinator.py | .py | 8498f1e21d80ee88 | 7.39 | 5 |
# SPDX-License-Identifier: MIT
# Copyright (c) 2025 Ilia Sotnikov
"""
Select entities for `gs_alarm` integration.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import logging
from homeassistant.core import HomeAssistant
from homeassistant.const import EntityCategory
from homeassistant.helpers... | hostcc/hass-gs-alarm | custom_components/gs_alarm/select.py | .py | 847c77fd907082e2 | 7.39 | 5 |
# SPDX-License-Identifier: MIT
# Copyright (c) 2025 Ilia Sotnikov
"""
Tests for number entities in the custom component.
"""
from __future__ import annotations
from datetime import timedelta
import pytest
from pytest_homeassistant_custom_component.common import (
async_fire_time_changed,
MockConfigEntry,
)
fr... | hostcc/hass-gs-alarm | tests/test_number.py | .py | 07d31395506d1496 | 7.89 | 5 |
import sys
import os
import re
import importlib
import warnings
is_pypy = '__pypy__' in sys.builtin_module_names
warnings.filterwarnings('ignore',
r'.+ distutils\b.+ deprecated',
DeprecationWarning)
def warn_distutils_present():
if 'distutils' not in sys.modules... | Tobechukwu-Njoku/Levenshtein_Ratio | venv/Lib/site-packages/_distutils_hack/__init__.py | .py | 5f7454880e8a04fa | 7.15 | 1 |
# This file is generated by numpy's setup.py
# It contains system_info results at the time of building this package.
__all__ = ["get_info","show"]
import os
import sys
extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
if sys.version_inf... | Tobechukwu-Njoku/Levenshtein_Ratio | venv/Lib/site-packages/numpy/__config__.py | .py | 13a9cbaa1438271d | 7.15 | 1 |
"""
Module defining global singleton classes.
This module raises a RuntimeError if an attempt to reload it is made. In that
way the identities of the classes defined here are fixed and will remain so
even if numpy itself is reloaded. In particular, a function like the following
will still work correctly after numpy is... | Tobechukwu-Njoku/Levenshtein_Ratio | venv/Lib/site-packages/numpy/_globals.py | .py | 5dc5b34f83986fbe | 7.15 | 1 |
"""
Pytest test running.
This module implements the ``test()`` function for NumPy modules. The usual
boiler plate for doing that is to put the following in the module
``__init__.py`` file::
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
Warnings filtering and... | Tobechukwu-Njoku/Levenshtein_Ratio | venv/Lib/site-packages/numpy/_pytesttester.py | .py | 6b6998817f776721 | 7.65 | 1 |
"""
Python 3.X compatibility tools.
While this file was originally intended for Python 2 -> 3 transition,
it is now used to create a compatibility layer between different
minor versions of Python 3.
While the active version of numpy may not support a given version of python, we
allow downstream libraries to continue ... | Tobechukwu-Njoku/Levenshtein_Ratio | venv/Lib/site-packages/numpy/compat/py3k.py | .py | 83ad240929fc0e49 | 7.15 | 1 |
"""
Functions in the ``as*array`` family that promote array-likes into arrays.
`require` fits this category despite its name not matching this pattern.
"""
from .overrides import (
array_function_dispatch,
set_array_function_like_doc,
set_module,
)
from .multiarray import array, asanyarray
__all__ = ["re... | Tobechukwu-Njoku/Levenshtein_Ratio | venv/Lib/site-packages/numpy/core/_asarray.py | .py | bdd4001de0bfdc85 | 7.15 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.