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
import typer
from exasol.toolbox.tools import template
CLI = typer.Typer()
PKG = "exasol.toolbox.templates.github.ISSUE_TEMPLATE"
LEXER = "markdown"
ISSUE_TEMPLATE_PATH = Path("./.github/ISSUE_TEMPLATE")
@CLI.command(name="list")
def list_issues(
columns: bool = typer.Option(
F... | exasol/python-toolbox | exasol/toolbox/tools/issue.py | .py | a5e95038ae77400b | 7.48 | 8 |
"""This module contains security related CLI tools and code"""
from __future__ import annotations
import json
import re
import subprocess # nosec: B404 - risk of subprocess is accepted
import sys
from collections.abc import (
Generator,
Iterable,
)
from dataclasses import (
asdict,
dataclass,
)
from ... | exasol/python-toolbox | exasol/toolbox/tools/security.py | .py | 1a02bd85aef4d736 | 7.48 | 8 |
from __future__ import annotations
import json
import subprocess # nosec: B404 - risk of subprocess is accepted
import tempfile
from dataclasses import dataclass
from enum import Enum
from inspect import cleandoc
from pathlib import Path
from re import search
from typing import (
Any,
)
from pydantic import (
... | exasol/python-toolbox | exasol/toolbox/util/dependencies/audit.py | .py | 98582877fab48d83 | 7.48 | 8 |
from __future__ import annotations
from packaging.version import Version
from pydantic import (
BaseModel,
ConfigDict,
)
from exasol.toolbox.util.dependencies.shared_models import (
NormalizedPackageStr,
Package,
create_package_coordinates,
)
class DependencyChange(BaseModel):
model_config =... | exasol/python-toolbox | exasol/toolbox/util/dependencies/track_changes.py | .py | 50e9f0639c946170 | 7.48 | 8 |
from collections import defaultdict
from inspect import cleandoc
from pydantic import (
BaseModel,
ConfigDict,
)
from exasol.toolbox.util.dependencies.audit import Vulnerability
class VulnerabilityMatcher:
def __init__(self, current_vulnerabilities: list[Vulnerability]):
# Dictionary mapping pac... | exasol/python-toolbox | exasol/toolbox/util/dependencies/track_vulnerabilities.py | .py | 45bdf6765d8b1693 | 7.48 | 8 |
from __future__ import annotations
from collections import OrderedDict
from collections.abc import Generator
from datetime import datetime
from enum import Enum
from inspect import cleandoc
from pathlib import Path
from exasol.toolbox.util.dependencies.audit import (
get_vulnerabilities,
get_vulnerabilities_f... | exasol/python-toolbox | exasol/toolbox/util/release/changelog.py | .py | 25113334a4f03cd8 | 7.48 | 8 |
"""
Class Markdown represents a file in Markdown syntax with some additional
constraints:
* The file must start with a title in the first line.
* Each subsequent title must be of a higher level, i.e. start with more "#"
characters than the top-level title.
Each title starts a section, optionally containing an addit... | exasol/python-toolbox | exasol/toolbox/util/release/markdown.py | .py | a518ceffa5150101 | 7.48 | 8 |
from collections.abc import Mapping
from pathlib import Path
from typing import Final
import importlib_resources as resources
SKILLS_DIRECTORY: Final = "exasol.toolbox.skills"
PTB_SKILL_NAME: Final = "exasol-python-toolbox"
def get_skill_path(skill_name: str = PTB_SKILL_NAME) -> Path:
"""
Return the path to... | exasol/python-toolbox | exasol/toolbox/util/skills.py | .py | 14ea99c9ac831960 | 7.48 | 8 |
from __future__ import annotations
from pathlib import Path
from typing import (
Literal,
TypeAlias,
)
from pydantic import (
BaseModel,
ConfigDict,
)
from ruamel.yaml import (
CommentedMap,
)
from exasol.toolbox.util.workflows.render_yaml import parse_yaml_text
PermissionLevel: TypeAlias = Lite... | exasol/python-toolbox | exasol/toolbox/util/workflows/custom_workflow.py | .py | 92513db7eb53974d | 7.48 | 8 |
"""NER utilities."""
import warnings
from collections.abc import Iterable, Sequence
from typing import Any
import curies
import ssslm
from curies import vocabulary as v
from obographs import StandardizedGraph, StandardizedNode
from tqdm import tqdm
from .robot import get_obograph_by_prefix
__all__ = [
"get_lite... | biopragmatics/bioontologies | src/bioontologies/ner.py | .py | 49ed7a5fa7b8ff45 | 7.56 | 12 |
"""A wrapper around ROBOT functionality.
.. seealso:: https://robot.obolibrary.org
"""
import dataclasses
import json
import logging
import os
import subprocess
import tempfile
from collections.abc import Generator
from contextlib import contextmanager
from dataclasses import dataclass
from pathlib import Path
from t... | biopragmatics/bioontologies | src/bioontologies/robot.py | .py | dd848a42748ea129 | 7.56 | 12 |
"""Version information for :mod:`bioontologies`.
Run with ``python -m bioontologies.version``
"""
import os
from subprocess import CalledProcessError, check_output
__all__ = [
"VERSION",
"get_git_hash",
"get_version",
]
VERSION = "0.9.1-dev"
def get_git_hash() -> str:
"""Get the :mod:`bioontologie... | biopragmatics/bioontologies | src/bioontologies/version.py | .py | ccd10216b8703d41 | 7.56 | 12 |
"""Test API functions."""
import unittest
from robot_obo_tool import is_available
from bioontologies.robot import ParseResults, convert_to_obograph_remote
@unittest.skipUnless(is_available(), "Robot is not available")
class TestAPI(unittest.TestCase):
"""Test parsing a remote file."""
def test_parse_owl(s... | biopragmatics/bioontologies | tests/test_api.py | .py | cad1b7cb934ca731 | 8.06 | 12 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""API routes: healthz, formats, parse, render.
Uploads are received in memory as temporary files, processed, then discarded
(stateless). Paths are never taken from user input. Upload size is capped.
"""
from __futur... | sktelecom/onot | src/onot/api/routes.py | .py | 46a51db84bfdfc53 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""onot CLI entry point (Typer).
generate (multiple formats, auto-detection, language, settings), formats, version.
"""
from __future__ import annotations
from datetime import datetime
from pathlib import Path
impo... | sktelecom/onot | src/onot/cli/main.py | .py | 936da75352d9f6a2 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Settings: company info, language, theme, offline mode. Precedence: CLI/explicit args > yaml > env vars > defaults.
Env var example: ONOT_DEFAULT_LANG=en, ONOT_COMPANY__ORGANIZATION="Acme Inc".
"""
from __future__ ... | sktelecom/onot | src/onot/core/config.py | .py | a72ee6a7d1c6e7a9 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Output file naming rules. (HTML anchor slugs are added in M4 license_links)"""
from __future__ import annotations
import re
from datetime import datetime
_UNSAFE = re.compile(r"[^A-Za-z0-9._-]+")
def slugify(na... | sktelecom/onot | src/onot/core/naming.py | .py | 75fbff77597f13d0 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Write outputs to disk (separated from rendering)."""
from __future__ import annotations
from pathlib import Path
class OutputWriter:
def write(self, content: str | bytes, path: str | Path) -> Path:
t... | sktelecom/onot | src/onot/core/writer.py | .py | 2e6df34ed33a4002 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""onot domain models (pure Pydantic v2, no external parser/network dependency).
All models are frozen=True, extra="forbid". License expressions and copyrights are
structured as value objects to distinguish NOASSERTIO... | sktelecom/onot | src/onot/domain/models.py | .py | 34610bd4018449dc | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Defense against XXE and expansion bombs (billion-laughs) in untrusted XML input.
Rather than relying on the library's internal parser, this rejects DOCTYPE/ENTITY
declarations before parsing. SBOM XML (CycloneDX/SP... | sktelecom/onot | src/onot/ingest/_xml_guard.py | .py | b29c0aeb1c7f2ead | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Common interface for input adapters."""
from __future__ import annotations
from pathlib import Path
from typing import Protocol, runtime_checkable
from pydantic import BaseModel, ConfigDict
from onot.domain.mode... | sktelecom/onot | src/onot/ingest/base.py | .py | 5eaad2c207f815c3 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""CycloneDxAdapter — parses CycloneDX (JSON/XML) via cyclonedx-python-lib.
CDX has no concluded/declared distinction, so licenses are mapped to license_declared
(effective falls back to declared). Inline named licens... | sktelecom/onot | src/onot/ingest/cyclonedx.py | .py | 748af99c12fb0413 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""ExcelAdapter — 1.x onot/SPDX spreadsheet template -> NoticeDocument.
Reads the Document Info, Package Info, and Extracted License Info sheets and maps them into
a NoticeDocument. Integrated into the registry as Exc... | sktelecom/onot | src/onot/ingest/excel.py | .py | 2691b3321d93f476 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Format adapter registry + load_document entry point."""
from __future__ import annotations
from pathlib import Path
from onot.domain.errors import UnsupportedFormatError
from onot.ingest.base import IngestAdapter... | sktelecom/onot | src/onot/ingest/registry.py | .py | c947d8ac7e967949 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""SpdxAdapter — parses SPDX 2.x (JSON/YAML/Tag-Value/RDF) via spdx-tools.
SPDX 3.0 input is deferred (D-005). For RDF/XML, an XXE guard is applied before parsing.
"""
from __future__ import annotations
from pathlib... | sktelecom/onot | src/onot/ingest/spdx.py | .py | 684f97190030ab35 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""License resolution layer.
The default `resolve()` does offline resolution based on the bundled catalog (air-gapped,
deterministic). Inject a fetcher into LicenseResolver if online supplementation is needed.
"""
fr... | sktelecom/onot | src/onot/license/__init__.py | .py | 80c6c5e57d972ca1 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""On-disk cache of license full texts (platformdirs). The namespace includes the license-list version."""
from __future__ import annotations
import hashlib
from pathlib import Path
import platformdirs
class DiskC... | sktelecom/onot | src/onot/license/cache.py | .py | f6c1ea68458a97bf | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Bundled SPDX license-list-data catalog (includes full texts, fully air-gapped).
The data is vendored via `scripts/update_license_data.py`. For frozen-environment safety,
it is accessed through importlib.resources '... | sktelecom/onot | src/onot/license/catalog.py | .py | 25f851958c55e6ac | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""SPDX license expression parsing (wrapper around license-expression).
Flattens nested OR/AND/WITH and the + operator to extract symbols. Parse failures are
raised as ExpressionParseError (the resolver handles the fa... | sktelecom/onot | src/onot/license/expression_parser.py | .py | d5e8d2a7064253ed | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Remote license full-text fetch (httpx + exponential backoff retries + proxy-aware).
A supplementary path that fetches new/rare licenses not in the bundle from online. Not
called in air-gapped/offline mode. `trust_e... | sktelecom/onot | src/onot/license/fetcher.py | .py | 1ec0f19a818ef5ce | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""LicenseResolver — orchestrates expression resolution + full-text lookup.
Flattens each package's effective_expression to build the license list and back-references
(used_by), then fills full texts in the order: bun... | sktelecom/onot | src/onot/license/resolver.py | .py | 39a0654f302fa8b1 | 7.6 | 15 |
# SPDX-FileCopyrightText: Kakao Corp. and SK telecom Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Renderer ABC + shared Jinja environment.
render() is a pure function with no file I/O. Disk writing is handled by core.writer.OutputWriter.
"""
from __future__ import annotations
from abc import ABC, abstractmeth... | sktelecom/onot | src/onot/rendering/base.py | .py | 42863337e4f65cea | 7.6 | 15 |
"""
Common super class for the KOFReader() and KOFWriter() classes
"""
import csv
from pathlib import Path
from typing import Dict, Optional
def get_srid_to_code_mapping() -> Dict[int, int]:
field_names = ["name", "description", "code", "srid"]
path = Path(__file__).parent.absolute()
result = {}
with... | norwegian-geotechnical-institute/kof-parser | src/kof_parser/kof.py | .py | d4616ba294365baf | 7.42 | 6 |
from typing import List, Optional
from datetime import datetime, UTC
from uuid import UUID
from kof_parser import Kof
from kof_parser import Location
from kof_parser.enums import MethodType
from kof_parser import projector
class KOFWriter(Kof):
method_type_to_temakode = {
MethodType.RO.name: "2251",
... | norwegian-geotechnical-institute/kof-parser | src/kof_parser/writer.py | .py | dcbb9aeba7d4c41d | 7.42 | 6 |
import pytest
from kof_parser import KOFParser, exceptions
from kof_parser.enums import MethodType
class TestParse:
def test_parse(self):
parser = KOFParser()
srid = 5110
locations = parser.parse("tests/data/test.kof", srid)
assert len(locations) == 7
for location in loca... | norwegian-geotechnical-institute/kof-parser | tests/test_parse.py | .py | 5c92aad4be27900a | 7.92 | 6 |
#!/usr/bin/env python3
"""
is_my_module_standard
usage:
is_my_module_standard <version> -m <modules>...
"""
import json
import sys
from urllib.request import urlopen
LOCAL_DATA = "OUR_MODULES_DIFF.json"
OUR_MODULES_URL = "https://raw.githubusercontent.com/mao-odoo/all_standard_odoo_apps_per_version/main/OUR_MOD... | mao-odoo/all_standard_odoo_apps_per_version | is_my_module_standard.py | .py | e9aa5bb1f2068925 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Show the standard apps present in a version that did not exist in the previous one
"""
import json
from urllib.request import urlopen
LOCAL_DATA = "OUR_MODULES_DIFF.json"
OUR_MODULES_URL = "https://raw.githubusercontent.com/mao-odoo/all_standard_odoo_apps_per_version/main/OUR_MODULES_DIFF.j... | mao-odoo/all_standard_odoo_apps_per_version | new_app_per_version.py | .py | e654184bc8a3e40a | 7.45 | 7 |
# pylint: disable=invalid-name
"""Bluetooth Sensors"""
from .subscriber_base import SubscriberBase
class LennoxBleInput(SubscriberBase):
"""Represents a BLE sensor value"""
def __init__(self, ble_id: int, input_id: int):
SubscriberBase.__init__(self)
self.ble_id = ble_id
self.input_i... | PeteRager/lennoxs30api | lennoxs30api/lennox_ble.py | .py | 5b80682991684e3e | 7.59 | 14 |
"""Module for modeling lennox equipment"""
# pylint: disable=invalid-name
# pylint: disable=line-too-long
from typing import Final
from .s30exception import EC_BAD_PARAMETERS, S30Exception
class lennox_equipment_diagnostic(object):
"""Models a lennox equipment diagnostic elemetns"""
def __init__(self, equip... | PeteRager/lennoxs30api | lennoxs30api/lennox_equipment.py | .py | 733bacd692f6f056 | 7.59 | 14 |
"""Modules for a lennox home"""
# pylint: disable=invalid-name
# pylint: disable=line-too-long
import logging
import json
_LOGGER = logging.getLogger(__name__)
class lennox_home(object):
"""Class to model a lennox home"""
def __init__(self, home_id: int):
self.id: int = home_id
self.idx: in... | PeteRager/lennoxs30api | lennoxs30api/lennox_home.py | .py | caa78dedada048af | 7.59 | 14 |
"""Module for lennox schedule period"""
# pylint: disable=invalid-name
# pylint: disable=line-too-long
class lennox_period(object):
"""Class to represent a schedule period"""
def __init__(self, period_id):
self.id = period_id
self.enabled = False
self.startTime = None
self.sys... | PeteRager/lennoxs30api | lennoxs30api/lennox_period.py | .py | 72819b125ece083c | 7.59 | 14 |
"""Modules for lennox schedules"""
# pylint: disable=invalid-name
from .lennox_period import lennox_period
class lennox_schedule(object):
"""Class for a lennox schedule"""
def __init__(self, sched_id):
self.id = sched_id
self.name = "<Unknown>"
self.periodCount = -1
self._per... | PeteRager/lennoxs30api | lennoxs30api/lennox_schedule.py | .py | d6fc529eb118887c | 7.59 | 14 |
"""Modules to log messages to files"""
# pylint: disable=line-too-long
import logging
import json
import copy
REDACTED: str = "**redacted**"
class MessageLogger(object):
"""Class to log messages"""
def __init__(self, logger=None, enabled: bool = True, message_logging_file: str = None):
if message_l... | PeteRager/lennoxs30api | lennoxs30api/message_logger.py | .py | 888df06abb227fbb | 7.59 | 14 |
"""Communication Metrics for communication to lennox controller"""
# pylint: disable=invalid-name
from datetime import UTC, datetime
class Metrics:
"""Communication Metrics"""
def __init__(self):
self.error_count: int = 0
self.message_count: int = 0
self.receive_count: int = 0
... | PeteRager/lennoxs30api | lennoxs30api/metrics.py | .py | a502ad6cbce1d8bd | 7.59 | 14 |
"""Defines the S30Exception class and error codes"""
import asyncio
from aiohttp import (
ClientResponseError,
ServerDisconnectedError,
ClientConnectorError,
ClientConnectionError,
)
from lennoxs30api.metrics import Metrics
EC_AUTHENTICATE = 1
EC_LOGIN = 2
EC_NEGOTIATE = 3
EC_SUBSCRIBE = 4
EC_RETRIEV... | PeteRager/lennoxs30api | lennoxs30api/s30exception.py | .py | bb461a5348ab5a83 | 7.59 | 14 |
# pylint: disable=line-too-long
"""Base class for subscribable objects"""
from abc import ABC, abstractmethod
import logging
_LOGGER = logging.getLogger(__name__)
class SubscriberBase(ABC):
"""Base class for subscribable objects"""
def __init__(self):
self._dirty_list: list[str] = []
self._... | PeteRager/lennoxs30api | lennoxs30api/subscriber_base.py | .py | f4c7b55b19427897 | 7.59 | 14 |
#!/usr/bin/python
from lennoxs30api.s30exception import S30Exception
from lennoxs30api import lennox_system, lennox_zone, s30api_async
import time
import logging
import sys
import asyncio
###### ENIVRONMENT SETUP #####################
LOG_PATH = "/home/pete" # Directoy to stash the log file in
EMAIL_ADDRESS = "mye... | PeteRager/lennoxs30api | samples/test_async.py | .py | 68451c2059359a76 | 7.09 | 14 |
#!/usr/bin/python
from lennoxs30api.s30exception import S30Exception
from lennoxs30api import lennox_system, lennox_zone, s30api_async
import time
import logging
import sys
import asyncio
###### ENIVRONMENT SETUP #####################
LOG_PATH = "/home/pete" # Directoy to stash the log file in
# EMAIL_ADDRESS = "m... | PeteRager/lennoxs30api | samples/test_async_local.py | .py | 02b14569fc8a957e | 7.09 | 14 |
"""Pytest fixtures"""
import json
import os
import asyncio
import pytest
from lennoxs30api.metrics import Metrics
from lennoxs30api.s30api_async import s30api_async
def loadfile(name, sys_id=None) -> json:
"""Loads a JSON file from the messages directory"""
script_dir = os.path.dirname(__file__) + "/message... | PeteRager/lennoxs30api | tests/conftest.py | .py | 820bfb644ffff0ee | 7.09 | 14 |
"""Test module for processing messages"""
# pylint: disable=protected-access
import logging
from lennoxs30api.s30api_async import (
lennox_system,
s30api_async,
)
from tests.conftest import loadfile
def test_api_process_sibling_message(api: s30api_async, caplog):
"""Tests the processing of sibling messa... | PeteRager/lennoxs30api | tests/test_api_process_message.py | .py | a3ffc19515043c99 | 8.09 | 14 |
"""Test processing the online/offline thermostat status from the cloud"""
# pylint: disable=line-too-long
import json
import logging
from unittest.mock import patch
import aiohttp
import pytest
from lennoxs30api.s30api_async import (
lennox_system,
s30api_async,
)
from lennoxs30api.s30exception import S30Ex... | PeteRager/lennoxs30api | tests/test_async_get_system_online_cloud.py | .py | 7dddac9e0cbbe886 | 7.09 | 14 |
"""Tests authenticate"""
# pylint: disable=line-too-long
import logging
from unittest.mock import patch
import aiohttp
import pytest
from lennoxs30api.s30api_async import CERTIFICATE, s30api_async
from lennoxs30api.s30exception import S30Exception
@pytest.mark.asyncio
async def test_authenticate_local():
"""Tes... | PeteRager/lennoxs30api | tests/test_authenticate.py | .py | aefe6e98aa08d24c | 7.09 | 14 |
"""Tests for BLE devices"""
# pylint: disable=line-too-long
from lennoxs30api.s30api_async import lennox_system
from tests.conftest import loadfile
def test_ble_config(api_system_04_furn_ac_zoning):
"""Tests BLE config loading"""
api = api_system_04_furn_ac_zoning
system: lennox_system = api.system_list... | PeteRager/lennoxs30api | tests/test_ble_sensors.py | .py | c6ba55ae7df1e523 | 7.09 | 14 |
"""Test unit system rounding"""
from lennoxs30api.s30api_async import lennox_system
def test_celsius_round(api):
"""Tests rounding celsius to 0.5 degrees"""
lsystem: lennox_system = api.system_list[0]
assert lsystem.sysId == "0000000-0000-0000-0000-000000000001"
assert lsystem.celsius_round(20.7) == ... | PeteRager/lennoxs30api | tests/test_conversions.py | .py | a28de842ddf9245f | 8.09 | 14 |
"""Tests the diagnostic response from the controller"""
import os
from lennoxs30api.lennox_equipment import lennox_equipment, lennox_equipment_diagnostic
from lennoxs30api.s30api_async import s30api_async, lennox_system
from tests.conftest import loadfile
# where device responses can be found
script_dir = os.path.... | PeteRager/lennoxs30api | tests/test_diagnostic_response.py | .py | 05ff01d78f80d3e6 | 7.09 | 14 |
"""Tests the controller diagnostic level"""
from lennoxs30api.s30api_async import lennox_system, s30api_async
from tests.conftest import loadfile
def test_get_diagnostic_level(api: s30api_async):
"""Tests getting the diagnostic level from message"""
lsystem: lennox_system = api.system_list[0]
assert lsys... | PeteRager/lennoxs30api | tests/test_diagnostics_level.py | .py | 828ee486ff76b60b | 7.09 | 14 |
"""Tests the equipment response"""
# pylint: disable=line-too-long
# pylint: disable=protected-access
# pylint: disable=protected-access
# pylint: disable=missing-function-docstring
# pylint: disable=invalid-name
from lennoxs30api.lennox_equipment import lennox_equipment
from lennoxs30api.s30api_async import (
LEN... | PeteRager/lennoxs30api | tests/test_equipment_response.py | .py | e46467ced3f33f29 | 8.09 | 14 |
"""Tests for BLE devices"""
# pylint: disable=line-too-long
from lennoxs30api.s30api_async import lennox_system
from tests.conftest import loadfile
def test_iaq_config(api_system_04_furn_ac_zoning):
"""Tests BLE config loading"""
api = api_system_04_furn_ac_zoning
system: lennox_system = api.system_list... | PeteRager/lennoxs30api | tests/test_iaq.py | .py | f78663e3dc39dfee | 7.09 | 14 |
"""Test Login"""
# pylint: disable=line-too-long
import json
import logging
from unittest.mock import patch
import aiohttp
import pytest
from lennoxs30api.s30api_async import s30api_async
from lennoxs30api.s30exception import (
EC_COMMS_ERROR,
EC_LOGIN,
S30Exception,
)
from tests.conftest import loadfile... | PeteRager/lennoxs30api | tests/test_login.py | .py | 360bcbe34a6eb4dc | 7.09 | 14 |
"""Tests login responses"""
from lennoxs30api.s30api_async import s30api_async, lennox_system
from lennoxs30api.lennox_home import lennox_home
from tests.conftest import loadfile
def test_process_login_message():
"""Test login message"""
api = s30api_async("myemail@email.com", "mypassword", None)
data = ... | PeteRager/lennoxs30api | tests/test_login_response.py | .py | c52c8be1c24d9647 | 7.09 | 14 |
"""Tests the api.logout function"""
# pylint: disable=line-too-long
# pylint: disable=protected-access
# pylint: disable=protected-access
# pylint: disable=missing-function-docstring
# pylint: disable=invalid-name
import logging
from unittest.mock import patch
import aiohttp
import pytest
from lennoxs30api.s30api_asy... | PeteRager/lennoxs30api | tests/test_logout.py | .py | 751e7ff3620369a2 | 8.09 | 14 |
"""Tests the message logger"""
# pylint: disable=line-too-long
import logging
import json
import timeit
from lennoxs30api.message_logger import REDACTED, MessageLogger
from tests.conftest import loadfile
def test_logging_enable_disable(caplog):
"""Test logging"""
logger = logging.getLogger(__name__)
log... | PeteRager/lennoxs30api | tests/test_message_logger.py | .py | 8491b00939712d57 | 8.09 | 14 |
"""Test data updates"""
from lennoxs30api.s30api_async import (
LENNOX_HUMID_OPERATION_HUMID,
LENNOX_HUMIDITY_MODE_DEHUMIDIFY,
LENNOX_HUMIDITY_MODE_HUMIDIFY,
LENNOX_SA_SETPOINT_STATE_HOME,
LENNOX_SA_STATE_ENABLED_CANCELLED,
LENNOX_STATUS_GOOD,
LENNOX_STATUS_NOT_AVAILABLE,
LENNOX_STATUS_... | PeteRager/lennoxs30api | tests/test_mutations.py | .py | 450b763cdd382fb4 | 7.09 | 14 |
"""Tests the cloud negotiate sequence"""
# pylint: disable=protected-access
from unittest.mock import patch
import pytest
import aiohttp
from lennoxs30api.s30api_async import (
s30api_async,
)
from lennoxs30api.s30exception import (
EC_COMMS_ERROR,
EC_NEGOTIATE,
S30Exception,
)
class GoodResponse:
... | PeteRager/lennoxs30api | tests/test_negotiate.py | .py | 903cee510da146bc | 7.09 | 14 |
"""Test the api publish messsage helper function"""
# pylint: disable=protected-access
import json
from unittest.mock import patch
import aiohttp
import pytest
from lennoxs30api.s30api_async import lennox_system, s30api_async
from lennoxs30api.s30exception import (
EC_COMMS_ERROR,
EC_PUBLISH_MESSAGE,
S30Ex... | PeteRager/lennoxs30api | tests/test_publish_message_helper.py | .py | d956381bff268bfd | 7.09 | 14 |
"""Test receive errors"""
# pylint: disable=protected-access
import asyncio
import logging
from unittest.mock import patch
import aiohttp
import pytest
from lennoxs30api.s30api_async import s30api_async
from lennoxs30api.s30exception import (
EC_COMMS_ERROR,
EC_HTTP_ERR,
EC_UNAUTHORIZED,
S30Exception,
... | PeteRager/lennoxs30api | tests/test_receive_errors.py | .py | 4371aa090be0d2a9 | 7.09 | 14 |
"""Tests the API request data helper"""
# pylint: disable=protected-access
# pylint: disable=line-too-long
import json
from unittest.mock import patch
import aiohttp
import pytest
from lennoxs30api.s30api_async import (
lennox_system,
s30api_async,
)
from lennoxs30api.s30exception import (
EC_COMMS_ERROR,... | PeteRager/lennoxs30api | tests/test_request_data_helper.py | .py | a349f27cea900a61 | 7.09 | 14 |
"""Test the controllers internet status"""
from lennoxs30api.s30api_async import (
lennox_system,
s30api_async,
)
from tests.conftest import loadfile
def test_get_rgw_status(api: s30api_async):
"""Test the RGW status"""
lsystem: lennox_system = api.system_list[0]
assert lsystem.sysId == "0000000-... | PeteRager/lennoxs30api | tests/test_rgw_internet.py | .py | 48935d1a52362b64 | 7.09 | 14 |
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Dict, Optional
from rich.table import Table
from . import format_table, log, mapfile
from .elf import Elf
def show_table(table: Table) -> None:
"""Print Rich Table in CSV format... | espressif/esp-idf-size | esp_idf_size/format_csv.py | .py | 6da3b3b7b449099e | 7.6 | 15 |
# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import json
from pathlib import Path
from subprocess import run
from tempfile import TemporaryDirectory
import pytest
import utils
def pytest_addoption(parser: pytest.Parser) -> None:
parser.addoption(
... | espressif/esp-idf-size | test/conftest.py | .py | eb868a9195f75836 | 7.1 | 15 |
# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import filecmp
import json
import logging
import os
import sys
from pathlib import Path
from subprocess import run
from tempfile import TemporaryDirectory
import pytest
sys.path.append(str(Path(__file__).res... | espressif/esp-idf-size | test/test_formats.py | .py | 713047b6a85d2bfd | 7.1 | 15 |
#!/usr/bin/python3
"""Required modules"""
import argparse
import json
import os
import re
import urllib
import requests
def basename(url):
"""Get basename from the path of a url"""
return os.path.basename(urllib.parse.urlparse(url.strip("/")).path)
def is_snapshot(url):
"""Check if a url is formatted ... | osbuild/rpmrepo | .github/scripts/update_schutzfile.py | .py | 35e6e93c75fe1bce | 7.66 | 20 |
#!/usr/bin/python3
# pylint: disable=invalid-name
"""
Generate all repo snapshot configuration files based on the definitions list
"""
import argparse
import json
import logging
import subprocess
import sys
import yaml
logger = logging.getLogger(__name__)
def get_parser():
"""
Create argument parser
"... | osbuild/rpmrepo | gen-all-repos.py | .py | b85bdab9d068ffa8 | 7.66 | 20 |
"""rpmrepo - Command Line Interface
The `cli` module provides a command-line interface to the rpmrepo package. It
provides the most basic way to execute and interact with the rpmrepo functions.
"""
# pylint: disable=duplicate-code,invalid-name,too-few-public-methods
import argparse
import contextlib
import os
import... | osbuild/rpmrepo | src/ctl/cli.py | .py | d9a6664690190df8 | 7.66 | 20 |
"""rpmrepo - Create RPM Repository Enumerate Cache
This module enumerates all the thread indices to generate a list of
snapshots, which it then stores under data/thread/meta/cache.json.
"""
# pylint: disable=duplicate-code,invalid-name,too-few-public-methods
import contextlib
import json
import boto3
class Enumer... | osbuild/rpmrepo | src/ctl/enumerate_cache.py | .py | 345cb2cb26ccc01b | 7.66 | 20 |
"""rpmrepo - Create RPM Repository Index
This module creates a custom index for an RPM repository which provides
a content-addressable storage alongside a symlink collection.
"""
# pylint: disable=duplicate-code,invalid-name,too-few-public-methods
import contextlib
import errno
import hashlib
import os
import shutil... | osbuild/rpmrepo | src/ctl/index.py | .py | 3cf491e9e9406207 | 7.66 | 20 |
"""rpmrepo - Pull RPM Repository
This module implements the functions that pull an entire RPM repository to
local storage.
"""
# pylint: disable=duplicate-code,invalid-name,too-few-public-methods
import contextlib
import errno
import os
import shutil
import subprocess
import sys
import tempfile
from . import util
... | osbuild/rpmrepo | src/ctl/pull.py | .py | f460f9b1e6efe8b1 | 7.66 | 20 |
"""rpmrepo - Push RPM Repository
This module implements the functions that push local RPM repository
snapshots to configured remote storage.
"""
# pylint: disable=duplicate-code,invalid-name,too-few-public-methods
import contextlib
import os
import boto3
class Push(contextlib.AbstractContextManager):
"""Push ... | osbuild/rpmrepo | src/ctl/push.py | .py | dc44dbe70ef3d566 | 7.66 | 20 |
"""rpmrepo - Snapshot RPM Repository
This module implements the snapshot pipeline that pulls an RPM repository,
indexes it, and pushes it to remote storage.
"""
# pylint: disable=duplicate-code,invalid-name,too-few-public-methods
import datetime
import json
import os
import boto3
import botocore.exceptions
from . ... | osbuild/rpmrepo | src/ctl/snapshot.py | .py | 09902fc67db9909f | 7.66 | 20 |
"""rpmrepo - utilities
A module with a wide array of different utility functions that extend the
standard library.
"""
# pylint: disable=invalid-name
import contextlib
import errno
import os
@contextlib.contextmanager
def suppress_oserror(*errnos):
"""Suppress OSError Exceptions
This is an extension to `c... | osbuild/rpmrepo | src/ctl/util.py | .py | b9a381c16d807c1e | 7.66 | 20 |
#!/usr/bin/python3
"""repo-check - Check JSON repository files
A simple script to check the validity of repository configuration files that
we store in ./repo/.
"""
# pylint: disable=duplicate-code,invalid-name,too-few-public-methods
import argparse
import json
import os
import re
import urllib.parse
import request... | osbuild/rpmrepo | src/script/repo-check.py | .py | 9b53b1ec57f43d2a | 7.66 | 20 |
from __future__ import annotations
import os
import re
from dataclasses import dataclass
from typing import Any
from stdl.dt import date_fmt, datetime, parse_datetime_str
from stdl.net import download
from stdl.st import sf
@dataclass(order=True)
class TwitchClip:
view_count: int
clip_id: str
duration: ... | zigai/twitch-scraper | twitch_scraper/clip.py | .py | f1d36f1d83bd7cf8 | 7.48 | 8 |
from stdl.dt import datetime, datetime_fmt, time
from stdl.fs import json_dump, os
from stdl.log import br
from stdl.st import FG, colored
from twitch_scraper.client import TwitchApiClient
from twitch_scraper.util import JsonValue
class TwitchScraper(TwitchApiClient):
"""
Twitch.tv scraper.
Args:
... | zigai/twitch-scraper | twitch_scraper/scraper.py | .py | 994128cfd9847a7a | 7.48 | 8 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import os
import sys
from pathlib import Path
import pandas as pd
from sklearn.model_selection import train_test_split
import xgboost as xgb
import dask.dataframe as dd
from sagemaker_training import environment
imp... | amzn/rheoceros | examples/model_training_and_inference/create_custom_container/xgboost/docker_test_folder/code/train.py | .py | c9eebad661a1c7a0 | 8.13 | 17 |
# Copyright 2020 Curtin University
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | The-Academic-Observatory/oaebu-workflows | dags/oaebu_workflows/airflow_pools.py | .py | 13b38e7844f637dc | 7.5 | 9 |
# Copyright 2020-2024 Curtin University
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | The-Academic-Observatory/oaebu-workflows | dags/oaebu_workflows/config.py | .py | 46dd1bfd1e225a06 | 7.5 | 9 |
# Copyright 2022-2024 Curtin University
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | The-Academic-Observatory/oaebu-workflows | dags/oaebu_workflows/irus_fulcrum_telescope/irus_fulcrum_telescope.py | .py | d33d110ba1442e0d | 7.5 | 9 |
# Copyright 2020-2024 Curtin University
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | The-Academic-Observatory/oaebu-workflows | dags/oaebu_workflows/oapen_metadata_telescope/oapen_metadata_telescope.py | .py | 4ea9ea7b3ff2cf60 | 7.5 | 9 |
# Copyright 2021-2024 Curtin University
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | The-Academic-Observatory/oaebu-workflows | dags/oaebu_workflows/onix_telescope/onix_telescope.py | .py | 79768574d55373ab | 7.5 | 9 |
# Copyright 2023-2024 Curtin University
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | The-Academic-Observatory/oaebu-workflows | dags/oaebu_workflows/thoth_telescope/thoth_telescope.py | .py | d10dfa38d6d98559 | 7.5 | 9 |
import asyncio
import contextlib
import inspect
import io
import os
import subprocess
import textwrap
import time
import traceback
import disnake
from loguru import logger
from tortoise import Tortoise
from ouranos.dpy.cog import Cog
from ouranos.dpy.command import command, group
from ouranos.utils import db
from our... | nwunderly/ouranos | ouranos/cogs/admin.py | .py | 9557e720806703d0 | 7.54 | 11 |
from typing import Union
import disnake
from disnake.ext import commands
from ouranos.dpy.cog import Cog
from ouranos.dpy.command import command, group
from ouranos.settings import Settings
from ouranos.utils import db
from ouranos.utils.checks import is_bot_admin, server_admin
from ouranos.utils.emojis import TICK_G... | nwunderly/ouranos | ouranos/cogs/config.py | .py | 7efc44e4855acd7b | 7.54 | 11 |
import datetime
import itertools
import sys
import time
import disnake
import psutil
import pygit2
from ouranos.dpy.cog import Cog
from ouranos.dpy.command import command
from ouranos.settings import Settings
from ouranos.utils.checks import is_bot_admin, server_mod
from ouranos.utils.emojis import (
BOTDEV,
... | nwunderly/ouranos | ouranos/cogs/general.py | .py | aba39bd28faaba82 | 7.54 | 11 |
import asyncio
from disnake.ext import commands
from ouranos.utils.errors import ActionCanceled, ActionTimedOut
class Context(commands.Context):
"""Custom context utilities."""
def __init__(self, **attrs):
self._force_action = False
super().__init__(**attrs)
def force_action(self, valu... | nwunderly/ouranos | ouranos/dpy/context.py | .py | 92e812b3f49014e8 | 7.54 | 11 |
import boto3
import uuid
import logging
client = boto3.client('docdb')
class DocumentDB:
"""
Add or remove read replicas on an Amazon DocumentDB cluster.
Attributes
----------
db_cluster_id : str
DocumentDB cluster identifier.
min_capacity : int
The minimum capacity (default is 0).
max_capacity... | theuves/docdb-autoscaling | src/autoscaling.py | .py | 37306accb2bd5840 | 7.54 | 11 |
import datetime
import numpy as np
import pandas as pd
class Portfolio:
"""
Clase Portfolio que interactúa con una API para obtener y procesar información de activos de un comitente
en una fecha específica y en una moneda determinada.
Atributos:
headers (dict): Encabezados HTTP que se util... | franco-lamas/SHD | SHDA/portfolio/portfolio.py | .py | 39fe3bc6e868e570 | 7.42 | 6 |
"""
This module is called after project is created.
From pydanny's cookiecutter-django:
https://github.com/pydanny/cookiecutter-django
"""
import os
import textwrap
# Get the root project directory:
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
PROJECT_NAME = "{{ cookiecutter.project_name }}"
LINTER = "{{ co... | yakimka/cookiecutter-pyproject | hooks/post_gen_project.py | .py | 6050f905f7389292 | 7.45 | 7 |
"""
Does some basic tests on the generated project.
Almost completely taken from (you guys rock!):
https://github.com/pydanny/cookiecutter-django/blob/master/tests
"""
import os
import re
import pytest
import tomlkit
from binaryornot.check import is_binary
from cookiecutter.exceptions import FailedHookException
RE_... | yakimka/cookiecutter-pyproject | tests/test_project_generation.py | .py | 82a9547882ec4d7a | 7.95 | 7 |
"""CRC hash generation for name table.
Notes:
Converted UE4's codes (Crc.cpp, etc.) to python.
https://github.com/EpicGames/UnrealEngine
"""
import struct
CRCTable_DEPRECATED = [
0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005,
0x2608EDB8, 0x22C9F00F, 0... | Lakifume/True-Randomization | Tools/UE4DDSTools/unreal/crc.py | .py | 2d10404df219e1ab | 7.6 | 15 |
"""Class for version info.
Notes:
Variables:
base: Base version like 1.2, 2.3.0.
base_int: Base version as int. 1 will be 10000. 4.27 will be 42700. 5.0.2 will be 50002.
custom: custom string for customized version.
Operators:
==, !=, in: Comparison operators for base and custom... | Lakifume/True-Randomization | Tools/UE4DDSTools/unreal/version.py | .py | d31191e24107ba44 | 7.6 | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.