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 |
|---|---|---|---|---|---|---|
"""Support for EPA (Victoria) Air Quality Sensors."""
from datetime import datetime as dt
from enum import Enum
import logging
import traceback
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import (
... | BJReplay/EPA_AirQuality_HA | custom_components/epa_victoria_air_quality/sensor.py | .py | f08e9eb149a56a9c | 7.54 | 11 |
"""Tests setup for EPA Victoria Air Quality integration."""
import copy
from typing import Any
from homeassistant.components.epa_victoria_air_quality.const import (
CONF_AQI_SOURCE,
CONF_SITE_ID,
CONF_SITE_NAME,
DEFAULT_AQI_SOURCE,
DOMAIN,
)
from homeassistant.const import CONF_API_KEY
from tests... | BJReplay/EPA_AirQuality_HA | tests/__init__.py | .py | 899b446d39882219 | 7.04 | 11 |
"""Simulated data for EPA Victoria Air Quality integration.
Provides deterministic, realistic EPA air monitoring site and observation data
for use by the WSGI simulator and tests.
Theory of operation:
* Simulated sites represent real EPA Victoria monitoring station types (Standard and Sensor).
* PM2.5 readings vary ... | BJReplay/EPA_AirQuality_HA | tests/simulator/simulate.py | .py | 90cbcba190c9373b | 8.04 | 11 |
"""Tests for the EPA Victoria Air Quality __init__.py."""
from unittest.mock import AsyncMock, MagicMock, patch
from aiohttp.client_exceptions import ClientConnectorError
import pytest
from homeassistant import loader
from homeassistant.components.epa_victoria_air_quality import (
async_migrate_entry,
async_... | BJReplay/EPA_AirQuality_HA | tests/test_init.py | .py | a7d71ac7b3fb392e | 7.04 | 11 |
"""Tests for the EPA Victoria Air Quality sensor platform."""
import importlib
from datetime import datetime as dt
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from homeassistant.components.epa_victoria_air_quality.const import (
ATTR_CONFIDENCE,
ATTR_DATA_SOURCE,
ATTR_TOTAL_SAMPLE... | BJReplay/EPA_AirQuality_HA | tests/test_sensor.py | .py | e6efe36726d90dcf | 7.04 | 11 |
"""
``bundled()`` / ``golang()`` from Koji Provides (Deptopia ``internal/sources/rpm.go``).
Lightweight SPDX 2 document fragments for manifests (packages + DEPENDENCY_OF).
"""
from __future__ import annotations
import hashlib
from dataclasses import dataclass
from typing import Any
LANG_TO_PURL_TYPE: dict[str, str]... | RedHatProductSecurity/security-data-guidelines | sbom/examples/rpm/build/bundled_provides.py | .py | 874968de0548247c | 7.45 | 7 |
#!/usr/bin/env python3
import sys
import argparse
import re
from collections import defaultdict
def parse_args():
parser = argparse.ArgumentParser(description="Generate Kallisto Total index files from FASTA and GTF.")
parser.add_argument('--name', required=True, help="Prefix for output files (e.g., species1)")... | mortazavilab/dogme | scripts/makeKallistoRefs.py | .py | 5acfad6be7894dd5 | 7.62 | 16 |
#!/usr/bin/env python3
"""
software_versions.py
Collects versions of the main tools used in the pipeline and writes them to a
softwareVersion.txt file, similar to the old shell-based softwareVTask.
"""
import argparse
import pathlib
import subprocess
from typing import List
def run_command(cmd: List[str]) -> str:
... | mortazavilab/dogme | scripts/software_versions.py | .py | f13eff3495067cff | 7.62 | 16 |
import re
import typing as t
from pathlib import Path
class Tree:
def __init__(self):
self.__children = []
self.__parent = None
self.__data = None
@property
def data(self) -> t.Optional[str]:
return self.__data
@property
def parent(self) -> t.Optional['Tree']:
... | TrustSource/ts-scan | src/ts_scan/pm/maven/tree_utils.py | .py | 62e70b2ce25d4183 | 7.5 | 9 |
from typing import cast
import datetime
from typing import Any, Generic, TypeVar
import slowstore
T = TypeVar("T")
def _coerce_datetime(value: Any) -> datetime.datetime:
"""A datetime for a change: parse an ISO string (as persisted by
``json_default_serializer``), pass a datetime through, else ``now()``.""... | 42dotmk/slowstore | slowstore/change.py | .py | 4cb233b1712d9ada | 7.54 | 11 |
"""Errors and policies for on-disk change detection.
Lives in its own module (no slowstore imports) so both :mod:`slowstore.store`
and :mod:`slowstore.blob` can use it without an import cycle.
"""
from __future__ import annotations
from typing import Any
class ConflictPolicy:
"""What ``commit`` does when a rec... | 42dotmk/slowstore | slowstore/errors.py | .py | bad756115e876418 | 7.54 | 11 |
from logging import getLogger as get_logger
import sys
import slowstore
from typing import Any, Generic, TypeVar, cast, override
from .change import Change, ChangeKind
from .blob import BlobRef
from .ref import Ref, _is_record
logger = get_logger("SLOWSTORE")
T = TypeVar("T")
__special_fields__ = [
"store",
... | 42dotmk/slowstore | slowstore/proxy.py | .py | c6516e1bd2636e49 | 7.54 | 11 |
"""A shared catalog of stores so references can be resolved and joined.
Every :class:`~slowstore.store.Store` that participates in cross-collection
references registers itself into a ``Registry`` under its collection name. A
:class:`~slowstore.ref.Ref` resolves through the registry, and the registry
provides a minima... | 42dotmk/slowstore | slowstore/registry.py | .py | b42f1329c9d92021 | 7.54 | 11 |
import dataclasses
import datetime
import decimal
import enum
import uuid
from functools import wraps
from typing import Any, Callable, cast
import slowstore
def json_default_serializer(o: Any):
"""``json.dumps(default=...)`` hook for record writes.
Handles the rich types that commonly appear in models; anyth... | 42dotmk/slowstore | slowstore/utils.py | .py | 2de68dbb17b94dd5 | 7.54 | 11 |
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Validate Copilot CLI skills against the Agent Skills specification.
"""
from __future__ import annotations
import os
import re
import sys
from dataclasses import dataclass, field
from pathlib import Path
try:
impo... | Azure/sap-automation-qa | .github/skills/_validation/validate_skills.py | .py | f45a3ba1b666681c | 7.59 | 14 |
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Validate SAP Testing Automation Framework workspace configurations.
"""
from __future__ import annotations
import os
import re
import subprocess
import sys
from dataclasses import dataclass, field
from pathlib import P... | Azure/sap-automation-qa | .github/skills/workspace-validator/scripts/validate_workspace.py | .py | b5396757c9aa20e5 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Health check endpoints."""
from datetime import datetime, timezone
from typing import Dict
from fastapi import APIRouter
from pydantic import BaseModel
router = APIRouter(tags=["health"])
_service_status: Dict[str, bool] = {}
class HealthR... | Azure/sap-automation-qa | src/api/routes/health.py | .py | 14e512e8b7903777 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Jobs API routes
"""
from pathlib import Path
from typing import Optional
from fastapi import APIRouter, HTTPException, Query
from fastapi.responses import PlainTextResponse
from src.api.routes.workspaces import _load_workspaces_from_director... | Azure/sap-automation-qa | src/api/routes/jobs.py | .py | 5c2ad90c7475b7ed | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Schedules API routes."""
from datetime import datetime, timezone
from typing import Optional
from apscheduler.triggers.cron import CronTrigger
from fastapi import APIRouter, HTTPException, Query
from src.api.routes.jobs import get_job_store
f... | Azure/sap-automation-qa | src/api/routes/schedules.py | .py | 2071b77fe9fae2d1 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Workspaces API routes."""
import os
import re
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional
import yaml
from fastapi import APIRouter, HTTPException
from src.core.observability import get_logger
from src.core... | Azure/sap-automation-qa | src/api/routes/workspaces.py | .py | 0e63575ff52e602e | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Test executor interface and implementations.
"""
import json
import os
import signal
import subprocess
import threading
from pathlib import Path
from dataclasses import asdict
from typing import Any, Optional, Protocol
from src.module_utils.... | Azure/sap-automation-qa | src/core/execution/executor.py | .py | e54719bbb8483587 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
SSH credential provisioning from Azure Key Vault or local files.
"""
from __future__ import annotations
import os
import stat
import tempfile
from pathlib import Path
from typing import Any, Optional
from urllib.parse import urlparse
from az... | Azure/sap-automation-qa | src/core/execution/ssh_provider.py | .py | 06f29b103d4de0be | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Job execution models."""
from datetime import datetime
from enum import Enum
from typing import Any, Optional, List
from uuid import UUID, uuid4
from pydantic import BaseModel, Field, ConfigDict
class JobStatus(str, Enum):
"""Status of ... | Azure/sap-automation-qa | src/core/models/job.py | .py | 49fa67ac7508ab56 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Schedule configuration models."""
from datetime import datetime, timezone
from typing import List, Optional
from uuid import uuid4
from pydantic import BaseModel, ConfigDict, Field
def _utcnow() -> datetime:
"""Return timezone-aware UT... | Azure/sap-automation-qa | src/core/models/schedule.py | .py | 7e1e314289f7510b | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""SSH credential models."""
from __future__ import annotations
import logging
import os
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional
logger = logging.getLogger(__name__)
class AuthType(Enum):
... | Azure/sap-automation-qa | src/core/models/ssh.py | .py | 2c8363f79ab70fcc | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Telemetry configuration model."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Optional
_SERVICE_LOG_TABLE_SUFFIX = "ServiceLogs"
@dataclass(frozen=True)
class TelemetryConfig:
"""
Immutab... | Azure/sap-automation-qa | src/core/models/telemetry.py | .py | 8adc33c5c1c91d3b | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Workspace models."""
from typing import List
from pydantic import BaseModel
class WorkspaceInfo(BaseModel):
"""Workspace information."""
id: str
name: str
environment: str = ""
path: str = ""
class WorkspaceListRespon... | Azure/sap-automation-qa | src/core/models/workspace.py | .py | 368eea870db898a0 | 7.09 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Request context management using ContextVars.
Thread-safe, async-compatible context propagation for observability.
"""
from __future__ import annotations
import uuid
from contextvars import ContextVar, Token
from dataclasses import dataclass
... | Azure/sap-automation-qa | src/core/observability/context.py | .py | c0127f5beff70b05 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Typed event definitions for structured logging.
"""
from __future__ import annotations
from datetime import datetime, timezone
from enum import Enum
from typing import Any, Literal, Optional
from pydantic import BaseModel, ConfigDict, Field... | Azure/sap-automation-qa | src/core/observability/events.py | .py | 168cb91255cf6f03 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Structured logging with OOP design.
"""
from __future__ import annotations
import json
import logging
import os
import sys
from abc import ABC, abstractmethod
from datetime import datetime, timezone
from logging.handlers import RotatingFileHa... | Azure/sap-automation-qa | src/core/observability/logger.py | .py | 552ba6532ebb7eb5 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
FastAPI middleware for observability.
"""
from __future__ import annotations
import time
import uuid
from typing import Any, Optional
from fastapi import Request, Response
from starlette.middleware.base import BaseHTTPMiddleware, RequestRespo... | Azure/sap-automation-qa | src/core/observability/middleware.py | .py | 0d782ac95a39e145 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Remote telemetry log handlers with async background batching.
"""
from __future__ import annotations
import json
import logging
import os
import queue
import threading
import time
from abc import abstractmethod
from datetime import datetime,... | Azure/sap-automation-qa | src/core/observability/telemetry_handlers.py | .py | cb31c7ad167bcd82 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Cron-based scheduler service for automated test execution."""
import asyncio
from datetime import datetime, timezone
from typing import Optional
from apscheduler.triggers.cron import CronTrigger
from src.core.models.job import Job
from src.co... | Azure/sap-automation-qa | src/core/services/scheduler.py | .py | 5b14ba692d0e7645 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""SQLite-based storage for jobs."""
import json
import sqlite3
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import List, Optional
from uuid import UUID
from src.core.models.job import Job, JobStatus
f... | Azure/sap-automation-qa | src/core/storage/job_store.py | .py | 7e8df27669137032 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""SQLite-based storage for schedules."""
import json
import sqlite3
from datetime import datetime, timezone
from pathlib import Path
from typing import List, Optional
from src.core.models.schedule import Schedule
from src.core.observability im... | Azure/sap-automation-qa | src/core/storage/schedule_store.py | .py | ff7e989235e432d4 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Parameter computation helpers for Azure Backup HANA reports.
"""
from typing import Any, Dict, List
try:
from src.module_utils.enums import TestStatus, Parameters
except ImportError:
from ansible.module_utils.enums import TestStatus... | Azure/sap-automation-qa | src/module_utils/backup_parameters.py | .py | 4692917f6a3e0835 | 7.59 | 14 |
"""
This module defines various enumerations and data classes used throughout the sap-automation-qa
"""
from enum import Enum
from typing import Dict, Any, List, Optional
from datetime import datetime
class TelemetryDataDestination(Enum):
"""
Enum for the destination of the telemetry data.
"""
KUSTO... | Azure/sap-automation-qa | src/module_utils/enums.py | .py | 557644efce314ec0 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Base class for cluster status checking implementations.
"""
import logging
from abc import abstractmethod
import xml.etree.ElementTree as ET
from datetime import datetime
from typing import Dict, Any
try:
from ansible.module_utils.sap_a... | Azure/sap-automation-qa | src/module_utils/get_cluster_status.py | .py | fd9a370e35076bd0 | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
This module is used to setup the context for the test cases
and setup base variables for the test case running in the sap-automation-qa
"""
from abc import ABC
import sys
import logging
import subprocess
import traceback
from typing import O... | Azure/sap-automation-qa | src/module_utils/sap_automation_qa.py | .py | 965a4c9162f20c9a | 7.59 | 14 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Module to display a summary of test results at the end of playbook execution.
Shows aggregated pass/fail/info counts per test case, and for ha-config tests
displays specific FAILED parameters.
"""
import json
import logging
import os
from co... | Azure/sap-automation-qa | src/modules/display_test_summary.py | .py | d0ff8515015d7d16 | 8.09 | 14 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Utility module designed to support shared logic across AWS Span Processors."""
import json
import os
from typing import Dict, List
from urllib.parse import ParseResult, urlparse
from amazon.opentelemetry.distr... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_span_processing_util.py | .py | 850059778a1a7b08 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import os
from importlib.metadata import PackageNotFoundError, version
from logging import Logger, getLogger
from typing import Optional
from packaging.requirements import Requirement
_logger: Logger = getLogge... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_utils.py | .py | 78ffbc3c5d453a85 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from logging import Logger, getLogger
from typing import Optional, Sequence
from typing_extensions import override
from opentelemetry.context import Context
from opentelemetry.sdk.trace.sampling import Decision,... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/always_record_sampler.py | .py | 7efcc59472df7d86 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from typing import Callable, Optional, Tuple
from typing_extensions import override
from amazon.opentelemetry.distro._aws_attribute_keys import (
AWS_CONSUMER_PARENT_SPAN_KIND,
AWS_SDK_DESCENDANT,
AW... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/attribute_propagating_span_processor.py | .py | f5cd824927845ceb | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from typing import Callable, List, Tuple
from amazon.opentelemetry.distro._aws_attribute_keys import (
AWS_LOCAL_OPERATION,
AWS_REMOTE_OPERATION,
AWS_REMOTE_SERVICE,
)
from amazon.opentelemetry.distro... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/attribute_propagating_span_processor_builder.py | .py | e096d77b06766cc7 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from typing import List, Sequence, TypeVar
from typing_extensions import override
from amazon.opentelemetry.distro._aws_attribute_keys import AWS_SPAN_KIND
from amazon.opentelemetry.distro._aws_span_processing_u... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_metric_attributes_span_exporter.py | .py | 52d615f577e7bb68 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from amazon.opentelemetry.distro._aws_metric_attribute_generator import _AwsMetricAttributeGenerator
from amazon.opentelemetry.distro.aws_metric_attributes_span_exporter import AwsMetricAttributesSpanExporter
from... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_metric_attributes_span_exporter_builder.py | .py | 70ffaff4d3853a18 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from typing import Callable, Dict, Optional
from typing_extensions import override
from amazon.opentelemetry.distro._aws_attribute_keys import AWS_REMOTE_SERVICE
from amazon.opentelemetry.distro._aws_span_proces... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_span_metrics_processor.py | .py | c531d1a74915df32 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from typing import Optional
from amazon.opentelemetry.distro._aws_metric_attribute_generator import _AwsMetricAttributeGenerator
from amazon.opentelemetry.distro.aws_span_metrics_processor import AwsSpanMetricsPr... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_span_metrics_processor_builder.py | .py | 64bbf1a6960c6656 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Code Attributes Span Processor implementation for OpenTelemetry Python.
This processor captures stack traces and attaches them to spans as attributes.
It's based on the OpenTelemetry Java contrib StackTraceS... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/code_correlation/code_attributes_span_processor.py | .py | caf938e69e481ed8 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Configuration management for AWS OpenTelemetry code correlation features.
This module provides a configuration class that handles environment variable
parsing for code correlation settings, including package... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/code_correlation/config.py | .py | 423a4bb9f6b96319 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Package discovery and classification module for OpenTelemetry code correlation.
This module provides utilities to:
- Classify Python code as standard library, third-party, or user code
- Map file paths to th... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/code_correlation/internal/packages_resolver.py | .py | 6e20a2546571fb2a | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Utility functions for code correlation in AWS OpenTelemetry Python Instrumentation.
This module contains the core functionality for extracting and correlating
code metadata with telemetry data.
"""
import f... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/code_correlation/utils.py | .py | 59ade231411ae98c | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Per-instrumentation rate limiter using a fixed-window token bucket algorithm.
Limits the number of snapshot captures per second for a single instrumentation
configuration (probe or breakpoint). This prevents h... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/debugger/_capture_rate_limiter.py | .py | b13a8696505343ee | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Snapshot data models for Dynamic Instrumentation.
Implements the AWS DI Snapshot Specification v1.0.
Snapshots replace OTel Spans as the output signal for DI.
"""
import uuid
from dataclasses import datacla... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/debugger/_snapshot_models.py | .py | d1f037468a9d747f | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
OTLP LogRecord emitter for DI snapshots.
Converts Snapshot objects into structured OTLP LogRecords with:
- Flat attributes (queryable in CloudWatch Logs Insights)
- Structured body (stack + captures as neste... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/debugger/_snapshot_otlp_emitter.py | .py | 0f55e715ef18e10a | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Variable serializer for Snapshot CapturedValue format.
Replaces the flat span-attribute serialization with the recursive
CapturedValue tree structure defined in the Snapshot v1 spec.
"""
import itertools
im... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/debugger/_snapshot_serializer.py | .py | fe649aa7f1283157 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Shared stack trace utilities for Dynamic Instrumentation."""
import inspect
import logging
from typing import List
from amazon.opentelemetry.distro.debugger._snapshot_models import StackFrame
logger = loggi... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/debugger/_stack_utils.py | .py | 3766bafd45d5fb4b | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Main entry point for the refactored debugger.
This module provides a simple facade for initializing and managing the debugger,
including environment variable configuration and lifecycle management.
"""
impo... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/debugger/debugger.py | .py | 84124b82aac3c241 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# pylint: disable=no-self-use
import logging
from typing import Any, Dict, Optional
from opentelemetry.sdk.metrics.export import AggregationTemporality
from .base_emf_exporter import BaseEmfExporter
logger = ... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/exporter/aws/metrics/console_emf_exporter.py | .py | 992ff5428b7df9c7 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import json
import logging
import os
import re
import sys
from typing import IO, Sequence
try:
from opentelemetry.sdk._logs.export import LogRecordExportResult as LogExportResult
except ImportError:
from ... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/exporter/console/logs/compact_console_log_exporter.py | .py | c60f2b1f84ff16b0 | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""SigV4 credential provider for the upstream OTel SDK credential-provider hook.
Registered under the ``opentelemetry_otlp_credential_provider`` entry point as
``aws_sigv4``. Selected by setting any of (Python S... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/exporter/otlp/aws/common/aws_sigv4_session_factory.py | .py | 57c2ea003e9210ee | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# Modifications Copyright The OpenTelemetry Authors. Licensed under the Apache License 2.0 License.
import logging
from typing import Mapping, Optional, Sequence, cast
from amazon.opentelemetry.distro.exporter.o... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/exporter/otlp/aws/logs/_aws_cw_otlp_batch_log_record_processor.py | .py | 51b274028dfe2dce | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# Modifications Copyright The OpenTelemetry Authors. Licensed under the Apache License 2.0 License.
import gzip
import logging
import random
from io import BytesIO
from threading import Event
from time import tim... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/exporter/otlp/aws/logs/otlp_aws_log_record_exporter.py | .py | 2a5fe5392285318c | 7.56 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import logging
from typing import Dict, Optional, Sequence
from botocore.session import Session
from amazon.opentelemetry.distro._utils import is_agent_observability_enabled, is_genai_content_extraction_opted_o... | aws-observability/aws-otel-python-instrumentation | aws-opentelemetry-distro/src/amazon/opentelemetry/distro/exporter/otlp/aws/traces/otlp_aws_span_exporter.py | .py | 1f0f05a947197eb4 | 7.56 | 12 |
import unittest
from edugraph import (
Area, Scope, Ability, relations,
structures, structured_by, specializes, specialized_by,
part_of, expands, part_of_transitive, structures_transitive, specializes_transitive, definition,
implies, implies_transitive, contradicts, deduct_compatible, deduct_admitting, ... | christian-bick/edugraph-ontology | libraries/python/test_relations.py | .py | 19cff3271906b646 | 7.1 | 15 |
import {
Area, Scope, Ability, relations,
structures, structuredBy, partOfTransitive, specializes, specializedBy,
structuresTransitive, specializesTransitive,
expands, definition, implies, impliesTransitive, contradicts,
deductCompatible, deductAdmitting, incompatible
} from "./index";
console.log("🧪 Runnin... | christian-bick/edugraph-ontology | libraries/typescript/test.ts | .ts | 23f9faa7464fc0a8 | 7.1 | 15 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
In-tree PEP 517 build backend that wraps `maturin` to inject a
VCS-derived version.
Why this exists: maturin reads the wheel version from
`[project].version` in pyproject.toml (or `[package].version` in
Cargo.toml when `dynamic = ["version"]` is ... | OpenJobDescription/openjd-model-for-python | _build_backend.py | .py | babc64bf514d4dc8 | 7.6 | 15 |
#!/usr/bin/env python3
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
Generate src/openjd/model/_version.py from the git VCS state.
The openjd-model-for-python build backend is maturin, which does not
run hatchling build hooks. This means the `[tool.hatch.build.hooks.vcs]`
mechanism that norm... | OpenJobDescription/openjd-model-for-python | scripts/generate_version.py | .py | 26734dab88b0f59f | 7.6 | 15 |
#!/usr/bin/env python3
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
Build the openjd-model wheel/extension via maturin with a VCS-derived
version string.
maturin reads the wheel version from `[project].version` in
pyproject.toml, or — when `[project].dynamic` lists "version" — from
`[packag... | OpenJobDescription/openjd-model-for-python | scripts/maturin_build.py | .py | b33bc02aed841f7f | 7.6 | 15 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from typing import Sequence, Union
import re
from ._format_strings import FormatString
_name_regex: re.Pattern = re.compile(
r"^(?:[a-z_][a-z0-9_]+:)?(?:amount|attr)(?:\.[a-z_][a-z0-9_]*)+$"
)
_reserved_scopes = ("worker", "job", "step", "task... | OpenJobDescription/openjd-model-for-python | src/openjd/model/_capabilities.py | .py | d8f5e7afa54e7631 | 7.6 | 15 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from typing import Type, Union
from pydantic import BaseModel
from pydantic_core import ErrorDetails
from inspect import getmodule
def pydantic_validationerrors_to_str(
root_model: Type[BaseModel], errors: list[ErrorDetails]
) -> str:
"""Th... | OpenJobDescription/openjd-model-for-python | src/openjd/model/_convert_pydantic_error.py | .py | 19fe4e4528f35d28 | 7.6 | 15 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
__all__ = [
"CompatibilityError",
"DecodeValidationError",
"ExpressionError",
"ModelValidationError",
"TokenError",
"UnsupportedSchema",
]
class UnsupportedSchema(ValueError):
"""Error raised when an attempt is made to d... | OpenJobDescription/openjd-model-for-python | src/openjd/model/_errors.py | .py | 6b468a4d16b4d5c2 | 7.6 | 15 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from array import array
def closest(symbols: set[str], match: str) -> tuple[int, set[str]]:
"""Return the set of symbols that most closely match the given match symbol.
Returns:
tuple[int, set[str]]
- [0]: Distance from... | OpenJobDescription/openjd-model-for-python | src/openjd/model/_format_strings/_edit_distance.py | .py | 9bad45df279411ec | 7.6 | 15 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Support for the EXPR extension (RFCs 0005/0006/0007) in the pure-Python
(v0) model.
The pure-Python model does not implement the EXPR expression grammar. When a
template declares the ``EXPR`` extension, format-string expressions are parsed
and ev... | OpenJobDescription/openjd-model-for-python | src/openjd/model/_format_strings/_expr_support.py | .py | a583055c75d6f4a5 | 7.6 | 15 |
"""This script is copied and adapted from
https://github.com/astral-sh/rye/blob/main/rye-devtools/
Licensed under the MIT.
It finds the latest Python releases, sorts them by
various factors (arch, platform, flavor) and generates download
links to be included into rye at build time.
"""
from __future__ import annota... | frostming/pbs-installer | scripts/find_versions.py | .py | 61e6f022a204a223 | 7.62 | 16 |
# Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pydynamicreporting | src/ansys/dynamicreporting/core/common_utils.py | .py | a5c3c667d2c7b005 | 7.56 | 12 |
# Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pydynamicreporting | src/ansys/dynamicreporting/core/compatibility.py | .py | 8ab9aa4f0c718e55 | 7.56 | 12 |
# Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pydynamicreporting | src/ansys/dynamicreporting/core/examples/downloads.py | .py | ab14df93c342edc6 | 7.56 | 12 |
# Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pydynamicreporting | src/ansys/dynamicreporting/core/serverless/_compat.py | .py | 241e4d2e3e93e67c | 7.56 | 12 |
# Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pydynamicreporting | src/ansys/dynamicreporting/core/utils/encoders.py | .py | f7c7b6ce45435773 | 7.56 | 12 |
# Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pydynamicreporting | src/ansys/dynamicreporting/core/utils/html_export_mathjax.py | .py | ce4a6b9a8a85c6a4 | 7.56 | 12 |
"""Config flow for mysql_query integration."""
from __future__ import annotations
import logging
from typing import Any
from aiomysql import Error
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigFlowResult
from homeassistant.core import callback
from... | IAsDoubleYou/homeassistant-mysql_query | custom_components/mysql_query/config_flow.py | .py | 723a7643e3ba5dad | 7.59 | 14 |
"""Database plumbing shared by the config flow and the integration setup."""
from __future__ import annotations
from collections.abc import Mapping
import logging
import re
import ssl
from typing import Any
import aiomysql
from .const import (
CONF_AUTOCOMMIT,
CONF_MYSQL_CHARSET,
CONF_MYSQL_COLLATION,
... | IAsDoubleYou/homeassistant-mysql_query | custom_components/mysql_query/db.py | .py | 8ce556a302f0aa9e | 7.59 | 14 |
"""Classification of the SQL a service call carries.
The driver decides nothing here: aiomysql turns on CLIENT.MULTI_STATEMENTS
unconditionally and offers no way to turn it off, so "one call, one statement"
has to be established before the statement is handed over. Everything in this
module works on the text alone and... | IAsDoubleYou/homeassistant-mysql_query | custom_components/mysql_query/sql.py | .py | 566c20136b06db90 | 7.59 | 14 |
"""Build the Home Assistant brand images from the raw artwork.
Sources (repository root): icon_raw.jpeg, logo_raw.jpeg
Outputs go to custom_components/mysql_query/brand/, which Home Assistant 2026.3+ reads
directly; local brand images take priority over the brands CDN. Sizes follow the
home-assistant/brands conventio... | IAsDoubleYou/homeassistant-mysql_query | scripts/build_brands.py | .py | da64aaba04d11cd7 | 7.59 | 14 |
"""No-op stand-in for the POSIX-only stdlib ``fcntl`` module.
Home Assistant's ``runner.py`` unconditionally imports ``fcntl`` for PID-file
locking, which only happens when HA runs as a full daemon - never during
these component-level unit tests. This shim lets the import succeed when
running the test suite on Windows... | IAsDoubleYou/homeassistant-mysql_query | tests/_win_shims/fcntl.py | .py | 1af5fedbc21e8d90 | 7.09 | 14 |
"""No-op stand-in for the POSIX-only stdlib ``resource`` module.
homeassistant.util.resource imports this to raise the open file descriptor
limit at daemon startup - never exercised during these component-level unit
tests. See fcntl.py in this same directory for the full rationale.
"""
from __future__ import annotati... | IAsDoubleYou/homeassistant-mysql_query | tests/_win_shims/resource.py | .py | 6ef5ad03954a50d5 | 8.09 | 14 |
"""Fixtures for mysql_query tests."""
from __future__ import annotations
from collections.abc import Awaitable, Callable, Sequence
import socket
import sys
from typing import Any
from unittest.mock import AsyncMock, patch
import pytest
# On Linux/macOS (e.g. CI) this file isn't needed: the stdlib "fcntl" module
# t... | IAsDoubleYou/homeassistant-mysql_query | tests/conftest.py | .py | e586db35ee9c65c3 | 8.09 | 14 |
"""Tests for the shared database helpers."""
from __future__ import annotations
import ssl
from unittest.mock import AsyncMock, patch
from aiomysql import Error as MySQLError
import pytest
from custom_components.mysql_query.const import (
CONF_AUTOCOMMIT,
CONF_MYSQL_CHARSET,
CONF_MYSQL_COLLATION,
CO... | IAsDoubleYou/homeassistant-mysql_query | tests/test_db.py | .py | 958b10101ca5ed5f | 8.09 | 14 |
"""Tests for converting MySQL column values into JSON-serialisable data."""
from __future__ import annotations
from datetime import date, datetime, time, timedelta
from decimal import Decimal
import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry
from homeassistant.core import HomeAs... | IAsDoubleYou/homeassistant-mysql_query | tests/test_json_serialization.py | .py | afcb2c8bf85905c4 | 8.09 | 14 |
"""Tests for the connection pool and the per-entry concurrency lock."""
from __future__ import annotations
import asyncio
from unittest.mock import AsyncMock, patch
from aiomysql import Error as MySQLError
import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry
from homeassistant.core... | IAsDoubleYou/homeassistant-mysql_query | tests/test_pool_and_lock.py | .py | 64d6a16c4c0718aa | 7.09 | 14 |
"""Tests for the statement classifier behind the query/execute split."""
from __future__ import annotations
import pytest
from custom_components.mysql_query.sql import (
first_keyword,
is_read_only,
split_statements,
strip_comments,
unwrap_prefixes,
)
@pytest.mark.parametrize(
("statement",... | IAsDoubleYou/homeassistant-mysql_query | tests/test_sql.py | .py | 32f1a21dad06c62f | 8.09 | 14 |
from __future__ import annotations
from enum import IntEnum
from typing import TYPE_CHECKING
from construct import (
Array,
Byte,
Bytes,
Const,
Default,
Enum,
Error,
FlagsEnum,
Hex,
If,
Int16ub,
Int16ul,
Int32ul,
PaddedString,
Pass,
Struct,
Switch,
)... | morian/aio-ld2410 | aio_ld2410/protocol/command.py | .py | 8ff8a827a29cb625 | 7.45 | 7 |
from __future__ import annotations
from enum import IntEnum, IntFlag
from construct import Array, Byte, Const, Enum, If, Int16ul, Struct
from .command import OutPinLevel
class ReportType(IntEnum):
"""Type of report we received."""
#: Advanced report with per-gate values.
ENGINEERING = 1
#: Basic ... | morian/aio-ld2410 | aio_ld2410/protocol/report.py | .py | 3cb3c23a2147cf92 | 7.45 | 7 |
from __future__ import annotations
import io
import logging
from typing import TYPE_CHECKING, Any, ClassVar
from construct import GreedyRange
from .protocol import FRAME_HEADER_COMMAND, FRAME_HEADER_REPORT, Frame, FrameHeader
if TYPE_CHECKING:
from collections.abc import Iterator
from construct import Cont... | morian/aio-ld2410 | aio_ld2410/stream.py | .py | efe2c0551c14038b | 7.45 | 7 |
from __future__ import annotations
import asyncio
import json
import logging
from asyncio import Event, Lock
from contextlib import AsyncExitStack, suppress
from dataclasses import asdict, is_dataclass
from enum import IntEnum
from random import randrange
from typing import TYPE_CHECKING, Any
import dacite
from aio_... | morian/aio-ld2410 | tests/emulator/device.py | .py | 82dd21f3076eeb15 | 7.95 | 7 |
from __future__ import annotations
import copy
from collections.abc import Mapping
from dataclasses import dataclass, field
from enum import IntEnum, auto
from typing import Any
from aio_ld2410 import (
ConfigModeStatus,
FirmwareVersion,
LightControl,
LightControlStatus,
OutPinLevel,
Parameter... | morian/aio-ld2410 | tests/emulator/models.py | .py | 6d24051b2baae977 | 7.95 | 7 |
from __future__ import annotations
from asyncio import start_unix_server
from typing import TYPE_CHECKING
from anyio import TASK_STATUS_IGNORED
from .device import EmulatedDevice
if TYPE_CHECKING:
from asyncio import StreamReader, StreamWriter
from anyio.abc import TaskStatus
class EmulatorServer:
""... | morian/aio-ld2410 | tests/emulator/server.py | .py | 93ddf0012d33c146 | 7.95 | 7 |
from __future__ import annotations
import asyncio
import json
import logging
# Python 3.9 and lower have a distinct class for asyncio.TimeoutError.
from asyncio import (
StreamReader,
StreamWriter,
TimeoutError as AsyncTimeoutError,
)
from dataclasses import asdict
import pytest
from aio_ld2410 import (... | morian/aio-ld2410 | tests/test_ld2410.py | .py | 4d7152b1a3e339f4 | 7.95 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.