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 |
|---|---|---|---|---|---|---|
"""Initial database model
Revision ID: 53986072f514
Revises:
Create Date: 2022-02-08 18:30:17.637824
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "53986072f514"
down_revision = None
branch_labels = None
depends_on = None... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/53986072f514_initial_database_model.py | .py | 0a283c081f7ce898 | 7.62 | 16 |
"""add_osm_tables
Revision ID: 56498dd756d0
Revises: 53986072f514
Create Date: 2022-02-15 17:14:11.834385
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "56498dd756d0"
down_revision = "b30396e4f842"
branch_labels = None
de... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/56498dd756d0_add_osm_tables.py | .py | 66f4f843726b6e70 | 7.62 | 16 |
"""add nature conservation areas
Revision ID: 65bd3f48f528
Revises: ae776f283429
Create Date: 2022-03-30 18:02:09.458178
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "65bd3f48f528"
down_revision = "ae776f283429"
branch_l... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/65bd3f48f528_add_nature_conservation_areas.py | .py | e28da79dc2321863 | 7.62 | 16 |
"""adjust arcrest tables for loader
Revision ID: 68c9b9ed3e26
Revises: ae776f283429
Create Date: 2022-04-01 13:46:33.391394
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "68c9b9ed3e26"
down_revision = "65bd3f48f528"
branc... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/68c9b9ed3e26_adjust_arcrest_tables_for_loader.py | .py | 0259dc99d76addbc | 7.62 | 16 |
"""add viivat name index
Revision ID: 6b21865a7058
Revises: 7443e8ba2d75
Create Date: 2022-06-23 17:43:15.729442
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "6b21865a7058"
down_revision = "7443e8ba2d75"
branch_labels = ... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/6b21865a7058_add_viivat_name_index.py | .py | c7dc16e7615cab39 | 7.62 | 16 |
"""remove recycling
Revision ID: 6f5b710cf21f
Revises: 1db9f62f20fd
Create Date: 2026-03-20 19:45:06.165713
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "6f5b710cf21f"
down_revision = "1db9f62f20fd"
branch_labels = None
... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/6f5b710cf21f_remove_recycling.py | .py | ea996a9b3ce47304 | 7.62 | 16 |
"""add missing table name to cluster partition
Revision ID: 7174bce9e6d1
Revises: 3df1bb2d0c9b
Create Date: 2022-08-11 12:16:26.890675
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "7174bce9e6d1"
down_revision = "3df1bb2d... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/7174bce9e6d1_add_missing_table_name_to_cluster_.py | .py | 4dac34b867cc0cb6 | 7.62 | 16 |
"""remove deleted lipas categories
Revision ID: 73a4b14c26ab
Revises: 3d38553ecec1
Create Date: 2026-01-07 15:34:01.471274
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "73a4b14c26ab"
down_revision = "3d38553ecec1"
branch... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/73a4b14c26ab_remove_deleted_lipas_categories.py | .py | 4c588baca6e3e1e6 | 7.62 | 16 |
"""add talviuinti category
Revision ID: 7443e8ba2d75
Revises: 4d9aaf970735
Create Date: 2022-06-21 16:31:08.310790
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "7443e8ba2d75"
down_revision = "4d9aaf970735"
branch_labels ... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/7443e8ba2d75_add_talviuinti_category.py | .py | 95b68766bcb00a8a | 7.62 | 16 |
"""add_rest_of_external_data
Revision ID: 7bd932e00b99
Revises: b30396e4f842
Create Date: 2022-02-22 14:25:09.480762
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "7bd932e00b99"
down_revision = "56498dd756d0"
branch_label... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/7bd932e00b99_add_rest_of_external_data_and_rename_old_tables.py | .py | 77b76d25f012eb65 | 7.62 | 16 |
"""add osm categories; add osm and rky alueet to all points
Revision ID: 7d8ba4b179f5
Revises: 7174bce9e6d1
Create Date: 2022-08-15 17:42:02.490518
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "7d8ba4b179f5"
down_revisio... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/7d8ba4b179f5_add_osm_categories_add_osm_and_rky_.py | .py | 1f18fb9600d6888c | 7.62 | 16 |
"""remove wfs luontopolut
Revision ID: 850af1d21f5e
Revises: 23de797a5de0
Create Date: 2022-05-05 12:04:27.010492
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "850af1d21f5e"
down_revision = "23de797a5de0"
branch_labels =... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/850af1d21f5e_remove_wfs_luontopolut.py | .py | d57703de82ab8183 | 7.62 | 16 |
"""refine databasemodel
Revision ID: 8832d7a1b5fb
Revises: 1dc4ac9953cb
Create Date: 2022-03-18 09:43:55.350402
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "8832d7a1b5fb"
down_revision = "959c5af94dc2"
branch_labels = N... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/8832d7a1b5fb_refine_databasemodel.py | .py | d27cf95aa303f9f8 | 7.62 | 16 |
"""remove luontopolkurasti constraint
Revision ID: 893d0d773706
Revises: 472d0f3f0d65
Create Date: 2022-06-14 12:49:07.290529
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "893d0d773706"
down_revision = "472d0f3f0d65"
bra... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/893d0d773706_remove_luontopolkurasti_constraint.py | .py | e24eeeb5f2294278 | 7.62 | 16 |
"""fix constraint name based on db state
Revision ID: 95144b48054e
Revises: 25c1d1309c6d
Create Date: 2022-02-28 15:22:12.158130
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "95144b48054e"
down_revision = "25c1d1309c6d"
... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/95144b48054e_fix_constraint_name_based_on_db_state.py | .py | 892786baa49b44a4 | 7.62 | 16 |
"""fix lipas metadata table migration
Revision ID: 959c5af94dc2
Revises: 1dc4ac9953cb
Create Date: 2022-03-29 12:18:25.153070
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "959c5af94dc2"
down_revision = "1dc4ac9953cb"
bra... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/959c5af94dc2_fix_lipas_metadata_table_migration.py | .py | 0db0744a9d552eca | 7.62 | 16 |
"""fix random field values in all_points layer
Revision ID: 9f3e55c9d75f
Revises: 37a74b19144f
Create Date: 2022-10-07 15:36:44.925469
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "9f3e55c9d75f"
down_revision = "37a74b19... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/9f3e55c9d75f_fix_random_field_values_in_all_points_.py | .py | aab4961607695ad9 | 7.62 | 16 |
"""add default values to existing rows
Revision ID: ae776f283429
Revises: 8832d7a1b5fb
Create Date: 2022-03-29 16:36:37.968146
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "ae776f283429"
down_revision = "106942da4dcc"
br... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/ae776f283429_add_default_values_to_existing_rows.py | .py | a202cb0f342c6497 | 7.62 | 16 |
"""addLuonnonmuistomerkit
Revision ID: b30396e4f842
Revises: 53986072f514
Create Date: 2022-02-16 16:56:43.000663
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "b30396e4f842"
down_revision = "53986072f514"
branch_labels =... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/b30396e4f842_addluonnonmuistomerkit.py | .py | 7f64de3793dcc502 | 7.62 | 16 |
"""add cityname indexes for filtering
Revision ID: b4eea63fd165
Revises: 850af1d21f5e
Create Date: 2022-05-05 17:39:57.826059
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "b4eea63fd165"
down_revision = "850af1d21f5e"
bra... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/b4eea63fd165_add_cityname_indexes_for_filtering.py | .py | 554d62207b3659eb | 7.62 | 16 |
"""adjust long lipas table names to match lipas type names
Revision ID: ca6838d8e8a5
Revises: 95144b48054e
Create Date: 2022-03-01 17:23:08.153056
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "ca6838d8e8a5"
down_revision... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/ca6838d8e8a5_adjust_long_lipas_table_names_to_match_.py | .py | 50171fd42c9090db | 7.62 | 16 |
"""add cluster views
Revision ID: f10f72c08c61
Revises: b4eea63fd165
Create Date: 2022-05-10 15:12:10.591771
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "f10f72c08c61"
down_revision = "b4eea63fd165"
branch_labels = None... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/f10f72c08c61_add_cluster_views.py | .py | 7f7597dc294b00e7 | 7.62 | 16 |
"""fix rkykohteet primary key name when migrating
Revision ID: fc36bf6bd3ff
Revises: 04aeb1302604
Create Date: 2022-05-16 16:22:25.153917
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "fc36bf6bd3ff"
down_revision = "04aeb... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/fc36bf6bd3ff_fix_rkykohteet_primary_key_name_when_.py | .py | 4d526dba2cbae995 | 7.62 | 16 |
import datetime
import json
from typing import Any, Dict, Optional
import requests
from shapely.geometry import (
LineString,
MultiLineString,
MultiPoint,
MultiPolygon,
Point,
Polygon,
shape,
)
from sqlalchemy.types import BOOLEAN, DATE
from .base_loader import (
LOGGER,
BaseLoader... | GispoCoding/tarmo | backend/lambda_functions/arcgis_loader/arcgis_loader.py | .py | 8be2499d2589e7b3 | 7.62 | 16 |
import datetime
import enum
import json
import logging
import os
from typing import Any, Dict, List, Optional, Type, TypedDict, Union
import boto3
from shapely.geometry import Point
from sqlalchemy import MetaData, create_engine, inspect
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.ext.automap import Aut... | GispoCoding/tarmo | backend/lambda_functions/base_loader/base_loader.py | .py | 33778b4512758a29 | 7.62 | 16 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# Licensed under the Apache2.0. See LICENSE file in charm source for details.
"""Shared OWASP-style security logger utilities.
This module defines a small, dependency-free helper to emit OWASP-inspired
security events in a nested JSON structure that is easy to pa... | canonical/vault-k8s-operator | k8s/.vendored/vault-package/vault/security_logger.py | .py | a9ad217be12c0d41 | 7.54 | 11 |
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
"""Common mocking setup for k8s and machine charm unit tests."""
from __future__ import annotations
import contextlib
from typing import Iterator
from unittest.mock import patch
from charms.data_platform_libs.v0.s3 import S3Requirer
from vau... | canonical/vault-k8s-operator | k8s/.vendored/vault-package/vault/testing/mocks.py | .py | ff5804af7cfc2c1a | 8.04 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# Licensed under the Apache2.0. See LICENSE file in charm source for details.
"""Library for the vault-autounseal relation.
This library contains the Requires and Provides classes for handling the
vault-autounseal interface.
The provider side of the interface is... | canonical/vault-k8s-operator | k8s/.vendored/vault-package/vault/vault_autounseal.py | .py | 19ab4b3e8271f083 | 7.54 | 11 |
"""This library contains helper function used when configuring the Vault service."""
import logging
from dataclasses import dataclass
import os
from typing import Dict, List
import ipaddress
import hcl
from jinja2 import Environment, FileSystemLoader
logger = logging.getLogger(__name__)
@dataclass
class Autounseal... | canonical/vault-k8s-operator | k8s/.vendored/vault-package/vault/vault_helpers.py | .py | 6a0c2ee427d57a6f | 7.54 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# Licensed under the Apache2.0. See LICENSE file in charm source for details.
"""S3 helper functions for Vault charms.
## Usage
Add the following dependencies to the charm's requirements.txt file:
```
boto3
boto3-stubs[s3]
```
"""
import loggin... | canonical/vault-k8s-operator | k8s/.vendored/vault-package/vault/vault_s3.py | .py | 9876016bcb478fa8 | 7.54 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
"""Container abstraction for the Vault charm."""
from typing import TextIO
from ops import Container as OpsContainer
from ops.pebble import PathError
from vault.vault_managers import WorkloadBase
class Container(Worklo... | canonical/vault-k8s-operator | k8s/src/container.py | .py | 06d6de5b6b2e8498 | 7.54 | 11 |
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import logging
import os
import subprocess
from collections.abc import Iterator
from pathlib import Path
import jubilant
import pytest
logger = logging.getLogger(__name__)
# jubilant's default ``wait_timeout`` is 180s, which is too short for s... | canonical/vault-k8s-operator | k8s/tests/integration/conftest.py | .py | 8469e4d6c99b4bec | 8.04 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import contextlib
import logging
import platform
import tempfile
import time
from pathlib import Path
from typing import Any, Dict, Generator, List, Tuple
import hvac
import jubilant
from cryptography import x509
from ligh... | canonical/vault-k8s-operator | k8s/tests/integration/helpers.py | .py | c090a68b6971897f | 8.04 | 11 |
#!/usr/bin/env python3
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
"""Minimal integration test: deploy Vault K8s and unseal it."""
import logging
from pathlib import Path
import jubilant
import pytest
from config import APPLICATION_NAME, JUJU_FAST_INTERVAL
from helpers import (
aut... | canonical/vault-k8s-operator | k8s/tests/integration/test_deploy_unseal.py | .py | 559393feb8569d61 | 7.04 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
"""Vault helper functions."""
import logging
import time
from os.path import abspath
from typing import Tuple
import hvac
import requests
logger = logging.getLogger(__name__)
# Vault status codes, see
# https://develop... | canonical/vault-k8s-operator | k8s/tests/integration/vault_helpers.py | .py | b1d8cd4f25c1e360 | 8.04 | 11 |
#!/usr/bin/env python3
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
"""Test charm for vault-kv."""
import logging
import secrets
from pathlib import Path
from typing import Any
from charms.vault_k8s.v0.vault_kv import VaultKvConnectedEvent, VaultKvReadyEvent, VaultKvRequires
from ops imp... | canonical/vault-k8s-operator | k8s/tests/integration/vault_kv_requirer_operator/src/charm.py | .py | 674227a5c8d32b3b | 8.04 | 11 |
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
"""Vault client."""
import logging
import hvac # type: ignore[import-untyped]
logger = logging.getLogger(__name__)
class VaultClient:
"""Vault client."""
def __init__(
self, url: str, ca_certificate: str, approle_role_id: ... | canonical/vault-k8s-operator | k8s/tests/integration/vault_kv_requirer_operator/src/vault_client.py | .py | 539fcd2d7fb2f0ba | 8.04 | 11 |
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import contextlib
from unittest.mock import patch
import ops.testing as testing
import pytest
from ops.model import ActiveStatus
from vault.testing.mocks import VaultCharmFixturesBase
from charm import VaultCharm
class VaultCharmFixtures(Vau... | canonical/vault-k8s-operator | k8s/tests/unit/fixtures.py | .py | dc3267178b2e9dc3 | 7.04 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import os
import tempfile
import ops.testing as testing
from fixtures import VaultCharmFixtures
class TestCharmInstall(VaultCharmFixtures):
def test_given_existing_data_exists_when_install_then_existing_data_is_rem... | canonical/vault-k8s-operator | k8s/tests/unit/test_charm_install.py | .py | 3260827d453d4e01 | 7.04 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import ops.testing as testing
import pytest
from vault.vault_managers import ManagerError
from fixtures import VaultCharmFixtures
class TestCharmListBackupAction(VaultCharmFixtures):
def test_given_manager_raises_e... | canonical/vault-k8s-operator | k8s/tests/unit/test_charm_list_backups_action.py | .py | c1824763dcfee141 | 7.04 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import os
import tempfile
import ops.testing as testing
from ops.pebble import Layer, ServiceStatus
from fixtures import VaultCharmFixtures
class TestCharmRemove(VaultCharmFixtures):
def test_given_can_connect_whe... | canonical/vault-k8s-operator | k8s/tests/unit/test_charm_remove.py | .py | d0d1512a8472cd2f | 7.04 | 11 |
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import ops.testing as testing
import pytest
import requests
from vault.vault_managers import ManagerError
from fixtures import VaultCharmFixtures
class TestCharmRestoreBackupAction(VaultCharmFixtures):
def test_giv... | canonical/vault-k8s-operator | k8s/tests/unit/test_charm_restore_backup_action.py | .py | b53037f2c5174e28 | 7.04 | 11 |
import click
import rich_click
from .east_context import EastContext, east_group_settings
from .system_commands import connect, init, install, rtt, update
from .workspace_commands import (
attach,
build,
bypass,
clean,
codechecker,
cortex_debug,
debug,
flash,
pack,
release,
... | IRNAS/irnas-east-software | src/east/__main__.py | .py | f61bb17eaca37c3b | 7.54 | 11 |
import os
from typing import Any
import pykwalify.core
import pykwalify.errors
import yaml
from .helper_functions import return_dict_on_match
class EastYmlLoadError(RuntimeError):
"""Some error happened when trying to load east.yml."""
def format_east_yml_load_error_msg(exception_msg):
"""Format error mes... | IRNAS/irnas-east-software | src/east/east_yml.py | .py | 27bb37dd0d3e4a36 | 7.54 | 11 |
import os
import shutil
from typing import Iterator, Sequence
from ..helper_functions import find_app_build_dir
from .artifacts2pack import ArtifactsToPack
from .tsuite import TSuite
class Artifact(object):
"""Artifact object that represents a single artifact that needs to be packed."""
# Source path to the... | IRNAS/irnas-east-software | src/east/modules/artifact.py | .py | e52069b9c4889bb7 | 7.54 | 11 |
from typing import Any, NamedTuple
from ..constants import EAST_GITHUB_URL
from .batchfile import BatchFile
class Project(NamedTuple):
"""Project object representing a build configuration for a project."""
name: str
artifacts: list[str]
nrfutil_flash_pack: bool
# Batch files are are not explicit... | IRNAS/irnas-east-software | src/east/modules/artifacts2pack.py | .py | 4345807d82b9744a | 7.54 | 11 |
import json
import os
from typing import NamedTuple
class BatchFile(NamedTuple):
"""BatchFile object that represents a batch file with its content and path."""
content: str
name: str
# Name of the associated ext-mem-config file, if any. Set during dry-run parsing.
ext_mem_config_name: str | None ... | IRNAS/irnas-east-software | src/east/modules/batchfile.py | .py | 5f65dcb3a406e296 | 7.54 | 11 |
import copy
import os
import re
from ..east_context import EastContext
from ..modules.artifacts2pack import ArtifactsToPack, Project
from ..modules.tsuite import TSuite
from .batchfile import BatchFile
def nrfutil_flash_packing(
east: EastContext,
testsuites: list[TSuite],
atp: ArtifactsToPack,
twist... | IRNAS/irnas-east-software | src/east/modules/pack_nrfutil.py | .py | 57d769c571fd07a7 | 7.54 | 11 |
from typing import NamedTuple, Optional
class ParsedTag(NamedTuple):
"""Container/interface class that holds the parsed tag information.
The instance of this class can be created either:
- from git describe output
- or from a tag given on the commandline.
The git describe command should be run w... | IRNAS/irnas-east-software | src/east/modules/parsedtag.py | .py | 8b6e6396d14e9edb | 7.54 | 11 |
import os
from typing import NamedTuple
from ..constants import EAST_GITHUB_URL
def tsuite_determine_path(
path: str, board: str, name: str, toolchain: str | None, twister_out_path: str
) -> str:
"""Determine the path to the testsuite's build directory.
Args:
topdir (str): The top directory of t... | IRNAS/irnas-east-software | src/east/modules/tsuite.py | .py | 7542563ef2453a08 | 7.54 | 11 |
from typing import Tuple
from .parsedtag import ParsedTag
def _parse_tag(tag: str) -> Tuple[int, int, int, str, int]:
"""Parse a tag.
This function contains logic to parse the semver-like tag into structured data.
The tweak part is only relevant for the cases where the tag is given on the
command l... | IRNAS/irnas-east-software | src/east/modules/zephyr_semver.py | .py | 75366dd1391f6448 | 7.54 | 11 |
import os
import click
from ..east_context import east_command_settings, east_group_settings
from ..helper_functions import configure_nrfutil
from .tooling import tool_installer
@click.command(**east_command_settings)
@click.option(
"-f",
"--force",
is_flag=True,
help="Reinstall the toolchain, even ... | IRNAS/irnas-east-software | src/east/system_commands/install.py | .py | 0e1d5a955ef464c3 | 7.54 | 11 |
import glob
import json
import os
import platform
import shutil
from rich.panel import Panel
from ..east_context import EastContext
from ..helper_functions import download_files
def _install_nrfutil(east: EastContext, exe_path: str):
"""Install nrfutil to a proper location."""
nrfutil = east.consts["nrfutil... | IRNAS/irnas-east-software | src/east/system_commands/tooling.py | .py | 2c8d889ea45770a7 | 7.54 | 11 |
import os
from typing import List
from ..helper_functions import return_dict_on_match
def is_child_in_parent(parent, child):
"""Check if the child path is in parent path
parent (): path
child (): path
Returns: True if yes, otherwise False.
"""
# Smooth out relative path names, note: ... | IRNAS/irnas-east-software | src/east/workspace_commands/build_type_flag.py | .py | 59bb6cd3e15ee721 | 7.54 | 11 |
import glob
import json
import linecache
import os
import plistlib as plist
import re
from ..helper_functions import get_git_version
def check_for_codechecker(east):
"""Check if codechecker is installed and available in the path."""
if not east.check_exe(east.consts["codechecker_path"]):
msg = (
... | IRNAS/irnas-east-software | src/east/workspace_commands/codechecker_helpers.py | .py | fc9893a96be38b06 | 7.54 | 11 |
import os
import pytest
import east.east_context
from . import helpers
# This is a conftest.py file, which has a special meaning when used with pytest.
#
# From pytest documentation:
#
# The conftest.py file serves as a means of providing fixtures for an entire directory.
# Fixtures defined in a conftest.py can be ... | IRNAS/irnas-east-software | tests/conftest.py | .py | 2ec8ac05c0ed534e | 7.04 | 11 |
import os
import shutil
from click.testing import CliRunner
from east.__main__ import cli
from east.east_context import EastContext
west_config_content = """
[manifest]
path = project
file = west.yml
[zephyr]
base = zephyr
"""
nrfsdk_yaml_content = """
manifest:
self:
# This repository should be cloned to
... | IRNAS/irnas-east-software | tests/helpers.py | .py | 7622fab9866644b1 | 7.04 | 11 |
from east.modules.artifact import Artifact, ExtraArtifact, TwisterArtifact
def test_check_for_no_duplicate_artifacts():
"""Test that no duplicate artifacts are found in a list of artifacts.
GIVEN a list of artifacts with no duplicate destination paths,
WHEN checking for duplicate artifacts,
THEN the ... | IRNAS/irnas-east-software | tests/test_artifact.py | .py | e152e025ac842885 | 7.04 | 11 |
import yaml
from east.modules.artifacts2pack import ArtifactsToPack
pack_yaml_single_app = """
pack:
artifacts:
- $APP_DIR/zephyr/merged.hex
build_configurations:
- name: app.prod
artifacts:
- $APP_DIR/zephyr/zephyr.hex
- dfu_application.zip
"""
def test_getting_artifact_list_for_l... | IRNAS/irnas-east-software | tests/test_artifact2pack.py | .py | 422ed91ea37d0769 | 8.04 | 11 |
import os
from east.east_context import EastContext
from . import helpers
def assert_all_is_none(east, path):
"""Small helper for brevity."""
assert east.cwd == path
assert east.west_dir_path is None
assert east.detected_ncs_version is None
assert east.project_dir is None
def test_good_west_wo... | IRNAS/irnas-east-software | tests/test_configuration.py | .py | 11442c81c557fb48 | 7.04 | 11 |
from east.helper_functions import clean_up_extra_args
def test_clean_up_extra_args():
"""Test that arguments are correctly cleaned up and concatenated.
If arg is "-DXXX=yyy:
If yyy has quotes, they must be escaped.
If yyy has no quotes, do nothing.
If arg is something else, add quotes aro... | IRNAS/irnas-east-software | tests/test_helpers.py | .py | b5847e78fea729ef | 7.04 | 11 |
import os
import pytest
from click.testing import CliRunner
from east.__main__ import cli
from east.east_yml import EastYmlLoadError, load_east_yml
from .helpers import create_and_write
pack_yaml_single_app = """
pack:
artifacts:
- $APP_DIR/zephyr/merged.hex
build_configurations:
- name: app.prod
... | IRNAS/irnas-east-software | tests/test_pack.py | .py | 905c580bad1f7f5d | 7.04 | 11 |
import pytest
from east.modules.parsedtag import ParsedTag
from east.modules.zephyr_semver import ZephyrSemver
def test_creating_parsedtag_when_not_in_git_repo():
"""Test creating Parsed tag when not in git repo."""
with pytest.raises(ValueError):
ParsedTag.from_git_describe(
"fatal: not ... | IRNAS/irnas-east-software | tests/test_parsedtag.py | .py | 8c215eaa6609702c | 7.04 | 11 |
import os
import shutil as sh
import east
from east.east_context import EastContext
from east.helper_functions import find_all_boards
from . import helpers
from .helpers import helper_test_against_west_run
def test_finding_hardware_versions(west_workplace):
"""Test finding hardware versions."""
_ = west_wor... | IRNAS/irnas-east-software | tests/test_release.py | .py | 98e0229cc35e0090 | 7.04 | 11 |
import copy
import pytest
from east.modules.tsuite import TSuite
test_suite_json = {
# This is a Zephyr v3 "style" testsuite
"testsuites": [
{
"name": "app.v3",
"arch": "arm",
"platform": "custom_board@1.0.0/nrf52840",
"path": "../project/app",
... | IRNAS/irnas-east-software | tests/test_tsuite.py | .py | ce2909f600361acc | 7.04 | 11 |
import os
import pytest
from click.testing import CliRunner
from east.__main__ import cli
from east.east_yml import EastYmlLoadError, load_east_yml
from .helpers import create_and_write
two_apps = """
version:
paths:
- app/test_one
- app/test_two
"""
def test_simple_version_config(west_workplace):
"... | IRNAS/irnas-east-software | tests/test_version.py | .py | 13fd81674a7b57a2 | 7.04 | 11 |
"""Consistent version information for Juliet."""
import importlib.metadata
import logging
from pathlib import Path
logger = logging.getLogger(__name__)
def package_version(pkgname):
return importlib.metadata.version(pkgname)
def extended_version(pkgname):
version = package_version(pkgname)
# if we ar... | jheddings/juliet | juliet/version.py | .py | 3eaf664d011e6065 | 7.42 | 6 |
"""Verify version information looks reasonable."""
import re
from juliet import __version__
def test_version_exists():
assert __version__
def test_version_is_valid_string():
"""Ensure version strings meet expected conventions."""
assert re.match(r"^[0-9]+(\.[0-9])+(-.*)?$", __version__)
| jheddings/juliet | tests/test_version.py | .py | 277858f84908987e | 7.42 | 6 |
"""Cast strings values to the appropriate data type."""
from __future__ import annotations
import logging
import re
from collections.abc import Callable
from . import const, grammar, types
logger = logging.getLogger(__name__)
def cast_value(text: str, type_id: str) -> types.DataType | None:
"""Cast a payload ... | DavidMStraub/python-gedcom7 | gedcom7/cast.py | .py | 1eef7c6aedea0a05 | 7.62 | 16 |
"""Exceptions raised by gedcom7."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .validator import Error
class GedcomError(Exception):
"""Base class for all errors raised by this package."""
class GedcomSerializeError(GedcomError, ValueError):
"""Raised w... | DavidMStraub/python-gedcom7 | gedcom7/exceptions.py | .py | b0abecaf0801ecf2 | 7.62 | 16 |
"""Format data type values back to payload strings.
This is the inverse of :mod:`gedcom7.cast`. Every formatter checks its result
against the same grammar production the corresponding cast function matches, so
a value that cannot be written as a conforming payload raises rather than
producing a data stream that will n... | DavidMStraub/python-gedcom7 | gedcom7/formatter.py | .py | 2302bc4743cf4990 | 7.62 | 16 |
"""GEDCOM 7 parser."""
from __future__ import annotations
import re
from typing import TYPE_CHECKING
from . import const, grammar
from .exceptions import GedcomParseError
from .types import GedcomStructure
if TYPE_CHECKING:
from typing import BinaryIO
# EOL = %x0D [%x0A] / %x0A -- CR-LF, CR, or LF
_EOL = re.co... | DavidMStraub/python-gedcom7 | gedcom7/parser.py | .py | 3aab668859e48b43 | 7.62 | 16 |
"""GEDCOM 7 serializer."""
from __future__ import annotations
import re
from typing import TYPE_CHECKING
from . import const, grammar
from .exceptions import GedcomSerializeError, GedcomValidationError
from .types import GedcomStructure
from .validator import validate as _validate
if TYPE_CHECKING:
from collect... | DavidMStraub/python-gedcom7 | gedcom7/serializer.py | .py | 8402e5c6dff80a77 | 7.62 | 16 |
"""Classes and data types."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Literal
from . import cast, const
@dataclass
class GedcomStructure:
"""Gedcom structure class."""
tag: str
# absent for a line without a pointer payload / without a cross-refere... | DavidMStraub/python-gedcom7 | gedcom7/types.py | .py | 683d1fc4d5a02a91 | 7.62 | 16 |
"""Utility functions for GEDCOM 7 processing."""
from __future__ import annotations
import datetime
from . import const, types
def get_first_child_with_tag(
structure: types.GedcomStructure, tag: str
) -> types.GedcomStructure | None:
"""Get the first child of a GEDCOM structure with a specific tag.
I... | DavidMStraub/python-gedcom7 | gedcom7/util.py | .py | 04c6caaa7bc83720 | 7.62 | 16 |
"""Report what is wrong with a dataset, using the tables the package already has.
Covers the checks that need no data beyond ``const.payloads``,
``const.substructures`` and ``const.GEDCOM_MONTHS``. Cardinality and
enumeration vocabularies are not among them: nothing here knows that an
individual may have one SEX, or t... | DavidMStraub/python-gedcom7 | gedcom7/validator.py | .py | 62150437d2cf80d7 | 7.62 | 16 |
import pathlib
import gedcom7
GEDCOM_MIN = """0 HEAD
1 GEDC
2 VERS 7.0
0 TRLR
"""
GEDCOM_EXTTAG = """0 HEAD
1 GEDC
2 VERS 7.0.0
1 SCHMA
2 TAG _FOO http://example.com/placeholder
0 @I1@ INDI
1 ALIA @I2@
1 _FOO 23
0 @I2@ INDI
1 SEX F
0 TRLR
"""
def test_minimal() -> None:
records = gedcom7.loads(GEDCOM_MIN)
... | DavidMStraub/python-gedcom7 | test/test_parser.py | .py | d4ffcc938db32d19 | 8.12 | 16 |
"""Test the utility functions."""
import datetime
from unittest.mock import patch
import pytest
from gedcom7 import types, util
def test_get_child_with_tag() -> None:
"""Test getting a child structure by tag."""
# Create parent structure with children
parent = types.GedcomStructure(tag="PARENT", pointe... | DavidMStraub/python-gedcom7 | test/test_util.py | .py | c79dce09ee0eab3e | 8.12 | 16 |
import asyncio
import snowflake.connector
from cryptography.hazmat.primitives import serialization
from snowflake.connector.constants import QueryStatus
class SnowflakeConnector:
def __init__(self, account_name: str, username: str, password: str = None, private_key: str = None):
"""
Authenticates... | anecdotes-ai/snowflake-query | snowflake_connector.py | .py | 92025de6c228e491 | 7.62 | 16 |
"""
Covers the credential seam and the output writer — the two things that can leak a secret or
silently stop working, and the only parts of this action testable without Snowflake.
Runs inside the image build (see Dockerfile), not on this repo's CI: GitHub Actions is disabled at
the repo level, so a workflow here woul... | anecdotes-ai/snowflake-query | test_credentials.py | .py | dd9967a27e1f6a08 | 8.12 | 16 |
# Copyright (C) 2026 Yukihiko Shinoda
"""This module implements exceptions for this package."""
__all__ = ["FFmpegProcessError"]
class Error(Exception):
"""Base class for exceptions in this module.
@see https://docs.python.org/3/tutorial/errors.html#user-defined-exceptions
"""
class FFmpegProcessError... | yukihiko-shinoda/asyncffmpeg | asyncffmpeg/exceptions.py | .py | d8fd2b5d6f6542fd | 7.65 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""FFmpeg coroutine interface."""
from __future__ import annotations
import asyncio
from asyncio.exceptions import CancelledError
from logging import getLogger
from signal import SIGTERM
from signal import signal
from typing import TYPE_CHECKING
from typing import Any
from typing... | yukihiko-shinoda/asyncffmpeg | asyncffmpeg/ffmpeg_coroutine.py | .py | 89418bf92d4e5aaa | 7.65 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""FFmpeg coroutine Factory."""
import os
from asyncffmpeg.ffmpeg_coroutine import TIME_TO_FORCE_TERMINATION
from asyncffmpeg.ffmpeg_coroutine import FFmpegCoroutine
from asyncffmpeg.ffmpegprocess.interface import FFmpegProcess
from asyncffmpeg.ffmpegprocess.posix import FFmpegPr... | yukihiko-shinoda/asyncffmpeg | asyncffmpeg/ffmpeg_coroutine_factory.py | .py | 016d07662bd9ca57 | 7.65 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""FFmpeg process wrapping Popen object."""
from __future__ import annotations
from abc import abstractmethod
from contextlib import suppress
from logging import getLogger
# Reason: This package requires to use subprocess.
from subprocess import Popen # nosec
from subprocess im... | yukihiko-shinoda/asyncffmpeg | asyncffmpeg/ffmpegprocess/interface.py | .py | 1526ffcf9aa995be | 7.65 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""Archive process."""
from __future__ import annotations
from typing import TYPE_CHECKING
import ffmpeg
from asyncffmpeg.ffmpegprocess.interface import FFmpegProcess
if TYPE_CHECKING:
# Reason: This package requires to use subprocess.
from subprocess import Popen # n... | yukihiko-shinoda/asyncffmpeg | asyncffmpeg/ffmpegprocess/posix.py | .py | fe94b5bc503146e9 | 7.65 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""The code to run in dedicated process group for Windows.
There are 2 purposes:
- to prevent Ctrl + C event propergation ti subprocess (raw FFmpeg execution)
- to prevent effect of setting ConsoleCtrlHandler to parent process (FFmpeg coroutine)
"""
import asyncio
import sys
fro... | yukihiko-shinoda/asyncffmpeg | asyncffmpeg/ffmpegprocess/windows.py | .py | 4a780361c0a0d11b | 7.65 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""The code to run in dedicated process group for Windows.
There are 2 purposes:
- to prevent Ctrl + C event propagation to subprocess (raw FFmpeg execution)
- to prevent effect of setting ConsoleCtrlHandler to parent process (FFmpeg coroutine)
Process group topology::
subp... | yukihiko-shinoda/asyncffmpeg | asyncffmpeg/ffmpegprocess/windows_wrapper.py | .py | e3994c8f5d534348 | 7.65 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""Configuration of pytest."""
from __future__ import annotations
import dataclasses
import logging
import multiprocessing
import os
import shutil
import time
from contextlib import AbstractContextManager
from contextlib import contextmanager
from logging import handlers
from mul... | yukihiko-shinoda/asyncffmpeg | tests/conftest.py | .py | 8e94e47450385952 | 8.15 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""Tests for FFmpegCoroutine."""
from __future__ import annotations
import asyncio
import shutil
import signal
# Reason: This package requires to use subprocess.
import subprocess # nosec
import sys
import time
from logging import DEBUG
# Reason: This package requires to use s... | yukihiko-shinoda/asyncffmpeg | tests/test_ffmpeg_coroutine.py | .py | 90b0686590db605f | 7.15 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""Coroutines for creating stream spec."""
from __future__ import annotations
from typing import TYPE_CHECKING
import ffmpeg
if TYPE_CHECKING:
from pathlib import Path
from asyncffmpeg import StreamSpec
class CreateStreamSpecCoroutineCopy:
"""Coroutine to create ... | yukihiko-shinoda/asyncffmpeg | tests/testlibraries/create_stream_spec_croutine.py | .py | 312fa2ce68ac33f7 | 7.15 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""To keep task property even raise KeyboardInterrupt."""
from __future__ import annotations
import asyncio
import os
import signal
import time
from logging import getLogger
from typing import TYPE_CHECKING
from typing import Any
from typing import Generic
from tests.testlibrari... | yukihiko-shinoda/asyncffmpeg | tests/testlibraries/keyboardinterrupter/keyboard_interrupter.py | .py | e6b2f4b893a7908a | 8.15 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""The socket to comunicate processes of different group each other."""
import socket
import time
from contextlib import closing
from tests.testlibraries.keyboardinterrupter import SECOND_SLEEP_FOR_TEST_KEYBOARD_INTERRUPT_CTRL_C_POPEN_MIDDLE
class LocalSocket:
"""The socket... | yukihiko-shinoda/asyncffmpeg | tests/testlibraries/keyboardinterrupter/local_socket.py | .py | c6bd7c837ad4b9ae | 8.15 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""For testing stdout and stderr."""
import sys
def main() -> None:
"""For testing stdout and stderr."""
count = 0
total_number_of_std = 2
while True:
count = count + 1
if count % 1 == 0:
print("stdout")
# On Windows with Pytho... | yukihiko-shinoda/asyncffmpeg | tests/testlibraries/print_forever.py | .py | a8b6366168eb3e65 | 7.15 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""To collect coverage in except KeyboardInterrupt block.
Since coverage.py can't trace asyncio.ProcessPoolExecutor.
see: https://github.com/nedbat/coveragepy/issues/481
"""
from __future__ import annotations
import multiprocessing
import signal
from contextlib import AbstractCo... | yukihiko-shinoda/asyncffmpeg | tests/testlibraries/process_pool_executor_simulator.py | .py | 181cf91b50b60c3b | 8.15 | 19 |
# Copyright (C) 2026 Yukihiko Shinoda
"""Subprocess wrapper for Windows."""
import asyncio
import logging
import os
import queue
import re
import sys
import time
from logging import DEBUG
from logging import LogRecord
from logging import basicConfig
from logging import getLogger
from logging import handlers
from multi... | yukihiko-shinoda/asyncffmpeg | tests/testlibraries/subprocess_wrapper_windows.py | .py | 65d0cc719f9d779c | 8.15 | 19 |
"""Platform for binary sensor integration."""
from __future__ import annotations
from dataclasses import dataclass
import logging
from typing import Final
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.... | astrandb/weatherlink | custom_components/weatherlink/binary_sensor.py | .py | f393503e82a2cbf4 | 7.62 | 16 |
"""pytest fixtures."""
from collections.abc import Generator
from unittest.mock import MagicMock, patch
import pytest
from pytest_homeassistant_custom_component.common import load_fixture
from pytest_homeassistant_custom_component.syrupy import HomeAssistantSnapshotExtension
from syrupy import SnapshotAssertion
from... | astrandb/weatherlink | tests/conftest.py | .py | a68e03fcc189f0f1 | 7.12 | 16 |
""" ConfigFlow for the Oppo UDP-20x Integration """
import ipaddress
import logging
import re
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_PORT
from oppoudpsdk import OppoClient
from .const import DEFAULT_PORT, DOMAIN
from .exceptions import HaAlrea... | simbaja/ha_oppoudp | custom_components/oppo_udp/config_flow.py | .py | 05489d332000ae5e | 7.57 | 13 |
"""Base Entity for the Oppo UDP-20x integration."""
import logging
from homeassistant.core import callback
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from oppoudpsdk import OppoDevic... | simbaja/ha_oppoudp | custom_components/oppo_udp/entity.py | .py | 61a5252af016aa8f | 7.57 | 13 |
""" Home Assistant derived exceptions"""
from homeassistant import exceptions as ha_exc
class HaCannotConnect(ha_exc.HomeAssistantError):
"""Error to indicate we cannot connect."""
class HaInvalidHost(ha_exc.HomeAssistantError):
"""Error to indicate we don't have a valid host."""
class HaAlreadyConfigu... | simbaja/ha_oppoudp | custom_components/oppo_udp/exceptions.py | .py | b6aa83cbaad2f47f | 7.07 | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.