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 |
|---|---|---|---|---|---|---|
import re
import base64
import traceback
import json
START_COMMENT = '<!--START:starList-->'
END_COMMENT = '<!--END:starList-->'
listReg = f"{START_COMMENT}[\\s\\S]+{END_COMMENT}"
def readJsonFile(path):
# print("开始")
start = 0
# markdown = '| 序号 |<div width="250px"> 仓库 </div>|<div width="900px"> 描述 </d... | hiifong/starList | main.py | .py | 9803bf7c68f49f55 | 7.64 | 18 |
from __future__ import annotations
__doc__ = """
Common caching infrastructure for MIV operators and data loaders.
This module provides the base caching functionality that is shared between
operators and data loaders. It includes cache policies, protocols, and base
cacher classes.
"""
__all__ = [
"_CacherProtocol... | GazzolaLab/MiV-OS | miv/core/cachable.py | .py | 101e7a4534d77b8b | 7.62 | 16 |
"""Shared callback utilities and :class:`BaseCallbackMixin` for pipeline nodes.
Scalar hooks (``after_run``, ``plot_``) live in :mod:`miv.core.operator.callback`
(:class:`ScalarCallbackMixin`). Streaming plot hooks live in
:mod:`miv.core.operator_generator.callback` (:class:`GeneratorCallbackMixin`).
"""
from __futur... | GazzolaLab/MiV-OS | miv/core/callback.py | .py | d501e87651ebbccc | 7.62 | 16 |
from __future__ import annotations
__doc__ = """
Mixin to create chaining structure between objects.
"""
__all__ = ["ChainingMixin", "node_graph_visualize"]
from typing import TYPE_CHECKING, Any, TypeVar, Generic, cast
from collections.abc import Iterator
from collections import deque
from abc import ABC, abstractmet... | GazzolaLab/MiV-OS | miv/core/chainable.py | .py | a0c305688db438ca | 7.62 | 16 |
__doc__ = """
Events
======
.. autoclass:: Events
:members:
"""
from typing import cast
import numpy as np
import quantities as pq
from ..datatype.signal import Signal
from .node_mixin import DataNodeMixin
class Events(DataNodeMixin):
"""
A list of events.
Comply with `Extendable` protocols.
... | GazzolaLab/MiV-OS | miv/core/datatype/events.py | .py | ff04c459d1e46780 | 7.62 | 16 |
from __future__ import annotations
__doc__ = """
Base mixin for datatype classes that provides chaining capabilities and makes them
compatible with the pipeline system.
"""
from typing import TYPE_CHECKING, Any
from typing_extensions import Self
from ..chainable import ChainingMixin
from ..loggable import DefaultLog... | GazzolaLab/MiV-OS | miv/core/datatype/node_mixin.py | .py | 03d0baf311c78c21 | 7.62 | 16 |
__doc__ = """Concatenate operation for collapsable objects."""
__all__ = ["concatenate"]
from typing import TYPE_CHECKING, Protocol
from functools import reduce
class _Collapsable(Protocol):
"""A protocol defining the concatenate method for collapsable objects."""
def extend(self, other: "_Collapsable") -> ... | GazzolaLab/MiV-OS | miv/core/datatype/operation/concatenate.py | .py | 37610cf6e2edafae | 7.62 | 16 |
__doc__ = """
Signal
======
.. autoclass:: Signal
:members:
"""
from typing import cast
import pickle
from dataclasses import dataclass
import numpy as np
from .node_mixin import DataNodeMixin
from miv.typing import SignalType, SpikestampsType
@dataclass
class Signal(DataNodeMixin):
"""
Contiguous ar... | GazzolaLab/MiV-OS | miv/core/datatype/signal.py | .py | 8304c18f75341b10 | 7.62 | 16 |
__doc__ = """
Spikestamps
===========
.. autoclass:: Spikestamps
:members:
"""
from collections.abc import MutableSequence, Sequence, Iterable, Generator
from typing import overload
import numpy as np
import quantities as pq
import neo
from .signal import Signal
from .node_mixin import DataNodeMixin
class Sp... | GazzolaLab/MiV-OS | miv/core/datatype/spikestamps.py | .py | aac2612b66cc8e52 | 7.62 | 16 |
from __future__ import annotations
__doc__ = """
"""
__all__ = [
"DefaultLoggerMixin",
]
import sys
from typing import TYPE_CHECKING, Any
from loguru import logger
SEPERATOR = " :: "
def configure_logger(start_tag: str, verbose: int) -> None: # pragma: no cover
# TODO: Redirect I/O stream to txt
# Co... | GazzolaLab/MiV-OS | miv/core/loggable.py | .py | c48bf9dd4a4e074e | 7.62 | 16 |
from __future__ import annotations
__doc__ = """
Caching implementation for MIV operators.
This module provides DataclassCacher, which is specifically designed for
operators that use dataclasses for configuration.
Useful wrapper functions for MIV operators.
.. autofunction:: miv.core.source.wrapper.cached_method
..... | GazzolaLab/MiV-OS | miv/core/operator/cachable.py | .py | 57042672b66f104b | 7.62 | 16 |
"""Scalar-operator callback groups (``after_run``, ``plot_``)."""
from __future__ import annotations
from typing import Any, ClassVar
from ..callback import BaseCallbackMixin
def _prepare_after_run_local(
_self: Any, args: tuple[Any, ...], kw: dict[str, Any]
) -> tuple[tuple[Any, ...], dict[str, Any]]:
ret... | GazzolaLab/MiV-OS | miv/core/operator/callback.py | .py | 8f502ac23f21fa42 | 7.62 | 16 |
from __future__ import annotations
__doc__ = """
Here, we define the behavior of basic operator class, and useful mixin classes that can
be used to create new operators that conform to required behaviors.
"""
from typing import Any
from abc import abstractmethod
import pathlib
from ..chainable import ChainingMixin
... | GazzolaLab/MiV-OS | miv/core/operator/operator.py | .py | 108ff73fc4f48152 | 7.62 | 16 |
__doc__ = """
Specification of the behaviors for Operator modules.
"""
from typing import Protocol, Any
from abc import abstractmethod
from .policy import RunnerBase
__all__ = ["_Runnable"]
class _Runnable(Protocol):
"""
A protocol for a runner policy.
"""
@property
def runner(
self,
... | GazzolaLab/MiV-OS | miv/core/operator/protocol.py | .py | 25c7dca8859799cc | 7.12 | 16 |
"""Callback mixin for generator operators.
This module provides callback functionality for generator-to-generator operators,
including plotting callbacks that execute during generator iterations.
"""
from __future__ import annotations
from typing import Any, ClassVar
from ..callback import BaseCallbackMixin
def _... | GazzolaLab/MiV-OS | miv/core/operator_generator/callback.py | .py | e59a9cfaade4ffd9 | 7.62 | 16 |
from __future__ import annotations
import itertools
from typing import Any
from collections.abc import Generator, Iterable
from abc import abstractmethod
from ..cache_write import persist_cacher_result
from ..chainable import ChainingMixin
from ..datatype import DataTypes
from ..operator.cachable import DataclassCach... | GazzolaLab/MiV-OS | miv/core/operator_generator/operator.py | .py | 22248bb21dd5ecf1 | 7.62 | 16 |
"""Wrapper decorator for generator operators (legacy signature adapter)."""
from __future__ import annotations
import functools
import warnings
from typing import Any, TypeVar
from collections.abc import Callable
from .operator import GeneratorOperatorMixin
C = TypeVar("C", bound="GeneratorOperatorMixin")
def cac... | GazzolaLab/MiV-OS | miv/core/operator_generator/wrapper.py | .py | a227bc1c30aa0daf | 7.62 | 16 |
__doc__ = """
.. autoclass:: miv.core.pipeline.Pipeline
:members:
"""
from typing import cast
from collections.abc import Sequence
import pathlib
import shutil
import time
import sys
from loguru import logger
from ..utils.formatter import TColors
from .protocol import _Node
from .utils.graph_sorting import top... | GazzolaLab/MiV-OS | miv/core/pipeline.py | .py | 0a803a10752cf92f | 7.62 | 16 |
from __future__ import annotations
from typing import Any
from collections.abc import Callable, Generator
from abc import ABC, abstractmethod
class RunnerBase(ABC):
"""Abstract base class for runner policies that control execution strategies.
Runner policies define how operators execute their functions, sup... | GazzolaLab/MiV-OS | miv/core/policy.py | .py | 5364e1f9a1732808 | 7.62 | 16 |
from __future__ import annotations
__doc__ = """
Caching implementation for MIV data loaders.
This module provides FunctionalCacher, which is specifically designed for
data loaders that use function parameters for configuration.
"""
__all__ = [
"FunctionalCacher",
]
from typing import Any
from collections.abc im... | GazzolaLab/MiV-OS | miv/core/source/cachable.py | .py | 2a52f3aedacc05e9 | 7.62 | 16 |
from __future__ import annotations
__doc__ = """
Mixin to create a data loader node.
"""
from typing import TYPE_CHECKING, Any
from collections.abc import Generator
from ..chainable import ChainingMixin
from ..callback import BaseCallbackMixin
from ..operator.policy import VanillaRunner
from .cachable import Functio... | GazzolaLab/MiV-OS | miv/core/source/node_mixin.py | .py | 241159636a3a0464 | 7.62 | 16 |
from __future__ import annotations
__doc__ = """
Wrapper functions for MIV data loaders.
This module provides cached_method decorator for caching method results
in data loaders.
"""
from typing import TypeVar, Concatenate, ParamSpec
from collections.abc import Callable
import os
import functools
from joblib import M... | GazzolaLab/MiV-OS | miv/core/source/wrapper.py | .py | 1c74741175fc5606 | 7.62 | 16 |
__doc__ = """
Topological sorting of the graph.
"""
__all__ = ["topological_sort"]
from typing import TypeVar
from ..protocol import _Chainable
C = TypeVar("C", bound=_Chainable)
def _get_upstream_topology(
node: C, upstream_nodelist: list[C] | None = None
) -> list[C]:
"""
Get the upstream topology of... | GazzolaLab/MiV-OS | miv/core/utils/graph_sorting.py | .py | 04ce0bf9d626a40d | 7.62 | 16 |
__all__ = ["get_file", "check_file_hash"]
from typing import Any
import hashlib
import logging
import os
import shutil
import tarfile
import urllib
import zipfile
from urllib.request import urlopen
from tqdm import tqdm
def get_file(
file_url: str,
directory: str,
fname: str,
file_hash: str | None ... | GazzolaLab/MiV-OS | miv/datasets/utils.py | .py | ba49fca7c60fc048 | 7.62 | 16 |
from typing import no_type_check
import importlib
@no_type_check
def getter_upon_call(
module_name: str,
submodule_alias_paths: dict[str, list[str]],
) -> callable: # pragma: no cover
def func(name): # pragma: no cover
for k, v in submodule_alias_paths.items():
if name in v:
... | GazzolaLab/MiV-OS | miv/import_helper.py | .py | abe0b8ef3fb98c90 | 7.62 | 16 |
__doc__ = """
ASDF file type loader
author: tvarley
djhavert
.. autoclass:: miv.io.asdf.asdf.DataASDF
:members:
"""
__all__ = ["DataASDF"]
from typing import Any
import numpy as np
from scipy.io import loadmat
from miv.core.datatype.spikestamps import Spikestamps
from miv.core.source.node_mixin import... | GazzolaLab/MiV-OS | miv/io/asdf/asdf.py | .py | f48544c413119a31 | 7.62 | 16 |
from typing import Any, cast
from logging import Logger
import h5py
import numpy as np
from h5py._hl.dataset import Dataset
from numpy import int64, ndarray
def read(
filename: str,
groups: str | list[str] | None = None,
subset: int | list[int] | tuple[int, int] | None = None,
logger: Logger | None ... | GazzolaLab/MiV-OS | miv/io/file/read.py | .py | cbcc8f24a86d67cc | 7.62 | 16 |
import argparse
import json
import requests
import time
from bs4 import BeautifulSoup
from emit_main.workflow.workflow_manager import WorkflowManager
#grabs the users access token to interact with inbox
def get_access_token(tenant_id, client_id, client_secret):
url = f"https://login.microsoftonline.com/{tenant_... | emit-sds/emit-main | emit_main/scripts/test_mailbox_graphapi.py | .py | 2f42ca668075ea99 | 7.98 | 8 |
"""
This config file allows pytest to pass arguments into tests
Author: Winston Olson-Duvall, winston.olson-duvall@jpl.nasa.gov
"""
from pytest import fixture
def pytest_addoption(parser):
parser.addoption(
"--config_path",
action="store"
)
@fixture()
def config_path(request):
return r... | emit-sds/emit-main | emit_main/test/conftest.py | .py | c0cdfeddb50d9f95 | 7.48 | 8 |
"""
This code contains test functions for workflow_manager.py
Author: Winston Olson-Duvall, winston.olson-duvall@jpl.nasa.gov
"""
import os
from emit_main.workflow.workflow_manager import WorkflowManager
def test_acquisition(config_path):
config_path = os.path.abspath(config_path)
print("\nRunning test_ac... | emit-sds/emit-main | emit_main/test/test_workflow_manager.py | .py | 7e8cab90f48d670a | 7.98 | 8 |
"""
This code encrypts passwords stored in a json file to be used by the workflow manager.
Author: Winston Olson-Duvall, winston.olson-duvall@jpl.nasa.gov
"""
import argparse
import json
import os
from cryptography.fernet import Fernet
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argumen... | emit-sds/emit-main | emit_main/util/encrypt_passwords.py | .py | 928f82e6c30ecfd5 | 7.48 | 8 |
"""
pge.py includes the PGE class that handles looking up and checking out code and building its executable environment.
Author: Winston Olson-Duvall, winston.olson-duvall@jpl.nasa.gov
"""
import logging
import os
import subprocess
logger = logging.getLogger("emit-main")
class PGE:
def __init__(self, conda_ba... | emit-sds/emit-main | emit_main/workflow/pge.py | .py | 63608c33354ee850 | 7.48 | 8 |
"""Configuration and CLI argument management for CodeEntropy.
This module provides:
1) A declarative argument specification (`ARG_SPECS`) used to build an
``argparse.ArgumentParser``.
2) A `ConfigResolver` that:
- loads YAML configuration if present,
- merges YAML values with CLI values, with CLI values ta... | CCPBioSim/CodeEntropy | CodeEntropy/config/argparse.py | .py | 6236f649635d7ca8 | 7.54 | 11 |
"""Run orchestration for CodeEntropy.
This module provides the CodeEntropyRunner, which is responsible for:
- Creating a new job folder for each run
- Loading YAML configuration and merging it with CLI arguments
- Setting up logging and displaying a Rich splash screen
- Building the MDAnalysis Universe (including opti... | CCPBioSim/CodeEntropy | CodeEntropy/config/runtime.py | .py | 8b2794ad2026cf77 | 7.54 | 11 |
"""
Helpers for setting up Dask clusters on HPC using SLURM.
"""
from __future__ import annotations
import logging
import os
import shlex
import subprocess
import sys
import psutil
from dask.distributed import Client
from dask_jobqueue import SLURMCluster
logger = logging.getLogger(__name__)
class HPCDaskManager:... | CCPBioSim/CodeEntropy | CodeEntropy/core/dask_clusters.py | .py | 16cbcbc9840f2264 | 7.54 | 11 |
"""Logging configuration utilities for CodeEntropy.
This module configures consistent logging across the project with:
- Rich console output (with tracebacks) for human-readable terminal logs
- File handlers for main logs, error-only logs, command logs, and MDAnalysis logs
- A singleton Rich Console instance with rec... | CCPBioSim/CodeEntropy | CodeEntropy/core/logging.py | .py | 5cbaf6952482e641 | 7.54 | 11 |
"""Conformational entropy utilities.
This module provides:
- Assignment of discrete conformational states for a single dihedral time series.
- Computation of conformational entropy from a sequence of state labels.
"""
from __future__ import annotations
import logging
from typing import Any
import numpy as np
log... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/configurational.py | .py | ddeaddd54978b062 | 7.54 | 11 |
"""Entropy graph orchestration.
This module defines `EntropyGraph`, a small directed acyclic graph (DAG) that
executes entropy calculation nodes in dependency order.
The graph is intentionally simple:
* Vibrational entropy
* Configurational entropy
* Aggregation of results
The nodes themselves encapsulate the ... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/graph.py | .py | 2de0c5d8ac713558 | 7.54 | 11 |
"""Aggregates entropy outputs produced by upstream DAG nodes."""
from __future__ import annotations
from collections.abc import Mapping, MutableMapping
from dataclasses import dataclass
from typing import Any
EntropyResults = dict[str, Any]
@dataclass(frozen=True, slots=True)
class AggregateEntropyNode:
"""Agg... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/nodes/aggregate.py | .py | e12c973f5fdb3342 | 7.54 | 11 |
"""Node for computing configurational entropy from conformational states."""
from __future__ import annotations
import logging
from collections.abc import Iterable, Mapping, MutableMapping, Sequence
from typing import (
Any,
)
import numpy as np
from CodeEntropy.entropy.configurational import ConformationalEntr... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/nodes/configurational.py | .py | fb78f68e2fe9fadc | 7.54 | 11 |
"""Node for computing orientational entropy from neighbors."""
from __future__ import annotations
import logging
from collections.abc import MutableMapping, Sequence
from typing import (
Any,
)
import numpy as np
from CodeEntropy.entropy.orientational import OrientationalEntropy
logger = logging.getLogger(__na... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/nodes/orientational.py | .py | c8f37f5d12752cec | 7.54 | 11 |
"""Node for computing vibrational entropy from covariance matrices."""
from __future__ import annotations
import logging
from collections.abc import Mapping, MutableMapping
from dataclasses import dataclass
from typing import Any
import numpy as np
from CodeEntropy.entropy.vibrational import VibrationalEntropy
from... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/nodes/vibrational.py | .py | dee851a9a3292bcb | 7.54 | 11 |
"""Orientational entropy calculations.
This module defines `OrientationalEntropy`, which computes orientational entropy
from a neighbor count and symmetry information.
"""
from __future__ import annotations
import logging
import math
from dataclasses import dataclass
import numpy as np
logger = logging.getLogger(_... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/orientational.py | .py | 81fa58a822908c00 | 7.54 | 11 |
"""Vibrational entropy calculations.
This module provides `VibrationalEntropy`, which computes vibrational entropy
from force, torque, or combined force-torque covariance matrices.
The implementation is intentionally split into small, single-purpose methods:
- Eigenvalue extraction + unit conversion
- Frequency calcu... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/vibrational.py | .py | 8e03d65a2516e9a4 | 7.54 | 11 |
"""Water entropy aggregation.
This module wraps the waterEntropy routines and maps their
outputs into the project `ResultsReporter` format.
"""
from __future__ import annotations
import logging
from collections.abc import Callable, Mapping
from dataclasses import dataclass
from typing import Any
import numpy as np
... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/water.py | .py | 39bdd5d3c0f240d4 | 7.54 | 11 |
"""Entropy manager orchestration.
This module defines `EntropyWorkflow`, which coordinates the end-to-end entropy
workflow:
- Determine trajectory bounds and frame count.
- Build a reduced universe based on atom selection.
- Identify molecule groups and hierarchy levels.
- Optionally compute water entropy and adjust s... | CCPBioSim/CodeEntropy | CodeEntropy/entropy/workflow.py | .py | 6f183c0155c693bb | 7.54 | 11 |
"""Selected-frame dihedral angle observation helpers.
This module contains the frame-aware angle collection logic used by the
conformational state workflow. It preserves the MDAnalysis frame-index contract:
``Dihedral.run(...)`` receives active analysis-universe frame bounds, while the
returned ``results.angles`` arra... | CCPBioSim/CodeEntropy | CodeEntropy/levels/dihedrals/angle_observations.py | .py | 66c21a5d1bcd4736 | 7.54 | 11 |
"""Numba kernels for dihedral conformational-state analysis.
This module contains numeric kernels used by the serial chunked conformational
workflow. The kernels operate only on NumPy arrays and avoid MDAnalysis objects
so they remain safe to JIT compile and reuse inside future distributed workers.
"""
from __future_... | CCPBioSim/CodeEntropy | CodeEntropy/levels/dihedrals/kernels.py | .py | 817ef98e00c3b3e7 | 7.54 | 11 |
"""Conformational state assignment from dihedral peak definitions.
This module contains the logic for converting positive-angle dihedral arrays and
global peak definitions into state labels and flexible-dihedral counts.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
... | CCPBioSim/CodeEntropy | CodeEntropy/levels/dihedrals/state_assignment.py | .py | 42d7d88d71016d6f | 7.54 | 11 |
"""Dihedral topology discovery for conformational state analysis.
This module contains the static molecule/residue dihedral discovery logic used
by conformational entropy calculations. The methods here identify which
dihedrals should be analysed; they do not inspect trajectory frames.
"""
from __future__ import annot... | CCPBioSim/CodeEntropy | CodeEntropy/levels/dihedrals/topology.py | .py | 2c9feee9c63e37dd | 7.54 | 11 |
"""Internal policy for hierarchy-level frame map-reduce execution.
Users provide compute resources. CodeEntropy keeps scheduling choices such as
chunk size and in-flight task limits internal so the public configuration remains
stable and simple.
"""
from __future__ import annotations
import math
from dataclasses imp... | CCPBioSim/CodeEntropy | CodeEntropy/levels/execution/policy.py | .py | e18a3177bc208f22 | 7.54 | 11 |
"""Task and worker-side helpers for frame-chunk execution."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
from CodeEntropy.levels.graph.frame_dag import FrameGraph
from CodeEntropy.levels.neighbors import Neighbors
FRAME_WORKER_EXCLUDED_SHARED_KEYS = {
"for... | CCPBioSim/CodeEntropy | CodeEntropy/levels/execution/tasks.py | .py | 84645b0b656624e5 | 7.54 | 11 |
"""Force/torque weighting and per-frame second-moment construction.
This module provides utilities for transforming atomic forces into bead-level
generalized forces (translation) and torques (rotation), and for assembling
per-frame second-moment matrices used downstream in entropy calculations.
"""
from __future__ im... | CCPBioSim/CodeEntropy | CodeEntropy/levels/forces.py | .py | 73b5e73480531421 | 7.54 | 11 |
"""Conformational-state DAG orchestration.
This module owns the conformational stage between static structural setup and
frame-local covariance/neighbour execution.
"""
from __future__ import annotations
from typing import Any
from CodeEntropy.levels.dihedrals.conformational_state_builder import (
ConformationS... | CCPBioSim/CodeEntropy | CodeEntropy/levels/graph/conformation_dag.py | .py | d9df5df52c1f7d82 | 7.54 | 11 |
"""Frame-local DAG execution.
This module defines the frame-scoped DAG used during the MAP stage of the
hierarchy workflow. Each selected frame is processed independently to produce
frame-local observable outputs, which are reduced outside this DAG.
FrameGraph owns trajectory positioning. It does not own scheduling, ... | CCPBioSim/CodeEntropy | CodeEntropy/levels/graph/frame_dag.py | .py | 631745b7cd6aea68 | 7.54 | 11 |
"""Hierarchy-level DAG orchestration.
LevelDAG owns hierarchy-level workflow order. Static setup nodes prepare
structural data. ConformationDAG computes trajectory-series conformational
states. FrameScheduler executes frame-local covariance and neighbour work.
"""
from __future__ import annotations
from typing impor... | CCPBioSim/CodeEntropy | CodeEntropy/levels/graph/level_dag.py | .py | 460964c8b8ef474a | 7.54 | 11 |
"""Hierarchy level selection and bead construction.
This module defines ``HierarchyBuilder``, which is responsible for:
- Determining which hierarchy levels apply to each molecule.
- Constructing "beads" (AtomGroups) for a given molecule at a given level.
Notes:
The "residue" bead construction must use residues ... | CCPBioSim/CodeEntropy | CodeEntropy/levels/hierarchy.py | .py | ddc778b7a4f2c20e | 7.54 | 11 |
"""Matrix utilities used across covariance and entropy calculations.
This module contains small, focused helpers for matrix construction and cleanup.
All functions are pure (no side effects beyond logging) and operate on NumPy
arrays.
Key behaviors:
- `create_submatrix` computes a 3x3 outer-product block for two 3-ve... | CCPBioSim/CodeEntropy | CodeEntropy/levels/linalg.py | .py | 3c996b2ad20e61c6 | 7.54 | 11 |
"""Frame-local neighbour observables for orientational entropy.
The frame execution layer calls :class:`Neighbors` once per selected trajectory
frame. Each call returns mergeable neighbour-count totals for every molecule
group. Static symmetry and linearity metadata is computed separately because it
does not vary by f... | CCPBioSim/CodeEntropy | CodeEntropy/levels/neighbors.py | .py | becc2f7900885419 | 7.54 | 11 |
"""Initialize covariance accumulators.
This module defines a LevelDAG static node that allocates all per-frame reduction
accumulators (means) and counters used by downstream frame processing.
The node owns only initialization concerns (single responsibility):
- create group-id <-> index mappings
- allocate force/torq... | CCPBioSim/CodeEntropy | CodeEntropy/levels/nodes/accumulators.py | .py | 5ccee9842008a344 | 7.54 | 11 |
"""Build static axes-topology metadata for frame covariance calculations.
This module caches topology-only atom-index relationships needed by customised
axes calculations. The cache avoids repeated MDAnalysis selection parsing inside
the frame-local covariance loop while preserving frame-dependent positions,
forces, c... | CCPBioSim/CodeEntropy | CodeEntropy/levels/nodes/axes_topology.py | .py | 433ad66c22fd600f | 7.54 | 11 |
"""Build bead (AtomGroup index) definitions for each molecule and hierarchy level.
This module defines the `BuildBeadsNode`, a static DAG node that constructs bead
definitions once, in reduced-universe index space. These bead definitions are
used by later frame-level nodes (e.g., covariance construction) without needi... | CCPBioSim/CodeEntropy | CodeEntropy/levels/nodes/beads.py | .py | f4ec34eb9158e23a | 7.54 | 11 |
"""Detect hierarchy levels present for each molecule in the reduced universe.
This module defines a static DAG node responsible for determining which
hierarchical levels (united_atom, residue, polymer) apply to each molecule.
"""
from __future__ import annotations
from typing import Any
from CodeEntropy.levels.hier... | CCPBioSim/CodeEntropy | CodeEntropy/levels/nodes/detect_levels.py | .py | 62b33949271e2e23 | 7.54 | 11 |
#!/usr/bin/env python3
"""
Improved script to fix Python built-in shadowing issues.
Handles function parameters in signatures more carefully.
"""
import re
from pathlib import Path
from typing import Tuple
def fix_filter_in_function_params(content: str) -> Tuple[str, int]:
"""Fix filter parameter in function sign... | odpi/egeria-python | .ai-sandbox/fix_shadowing_v2.py | .py | 4f7a42c115f2addd | 7.48 | 8 |
#!/usr/bin/env python3
"""
Script to refactor all find methods in OMVS modules to use **kwargs pattern.
This applies the pattern consistently across all files that use _async_find_request.
"""
import re
import os
from pathlib import Path
# Files and their find method counts based on search results
FILES_TO_REFACTOR =... | odpi/egeria-python | .ai-sandbox/refactor_all_find_methods.py | .py | 639835c9eb2642dc | 7.48 | 8 |
#!/usr/bin/env python3
"""
Automated refactoring script to apply **kwargs pattern to find methods.
This script:
1. Identifies find methods that use _async_find_request
2. Simplifies their signatures by moving advanced parameters to **kwargs
3. Updates the implementation to use params dict
4. Adds comprehensive **kwarg... | odpi/egeria-python | .ai-sandbox/refactor_find_methods.py | .py | 732f4c0cee88177a | 7.48 | 8 |
import json
import os
import re
# Configuration
INPUT_FILE = "../md_processing/data/commands.json"
OUTPUT_DIR = "../md_processing/data/commands"
FAMILY_MAP = {
"Data Designer": "commands_data_designer.json",
"Digital Product Manager": "commands_product_manager.json",
"External Reference": "commands_extern... | odpi/egeria-python | .ai-sandbox/split_commands.py | .py | 70568b246357ea5e | 7.48 | 8 |
#!/usr/bin/env python3
"""Test that FilterRequestBody model works correctly with alias"""
import sys
sys.path.insert(0, '..')
from pydantic import Field, ValidationError
from typing import Annotated, Literal
# Simplified version of the model to test
class TestFilterRequestBody:
"""Test the filter alias"""
pa... | odpi/egeria-python | .ai-sandbox/test_filter_alias.py | .py | 172168774126a0b2 | 7.98 | 8 |
"""
This is an ongoing experiment in parsing and playing with Dr.Egeria docs
"""
import os
import sys
import click
from loguru import logger
from rich.console import Console
from rich.prompt import Prompt
from pyegeria.core._exceptions import PyegeriaException, print_basic_exception
from pyegeria.core.config import se... | odpi/egeria-python | commands/cat/dr_egeria.py | .py | 2356900e704093d7 | 7.48 | 8 |
#!/usr/bin/env python3
"""
SPDX-License-Identifier: Apache-2.0
Copyright Contributors to the ODPi Egeria project.
A simple display for glossary terms
"""
import argparse
import os
import sys
import time
from pydantic import ValidationError
from rich import box
from rich.console import Console
from rich.markdown impo... | odpi/egeria-python | commands/cat/dr_egeria_command_help.py | .py | bc01f70d0943c46e | 7.48 | 8 |
"""
Execute all Dr. Egeria markdown files in a folder, following the load order in README.md if present.
"""
import os
import sys
import click
import re
import asyncio
from loguru import logger
from rich.console import Console
from pyegeria.core._exceptions import PyegeriaException, print_basic_exception
from pyegeria... | odpi/egeria-python | commands/cat/execute_dr_egeria_folder.py | .py | 2c44715c2814c61a | 7.48 | 8 |
#!/usr/bin/env python3
"""
SPDX-License-Identifier: Apache-2.0
Copyright Contributors to the ODPi Egeria project.
List assets
"""
import argparse
import os
import sys
import time
from rich import box
from rich.console import Console
from rich.markdown import Markdown
from rich.prompt import Prompt
from rich.table im... | odpi/egeria-python | commands/cat/list_assets.py | .py | d9710ccc08f3c526 | 7.48 | 8 |
#!/usr/bin/env python3
"""
SPDX-License-Identifier: Apache-2.0
Copyright Contributors to the ODPi Egeria project.
A simple display for collections
"""
import argparse
import os
from jsonschema import ValidationError
from rich.console import Console
from rich.prompt import Prompt
from pyegeria import (
print_basic... | odpi/egeria-python | commands/cat/list_collections.py | .py | e460f972c513f1ec | 7.48 | 8 |
"""This creates a templates guid file from the core metadata archive"""
import argparse
import os
import sys
import time
from rich import box
from rich.console import Console
from rich.markdown import Markdown
from rich.prompt import Prompt
from rich.table import Table
from pyegeria import (
PyegeriaException,
... | odpi/egeria-python | commands/cat/list_deployed_database_schemas.py | .py | 4bd32c6afa472634 | 7.48 | 8 |
#!/usr/bin/env python3
"""
SPDX-License-Identifier: Apache-2.0
Copyright Contributors to the ODPi Egeria project.
Generic list command that wraps exec_report_spec and adds TABLE output.
- TABLE: renders results as a paged Rich table; table title comes from get_report_spec_heading().
- MD, REPORT, FORM, HTML, MERMAID,... | odpi/egeria-python | commands/cat/run_report.py | .py | c1cdfe324bfc36eb | 7.48 | 8 |
#!/usr/bin/env python3
"""
SPDX-License-Identifier: Apache-2.0
Copyright Contributors to the ODPi Egeria project.
Interactive Textual TUI to view Egeria Report Spec Schemas as a collapsible tree.
"""
import click
from textual.app import App, ComposeResult
from textual.widgets import Tree, Header, Footer
from rich.tex... | odpi/egeria-python | commands/cat/view_schema_tree.py | .py | 522856106353a518 | 7.48 | 8 |
import os
from typing import Any, Dict
import anymarkup
from jsonschema import RefResolver, Draft6Validator
def load_schemas(work_dir: str = "schemas") -> Dict[str, Any]:
""" Function to load all schema files.
It works like qontract-bundler, it stores all the schema files in a dictionary.
The keys are the... | app-sre/qontract-schemas | test/utils.py | .py | d471b9d7e335048c | 8.07 | 13 |
# See https://docs.pytest.org/en/7.1.x/example/simple.html
from pathlib import Path
from typing import Any
import pytest
# Zone membership is defined by directory: anything under tests/contrib/ is
# contrib. The marker is derived from that rather than applied by hand, so the
# directory stays the single source of tru... | PolusAI/sophios | conftest.py | .py | dae13fce2e0d6e03 | 8.09 | 14 |
import argparse
import sys
import numpy as np
from scipy.optimize import least_squares
parser = argparse.ArgumentParser()
parser.add_argument('--xs', nargs='+', default=[], type=float)
parser.add_argument('--ys', nargs='+', default=[], type=float)
parser.add_argument('--tol_quad', type=float)
parser.add_argument('--s... | PolusAI/sophios | examples/scripts/check_linear_fit.py | .py | f49459b8ebc63ccc | 7.59 | 14 |
"""Build a workflow in Python and turn it into a validated compute request."""
from datetime import datetime
from pathlib import Path
import sys
from sophios.api.python.tool_builder import (
CommandLineTool,
Input,
Inputs,
Output,
Outputs,
cwl,
)
from sophios.api.python.workflow import (
S... | PolusAI/sophios | examples/scripts/compute_request_workflow.py | .py | aab1a50e51d95dfb | 7.59 | 14 |
"""Canonical end-to-end example: tool_builder -> Workflow -> compute request."""
from datetime import datetime
from pathlib import Path
from sophios.api.python.workflow import CompiledWorkflow, Step, Workflow
from sophios.api.python.tool_builder import CommandLineTool, Input, Inputs, Output, Outputs, cwl
from sophio... | PolusAI/sophios | examples/scripts/ichnaea_compact.py | .py | 04f01e69f7ca5428 | 7.59 | 14 |
"""Artifact-first variant of the ichnaea compact compute request example."""
from datetime import datetime
from pathlib import Path
from sophios.api.python.workflow import CompiledWorkflow, Step, Workflow
from sophios.api.python.tool_builder import CommandLineTool, Input, Inputs, Output, Outputs, cwl
from sophios.co... | PolusAI/sophios | examples/scripts/ichnaea_integrated.py | .py | ca90d41447cbb005 | 7.59 | 14 |
from pathlib import Path
from sophios.api.python.workflow import Step, Workflow
REPO_ROOT = Path(__file__).resolve().parents[2]
ADAPTERS = REPO_ROOT / "cwl_adapters"
def small_workflow() -> Workflow:
"""Scatter one echo step over the selected array values."""
array_ind = Step(clt_path=ADAPTERS / "array_ind... | PolusAI/sophios | examples/scripts/scatter_pyapi.py | .py | d748a409d5f9da92 | 7.59 | 14 |
import json
from pathlib import Path
from shutil import copytree, ignore_patterns
from typing import Any, cast
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py as _build_py
class build_py(_build_py):
"""build mode script"""
def run(self) -> None:
adapters_d... | PolusAI/sophios | setup.py | .py | 9d9889bd6b3d9adf | 7.59 | 14 |
"""Public API namespace for Sophios."""
from importlib import import_module
from types import ModuleType
__all__ = ["python"]
def __getattr__(name: str) -> ModuleType:
if name in __all__:
return import_module(f".{name}", __name__)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}... | PolusAI/sophios | src/sophios/api/__init__.py | .py | e58a9910732c1bb4 | 7.09 | 14 |
"""Concrete Python API modules for workflow and tool authoring.
Import user-facing symbols from the concrete modules so the API boundaries stay
visible:
``sophios.api.python.workflow``
Graph construction with ``Step`` and ``Workflow``.
``sophios.api.python.tool_builder``
CWL ``CommandLineTool`` authoring hel... | PolusAI/sophios | src/sophios/api/python/__init__.py | .py | f92e8f95c4881a3f | 7.59 | 14 |
"""Compiled workflow boundary objects for the public workflow API."""
from dataclasses import dataclass
from pathlib import Path
from sophios.input_output import dump_wic_yaml
from sophios.wic_types import Json
def _artifact_path(
path: str | Path | None,
*,
default_name: str,
suffixes: tuple[str, .... | PolusAI/sophios | src/sophios/api/python/_compiled.py | .py | 7a451401f28244ff | 7.59 | 14 |
"""Parameter and namespace helpers for the Python workflow API."""
from collections.abc import Callable, Iterator, Mapping
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Generic, TypeVar
from ._utils import (contains_any_type,
is_array_type,
n... | PolusAI/sophios | src/sophios/api/python/_ports.py | .py | 8c86e269a669c75d | 7.59 | 14 |
"""Private namespace objects for the public Tool Builder.
The builder surface is intentionally small:
- ``cwl`` is the only CWL vocabulary namespace
- ``Field``, ``Input``, and ``Output`` are the actual spec classes
- ``Inputs`` and ``Outputs`` are named collections that derive parameter names
from Python keyword a... | PolusAI/sophios | src/sophios/api/python/_tool_builder_namespaces.py | .py | eb8d8fce814ee214 | 7.59 | 14 |
"""Private dataclasses for the Tool Builder."""
# pylint: disable=missing-function-docstring,too-few-public-methods
# pylint: disable=too-many-instance-attributes,too-many-arguments
# pylint: disable=too-many-locals,redefined-builtin,too-many-lines
# These frozen dataclasses mirror the CWL schema closely, so field-ric... | PolusAI/sophios | src/sophios/api/python/_tool_builder_specs.py | .py | 942d0889bc90475c | 7.09 | 14 |
"""Small bridge between the CLT builder and the workflow Python API.
This module is intentionally the only place that imports both surfaces.
Keeping the bridge narrow lets the builder and workflow API evolve mostly
independently while still supporting an in-memory handoff.
"""
from pathlib import Path
from typing imp... | PolusAI/sophios | src/sophios/api/python/_tool_builder_step_bridge.py | .py | 9f6c4a6149e7567b | 7.59 | 14 |
"""CWL type definitions used by the Python APIs."""
from enum import Enum
class CWLAtomicType(str, Enum):
"""Atomic CWL type names.
These are the string-valued leaf types that may appear directly in CWL
input/output declarations. Structured types such as arrays, enums, and
records are represented se... | PolusAI/sophios | src/sophios/api/python/_types.py | .py | 57881fec8ed04b98 | 7.59 | 14 |
"""Internal helpers for the Python API."""
import keyword
from collections.abc import Sequence
from pathlib import Path
from typing import Any
import yaml
from sophios import utils_cwl
from ._errors import InvalidInputValueError
from ._types import CWLAtomicType
def normalize_parameter_name(cwl_id: str) -> str:
... | PolusAI/sophios | src/sophios/api/python/_utils.py | .py | 8fc9ab2abac5a665 | 7.59 | 14 |
import argparse
import sys
from pathlib import Path
from unittest.mock import patch
from . import __version__
from .wic_types import CompilerOptions, GraphSettings, YamlTagPaths
parser = argparse.ArgumentParser(prog='main', description='Convert a high-level yaml workflow file to CWL.')
parser.add_argument('--yaml', ... | PolusAI/sophios | src/sophios/cli.py | .py | 150692e452d835ff | 7.59 | 14 |
"""Schema-backed compute request objects."""
from collections.abc import Mapping
from dataclasses import dataclass, field, fields as dataclass_fields
from functools import lru_cache
import json
from pathlib import Path
import time
from typing import Any, Protocol, cast
from jsonschema import Draft202012Validator
impo... | PolusAI/sophios | src/sophios/compute_request.py | .py | 83ce19bf24b34cb0 | 7.59 | 14 |
"""A rule based system that facilitates particle reaction analysis.
QRules generates allowed particle transitions from a set of conservation rules and
boundary conditions as specified by the user. The user boundary conditions for a
particle reaction problem are for example the initial state, final state, and allowed
i... | ComPWA/qrules | src/qrules/__init__.py | .py | 9c7cea4f96232ad1 | 7.52 | 10 |
"""Definitions used internally for type hints and signatures.
`qrules` is strictly typed. This module bundles structures and definitions that don't
serve as data containers but only as type hints. `.EdgeQuantumNumbers` and
`.NodeQuantumNumbers` are the main structures and serve as a bridge between the
:mod:`.particle`... | ComPWA/qrules | src/qrules/quantum_numbers.py | .py | 2cfd117f66cacd6c | 7.52 | 10 |
"""Test for https://github.com/ComPWA/qrules/issues/165."""
import pytest
import qrules
from qrules.particle import ParticleCollection
from qrules.transition import SpinFormalism
@pytest.mark.parametrize("formalism", ["helicity", "canonical-helicity"])
@pytest.mark.parametrize(
"resonances",
[
["h(1... | ComPWA/qrules | tests/channels/test_psi2s_to_eta_k_kstar.py | .py | d5debe3e3c4df477 | 8.02 | 10 |
from importlib.metadata import version
import pytest
from qrules import load_default_particles
from qrules.particle import ParticleCollection
from qrules.settings import NumberOfThreads
# Ensure consistent test coverage when running pytest multithreaded
# https://github.com/ComPWA/qrules/issues/11
NumberOfThreads.se... | ComPWA/qrules | tests/conftest.py | .py | 6fe06a21f3876e84 | 7.02 | 10 |
import json
import pytest
from qrules import io
from qrules.particle import Particle, ParticleCollection
from qrules.topology import (
FrozenTransition,
Topology,
create_isobar_topologies,
create_n_body_topology,
)
from qrules.transition import ReactionInfo
def through_dict(instance):
# Check JS... | ComPWA/qrules | tests/unit/io/test_io.py | .py | d45f9920f529e4a9 | 7.02 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.