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 datetime import datetime, timezone from flask import current_app from app import db from app.dao.dao_utils import autocommit, version_class from app.models import ( BROADCAST_TYPE, EMAIL_AUTH_TYPE, INVITE_PENDING, VIEW_ACTIVITY, ApiKey, InvitedUser, Organisation, Permission, S...
alphagov/emergency-alerts-api
app/dao/broadcast_service_dao.py
.py
862a0b5137c3d5f5
7.5
9
"""Shared plumbing for the command line tools.""" from __future__ import annotations import argparse import contextlib import json import logging import os import secrets import sys from dataclasses import dataclass from pathlib import Path from scarletcoin.core.params import get_params, network_names from scarletco...
alessio-ds/ScarletCoin
src/scarletcoin/cli_common.py
.py
b50ac7bc783a0e08
7.5
9
"""Coinbase transactions. The coinbase is the first transaction of every block; it has no real inputs and mints the block subsidy plus the fees paid by the other transactions. Its ``coinbase_data`` field starts with the block height as a little-endian uint32. Committing to the height makes every coinbase — and there...
alessio-ds/ScarletCoin
src/scarletcoin/core/coinbase.py
.py
65d09a314660955a
7.5
9
"""Proof of work: compact targets, work accounting and difficulty retargeting.""" from __future__ import annotations __all__ = [ "MAX_TARGET_LIMIT", "bits_from_work", "bits_to_target", "block_work", "check_proof_of_work", "difficulty", "hash_to_int", "next_bits", "target_to_bits", ...
alessio-ds/ScarletCoin
src/scarletcoin/core/pow.py
.py
7d103c756f6980b1
7.5
9
"""A minimal, non-Turing-complete script language for P2SH outputs. A redeem script is a short bytecode program evaluated when the coins it protects are spent. There are no loops, no conditionals and no backwards jumps, so the language cannot loop forever: evaluation is bounded by the length of the script. Supported...
alessio-ds/ScarletCoin
src/scarletcoin/core/script.py
.py
ae70541209e1a38f
7.5
9
"""Deterministic binary serialisation helpers. Every consensus object is encoded with these primitives, which mirror Bitcoin's conventions: little-endian fixed-width integers and compact-size (varint) lengths. Encoding must be canonical, so :class:`Reader` rejects over-long varints, and :class:`Writer` never emits th...
alessio-ds/ScarletCoin
src/scarletcoin/core/serialize.py
.py
b1fd0d5947798263
7.5
9
"""Block templates. A node hands a miner everything needed to build the next block *except* the coinbase: the miner supplies its own payout address and extra nonce, assembles the coinbase locally and computes the Merkle root itself. That way the node never has to know the miner's keys and the miner is free to roll th...
alessio-ds/ScarletCoin
src/scarletcoin/core/template.py
.py
ecbd90b4ca14613d
7.5
9
"""The set of unspent transaction outputs. A :class:`Coin` is one unspent output plus the context needed to validate a spend of it (the height it was created at and whether it came from a coinbase, which is subject to a maturity delay). Two views over the coin set are defined: :class:`CoinView` The read-only int...
alessio-ds/ScarletCoin
src/scarletcoin/core/utxo.py
.py
a784b2e8e824ab25
7.5
9
"""Transaction validation against a set of unspent outputs.""" from __future__ import annotations from scarletcoin.core.params import ChainParams from scarletcoin.core.script import MAX_SCRIPT_SIZE, ScriptError, evaluate_script from scarletcoin.core.transaction import MAX_MONEY, OUTPUT_P2PKH, OUTPUT_P2SH, Transaction...
alessio-ds/ScarletCoin
src/scarletcoin/core/validation.py
.py
806278c721c1342e
7.5
9
"""Base58 and Base58Check encoding. Base58 is the classic Bitcoin alphabet: all alphanumeric characters except ``0``, ``O``, ``I`` and ``l``, which are easy to confuse when typed by hand. """ from __future__ import annotations from scarletcoin.crypto.hashing import hash256 __all__ = [ "ALPHABET", "Base58Err...
alessio-ds/ScarletCoin
src/scarletcoin/crypto/base58.py
.py
be9c2379e6c3754f
7.5
9
"""BIP-0039 mnemonic sentences and their seeds. A mnemonic is a human-friendly encoding of 128-256 bits of entropy: a checksum of ``entropy_length / 32`` bits is appended, the result is cut into 11-bit chunks, and every chunk picks a word from a fixed list of 2048 words. The seed is PBKDF2-HMAC-SHA512 over the senten...
alessio-ds/ScarletCoin
src/scarletcoin/crypto/bip39.py
.py
9590fa67b4909aec
7.5
9
"""Password-based encryption for wallet files. A wallet's secret material is sealed with AES-256-GCM using a key derived from the user's password with scrypt. The resulting envelope is JSON-friendly (all binary fields are hex) so it can be embedded directly in the wallet file. """ from __future__ import annotations ...
alessio-ds/ScarletCoin
src/scarletcoin/crypto/encryption.py
.py
7a660c3e5b625bdb
7.5
9
"""Hash helpers. ScarletCoin uses SHA-256 as its only hash primitive so that every implementation can be reproduced with nothing but the Python standard library: ``hash256`` Double SHA-256, used for block hashes, transaction ids, Merkle trees and the Base58Check checksum. ``hash160`` A 160-bit public-key ...
alessio-ds/ScarletCoin
src/scarletcoin/crypto/hashing.py
.py
d22207b25f470ea0
7.5
9
"""Peer-to-peer link encryption. After the ``version`` handshake, two peers exchange ephemeral secp256k1 public keys and derive a shared ChaCha20-Poly1305 key through ECDH and HKDF. Every message after that is authenticated and encrypted. Peers that do not offer an ephemeral key (protocol version 1) stay in the clea...
alessio-ds/ScarletCoin
src/scarletcoin/net/cipher.py
.py
60ff5622d5930656
7.5
9
"""A small JSON-RPC client for talking to a ScarletCoin node.""" from __future__ import annotations import http.client import itertools import json import ssl import time import urllib.error import urllib.request from typing import Any import certifi from scarletcoin.core.params import get_params __all__ = ["RpcCl...
alessio-ds/ScarletCoin
src/scarletcoin/net/client.py
.py
de7bfdc7b9a9474e
7.5
9
"""The ScarletCoin peer-to-peer wire protocol. Every message is wrapped in the same envelope:: magic 4 bytes network identifier, e.g. b"SCRL" command 12 bytes ASCII command name, zero padded length 4 bytes payload length, little endian checksum 4 bytes first four bytes of hash256(payl...
alessio-ds/ScarletCoin
src/scarletcoin/net/protocol.py
.py
028d8ee44ac12d9d
7.5
9
"""A WebSocket endpoint that pushes chain events to browser clients. The explorer connects to it so it can reload the moment a new block arrives, instead of polling. The hub runs its own event loop on a daemon thread; the node pushes events into it from its own threads through :meth:`WebSocketHub.broadcast`. """ fro...
alessio-ds/ScarletCoin
src/scarletcoin/net/websocket.py
.py
3e9c75dccbb17534
7.5
9
"""Converting between ScarletCoin amounts and human-readable strings. Amounts are always integers internally. One SCT is ``COIN`` (100 000 000) scar, the smallest unit; floating point is never used for money. Byte counts (how big the chain is, how big a block is) are rendered here too, so the command line, the deskt...
alessio-ds/ScarletCoin
src/scarletcoin/units.py
.py
168dce20d16da91e
7.5
9
"""Coin selection and transaction building. This is the only place in the code base that creates spending transactions, so fee estimation, change handling and signing all live together and cannot drift apart. """ from __future__ import annotations from collections.abc import Mapping, Sequence from dataclasses import...
alessio-ds/ScarletCoin
src/scarletcoin/wallet/builder.py
.py
55f8da85312a814a
7.5
9
'''This is a library providing a utility for unittesting events fired on a Harness-ed Charm. Example usage: >>> from charms.harness_extensions.v0.capture_events import capture >>> with capture(RelationEvent) as captured: >>> harness.add_relation('foo', 'remote') >>> assert captured.event.unit.name == 'remote' '''...
canonical/traefik-k8s-operator
lib/charms/harness_extensions/v0/capture_events.py
.py
76c04c1d4353f188
7.62
16
#!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. r"""# Interface Library for traefik_route. This library wraps relation endpoints for traefik_route. The requirer of this relation is the traefik-route-k8s charm, or any charm capable of providing Traefik configuration fil...
canonical/traefik-k8s-operator
lib/charms/traefik_k8s/v0/traefik_route.py
.py
438bbc2ea9a3b988
7.62
16
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Helpers to deploy any-charm / any-charm-k8s as tester charms. Instead of building local tester charms, we deploy any-charm from charmhub and configure it via `src-overwrite` to run the equivalent charm code. The actual charm source lives in...
canonical/traefik-k8s-operator
tests/integration/any_charm_helpers.py
.py
acd2e69cb14f13a0
7.12
16
# Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. import logging from pathlib import Path import jubilant import pytest import yaml from tests.integration.constants import ( ALERTMANAGER_APP_NAME, MANUAL_TLS_APP_NAME, MANUAL_TLS_CHANNEL, SSC_APP_NAME, SSC_CHANNEL, SSC_C...
canonical/traefik-k8s-operator
tests/integration/conftest.py
.py
c8dae503d8e3a0c7
8.12
16
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """DNS resolver adapter for HTTPS requests in integration tests.""" from urllib.parse import urlparse from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE, DEFAULT_RETRIES, HTTPAdapter class DNSResolverHTTPSAdapter(HTTPAdapter):...
canonical/traefik-k8s-operator
tests/integration/dns_adapter.py
.py
57a8827044006112
8.12
16
# Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. import json import logging import os import shutil from datetime import datetime from hashlib import md5 from pathlib import Path from subprocess import CalledProcessError, check_output, getoutput from typing import List, Union import yaml char...
canonical/traefik-k8s-operator
tests/integration/spellbook/cache.py
.py
ba2e47647b9786dd
8.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Integration tests for ingress-per-app (IPA) using jubilant.""" from pathlib import Path from urllib.parse import urlparse import jubilant import yaml from tests.integration.any_charm_helpers import ( ANY_CHARM, ...
canonical/traefik-k8s-operator
tests/integration/test_charm_ipa.py
.py
152576afd3774154
8.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Integration tests for ingress-per-unit (IPU) using jubilant.""" from pathlib import Path from urllib.parse import urlparse import jubilant import yaml from tests.integration.any_charm_helpers import ( ANY_CHARM, ...
canonical/traefik-k8s-operator
tests/integration/test_charm_ipu.py
.py
01515b3dc00f9613
8.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Integration tests for TCP ingress-per-unit using jubilant.""" from pathlib import Path import jubilant import yaml from tests.integration.any_charm_helpers import ( ANY_CHARM_CHANNEL, ANY_CHARM_K8S, PYTHO...
canonical/traefik-k8s-operator
tests/integration/test_charm_ipu_tcp.py
.py
5a343b7ab8ac19a8
8.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Integration test: verify dynamic config files are written to the workload container. Deploys traefik with 2+ apps integrated via ingress, then checks that the expected dynamic config YAML files exist in /opt/traefik/ju...
canonical/traefik-k8s-operator
tests/integration/test_dynamic_configs.py
.py
7bb9c9863074a4fe
8.12
16
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Integration test for the get-loadbalancer-ip action.""" import jubilant def test_get_loadbalancer_ip_action(juju: jubilant.Juju, traefik_app): """The get-loadbalancer-ip action returns a non-empty IP.""" result = juju.run(f"{traefi...
canonical/traefik-k8s-operator
tests/integration/test_get_loadbalancer_ip.py
.py
3d6cdfb70297e9f1
7.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Test TLS certificates on all traefik units.""" import jubilant from conftest import TRAEFIK_APP_NAME, TRAEFIK_RESOURCES from constants import MOCK_HOSTNAME, NUM_TRAEFIK_UNITS from helpers import all_settled, pull_ssc_c...
canonical/traefik-k8s-operator
tests/integration/test_https_multi_unit.py
.py
e3292556d22d8ce9
7.12
16
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Test the charm reports WaitingStatus when the LB Service has no external IP.""" import jubilant from tests.integration.helpers import all_settled # An IP outside the MetalLB pool (10.43.45.0/28) so the LB stays pending. UNREACHABLE_IP = "1...
canonical/traefik-k8s-operator
tests/integration/test_loadbalancer_pending_status.py
.py
91d84bc12c0e4af2
8.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Test TLS routing still works after Traefik gains a certificates relation.""" import json from pathlib import Path import jubilant import yaml from tests.integration.helpers import all_settled, fetch_with_retry TRAEF...
canonical/traefik-k8s-operator
tests/integration/test_pebble_restart_after_cert_relation_joined.py
.py
95fb4244cdadd6f7
8.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Regression test for receive-ca-cert status after relation removal (#670).""" import time from pathlib import Path import jubilant import yaml APP_NAME = "traefik-rca" SSC_NAME = "ssc-rca" METADATA = yaml.safe_load(P...
canonical/traefik-k8s-operator
tests/integration/test_receive_ca_cert_status.py
.py
d3ef2676ec9be052
8.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Test upgrades.""" import jubilant from tests.integration.helpers import all_settled, assert_traefik_revision TRAEFIK_APP_NAME = "traefik" SSC_APP_NAME = "ssc" INGRESS_REQUIRER_APP_NAME = "alertmanager" TRAEFIK_SOURC...
canonical/traefik-k8s-operator
tests/integration/test_upgrade.py
.py
334e708afcf603ea
7.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Upgrade traefik from Charmhub revision 280 to the charm under test. Scenario: 1. Deploy traefik-k8s (3 units) at revision 280 and integrate it with ``manual-tls-certificates`` and ``alertmanager``. 2. Sign every ou...
canonical/traefik-k8s-operator
tests/integration/test_upgrade_mtls_from_280.py
.py
1eb2128dab4183aa
7.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Upgrade traefik from revision 280 to 298 to the charm under test. Scenario: 1. Deploy traefik-k8s (3 units) at revision 280 and integrate it with ``manual-tls-certificates`` and ``alertmanager``. 2. Sign every outs...
canonical/traefik-k8s-operator
tests/integration/test_upgrade_mtls_from_280_via_298.py
.py
2eff50c9bf471709
7.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Upgrade traefik from Charmhub revision 298 to the charm under test. Scenario: 1. Deploy traefik-k8s (3 units) at revision 298 and integrate it with ``manual-tls-certificates`` and ``alertmanager``. 2. Sign every ou...
canonical/traefik-k8s-operator
tests/integration/test_upgrade_mtls_from_298.py
.py
afdc619b0cab9d21
7.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Leadership-change TLS behavior on upgrade from Charmhub revision 298. Scenario: 1. Deploy traefik-k8s (3 units) at revision 298 and integrate it with ``manual-tls-certificates`` and ``alertmanager``; sign the CSRs ...
canonical/traefik-k8s-operator
tests/integration/test_upgrade_mtls_leader_change_from_298.py
.py
76a65acfdee2a6a1
7.12
16
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Upgrade a single-unit traefik deployment from Charmhub revision 280. Scenario: 1. Deploy traefik-k8s (1 unit) at revision 280 and integrate it with ``manual-tls-certificates`` and ``alertmanager``. 2. Sign every ou...
canonical/traefik-k8s-operator
tests/integration/test_upgrade_mtls_single_unit_from_280.py
.py
48c3678b7c3f23d0
7.12
16
import hashlib import json import urllib.parse import urllib.request import uuid from importlib_resources import files def get_device_id() -> str: """ Generates a consistent device identifier as an UUID string. This function retrieves the hardware address as a 48-bit positive integer using `uuid.getnode(...
jacobbunk/famly-fetch
src/famly_fetch/api_client.py
.py
10af73a3ba2e07d3
7.63
17
# pylint: disable = invalid-name , missing-module-docstring # mypy: disable_error_code = empty-body from typing import Optional, Tuple, Any class Metadata: """Interface for a Macrobond metadata collection.""" @property def IsReadonly(self) -> bool: """Gets a value indicating whether this instanc...
macrobond/macrobond-data-api
macrobond_data_api/com/com_types/metadata.py
.py
070aadc4b31d98b6
7.66
20
# pylint: disable = invalid-name , missing-module-docstring # mypy: disable_error_code = empty-body class SearchQuery: """Interface for the Macrobond search query.""" @property def Text(self) -> str: """The free text search property.""" @Text.setter def Text(self, new_text: str) -> None:...
macrobond/macrobond-data-api
macrobond_data_api/com/com_types/search_query.py
.py
128aba9341be7452
7.66
20
# pylint: disable = invalid-name , missing-module-docstring # mypy: disable_error_code = empty-body from typing import List from .entity import Entity class SearchResult: """'Interface for the Macrobond search result.""" @property def Entities(self) -> List[Entity]: """The entities returned fro...
macrobond/macrobond-data-api
macrobond_data_api/com/com_types/search_result.py
.py
db6e3fee96569a73
7.16
20
# pylint: disable = invalid-name , missing-module-docstring # mypy: disable_error_code = empty-body from typing import Optional from datetime import datetime from macrobond_data_api.common.enums import ( SeriesMissingValueMethod, SeriesToLowerFrequencyMethod, SeriesToHigherFrequencyMethod, SeriesParti...
macrobond/macrobond-data-api
macrobond_data_api/com/com_types/series_expression.py
.py
c563e484a4900272
7.66
20
# pylint: disable = invalid-name , missing-module-docstring # mypy: disable_error_code = empty-body from datetime import datetime from typing import List from .series import Series class SeriesWithRevisions: """Interface for a Macrobond series with revisions.""" @property def IsError(self) -> bool: ...
macrobond/macrobond-data-api
macrobond_data_api/com/com_types/series_with_revisions.py
.py
5220c4436a645ec1
7.66
20
""" Base class for the implementations `macrobond_data_api.web.web_client.WebClient` and `macrobond_data_api.com.com_client.ComClient`. """ from abc import ABC, abstractmethod from typing import Any, Generic, TypeVar from .api import Api TypeVarApi = TypeVar("TypeVarApi", bound=Api) __pdoc__ = { "Client.__init_...
macrobond/macrobond-data-api
macrobond_data_api/common/client.py
.py
493cd97a4a6dc241
7.66
20
from dataclasses import dataclass from datetime import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Literal from macrobond_data_api.common.enums import StatusCode if TYPE_CHECKING: # pragma: no cover from pandas import Series from .metadata import Metadata EntityColumnsLiterals = L...
macrobond/macrobond-data-api
macrobond_data_api/common/types/entity.py
.py
621b5ff903eb4e9c
7.66
20
from dataclasses import dataclass from itertools import chain from typing import TYPE_CHECKING, Any, Dict, Sequence, overload, List from macrobond_data_api.common.types.vintage_series import VintageSeries if TYPE_CHECKING: # pragma: no cover from pandas import DataFrame __pdoc__ = { "GetAllVintageSeriesRes...
macrobond/macrobond-data-api
macrobond_data_api/common/types/get_all_vintage_series_result.py
.py
04055c356a68c539
7.66
20
from typing import List, Optional, Tuple, Iterable from dataclasses import dataclass __pdoc__ = { "EntitieErrorInfo.__init__": False, "GetEntitiesError.__init__": False, } @dataclass(init=False) class EntityErrorInfo: """ Represents a failed entity retrieval. """ __slots__ = ("name", "error_...
macrobond/macrobond-data-api
macrobond_data_api/common/types/get_entity_error.py
.py
f1e94e160ee58254
7.66
20
from dataclasses import dataclass from typing import Optional, List, TYPE_CHECKING, Literal, TypedDict __pdoc__ = { "MetadataAttributeInformation.__init__": False, "TypedDictMetadataAttributeInformation.__init__": False, } if TYPE_CHECKING: # pragma: no cover from pandas import DataFrame from ..enum...
macrobond/macrobond-data-api
macrobond_data_api/common/types/metadata_attribute_information.py
.py
79960089fd0dd8f4
7.66
20
# SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 import os from enum import Enum from typing import TYPE_CHECKING from typing import FrozenSet if TYPE_CHECKING: from esp_kconfiglib.core import Kconfig class DefaultsPolicy(Enum): USE_SDKCONFIG = "s...
espressif/esp-idf-kconfig
esp_kconfiglib/constants.py
.py
31192d5a7d73a6a9
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Detect unsupported legacy Kconfig constructs near a parser v2 error. Parser v2 rejects some constructs that parser v1 still accepts. When kconfgen re-parses a failed tree with v1, these matches distinguish an i...
espressif/esp-idf-kconfig
esp_kconfiglib/legacy_constructs.py
.py
cd44919826fbb3b8
7.5
9
# SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ESP-IDF menuconfig — Textual-based configuration interface.""" from __future__ import annotations import os import sys from typing import TYPE_CHECKING from typing import Dict from typing import Optional ...
espressif/esp-idf-kconfig
esp_menuconfig/__init__.py
.py
b8a7a2e751f75b85
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """IDF-specific sdkconfig / minimal-config file header builders.""" from __future__ import annotations import json import os from typing import TYPE_CHECKING from typing import Optional from esp_kconfiglib.consta...
espressif/esp-idf-kconfig
esp_menuconfig/idf_headers.py
.py
d33f629145cb61c9
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Parse an ESP-IDF ``.gitlab/CODEOWNERS`` file and map component paths to codeowner groups. Only ``/components...`` rules are considered for ownership: the part after ``/components`` identifies the component (pos...
espressif/esp-idf-kconfig
kcompare/codeowners.py
.py
e6aef71ad1cfb111
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Compare two ConfigurationSnapshots (older → newer). """ from typing import Dict from typing import List from typing import Set from typing import Tuple from .models import ConfigurationSnapshot from .models im...
espressif/esp-idf-kconfig
kcompare/diff.py
.py
f91fa1778feda58a
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Discover component Kconfig / Kconfig.projbuild / sdkconfig.rename files. Other Kconfig files (Kconfig.in etc.) are not discovered (same as in ESP-IDF CMake discovery). Mirrors ESP-IDF CMake discovery in tools/c...
espressif/esp-idf-kconfig
kcompare/discover.py
.py
7ea71e08e6d884c0
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Git helpers: commit ordering and detached worktrees for ESP-IDF checkouts. """ import os import re import shutil import subprocess from typing import List from typing import Optional from typing import Tuple f...
espressif/esp-idf-kconfig
kcompare/git_ops.py
.py
49c5fc7e318eedc8
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Prepare ESP-IDF checkouts through the ESP-IDF Installation Manager (eim). Replaces the legacy install.sh / export.sh flow: * ``eim install -p <path>`` sets up the toolchain for an existing checkout without o...
espressif/esp-idf-kconfig
kcompare/idf_env.py
.py
98763d92552fbc71
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Internal representation of Kconfig snapshots and comparison results. Designed so reporters can emit human, JSON, or markdown from the same objects. """ from dataclasses import asdict from dataclasses import da...
espressif/esp-idf-kconfig
kcompare/models.py
.py
5855b4c2cdc867c3
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Build a ConfigurationSnapshot from a parsed Kconfig tree. """ import os from contextlib import contextmanager from typing import Dict from typing import Iterator from typing import List from typing import Optio...
espressif/esp-idf-kconfig
kcompare/snapshot.py
.py
9c7ec48b824c42b4
7.5
9
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Split a comparison report into per-codeowner-group reports. Each change (symbol/choice add/remove/rename/default) is attributed to the codeowner groups that own the component it is defined in, resolved from the...
espressif/esp-idf-kconfig
kcompare/split_codeowners.py
.py
b76e31b532b67662
7.5
9
# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 import os import re from typing import Dict from typing import List from typing import Optional from typing import Set from typing import Tuple from esp_pylib.logger import log from rich.markup import escape ...
espressif/esp-idf-kconfig
kconfcheck/check_deprecated_options.py
.py
198967bcb6195c7c
7.5
9
#!/usr/bin/env python # SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 # # Long-running server process uses stdin & stdout to communicate JSON # with a caller # import json import os import sys from json import JSONDecodeError from typing import Dict from typ...
espressif/esp-idf-kconfig
kconfserver/core.py
.py
c748c3389d23eb13
7.5
9
# Copyright 2022 Dynatrace LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing...
dynatrace-oss/dynatrace-aws-s3-log-forwarder
src/log/forwarding/log_forwarding_rule.py
.py
7e38e0772e6f3418
7.45
7
# Copyright 2023 Dynatrace LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing...
dynatrace-oss/dynatrace-aws-s3-log-forwarder
src/utils/aws_appconfig_extension_helpers.py
.py
71b93b758a9f900a
7.45
7
""" Intelligent caching system for gh-folder-download. """ import json import os import shutil import threading import time from datetime import datetime from pathlib import Path from typing import Any from .logger import get_logger class CacheEntry: """Represents a cached file entry with metadata.""" def ...
leynier/gh-folder-download
gh_folder_download/cache.py
.py
1ead164c650bd23e
7.66
20
""" Configuration management for gh-folder-download. """ import os import re import sys from pathlib import Path from typing import Any, Literal import yaml from pydantic import BaseModel, ConfigDict, Field, field_validator from pydantic import ValidationError as PydanticValidationError from .logger import get_logge...
leynier/gh-folder-download
gh_folder_download/config.py
.py
477298ca160247d3
7.66
20
""" File filtering system for gh-folder-download. """ import fnmatch import re from pathlib import Path from github.ContentFile import ContentFile from pathspec import GitIgnoreSpec from .config import FilterConfig from .logger import get_logger class FileFilter: """Advanced file filtering system.""" def ...
leynier/gh-folder-download
gh_folder_download/filters.py
.py
fc9f55258e62a5ac
7.66
20
""" File integrity verification for gh-folder-download. """ import hashlib from pathlib import Path from typing import Any from .logger import get_logger class IntegrityError(Exception): """Exception raised when file integrity check fails.""" pass class FileIntegrityChecker: """Handles file integrity...
leynier/gh-folder-download
gh_folder_download/integrity.py
.py
bd72f025eb44c904
7.66
20
""" Logging configuration for gh-folder-download. """ import logging from pathlib import Path from rich.console import Console from rich.logging import RichHandler from rich.table import Table class GHFolderLogger: """Logger with rich formatting and progress tracking.""" def __init__( self, ...
leynier/gh-folder-download
gh_folder_download/logger.py
.py
c1cdf2be7dd7005e
7.66
20
""" Parallel download system for gh-folder-download using asyncio. """ import asyncio import contextlib import os import random import time from dataclasses import dataclass from pathlib import Path from typing import Any import aiohttp from .cache import DownloadCache from .integrity import FileIntegrityChecker, In...
leynier/gh-folder-download
gh_folder_download/parallel_downloader.py
.py
5564e9677f71c64e
7.66
20
""" Advanced progress tracking for gh-folder-download using Rich Progress. """ import contextlib import time from dataclasses import dataclass, field from pathlib import Path from typing import Any from rich.console import Console from rich.live import Live from rich.panel import Panel from rich.progress import ( ...
leynier/gh-folder-download
gh_folder_download/progress.py
.py
a688e819a40b916f
7.66
20
""" Rate limiting system for GitHub API calls in gh-folder-download. """ import threading import time from dataclasses import dataclass from typing import Any, cast from github import Auth, Github, GithubException from .logger import get_logger @dataclass class RateLimitInfo: """Information about GitHub rate l...
leynier/gh-folder-download
gh_folder_download/rate_limiter.py
.py
152f47f5e8a9c8b2
7.66
20
""" Retry mechanism with exponential backoff for gh-folder-download. """ import re import secrets import time from collections.abc import Callable from functools import wraps from typing import Any from github import GithubException from .logger import get_logger _random = secrets.SystemRandom() class RetryError(...
leynier/gh-folder-download
gh_folder_download/retry.py
.py
f586e2a63b76f205
7.66
20
""" Input validation utilities for gh-folder-download. """ import re from dataclasses import dataclass from pathlib import Path from urllib.parse import unquote, urlparse from .logger import get_logger class ValidationError(Exception): """Custom exception for validation errors.""" pass @dataclass(frozen=...
leynier/gh-folder-download
gh_folder_download/validation.py
.py
12304ec28f2e8182
7.66
20
"""Tests for caching system.""" import builtins import json import time from pathlib import Path from unittest.mock import Mock import pytest from gh_folder_download import cache as cache_module from gh_folder_download.cache import CacheEntry, DownloadCache @pytest.fixture def cache_dir(tmp_path): """Temporary...
leynier/gh-folder-download
tests/test_cache.py
.py
7a462ba6d1b703f6
7.16
20
"""Tests for file filtering system.""" from typing import cast from unittest.mock import Mock import pytest from github.ContentFile import ContentFile from gh_folder_download.config import FilterConfig from gh_folder_download.filters import FileFilter, FilterPresets, create_file_filter, get_preset_filter @pytest.f...
leynier/gh-folder-download
tests/test_filters.py
.py
29ae05dd6ae1ba4c
8.16
20
""" Integration tests for gh-folder-download. These tests perform REAL downloads from GitHub and save files locally. Run with: uv run pytest tests/test_integration.py -v NOTE: These tests require internet connection and may be slow. """ import os import shutil import pytest from gh_folder_download.config import Fi...
leynier/gh-folder-download
tests/test_integration.py
.py
7e78e7ccea1086f5
7.16
20
"""Tests for file integrity verification.""" import builtins import hashlib from unittest.mock import Mock import pytest from gh_folder_download.integrity import FileIntegrityChecker, IntegrityError, quick_integrity_check @pytest.fixture def temp_text_file(tmp_path): """Create a temporary text file for testing...
leynier/gh-folder-download
tests/test_integrity.py
.py
7415057d5510de69
8.16
20
"""Tests for rate limiting system.""" import time from unittest.mock import MagicMock, Mock, patch import pytest from github import GithubException from gh_folder_download.rate_limiter import ( GitHubRateLimiter, RateLimitedGitHubClient, RateLimitInfo, ) @pytest.fixture def rate_limit_info(): """Sa...
leynier/gh-folder-download
tests/test_rate_limiter.py
.py
21151fd6eb736db0
7.16
20
"""Tests for retry mechanism with exponential backoff.""" from unittest.mock import Mock import pytest from github import GithubException from gh_folder_download.retry import ( APIRetryHandler, DownloadRetryHandler, RetryConfig, RetryError, RetryHandler, with_retry, ) @pytest.fixture def de...
leynier/gh-folder-download
tests/test_retry.py
.py
6d9dd5e63b628b17
8.16
20
"""Tests for input validation utilities.""" from pathlib import Path from typing import Any, cast from unittest.mock import Mock import pytest from gh_folder_download import validation as validation_module from gh_folder_download.validation import InputValidator, ParsedGitHubURL, ValidationError class TestValidate...
leynier/gh-folder-download
tests/test_validation.py
.py
fc2e970be336f5c9
8.16
20
"""Download helpers for the Batch SDK. Every helper fetches task bodies straight from each result's presigned `result_url` (a signed storage URL) — no auth header, no API content endpoint in the loop. Bulk, both with optional concurrency + a tqdm progress bar: - `download_to_dir(...)` writes every task body to a d...
ZenRows/zenrows-python-sdk
src/zenrows/batch/_download.py
.py
6ab09122994e0bcd
7.66
20
"""Client-side cost estimation for Batch jobs. The Batch API prices a scrape per **successful request**, driven by two scraper knobs (`js_render`, `premium_proxy`) plus the dynamic `mode=auto`. The rate card is small, stable, and identical for every caller, so estimation lives client-side rather than behind a network ...
ZenRows/zenrows-python-sdk
src/zenrows/batch/_estimate.py
.py
39ee6777ba81c944
7.66
20
"""Structured logging for the Batch SDK. One logger per module under the `zenrows.batch` namespace. Logging follows the stdlib `logging` conventions — callers opt in by configuring a handler on `zenrows.batch` (or any ancestor); we never install one ourselves. That keeps quiet libraries quiet by default and lets apps ...
ZenRows/zenrows-python-sdk
src/zenrows/batch/_logging.py
.py
dab44ef8f474c2e6
7.66
20
"""Pythonic schedule builders for `submit_scheduled`. The wire format is a structured dict (`JobScheduleDict`) — three mutually exclusive shapes (`at` / `rate` / `calendar`) plus an optional `timezone`. The dict form is fine for power users; everyone else gets these typed classes: from zenrows.batch import At, Ra...
ZenRows/zenrows-python-sdk
src/zenrows/batch/_schedule.py
.py
37ab34134693b4a8
7.66
20
"""HTTP transport for the Batch client. Owns the httpx Client, the `X-API-Key` auth header, default User-Agent, automatic retries for transient failures, and the RFC 7807 → `BatchAPIError` mapping. The facade (`client.py`) is thin glue over this — one method per endpoint, all typed via pydantic v2 models. """ import ...
ZenRows/zenrows-python-sdk
src/zenrows/batch/_transport.py
.py
10194028eb2b62b8
7.66
20
"""TypedDict mirrors of the request models — for dict-literal callers. Most `client.submit_job(...)` / `add_tasks(...)` call sites pass a plain dict (it's nicer than constructing a pydantic model with the right kwargs). Without TypedDicts, those dicts get no autocomplete and no type-check; users discover misspellings ...
ZenRows/zenrows-python-sdk
src/zenrows/batch/_typed_dicts.py
.py
3e3df228531f092e
7.66
20
"""Polling helpers used by `ZenRowsBatchClient.wait_for_*` methods. Convention: a *waiter* polls a resource until it reaches a target state or a timeout/error fires. We default to exponential-ish backoff (capped) so short jobs don't pay a multi-second poll cadence and long ones don't hammer the API every two seconds. ...
ZenRows/zenrows-python-sdk
src/zenrows/batch/_waiters.py
.py
5e65f1e2169089b4
7.66
20
"""RFC 7807 Problem JSON → friendly Python exceptions. The Batch API returns errors as `application/problem+json`. We surface them as `BatchAPIError` with a structured `problem` payload plus a flat `code` shortcut so callers can branch without indexing into a dict. """ import json from dataclasses import dataclass fr...
ZenRows/zenrows-python-sdk
src/zenrows/batch/errors.py
.py
098bf89852f2cb42
7.66
20
"""Cost estimation (SPEC §8.1) — pure, client-side, no network.""" import pytest from zenrows.batch import ( CostEstimate, Tier, ZenRowsBatchClient, ) # Internal pricing helpers — no public function surface; estimation is # reached via `client.estimate_cost` / `client.estimate_job`. These tests # reach t...
ZenRows/zenrows-python-sdk
tests/test_estimate.py
.py
3424d6554dd29de0
8.16
20
# Copyright Spack Project Developers. See COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.cmake import CMakePackage from spack.package import * # supported model configurations KNOWN_CONF = ( "MOM6", "CICE6", "WW3", "MOM6-WW3", "MO...
ACCESS-NRI/access-spack-packages
spack_repo/access/nri/packages/access3/package.py
.py
3458777a83f14537
7.52
10
# Copyright Spack Project Developers. See COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.cmake import CMakePackage from spack.package import * from spack_repo.access.nri.packages.access3.package import ACCESS3_VERSIONS class Access3Share(CMakePackage...
ACCESS-NRI/access-spack-packages
spack_repo/access/nri/packages/access3_share/package.py
.py
865e0e7eae03b287
7.52
10
# Copyright Spack Project Developers. See COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.cmake import CMakePackage from spack.package import * class AccessCice(CMakePackage): """CICE is a computationally efficient model for simulating the growth...
ACCESS-NRI/access-spack-packages
spack_repo/access/nri/packages/access_cice/package.py
.py
a7183544c1045f8e
7.52
10
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # Copyright 2024 ACCESS-NRI # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.cmake import CMakePackage from spack.package import * ...
ACCESS-NRI/access-spack-packages
spack_repo/access/nri/packages/access_fms/package.py
.py
5227f32bef43089d
7.52
10
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.cmake import CMakePackage from spack.package import * class AccessGenericTracers(C...
ACCESS-NRI/access-spack-packages
spack_repo/access/nri/packages/access_generic_tracers/package.py
.py
ffcc467223f96ddb
7.52
10
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # Copyright 2024 ACCESS-NRI # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.cmake import CMakePackage from spack.package import * ...
ACCESS-NRI/access-spack-packages
spack_repo/access/nri/packages/access_mocsy/package.py
.py
a1a76c7449edfeda
7.52
10
# Copyright Spack Project Developers. See COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.cmake import CMakePackage from spack.package import * class AccessMom6(CMakePackage): """The Modular Ocean Model (MOM) describes the numerical ocean models ...
ACCESS-NRI/access-spack-packages
spack_repo/access/nri/packages/access_mom6/package.py
.py
b1ee07c6fee0daf4
7.52
10