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 |
|---|---|---|---|---|---|---|
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# Copyright 2024 ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.bundle import BundlePackage
from spack.package import ... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/access_test/package.py | .py | e3acda48474dd5b5 | 7.02 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# Based on spack/var/spack/repos/builtin/packages/fiat/package.py
from spack_repo.builtin.build_systems.cmake import CMakePackage
from spack.package import *
class AccessTestComponent(CMakePackage)... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/access_test_component/package.py | .py | 6cb3fbf1c2f8453e | 7.02 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.makefile import MakefilePackage
from spack.package import *
# import os
class AccessTriangle(MakefilePackage):
"""Triangle is a two-dimensional mesh genera... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/access_triangle/package.py | .py | a26057161cf47e70 | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.cmake import CMakePackage
from spack.package import *
class AccessWw3(CMakePackage):
"""WAVEWATCH III® is a community wave modeling framework that includes t... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/access_ww3/package.py | .py | daacca0b76cfcd0b | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.cmake import CMakePackage
from spack.package import *
class AdjointPetsc(CMakePackage):
"""adjoint-PETSc is a beta library that provides algorithmic
dif... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/adjoint_petsc/package.py | .py | aa4a76bf23ff7f96 | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import sys
from spack_repo.builtin.build_systems.makefile import MakefilePackage
from spack.package import *
class AncomsRoms(MakefilePackage):
"""ROMS is a free-surface, terrain-foll... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/ancoms_roms/package.py | .py | 4b022dd67692e9ac | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.cmake import CMakePackage
from spack.package import *
# See https://spack.readthedocs.io/en/latest/packaging_guide.html for a guide
# on how this file works.
c... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/cable/package.py | .py | 5f45f54951101513 | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# Copyright ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.cmake import CMakePackage
from spack.package import *
# These are the default layouts, inc 3 executables for OM2
# alternatively, supply... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/cice5/package.py | .py | c1d42124327fae9f | 7.52 | 10 |
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# Copyright 2024 ACCESS-NRI
# Based on https://github.com/coecms/access-esm-build-gadi/blob/master/Makefile
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_r... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/dummygrib/package.py | .py | 736aaaa39043dada | 7.52 | 10 |
from spack_repo.builtin.build_systems.generic import Package
from spack.package import *
class Fcm(Package):
"""
FCM is a build system for Fortran programs
"""
homepage = "https://github.com/metomi/fcm"
maintainers("scottwales", "penguian")
version(
"2021.05.0",
sha256="b417... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/fcm/package.py | .py | 39bb87be9466264d | 7.52 | 10 |
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# Based on spack/var/spack/repos/builtin/packages/fiat/package.py
from spack_repo.builtin.build_systems.cmake import CMak... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/fiat/package.py | .py | 667a8f5e07029789 | 7.52 | 10 |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.autotools import AutotoolsPackage
from spack.package import *
class Fortranxml(Aut... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/fortranxml/package.py | .py | 2b92d581f49266aa | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# Copyright 2025 ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.autotools import AutotoolsPackage
from spack.package import *
class FreNctools(AutotoolsPackage):
"""FRE-NCtools is a collecti... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/fre_nctools/package.py | .py | f2ef90355f37dd79 | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# Copyright 2024-2026 ACCESS-NRI
from spack_repo.builtin.build_systems.generic import Package
from spack.version.version_types import GitVersion, StandardVersion
from spack.package import *
class G... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/gcom/package.py | .py | d922e8c0421e09ab | 7.52 | 10 |
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# Copyright 2024 ACCESS-NRI
# Based on gcom/package.py by scottwales 2023
# and https://github.com/coecms/access-esm-build-gadi/blob/master/Makefile
#
# SPDX-License-Iden... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/gcom4/package.py | .py | 0b71503cfa98bbcc | 7.52 | 10 |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# Copyright 2022 ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.cmake import CMakePackage
from spack.package import *
... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/libaccessom2/package.py | .py | bf06ea53c4dcbe6b | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# Copyright ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack_repo.builtin.build_systems.cmake import CMakePackage
from spack.package import *
class Mom5(CMakePackage):
"""MOM is a numerical ocean model based on the hydr... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/mom5/package.py | .py | e8430c501e56d5c7 | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# Copyright 2024-2026 ACCESS-NRI
# Based on https://github.com/nci/spack-repo/blob/main/packages/um/package.py
from spack_repo.access.nri.build_systems.um_base import UmBasePackage
from spack.version... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/um/package.py | .py | dd403d3473f96dd1 | 7.52 | 10 |
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# Copyright 2024-2026 ACCESS-NRI
from spack_repo.access.nri.build_systems.um_base import UmBasePackage
from spack.package import *
class UmCreatebc(UmBasePackage):
"""
UmCreatebc creates loc... | ACCESS-NRI/access-spack-packages | spack_repo/access/nri/packages/um_createbc/package.py | .py | 5bf4228370e5ef1b | 7.52 | 10 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Authorisation rules changes observer."""
import json
import subprocess
import sys
from ssl import CERT_NONE, create_default_context
from time import sleep
from urllib.parse import urljoin
from urllib.request import urlopen
import psycopg2
i... | canonical/postgresql-k8s-operator | scripts/authorisation_rules_observer.py | .py | 75f683fc24ea16f4 | 7.59 | 14 |
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
"""Utilities for catching and raising architecture errors."""
import logging
import os
import sys
from ops.charm import CharmBase
from ops.model import BlockedStatus
logger = logging.getLogger(__name__)
class WrongArchitectureWarningCharm(C... | canonical/postgresql-k8s-operator | src/arch_utils.py | .py | fd7284b08cc6df37 | 7.59 | 14 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Authorisation rules observer."""
import logging
import os
import signal
import subprocess
import typing
from pathlib import Path
from sys import version_info
from ops.charm import CharmEvents
from ops.framework import EventBase, EventSource... | canonical/postgresql-k8s-operator | src/authorisation_rules_observer.py | .py | 72a067349af5a572 | 7.59 | 14 |
#!/usr/bin/env python3
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
"""Structured configuration for the PostgreSQL charm."""
import logging
from typing import Annotated, Literal
from charms.data_platform_libs.v0.data_models import BaseConfigModel
from pydantic import Field, NonNegativeIn... | canonical/postgresql-k8s-operator | src/config.py | .py | c87c724fe7a420fc | 7.59 | 14 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""LDAP implementation."""
import logging
from charms.glauth_k8s.v0.ldap import (
LdapProviderData,
LdapReadyEvent,
LdapRequirer,
LdapUnavailableEvent,
)
from ops import Object, Relation
logger = logging.getLogger(__name__)
... | canonical/postgresql-k8s-operator | src/ldap.py | .py | 19ec2fe654172445 | 7.59 | 14 |
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
"""Postgres db and db-admin relation hooks & helpers."""
import logging
from collections.abc import Iterable
from typing import TYPE_CHECKING
from charms.postgresql_k8s.v0.postgresql import (
ACCESS_GROUP_RELATION,
PostgreSQLCreateData... | canonical/postgresql-k8s-operator | src/relations/db.py | .py | ba637383894171e3 | 7.59 | 14 |
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
"""Postgres client relation hooks & helpers."""
import logging
from typing import TYPE_CHECKING
from charms.data_platform_libs.v0.data_interfaces import (
DatabaseProvides,
DatabaseRequestedEvent,
)
from charms.postgresql_k8s.v0.postgr... | canonical/postgresql-k8s-operator | src/relations/postgresql_provider.py | .py | bb949aa7618b17a2 | 7.59 | 14 |
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
"""Upgrades implementation."""
import json
import logging
from typing import TYPE_CHECKING
from charms.data_platform_libs.v0.upgrade import (
ClusterNotReadyError,
DataUpgrade,
DependencyModel,
KubernetesClientError,
)
from cha... | canonical/postgresql-k8s-operator | src/upgrade.py | .py | ef2b771095a520ee | 7.59 | 14 |
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
"""A collection of utility functions that are used in the charm."""
import re
import secrets
import string
def new_password() -> str:
"""Generate a random password string.
Returns:
A random password string.
"""
choices... | canonical/postgresql-k8s-operator | src/utils.py | .py | 1c42f073391a6cfa | 7.59 | 14 |
#!/usr/bin/env python3
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
import asyncio
import itertools
import logging
from datetime import datetime
from multiprocessing import ProcessError
from pathlib import Path
from subprocess import check_call
import botocore
import psycopg2
import reques... | canonical/postgresql-k8s-operator | tests/integration/helpers.py | .py | 9c70ad87700b568b | 7.09 | 14 |
# -*- coding: utf-8 -*-
"""
Created on 2024.08.16
@author: MiniUFO
Copyright 2018. All rights reserved. Use is subject to license terms.
"""
#%%
import xarray as xr
import numpy as np
from xcontour.xcontour import Contour2D, add_latlon_metrics
from xinvert.xinvert import FiniteDiff
dset = xr.open_dataset('d:/tracerL... | miniufo/xcontour | tests/test_Keff_ocean.py | .py | d177463ebd5aaf27 | 8.14 | 18 |
# -*- coding: utf-8 -*-
"""
Created on 2022.08.31
@author: MiniUFO
Copyright 2018. All rights reserved. Use is subject to license terms.
"""
#%% define two methods
import numpy as np
import xarray as xr
from GeoApps.DiagnosticMethods import Dynamics
from xcontour.xcontour import Contour2D
def computeKeff_hist(trac... | miniufo/xcontour | tests/test_hist.py | .py | 3803ce1d6a977c27 | 7.14 | 18 |
from __future__ import annotations
import json
from pathlib import Path
from types import SimpleNamespace
import pytest
# Import the module to allow monkeypatching its "files" symbol
from tmxcaliber.schema import schema as schema_mod
from tmxcaliber.schema.schema import (
SchemaValidationError,
SchemaValidat... | trustoncloud/tmxcaliber | test/test_schema.py | .py | 46239fcba7f72114 | 7.92 | 6 |
from __future__ import annotations
from collections.abc import Iterable
from typing import Any
from .filter import Filter
from .threatmodel_data import ThreatModelData
from .tools import sort_by_id
def _get_controls_dict(tm: ThreatModelData) -> dict[str, Any]:
data = tm.get_json().get("controls", {})
return... | trustoncloud/tmxcaliber | tmxcaliber/lib/control_selector.py | .py | 4afdc5d635bcb8af | 7.42 | 6 |
"""Semantic diff for drawio DFD bodies, used by tm_qa field-diffs.
A ThreatModel DFD ``body`` (``get_vanilla_json()["dfd"]["body"]``) is base64
of the drawio ``<mxfile>`` XML. Comparing those base64 strings (or the raw
XML) reports a change on every save, because drawio rewrites volatile editor
state on each export: t... | trustoncloud/tmxcaliber | tmxcaliber/lib/dfd_diff.py | .py | 9f0f3d7831c7bff6 | 7.42 | 6 |
import json
import re
from collections.abc import Callable
from datetime import datetime, timezone
from typing import Any, TypeVar
T = TypeVar("T")
# Priority mapping for the letter segments
priority_map: dict[str, int] = {"FC": 1, "T": 2, "CO": 3, "C": 4, "A": 5}
SortKey = tuple[int, int | float | str, int]
def e... | trustoncloud/tmxcaliber | tmxcaliber/lib/tools.py | .py | 5528d418ca0c2386 | 7.42 | 6 |
import base64
import copy
import os
import re
import subprocess
import sys
import zlib
from collections import defaultdict
from pathlib import Path
from typing import Any
from urllib.parse import unquote
from bs4 import BeautifulSoup as bsoup
from bs4.element import Tag
OPACITY_PERCENT = 10
BS4_BACKEND = "xml"
def ... | trustoncloud/tmxcaliber | tmxcaliber/opacity.py | .py | 01c85c3d71a46258 | 7.42 | 6 |
from __future__ import annotations
import json
import re
from collections.abc import Iterable
from importlib.resources import files
from typing import Any, Literal
_SchemaKind = Literal["threatmodel", "overwatch"]
__all__ = [
"SchemaValidationError",
"SchemaValidationUnavailable",
"validate_overwatch_sch... | trustoncloud/tmxcaliber | tmxcaliber/schema/schema.py | .py | 1b3195f4779a16d4 | 7.42 | 6 |
#!/usr/bin/env python3
"""
Configuration settings for the Iceberg Location Tracker.
"""
import os
from pathlib import Path
from typing import Any, Dict
# Base configuration
BASE_CONFIG: Dict[str, Any] = {
# URLs and endpoints
"iceberg_url": "https://www.scp.byu.edu/current_icebergs.html",
"full_database_u... | Joel-hanson/Iceberg-locations | src/config.py | .py | 49e9fb200e0b9928 | 7.42 | 6 |
# -*- coding: utf-8 -*-
import json
import os
import re
from datetime import datetime, timedelta
import requests
from bs4 import BeautifulSoup
def get_update_datetime(days, revised_date):
revised_year = revised_date.year
if days > revised_date.timetuple().tm_yday:
revised_year = revised_year - 1
... | Joel-hanson/Iceberg-locations | src/iceberg.py | .py | ddbe78ff6041975d | 7.42 | 6 |
"""
Animation utilities for the Antarctic Iceberg Tracker.
"""
from config import get_config
from .data_handler import get_latest_date, load_iceberg_data
def get_animation_url(iceberg_name):
"""Get the animation URL for a specific iceberg."""
config = get_config()
base_url = config["animation_base_url"]... | Joel-hanson/Iceberg-locations | src/utils/animations.py | .py | 4930eed3baaf0340 | 7.42 | 6 |
"""
Data handling utilities for the Antarctic Iceberg Tracker.
"""
import json
import os
from datetime import datetime
def get_data_file_path():
"""Get the path to the main data file."""
project_root = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
return os.pa... | Joel-hanson/Iceberg-locations | src/utils/data_handler.py | .py | 0bc1b78df5bfce92 | 7.42 | 6 |
"""
Process utilities for running external scripts.
"""
import os
import subprocess
import sys
def run_scraper():
"""Run the iceberg scraper directly (no subprocess needed)."""
print("Collecting latest iceberg data...")
try:
# Import and call the iceberg collection function directly
sys.p... | Joel-hanson/Iceberg-locations | src/utils/process_runner.py | .py | bc870722cb8c0c4e | 7.42 | 6 |
"""Generate the code for a Nextsim module class source file."""
def denamespace(nname):
"""Return the last element of the name, without any of the qualifying namespaces."""
return nname.split(":")[-1]
def generator(module_class_name, fq_interface_name, fq_impl_names, help_names):
"""Generate the text fo... | nextsimhub/nextsimdg | core/src/modules/module_maker.py | .py | c0aa46a60f6d8294 | 7.56 | 12 |
/*!
* @author Tim Spain <timothy.spain@nersc.no>
*/
#include "include/IDynamics.hpp"
#include "include/NextsimModule.hpp"
#include "PDTestDynamics.hpp"
#include <string>
namespace Module {
const std::string PDTESTDYNAMICS = "Nextsim::PDTestDynamics";
template <> const Module<Nextsim::IDynamics>::Map& Module<Nex... | nextsimhub/nextsimdg | core/test/DynamicsModuleForPDtest.cpp | .cpp | 1b77f0b7c992f33f | 7.06 | 12 |
/*!
* @author Tim Spain <timothy.spain@nersc.no>
*/
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>
#include "include/FileCallbackCloser.hpp"
#include <filesystem>
#include <functional>
#include <ostream>
namespace Nextsim {
const std::string testFileName = "testFileName.nc";
class File... | nextsimhub/nextsimdg | core/test/FileCallbackCloser_test.cpp | .cpp | d23e16d916e51af7 | 7.06 | 12 |
from bigraph_schema import allocate_core # noqa: F401
# The installed distribution's version, exposed so a run manifest can record
# *which* engine produced an artifact. Read from installed metadata rather
# than hardcoded, so the two can never disagree — and note the trap that
# makes it worth a test: an editable in... | vivarium-collective/process-bigraph | process_bigraph/__init__.py | .py | 5c7cca40da095ec2 | 7.42 | 6 |
"""Discover composite specs across installed bigraph-schema-dependent packages.
A composite spec is any file matching *.composite.yaml or *.composite.json inside
an installed package whose distribution declares bigraph-schema as a requirement.
"""
from __future__ import annotations
import importlib
import importlib.me... | vivarium-collective/process-bigraph | process_bigraph/composite_discovery.py | .py | 1fc1ffb2abaf6e00 | 7.42 | 6 |
"""Config-value normalizers for process ``initialize()`` / ``__init__`` bodies.
v2ecoli friction #3 (2026-05-19): a config value declared as a 2-element
range — e.g. ``band: [0.2, 0.5]`` in a composite/study yaml — does not always
arrive in the process as a list. ``bigraph-schema``'s ``node`` type (and JSON
round-trip... | vivarium-collective/process-bigraph | process_bigraph/config_helpers.py | .py | c8aed2b62c0a4e90 | 7.42 | 6 |
"""DraftProcess — a placeholder / draft process.
A *draft* process declares a **contract** — its input and output ports (names +
bigraph types) plus a human-readable description of the transformation it is
*intended* to perform — but has **no update dynamics yet**. It lets the model
topology (which process connects wh... | vivarium-collective/process-bigraph | process_bigraph/draft_process.py | .py | d04c1ef955893437 | 7.42 | 6 |
"""The pull half of pull-or-compute.
``SimulationStep`` computes a study's results by running it. ``CachedResults``
produces the same thing by resolving an artifact that already exists. They
share the ``{results: node}`` face and both produce at finalize, so nothing
downstream can tell which one it is wired to — a stu... | vivarium-collective/process-bigraph | process_bigraph/processes/cached.py | .py | 0b59decfde6109f5 | 7.42 | 6 |
"""
Reaction Step
=============
A Step that fires Milner-style reaction rules on its input state.
Rules are ``ReactionRule`` objects from ``bigraph_schema.assembly``.
The step searches the input subtree for redex matches, fires one
(deterministically or stochastically), and returns the modified
subtree as its output.... | vivarium-collective/process-bigraph | process_bigraph/processes/reaction.py | .py | 24d80d7e487d4b0b | 7.42 | 6 |
"""A whole simulation as one node of an outer step network.
A simulation is itself a step network, so a study is a **higher-order DAG**:
the simulation is a single node, and the flush entities — visualizations,
analyses, report cards — are ordinary steps downstream of it.
That framing is what makes a flush step fire ... | vivarium-collective/process-bigraph | process_bigraph/processes/simulation.py | .py | 1dcd27ce85676e59 | 7.42 | 6 |
"""Run a whole Composite as one batch task (Nextflow / Snakemake / shell).
Loads a composite document (``{schema, state}``), overlays an optional
initial-state document, advances the simulation, and writes the resulting
state document and/or bridge outputs. The mother→daughter handoff of
vEcoli's Nextflow workflow bec... | vivarium-collective/process-bigraph | process_bigraph/run_composite.py | .py | 66a7d7c3a88c4b56 | 7.42 | 6 |
"""Tests for process_bigraph.composite_discovery (moved from viva-superpowers)."""
import pytest
from process_bigraph.composite_discovery import (
discover_composites, discover_all, _make_spec_id,
)
from process_bigraph import composite_spec as cs
def test_discover_composites_finds_workspace_local_specs(tmp_pat... | vivarium-collective/process-bigraph | process_bigraph/tests/test_composite_discovery.py | .py | fe5e073e2d1dfa33 | 7.92 | 6 |
# %% [markdown]
# # Comparing Cross-Bridge Models: Land, Lewalle, RDQ18, RDQ20MF
#
# The previous four demos each ran the same isometric twitch experiment --
# a 10x1x1 mm slab of Holzapfel-Ogden tissue, pre-stretched and locked, then
# activated -- with a different
# [`crossbridge`](https://github.com/ComputationalPhy... | finsberg/fenicsx-pulse | demo/crossbridge/crossbridge_comparison.py | .py | 4ef4ad363f1a7923 | 7.54 | 11 |
# %% [markdown]
# # Isometric Twitch with the Land (2017) Cross-Bridge Model
#
# The [`frank_starling_twitch`](frank_starling_twitch.py) demo reproduces the
# Frank-Starling mechanism with a purely phenomenological, curve-fitted
# multiplier $g(\lambda)$ bolted onto the active stress. This demo replaces
# that ad hoc m... | finsberg/fenicsx-pulse | demo/crossbridge/crossbridge_land2017.py | .py | 73797be893ca0558 | 7.54 | 11 |
# %% [markdown]
# # Isometric Twitch with the Lewalle (2024) OFF-State Feedback Model
#
# This demo repeats the [Land (2017) cross-bridge twitch](crossbridge_land2017.py)
# with [`crossbridge`](https://github.com/ComputationalPhysiology/crossbridge)'s
# `Lewalle2024` model instead. `Lewalle2024` is Land (2017) with one... | finsberg/fenicsx-pulse | demo/crossbridge/crossbridge_lewalle2024.py | .py | 548384af9351f731 | 7.54 | 11 |
# %% [markdown]
# # Isometric Twitch with the RDQ18 Regulatory-Unit Model
#
# This demo repeats the [Land (2017) cross-bridge twitch](crossbridge_land2017.py)
# with [`crossbridge`](https://github.com/ComputationalPhysiology/crossbridge)'s
# `RDQ18` model, from Regazzoni, Dedè & Quarteroni {cite}`regazzoni2018active`.
... | finsberg/fenicsx-pulse | demo/crossbridge/crossbridge_rdq18.py | .py | a641af79fc544bfe | 7.54 | 11 |
# %% [markdown]
# # Isometric Twitch with the RDQ20-MF Mean-Field Cross-Bridge Model
#
# This demo repeats the [RDQ18 twitch](crossbridge_rdq18.py) with
# [`crossbridge`](https://github.com/ComputationalPhysiology/crossbridge)'s
# `RDQ20MF` model, from Regazzoni, Dedè & Quarteroni
# {cite}`regazzoni2020biophysically`.
... | finsberg/fenicsx-pulse | demo/crossbridge/crossbridge_rdq20mf.py | .py | e294516834f887f6 | 7.54 | 11 |
import ufl
def subplus(x):
r"""
Ramp function
.. math::
\max\{x,0\}
"""
return ufl.conditional(ufl.ge(x, 0.0), x, 0.0)
def heaviside(
x: ufl.core.expr.Expr,
k: float = 1.0,
use_exp: bool = False,
) -> ufl.core.expr.Expr:
r"""
Heaviside function
.. math::
... | finsberg/fenicsx-pulse | src/pulse/functions.py | .py | c186b20498cc6200 | 7.54 | 11 |
#!/usr/bin/env python3
"""Phoenix system management"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import os
import logging
import sys
import resource
import importlib
logging.basicConfig(format="%(levelname)s: %(message)s")
from ClusterShell.NodeUtils import GroupResolver
from ClusterShell.NodeSet import ... | olcf/phoenix | lib/phoenix/__init__.py | .py | 4d12c2d89254dd48 | 7.45 | 7 |
#!/usr/bin/env python3
"""Phoenix bootloader support"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import sys
import logging
import phoenix
from phoenix.node import Node
import os
from pathlib import Path
def get_bootloader_script(node, interface=None, provider=None):
loader_class = _find_class(node, p... | olcf/phoenix | lib/phoenix/bootloader/__init__.py | .py | 3d45aec7cc68f57f | 7.45 | 7 |
#!/usr/bin/env python3
"""Commands"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import sys
import logging
import os
from ClusterShell.NodeSet import NodeSet
import phoenix
from phoenix.system import System
from phoenix.oob import OOBTimeoutError
class CommandTimeout(Exception):
pass
class Command(o... | olcf/phoenix | lib/phoenix/command/__init__.py | .py | d68d489507938a77 | 7.45 | 7 |
#!/usr/bin/env python3
"""Node configuration"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import logging
import sys
import argparse
import traceback
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
logging.info("Unable to load CLoader and/or CDumper")
... | olcf/phoenix | lib/phoenix/command/node.py | .py | f0d0e84e42d3b30e | 7.45 | 7 |
#!/usr/bin/env python3
"""CSV Data Source Functions"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import logging
import time
import csv
import phoenix
from phoenix.datasource import Datasource
class CsvfileDatasource(Datasource):
cachetime = 300
data = {}
data_freshness = {}
@classmethod
... | olcf/phoenix | lib/phoenix/datasource/csvfile.py | .py | 75ee3ba0675c88e1 | 7.45 | 7 |
#!/usr/bin/env python3
"""Phoenix class to manage groups"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import logging
from yaml import load, dump
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
logging.info("Unable to load CLoader and/or CDumper")
from yaml import ... | olcf/phoenix | lib/phoenix/group.py | .py | 89e096cc63621e02 | 7.45 | 7 |
#!/usr/bin/env python3
"""Phoenix class to manage networks"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import logging
from yaml import load, dump
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
logging.info("Unable to load CLoader and/or CDumper")
from yaml impor... | olcf/phoenix | lib/phoenix/network.py | .py | 8db5220d38b7af2c | 7.45 | 7 |
#!/usr/bin/env python3
"""SNMP out-of-band Functions"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import logging
import netsnmp
import json
from phoenix.oob import OOBTimeoutError
from phoenix.oob import Oob
class SnmpError(Exception):
pass
class Snmp(Oob):
@classmethod
def _snmpwalk(cls, o... | olcf/phoenix | lib/phoenix/oob/snmp.py | .py | 57e9f23c539125c8 | 7.45 | 7 |
#!/usr/bin/env python3
"""OOB SSH Functions"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import logging
import json
from ClusterShell.Task import Task
from phoenix.oob import OOBTimeoutError
from phoenix.oob import Oob
class SshError(Exception):
pass
class Ssh(Oob):
pass
class SshSwitch(Ssh):
... | olcf/phoenix | lib/phoenix/oob/ssh.py | .py | 8a3f6956deba1614 | 7.45 | 7 |
#!/usr/bin/env python3
"""Phoenix class to manage a System and plugin settings"""
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
import logging
from yaml import load, dump
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
logging.info("Unable to load CLoader and/or CDumper")... | olcf/phoenix | lib/phoenix/system.py | .py | eca68f8ab0951ea8 | 7.45 | 7 |
"""The XY Screens integration."""
import logging
from typing import Any
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import entity... | rrooggiieerr/homeassistant-xyscreens | custom_components/xyscreens/__init__.py | .py | 6f88b83633c349f5 | 7.42 | 6 |
"""Config flow for XY Screens integration."""
import logging
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import UnitOfTime
from homeassistant.core import callback
from home... | rrooggiieerr/homeassistant-xyscreens | custom_components/xyscreens/config_flow.py | .py | cfe101920f6ccd3d | 7.42 | 6 |
"""The XY Screens cover entity."""
import logging
from typing import Any
from homeassistant.components.cover import (
ATTR_CURRENT_POSITION,
ATTR_POSITION,
CoverEntity,
CoverEntityDescription,
CoverEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import... | rrooggiieerr/homeassistant-xyscreens | custom_components/xyscreens/cover.py | .py | b0022ca46cd224f3 | 7.42 | 6 |
"""
Created on 2023-11-16
@author: wf
"""
import random
from typing import List, Optional
import requests
from bs4 import BeautifulSoup
from scan.product import Product
class Amazon:
"""
lookup products on amazon web site
"""
def __init__(self, debug: Optional[bool] = False):
"""
... | WolfgangFahl/scan2wiki | scan/amazon.py | .py | a7183d92c41913cf | 7.42 | 6 |
"""
Created on 2023-11-16
@author: wf
"""
import logging
from dataclasses import dataclass
from typing import List, Optional
from PIL import Image
from pyzbar.pyzbar import decode
@dataclass
class Barcode:
"""
Barcode data structure with
static methods e.g. e.g. pyzbar barcode decoder wrapper
"""
... | WolfgangFahl/scan2wiki | scan/barcode.py | .py | e041b50826a0d544 | 7.42 | 6 |
"""
Created on 2024-08-25
@author: wf
"""
from typing import Any
from ngwidgets.progress import NiceguiProgressbar
from ngwidgets.widgets import Link
from nicegui import run, ui
from scan.dms import Archive
# from ngwidgets.lod_grid import ListOfDictsGrid
class EntityView:
"""
a generic entity view
""... | WolfgangFahl/scan2wiki | scan/dms_views.py | .py | 084131c4132701d1 | 7.42 | 6 |
"""
Created on 2023-11-17
@author: wf
"""
from ngwidgets.lod_grid import GridConfig, ListOfDictsGrid
from ngwidgets.widgets import Link
from nicegui import ui
from scan.dms import EntityManager
class EntityManagerView:
"""
a view for a given entity manager
"""
def __init__(self, em: EntityManager,... | WolfgangFahl/scan2wiki | scan/entity_view.py | .py | 085b7c8eb680924d | 7.42 | 6 |
"""
Created on 2021-04-21
see https://stackoverflow.com/a/66110795/1497139
"""
import sys
import time
from watchdog.events import PatternMatchingEventHandler
from watchdog.observers import Observer
class Watcher:
"""
watch the given path with the given callback
"""
def __init__(self, path, patter... | WolfgangFahl/scan2wiki | scan/folderwatcher.py | .py | 9213b07c9b6c10f6 | 7.42 | 6 |
"""
Created on 2025-04-07
@author: wf
"""
import os
import re
import fitz # PyMuPDF
class PDFExtractor:
"""
PyMuPDF wrapper to get PDF Text with caching capability
"""
@classmethod
def getPDFText(
cls, pdfFilenamePath, throwError: bool = True, useCache: bool = True
):
"""
... | WolfgangFahl/scan2wiki | scan/pdf.py | .py | 5f4962b22e1f16dc | 7.42 | 6 |
"""
Created on 2021-10-26
@author: wf
"""
import time
class Profiler:
"""
simple profiler
"""
def __init__(self, msg: str, profile=True):
"""
construct me with the given msg and profile active flag
Args:
msg (str): the message to show if profiling is active
... | WolfgangFahl/scan2wiki | scan/profiler.py | .py | a83ce78fcd5ace8f | 7.42 | 6 |
"""
Created on 2023-11-14
@author: wf
"""
import sys
from argparse import ArgumentParser
from basemkit.argparse_action import StoreDictKeyPair
from ngwidgets.cmd import WebserverCmd
from scan.scan_webserver import ScanSolution, ScanWebServer
class ScanCmd(WebserverCmd):
"""
Command line for scan2wiki web ... | WolfgangFahl/scan2wiki | scan/scan_cmd.py | .py | 30f6d1a9e33e8807 | 7.42 | 6 |
"""
Created on 2023-11-14
@author: wf
"""
import logging
import os
import sys
from fastapi.responses import FileResponse, HTMLResponse, RedirectResponse
from ngwidgets.input_webserver import InputWebserver, InputWebSolution
from ngwidgets.lod_grid import GridConfig, ListOfDictsGrid
from ngwidgets.webserver import We... | WolfgangFahl/scan2wiki | scan/scan_webserver.py | .py | a06b853af9886971 | 7.42 | 6 |
"""
Created on 2023-11-14
@author: wf
"""
import os
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List
from ngwidgets.widgets import Link
from scan.dms import Document
from scan.logger import Logger
class Scans:
"""
Class to handle operations related to scanned files... | WolfgangFahl/scan2wiki | scan/scans.py | .py | 1b6fba724aa27681 | 7.42 | 6 |
"""
Created on 2023-11-14
@author: wf
"""
import logging
import time
from collections import Counter
from datetime import datetime
from ngwidgets.progress import NiceguiProgressbar
from ngwidgets.widgets import Link
from nicegui import run, ui
from scan.dms import Document
from scan.upload_job import UploadJob
cl... | WolfgangFahl/scan2wiki | scan/upload.py | .py | 58754e0d76fd038e | 7.42 | 6 |
"""
Created on 2023-11-16
Updated on 2024-12-29
Updated on 2025-11-26 for https://github.com/WolfgangFahl/scan2wiki/issues/25
@author: wf
"""
import os
from datetime import datetime
from pathlib import Path
from typing import Optional, Tuple
import requests
from ngwidgets.ai_tasks import AITasks
from ngwidgets.image... | WolfgangFahl/scan2wiki | scan/webcam.py | .py | 6836f57efa959438 | 7.42 | 6 |
"""
Created on 2023-11-16
@author: wf
"""
from os.path import expanduser
from ngwidgets.basetest import Basetest
from scan.amazon import Amazon, Product
from scan.product import Products
class TestAmazon(Basetest):
"""
test the amazon search
"""
def testBooks(self):
""" """
if sel... | WolfgangFahl/scan2wiki | tests/test_amazon.py | .py | dcf9bc17945ae922 | 7.92 | 6 |
"""
Created on 2023-11-16
@author: wf
"""
import os
from ngwidgets.basetest import Basetest
from scan.barcode import Barcode
from scan.scan_webserver import ScanSolution
class TestBarcode(Basetest):
"""
test the barcode reading
"""
def test_barcodes(self):
"""
test decoding sample... | WolfgangFahl/scan2wiki | tests/test_barcode.py | .py | 51fa91f8027e5d02 | 7.92 | 6 |
"""
Created on 2023-11-16
@author: wf
"""
import os
import tempfile
from ngwidgets.basetest import Basetest
from scan.product import Product, Products
class TestProduct(Basetest):
"""
Test the product handling.
"""
def test_products(self):
"""
Test adding products, storing and rel... | WolfgangFahl/scan2wiki | tests/test_product.py | .py | f68d3dd1d7770aa4 | 7.92 | 6 |
"""
Created on 2023-11-14
@author: wf
"""
import os
import shutil
from ngwidgets.basetest import Basetest
from scan.scans import Scans
class TestScans(Basetest):
"""
test the Scans class
"""
def setUp(self, debug=False, profile=True):
"""
create a few files for testing
"""... | WolfgangFahl/scan2wiki | tests/test_scans.py | .py | 242b3cb3b8191660 | 7.92 | 6 |
"""
Created on 2021-10-21
@author: wf
"""
import unittest
from ngwidgets.basetest import Basetest
from scan.dms import Archive, ArchiveManager, DocumentManager, FolderManager
from scan.profiler import Profiler
class TestDMS(Basetest):
"""
test document management system handling
"""
def setUp(sel... | WolfgangFahl/scan2wiki | tests/testdms.py | .py | 701fbedd9d13d4d0 | 7.92 | 6 |
"""
Created on 2021-04-10
@author: wf
"""
import datetime
import os
from apscheduler.schedulers.background import BackgroundScheduler
from ngwidgets.basetest import Basetest
from scan.folderwatcher import Watcher
class TestFolderWatch(Basetest):
"""
test the folder watch functionality
"""
def set... | WolfgangFahl/scan2wiki | tests/testfolderwatch.py | .py | e1640ad099740402 | 7.92 | 6 |
"""
Created on 21.03.2021
@author: wf
"""
from ngwidgets.basetest import Basetest
from scan.dms import Document
from scan.pdf import PDFExtractor
from scan.scan_webserver import ScanSolution
class TestPDFExtract(Basetest):
"""
test PDF text extraction
"""
def setUp(self):
Basetest.setUp(se... | WolfgangFahl/scan2wiki | tests/testpdfextract.py | .py | e8afe6054f269d61 | 7.92 | 6 |
"""
Created on 2021-03-21
@author: wf
"""
from os import listdir
from ngwidgets.basetest import Basetest
from scan.dms import Document
from scan.scan_webserver import ScanSolution
class TestUpload(Basetest):
"""
test uploading to a mediawiki
"""
def setUp(self):
Basetest.setUp(self)
... | WolfgangFahl/scan2wiki | tests/testupload.py | .py | 6e99723b2e77a20a | 7.92 | 6 |
import os
import typing as ty
import logging
from pathlib import Path
import tempfile
import pytest
try:
from pydra import set_input_validator
set_input_validator(True)
except ImportError:
pass
from fileformats.core.utils import include_testing_package
include_testing_package(True)
# Set DEBUG logging f... | python-fileformats/fileformats | conftest.py | .py | ec75bf1c10b0d96d | 7.02 | 10 |
import json
import pytest
from fileformats.application import Dicom
def test_dicom_metadata():
dicom = Dicom.sample()
assert dicom.metadata["EchoTime"] == 2.07
def test_dicom_metadata_sequence_converted_to_list_of_dicts():
"""SQ-VR elements (e.g. ReferencedImageSequence) hold a list of nested Dataset... | python-fileformats/fileformats | extras/fileformats/extras/application/tests/test_application_medical.py | .py | 1ccf33dfa32be56c | 8.02 | 10 |
from pathlib import Path
from fileformats.application import Json, Yaml
SAMPLE_JSON = (
"""{"a": "string field", "alist": [0, 1, 2, 3, 4, 5], """
""""anesteddict": {"x": null, "y": [], "z": 42.0}}"""
)
SAMPLE_YAML = """a: string field
alist:
- 0
- 1
- 2
- 3
- 4
- 5
anesteddict:
x: null
y: []
z: 42.0
""... | python-fileformats/fileformats | extras/fileformats/extras/application/tests/test_application_serialization.py | .py | 71c7b61cb1b7dd65 | 7.02 | 10 |
import typing as ty
from fileformats.core.mixin import WithMagicNumber
from fileformats.generic import BinaryFile
if ty.TYPE_CHECKING:
import pydicom
class Dicom(WithMagicNumber, BinaryFile):
iana_mime = "application/dicom"
magic_number = b"DICM"
magic_number_offset = 128
binary = True
alt... | python-fileformats/fileformats | fileformats/application/medical.py | .py | fb330033b520c2e5 | 7.52 | 10 |
import typing as ty
from .decorators import classproperty
from .exceptions import FormatDefinitionError
class Classifier:
"""Base class for all file-format "classifiers", including datatypes and abstract
types"""
@classproperty # type: ignore[arg-type]
def type_name(cls) -> str:
"""Name of ... | python-fileformats/fileformats | fileformats/core/classifier.py | .py | 9c527e1cd2e3d350 | 7.52 | 10 |
import typing as ty
from abc import ABCMeta, abstractmethod
from pathlib import Path
from fileformats.core import FileSet, mtime_cached_property, validated_property
from fileformats.core.decorators import classproperty
from fileformats.core.exceptions import FormatMismatchError
from fileformats.core.utils import get_o... | python-fileformats/fileformats | fileformats/core/collection.py | .py | c5f3450613218a6d | 7.52 | 10 |
import logging
import typing as ty
from abc import ABCMeta
from .classifier import Classifier
from .datatype import DataType
from .exceptions import FormatDefinitionError
if ty.TYPE_CHECKING:
from pydra.compose.base import Task
import fileformats.core
from . import mixin
logger = logging.getLogger("fil... | python-fileformats/fileformats | fileformats/core/converter_helpers.py | .py | b497b620a2fc5331 | 7.52 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.