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 |
|---|---|---|---|---|---|---|
"""
File: figureS08.py
Purpose: Generates figure S08.
Figure S08 analyzes heterogeneous (2 state), uncensored,
single lineages (no more than one lineage per population).
"""
import numpy as np
from ..LineageTree import LineageTree
from .common import (
E2,
T,
commonAnalyze,
figureMaker,
getSetup,
... | meyer-lab/tHMM | lineage/figures/figureS08.py | .py | 77d9343688682a44 | 7.54 | 11 |
"""In this file we plot the abundance of states over time for experimental data."""
import math
import numpy as np
from ..Analyze import Analyze_list
from ..Lineage_collections import AllGemcitabine, AllLapatinib
from .common import getSetup, subplotLabel
lapt_tHMMobj_list = Analyze_list(AllLapatinib, 4)[0]
gemc_tH... | meyer-lab/tHMM | lineage/figures/figureS15.py | .py | 5d79718c1cf3746f | 7.54 | 11 |
"""Barcoding computational experinece."""
import numpy as np
from ..Analyze import Analyze_list
from ..Lineage_collections import AllGemcitabine, AllLapatinib
from .common import getSetup, subplotLabel
num_lineages = 10
def makeFigure():
"""
Makes fig barcode.
"""
# Get list of axis objects
ax... | meyer-lab/tHMM | lineage/figures/figureS16.py | .py | 21f72025fda1f240 | 7.54 | 11 |
""" Create a file with only the published subset curation-export.ttl
Usage:
pushd path/to/export/root; python -m sparcur.export.published; popd
"""
import rdflib
from sparcur.paths import Path
from pyontutils.core import OntResPath, OntGraph
from pyontutils.namespaces import rdf, sparc, TEMP
def curation_expor... | SciCrunch/sparc-curation | sparcur/export/published.py | .py | 09f09475a5d96ac7 | 7.64 | 18 |
from sparcur.config import auth
from sparcur.idmap import get_projects_datasets_from_project_ids
def events():
""" one shot process to retrieve all identifier mappings
use to sync with the remote, these mappings are immutable
and only the dataset uuid -> dois mapping can change if
new vers... | SciCrunch/sparc-curation | sparcur/extra/events.py | .py | 594867167f2009ab | 7.64 | 18 |
import idlib
from sparcur.utils import PennsieveId as RemoteId, log
from sparcur.config import auth
from sparcur.simple.utils import backend_pennsieve
def get_projects_datasets_from_project_ids(project_ids):
datasets = []
projects = []
for project_id in project_ids:
PennsieveRemote = backend_penns... | SciCrunch/sparc-curation | sparcur/idmap.py | .py | 6db8d2eebda90be7 | 7.64 | 18 |
import sqlite3
class MetaStore:
""" A local backup against accidental xattr removal """
_attrs = ('bf.id',
'bf.file_id',
'bf.size',
'bf.created_at',
'bf.updated_at',
'bf.checksum',
'bf.error')
attrs = 'xattrs',
# FIXME... | SciCrunch/sparc-curation | sparcur/metastore.py | .py | 87e4431a365b3223 | 7.64 | 18 |
""" rerun all datasets """
import sys
from augpathlib.meta import isoformat
from sparcur.sparcron import get_redis_conn, _none
from datetime import timedelta
from dateutil import parser as dateparser
from sparcur.utils import PennsieveId
from sparcur.sparcron.core import (
project_ids,
datasets_remote_from_pro... | SciCrunch/sparc-curation | sparcur/sparcron/rerun.py | .py | 9dec2010f7b1d5a5 | 7.64 | 18 |
from sparcur import sheets
from sparcur import datasources as ds
#from sparcur import protocols
# state downstream of static external sources
class State:
""" stateful values that many things need to access after startup
that are beyond just the command line interface and which we
don't want to c... | SciCrunch/sparc-curation | sparcur/state.py | .py | 7c54d3307dcba0e9 | 7.64 | 18 |
from typing import Any, Callable
import numpy as np
from numpy.typing import NDArray
from scipy.optimize import minimize_scalar
from vndecorrelate.decorrelation import Decorrelator, HaasEffect, VelvetNoise
from vndecorrelate.utils.dsp import EPSILON, polar_coordinates
def left_right_correlation(stereo_signal: NDArr... | ckonst/VNDecorrelate | src/vndecorrelate/optimization.py | .py | 48839a17e3fa50d2 | 7.48 | 8 |
import time
from functools import wraps
def timed(repititions: int = 5):
"""
A decorator to measure the execution time of a function.
"""
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
execution_time = 0
for _ in range(repititions):
... | ckonst/VNDecorrelate | src/vndecorrelate/utils/__init__.py | .py | 41a5c8f088d480c6 | 7.48 | 8 |
# Generate Specifications Bands Table
# This script can save you time by generating the 'Bands table' metadata that is displayed in the Specifications tab of product pages on the DEA Knowledge Hub. E.g. https://knowledge.dea.ga.gov.au/data/product/dea-intertidal/?tab=specifications
# How to use this script:
# 1. In ... | GeoscienceAustralia/dea-knowledge-hub | scripts/generate-specs-bands-table.py | .py | 3389b07ba8b4427f | 7.12 | 16 |
# pylint: disable=invalid-name,attribute-defined-outside-init,unused-argument,arguments-differ
"""Make your voice assistant laugh evilly. Beware... it might be haunted!"""
import random
from datetime import datetime, timedelta
from os import listdir
from os.path import dirname, isdir, join
from typing import Literal, O... | OpenVoiceOS/ovos-skill-laugh | ovos_skill_laugh/__init__.py | .py | 1625bd51ffa7f8c3 | 7.45 | 7 |
"""End-to-end intent routing tests for the en-US locale.
Each canonical utterance is fired through a real MiniCroft and asserted to
route to the expected intent handler. Assertions cover the intent binding
(drift-proof subset match, not a full expected-message sequence) and, where
the handler speaks, the presence of a... | OpenVoiceOS/ovos-skill-laugh | test/end2end/test_intents_en_us.py | .py | de69b685f0dbb986 | 7.95 | 7 |
"""Test cases for the serialization helper function."""
from enum import Enum, auto
from unittest.mock import MagicMock
from assertpy import assert_that
from pytest import mark
from ..webapp import _serialize_object
class JustAnEnum(Enum):
"""Simple enum for testing serialization."""
MEMBER_ONE = auto()
... | TomerFi/switcher_webapi | app/tests/test_serialization_helper.py | .py | 9db77a91a8d03982 | 7.07 | 13 |
class OpenSprinklerAuthError(Exception):
"""Exception for authentication error."""
class OpenSprinklerConnectionError(Exception):
"""Exception for connection error."""
class OpenSprinklerNoStateError(Exception):
"""Exception for no state."""
class OpenSprinklerApiError(Exception):
"""Exception for... | vinteo/py-opensprinkler | pyopensprinkler/exceptions.py | .py | 625655bff7301fcb | 7.12 | 16 |
"""Commonly used functions."""
def _is_new_feature_supported(controller, required_version, required_minor_version):
"""Compare current firmware version with the first supported version of a feature"""
firmware_version = controller.firmware_version
firmware_minor_version = controller.firmware_minor_version... | vinteo/py-opensprinkler | pyopensprinkler/utils.py | .py | 3a97f992bc29ff94 | 7.62 | 16 |
"""In-memory file inventory for one getfastq run directory."""
from __future__ import annotations
import os
from collections.abc import Callable, Iterable
def list_run_dir_files(work_dir: str) -> set[str]:
"""List regular files in a run directory without failing if it vanished."""
try:
with os.scand... | kfuku52/amalgkit | amalgkit/getfastq_file_state.py | .py | 1f24ca200958a5e5 | 7.56 | 12 |
#!/usr/bin/env python3
"""archive-fact — safely MOVE a decayed fact from continuity.md to the archive.
This executes the mechanical half of REVIEW.md step 4 deterministically, so the
move can't be botched. The agent still decides *what* to archive (meaning); this
script performs the *move* safely (mechanics) — the sam... | Accenture/mercury-python | agent-skills/archive-fact/scripts/archive-fact.py | .py | b8e756094d293bb8 | 7.54 | 11 |
"""
Demo polyglot functions.
Run: mercury-serve examples/demo_app.py
Configuration comes from examples/resources/application.yml (the engines'
"resources" convention - port 8086, the demo.health dependency, log format);
override any key with -Dkey=value, e.g. -Drest.server.port=8090.
Then map a route from a Mercury... | Accenture/mercury-python | examples/demo_app.py | .py | 9bfda8c342309f2f | 7.54 | 11 |
"""
Exceptions for Mercury Composable polyglot functions.
AppException mirrors the Java/Rust engines' AppException: an intentional
application error carrying an HTTP-style status code and a message. Raised
from a function handler, it becomes the portable error contract on the wire:
envelope status (>= 400) + body (the... | Accenture/mercury-python | src/mercury_composable/exceptions.py | .py | ecbc579ab5608072 | 7.54 | 11 |
"""
Function registry and the @preload decorator.
Mirrors the engines' PreLoad vocabulary: a function is registered under a
route name with an instance count (its concurrency limit) and a private flag.
Handlers take ``(headers: dict[str, str], body)`` — the same two-part input as a
TypedLambdaFunction — and return the... | Accenture/mercury-python | src/mercury_composable/registry.py | .py | b1837b5e44418aab | 7.54 | 11 |
"""
Minimalist telemetry: distributed trace context for polyglot functions.
The engines carry trace_id / trace_path / cid inside the event envelope. The
server installs them into a context variable around each handler call, so a
handler (and anything it awaits) can read its trace and annotate it without
plumbing argum... | Accenture/mercury-python | src/mercury_composable/trace.py | .py | dc52a7ec253c2f54 | 7.54 | 11 |
"""Formatter tests: engine pattern and exception rendering."""
import logging
import sys
from mercury_composable.log import EngineJsonFormatter, EngineTextFormatter
def _record_with_exception() -> logging.LogRecord:
try:
raise RuntimeError("boom-x")
except RuntimeError:
return logging.LogRec... | Accenture/mercury-python | tests/test_log.py | .py | ea4b089a17ec4237 | 8.04 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/log.py | .py | d46e9d853a61051f | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/base.py | .py | 7b06f40326ed8a88 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/batch_issue_redeem.py | .py | cfbf2d1ad95760d4 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/batch_register_personal_info.py | .py | b634dd9761526ae2 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/bulk_transfer.py | .py | e4ad91bfc44593ab | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/e2e_messaging_account.py | .py | a2e4fb2233d11480 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/idx_block_data.py | .py | 3085b9c1d0020bb1 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/idx_dvp_delivery.py | .py | c7e0fa393abab790 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/idx_e2e_messaging.py | .py | f636f272ce1a6a84 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/idx_issue_redeem.py | .py | ab9e4f6de308d8b9 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/idx_personal_info.py | .py | 72c7ae52c405a0a0 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/idx_position.py | .py | 4b62d9130b269cc8 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/idx_transfer.py | .py | 2fdff0518efbd3a2 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/idx_transfer_approval.py | .py | c2278ec17cc73200 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/ledger.py | .py | 3ab148cf08ffc21f | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/notification.py | .py | 862724b53b6ecf70 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/token.py | .py | 0eb9fb014b52c936 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/token_holder_extra_info.py | .py | a99418762a6eceeb | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/token_holders_collection.py | .py | b019c02fea50b358 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/token_update_operation_log.py | .py | 8a12cc7338a4035b | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/transfer_appoval_history.py | .py | 4f732fcc0684ee76 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/update_token.py | .py | a81b9e7c211d07b8 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/db/utxo.py | .py | 41f4e009898f5149 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/ibet/e2e_messaging.py | .py | 85edb50575ac175b | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/ibet/freeze_log.py | .py | f1e411a4e0555259 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/ibet/personal_info.py | .py | 8586f08e748b7154 | 7.54 | 11 |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | BoostryJP/ibet-Prime | app/model/ibet/token_list.py | .py | ccb1bea4de485fdc | 7.54 | 11 |
#!/usr/bin/env python3
"""Helpers for reading Linux operational state from /proc."""
def _read_text(path, reader=None):
if reader is not None:
return reader(path)
with open(path, "r") as f:
return f.read()
def parse_uptime_minutes(text):
fields = text.split()
if not fields:
r... | flavio-fernandes/bedclock | bedclock/systemstats.py | .py | 55a630223f2bd0e5 | 7.54 | 11 |
"""Typing helpers."""
from __future__ import annotations
__all__ = ('OnMessageCallback', 'ProbeDict', 'ProbeFormatDict', 'ProbeStreamDict')
from collections.abc import Callable, Sequence
from typing import TypedDict
OnMessageCallback = Callable[[float, int, int, float], None]
class ProbeStreamDict(TypedDict):
... | Tatsh/ffmpeg-progress | ffmpeg_progress/typing.py | .py | c3fcca11a8140df5 | 7.63 | 17 |
# -*- coding: utf-8 -*-
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2018 Datadog, Inc.
"""
Performance tests for the agent/dogstatsd metrics aggrega... | DataDog/datadog-unix-agent | aggregator/tests/benchmark_aggregator.py | .py | 42abb3b21b8493a0 | 8.12 | 16 |
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2025 Datadog, Inc.
from datetime import datetime
import pytest
from api.handlers import AgentStatusHandl... | DataDog/datadog-unix-agent | api/tests/test_handlers.py | .py | 124a7bdf92dc8e8e | 7.12 | 16 |
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from xml.etree.ElementTree import ParseError
import requests
from lxml import etree
from six import ensure_text
from checks import AgentCheck
from utils.util import _is_affirmative
from . import metrics... | DataDog/datadog-unix-agent | checks/bundled/ibm_was/datadog_checks/ibm_was/ibm_was.py | .py | c4df5ed96c4cb8b1 | 7.62 | 16 |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license tagsrmation.
import os
import docker
from . import github
from .image_variants import get_default_variant
class DockerTags:
def __init__(self):
self.repo = None
s... | Azure/iot-sdks-e2e-fx | bin/build/docker_tags.py | .py | c4230ff5c6a5aea1 | 7.42 | 6 |
import json
import logging
from typing import Any, Tuple, Union
import zmq
from .blueprints import deserialize_obj, to_dict
logger = logging.getLogger(__name__)
def encode(data: Any) -> str:
return json.dumps(to_dict(data))
def decode(data: Union[str, bytes]) -> Any:
return deserialize_obj(json.loads(dat... | toolsforexperiments/instrumentserver | src/instrumentserver/base.py | .py | 32ba0d789a634f46 | 7.57 | 13 |
import importlib
import logging
import sys
from pathlib import Path
from typing import Dict, Optional, Union, cast
from qtpy.QtGui import QGuiApplication
from qtpy.QtWidgets import QFileDialog, QWidget
from instrumentserver import QtCore, QtGui, QtWidgets, getInstrumentserverPath
from instrumentserver.blueprints impo... | toolsforexperiments/instrumentserver | src/instrumentserver/client/application.py | .py | 209a139ef0916d92 | 7.57 | 13 |
from typing import Any, Optional, Tuple, cast
from .. import QtCore, QtGui, QtWidgets
class AlertLabel(QtWidgets.QLabel):
def __init__(
self,
parent: Optional[QtWidgets.QWidget] = None,
pixmapSize: Tuple[int, int] = (20, 20),
):
super().__init__(parent)
self.setAlignm... | toolsforexperiments/instrumentserver | src/instrumentserver/gui/misc.py | .py | e694ba5336e39717 | 7.57 | 13 |
import logging
import numbers
import re
from typing import Any, Callable, List, Optional, Tuple
from qcodes import Parameter
from .. import QtCore, QtGui, QtWidgets
from ..params import ParameterTypes, paramTypeFromVals
from . import keepSmallHorizontally
from .misc import AlertLabel
logger = logging.getLogger(__nam... | toolsforexperiments/instrumentserver | src/instrumentserver/gui/parameters.py | .py | 85fe584b3a6e8b8f | 7.57 | 13 |
import inspect
from typing import Any, Dict, List, Tuple, Union
from qcodes import Instrument, Parameter
from .serialize import toParamDict
# TODO: check for usage of get params / methods functions -- might not be needed
def stringToArgsAndKwargs(value: str) -> Tuple[List[Any], Dict[str, Any]]:
"""Create argum... | toolsforexperiments/instrumentserver | src/instrumentserver/helpers.py | .py | 1dcb0592990a31ce | 7.57 | 13 |
"""
instrumentserver.log : Logging tools and defaults for instrumentserver.
"""
import logging
import re
import sys
from enum import Enum, auto, unique
from html import escape
from typing import Callable, Optional
from . import QtCore, QtGui, QtWidgets
@unique
class LogLevels(Enum):
error = auto()
warn = au... | toolsforexperiments/instrumentserver | src/instrumentserver/log.py | .py | 3af2900ad31b5c84 | 7.57 | 13 |
import json
import logging
import os
from enum import Enum, auto, unique
from pathlib import Path
from typing import Any, Dict, List, Union
from qcodes import Parameter, validators
from qcodes.instrument import InstrumentBase
from qcodes.parameters import ParameterBase
from . import serialize
logger = logging.getLog... | toolsforexperiments/instrumentserver | src/instrumentserver/params.py | .py | 11d25ef73df4b2be | 7.57 | 13 |
"""
instrumentserver.serialize
^^^^^^^^^^^^^^^^^^^^^^^^^^
Serializing and de-serializing instruments and parameters.
The tools in here can be used to perform the following tasks:
* Store instrument and parameter information to json.
* Load instrument and parameter information from json.
The main utility of ... | toolsforexperiments/instrumentserver | src/instrumentserver/serialize.py | .py | d6c6630abff9e92c | 7.57 | 13 |
# mypy: ignore-errors
# No need to mypy check dummy testing instruments.
import time
from dataclasses import dataclass, field
from enum import IntFlag
from types import MethodType
from typing import ClassVar, List
import numpy as np
from qcodes import Instrument, validators
from qcodes.math_utils.field_vector import ... | toolsforexperiments/instrumentserver | src/instrumentserver/testing/dummy_instruments/generic.py | .py | aea5eb79854e2dd6 | 7.07 | 13 |
from typing import Any
import numpy as np
from numpy.typing import NDArray
from qcodes import (
Instrument,
ParameterWithSetpoints,
find_or_create_instrument,
validators,
)
from scipy import constants
class ResonatorResponse(Instrument):
"""A dummy instrument that generates the response of a reso... | toolsforexperiments/instrumentserver | src/instrumentserver/testing/dummy_instruments/rf.py | .py | 37c8446bbf3c1475 | 8.07 | 13 |
"""Shared helpers for docs verification scripts.
The single canonical way verification scripts start servers, get clients, and
capture Broadcasts (see README.md in this directory). Mirrors the pytest
fixtures in test/pytest/conftest.py wherever one exists; helpers that prove
broadly useful are candidates to graduate i... | toolsforexperiments/instrumentserver | test/docs_verification/helpers.py | .py | 00de5e8d68acf57d | 8.07 | 13 |
import pytest # type: ignore[import-not-found]
import qcodes as qc
from instrumentserver.client.core import BaseClient
from instrumentserver.client.proxy import Client
from instrumentserver.server.core import startServer
@pytest.fixture(autouse=True, scope="module")
def _close_instruments_between_modules():
"""... | toolsforexperiments/instrumentserver | test/pytest/conftest.py | .py | 9a0f8e922828f939 | 8.07 | 13 |
"""Tests for serializing ``Enum``/``IntFlag`` valued parameters.
Regression coverage for the infinite-recursion bug triggered when a station
snapshot contains an ``IntFlag`` value (e.g. the Yokogawa GS200 status/event
registers, whose ``get_parser`` returns ``IntFlag`` instances).
Starting with Python 3.11, ``Flag``/... | toolsforexperiments/instrumentserver | test/pytest/test_enum_serialization.py | .py | 7cc41f8a12cefa95 | 8.07 | 13 |
from qcodes import Parameter, Station
from instrumentserver.serialize import toParamDict
def test_toParamDict_paramsBasic():
"""Test serializing a few parameters added to a station"""
paramNames = [f"parameter_{i}" for i in range(4)]
paramValues = [123, None, True, "abcdef"]
params = []
for n, ... | toolsforexperiments/instrumentserver | test/pytest/test_serialize.py | .py | 8424b3badccaffed | 7.07 | 13 |
#!/usr/bin/env python3
#
# Copyright (c) 2019 Ableton AG, Berlin. All rights reserved.
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
"""A small wrapper script to call CodeNarc and interpret its output."""
import argparse
import logging
import os
import platfor... | Ableton/groovylint | run_codenarc.py | .py | d6231559fe17af76 | 7.66 | 20 |
# Copyright (c) 2019 Ableton AG, Berlin. All rights reserved.
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
"""Tests for run_codenarc script."""
import os
import subprocess
from unittest.mock import patch
from urllib.error import HTTPError
import pytest
fro... | Ableton/groovylint | tests/test_run_codenarc.py | .py | 4d17ffbb156a31b6 | 8.16 | 20 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Sergio Correia <scorreia@redhat.com>
# SPDX-License-Identifier: MIT
#
"""This is an small ansible module for handling some operations related to a
tang server."""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
AN... | linux-system-roles/nbde_server | library/nbde_server_tang.py | .py | c5d384310d00e8b3 | 7.56 | 12 |
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# Th... | LPD-VRChat/LPD-Officer-Monitor | alembic/env.py | .py | e7be8d96daa94c73 | 7.45 | 7 |
"""Added Payment Models
Revision ID: 5c6f2d8fc962
Revises: 86b4e89d95ec
Create Date: 2024-04-28 14:10:07.625228
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "5c6f2d8fc962"
down_revision = "86b4e89d95ec"
branch_labels = None
depends_on = None
def upgrade()... | LPD-VRChat/LPD-Officer-Monitor | alembic/versions/5c6f2d8fc962_added_payment_models.py | .py | a8968f37d5e6797c | 7.45 | 7 |
"""officer add extra column
Revision ID: dccc7b577d9a
Revises: 5c6f2d8fc962
Create Date: 2025-07-14 15:53:40.195388
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "dccc7b577d9a"
down_revision = "5c6f2d8fc962"
branch_labels = None
depends_on = None
def upgra... | LPD-VRChat/LPD-Officer-Monitor | alembic/versions/dccc7b577d9a_officer_add_extra_column.py | .py | 5b3de1ea8337f725 | 7.45 | 7 |
from re import A
import pytest
import discord.ext.test as dpytest
import pytest_asyncio
import asyncio
import os
import logging
from discord import Intents
from discord.ext.commands import Bot
import settings
from src.layers.ui.discord_commands import setup as setup_discord_commands
from testing.fixtures.dpytest_fixt... | LPD-VRChat/LPD-Officer-Monitor | conftest.py | .py | db24489fb0c3bb94 | 7.95 | 7 |
from dataclasses import dataclass
from logging import Logger
from types import coroutine
from typing import Any, Callable, Coroutine, List
from discord.ext import commands
from src.layers.business.moderation_bl import ModerationBL
from .modules.vrc_member_list_bl import VRCMemberListBL
from .modules.mm_bl import Mem... | LPD-VRChat/LPD-Officer-Monitor | src/layers/business/bl_wrapper.py | .py | cb37f85f8fb616ce | 7.45 | 7 |
# Standard
import asyncio
from collections.abc import Callable, Coroutine
import functools
from typing import List, Optional, TypeVar, Union
import discord
from nest_asyncio import apply
from io import StringIO, BytesIO
from datetime import datetime
from sys import stdout
import settings
import datetime as dt
from typi... | LPD-VRChat/LPD-Officer-Monitor | src/layers/business/extra_functions.py | .py | 0368bd27dd1a0360 | 7.45 | 7 |
"""
Activity Logging Business Layer
Record when officer where last active in the comunity
"""
# Standard
import asyncio
import logging
from datetime import datetime, timedelta, date
from typing import Dict, Iterable
from enum import Enum
# Community
import discord
from discord.ext import commands
import ormar
# Cus... | LPD-VRChat/LPD-Officer-Monitor | src/layers/business/modules/loa_bl.py | .py | 631dd568d20fdbbe | 7.45 | 7 |
"""
Member Management Business Layer
Adds/Removes members from the database as they join/leave the LPD.
"""
# Standard
import asyncio
from dataclasses import dataclass
import datetime as dt
import logging
from typing import Dict, Optional
# Community
import discord
from discord.ext import commands, tasks
from thefuz... | LPD-VRChat/LPD-Officer-Monitor | src/layers/business/modules/mm_bl.py | .py | 49a5eaa2f958114b | 7.45 | 7 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Create BerkeleyDB minter instances for any shoulders in the database that
are referencing non-existing minters.
"""
import argparse
import logging
import django.conf
import django.contrib.auth.models
import djang... | CDLUC3/ezid | ezidapp/management/commands/diag-create-missing-minters.py | .py | 207c5fbf64a7c272 | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Display basic statistics for all registered models
This command does not alter any information in the database, and should be safe to run
at any time, including a running production instance.
This command works t... | CDLUC3/ezid | ezidapp/management/commands/diag-db-stats.py | .py | f4e75671e1f3c949 | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Print a random string that can be used in the settings.SECRET_KEY setting.
"""
import logging
import django.core.management.utils
log = logging.getLogger(__name__)
class Command(django.core.management.BaseComma... | CDLUC3/ezid | ezidapp/management/commands/diag-gen-secret-key.py | .py | 2ab6f3ab5aa81513 | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Report queue statuses
For each queue, report the number of entries at each status level.
For queues other than download:
U = Unsubmitted
C = Unchecked
S = Submitted
W = Warning
F = Failure
I = Ignored... | CDLUC3/ezid | ezidapp/management/commands/diag-queue-stats.py | .py | 7dd6b706bef84e96 | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Create or update the EZID admin account, password and related details
This command must be run in order to apply any changes made to the `ADMIN_` settings
in settings.py.
Notes:
If the EZID admin account does no... | CDLUC3/ezid | ezidapp/management/commands/diag-update-admin.py | .py | 17a47be94461db2e | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Get identifier count from RDS and OpenSearch index
"""
import time
from django.conf import settings
import django.core.management
import ezidapp.models.identifier
from impl.open_search_doc import OpenSearchDoc
c... | CDLUC3/ezid | ezidapp/management/commands/get-rds-opensearch-counts.py | .py | aa7e26215f67dbbc | 7.56 | 12 |
#! /usr/bin/env python
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Delete a group
Before running this command, remove the group's users and shoulders.
"""
import argparse
import logging
import django.contrib.auth.models
import django.core.management
impo... | CDLUC3/ezid | ezidapp/management/commands/group-delete.py | .py | 8d11aecdf19aa0c9 | 7.56 | 12 |
#! /usr/bin/env python
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Move a group to a different realm
For a group to be moved, the group must:
- Have no users that are realm administrators.
After running this command:
- Save the group's record in... | CDLUC3/ezid | ezidapp/management/commands/group-move.py | .py | 57ab8e22b7bfdf7c | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Check target links
Link checker that tests EZID target URLs provided by an input file with EZID identifiers and/or URLs.
The link checker tests a target URL by performing a GET request on the URL. A timely
200 re... | CDLUC3/ezid | ezidapp/management/commands/link-checker-by-ids.py | .py | c8a5b0f5cd57bced | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Asynchronous DataCite processing
This background process takes tasks from the DataciteQueue
and performs the specified actions to set infomration in
Datacite to correspond with the identifier and its
metadata in E... | CDLUC3/ezid | ezidapp/management/commands/proc-datacite.py | .py | 18e8738e884422a3 | 7.56 | 12 |
#! /usr/bin/env python
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Expunge expired test identifiers
Test identifiers older than Identifiers are discovered by querying the database directly, but expunged by
requesting that the (live) EZID server delete them... | CDLUC3/ezid | ezidapp/management/commands/proc-expunge.py | .py | 5214d092fd3b0320 | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Index identifiers for search
This async process keeps the SearchIdentifier model in sync with the StoreIdentifier
model.
The StoreIdentifier and SearchIdentifier models hold the same information, but the
SearchId... | CDLUC3/ezid | ezidapp/management/commands/proc-search-indexer.py | .py | 14447e8542e1be1d | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Identifier statistics
To avoid burdening online identifier processing, statistics are computed periodically by
a daemon thread. We eschew a synchronous, inline approach to maintaining statistics
because identifier... | CDLUC3/ezid | ezidapp/management/commands/proc-stats.py | .py | 24bde123acc86477 | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
import argparse
import http.client
import logging
import multiprocessing
import os
import signal
import sys
import time
import types
import typing
import urllib.error
import urllib.parse
import urllib.request
import ur... | CDLUC3/ezid | ezidapp/management/commands/proc_base.py | .py | 09f48219f5bc89df | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Activate an existing shoulder
"""
import argparse
import logging
import django.contrib.auth.models
import django.core.management
import django.db.transaction
import ezidapp.models.shoulder
import impl.nog_sql.ut... | CDLUC3/ezid | ezidapp/management/commands/shoulder-activate.py | .py | d2219f6da6738cd6 | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Create a new ARK shoulder
"""
import argparse
import logging
import django.core.management
import impl.nog_sql.exc
import impl.nog_sql.id_ns
import impl.nog_sql.shoulder
import impl.nog_sql.util
log = logging.g... | CDLUC3/ezid | ezidapp/management/commands/shoulder-create-ark.py | .py | b31094152edcb79d | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Create a new DOI shoulder
"""
import argparse
import logging
import django.core.management
import ezidapp.models.datacenter
import impl.nog_sql.exc
import impl.nog_sql.id_ns
import impl.nog_sql.shoulder
import i... | CDLUC3/ezid | ezidapp/management/commands/shoulder-create-doi.py | .py | 8cab8c04e20ab885 | 7.56 | 12 |
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Deactivate an existing shoulder
"""
import argparse
import logging
import django.contrib.auth.models
import django.core.management
import django.db.transaction
import ezidapp.models.shoulder
import impl.nog_sql.... | CDLUC3/ezid | ezidapp/management/commands/shoulder-deactivate.py | .py | b8fb6a6ad36cf07c | 7.56 | 12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.