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
"""Re-export 3D grids with properties.""" from pathlib import Path import xtgeo from fmu.config import utilities as ut from fmu.dataio import ExportData CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml") OUT_DIR = Path("../output/grids") GRID_FILE = "gg" GRID_NAME = "geogrid" PROPS_TO_EXPORT = ["phi...
equinor/fmu-dataio
examples/example_exports/export_non_rms_data/export_grid3d.py
.py
eb282b82ebdffaf6
7.52
10
"""Re-export already exported volume tables for Sumo.""" from pathlib import Path import pandas as pd from fmu.config import utilities as ut from fmu.dataio import ExportData CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml") VOL_DIR = Path("../output/volumes/") VOL_FILES = ["geogrid_vol.csv", "simg...
equinor/fmu-dataio
examples/example_exports/export_non_rms_data/export_volumetables.py
.py
f1a9f7e8e815ba1b
7.52
10
"""Export fault lines polygons. This example contains two cases of exporting: directly from the RMS project or from already exported files. These two cases are indicated with comments where appropriate. """ from pathlib import Path import xtgeo from fmu.config import utilities as ut from fmu.dataio import ExportDat...
equinor/fmu-dataio
examples/example_exports/export_rms_data/export_faultpolygons.py
.py
cc0b6e24f4d65853
7.52
10
"""Export FaultRoom surfaces from RMS.""" from pathlib import Path from fmu.config import utilities as ut from fmu.dataio import ExportData from fmu.dataio._readers import faultroom CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml") # If running outside RMS using files that are stored e.g. on rms/ou...
equinor/fmu-dataio
examples/example_exports/export_rms_data/export_faultroom_surfaces.py
.py
cb82605822fc1790
7.52
10
"""Export a preprocessed surface with metadata.""" from pathlib import Path import xtgeo from fmu.config import utilities as ut from fmu.dataio.dataio import ExportData CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml") DEPTH_FILE = Path("../output/maps/structure/") / "topvolantis--ds_extract_geogri...
equinor/fmu-dataio
examples/example_exports/export_rms_data/export_preprocessed_surface.py
.py
c6a18b851f6a347b
7.52
10
"""Export maps that holds certain average gridmodel properties. The files on disk are: facies_fraction_channels_volon.gri klogh_average_valysar.gri phit_average_therys.gri We want to use the file names here to extract some data (like name of formation, e.g. Therys). """ from pathlib import Path import xtgeo from f...
equinor/fmu-dataio
examples/example_exports/export_rms_data/export_propmaps.py
.py
9fcf906d93784fd9
7.52
10
"""Re-export already exported surfaces with metadata.""" from pathlib import Path import xtgeo from fmu.config import utilities as ut from fmu.dataio import ExportData CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml") PORO_FILE = Path("../output/maps/props/poro_average.gri") DEPTH_FILE = Path("../o...
equinor/fmu-dataio
examples/example_exports/export_rms_data/export_surface_maps.py
.py
078deb454fb94414
7.52
10
"""Create case metadata using fmu-dataio.""" import logging from fmu.config import utilities as utils from fmu.dataio._workflows.case.export_case_metadata import ExportCaseMetadata logger = logging.getLogger(__name__) logger.setLevel(logging.WARNING) CFG = utils.yaml_load("fmuconfig/output/global_variables.yml") ...
equinor/fmu-dataio
examples/metadata_scripts/create_case_metadata.py
.py
ec33b493ce51844d
7.52
10
""" Module for ExportConfig which contains the fully resolved export configuration. This is the interface used internally which has already processed user input and undergone input validation and transformations. """ from __future__ import annotations import dataclasses from dataclasses import dataclass from pathlib...
equinor/fmu-dataio
src/fmu/dataio/_export/_export_config.py
.py
4569dbd1f46c7792
7.52
10
"""This module contains classes used when data is being exported from the object data provider. Mostly these classes are here to maintain backward compatibility while a deprecation period is ongoing. """ from __future__ import annotations import warnings from typing import Final, Literal from pydantic import ( ...
equinor/fmu-dataio
src/fmu/dataio/_export/_export_models.py
.py
5e16c6292cab060a
7.52
10
"""Functions for exporting data with and without metadata.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING, Final import yaml from fmu.dataio._logging import null_logger from fmu.dataio._metadata import ( SharePathConstructor, _generate_metadata, create_ob...
equinor/fmu-dataio
src/fmu/dataio/_export/core.py
.py
7b0264dd69a766de
7.52
10
"""Serialization of data objects to files and buffers. This module handles the i/o exporting data objects. It dispatches to the appropriate serialization logic based on the underlying object type while checksumming. """ from __future__ import annotations import json import logging from io import BytesIO from pathlib...
equinor/fmu-dataio
src/fmu/dataio/_export/serialize.py
.py
fd558c1f86bf6635
7.52
10
"""Module to produce a GlobalConfiguration object or dictionary.""" import contextlib import warnings from pathlib import Path from typing import Any, Final import pydantic import yaml from fmu.dataio._logging import null_logger from fmu.dataio.exceptions import ValidationError from fmu.datamodels.fmu_results.global...
equinor/fmu-dataio
src/fmu/dataio/_global_config.py
.py
e6e72b7bacc866a6
7.52
10
from __future__ import annotations import os from pathlib import Path from typing import TYPE_CHECKING, Any, Final, Self, TypedDict import pyarrow as pa import pyarrow.parquet as pq if TYPE_CHECKING: from fmu.sumo.uploader._fileonjob import FileOnJob # Client id for Sumo uploader to identify the source of uploa...
equinor/fmu-dataio
src/fmu/dataio/_interfaces/sumo_uploader_interface.py
.py
7448a9b7eeede4ab
7.52
10
"""Module for DataIO _FileData Populate and verify stuff in the 'file' block in fmu (partial excpetion is checksum_md5 as this is convinient to populate later, on demand) """ from __future__ import annotations import re import warnings from pathlib import Path from typing import TYPE_CHECKING, Final from fmu.dataio...
equinor/fmu-dataio
src/fmu/dataio/_metadata/_file.py
.py
a2ea89e54a68a612
7.52
10
from __future__ import annotations from abc import abstractmethod from datetime import datetime from typing import TYPE_CHECKING, Final from fmu.dataio._export import ExportConfig, UnsetData from fmu.dataio._logging import null_logger from fmu.datamodels.fmu_results.data import AnyData, SmdaEntity, Time, Timestamp fr...
equinor/fmu-dataio
src/fmu/dataio/_metadata/_object/_base.py
.py
91d3d9a18ed92fb7
7.52
10
from __future__ import annotations from typing import TYPE_CHECKING, Final from fmu.dataio._definitions import ExportFolder, FileExtension from fmu.dataio._logging import null_logger from fmu.dataio._metadata._object._utils import Utils from fmu.datamodels.fmu_results.data import BoundingBox3D from fmu.datamodels.fmu...
equinor/fmu-dataio
src/fmu/dataio/_metadata/_object/_faultroom.py
.py
de2b1cb7bac0b858
7.52
10
from __future__ import annotations import warnings from typing import TYPE_CHECKING, Final from fmu.dataio._definitions import ( STANDARD_TABLE_INDEX_COLUMNS, ExportFolder, FileExtension, ) from fmu.dataio._logging import null_logger from fmu.dataio.exceptions import ConfigurationError from fmu.datamodels...
equinor/fmu-dataio
src/fmu/dataio/_metadata/_object/_tables.py
.py
bd9658aedefcd050
7.52
10
from __future__ import annotations import warnings from typing import TYPE_CHECKING import numpy as np import pyarrow as pa import pyarrow.compute as pc from fmu.datamodels.fmu_results.specification import Statistics if TYPE_CHECKING: import pandas as pd from fmu.datamodels.fmu_results.global_configuration...
equinor/fmu-dataio
src/fmu/dataio/_metadata/_object/_utils.py
.py
47c21ecc138ce178
7.52
10
"""Module for creating ObjectData instances. This contains evaluation of the valid objects that can be handled and is mostly used in the ``data`` block but some settings are applied later in the other blocks """ from __future__ import annotations from typing import TYPE_CHECKING, Final import pandas as pd import py...
equinor/fmu-dataio
src/fmu/dataio/_metadata/_object/core.py
.py
5694036a69e39244
7.52
10
""" This module contains models used to output the metadata that sit beside the exported data. It contains internal data structures that are designed to depend on external modules, but not the other way around. This design ensures modularity and flexibility, allowing external modules to be potentially separated into t...
equinor/fmu-dataio
src/fmu/dataio/_metadata/core.py
.py
e67d14cccda6657a
7.52
10
"""Module for reading Faultroom data""" from __future__ import annotations import hashlib import json from dataclasses import dataclass, field from pathlib import Path def read_faultroom_file(filename: str | Path) -> FaultRoomSurface: """Faultroom surface data are (geo)JSON file or dicts; needs separate handlin...
equinor/fmu-dataio
src/fmu/dataio/_readers/faultroom.py
.py
4e44350bb45bc01c
7.52
10
from __future__ import annotations import os import warnings from dataclasses import dataclass from pathlib import Path from typing import Final, Self import yaml from fmu.dataio._definitions import ERT_RELATIVE_CASE_METADATA_FILE, RMSExecutionMode from fmu.dataio._logging import null_logger from fmu.dataio._utils i...
equinor/fmu-dataio
src/fmu/dataio/_runcontext.py
.py
5f9ccc6d6aebb52d
7.52
10
"""Module for private utilities/helpers for DataIO class.""" from __future__ import annotations import hashlib import json import shlex import uuid from pathlib import Path from typing import TYPE_CHECKING, Final import yaml from ._definitions import ERT_RELATIVE_CASE_METADATA_FILE from ._logging import null_logger...
equinor/fmu-dataio
src/fmu/dataio/_utils.py
.py
42d1d5e4fd98a48d
7.52
10
"""Extract and process stratigraphy mappings.""" from __future__ import annotations import logging from typing import Final import pyarrow as pa from fmu.settings import ProjectFMUDirectory logger: Final = logging.getLogger(__name__) logger.setLevel(logging.CRITICAL) def has_stratigraphy_mappings(fmu_dir: Projec...
equinor/fmu-dataio
src/fmu/dataio/_workflows/case/_mappings.py
.py
30b58097253cc145
7.52
10
"""Extract and process Ert observations.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Final, Literal import polars as pl import pyarrow as pa if TYPE_CHECKING: from ert.storage import Ensemble as ErtEnsemble logger: Final = logging.getLogger(__name__) logger.setLevel(...
equinor/fmu-dataio
src/fmu/dataio/_workflows/case/_observations.py
.py
55c93f34d45f3ce2
7.52
10
"""Extract and process Ert parameters.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Final import ert import pyarrow as pa from pydantic import TypeAdapter from fmu.datamodels import ErtParameterMetadata if TYPE_CHECKING: import polars as pl from ert.storage import ...
equinor/fmu-dataio
src/fmu/dataio/_workflows/case/_parameters.py
.py
11e4569625565baf
7.52
10
from __future__ import annotations import copy import getpass import uuid import warnings from pathlib import Path from typing import Any, Final, Self from fmu.dataio._export import export_metadata_file from fmu.dataio._global_config import ( build_global_configuration, ) from fmu.dataio._logging import null_logg...
equinor/fmu-dataio
src/fmu/dataio/_workflows/case/export_case_metadata.py
.py
d21f489dd6c18210
7.52
10
# MIT License # # Copyright (c) 2026 Rizom-Lab # # 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 limitation the rights # to use, copy, modify, merge, ...
RemiArq/RizomUVLink
RizomUVLink.py
.py
8e5a02df2fb8203e
7.48
8
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2024 LG Electronics Inc. # SPDX-License-Identifier: Apache-2.0 from datetime import datetime, timezone, timedelta _TIMESTAMP_FMT = '%Y%m%d_%H%M%S' _DISPLAY_TZ = timezone(timedelta(hours=9)) # KST (UTC+9) def current_timestamp_utc() -> str: """Return...
fosslight/fosslight_util
src/fosslight_util/time.py
.py
b6548d47a771347b
7.56
12
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2020 LG Electronics Inc. # SPDX-License-Identifier: Apache-2.0 from fosslight_scanner._get_input import get_input, get_input_mode def test_get_input(monkeypatch): # given ask_msg = "Please enter the path to analyze:" default_value = "default"...
fosslight/fosslight_scanner
tests/test__get_input.py
.py
2c5d4a6e30787a95
7.14
18
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2020 LG Electronics Inc. # SPDX-License-Identifier: Apache-2.0 import pytest from fosslight_scanner._run_compare import write_result_json_yaml, parse_result_for_table, get_sample_html, \ write_result_html, write_result_xlsx, write_compared_result, get_...
fosslight/fosslight_scanner
tests/test__run_compare.py
.py
09f337b23905a1d1
7.14
18
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2020 LG Electronics Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import json import sys from fosslight_scanner.cli import main, set_args def test_set_args(monkeypatch): # Mocking os.path.isfile to return True monkeypatch.setattr("os.pa...
fosslight/fosslight_scanner
tests/test_cli.py
.py
70d74ac9f2a497b1
7.14
18
import shutil import openpyxl import pytest from pathlib import Path from fosslight_scanner.fosslight_scanner import run_scanner, download_source, init, run_main, run_dependency from fosslight_util.oss_item import ScannerItem from fosslight_util.constant import FOSSLIGHT_BINARY, FOSSLIGHT_DEPENDENCY, FOSSLIGHT_SOURCE, ...
fosslight/fosslight_scanner
tests/test_fosslight_scanner.py
.py
2d2b502300d38d77
7.14
18
import json import os import logging import threading import time import zmq from typing import Optional from ..core.settings import RIG_BUILDER_USER_PATH, HOSTS_FILE, DEFAULT_DISCOVERY_PORT from .hostClient import HostClient from .discoveryServer import DiscoveryServer from ..core.utils import loadJson, saveJson from...
azagoruyko/rigBuilder
core/connectionManager.py
.py
6fd18ad021a841ae
7.45
7
"""Git repository wrapper for running git commands in a given working directory.""" from __future__ import annotations import os import shlex import shutil import sys import subprocess from typing import List, Optional, Tuple if sys.platform == "win32": _startupinfo = subprocess.STARTUPINFO() _startupinfo.d...
azagoruyko/rigBuilder
core/gitrepo.py
.py
198e2e3754315d8d
7.45
7
import logging import sys import os from .settings import RIG_BUILDER_USER_PATH class LogHandler(logging.Handler): """Generic log handler that pipes messages to an external target.""" def __init__(self): super().__init__() self._target = None self._buffer = [] # Buffer for early logs be...
azagoruyko/rigBuilder
core/logger.py
.py
c231e7b435ca7051
7.45
7
import os import re import json import xml.etree.ElementTree as ET from typing import List, Tuple, Dict, Any from . import core from .uidManager import UidManager from ..ai import engine from .settings import settings from .utils import loadJson, saveJson, fileHash class ModuleIndexer: """ Handles indexing of...
azagoruyko/rigBuilder
core/moduleIndexer.py
.py
89ab01f4fffe601e
7.45
7
import os import json import logging from .utils import loadJson, saveJson RIG_BUILDER_PATH = os.path.normpath(os.path.dirname(os.path.dirname(__file__))) RIG_BUILDER_USER_PATH = os.path.normpath(os.path.join(os.path.expanduser("~"), "rigBuilder")) SETTINGS_PATH = os.path.join(RIG_BUILDER_USER_PATH, "settings.json") ...
azagoruyko/rigBuilder
core/settings.py
.py
281812d03a8beaa5
7.45
7
import weakref import inspect class Signal: """A pure-Python observer implementation using weak references to prevent memory leaks in background environments like the networking client. """ def __init__(self): # Stores either weakref objects (for python methods/functions) # or direct ...
azagoruyko/rigBuilder
core/signal.py
.py
3f09478f46a7d1b6
7.45
7
import os import re import glob from .settings import settings, MODULE_EXTS from typing import Optional class UidManager: _uids: dict[str, str] = {} # uid: path _mtimeCache: dict[str, tuple[float, str]] = {} # path: (mtime, uid) @classmethod def sync(cls): """Sync cached UIDs from modules dire...
azagoruyko/rigBuilder
core/uidManager.py
.py
9c6327c0c4ad2461
7.45
7
import sys import os import re import json import textwrap import hashlib import io import ast import stat import shutil from contextlib import contextmanager, redirect_stdout, redirect_stderr from datetime import datetime, timedelta from typing import List, Any def clamp(val: float, low: float, high: float) -> float...
azagoruyko/rigBuilder
core/utils.py
.py
539e59390aabd07d
7.45
7
from __future__ import annotations import html import os import sys import shutil import xml.etree.ElementTree as ET from typing import List, Protocol, Optional, Union, TYPE_CHECKING if TYPE_CHECKING: from xml.etree.ElementTree import Element from .settings import ( settings, Settings, RIG_BUILDER_US...
azagoruyko/rigBuilder
core/workspace.py
.py
69a7d0c69be87249
7.45
7
import os import sys import subprocess import importlib def getPythonExe(): """Finds the actual python.exe path for the current application.""" exe = sys.executable # Unreal Engine logic: sys.executable is the Editor itself if "UnrealEditor" in exe: ueBin = os.path.dirname(exe) for rel...
azagoruyko/rigBuilder
host/ensure_zmq.py
.py
52faf6f26d9d386d
7.45
7
"""Module execution and code evaluation for the Rig Builder server.""" import io import traceback from ..core import Module, APIRegistry from ..core.utils import captureOutput, jsonifyContext, getErrorStack, executeWithResult # Persistent execution contexts for interactive (line-by-line) code execution. # Keyed by a...
azagoruyko/rigBuilder
host/runner.py
.py
a2c8b21659fb18b0
7.45
7
"""Blender host server. Run once inside Blender (e.g. from a startup script): from rigBuilder.host.servers.blender import BlenderServer BlenderServer(51605).start() """ import os import bpy from rigBuilder.host.servers import HostServer class BlenderServer(HostServer): """Dispatches execution to Blend...
azagoruyko/rigBuilder
host/servers/blender.py
.py
f65b138ca2f58261
7.45
7
"""Houdini host server. Run once inside Houdini (e.g. from a startup script or shelf tool): from rigBuilder.host.servers.houdini import HoudiniServer HoudiniServer(51605).start() """ import hou from rigBuilder.host.servers import HostServer class HoudiniServer(HostServer): """Dispatches execution to H...
azagoruyko/rigBuilder
host/servers/houdini.py
.py
6e84ae9c01da43e3
7.45
7
"""Maya host server. Run once inside Maya (e.g. from userSetup.py or Script Editor): from rigBuilder.host.servers.maya import MayaServer MayaServer(51605).start() """ import os import maya.utils import maya.cmds as cmds import maya.OpenMaya as om from rigBuilder.host.servers import HostServer class MayaSer...
azagoruyko/rigBuilder
host/servers/maya.py
.py
bc54d7c7731b6d98
7.45
7
"""Standalone host server — runs module code inline, no main-thread dispatch needed. Used for testing and for running rigBuilder without any host. """ from . import HostServer class StandaloneServer(HostServer): """Standalone server — executes module code directly in the socket thread.""" def ping(self) -> ...
azagoruyko/rigBuilder
host/servers/standalone.py
.py
8658f88f06114a29
7.45
7
"""Unreal Engine host server. Run inside Unreal (e.g. from Python Script Editor): from rigBuilder.host.servers.unreal import UnrealServer UnrealServer(51605).start() """ import queue import traceback import unreal from rigBuilder.host.servers import HostServer class UnrealServer(HostServer): """Dispa...
azagoruyko/rigBuilder
host/servers/unreal.py
.py
1a6412ae1a16074d
7.45
7
import zmq import json ZMQ_PORT = 51607 class ZmqClient: """ZMQ Client for RigBuilder MCP""" def __init__(self): self.context = zmq.Context() self.socket = self.context.socket(zmq.REQ) # Timeout for socket if server is offline self.socket.setsockopt(zmq.RCVTIMEO, 1000) ...
azagoruyko/rigBuilder
mcp_server/zmq_client.py
.py
d30218d80405ce52
7.45
7
import zmq import json from PySide6.QtCore import QObject, QTimer, QPersistentModelIndex ZMQ_PORT = 51607 class RigBuilderAPI: """API for RigBuilder""" mainWindow = None @classmethod def get_selected_modules(cls, req): """Get currently selected modules""" modules = cls.mainWindow.tree...
azagoruyko/rigBuilder
mcp_server/zmq_server.py
.py
d668e700ec813f94
7.45
7
"""API Registry browser. Shows registered names, docstrings, and signatures for user reference.""" from __future__ import annotations import inspect from typing import Any from ..core import APIRegistry from .qt import * def getObjectInfo(name: str, obj: Any) -> tuple[str, str, str, str]: """Helper to extract t...
azagoruyko/rigBuilder
ui/apiBrowser.py
.py
c3c08d6daef73fff
7.45
7
import os import difflib import asyncio from typing import List from ..core import Module from .qt import * from .utils import centerWindow from ..core.logger import logger from .. import ai from ..ai import engine activeWorkers = [] def calculateModulesDiff(modules: List[Module]) -> str: """Calculate unified dif...
azagoruyko/rigBuilder
ui/diffBrowser.py
.py
ac8f79b652f3408f
7.45
7
import os import fnmatch from typing import List, Optional from .qt import * class DirectoryWatcher(QObject): """Watch directories recursively and emit debounced change events.""" fileChanged = Signal(str) def __init__( self, roots: List[str], *, debounceMs: int = 700, ...
azagoruyko/rigBuilder
ui/fileTracker.py
.py
7906f78ceb7799df
7.45
7
"""Authentication library, providing base classes for users of the library. In order to use `gcal_sync.api`, you need to implement `gcal_sync.AbstractAuth` which provides an OAuth access token. See Google's [Authentication and authorization overview][1] for general details on how to use OAuth, which involves things li...
allenporter/gcal_sync
gcal_sync/auth.py
.py
53f99790439dff12
7.57
13
"""Library for exceptions using the Google Calendar API.""" class GoogleCalendarException(Exception): """Base class for all client exceptions.""" class ApiException(GoogleCalendarException): """Raised during problems talking to the API.""" class AuthException(ApiException): """Raised due to auth probl...
allenporter/gcal_sync
gcal_sync/exceptions.py
.py
4da7b099b8e0384d
7.57
13
"""Library for local storage of calendar data.""" from __future__ import annotations from abc import ABC from typing import Any __all__ = [ "CalendarStore", ] class CalendarStore(ABC): """Interface for external calendar storage. This is an abstract class that may be implemented by callers to provide a...
allenporter/gcal_sync
gcal_sync/store.py
.py
bed6d05576c5a4b1
7.57
13
"""Library for handling local event sync. This library implements the best practices for how to [Synchronize resources](https://developers.google.com/calendar/api/guides/sync) for a Google Calendar. To use this library, you create an instance of a sync manager then run the `run` method on a regular basis to pull down...
allenporter/gcal_sync
gcal_sync/sync.py
.py
a9e610bd0f064120
7.57
13
"""A Timeline is a set of events on a calendar. A timeline can be used to iterate over all events, including expanded recurring events. A timeline also supports methods to scan ranges of events like returning all events happening today or after a specific date. """ from __future__ import annotations import datetime ...
allenporter/gcal_sync
gcal_sync/timeline.py
.py
9b0af639ee6a0ab2
7.57
13
"""Test fixtures for calendar API.""" from __future__ import annotations import datetime import json from collections.abc import Awaitable, Callable, Generator from json import JSONDecodeError from typing import Any, TypeVar, cast import aiohttp import pytest from aiohttp.test_utils import TestClient from gcal_sync...
allenporter/gcal_sync
tests/conftest.py
.py
e1517c56d529ef96
8.07
13
"""Tests for local storage.""" import pytest from gcal_sync.store import CalendarStore, InMemoryCalendarStore, ScopedCalendarStore @pytest.fixture(name="store") def fake_store() -> CalendarStore: """Fixture for a calendar store.""" return InMemoryCalendarStore() async def test_empty_store(store: CalendarS...
allenporter/gcal_sync
tests/test_store.py
.py
53f6458efff406a0
8.07
13
""" conftest.py — Root-level pytest session configuration for IJT Console Client. Sets basetemp to <project-root>/tmp/pytest (absolute, CWD-independent) so that all pytest temp directories always land inside this project regardless of where the test runner is invoked from (repo root, client dir, CI, etc.). Set IJT_US...
umati/UA-for-Industrial-Joining-Technologies
OPC_UA_Clients/Release2/IJT_Console_Client/conftest.py
.py
5aeb3045b5fe0998
7.95
7
"""Docker image freshness helpers for the OPC UA simulator. Pure stdlib so this module is safe to import from regression tests that must run in lightweight environments (no cryptography, no asyncua, no pytest plugins beyond the core). Behavior parity with the C# fixture's ShouldBuildDockerImage path lives in OPC_UA_C...
umati/UA-for-Industrial-Joining-Technologies
OPC_UA_Clients/Release2/IJT_Console_Client/docker_freshness.py
.py
cc0192abae9a144b
7.45
7
from __future__ import annotations import hashlib import json import os import shutil import socket import uuid from dataclasses import dataclass from datetime import datetime, timedelta, timezone from pathlib import Path def preserve_test_artifacts() -> bool: return os.environ.get("IJT_PRESERVE_TEST_ARTIFACTS",...
umati/UA-for-Industrial-Joining-Technologies
OPC_UA_Clients/Release2/IJT_Console_Client/opcua_security_support.py
.py
6a3d6a2e2b3a3ab9
7.45
7
"""Config flow for the sma webbox integration.""" from __future__ import annotations import logging from ipaddress import ip_address from typing import Any import homeassistant.helpers.config_validation as cv import voluptuous as vol from homeassistant import config_entries from homeassistant.const import CONF_IP_ADD...
jpcornil-git/HA-sma
custom_components/sma_webbox/config_flow.py
.py
3e47ddf8d66e7072
7.57
13
"""Sensor platform for SMA Webbox integration.""" from __future__ import annotations import logging from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorStateClass, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( UnitOfElectricCu...
jpcornil-git/HA-sma
custom_components/sma_webbox/sensor.py
.py
bbf17af6fd4c60a0
7.57
13
"""Create, update, toggle and delete firewall aliases. Aliases are named groups of hosts, networks, ports or countries that firewall and NAT rules reference by name. The existing `aliases` tool only searches; this adds the write side, which the routing work needs for its source groups. Updates read the whole node, me...
coreyhines/opnsense-mcp
opnsense_mcp/tools/alias_write.py
.py
f20a15ac3e62df42
7.52
10
"""Firewall alias listing tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class AliasesTool: """Tool for listing firewall aliases (IP groups, port groups, etc).""" name = "aliases" description = "List fi...
coreyhines/opnsense-mcp
opnsense_mcp/tools/aliases.py
.py
e166b3f8468de32d
7.52
10
"""DHCP lease management tool for OPNsense.""" import asyncio import logging from typing import Any from pydantic import BaseModel from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) # Fields that are internal DHCP protocol details rarely useful in LLM context. _NOISY_FIELDS = fr...
coreyhines/opnsense-mcp
opnsense_mcp/tools/dhcp.py
.py
449e638c702a939d
7.52
10
"""MCP tool to list DHCP host reservations (dnsmasq search_host rows).""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Any from opnsense_mcp.utils.dhcp_host import DhcpHostRecord if TYPE_CHECKING: from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogge...
coreyhines/opnsense-mcp
opnsense_mcp/tools/dhcp_hosts.py
.py
7062ce4092b7aae8
7.52
10
"""MCP tools for DHCP per-subnet DNS configuration.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) _SCOPE_PROPERTIES = { "subnet": { "type": "string",...
coreyhines/opnsense-mcp
opnsense_mcp/tools/dhcp_subnet_dns.py
.py
39791c6623f7fe17
7.52
10
"""Unbound DNS host override listing tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class DNSTool: """Tool for listing Unbound DNS host overrides.""" name = "dns" description = "List Unbound DNS host ov...
coreyhines/opnsense-mcp
opnsense_mcp/tools/dns.py
.py
1a533ebf5cf6cfa2
7.52
10
#!/usr/bin/env python3 """Firewall logs retrieval and analysis tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import FirewallLogsFetchError, OPNsenseClient from opnsense_mcp.utils.firewall_log_normalize import ( normalize_log_dict, normalize_logs, parse_int, ) log...
coreyhines/opnsense-mcp
opnsense_mcp/tools/firewall_logs.py
.py
8e922a30a586409c
7.52
10
"""Firewall interface groups. A group names a set of assigned interfaces so one rule can cover all of them. Adding a network to an existing zone is otherwise a rule-per-interface job, which is where rule sets drift apart. Groups hold assigned interfaces only, so a VLAN device that has not been assigned cannot join on...
coreyhines/opnsense-mcp
opnsense_mcp/tools/fw_groups.py
.py
ad9a041bc26707a6
7.52
10
"""Firewall rules management tool for OPNsense.""" import asyncio import logging from typing import Any from pydantic import BaseModel from opnsense_mcp.utils.api import OPNsenseClient from opnsense_mcp.utils.mock_api import MockOPNsenseClient logger = logging.getLogger(__name__) def _parse_sequence(value: Any) -...
coreyhines/opnsense-mcp
opnsense_mcp/tools/fw_rules.py
.py
395e1ffc239d9bc9
7.52
10
"""Gateway/WAN health status tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class GatewayStatusTool: """Tool for showing WAN gateway health (latency, packet loss).""" name = "gateway_status" description...
coreyhines/opnsense-mcp
opnsense_mcp/tools/gateway_status.py
.py
9020af810b169b05
7.52
10
"""Compatibility shim for the canonical firewall logs tool.""" from __future__ import annotations from typing import Any from opnsense_mcp.tools.firewall_logs import FirewallLogsTool as _FirewallLogsTool class GetLogsTool(_FirewallLogsTool): """Backward-compatible name for :class:`FirewallLogsTool`.""" na...
coreyhines/opnsense-mcp
opnsense_mcp/tools/get_logs.py
.py
c579e2b5abab88a7
7.52
10
"""Set an interface's address over SSH, because the API cannot. This is the only place the project writes configuration outside the API, so the reasoning matters as much as the code. `NetworkInterface.xml` on the 26.7 series defines six fields — descr, identifier, icon, optgroup, if, lock — and `AssignmentController`...
coreyhines/opnsense-mcp
opnsense_mcp/tools/interface_address.py
.py
17629aefae1bda39
7.52
10
"""Interface list management tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class InterfaceListTool: """Tool for getting available firewall interface names.""" name = "interface_list" description = "Get...
coreyhines/opnsense-mcp
opnsense_mcp/tools/interface_list.py
.py
b0bd698fb1f8fa8c
7.52
10
"""LLDP (Link Layer Discovery Protocol) neighbor table management tool.""" import logging from typing import Any from pydantic import BaseModel from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class LLDPEntry(BaseModel): """Model for LLDP neighbor table entries.""" i...
coreyhines/opnsense-mcp
opnsense_mcp/tools/lldp.py
.py
227ebbcef160e281
7.52
10
"""Unbound DNS host override creation tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import OPNsenseClient, _record_type_for_server logger = logging.getLogger(__name__) class MkdnsTool: """Tool for adding Unbound DNS host overrides.""" name = "mkdns" descriptio...
coreyhines/opnsense-mcp
opnsense_mcp/tools/mkdns.py
.py
5c2102e4341fc213
7.52
10
"""Firewall rule creation tool for OPNsense.""" import logging from typing import Any from pydantic import BaseModel, field_validator from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class FirewallRuleSpec(BaseModel): """Specification for creating a firewall rule.""" ...
coreyhines/opnsense-mcp
opnsense_mcp/tools/mkfw_rule.py
.py
532944c772bc9c82
7.52
10
"""MCP tool to delete a DHCP host reservation.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class RmDhcpHostTool: """Delete a dnsmasq DHCP host reservation...
coreyhines/opnsense-mcp
opnsense_mcp/tools/rm_dhcp_host.py
.py
0406ea41c9887463
7.52
10
"""Unbound DNS host override deletion tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class RmdnsTool: """Tool for deleting Unbound DNS host overrides.""" name = "rmdns" description = "Delete a DNS host ...
coreyhines/opnsense-mcp
opnsense_mcp/tools/rmdns.py
.py
bf9720599d0995f5
7.52
10
"""Firewall rule deletion tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) class RmfwRuleTool: """Tool for deleting firewall rules in OPNsense.""" name = "rmfw_rule" description = "Delete firewall rules" ...
coreyhines/opnsense-mcp
opnsense_mcp/tools/rmfw_rule.py
.py
bc8fa77f6e6bddd3
7.52
10
"""Firewall rule edit tool for OPNsense.""" import logging from typing import Any from opnsense_mcp.utils.api import OPNsenseClient logger = logging.getLogger(__name__) # Fields that can be edited on an existing rule _EDITABLE_FIELDS = { "description", "interface", "direction", "ipprotocol", "pr...
coreyhines/opnsense-mcp
opnsense_mcp/tools/set_fw_rule.py
.py
d3fc502b8930550f
7.52
10
from time import time from typing import Callable from fastapi import HTTPException, Request, Response from fastapi.routing import APIRoute from ..common import logger class RequestLoggingRoute(APIRoute): """A FastAPI route that will add request info to logs from this level down. It has access to the path p...
NHSDigital/mesh-sandbox
src/mesh_sandbox/routers/request_logging.py
.py
81968e27f329dd03
7.45
7
"""Plate diagram for the TCRi generative model, annotated with the knobs that tune it. Run this to regenerate ``docs/images/model_pgm.png``:: .venv-docs/bin/python docs/model_pgm.py The output is **committed** rather than built by Sphinx: the docs build installs only ``docs/requirements.txt`` (mirroring Read the...
nceglia/tcri
docs/model_pgm.py
.py
813cf5fa6cb9249d
7.5
9
"""Distance / divergence kernels for phenotype distributions. Single home for the KL kernel (was `metrics.dkl` + `flux.dkl_func`, two copies) plus L1 and a symmetric Jensen–Shannon option. All operate on 1-D probability vectors, use log base 2 (bits), and share one eps floor. ``phenotype_distance`` is the string→calla...
nceglia/tcri
tcri/_compute/_distance.py
.py
c232e40499d7408e
7.5
9
"""Device seam for the batched engine — **torch-first** (grafiti `_compute/_xp` parity, adapted because tcri's numeric core is torch: the Dirichlet draws and the softmax are `torch`, and torch≥2.4 is already a hard dep so torch.cuda is zero new deps). `cupy` may be added later as a second backend; for now the ladder is...
nceglia/tcri
tcri/_compute/_xp.py
.py
4903cd0e3cc80dfa
7.5
9
"""Result shapes for the ``tl`` metrics, as ``TypedDict``s. ``@tl_result(schema=...)`` checks required-key PRESENCE on dict results. The shapes in the trailing comments are documentation — nothing parses them — but they are the only place the payload layout is written down, so keep them accurate. Every metric returns...
nceglia/tcri
tcri/_state/schemas.py
.py
5ffc745529616dce
7.5
9
"""``compare_groups`` — INTERNAL. The one contrast implementation in the package. Turns a per-unit frame (one row per replicate, e.g. per patient) into group contrasts. Unpaired: Mann-Whitney U + two-sided p + delta of means. Paired (``paired=True``): per-unit posterior-draw vectors aligned by ``pair_on`` -> signed de...
nceglia/tcri
tcri/_stats/_compare.py
.py
b0a876e8b4db9ecb
7.5
9
"""Shared statistics helpers. The significance / AUROC helpers plus the posterior-summary primitives the metric layer needs (true HDI, signed-direction probability). ``auc_and_label_permutation`` and ``bootstrap_auc`` are re-exported as ``tcri.ut.*``. They are complementary -- a permutation p-value against shuffled l...
nceglia/tcri
tcri/_stats/_core.py
.py
3c3f32ce9dea32f2
7.5
9
"""``tcri.diag`` training diagnostics (§9.2) — the two model plots relocated off ``TCRIModel`` (``plot_loss`` → :func:`loss`, ``plot_archetypes`` → :func:`archetypes`).""" from __future__ import annotations import numpy as np __all__ = ["loss", "archetypes"] def _series(hist, key): """Pull a 1-D value array fro...
nceglia/tcri
tcri/diagnostics/_training.py
.py
7864b6ae01eb4a3d
7.5
9
"""Accessors for cached ``tl`` results — ``tcri.get.*``. Every ``tl`` metric stores its result under a namespaced ``uns`` key and returns the same object. This module is how everything else reads it back without knowing the blob format: ``pl`` renders from here, and so should any user code that wants the table a plot ...
nceglia/tcri
tcri/get.py
.py
bb1cab0eaf25857d
7.5
9
"""Prior distributions for the TCRI generative model. `VampPrior` is a learnable mixture-of-encoders prior over the latent space; `MixtureDirichlet` is the per-clonotype mixture-of-Dirichlets used as the clonotype-level phenotype prior. """ import torch import pyro.distributions as dist __all__ = ["MixtureDirichlet",...
nceglia/tcri
tcri/model/_priors.py
.py
8ca3557793f71cac
7.5
9
"""``pl.delta_*`` (§8.4) — cache renderers for the paired entropies. Two views of one cached result, selected by ``kind``: ``"delta"`` (default) The change itself, with a zero rule. Mass either side of zero is the direction. ``"endpoints"`` ``cov_from`` and ``cov_to`` side by side, connected per replicate. T...
nceglia/tcri
tcri/plotting/_delta.py
.py
cfe170fd21399bd1
7.5
9
"""``pl.clonotypic_entropy`` / ``pl.phenotypic_entropy`` (§8.1) — cache renderers. The two differ in one thing, and it is a property of the metric rather than a style choice: H(c|phi) has one value per PHENOTYPE, a handful of named categories that belong on the x axis; H(phi|c) has one value per CLONE, which is the wh...
nceglia/tcri
tcri/plotting/_entropy.py
.py
0cf784f899a7f918
7.5
9
import numpy as np import matplotlib.patches as mpatches import matplotlib.colors as mcolors class SankeyNode(object): """Object for sankey node""" def __init__(self, x, y, val, dx = 0.2, color = None, **kwargs): self.x = x self.y = y self.dx = dx self.dy = val self.x_...
nceglia/tcri
tcri/plotting/_sankey.py
.py
1dd780ef8e6f678b
7.5
9