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 |
|---|---|---|---|---|---|---|
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Fixtures for the SAML Integrator charm integration tests."""
import json
from pathlib import Path
import pytest_asyncio
import yaml
from pytest import Config, fixture
from pytest_operator.plugin import OpsTest
@fixture(scope="module", nam... | canonical/saml-integrator-operator | tests/integration/conftest.py | .py | fb90bc4f57371aef | 7.5 | 0 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Fixtures for charm-relation-interfaces tests."""
from typing import Dict
from unittest import mock
import pytest
from charms.saml_integrator.v0.saml import SamlEndpoint, SamlRelationData
from interface_tester.plugin import InterfaceTester
f... | canonical/saml-integrator-operator | tests/interface/conftest.py | .py | d063fc191a56495d | 7.5 | 0 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class Abs(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/abs.py | .py | daec2fca58ff41ee | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class Add(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/add.py | .py | a641b8e8a8da6fcd | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class AND(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/and_.py | .py | 5caf886220892c46 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class CompositeBinaryToNu... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/composite_binary_to_number.py | .py | d9539c031ad8a6e4 | 7.39 | 5 |
from __future__ import annotations
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.NumberProperty import NumberInput, NumberProperty
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class ConstantNumber(Co... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/constant_number.py | .py | 0e30bf3398987186 | 7.39 | 5 |
from __future__ import annotations
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class ConstantOn(Component):
"""
Outputs a constant on signal.
"""
def ... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/constant_on.py | .py | 1296e435a433f201 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class Delta(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/delta.py | .py | f6da07cfe4663fe2 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class Divide(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/divide.py | .py | 99cc0981c6b86297 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class GreaterThan(Compone... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/greater_than.py | .py | 58b5bb78963e4770 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class JKFlipFlop(Componen... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/jk_flip_flop.py | .py | eb86245bc848e4f8 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class LessThan(Component)... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/less_than.py | .py | 4c332585ef315e9f | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class Modulo(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/modulo.py | .py | 2fc7e6d92b55a23f | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class Multiply(Component)... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/multiply.py | .py | 92d3d6e0e731e22e | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class NAND(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/nand.py | .py | 372192e4eb2cef5e | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class NOR(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/nor.py | .py | a175962c30ae9156 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class NOT(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/not_.py | .py | 3adac3fc41cc5b42 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class NumberToCompositeBi... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/number_to_composite_binary.py | .py | 34240947d30da012 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class OR(Component):
... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/or_.py | .py | d47e08131b8542b7 | 7.39 | 5 |
from __future__ import annotations
from typing import Optional
from sw_mc_lib.Component import INNER_TO_XML_RESULT, Component
from sw_mc_lib.Input import Input
from sw_mc_lib.Position import Position
from sw_mc_lib.Types import ComponentType
from sw_mc_lib.XMLParser import XMLParserElement
class PushToToggle(Compon... | stormworks-utils/sw_mc_lib | sw_mc_lib/Components/push_to_toggle.py | .py | 31eb17480ba58842 | 7.39 | 5 |
# vatsim_cog.py
import os
import math
import time
import asyncio
from dataclasses import dataclass
from typing import Optional, Dict, Tuple, List
import aiohttp
import discord
from discord import app_commands
from discord.ext import commands, tasks
from cachetools import TTLCache
import settings
VATSIM_URL = "https:/... | DavideClemente/DouraBot | src/cogs/vatsim.py | .py | c53e60776b5f4f5a | 7.15 | 1 |
from io import BytesIO
import re
from PIL import Image, ImageDraw, ImageFont
import settings
from logic.http import fetch_bytes
from logic.utilities import hex_to_rgba
from database import DatabaseManager
def create_circle(size):
mask = Image.new('L', (size, size), 0)
draw = ImageDraw.Draw(mask)
draw.elli... | DavideClemente/DouraBot | src/logic/images.py | .py | 86732e997e5ba7b0 | 7.15 | 1 |
from dis import disco
import discord
from discord import app_commands
from discord.ext import commands
from datetime import datetime
from py_linq.py_linq import Enumerable
import pycountry
import settings
def bold_msg(msg: str) -> str:
"""
Returns the message wrapped in double asterisks for bold formatting.
... | DavideClemente/DouraBot | src/logic/utilities.py | .py | 15945b24655aaf24 | 7.15 | 1 |
"""Task event handlers ported from FC Server Scripts."""
from __future__ import annotations
import frappe
def before_insert_task(doc, _method=None):
_restrict_non_pm_create(doc)
def on_update_task(doc, _method=None):
_sum_allocated_hours_on_project(doc)
_sync_task_time_distributions(doc)
_push_task_dates_to_t... | opero-con/opero | opero/events/task.py | .py | 99dcfa722105999b | 7 | 0 |
#!/usr/bin/env python3.12
"""Atheris fuzzing harness for Reliabot.
Requires Python 3.11—3.12
"""
import sys
import atheris
# Import Reliabot modules
import os
# Make sure the parent directory is in sys.path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
with atheris.instrument_import... | dupuy/reliabot | fuzz/reliabot_fuzzer.py | .py | 0b7f8da4b4c87e76 | 7.15 | 1 |
#!/usr/bin/env python3
# pylint: disable=invalid-name
"""Tidy numbering and ordering of all Markdown reference links in FILEs.
Number _all_ reference links in the order they appear in the text and place
them at the end of the file. _Remove_ any unused reference link definitions.
If no files are given, read stdin and ... | dupuy/reliabot | tidy-md-refs.py | .py | 77a94a333e20fa3c | 7.15 | 1 |
#!/bin/python
"""
IDE/editor independent tooling for developing and debugging Blender extensions.
https://codeberg.org/emperorofmars/bpydev
Sets up your Blender extension into a local Blender extensions repository and launches Blender with it enabled.
Copy this script next your `blender_manifest.toml` and run.
Idea... | emperorofmars/stf_blender | bpydev.py | .py | 20da59e1b40fbd6d | 7.15 | 1 |
# pyright: strict
import io
import json
from ...stfblender_common import STF_JsonDefinition
from ...stfblender_common.utils import buffer_utils
__all__ = ["STF_File"]
class STF_File:
"""
Holds all data of a binary STF file.
Provides methods to parse and serialize it to and from a io.Buffer*Reader/Writer.
"""
... | emperorofmars/stf_blender | stfblender/io/stf_file.py | .py | 7892e36192a54d37 | 7.15 | 1 |
"""The Growatt server PV inverter sensor integration."""
from __future__ import annotations
import logging
from datetime import timedelta
from homeassistant.const import (
CONF_ADDRESS,
CONF_IP_ADDRESS,
CONF_PORT,
CONF_SCAN_INTERVAL,
CONF_TYPE,
)
from homeassistant.core import HomeAssistant, call... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/__init__.py | .py | b8ae994f285f9311 | 7 | 0 |
"""
Modbus transport layer for Growatt inverters.
Provides the connection/transaction primitives (serial RS232/RTU and
TCP/UDP) shared by the higher-level device abstraction.
"""
import asyncio
import logging
import os
import sys
from datetime import datetime
from pymodbus import FramerType
from pymodbus.client impo... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/api/client.py | .py | beb51b2e13f87407 | 7 | 0 |
"""
High-level Growatt device abstraction.
Wraps a :class:`GrowattModbusBase` transport and maps the protocol register
layout for a given device type to named values.
"""
import logging
from collections.abc import Collection
from datetime import datetime, timedelta
from typing import Any
from .client import GrowattM... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/api/device.py | .py | 4203b7a4a34ede1e | 7 | 0 |
"""The register dataclasses and the device-identity registers.
Everything here is model-agnostic: the shape of a register definition, the
decoded device info, and the handful of registers every Growatt device
exposes for identification.
"""
from collections.abc import Callable
from dataclasses import dataclass
from ... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/api/device_type/models.py | .py | d494a2fb6818d3ab | 7 | 0 |
"""Battery charge/discharge time-of-use slots (Protocol II V1.39, storage).
Split out of ``storage_120`` because the slot encoding is consumed well
outside the register map: the ``tou`` entity helpers, the ``set_time_slot``
service and the EMHASS optimizer all encode or decode slots without caring
about the rest of th... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/api/device_type/time_slots.py | .py | adf0ccd278f61bcf | 7 | 0 |
"""A small fixed-size LRU cache.
A general-purpose container rather than anything Modbus-specific, which is
why it no longer lives in utils.py. Used to memoise the register-sequence
plan for a set of keys (see device.py), where the same key set recurs on
every poll.
"""
from __future__ import annotations
from collec... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/api/lru_cache.py | .py | d8b8ab9e0b3fa4dd | 7 | 0 |
"""Pure logic to compile an EMHASS battery schedule into time-of-use slots.
This module is intentionally free of Home Assistant / pymodbus imports so it can
be unit-tested in the stdlib-only environment (imported as ``growatt_api``).
Priority codes match ``TIME_SLOT_PRIORITIES`` in ``device_type/time_slots``:
``0 = L... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/api/tou_planner.py | .py | c3842e637970fddb | 7 | 0 |
"""
Utility functions.
"""
from __future__ import annotations
import logging
from collections.abc import Iterable
from dataclasses import dataclass, field
from typing import Any
from .device_type.base import (
GrowattDeviceRegisters,
custom_function,
)
__all__ = (
"get_keys_from_register",
"get_all_... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/api/utils.py | .py | 28f2e9753312e409 | 7 | 0 |
"""Button platform for the Growatt Modbus integration.
Exposes device-level actions; currently a "Sync device time" button that writes
the Home Assistant host clock to the inverter (holding registers 45-50).
"""
from __future__ import annotations
import logging
from homeassistant.components.button import ButtonEnti... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/button.py | .py | 94fcc90407b79353 | 7 | 0 |
"""Data update coordinator and runtime data for the Growatt Modbus integration."""
from __future__ import annotations
import logging
from collections.abc import Callable, Collection
from dataclasses import dataclass, field
from datetime import timedelta
from typing import TYPE_CHECKING, Any
from homeassistant.config... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/coordinator.py | .py | 5de1213143a8b0e3 | 7 | 0 |
"""Thin async client for the EMHASS REST API.
EMHASS (Energy Management for Home Assistant, https://github.com/davidusb-geek/emhass)
runs the actual optimisation. This integration only *triggers* an optimisation
and reads the result back from the sensors EMHASS publishes into Home Assistant.
The EMHASS ``/action/<nam... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/emhass_client.py | .py | 813cb56e030de915 | 7 | 0 |
"""Shared entity base and device helpers for the Growatt Modbus integration."""
from __future__ import annotations
from typing import Any
from homeassistant.const import CONF_MODEL, CONF_NAME
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
f... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/entity.py | .py | 6b9140b1290ba09e | 7 | 0 |
"""Entity description types for the Growatt integration.
Each platform's register-backed entities are declared as a table of these
descriptions (see inverter.py / storage.py). They extend the Home Assistant
description with the few extra fields this integration needs; ``key`` is
already required by ``EntityDescription... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/entity_descriptions/descriptions.py | .py | fab03d0ec06c2daf | 7 | 0 |
"""Number platform for the Growatt Modbus integration.
Exposes writable holding registers (SOC limits, charge/discharge rates) as
number entities.
"""
from __future__ import annotations
import logging
from homeassistant.components.number import NumberEntity
from homeassistant.const import (
EntityCategory,
)
fr... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/number.py | .py | 3e8e25d47f36cce2 | 7 | 0 |
"""The EMHASS optimisation plan, as published into Home Assistant.
Pure reading: this module turns the EMHASS sensors into an OptimizationPlan
snapshot. It knows nothing about the inverter and never writes anything.
"""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetim... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/optimizer/plan.py | .py | 84335007c3e90ca2 | 7 | 0 |
"""Options flow: the settings a user can change after setup.
Split out of config_flow.py, which was 798 lines covering three distinct
flows. This one only edits an existing entry - scan intervals, battery and
time-of-use slot counts, and the optional EMHASS optimizer.
"""
from __future__ import annotations
import vo... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/options_flow.py | .py | 218e98f4214e5c4a | 7 | 0 |
"""Select platform for the Growatt Modbus integration.
Exposes writable enumerated holding registers (battery type, UPS output,
generator force) as select entities.
"""
from __future__ import annotations
import logging
from homeassistant.components.select import SelectEntity
from homeassistant.const import (
En... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/select.py | .py | d5c58d4eb32df786 | 7 | 0 |
import logging
import re
from datetime import timedelta
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
CONF_TYPE,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import DeviceInfo
from h... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/sensor.py | .py | 69933d96d1006e03 | 7 | 0 |
"""Switch platform for the Growatt Modbus integration.
Exposes writable holding registers (e.g. AC charge enable) as switches.
"""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.components.switch import SwitchEntity
from homeassistant.const import (
STATE_ON,
Ent... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/switch.py | .py | a3f8c15e5831dba0 | 7 | 0 |
"""Time platform: start/end times for the battery time-of-use slots."""
from __future__ import annotations
from datetime import time as dt_time
from homeassistant.components.time import TimeEntity
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant, callback
from homeassistant... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/time.py | .py | 4a5bcc192da64e24 | 7 | 0 |
"""Shared helpers for the time-of-use slot entities.
A slot's start/end time, priority and enable flag are packed into two holding
registers. The entities below read the current register pair from the
coordinator data and rewrite it (read-modify-write) when a single field
changes.
"""
from __future__ import annotatio... | jacobbjerregaard/homeassistant-growatt-modbus | custom_components/growatt_modbus/tou.py | .py | bb27924f394d4be6 | 7 | 0 |
"""Test bootstrap for the Growatt Modbus integration.
The integration package (``custom_components/growatt_modbus``) imports Home
Assistant at import time, so it cannot be imported directly in a plain unit
test environment. The protocol/decoding logic in ``api`` is however pure
Python (stdlib only) and is the part mo... | jacobbjerregaard/homeassistant-growatt-modbus | tests/conftest.py | .py | 460048e1adf5bce5 | 7.5 | 0 |
"""Fixtures for the Home Assistant integration tests.
These run only when Home Assistant + pytest-homeassistant-custom-component are
installed (Python 3.14). They exercise the real config-entry setup, coordinators
and entity platforms against a faked Modbus transport - only the wire is mocked,
so the register map, dec... | jacobbjerregaard/homeassistant-growatt-modbus | tests/integration/conftest.py | .py | dc67b5b1b1e881e9 | 7.5 | 0 |
"""Integration tests for the battery / BMS detail sensors."""
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import entity_registry as er
from custom_components.growatt_modbus.const import DOMAIN
def _state(hass, entry, key: str) -> str:
registry = er.async_get(hass)
uid ... | jacobbjerregaard/homeassistant-growatt-modbus | tests/integration/test_battery.py | .py | 85c26a00e8f515a0 | 7.5 | 0 |
#!/usr/bin/env python3
"""Push a Pushover notification when something on GitHub needs attention.
Reports what *changed* inside LOOKBACK_HOURS rather than everything currently
open. A digest of all open items re-notifies about the same untouched PR every
day, which is the notification fatigue this job exists to replace... | s0len/solen-ops | kubernetes/apps/default/github-attention/app/scripts/gh-attention.py | .py | 34559dea8ec582d4 | 7.15 | 1 |
#!/usr/bin/env python3
"""subsonic.py — the Subsonic client, and the write path this app does NOT share
with filesync.py.
filesync.py creates playlists PUBLIC by default and always follows up with an
explicit updatePlaylist to set the flag. That was a workaround for not having the
other person's password. This app has... | s0len/solen-ops | kubernetes/apps/media/playlists/app/src/subsonic.py | .py | 06aff581d9fe176c | 7.15 | 1 |
#!/usr/bin/env python3
"""ui.py — every byte of Swedish copy, as stdlib string templates.
Rules baked into this file rather than left to taste:
* One <h1> per page, and it states an OUTCOME ("Hittade 11 av 26 låtar"), never a
label ("Resultat").
* No percentages anywhere. "11 av 26" is a thing he can picture; ... | s0len/solen-ops | kubernetes/apps/media/playlists/app/src/ui.py | .py | 2bd8ba3895622618 | 7.15 | 1 |
#!/usr/bin/env python3
"""matcher.py — shared, source-agnostic track matching for the tunesynctool scripts.
Extracted verbatim from plexsync.py so `plexsync.py` (Spotify -> Plex) and
`filesync.py` (playlist file -> Navidrome) match identically instead of drifting
apart. Nothing here talks to Spotify, Plex or Navidrome... | s0len/solen-ops | kubernetes/apps/media/tunesynctool/app/scripts/matcher.py | .py | 4572cfd47979de0e | 7.15 | 1 |
#!/usr/bin/env python3
"""Audit drift between the live TC server's v3 OPTIONS /<object>/fields and the generated models.
READ-ONLY: this script only issues OPTIONS/GET requests to the configured ThreatConnect server
(creds/host come from the environment — load your .env before running). It mutates nothing, so the
dry-... | ThreatConnect-Inc/tcex-cli | .claude/scripts/audit_v3_model_field_drift.py | .py | 88c737cc497e772e | 7.24 | 2 |
#!/usr/bin/env python3
"""Regenerate the pytest template fixture zip as a GitHub-style archive.
The fixture consumed by ``tests/template/conftest.py::_extract_fixture_to_cache`` must be a
GitHub-style archive: every entry lives under a SINGLE top-level wrapper directory (e.g.
``tcex-app-templates-2/``). conftest compu... | ThreatConnect-Inc/tcex-cli | .claude/scripts/build_template_fixture.py | .py | bb2742a699f4d5fb | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import logging
from pathlib import Path
# first-party
from tcex_cli.__metadata__ import __license__, __version__
from tcex_cli.logger.rotating_file_handler_custom import RotatingFileHandlerCustom
from tcex_cli.logger.trace_logger import TraceLogger
def cli_out_path() -... | ThreatConnect-Inc/tcex-cli | tcex_cli/__init__.py | .py | 8d33ce0aa297a837 | 7.24 | 2 |
"""TcEx Framework Module"""
# first-party
from tcex_cli.app.config.install_json import InstallJson
from tcex_cli.app.config.job_json import JobJson
from tcex_cli.app.config.layout_json import LayoutJson
from tcex_cli.app.config.permutation import Permutation
from tcex_cli.app.config.tcex_json import TcexJson
from tcex... | ThreatConnect-Inc/tcex-cli | tcex_cli/app/app.py | .py | da277f4db2ef6e4e | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import json
import logging
import re
from functools import cached_property
from pathlib import Path
from typing import Any
# first-party
from tcex_cli.app.config.install_json import InstallJson
from tcex_cli.app.config.model.install_json_model import ParamsModel
from tce... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/app_input/app_input_cli.py | .py | 5e5e1cf728a25949 | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import contextlib
import sys
from importlib.metadata import version as get_version
from pathlib import Path
# third-party
import typer
from dotenv import load_dotenv
from semantic_version import Version
# first-party
from tcex_cli.cli.app_input import app_input
from tce... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/cli.py | .py | c5a31227dbb77e9d | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import contextlib
import logging
import os
import sys
from abc import ABC
from functools import cached_property
from pathlib import Path
# third-party
from semantic_version import Version
# first-party
from tcex_cli.app.app import App
from tcex_cli.input.field_type.sens... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/cli_abc.py | .py | d0c1d699ed63f64c | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import os
from pathlib import Path
# first-party
from tcex_cli.cli.cli_abc import CliABC
from tcex_cli.input.field_type.sensitive import Sensitive
from tcex_cli.pleb.proxies import proxies
from tcex_cli.render.render import Render
from tcex_cli.requests_tc import TcSessi... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/deploy/deploy_cli.py | .py | ab421a25ea8a1dfb | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import contextlib
import logging
import os
import shutil
import subprocess # nosec
import sys
from datetime import UTC, datetime
from functools import cached_property
from importlib.metadata import version as get_version
from pathlib import Path
from urllib.parse import ... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/deps/deps_cli.py | .py | bba3d77f7a9cd387 | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import BaseModel, Field
class ValidationItemModel(BaseModel):
"""Model Definition"""
name: str = Field(..., description='The name of the file.')
status: bool = Field(..., description='The status of the file.')
@property
def status_color(se... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/model/validation_data_model.py | .py | 0e50e75747b80f99 | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
from datetime import UTC, datetime
from pathlib import Path
from typing import Optional
# third-party
import typer
# first-party
from tcex_cli.cli.package.package_cli import PackageCli
from tcex_cli.cli.validate.validate_cli import ValidateCli
from tcex_cli.render.rende... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/package/package.py | .py | 3aef86ff9631a24d | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import fnmatch
import json
import os
import shutil
from datetime import UTC, datetime
from pathlib import Path
# first-party
from tcex_cli.app.config.install_json import InstallJson
from tcex_cli.cli.cli_abc import CliABC
from tcex_cli.cli.model.app_metadata_model import... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/package/package_cli.py | .py | c34eb5de9aacdb0b | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import atexit
import difflib
import json
import logging
import os
import re
import secrets
import socket
import string
import sys
from abc import ABC, abstractmethod
from pathlib import Path
from threading import Thread
# third-party
import redis
from fakeredis import Tc... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/launch_abc.py | .py | 27af458b21982802 | 7.24 | 2 |
"""Run App Local"""
# standard library
from pathlib import Path
# first-party
from tcex_cli.cli.run.launch_abc import LaunchABC
from tcex_cli.cli.run.model.app_playbook_model import AppPlaybookInputModel
from tcex_cli.cli.run.playbook_create import PlaybookCreate
from tcex_cli.pleb.cached_property import cached_prope... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/launch_playbook.py | .py | 4e72f03a052e416c | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import datetime
import json
import os
from pathlib import Path
from threading import Thread
# third-party
from rich.console import Console
from rich.layout import Layout
from rich.live import Live
from rich.panel import Panel
from rich.table import Table
# first-party
f... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/launch_service_api.py | .py | 1982d6b94597d0fd | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
from abc import ABC
from pathlib import Path
from threading import Event, Thread
# third-party
import paho.mqtt.client as mqtt
from rich.panel import Panel
from rich.table import Table
# first-party
from tcex_cli.cli.run.launch_abc import LaunchABC
from tcex_cli.message... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/launch_service_common_abc.py | .py | d4b74e61975989e7 | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
import datetime
import json
import random
from abc import ABC
from pathlib import Path
# third-party
from rich.panel import Panel
from rich.table import Table
# first-party
from tcex_cli.app.config.install_json import InstallJson
from tcex_cli.cli.run.launch_service_com... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/launch_service_common_trigger_abc.py | .py | 0f214a421e4975e6 | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
from threading import Thread
# third-party
from rich.console import Console
from rich.layout import Layout
from rich.live import Live
# first-party
from tcex_cli.cli.run.launch_service_common_trigger_abc import LaunchServiceCommonTriggersABC
from tcex_cli.cli.run.model.... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/launch_service_custom_trigger.py | .py | 03cdb6c3aea33a9c | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
from threading import Thread
# third-party
from rich.console import Console
from rich.layout import Layout
from rich.live import Live
from rich.panel import Panel
# first-party
from tcex_cli.cli.run.launch_service_common_trigger_abc import LaunchServiceCommonTriggersABC... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/launch_service_webhook_trigger.py | .py | a33096a2801aef3c | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import BaseSettings, Extra, validator
# first-party
from tcex_cli.app.config.install_json import InstallJson
from tcex_cli.input.field_type.sensitive import Sensitive
class ApiModel(BaseSettings):
"""Model Definition"""
# api model
api_default_org... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/api_model.py | .py | 820efd46b47afbb3 | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import Extra
# first-party
from tcex_cli.cli.run.model.common_app_input_model import CommonAppInputModel
from tcex_cli.cli.run.model.common_model import CommonModel
from tcex_cli.cli.run.model.playbook_common_model import PlaybookCommonModel
from tcex_cli.cli.ru... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/app_api_service_model.py | .py | 19124a3bd07a31e5 | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import Extra
# first-party
from tcex_cli.cli.run.model.common_app_input_model import CommonAppInputModel
from tcex_cli.cli.run.model.common_model import CommonModel
from tcex_cli.cli.run.model.organization_model import OrganizationModel
from tcex_cli.input.field... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/app_organization_model.py | .py | f84807ece20b0579 | 7.24 | 2 |
"""TcEx Framework Module"""
# standard library
from pathlib import PosixPath
from typing import ClassVar
# third-party
from pydantic import Extra
# first-party
from tcex_cli.app.config import InstallJson
from tcex_cli.cli.run.model.common_app_input_model import CommonAppInputModel
from tcex_cli.cli.run.model.common_... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/app_playbook_model.py | .py | d95c0156e2eabb32 | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import Extra
# first-party
from tcex_cli.cli.run.model.common_app_input_model import CommonAppInputModel
from tcex_cli.cli.run.model.common_model import CommonModel
from tcex_cli.cli.run.model.playbook_common_model import PlaybookCommonModel
from tcex_cli.cli.ru... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/app_trigger_service_model.py | .py | 7a0b35c88c078c26 | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import Extra
# first-party
from tcex_cli.cli.run.model.common_app_input_model import CommonAppInputModel
from tcex_cli.cli.run.model.common_model import CommonModel
from tcex_cli.cli.run.model.playbook_common_model import PlaybookCommonModel
from tcex_cli.cli.ru... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/app_webhook_trigger_service_model.py | .py | 2490ba409034cba1 | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import BaseSettings, Extra
class BatchModel(BaseSettings):
"""Model Definition"""
batch_action: str = 'Create'
batch_chunk: int = 25_000
batch_halt_on_error: bool = False
batch_poll_interval: int = 15
batch_poll_interval_max: int = 3_60... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/batch_model.py | .py | b5fc66d1b47abe06 | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import BaseModel, Extra
# first-party
from tcex_cli.cli.run.model.common_model import CommonModel
class InputsModel(CommonModel, extra=Extra.allow):
"""InputsModel"""
class StageModel(BaseModel):
"""Model Definition"""
kvstore: dict[str, str | d... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/common_app_input_model.py | .py | d1eb10a652e87693 | 7.24 | 2 |
"""TcEx Framework Module"""
# first-party
from tcex_cli.cli.run.model.api_model import ApiModel
from tcex_cli.cli.run.model.batch_model import BatchModel
from tcex_cli.cli.run.model.logging_model import LoggingModel
from tcex_cli.cli.run.model.path_model import PathModel
from tcex_cli.cli.run.model.playbook_common_mod... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/common_model.py | .py | 28b1efdb2535df14 | 7.24 | 2 |
"""TcEx Framework Module"""
# third-party
from pydantic import BaseSettings, Extra
class LoggingModel(BaseSettings):
"""Model Definition"""
# logging model
tc_log_backup_count: int = 25
tc_log_file: str = 'app.log'
tc_log_level: str = 'trace'
tc_log_max_bytes: int = 10_485_760
tc_log_to_... | ThreatConnect-Inc/tcex-cli | tcex_cli/cli/run/model/logging_model.py | .py | 13064e42372ab74c | 7.24 | 2 |
#!/usr/bin/env python3
"""
Download additional data from Google My Maps and extract Place IDs.
This script:
1. Downloads the HTML from a Google My Maps viewer URL
2. Extracts and parses the _pageData JavaScript object
3. Finds Google Place IDs for each map item
4. Updates map.json with the extracted place IDs
"""
imp... | infrastructureclub/travel_guide | scripts/download-additional-data.py | .py | c4988cffb94f4151 | 7.24 | 2 |
"""
The default group of operations that pyrelist has
"""
import json
import re
import sys
import pylogconf.core
from pytconf import config_arg_parse_and_launch, get_free_args, register_endpoint, register_main
from pyrelist.configs import ConfigMatch
from pyrelist.static import APP_NAME, DESCRIPTION, VERSION_STR
@r... | veltzer/pyrelist | src/pyrelist/main.py | .py | 0e75f83ec6ac8c8e | 7 | 0 |
""" segments.py """
import os
import os.path
from abc import ABC, abstractmethod
from pypowerline.colors import Color
from pypowerline.symbols import Symbol
class Segment(ABC):
# pylint: disable=too-many-positional-arguments
def __init__(
self,
color: Color | None = None,
... | veltzer/pypowerline | src/pypowerline/segments.py | .py | ce1b7317135634fd | 7 | 0 |
"""
The default group of operations that pygooglecloud has
"""
import configparser
import json
import os
import sys
import google.auth._cloud_sdk
import pylogconf.core
from pytconf import config_arg_parse_and_launch, register_endpoint, register_main
from pygooglecloud.static import APP_NAME, DESCRIPTION, VERSION_STR
... | veltzer/pygooglecloud | src/pygooglecloud/main.py | .py | 4072835126d5c861 | 7 | 0 |
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "httpx",
# "pydantic",
# ]
# ///
from __future__ import annotations
import os
import httpx
from models import PackageStats
def pepy_api_key() -> str:
"""Return PEPY API key from env var PEPY_API_KEY."""
if key := os.environ.get("PEPY_AP... | janbjorge/artifacts-storage | pgqueuer/pepy.py | .py | af8d12a305aff79c | 7 | 0 |
#!/usr/bin/env python
"""Check that an exercise's solution.sh reproduces its committed output.json.
Takes one or more solution.sh paths (rsconstruct's script processor appends the
discovered files to the command line). For each one, the solution is run in a
temporary directory against a copy of the exercise's input.js... | veltzer/demos-lang-jq | scripts/test_solution.py | .py | a174eb79fbccfe9f | 7.5 | 0 |
import requests
import json
from bs4 import BeautifulSoup
import asyncio
import asyncclick as click
import logging
from datetime import datetime, timedelta, timezone
from os import path
from typing import List, Dict
# ロガーの設定
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
lo... | yamamo-i/Hyakkin | daiso.py | .py | ce3b9a96711de498 | 7.15 | 1 |
# ruff: noqa: S101
import pytest
import json
from unittest.mock import MagicMock, patch, mock_open
from bs4 import BeautifulSoup
import daiso
# テスト用データ
HTML_PAGINATION = """
<div class="pagination__nav">
<a href="/collections/newarrival?page=1" data-page="1" class="pagination__nav-item link pagination__text" title... | yamamo-i/Hyakkin | test_daiso.py | .py | 11ba2eacd2cfb7b9 | 7.65 | 1 |
"""Veri deposu: veri setini CSV olarak okur/yazar ve fiyat geçmişini tutar."""
from __future__ import annotations
import csv
import logging
from pathlib import Path
from bookdata.models import Product
logger = logging.getLogger(__name__)
HEADER = [
"Kitap İsmi",
"Yazar",
"Yayınevi",
"Kategori",
... | fzozyurt/BookStoresDatasets | src/bookdata/adapters/storage.py | .py | 213802032dbb2ee5 | 7 | 0 |
"""Mağaza port'u (adapter arayüzü): BKM ve Kitapyurdu bu arayüzü uygular.
Adapter'lar sadece siteye özel olan işleri yapar:
- Kategori listesini çekmek
- Sayfalama dahil sayfa HTML'lerini üretmek
- Sayfa içinden ham ürün verilerini çıkarmak
Veri temizleme (fiyat, URL, kopya) bağımsız bir standardizasyon aşamasında ya... | fzozyurt/BookStoresDatasets | src/bookdata/adapters/stores/base.py | .py | 11063b3d7dee6018 | 7 | 0 |
"""Fiyat analizi: veri setinden fiyat değişimleri, trendler ve özetler üretir."""
from __future__ import annotations
from pathlib import Path
import pandas as pd
REQUIRED = ["Tarih", "URL", "Fiyat", "Kitap İsmi", "Site", "Kategori"]
def load_datasets(data_dir: Path) -> pd.DataFrame:
"""Data dizinindeki tüm *_... | fzozyurt/BookStoresDatasets | src/bookdata/analyze.py | .py | ca3b1ecd7a97c358 | 7 | 0 |
"""Merkezi loglama: yapılandırılmış, tek sefer kurulum, rotasyonlu dosya + console."""
from __future__ import annotations
import logging
import sys
from logging.handlers import RotatingFileHandler
from pathlib import Path
FORMAT = "%(asctime)s | %(levelname)-7s | %(name)s | %(message)s"
_logger_configured = False
... | fzozyurt/BookStoresDatasets | src/bookdata/logging_setup.py | .py | 5ec31fa4f08003e6 | 7 | 0 |
"""Mağazalar arası kitap eşleştirme motoru (LLM'siz, fuzzy matching).
Akış (identifier-first):
1. ISBN varsa ve eşitse → MATCH (deterministic)
2. ISBN yoksa:
a. Yayınevi (Brand) normalize edilip eşleşirse aynı aday havuzu
b. Başlık (Model) fuzzy benzerliği + yazar (fuzzy) onayı
c. ... | fzozyurt/BookStoresDatasets | src/bookdata/matching.py | .py | c31614a7c704a53b | 7 | 0 |
"""Yapılandırılmış veri (JSON-LD) odaklı ürün çıkarma.
İlke: "structured data first, DOM fallback". Sayfa içindeki `application/ld+json`
bloklarındaki `Product`/`Book`/`ItemList` verisi okunur; bu, DOM değişimlerine
karşı daha dayanıklıdır. DOM çıktısı hiçbir zaman atılmaz, `merge_products` ile
zenginleştirilir — böyl... | fzozyurt/BookStoresDatasets | src/bookdata/pipeline/extract.py | .py | 87fe36f5431a25c7 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.