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
""" This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py without the Pydantic v1 specific errors. """ from __future__ import annotations import re from typing import Dict, Union, Optional from datetime import date, datetime, timezone, timedelta from .._types impor...
Metronome-Industries/metronome-python
src/metronome/_utils/_datetime_parse.py
.py
6c0053b3405ceab6
7.35
4
import json from typing import Any from datetime import datetime from typing_extensions import override import pydantic from .._compat import model_dump def openapi_dumps(obj: Any) -> bytes: """ Serialize an object to UTF-8 encoded JSON bytes. Extends the standard json.dumps with support for additional...
Metronome-Industries/metronome-python
src/metronome/_utils/_json.py
.py
6e5f79bae216c204
7.35
4
from __future__ import annotations import re from typing import ( Any, Mapping, Callable, ) from urllib.parse import quote # Matches '.' or '..' where each dot is either literal or percent-encoded (%2e / %2E). _DOT_SEGMENT_RE = re.compile(r"^(?:\.|%2[eE]){1,2}$") _PLACEHOLDER_RE = re.compile(r"\{(\w+)\}"...
Metronome-Industries/metronome-python
src/metronome/_utils/_path.py
.py
0e4dbde257afb895
7.35
4
from __future__ import annotations from abc import ABC, abstractmethod from typing import Generic, TypeVar, Iterable, cast from typing_extensions import override T = TypeVar("T") class LazyProxy(Generic[T], ABC): """Implements data methods to pretend that an instance is another instance. This includes forw...
Metronome-Industries/metronome-python
src/metronome/_utils/_proxy.py
.py
6a09678f6c814c3c
7.35
4
from __future__ import annotations import inspect from typing import Any, Callable def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool: """Returns whether or not the given function has a specific parameter""" sig = inspect.signature(func) return arg_name in sig.parameters def ass...
Metronome-Industries/metronome-python
src/metronome/_utils/_reflection.py
.py
6661a42204ff3eec
7.35
4
from __future__ import annotations from typing import Any from typing_extensions import override from ._proxy import LazyProxy class ResourcesProxy(LazyProxy[Any]): """A proxy for the `metronome.resources` module. This is used so that we can lazily import `metronome.resources` only when needed *and* so...
Metronome-Industries/metronome-python
src/metronome/_utils/_resources_proxy.py
.py
9554eb2ada13c181
7.35
4
from __future__ import annotations import asyncio import functools from typing import TypeVar, Callable, Awaitable from typing_extensions import ParamSpec import anyio import sniffio import anyio.to_thread T_Retval = TypeVar("T_Retval") T_ParamSpec = ParamSpec("T_ParamSpec") async def to_thread( func: Callable...
Metronome-Industries/metronome-python
src/metronome/_utils/_sync.py
.py
1c19d9924067cf1b
7.35
4
from __future__ import annotations import sys import typing import typing_extensions from typing import Any, TypeVar, Iterable, cast from collections import abc as _c_abc from typing_extensions import ( TypeIs, Required, Annotated, get_args, get_origin, ) from ._utils import lru_cache from .._type...
Metronome-Industries/metronome-python
src/metronome/_utils/_typing.py
.py
37fe4f3ee14db1ac
7.35
4
from __future__ import annotations import os import re import inspect import functools from typing import ( Any, Tuple, Mapping, TypeVar, Callable, Iterable, Sequence, cast, overload, ) from pathlib import Path from datetime import date, datetime from typing_extensions import TypeGu...
Metronome-Industries/metronome-python
src/metronome/_utils/_utils.py
.py
b20e7fe155da2908
7.35
4
# kinetix/configs/defect_config.py """Defect configuration dataclasses.""" from dataclasses import dataclass, field from typing import List, Dict, Optional, Any from enum import Enum from pathlib import Path import yaml class SiteType(Enum): INTERSTITIAL = "interstitial" SUBLATTICE = "sublattice" clas...
aldanads/Kinetix
kinetix/configs/defect_config.py
.py
b0ccf27317d7d83b
7.15
1
# kinetix/configs/material_config.py """Material and crystal structure configuration.""" from dataclasses import dataclass, field from typing import Tuple, Optional, Any, Dict @dataclass class MaterialSelection: """Material identification and MP database info.""" name: str mp_id: str radius_neighbors...
aldanads/Kinetix
kinetix/configs/material_config.py
.py
057fa394ebab61c3
7.15
1
# kinetix/configs/mesh_config.py from dataclasses import dataclass, field from typing import Dict, Any, Optional from pathlib import Path import yaml @dataclass class MeshConfig: """Mesh generation parameters for Gmsh.""" # Domain settings gdim: int = 3 gmsh_model_rank: int = 0 # Glob...
aldanads/Kinetix
kinetix/configs/mesh_config.py
.py
02e80d61a8d82e61
7.15
1
# kinetix/configs/reaction_config.py """Reaction configuration dataclasses.""" from dataclasses import dataclass, field from typing import List, Dict, Any, Optional from pathlib import Path import yaml @dataclass class ReactionSpecies: """A species in a reaction (reactant or product).""" symbol: str s...
aldanads/Kinetix
kinetix/configs/reaction_config.py
.py
06c8d9ad1a46b22c
7.15
1
# kinetix/configs/solver_config.py """Poisson and Heat solver configuration.""" from dataclasses import dataclass, field from typing import Dict, Any, Optional from pathlib import Path @dataclass class PoissonSolverConfig: """Poisson equation solver parameters.""" mesh_file: str = "" epsilon_r: float =...
aldanads/Kinetix
kinetix/configs/solver_config.py
.py
c13756e71c4496c8
7.15
1
# -*- coding: utf-8 -*- """Cluster class for filament analysis.""" import numpy as np class Cluster: def __init__(self,cluster_atoms,atoms_positions,attached_layer,conductivity): self.atoms_id = set(cluster_atoms) self.atoms_positions = atoms_positions self.size = len(self.atoms_id) ...
aldanads/Kinetix
kinetix/lattice/cluster.py
.py
67effe596253dae8
7.15
1
# -*- coding: utf-8 -*- """GrainBoundary class for GB physics.""" import numpy as np import math class GrainBoundary: def __init__(self,domain_size, gb_configurations: list[dict] = None): """ Grain boundaries for memristive filament formation. Supporing: - Vertical planar bound...
aldanads/Kinetix
kinetix/lattice/grain_boundary.py
.py
e69ba9d0f130fbba
7.15
1
# -*- coding: utf-8 -*- """ Created on Wed Jan 25 10:03:02 2023 @author: ALDANADS """ class Node: def __init__(self, data): self.data = data self.left = None self.right = None # arr should be a tuple def build_tree(arr): if not arr: return None if len(arr) == 1: r...
aldanads/Kinetix
kinetix/utils/balanced_tree.py
.py
f487fe1047fdcc50
7.15
1
# utils/mpi_context.py class MPIContext: """ Centralized MPI context manager Initialize once at program entry """ _instance = None def __init__(self): self._initialize_mpi() def _initialize_mpi(self): """ Try to initialize MPI, detect if running in parallel """ try: ...
aldanads/Kinetix
kinetix/utils/mpi_context.py
.py
f8105ac907c283de
7.15
1
import numpy as np from scipy.spatial import cKDTree from pathlib import Path def parse_lammps_dump(dump_path: str) -> dict: """ Extracts timestep, box bounds, and atom data (id, type, x, y, z, charge) """ with open(dump_path, 'r') as f: lines = f.readlines() timestep = 0.0 atoms =...
aldanads/Kinetix
kinetix/utils/state_loader.py
.py
6710bb883a704ee0
7.15
1
""" Tests for FEMSolverBase class. """ import pytest import numpy as np from pathlib import Path from dolfinx import fem from solvers.FEMSolverBase import FEMSolverBase from utils.mpi_context import MPIContext class TestFEMSolverBase: """Test suite for FEMSolverBase.""" def test_mpi_con...
aldanads/Kinetix
tests/test_FEMSolver.py
.py
1133af5467f21a50
7.65
1
# tests/test_poisson_solver.py """ Tests for PoissonSolver class. """ import pytest import numpy as np from pathlib import Path from scipy.constants import epsilon_0 from solvers.poisson import PoissonSolver from utils.mpi_context import MPIContext class MockCluster: """Mock Cluster object for testin...
aldanads/Kinetix
tests/test_poisson_solver.py
.py
3e53cbdd8de82cc5
7.65
1
#!/usr/bin/env python3 # Copyright (c) 2024 Red Hat, Inc. # Copyright Contributors to the Open Cluster Management project # Assumes: Python 3.6+ import argparse import coloredlogs import glob import json import logging import os import shutil import yaml from git import Repo # Configure logging with coloredlogs col...
stolostron/installer-dev-tools
scripts/bundle-generation/generate-sha-commits.py
.py
11e8e6882da0100e
7.15
1
#!/usr/bin/env python3 # Copyright (c) 2021 Red Hat, Inc. # Copyright Contributors to the Open Cluster Management project # Assumes: Python 3.6+ import argparse import os import re import shutil import yaml import logging import subprocess from git import Repo, exc from packaging import version from validate_csv impo...
stolostron/installer-dev-tools
scripts/bundle-generation/move-charts.py
.py
0251b26cdcb974a3
7.15
1
#!/usr/bin/env python3 """ Unit tests for the fetch_sha_from_git_remote function. """ import unittest from utils.git_sha_fetcher import fetch_sha_from_git_remote class TestFetchShaFromGitRemote(unittest.TestCase): """Test cases for fetch_sha_from_git_remote function.""" def test_fetch_sha_from_hive_master(s...
stolostron/installer-dev-tools
scripts/bundle-generation/test_fetch_sha.py
.py
97860090ddc7577a
7.65
1
#!/usr/bin/env python3 """ Analyze vulnerability CSV files and report high/critical issues by component. This script reads a vulnerability CSV file (created by parse_vulnerabilities.py) and reports on high and critical severity vulnerabilities grouped by component. """ import csv import sys import argparse from colle...
stolostron/installer-dev-tools
scripts/konflux/analyze_vulnerabilities.py
.py
3e86fbaa33817838
7.15
1
#!/usr/bin/env python3 """ Split a Konflux Snapshot YAML file into individual snapshots per component. This script takes a snapshot YAML file containing multiple components and creates separate snapshot files for each component, making it easier to manage and track individual container images. Usage: ./split_snap...
stolostron/installer-dev-tools
scripts/konflux/split_snapshot.py
.py
1aa0c3179025104f
7.15
1
#!/usr/bin/env python3 """ Policy Violation Summary Script Parses konflux log files and summarizes policy violations by component and violation type. """ import re import sys import glob from collections import defaultdict, Counter from pathlib import Path def extract_component_from_image(image_ref): """Extract ...
stolostron/installer-dev-tools
scripts/konflux/summarize_violations.py
.py
8f2ccef88dfb6bc0
7.15
1
#!/usr/bin/env python3 # Copyright (c) 2025 Red Hat, Inc. # Copyright Contributors to the Open Cluster Management project # Assumes: Python 3.6+ import utils.common import inquirer def prompt_user(prompt, default=None, required=False, example=None): """Prompt the user for input, with an optional default, example,...
stolostron/installer-dev-tools
scripts/release/onboard-new-components.py
.py
b6162a33e472bd05
7.15
1
#!/usr/bin/env python3 # Copyright (c) 2024 Red Hat, Inc. # Copyright Contributors to the Open Cluster Management project # Assumes: Python 3.6+ import argparse import logging import os import shutil from git import Repo TARGET_DIR = "config/images" TARGET_FILE = os.path.join(TARGET_DIR, "image-alias.json") def fet...
stolostron/installer-dev-tools
scripts/release/refresh-image-aliases.py
.py
5d57725bb0dcf4ce
7.15
1
#!/usr/bin/env python3 # Copyright (c) 2025 Red Hat, Inc. # Copyright Contributors to the Open Cluster Management project # Assumes: Python 3.6+ import coloredlogs import logging import os import shutil import yaml # Configure logging with coloredlogs coloredlogs.install(level='DEBUG') # Set the logging level as nee...
stolostron/installer-dev-tools
scripts/utils/common.py
.py
e3b7a1b2c4468371
7.15
1
"""Traffic-light image DGP: three circles encode a confounded, a mediated, and an independent signal.""" import torch def circle_mask(h, w, center, radius): """Boolean (h, w) mask of a filled circle.""" Y, X = torch.meshgrid(torch.arange(h), torch.arange(w), indexing='ij') dist = (X - center[1]) ** 2 + (Y...
mpff/cocodeel
experiments/simulation/common/dgp.py
.py
4fcdd4cba6f830e6
7
0
"""Resumable multiprocessing runner for (sweep, setting, seed) simulation grids.""" import csv import datetime import json import os import subprocess import time import traceback from pathlib import Path import torch.multiprocessing as mp ROOT = Path(__file__).resolve().parents[3] def _git_commit(): try: ...
mpff/cocodeel
experiments/simulation/common/grid_runner.py
.py
5b136335b64a2764
7
0
"""Shared multiprocessing driver and CSV writer for the hyperparameter searches.""" import csv import datetime import time import torch.multiprocessing as mp def run_pool(tasks, fit_one, n_workers, describe): """Run fit_one over tasks in a spawn pool; print one `describe(res)` line per result.""" t_start = t...
mpff/cocodeel
experiments/simulation/hpsearch/_grid_search.py
.py
4c26ce5c7c81a37e
7
0
"""Adversarial confound-predictor baseline: CF-Net (Zhao, Adeli & Pohl 2020). Trains a Z-free `BaseNetwork` end-to-end while an auxiliary confound predictor is used adversarially to push backbone features toward zero (squared) correlation with the covariates. A competitor to the post-hoc and semi-structured baselines:...
mpff/cocodeel
src/cocodeel/benchmarking/adversarial_trainer.py
.py
2bd1ac71cdd50d06
7
0
"""End-to-end competitor models: NAM-style networks training f(X) and f(Z) jointly by SGD.""" import torch import torch.nn as nn from cocodeel.model import _BaseCovarNetwork from cocodeel.transform import Center class CovarNetwork(_BaseCovarNetwork): """Covariate Network: includes covariate (Z) effects.""" ...
mpff/cocodeel
src/cocodeel/benchmarking/model.py
.py
d84e52db139ef7c9
7
0
"""Cross-fitted ensemble of already-fitted, disjoint-fold RefitCovarNetwork models.""" import torch class CrossFitEnsemble: """K-fold cross-fit ensemble: eta_hat = (1/K) sum_k eta_k, with the link applied once.""" # The link is never applied per fold: mean_k(g^-1(eta_k)) != g^-1(mean_k(eta_k)) # for a no...
mpff/cocodeel
src/cocodeel/crossfit.py
.py
f0a0b744913183ea
7
0
from torch.utils.data import Dataset class CovarDataset(Dataset): """Dataset with covariates.""" def __init__(self, X, Z, y, transform=None): """ Args: X (torch.tensor): Array of input images. Z (torch.tensor): Array of covariates. y (torch.tensor): Array of...
mpff/cocodeel
src/cocodeel/dataset.py
.py
979c01476563826d
7
0
import torch import torch.nn as nn class DummyBackbone(nn.Module): """Minimal backbone for tests: flatten input, apply one linear map. `identity=True` initialises the linear map to the (rectangular) identity with zero bias, making the backbone an exact pass-through of the first `out_features` flatten...
mpff/cocodeel
tests/conftest.py
.py
5508c07ab2b71fbc
7.5
0
"""Based on example from https://gist.github.com/treuille/2ce0acb6697f205e44e3e0f576e810b7""" import itertools from collections.abc import Iterable, Iterator from typing import Any import streamlit as st def page_format_func(i: int) -> str: return f"Page {i}" def paginator( label: str, items: Iterable[Any...
panjacek/face_finder
src/face_finder/paginator.py
.py
c3fc25569b41d389
7
0
""" Apply Updated Functions (self-healing review tool) Reads the Claude-rewritten functions that the nodriver self-healing layer (``session_maintenance/self_healing.py``) saves to ``session_maintenance/updated_functions/`` and splices each one back into its original source file (e.g. ``session_maintenance/flows.py``)....
BenjaminWalkerBond/auto_grocer
scripts/apply_updates.py
.py
1231925ebdcde9e1
7
0
"""One-off seeder for a batch of recipe sources (YouTube + web pages). Runs in a FRESH process so it picks up the latest utility/youtube.py code (the long-lived MCP server caches modules and won't see edits until restarted). It calls the real seed_recipes logic (mcp_server.seed_recipes.fn), writing to the same databas...
BenjaminWalkerBond/auto_grocer
scripts/seed_from_sources.py
.py
92f1aba3bd3fd306
7
0
"""Launch a patched (patchright) Chromium context for the HEB stealth spike. Mirrors the env contract of ``auto_grocer.session_maintenance.browser`` so it drops into the existing Docker image unchanged: NODRIVER_BROWSER_PATH / CHROME_BIN - explicit Chromium/Chrome binary. AUTO_GROCER_NO_SANDBOX=1 ...
BenjaminWalkerBond/auto_grocer
spikes/patchright/browser.py
.py
c04859f90bc3dc07
7
0
"""HEB cold-login + GraphQL hash capture + session export, on patchright. Faithfully mirrors the nodriver login flow in ``auto_grocer.session_maintenance.flows.login`` (email -> Continue -> password -> submit -> email OTP -> dismiss passkey), but expressed in patchright's Playwright-compatible API. Reuses the project'...
BenjaminWalkerBond/auto_grocer
spikes/patchright/flow.py
.py
fa159b2da90b6dc5
7
0
import io import json import os import sys from typing import cast import anthropic from anthropic.types import TextBlock from dotenv import load_dotenv # Ensure stdout/stderr use UTF-8 so the project's Unicode status symbols (✓, 🥗, # emoji) don't crash on Windows, whose console defaults to a legacy code page # (cp1...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/claude.py
.py
0e466be44395e7bb
7
0
""" Database configuration module. Loads database connection parameters from the environment (.env file). """ import os from pathlib import Path from dotenv import load_dotenv # Load the project's .env (repo root) so DATABASE_* settings are available even # when this module is imported without an entry point having l...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/database/db_config.py
.py
ab54ce6d4566a9c9
7
0
""" Database connection module. Manages SQLAlchemy engine and session creation. """ from collections.abc import Iterator from sqlalchemy import create_engine from sqlalchemy.engine import Engine from sqlalchemy.orm import Session, sessionmaker from .db_config import DatabaseConfig # Create database engine engine: En...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/database/db_connection.py
.py
49b98911d7619caf
7
0
""" Repository for Ingredient operations. Provides CRUD operations for ingredients. """ from typing import List, Optional from sqlalchemy.orm import Session from .models import Ingredient, Tag from .tag_repository import TagRepository class IngredientRepository: """Repository for managing ingredients in the dat...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/database/ingredient_repository.py
.py
3b847ee9a7be3093
7
0
""" Database models for the auto_grocer application. Defines the schema for ingredients, tags, and recipes. """ from datetime import datetime from sqlalchemy import DECIMAL, TIMESTAMP, Column, ForeignKey, Integer, String, Table, Text from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship cla...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/database/models.py
.py
e9a818bb5b14fd12
7
0
""" Seed recipes into the database from a list of URLs. For each URL this script: 1. Extracts title + description (via recipe_grabber.extract_recipe_metadata). 2. Creates/gets the recipe row (RecipeRepository.get_or_create). 3. If the recipe has no ingredients yet, scrapes ingredients (recipe_grabber.popula...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/database/seed_recipes.py
.py
0ac61d96abbcb69a
7
0
import re import sys from urllib.parse import urlparse import requests from bs4 import BeautifulSoup # import classes.Ingredient as Ingredient from auto_grocer.classes.Ingredient import Ingredient # import classes.IngredientList as IngredientList from auto_grocer.classes.IngredientList import IngredientList from aut...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/recipe_grabber.py
.py
76e4644dfa6a66a6
7
0
"""Export a live nodriver session to the Playwright-format auth.json the MCP GraphQL client reads. This is the async counterpart of utility/graphql_auth.export_selenium_session_to_authjson. It reuses that module's pure mapping/reporting helpers and only swaps the parts that read from the browser: * driver.get_cookie...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/session_maintenance/auth_export.py
.py
c9124414dd5f8855
7
0
"""Capture HEB GraphQL persisted-query hashes via live CDP Network events. The Selenium version (utility/graphql_hash_capture.py) periodically drained the destructive Chrome performance log. nodriver lets us subscribe to the CDP ``Network.requestWillBeSent`` event directly and accumulate operations live, so nothing ro...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/session_maintenance/hash_capture.py
.py
d76f4d3dc2b7d1ff
7
0
"""Async debug logger for the nodriver prototype. Mirrors utility/driver_logger.py (timestamped session dir, HTML + screenshot + error JSON) but uses nodriver's async tab API instead of the Selenium driver: * driver.page_source -> await tab.get_content() * driver.save_screenshot() -> await tab.save_screens...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/session_maintenance/logger.py
.py
4aa180b390dcddbf
7
0
"""Async primitives for the nodriver prototype. These mirror the small Selenium helpers in main.py (random_time, human_like_*, scroll_to_element, check_exists_by_xpath, dismiss_modals) plus a couple of select-with-fallback helpers that replace the WebDriverWait/EC retry loops. nodriver notes: * tab.select(css, time...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/session_maintenance/primitives.py
.py
84d0507916c085cd
7
0
"""Detection for HEB's "security setting on your device" block page. When Imperva/Incapsula rate-limits or fingerprint-blocks the automation, HEB does not return a normal Incapsula interstitial. It renders a JS-built overlay that blames the *client*: "The page can't load due to a security setting on your device."...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/session_maintenance/waf_block.py
.py
15fb2c14c66e9e64
7
0
"""Helpers for writing the Playwright-format ``auth.json`` storage-state file the vendored ``auto_grocer_mcp`` GraphQL client reads. The GraphQL client authenticates from ``auth.json`` (HEB session cookies plus the ``reese84`` WAF/bot-detection token). The session is produced by the nodriver browser flow (``session_ma...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/utility/graphql_auth.py
.py
d4a9450e0ce6b4a5
7
0
"""Parse + persist HEB GraphQL persisted-query hashes captured from live traffic. HEB uses Apollo "persisted queries": each GraphQL operation is sent with only a sha256 hash instead of the full query text. HEB rotates these hashes on every front-end deploy, which invalidates the hard-coded values bundled in ``auto_gro...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/utility/graphql_hash_capture.py
.py
c9c73cc40e47ab6e
7
0
"""Store search and selection for the GraphQL cart modes. Lets the user find the closest HEB stores to an address and pick one to use as the active store for searching/pricing and (when authenticated) for pickup fulfillment. Backed by the vendored ``auto_grocer_mcp`` GraphQL client. """ import asyncio import re impor...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/utility/graphql_store.py
.py
2b6af749f6ee6d44
7
0
""" Natural-language recipe matching. Turns a user request like "I want palak paneer, chicken buffalo wraps, and penne alla vodka this week" into a set of recipes from the database, then builds an IngredientList from the ingredients of those recipes for the existing cart pipeline. Matching strategy: 1. Primary:...
BenjaminWalkerBond/auto_grocer
src/auto_grocer/utility/recipe_matcher.py
.py
18af046a0c678aeb
7
0
# coding: utf-8 -*- # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' name: flightctl_console short_description: Connect to Flight Control managed devices descript...
flightctl/flightctl-ansible
plugins/connection/flightctl_console.py
.py
5c83cfa83fcd4ad8
7.3
3
# coding: utf-8 -*- # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type try: import jsonschema except ImportError as imp_exc: JSONSCHEMA_IMPORT_ERROR = imp_exc else: JSONSCHE...
flightctl/flightctl-ansible
plugins/module_utils/config_loader.py
.py
b6c5aa3480c9553d
7.3
3
# coding: utf-8 -*- # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import base64 import re import tempfile from typing import Any, Callable, Dict, Optional from ansible.module_util...
flightctl/flightctl-ansible
plugins/module_utils/core.py
.py
7a8c36f9d8356b56
7.3
3
# coding: utf-8 -*- # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type from typing import Any, Callable, Dict, Optional from .core import FlightctlModule from .exceptions import Flight...
flightctl/flightctl-ansible
plugins/module_utils/imagebuilder_module.py
.py
c8841031accdfb85
7.3
3
# coding: utf-8 -*- # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json from ansible.module_utils.urls import open_url from .exceptions import ValidationException def fet...
flightctl/flightctl-ansible
plugins/module_utils/oidc_auth.py
.py
ce9a035898128fe8
7.3
3
# coding: utf-8 -*- # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type from typing import Any, Dict, Iterable, List, Optional, Union, cast from .constants import API_MAPPING, ResourceT...
flightctl/flightctl-ansible
plugins/module_utils/resources.py
.py
8354fac60f259cc8
7.3
3
# coding: utf-8 -*- # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json from typing import Any, Dict def is_pydantic_validation_error(exc: Exception) -> bool: """Check ...
flightctl/flightctl-ansible
plugins/module_utils/sdk_utils.py
.py
6207b6ee09490711
7.3
3
# coding: utf-8 -*- # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json import traceback from typing import Any, Dict, List, Optional, Tuple from ansible.module_utils.basic ...
flightctl/flightctl-ansible
plugins/module_utils/utils.py
.py
c8fe305efddb3354
7.3
3
"""Simple transaction builder helper for UTxO RPC using PyCardano.""" from pycardano import ( PaymentSigningKey, PaymentVerificationKey, HDWallet, Address, Network, TransactionBuilder, TransactionOutput, Value, ) TEST_CONFIG = { "uri": "localhost:50051", "headers": {}, "ne...
utxorpc/python-sdk
examples/tx_builder.py
.py
1be75dfc5f8eeb04
7.35
4
from __future__ import annotations from typing import AsyncGenerator, Any, Generic, Optional from utxorpc_spec.utxorpc.v1alpha.submit.submit_pb2 import ( # type: ignore SubmitTxRequest, WaitForTxRequest, WatchMempoolRequest, AnyChainTx, TxInMempool, TxPredicate, Stage, ) from utxorpc_spec...
utxorpc/python-sdk
utxorpc/generics/clients/submit.py
.py
bb4e8721063af2f7
7.35
4
""" Command line interface for working with buoy database. """ from pathlib import Path from enum import Enum from pandas import DataFrame from influxdb_client_3 import InfluxDBClient3 from click import group from lib import ( influx_options, influx_host, influx_api_token, ) from buoys import ( buoys, ...
hurricane-island/pen-bay-marine-data
buoys/database/__init__.py
.py
eef58cca9cbec709
7.15
1
""" Quality assurance and quality control (QA/QC) for buoy data using QARTOD tests. """ from datetime import datetime from typing import cast from enum import Enum from pathlib import Path from click import option, Choice from yaml import safe_load from numpy import where from pandas import concat, DataFrame from pand...
hurricane-island/pen-bay-marine-data
buoys/qartod/__init__.py
.py
292a69fe3a1ec54e
7.15
1
""" Example of processing a CSV file with pandas. Once you understand how things work, use these methods to analyze your own data. Not covered: - check a daily trend - add another series - subplots """ from datetime import datetime from pathlib import Path from pandas import DataFrame, read_csv, to_datetime from matp...
hurricane-island/pen-bay-marine-data
data_training/examples.py
.py
47c8da95c1cd51f5
7.15
1
""" Read data from either the exported CSV files from Govee or Sol Ark devices, or query the API for each. Visualize the data. """ from os import listdir, path from datetime import datetime from pathlib import Path from sys import argv from pandas import DataFrame, read_csv, to_datetime, concat from matplotlib.pyplot ...
hurricane-island/pen-bay-marine-data
island/__init__.py
.py
f33c29f908d92baf
7.15
1
""" Shared across sensing platforms and systems. Mostly related to processing Pandas DataFrames and plotting with Matplotlib. """ from datetime import datetime, timedelta from enum import Enum from pathlib import Path from typing import Optional, Callable from matplotlib import pyplot as plt, dates as mdates from matp...
hurricane-island/pen-bay-marine-data
lib.py
.py
ee932884afa497d9
7.15
1
""" LoRaWAN CLI commands. """ from enum import Enum from os import getenv from pathlib import Path from uuid import uuid4 from typing import Optional from random import uniform, randint from datetime import datetime, timedelta, timezone import json import requests import click from pyproj import Transformer from pandas...
hurricane-island/pen-bay-marine-data
lorawan/__init__.py
.py
ec1d7bf205b6d1ca
7.15
1
""" Command line interfaces for working with vertical profiles of water column data, such as temperature, salinity, and density. """ import click from pathlib import Path from pandas import read_csv, DataFrame, Series, cut from numpy import arange from matplotlib.pyplot import subplots DATA_DIR = Path(__file__).parent...
hurricane-island/pen-bay-marine-data
profiles/__init__.py
.py
0ce311e5efcfe2d4
7.15
1
# pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals """ Weather Station Tools CLI: This module provides a command-line interface for using weather station data, including: - `export`:Concatenate CSV files from a single station - `describe`: Show summary statistics for a station - `db`: ...
hurricane-island/pen-bay-marine-data
weather/__init__.py
.py
63617b92398d28ec
7.15
1
#!/usr/bin/env python3 # Copyright 2024-2026 Canonical Ltd. # See LICENSE file for licensing details. """Charm the application.""" import logging from typing import cast import ops from charms.filesystem_client.v0.filesystem_info import CephfsInfo, FilesystemProvides logger = logging.getLogger(__name__) class Cha...
canonical/filesystem-charms
charms/cephfs-server-proxy/src/charm.py
.py
011a9f955048024c
7.24
2
# Copyright 2025 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
canonical/filesystem-charms
charms/filesystem-client/lib/charms/filesystem_client/v0/mount_info.py
.py
42c22ad5611d3f79
7.24
2
#!/usr/bin/env python3 # Copyright 2024-2026 Canonical Ltd. # See LICENSE file for licensing details. """Charm for the filesystem client.""" import logging from typing import cast import ops from charmed_hpc_libs.ops import StopCharm, refresh from charms.filesystem_client.v0.filesystem_info import FilesystemRequires...
canonical/filesystem-charms
charms/filesystem-client/src/charm.py
.py
61b5c9e1e7177e4f
7.24
2
# Copyright 2024-2026 Canonical Ltd. # See LICENSE file for licensing details. """Manage machine mounts and dependencies.""" import contextlib import logging import os import pathlib from collections.abc import Iterator from dataclasses import dataclass from ipaddress import AddressValueError, IPv6Address import ops...
canonical/filesystem-charms
charms/filesystem-client/src/utils/manager.py
.py
0a755283fb3f9dfd
7.24
2
#!/usr/bin/env python3 # Copyright 2024-2026 Canonical Ltd. # See LICENSE file for licensing details. """Unit tests for FilesystemClientCharm.""" import json from dataclasses import asdict from unittest.mock import MagicMock, patch import pytest from charm import FilesystemClientCharm from charms.filesystem_client.v...
canonical/filesystem-charms
charms/filesystem-client/tests/unit/test_charm.py
.py
ee058547a7533ed3
7.74
2
#!/usr/bin/env python3 # Copyright 2024-2026 Canonical Ltd. # See LICENSE file for licensing details. """Test the filesystem_info charm library.""" import pytest from charms.filesystem_client.v0.filesystem_info import ( FilesystemRequires, NfsInfo, _hostinfo, ) from ops import CharmBase FS_INTEGRATION_NA...
canonical/filesystem-charms
charms/filesystem-client/tests/unit/test_filesystem_info.py
.py
56d83f52d92304e2
7.74
2
# Copyright 2024-2026 Canonical Ltd. # See LICENSE file for licensing details. """Unit tests for `utils.manager.MountsManager`.""" import pathlib from unittest.mock import MagicMock import pytest from charms.filesystem_client.v0.filesystem_info import NfsInfo from lustre_ops.errors import LNetError from pytest_mock ...
canonical/filesystem-charms
charms/filesystem-client/tests/unit/test_manager.py
.py
879ec91ff5f56a7c
7.74
2
#!/usr/bin/env python3 # Copyright 2025-2026 Canonical Ltd. # See LICENSE file for licensing details. """Lustre server proxy charm operator for mount non-charmed Lustre shares.""" import logging from typing import cast import ops from charms.filesystem_client.v0.filesystem_info import FilesystemProvides, LustreInfo ...
canonical/filesystem-charms
charms/lustre-server-proxy/src/charm.py
.py
b0ed14fcb04bdd7a
7.24
2
#!/usr/bin/env python3 # Copyright 2025-2026 Canonical Ltd. # See LICENSE file for licensing details. """Test base charm events such as Install, ConfigChanged, etc.""" from charm import LustreServerProxyCharm from charms.filesystem_client.v0.filesystem_info import LustreInfo from ops import testing def test_config_n...
canonical/filesystem-charms
charms/lustre-server-proxy/tests/unit/test_charm.py
.py
5a1eeb6f36a34f0a
7.74
2
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Charm for the Lustre file system.""" import logging from enum import StrEnum import lustre_fs import ops from charmed_hpc_libs.ops import StopCharm, refresh from charmlibs import apt from charms.filesystem_client.v0.f...
canonical/filesystem-charms
charms/lustre-server/src/charm.py
.py
a2617e51e4fefcd8
7.24
2
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Exceptions used within the charm.""" import ops class LustreError(Exception): """Base class for Lustre-related errors.""" class LustreFilesystemError(LustreError): """Raised when a Lustre file system operat...
canonical/filesystem-charms
charms/lustre-server/src/errors.py
.py
c6e789e682fda928
7.24
2
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Peer relation observer for the Lustre charm.""" import json import logging from enum import StrEnum from typing import TYPE_CHECKING import lustre_fs import ops import pydantic from charms.filesystem_client.v0.filesys...
canonical/filesystem-charms
charms/lustre-server/src/lustre_peer.py
.py
25b32bc9ab28c6fe
7.24
2
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Check the state of the Lustre charmed operator.""" import logging from enum import StrEnum from pathlib import Path from typing import TYPE_CHECKING import ops from constants import ( LUSTRE_MGS_MDT_MOUNTPOINT, ...
canonical/filesystem-charms
charms/lustre-server/src/state.py
.py
6753da404d06091c
7.24
2
#!/usr/bin/env python3 # Copyright 2023-2026 Canonical Ltd. # See LICENSE file for licensing details. """NFS server proxy charm operator for mount non-charmed NFS shares.""" import logging from typing import cast import ops from charms.filesystem_client.v0.filesystem_info import FilesystemProvides, NfsInfo logger =...
canonical/filesystem-charms
charms/nfs-server-proxy/src/charm.py
.py
9aedf5f63f7ff930
7.24
2
#!/usr/bin/env python3 # Copyright 2023-2026 Canonical Ltd. # See LICENSE file for licensing details. """Test base charm events such as Install, ConfigChanged, etc.""" from charm import NFSServerProxyCharm from charms.filesystem_client.v0.filesystem_info import NfsInfo from ops import testing def test_config_no_host...
canonical/filesystem-charms
charms/nfs-server-proxy/tests/unit/test_charm.py
.py
b139a865d3cfb87a
7.74
2
#!/usr/bin/env python3 # Copyright 2025-2026 Canonical Ltd. # See LICENSE file for licensing details. """Operator to test the `mount_info` interface.""" import logging from typing import cast import ops from charms.filesystem_client.v0.mount_info import MountInfo, MountRequires from ops.framework import EventBase l...
canonical/filesystem-charms
charms/test-mount-client/src/charm.py
.py
d575b8583e97b098
7.74
2
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details """LNet operations shared by the Lustre server and filesystem client charms. Supports TCP (`tcp`) and InfiniBand (`o2ib`) LNDs, multiple networks, and multi-rail (multiple interfaces bound to a single LNet network). """ import logging import su...
canonical/filesystem-charms
internal/lustre-ops/src/lustre_ops/lnet.py
.py
d6c24756c1bb3cd7
7.24
2
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details """Auto-detection of LNet networks from host interfaces.""" import json import logging import subprocess from lustre_ops.constants import IP_EXECUTABLE, RDMA_EXECUTABLE, SYS_CLASS_NET from lustre_ops.errors import LNetParseError, LNetQueryError...
canonical/filesystem-charms
internal/lustre-ops/src/lustre_ops/lnet_detection.py
.py
593c22177dba050e
7.24
2
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details """Unit tests for `lustre_ops.ppa`.""" from subprocess import CalledProcessError from unittest.mock import MagicMock import pytest from charmlibs import apt from lustre_ops import ppa from lustre_ops.errors import RepositoryCodenameError, Repos...
canonical/filesystem-charms
internal/lustre-ops/tests/unit/test_ppa.py
.py
c3ba0ff23e1605b5
7.74
2
# Copyright 2025 Canonical Ltd. # See LICENSE file for licensing details. import json import logging import os import subprocess from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path import jubilant import pytest from helpers import add_machine logger = logging.getLogger(__n...
canonical/filesystem-charms
tests/integration/conftest.py
.py
c01246cfe6550b1c
7.74
2
# Copyright 2025-2026 Canonical Ltd. # See LICENSE file for licensing details. """Helpers for integration tests.""" import json import logging import re import textwrap from pathlib import Path import jubilant import tenacity from charms.filesystem_client.v0.filesystem_info import CephfsInfo, LustreInfo, NfsInfo _l...
canonical/filesystem-charms
tests/integration/helpers.py
.py
2ebc4cb803b9cca7
7.74
2
import logging from pathlib import Path import jubilant import pytest from conftest import Machines from constants import ( FILESYSTEM_CLIENT, LUSTRE_SERVER, LUSTRE_SERVER_PROXY, MOUNT_PROVIDER, MOUNT_REQUIRERS, ) from helpers import bootstrap_lustre_server, charm_channel, check_files logger = log...
canonical/filesystem-charms
tests/integration/test_lustre.py
.py
553f8ab1bfd28415
7.74
2
import fnmatch import re # * matches everything # ? matches any single character # [seq] matches any character in seq # [!seq] matches any char not in seq _SHELL_PATTERNS = re.compile(r"\*|\?|(\[[^\]]*\])") def calc_specificy(pattern: str): """Calculate the specificy of a shell style pattern. Alwa...
moi90/polytaxo
src/polytaxo/alias.py
.py
dcd1261590aff9a0
7
0