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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3 -W ignore::UserWarning
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Anonymize users non-interactively."""
import typing
import uuid
import click
from indico.cli.core import cli_group
from indico.core.db import db
from indico.modules.events.registration.models.fo... | canonical/indico-operator | indico_rock/plugins/anonymize/anonymize/cli.py | .py | e99e9efdc7314e53 | 7.56 | 12 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Connect our CLI plugin to the existing Indico's CLI."""
from indico.core import signals
from indico.core.plugins import IndicoPlugin
from anonymize.cli import cli
class AnonymizePlugin(IndicoPlugin):
"""Anonymiz... | canonical/indico-operator | indico_rock/plugins/anonymize/anonymize/plugin.py | .py | cc7a3106ed6e8a7f | 7.56 | 12 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Create users non-interactively."""
import click
from indico.cli.core import cli_group
from indico.core.db import db
from indico.modules.auth import Identity
from indico.modules.users import User
from indico.modules.use... | canonical/indico-operator | indico_rock/plugins/autocreate/autocreate/cli.py | .py | e8d17cdd0f7a2c6e | 7.56 | 12 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Connect our CLI plugin to the existing Indico's CLI."""
from indico.core import signals
from indico.core.plugins import IndicoPlugin
from autocreate.cli import cli
class AutocreatePlugin(IndicoPlugin):
"""Autocr... | canonical/indico-operator | indico_rock/plugins/autocreate/autocreate/plugin.py | .py | 61d1ae255c19bb03 | 7.56 | 12 |
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
"""# Interface Library for OpenFGA.
This library wraps relation endpoints using the `openfga` interface
and provides a Python API for requesting OpenFGA authorization model
stores to be created.
## Getting Started
To get started using the lib... | canonical/indico-operator | lib/charms/openfga_k8s/v1/openfga.py | .py | 0d86c3c0cd848764 | 7.56 | 12 |
// Copyright 2025 Canonical Ltd.
// See LICENSE file for licensing details.
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
duration: '1m',
vus: 50,
thresholds: {
http_req_failed: ['rate<0.01'], // http errors should be less than 1%
http_req_duration: ['p(80)<1500'], // ... | canonical/indico-operator | load_tests/load-test.js | .js | 824c977fca0b3889 | 7.06 | 12 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Flask Charm entrypoint."""
import logging
import typing
import ops
import paas_charm.flask
logger = logging.getLogger(__name__)
EMAIL_LIST_SEPARATOR = ","
EMAIL_LIST_MAX = 50
INDICO_WRAPPER = "/srv/indico/start-indi... | canonical/indico-operator | src/charm.py | .py | 2a67ef44b8d290da | 7.56 | 12 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Fixtures for Indico charm tests."""
def pytest_addoption(parser):
"""Parse additional pytest options.
Args:
parser: Pytest parser.
"""
parser.addoption("--charm-file", action="store")
parser.addoption(
"... | canonical/indico-operator | tests/conftest.py | .py | 433cd8000fdab6ec | 7.06 | 12 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Fixtures for Indico charm integration tests."""
import logging
import socket
import typing
from collections.abc import Generator
import jubilant
import pytest
logger = logging.getLogger(__name__)
# Timeout for juju wait operations in seco... | canonical/indico-operator | tests/integration/conftest.py | .py | d0d1f6e5a5942b80 | 8.06 | 12 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Integration tests for the Indico charm."""
import logging
from secrets import token_hex
import jubilant
import pytest
import requests
logger = logging.getLogger(__name__)
@pytest.mark.abort_on_fail
def test_active... | canonical/indico-operator | tests/integration/test_charm.py | .py | 3dc78e7ed2fa2067 | 8.06 | 12 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""S3 integration tests for the Indico charm."""
import logging
import jubilant
import pytest
import requests
from .conftest import JUJU_WAIT_TIMEOUT, generate_s3_config
logger = logging.getLogger(__name__)
def _ind... | canonical/indico-operator | tests/integration/test_s3.py | .py | 48a7ba5076783b77 | 8.06 | 12 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""SAML integration tests for the Indico charm."""
import logging
from urllib.parse import urlparse
import jubilant
import pytest
import requests
from .conftest import JUJU_WAIT_TIMEOUT
logger = logging.getLogger(__na... | canonical/indico-operator | tests/integration/test_saml.py | .py | bc7399a339f6a32a | 8.06 | 12 |
#!/usr/bin/env python3
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
"""SMTP integration tests for the Indico charm."""
import logging
import jubilant
import pytest
from .conftest import JUJU_WAIT_TIMEOUT
logger = logging.getLogger(__name__)
# Non-routable RFC 5737 TEST-NET-1 address ... | canonical/indico-operator | tests/integration/test_smtp.py | .py | 19d29ba7d9c71c48 | 7.06 | 12 |
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
# Learn more about testing at: https://ops.readthedocs.io/en/latest/explanation/testing.html
"""Unit tests for the Indico charm actions."""
from secrets import token_hex
from unittest.mock import patch
import ops
import ops.testing
import pyt... | canonical/indico-operator | tests/unit/test_actions.py | .py | 3720db49a592276b | 7.06 | 12 |
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
# Learn more about testing at: https://ops.readthedocs.io/en/latest/explanation/testing.html
"""Unit tests for the Indico charm base behaviour."""
import ops
import ops.testing
from charm import IndicoCharm
from .charm_metadata import CHARM_... | canonical/indico-operator | tests/unit/test_base.py | .py | fba4d013cb75f699 | 8.06 | 12 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
# pylint: disable=missing-module-docstring,invalid-name,unused-argument
# linting rules disabled due to this file is defined by ZAP tool script template
def sendingRequest(msg, initiator, helper): # noqa: N802
"""Sendingrequest is a name d... | canonical/indico-operator | tests/zap/add_header_request.py | .py | 4f75903c2b5afd87 | 8.06 | 12 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
# pylint: disable=missing-module-docstring,invalid-name,unused-argument
# linting rules disabled due to this file is defined by ZAP tool script template
import logging
def zap_started(zap, target):
"""Actions when starts
Args:
... | canonical/indico-operator | tests/zap/hook.py | .py | 67f03dba63629172 | 8.06 | 12 |
"""Benchmark scenario configuration: endpoints, workload pool, warmup and repetitions."""
from dataclasses import dataclass, field, replace
from typing import Optional
# --- Endpoints ---
@dataclass(frozen=True)
class ReadEndpoint:
name: str
# relative to base_url; may contain {gt_name}/{major_iov}/{minor_... | BNLNPPS/nopayloaddb | bench/config.py | .py | 1c8e064342abf130 | 7.45 | 7 |
"""Database-side capture for the benchmark harness. Arithmetic lives in
pg_snapshot.py; nothing here reports a cumulative counter as a result."""
import hashlib
import json
import logging
from datetime import datetime, timezone
from django.db import connections
from cdb_rest import queries
from .pg_snapshot import ... | BNLNPPS/nopayloaddb | bench/db_metrics.py | .py | d5ff819809114b17 | 7.45 | 7 |
"""Latency statistics and noise-aware comparison, so a single lucky run is
never reported as an improvement. Stdlib only."""
import math
from typing import Optional
# Two-sided t critical values at alpha = 0.05, by degrees of freedom.
_T_CRITICAL_95 = {
1: 12.706, 2: 4.303, 3: 3.182, 4: 2.776, 5: 2.571, 6: 2.447,... | BNLNPPS/nopayloaddb | bench/latency_stats.py | .py | 2a878bae66d5fde5 | 7.45 | 7 |
"""Deterministic parameter pools. Replaying one tuple makes the workload
perfectly cacheable, which flatters R8 and hides R5/R7 entirely."""
import random
from .config import IOVPoint, WorkloadConfig, WorkloadProfile
def _spread(lo: int, hi: int, count: int, rng: random.Random) -> list:
"""`count` values evenly... | BNLNPPS/nopayloaddb | bench/workload.py | .py | 5d4702823dbed274 | 7.45 | 7 |
import jwt
from rest_framework.authentication import BaseAuthentication
from rest_framework import exceptions
from django.conf import settings
from types import SimpleNamespace
class CustomJWTAuthentication(BaseAuthentication):
"""
custom authentication class for DRF and JWT
"""
def authenticate(self,... | BNLNPPS/nopayloaddb | cdb_rest/authentication.py | .py | 1be38a5db1d437d5 | 7.45 | 7 |
"""Create or upgrade the ai_optimizer schema; run once after each deploy.
The schema sits outside Django's migration history, and only the collector,
tuner and benchmark call ensure_schema() -- so after an upgrade that adds a
column the read-only suggestions API can fail on every request. Idempotent, and
issues DDL, s... | BNLNPPS/nopayloaddb | cdb_rest/management/commands/ensure_ai_schema.py | .py | efe4ad95f4276235 | 7.45 | 7 |
"""The /ai/suggestions/ REST API.
Approving an immediately-appliable safe_sql executes it and moves the suggestion
to 'applied'; DDL and advisory suggestions stay 'approved' for the off-peak job
or manual action. Raw SQL rather than models, since ai_optimizer sits outside
Django's migration history.
"""
from django.c... | BNLNPPS/nopayloaddb | cdb_rest/query_optimization/api_views.py | .py | e273b9769d7e3545 | 7.45 | 7 |
"""Turn a pg_stat_statements entry into something PostgreSQL can actually plan.
Stored SQL is normalized to $1/$2 placeholders, and EXPLAIN ANALYZE rejects
those outright, so the collector would find every production endpoint and plan
none of them. Three tiers, most informative first: BOUND_PARAMS replays the
real que... | BNLNPPS/nopayloaddb | cdb_rest/query_optimization/explain_targets.py | .py | d143226c256a0899 | 7.45 | 7 |
"""Layer 3 of the AI analysis engine: LLM-augmented analysis.
Only invoked when a query plan is a genuine candidate (already crossed the
collector's latency/IO threshold) but Layer 2's 13 deterministic rules found
nothing to say about it. The LLM's job here is narrow: name a bottleneck and,
optionally, propose one saf... | BNLNPPS/nopayloaddb | cdb_rest/query_optimization/llm_analyzer.py | .py | 71cbd47c2ec3ef23 | 7.45 | 7 |
"""LLM backend abstraction for Layer 3 of the AI analysis engine.
Ollama (air-gapped/on-prem), OpenAI (cloud), and MockLLMBackend (tests) all
conform to BaseLLMBackend so the analysis layer never depends on a specific
provider. Selection happens via the CDB_LLM_BACKEND env var, mirroring how
CDB_AUTH_CLASS selects the... | BNLNPPS/nopayloaddb | cdb_rest/query_optimization/llm_backend.py | .py | baed9188b0a286ab | 7.45 | 7 |
import random
from nopayloaddb.middleware import get_current_request
class ReadWriteRouter:
def db_for_read(self, model, **hints):
"""Route read queries to one of the read databases."""
# Redirect everything to default
#db = random.choice(['read_db_1', 'read_db_2'])
# Check if reque... | BNLNPPS/nopayloaddb | nopayloaddb/db_router.py | .py | 9801a7d1d375eff3 | 7.45 | 7 |
from threading import local
# Local storage for storing the current request
_request_local = local()
def get_current_request():
return getattr(_request_local, 'request', None)
class RequestMiddleware:
"""Middleware to store the current request for use in the DB router."""
def __init__(self, get_response)... | BNLNPPS/nopayloaddb | nopayloaddb/middleware.py | .py | 018c5df6e310da81 | 7.45 | 7 |
//! Shared test helpers: an in-memory capture sink and a lock that serializes
//! tests mutating `alog`'s global configuration within a single test binary.
use std::io::{self, Write};
use std::sync::{Arc, Mutex, MutexGuard};
static TEST_LOCK: Mutex<()> = Mutex::new(());
/// Acquires the process-wide test lock. Hold ... | IBM/alchemy-logging | src/rust/tests/common/mod.rs | .rs | 41977fe7a5220a05 | 7.09 | 14 |
// Excluded under `disable-logging`: `alog!` becomes a no-op under that
// feature, which would make these assertions fail by design rather than by
// bug. See `disable_logging_test.rs` for that feature's own coverage.
#![cfg(not(feature = "disable-logging"))]
mod common;
use alog::{alog, Config, Filters, FormatterKi... | IBM/alchemy-logging | src/rust/tests/configure_test.rs | .rs | d79b60b751864cd7 | 7.09 | 14 |
//! Verifies the Rust analog of `cpp`'s `-D ALOG_DISABLE_LOGGING`: with the
//! `disable-logging` feature enabled, every logging macro becomes a no-op,
//! but directly constructing a `Scoped*` guard (the escape hatch for named
//! instances, e.g. a `ScopedTimer` queried mid-scope) still logs normally.
//!
//! Gated on... | IBM/alchemy-logging | src/rust/tests/disable_logging_test.rs | .rs | 76b56dc990c23884 | 7.09 | 14 |
"""
Calculations provided by aiida_gromacs.
This calculation configures the ability to use the 'gmx editconf' executable.
"""
import os
from aiida.common import CalcInfo, CodeInfo
from aiida.engine import CalcJob
from aiida.orm import SinglefileData, Str
from aiida.plugins import DataFactory
EditconfParameters = Da... | CCPBioSim/aiida-gromacs | aiida_gromacs/calculations/editconf.py | .py | 6acf7a29070f9b86 | 7.48 | 8 |
"""
Generic calculation used to track input and output files of a
generic command.
"""
import os
from aiida.common import datastructures
from aiida.engine import CalcJob
from aiida.orm import List, SinglefileData, Str
class GenericCalculation(CalcJob):
"""
AiiDA calculation plugin wrapping an executable wi... | CCPBioSim/aiida-gromacs | aiida_gromacs/calculations/genericMD.py | .py | 7c9adff711e287a7 | 7.48 | 8 |
"""
Calculations provided by aiida_gromacs.
This calculation configures the ability to use the 'gmx genion' executable.
"""
import os
from aiida.common import CalcInfo, CodeInfo
from aiida.engine import CalcJob
from aiida.orm import SinglefileData, Str
from aiida.plugins import DataFactory
GenionParameters = DataFac... | CCPBioSim/aiida-gromacs | aiida_gromacs/calculations/genion.py | .py | 774132695a7a733f | 7.48 | 8 |
"""
Calculations provided by aiida_gromacs.
This calculation configures the ability to use the 'gmx grompp' executable.
"""
import os
from aiida.common import CalcInfo, CodeInfo
from aiida.engine import CalcJob
from aiida.orm import SinglefileData, FolderData, Str
from aiida.plugins import DataFactory
GromppParamete... | CCPBioSim/aiida-gromacs | aiida_gromacs/calculations/grompp.py | .py | ecb81163652589b4 | 7.48 | 8 |
"""
Calculations provided by aiida_gromacs.
This calculation configures the ability to use the 'gmx make_ndx' executable.
"""
import os
from aiida.common import CalcInfo, CodeInfo
from aiida.engine import CalcJob
from aiida.orm import SinglefileData, Str
from aiida.plugins import DataFactory
Make_ndxParameters = Dat... | CCPBioSim/aiida-gromacs | aiida_gromacs/calculations/make_ndx.py | .py | 3555f97ea1de935d | 7.48 | 8 |
"""
Calculations provided by aiida_gromacs.
This calculation configures the ability to use the 'gmx pdb2gmx' executable.
"""
import os
from aiida.common import CalcInfo, CodeInfo
from aiida.engine import CalcJob
from aiida.orm import SinglefileData, Str
from aiida.plugins import DataFactory
Pdb2gmxParameters = DataF... | CCPBioSim/aiida-gromacs | aiida_gromacs/calculations/pdb2gmx.py | .py | 31f483bbdd9456b4 | 7.48 | 8 |
"""
Calculations provided by aiida_gromacs.
This calculation configures the ability to use the 'gmx solvate' executable.
"""
import os
from aiida.common import CalcInfo, CodeInfo
from aiida.engine import CalcJob
from aiida.orm import SinglefileData, Str
from aiida.plugins import DataFactory
SolvateParameters = DataF... | CCPBioSim/aiida-gromacs | aiida_gromacs/calculations/solvate.py | .py | 5b4e35451089fd7b | 7.48 | 8 |
#!/usr/bin/env python
"""
Create AiiDA database archive from loaded profile.
"""
from aiida import load_profile
import subprocess
import click
import os
def create_archive(options):
"""
Create .aiida file of archived database.
https://aiida.readthedocs.io/projects/aiida-core/en/latest/howto/share_data.htm... | CCPBioSim/aiida-gromacs | aiida_gromacs/cli/createarchive.py | .py | 9087d0f940a66099 | 7.48 | 8 |
#!/usr/bin/env python
"""CLI utility to run gmx editconf with AiiDA.
Usage: gmx_editconf --help
"""
import os
import click
from aiida import cmdline, engine, orm
from aiida.plugins import CalculationFactory, DataFactory
from aiida_gromacs import helpers
from aiida_gromacs.utils import searchprevious
def launch(p... | CCPBioSim/aiida-gromacs | aiida_gromacs/cli/editconf.py | .py | af12cc153fa9db70 | 7.48 | 8 |
#!/usr/bin/env python
"""CLI utility to run gmx genion with AiiDA.
Usage: gmx_genion --help
"""
import os
import click
from aiida import cmdline, engine, orm
from aiida.plugins import CalculationFactory, DataFactory
from aiida_gromacs import helpers
from aiida_gromacs.utils import searchprevious
def launch(param... | CCPBioSim/aiida-gromacs | aiida_gromacs/cli/genion.py | .py | 8328346bbdf1b987 | 7.48 | 8 |
#!/usr/bin/env python
"""CLI utility to run gmx grompp with AiiDA.
Usage: gmx_grompp --help
"""
import click
import os
from aiida import cmdline, engine, orm
from aiida.plugins import CalculationFactory, DataFactory
from aiida_gromacs import helpers
from aiida_gromacs.utils import searchprevious, topfile_utils
de... | CCPBioSim/aiida-gromacs | aiida_gromacs/cli/grompp.py | .py | 62f898b8b5e2ca12 | 7.48 | 8 |
#!/usr/bin/env python
"""CLI utility to run gmx make_ndx with AiiDA.
Usage: gmx_make_ndx --help
"""
import os
import click
from aiida import cmdline, engine
from aiida.plugins import CalculationFactory, DataFactory
from aiida_gromacs import helpers
from aiida_gromacs.utils import searchprevious
def launch(params):
... | CCPBioSim/aiida-gromacs | aiida_gromacs/cli/make_ndx.py | .py | 26452efe8489772a | 7.48 | 8 |
#!/usr/bin/env python
"""CLI utility to run gmx mdrun with AiiDA.
Usage: gmx_mdrun --help
"""
import os
import click
from aiida import cmdline, engine, orm
from aiida.plugins import CalculationFactory, DataFactory
from aiida_gromacs import helpers
from aiida_gromacs.utils import searchprevious
from aiida_gromacs.da... | CCPBioSim/aiida-gromacs | aiida_gromacs/cli/mdrun.py | .py | 1267cb78d16c33e3 | 7.48 | 8 |
#!/usr/bin/env python
"""CLI utility to run gmx pdb2gmx with AiiDA.
Usage: gmx_pdb2gmx --help
"""
import os
import sys
import click
from aiida import cmdline, engine, orm
from aiida.plugins import CalculationFactory, DataFactory
from aiida_gromacs import helpers
from aiida_gromacs.utils import searchprevious
def ... | CCPBioSim/aiida-gromacs | aiida_gromacs/cli/pdb2gmx.py | .py | 4bd894f62639969e | 7.48 | 8 |
#!/usr/bin/env python
"""CLI utility to run gmx solvate with AiiDA.
Usage: gmx_solvate --help
"""
import os
import click
from aiida import cmdline, engine, orm
from aiida.plugins import CalculationFactory, DataFactory
from aiida_gromacs import helpers
from aiida_gromacs.utils import searchprevious
def launch(par... | CCPBioSim/aiida-gromacs | aiida_gromacs/cli/solvate.py | .py | ce93d3d3d6349c57 | 7.48 | 8 |
#!/usr/bin/env python
"""
Show text output of the provenance of commands performed in gmx
"""
import click
from aiida_gromacs.utils.displayprovenance import show_provenance_text
@click.group()
def provenance():
"""commandline help for provenance command
Help: $ verdi data provenance --help"""
@provenance.comman... | CCPBioSim/aiida-gromacs | aiida_gromacs/commands/provenance.py | .py | e2747b87cb04ae9c | 7.48 | 8 |
"""
Data types provided by plugin
Register data types via the "aiida.data" entry point in setup.json.
"""
# You can directly use or subclass aiida.orm.data.Data
# or any other data type listed under 'verdi data'
from voluptuous import Optional, Required, Schema
from aiida.orm import Dict
# A subset of editconf comm... | CCPBioSim/aiida-gromacs | aiida_gromacs/data/editconf.py | .py | ba74aa3d452a1e79 | 7.48 | 8 |
"""
Data types provided by plugin
Register data types via the "aiida.data" entry point in setup.json.
"""
# You can directly use or subclass aiida.orm.data.Data
# or any other data type listed under 'verdi data'
from voluptuous import Optional, Required, Schema
from aiida.orm import Dict
# A subset of genion comman... | CCPBioSim/aiida-gromacs | aiida_gromacs/data/genion.py | .py | 92d95977a8c2d4c0 | 7.48 | 8 |
"""
Data types provided by plugin
Register data types via the "aiida.data" entry point in setup.json.
"""
# You can directly use or subclass aiida.orm.data.Data
# or any other data type listed under 'verdi data'
from voluptuous import Optional, Required, Schema
from aiida.orm import Dict
# A subset of grompp comman... | CCPBioSim/aiida-gromacs | aiida_gromacs/data/grompp.py | .py | 32604285d7218263 | 7.48 | 8 |
"""
Data types provided by plugin
Register data types via the "aiida.data" entry point in setup.json.
"""
# You can directly use or subclass aiida.orm.data.Data
# or any other data type listed under 'verdi data'
from voluptuous import Optional, Required, Schema
from aiida.orm import Dict
# A subset of make_ndx comm... | CCPBioSim/aiida-gromacs | aiida_gromacs/data/make_ndx.py | .py | 40027271127372fa | 7.48 | 8 |
"""
Data types provided by plugin
Register data types via the "aiida.data" entry point in setup.json.
"""
# You can directly use or subclass aiida.orm.data.Data
# or any other data type listed under 'verdi data'
from voluptuous import Optional, Required, Schema
from aiida.orm import Dict
# A subset of mdrun command... | CCPBioSim/aiida-gromacs | aiida_gromacs/data/mdrun.py | .py | 6ec0862b2f68a1b3 | 7.48 | 8 |
"""
Data types provided by plugin
Register data types via the "aiida.data" entry point in setup.json.
"""
# You can directly use or subclass aiida.orm.data.Data
# or any other data type listed under 'verdi data'
from voluptuous import Optional, Required, Schema
from aiida.orm import Dict
# A subset of pdb2gmx comma... | CCPBioSim/aiida-gromacs | aiida_gromacs/data/pdb2gmx.py | .py | 26f1c9faabbb6f92 | 7.48 | 8 |
"""
Data types provided by plugin
Register data types via the "aiida.data" entry point in setup.json.
"""
# You can directly use or subclass aiida.orm.data.Data
# or any other data type listed under 'verdi data'
from voluptuous import Optional, Required, Schema
from aiida.orm import Dict
# A subset of solvate comma... | CCPBioSim/aiida-gromacs | aiida_gromacs/data/solvate.py | .py | 3ae714c2fd49e17d | 7.48 | 8 |
""" Helper functions for automatically setting up computer & code.
Helper functions for setting up
1. An AiiDA localhost computer
2. A "gmx" code on localhost
Note: Point 2 is made possible by the fact that the ``diff`` executable is
available in the PATH on almost any UNIX system.
"""
import shutil
import tempfile... | CCPBioSim/aiida-gromacs | aiida_gromacs/helpers.py | .py | df5de8328943d65d | 7.48 | 8 |
"""
Parsers provided by aiida_gromacs.
This parser adds the ability to parse the outputs of the 'gmx editconf' executable.
"""
import os
from pathlib import Path
from aiida.common import exceptions
from aiida.engine import ExitCode
from aiida.orm import SinglefileData
from aiida.parsers.parser import Parser
from aiida... | CCPBioSim/aiida-gromacs | aiida_gromacs/parsers/editconf.py | .py | 445b34aa67c08df0 | 7.48 | 8 |
"""
Parsers provided by aiida_gromacs.
This parser saves outputted files from a generic command.
"""
import os
import re
from aiida.common import exceptions
from aiida.engine import ExitCode
from aiida.orm import SinglefileData
from aiida.parsers.parser import Parser
from aiida.plugins import CalculationFactory
fro... | CCPBioSim/aiida-gromacs | aiida_gromacs/parsers/genericMD.py | .py | 45546a43267457c2 | 7.48 | 8 |
"""
Parsers provided by aiida_gromacs.
This parser adds the ability to parse the outputs of the 'gmx genion' executable.
"""
import os
from pathlib import Path
from aiida.common import exceptions
from aiida.engine import ExitCode
from aiida.orm import SinglefileData
from aiida.parsers.parser import Parser
from aiida.p... | CCPBioSim/aiida-gromacs | aiida_gromacs/parsers/genion.py | .py | 1cf9d75a540dfcd2 | 7.48 | 8 |
"""
Parsers provided by aiida_gromacs.
This parser adds the ability to parse the outputs of the 'gmx grompp' executable.
"""
import os
from pathlib import Path
from aiida.common import exceptions
from aiida.engine import ExitCode
from aiida.orm import SinglefileData
from aiida.parsers.parser import Parser
from aiida.p... | CCPBioSim/aiida-gromacs | aiida_gromacs/parsers/grompp.py | .py | 7bb2b6df94ba6bd5 | 7.48 | 8 |
"""
Parsers provided by aiida_gromacs.
This calculation configures the ability to use the 'gmx make_ndx' executable.
"""
import os
from pathlib import Path
from aiida.common import exceptions
from aiida.engine import ExitCode
from aiida.orm import SinglefileData
from aiida.parsers.parser import Parser
from aiida.plugi... | CCPBioSim/aiida-gromacs | aiida_gromacs/parsers/make_ndx.py | .py | 226d8079a381bfd8 | 7.48 | 8 |
"""
Parsers provided by aiida_gromacs.
This parser adds the ability to parse the outputs of the 'gmx pdb2gmx' executable.
"""
import os
from pathlib import Path
from aiida.common import exceptions
from aiida.engine import ExitCode
from aiida.orm import SinglefileData
from aiida.parsers.parser import Parser
from aiida.... | CCPBioSim/aiida-gromacs | aiida_gromacs/parsers/pdb2gmx.py | .py | fd84a25da60eefca | 7.48 | 8 |
"""
Parsers provided by aiida_gromacs.
This parser adds the ability to parse the outputs of the 'gmx solvate' executable.
"""
import os
from pathlib import Path
from aiida.common import exceptions
from aiida.engine import ExitCode
from aiida.orm import SinglefileData
from aiida.parsers.parser import Parser
from aiida.... | CCPBioSim/aiida-gromacs | aiida_gromacs/parsers/solvate.py | .py | e4aaa320650ca93f | 7.48 | 8 |
#!/usr/bin/env python
"""
Display provenance of processes run on current loaded profile
"""
from aiida import orm, load_profile
def show_provenance_text():
"""For a given loaded aiida profile, view the provenance graph on the
CLI as plain text
"""
load_profile()
qb = orm.QueryBuilder()
# get ... | CCPBioSim/aiida-gromacs | aiida_gromacs/utils/displayprovenance.py | .py | c6a8b04e32ce9454 | 7.48 | 8 |
"""Methods for dealing with various types of files and
directories that are used in processes and add them to aiida nodes"""
import os
import re
from aiida.orm import FolderData
def format_link_label(filename: str) -> str:
"""
Modified from: https://github.com/sphuber/aiida-shell/blob/main/src/aiida_shell/p... | CCPBioSim/aiida-gromacs | aiida_gromacs/utils/inputFile_utils.py | .py | 2f64b824b31f5241 | 7.48 | 8 |
"""Various functions for searching through previous AiiDA processes
and appending nodes from previous processes to current process nodes.
"""
import os
import re
import time
import sys
from aiida import orm
from aiida.orm.nodes.process.process import ProcessState
def format_link_label(filename: str) -> str:
""... | CCPBioSim/aiida-gromacs | aiida_gromacs/utils/searchprevious.py | .py | 7d02e0dca348e6e0 | 7.48 | 8 |
"""Methods for extracting and dealing with various types of files that can be
declared within a gromacs topology file."""
import re
def itp_finder(mdpfile, topfile):
""" Extract included files from the topology file.
This method will grab a list of all includes and then try to sort them
based on if ... | CCPBioSim/aiida-gromacs | aiida_gromacs/utils/topfile_utils.py | .py | 82fdcc0f4ffe5ec1 | 7.48 | 8 |
"""pytest fixtures for simplified testing."""
import pytest
pytest_plugins = ["aiida.manage.tests.pytest_fixtures"]
@pytest.fixture(scope="function", autouse=True)
def clear_database_auto(aiida_profile_clean): # pylint: disable=unused-argument
"""Automatically clear database in between tests."""
@pytest.fixtu... | CCPBioSim/aiida-gromacs | conftest.py | .py | 9f232f7112d7c21f | 7.98 | 8 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Extends... | Linuxfabrik/lib | args.py | .py | d35f1eac663731e4 | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Simple ... | Linuxfabrik/lib | cache.py | .py | 858a90c7b46830c4 | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Parse A... | Linuxfabrik/lib | feedparser.py | .py | c5b513a81c62608c | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Provide... | Linuxfabrik/lib | grassfish.py | .py | 9c343311fab33c4c | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""This li... | Linuxfabrik/lib | keycloak.py | .py | 6f12fd6797b44063 | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Provide... | Linuxfabrik/lib | lftest.py | .py | 378c222548e3c5a9 | 7.09 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""This li... | Linuxfabrik/lib | librenms.py | .py | 894102eb8aa0c49f | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""This li... | Linuxfabrik/lib | lvm.py | .py | 2191a7fe2f72817a | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""This li... | Linuxfabrik/lib | psi.py | .py | 8ac03167227c9703 | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Communi... | Linuxfabrik/lib | shell.py | .py | 4c8e414b4449a8d2 | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Provide... | Linuxfabrik/lib | smb.py | .py | f45f0ef076f79fd5 | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Run co... | Linuxfabrik/lib | ssh.py | .py | 7dc58ac3c099c6ec | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
"""Runs work under a deadline that holds even when the work cannot be inte... | Linuxfabrik/lib | task.py | .py | d0b885931961483c | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Provide... | Linuxfabrik/lib | time.py | .py | e8fd422b3e44bd70 | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Shared ... | Linuxfabrik/lib | tools/_common.py | .py | 9b16d55b94eb602e | 7.59 | 14 |
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""Provide... | Linuxfabrik/lib | version.py | .py | 3444dfbc2ae4aed1 | 7.59 | 14 |
#!/usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/lib/blob/main/CONTRIBUTING.md
"""This lib... | Linuxfabrik/lib | winrm.py | .py | ff123468e46d7a46 | 7.59 | 14 |
from sphinx import addnodes
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.domains.python import PyXRefRole, PyAttribute
def _parse_propertyobj_section(self, section):
"""Injected into :class:`sphinx.ext.napoleon.docstring.GoogleDocstring`
to transform a `Properties` section... | nocarryr/tslumd | doc/source/ext/propertyobj.py | .py | 6a1976fbdf895241 | 7.57 | 13 |
from __future__ import annotations
import enum
from typing import Tuple, Iterator, TypedDict
__all__ = (
'TallyColor', 'TallyType', 'TallyState', 'MessageType', 'TallyKey',
'DisplayTallyCommonDict',
)
class TallyColor(enum.IntFlag):
"""Color enum for tally indicators
Since this is an :class:`~enum.In... | nocarryr/tslumd | src/tslumd/common.py | .py | 5f5fdea98fac72f4 | 7.57 | 13 |
from __future__ import annotations
import asyncio
import dataclasses
from dataclasses import dataclass, field
import enum
import struct
import warnings
from typing import Tuple, Iterator, TypedDict, Any, cast
from . import MessageType, TallyColor, Tally, DisplayTallyCommonDict
__all__ = (
'Display', 'Message', 'P... | nocarryr/tslumd | src/tslumd/messages.py | .py | dcde60e0a1b63975 | 7.57 | 13 |
from __future__ import annotations
try:
from loguru import logger # type: ignore[missing-import]
except ImportError: # pragma: no cover
import logging
logger = logging.getLogger(__name__)
import asyncio
from typing import Tuple
from pydispatch import Dispatcher, Property, DictProperty, ListPr... | nocarryr/tslumd | src/tslumd/receiver.py | .py | 5e5dd476bab0e276 | 7.57 | 13 |
from __future__ import annotations
try:
from loguru import logger # type: ignore[missing-import]
except ImportError: # pragma: no cover
import logging
logger = logging.getLogger(__name__)
import asyncio
import socket
import argparse
from typing import Tuple, Iterable
from pydispatch import Di... | nocarryr/tslumd | src/tslumd/sender.py | .py | 8caab841654a6bd5 | 7.57 | 13 |
from pathlib import Path
import json
import socket
import pytest
from tslumd import TallyColor, Message, Display
HERE = Path(__file__).resolve().parent
DATA_DIR = HERE / 'data'
MESSAGE_FILE = DATA_DIR / 'uhs500-message.umd'
MESSAGE_JSON = DATA_DIR / 'uhs500-tally.json'
@pytest.fixture(scope='session')
def non_loopba... | nocarryr/tslumd | tests/conftest.py | .py | dd4086ba5619d85f | 7.07 | 13 |
import struct
import pytest
from tslumd import TallyColor, Message, Display, MessageType
from tslumd.tallyobj import Tally, Screen
from tslumd.messages import (
Flags, ParseError, DmsgParseError,
DmsgControlParseError, MessageParseError, MessageLengthError,
)
def build_multi_display_message(num_displays: int... | nocarryr/tslumd | tests/test_messages.py | .py | a67f7f388b97b2b3 | 8.07 | 13 |
#!/usr/bin/env python3
import json
import argparse
from typing import Dict, Any
from rich.table import Table
from rich.console import Console
def parse_vulnerabilities_json(data: Dict[str, Any]) -> bool:
"""
Parses pip-audit json output, extracts fixable vulnerabilities
and pretty prints them.
"""
... | redhat-openshift-ecosystem/operator-pipelines | local-dev/pip-audit-parse.py | .py | b9eb0c06a7bcccdf | 7.63 | 17 |
"""
Main module for the operator certification tool
"""
import json
import logging
import pathlib
import re
from datetime import datetime, timezone
from typing import Any, Dict, List, Tuple, Optional
from urllib.parse import urljoin
import yaml
from dateutil.parser import isoparse
from operatorcert import pyxis
from ... | redhat-openshift-ecosystem/operator-pipelines | operatorcert/__init__.py | .py | b04d7f15f14c6d59 | 7.63 | 17 |
"""Module for building and pushing images using buildah."""
import logging
import os
from typing import Any
from operatorcert.utils import run_command
LOGGER = logging.getLogger("operator-cert")
def build_image(dockerfile_path: str, context: str, output_image: str) -> Any:
"""
Build an image using buildah ... | redhat-openshift-ecosystem/operator-pipelines | operatorcert/buildah.py | .py | 51078d5ff990ee45 | 7.63 | 17 |
"""A module for working with bundle images."""
import json
import logging
import os
import shutil
import tempfile
from typing import Any, Optional
import yaml
from operatorcert import utils
LOGGER = logging.getLogger("operator-cert")
class BundleImage:
"""
A class representing a bundle image. The class pro... | redhat-openshift-ecosystem/operator-pipelines | operatorcert/bundle.py | .py | 07715495d778abce | 7.63 | 17 |
"""A module for working with catalog content."""
from typing import Any, Iterator, Optional
import yaml
from operatorcert.catalog.bundle import CatalogBundle
from operatorcert.catalog.channel import CatalogChannel
from operatorcert.catalog.package import CatalogPackage
from operatorcert.utils import run_command
cla... | redhat-openshift-ecosystem/operator-pipelines | operatorcert/catalog/catalog.py | .py | c10240342a1ed7e4 | 7.63 | 17 |
"""A cli tool for browsing and querying index image content."""
import argparse
from typing import Any
from operatorcert.catalog.catalog import Catalog, CatalogImage
def setup_argparser() -> argparse.ArgumentParser:
"""
Setup argument parser
Returns:
Any: Initialized argument parser
"""
... | redhat-openshift-ecosystem/operator-pipelines | operatorcert/catalog/catalog_cli.py | .py | 3546043d6c3e965a | 7.63 | 17 |
"""A module for working with catalog channel content."""
from typing import Any
class CatalogChannel:
"""
A class representing a channel in the catalog.
"""
def __init__(self, definition: dict[str, Any], catalog: Any):
self.definition = definition
self.catalog = catalog
@propert... | redhat-openshift-ecosystem/operator-pipelines | operatorcert/catalog/channel.py | .py | 4ddca7d82e98405b | 7.63 | 17 |
"""A module representing a package in the catalog."""
from typing import Any
class CatalogPackage:
"""
A class representing a package in the catalog.
"""
def __init__(self, definition: dict[str, Any], catalog: Any) -> None:
self.definition = definition
self.catalog = catalog
@pr... | redhat-openshift-ecosystem/operator-pipelines | operatorcert/catalog/package.py | .py | f4d1000d4e312d17 | 7.63 | 17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.