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 2018 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | src/vinyldns/serdes.py | .py | a844e0b7c8a45392 | 7.56 | 12 |
# Copyright 2018 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | tests/conftest.py | .py | c61b95127831a5f4 | 8.06 | 12 |
# Copyright 2026 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | tests/test_health_status.py | .py | adf642653449160f | 7.06 | 12 |
# Copyright 2018 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | tests/test_membership.py | .py | 4fd4936ffb770dca | 7.06 | 12 |
# Copyright 2026 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | tests/test_membership_extras.py | .py | 9889c57ffc0c4d4e | 7.06 | 12 |
# Copyright 2018 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | tests/test_records.py | .py | a4a4c90f400da45f | 7.06 | 12 |
# Copyright 2026 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | tests/test_users.py | .py | 69c9dfbbe43a9f29 | 7.06 | 12 |
# Copyright 2026 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | tests/test_zone_extras.py | .py | 343831f79b78fbd3 | 7.06 | 12 |
# Copyright 2018 Comcast Cable Communications Management, LLC
#
# 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 applica... | vinyldns/vinyldns-python | tests/test_zones.py | .py | 01a962e2eebf6628 | 7.06 | 12 |
from __future__ import annotations
import json
import logging
import os
from typing import cast, overload
# workaround for https://github.com/snakemake/snakemake/issues/2786
import snakemake.cli
from snakemake import script
from snakemake.logging import LoggerManager
from snakemake.rules import (
InputFiles,
... | Hoeze/snakemk_util | snakemk_util/rule_args.py | .py | a1afc0a04f031854 | 7.45 | 7 |
import click
import os.path
import json
import requests
import sys
import gen3.auth as auth_tool
from cdislogging import get_logger
logging = get_logger(__name__)
def stderr(*str):
logging.error(*str, sys.stderr)
@click.command()
@click.option("--request", "request", help="HTTP Method - GET, PUT, POST, DELETE... | uc-cdis/gen3sdk-python | gen3/cli/auth.py | .py | 9668fb78c25056cb | 7.63 | 17 |
import click
import sys
from pfb import cli as pfb_cli
from gen3.utils import load_entry_points
try:
from importlib.metadata import entry_points
except ImportError:
from importlib_metadata import entry_points
@click.group()
def main():
"""Gen3 Command Line Interface"""
pass
@click.group()
def pfb(... | uc-cdis/gen3sdk-python | gen3/cli/pfb.py | .py | 1d78baa10ee0eaeb | 7.63 | 17 |
import click
from gen3users import main as users_cli
import sys
from gen3.utils import load_entry_points
try:
from importlib.metadata import entry_points
except ImportError:
from importlib_metadata import entry_points
@click.group()
def main():
"""Gen3 Command Line Interface"""
pass
@click.group(... | uc-cdis/gen3sdk-python | gen3/cli/users.py | .py | fb9193d54c5060aa | 7.63 | 17 |
"""
The format of config file is described as following
[profile1]
key_id=key_id_example_1
api_key=api_key_example_1
access_key=access_key_example_1
api_endpoint=http://localhost:8000
use_shepherd=true
min_shepherd_version=2.0.0
[profile2]
key_id=key_id_example_2
api_key=api_key_example_2
access_key=access_key_exampl... | uc-cdis/gen3sdk-python | gen3/configure.py | .py | af5d58379d1e20dc | 7.63 | 17 |
"""
Classes and functions for interacting with Gen3's Discovery Metadata and configured
external sources to obtain DOI metadata and mint real DOIs using Datacite's API.
"""
import csv
from cdislogging import get_logger
from gen3.doi import DataCite, DigitalObjectIdentifier
from gen3.external.nih.dbgap_doi import dbg... | uc-cdis/gen3sdk-python | gen3/discovery_dois.py | .py | 3f60d9c38d14f844 | 7.63 | 17 |
class ExternalMetadataSourceInterface(object):
"""
A simple interface for external metadata sources. The idea is to have
consistency that allows combining the outputs and making similar function
calls with similar input.
test0 = dbgapFHIR()
metadata_0 = test0.get_metadata_for_ids(["foo", "bar"]... | uc-cdis/gen3sdk-python | gen3/external/external.py | .py | a7ae1954f5eca6ba | 7.63 | 17 |
from cdislogging import get_logger
from gen3.doi import (
DigitalObjectIdentifierCreator,
DigitalObjectIdentifierFundingReference,
DigitalObjectIdentifierDescription,
DigitalObjectIdentifierTitle,
DigitalObjectIdenfitierAlternateID,
)
from gen3.external import ExternalMetadataSourceInterface
from g... | uc-cdis/gen3sdk-python | gen3/external/nih/dbgap_doi.py | .py | 3669b71616f38e01 | 7.63 | 17 |
import requests
from cdislogging import get_logger
import xmltodict
from gen3.external import ExternalMetadataSourceInterface
from gen3.external.nih.utils import get_dbgap_accession_as_parts
from gen3.utils import append_query_params
logging = get_logger(__name__)
class dbgapStudyRegistration(ExternalMetadataSourc... | uc-cdis/gen3sdk-python | gen3/external/nih/dbgap_study_registration.py | .py | 777876b7e4f3a108 | 7.63 | 17 |
import json
import requests
import json
import asyncio
import aiohttp
import aiofiles
import time
from tqdm import tqdm
from types import SimpleNamespace as Namespace
import os
import requests
from pathlib import Path
from cdislogging import get_logger
from gen3.index import Gen3Index
from gen3.utils import DEFAULT_B... | uc-cdis/gen3sdk-python | gen3/file.py | .py | a605925020fce286 | 7.63 | 17 |
import requests
from gen3.utils import raise_for_status_and_print_error
class Gen3ObjectError(Exception):
pass
class Gen3Object:
"""For interacting with Gen3 object level features.
A class for interacting with the Gen3 object services.
Currently allows creating and deleting of an object from the Ge... | uc-cdis/gen3sdk-python | gen3/object.py | .py | f4a1fcc31c52cd1e | 7.63 | 17 |
"""
Takes the differential between the matching columns of two manifests
TODO: Able to handle situations where only specific columns should be compared
"""
import os
import csv
import sys
import traceback
from cdislogging import get_logger
logging = get_logger(__name__)
def manifest_diff(
directory=".",
f... | uc-cdis/gen3sdk-python | gen3/tools/diff.py | .py | f8cfbb3c5331a8de | 7.63 | 17 |
from typing import List, Optional
import requests
import json
from cdislogging import get_logger
import os
import inspect
from datetime import datetime, timezone, timedelta
from pathlib import Path
# DRS Compact identifiers are resolved to hostnames using a set of resolvers
# NOTE: that the policy is to minimize the r... | uc-cdis/gen3sdk-python | gen3/tools/download/drs_resolvers.py | .py | 398ce28900e3656d | 7.63 | 17 |
"""
Module for downloading and listing data from external repositories.
Examples:
See docs/howto/externalFileDownloading.md for more details
"""
import json
from pathlib import Path
from typing import Any, Dict, List
from cdislogging import get_logger
from gen3.auth import Gen3Auth
REQUIRED_EXTERNAL_F... | uc-cdis/gen3sdk-python | gen3/tools/download/external_file_download.py | .py | f9d0d277acf670c9 | 7.63 | 17 |
__copyright__ = "Copyright (c) 2020-2025 Alex Laird"
__license__ = "MIT"
import os
import threading
import click
import confuse
from hookee.exception import HookeeConfigError
template = {
"default_route": confuse.String(default="/webhook$"),
"default_route_methods": confuse.String(default="^(GET|HEAD|POST|P... | alexdlaird/hookee | hookee/conf.py | .py | 2dce78d6b451f5cd | 7.52 | 10 |
__copyright__ = "Copyright (c) 2020-2024 Alex Laird"
__license__ = "MIT"
import logging
import threading
import time
from http import HTTPStatus
from urllib.error import URLError
from urllib.request import Request, urlopen
from flask import Flask
from hookee import pluginmanager
werkzeug_logger = logging.getLogger(... | alexdlaird/hookee | hookee/server.py | .py | ed3c24a5de433dbb | 7.52 | 10 |
__copyright__ = "Copyright (c) 2020-2024 Alex Laird"
__license__ = "MIT"
import os
import unittest
import requests
from hookee import HookeeManager
from hookee.conf import Config
from tests.testcase import HookeeTestCase
class TestHookeeManagerEdges(HookeeTestCase):
def test_not_click_logging(self):
se... | alexdlaird/hookee | tests/test_hookee_manager_edges.py | .py | 8bba91763b56dd49 | 7.02 | 10 |
__copyright__ = "Copyright (c) 2020-2024 Alex Laird"
__license__ = "MIT"
from hookee import HookeeManager, util
from hookee.pluginmanager import PluginManager
from tests.testcase import HookeeTestCase
class TestUtil(HookeeTestCase):
def setUp(self):
super(TestUtil, self).setUp()
self.hookee_mana... | alexdlaird/hookee | tests/test_util.py | .py | f1546c1d98be91f7 | 7.02 | 10 |
import os
import whisper
import logging
import multiprocessing
import time
import json
from datetime import datetime, timezone
from concurrent.futures import ProcessPoolExecutor, as_completed
from django.conf import settings
from django.core.management.base import BaseCommand
from sidekick.utils.clickhouse import Click... | cybera/netbox-sidekick | sidekick/management/commands/migrate_graphite_to_clickhouse.py | .py | 68517ecabbdc9d7d | 7.45 | 7 |
# Copyright 2020 Allan Feldman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | a-feld/pywreck | src/pywreck/__init__.py | .py | 636611785f829c2c | 7.48 | 8 |
import logging
from pprint import pformat
import traceback
import intersight.api.aaa_api
import credentials
FORMAT = '%(asctime)-15s [%(levelname)s] [%(filename)s:%(lineno)s] %(message)s'
logging.basicConfig(format=FORMAT, level=logging.DEBUG)
logger = logging.getLogger('openapi')
def get_audit_logs(api_client):
... | CiscoDevNet/intersight-python-utils | audit_logs_example.py | .py | 6717efe60d19c851 | 7.62 | 16 |
'''
get audit records from intersight
'''
import sys
import intersight
from intersight.api import aaa_api
import credentials
# get audit records from the audit_api
def get_audit_records(api_client, filter_):
# Creating the audit api instance.
audit_instance = aaa_api.AaaApi(api_client)
try:
# Cre... | CiscoDevNet/intersight-python-utils | audit_records.py | .py | 5c8e2577c71277db | 7.62 | 16 |
"""Intersight Device Connector API configuration and target claim via the Intersight API."""
import sys
import os.path
import json
import traceback
from time import sleep
import intersight.api.asset_api
import intersight.model.asset_device_claim
from intersight.api import resource_api
from intersight.model.resource_res... | CiscoDevNet/intersight-python-utils | config_targets/claim_target.py | .py | 3f610c8553bde627 | 7.62 | 16 |
"""Delete an Intersight target via the Intersight API."""
import sys
import json
import traceback
import intersight.api.asset_api
sys.path.append('../')
import credentials
def delete_target(api_client, target_host):
result = dict(changed=False)
# create API instance
api_instance = intersight.api.asset_ap... | CiscoDevNet/intersight-python-utils | config_targets/delete_target.py | .py | 8be81b455207ff84 | 7.62 | 16 |
"""Intersight Formatting Helpers
This script provides formatting helper functions for use with the intersight python sdk
The following pip packages are required:
- tabulate
"""
try:
from tabulate import tabulate
except ImportError:
print("tabulate is required to run this script.\nInstall using the foll... | CiscoDevNet/intersight-python-utils | helpers.py | .py | 7b3d2344c3e42b09 | 7.62 | 16 |
'''
power cycle a server by its name
'''
import sys
import intersight
from intersight.api import compute_api
from intersight.model import compute_server_setting as compute
import credentials
# power cycle a server by its name
def power_cycle_server(api_client, server_name):
# Creating the compute api instance.
... | CiscoDevNet/intersight-python-utils | power_cycle_server.py | .py | eb5d9495f4043f8c | 7.62 | 16 |
'''
get processor information for servers
'''
import sys
import intersight
from intersight.api import processor_api
import credentials
# get processor information from the processor_api
def get_processor_information(api_client, filter_):
# Creating the compute api instance.
processor_instance = processor_api.... | CiscoDevNet/intersight-python-utils | processor_units.py | .py | af9c1d28608ca6f7 | 7.62 | 16 |
from binascii import hexlify
from hashlib import md5
import os
import threading
import sys
import falcon
import vulnpy.falcon
import time
MIDDLEWARE = []
if os.environ.get("VULNPY_FALCON_MULTIPART_MIDDLEWARE"):
from falcon_multipart.middleware import MultipartMiddleware
MIDDLEWARE.append(MultipartMiddleware()... | Contrast-Security-OSS/vulnpy | apps/falcon_app.py | .py | 8928993f202a1480 | 7.64 | 18 |
import os
import vulnpy
TEMPLATES_LOCATION = os.path.join(os.path.dirname(vulnpy.__file__), "templates")
def cache(func):
cache = {}
def wrapper(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
return wrapper
@cache
def get_template(path):
""... | Contrast-Security-OSS/vulnpy | src/vulnpy/common/templating.py | .py | 5f8433e52e1cdd70 | 7.64 | 18 |
import inspect
import sys
from vulnpy.common import get_template
from vulnpy.trigger import TRIGGER_MAP, get_trigger
def get_root_name(name):
if name == "home":
return "/vulnpy"
return "/vulnpy/{}".format(name)
def get_trigger_name(name, trigger):
return "/vulnpy/{}/{}".format(name, trigger)
d... | Contrast-Security-OSS/vulnpy | src/vulnpy/falcon/vulnerable.py | .py | b34cf2218d5030ad | 7.64 | 18 |
import inspect
import sys
from vulnpy.common import get_template
from vulnpy.trigger import TRIGGER_MAP, get_trigger
def get_root_name(name):
if name == "home":
return "/vulnpy"
return "/vulnpy/{}".format(name)
def get_trigger_name(name, trigger):
return "/vulnpy/{}/{}".format(name, trigger)
d... | Contrast-Security-OSS/vulnpy | src/vulnpy/falcon/vulnerable_asgi.py | .py | 69eb6900749b4e00 | 7.64 | 18 |
import glob
import inspect
from importlib import import_module
from os.path import dirname, basename, isfile, join
def _get_trigger_files():
"""
Find the file names under /trigger.
:return: list of str partial file names, ie ['cmdi', 'deserialization']
"""
all_files = glob.glob(join(dirname(__fil... | Contrast-Security-OSS/vulnpy | src/vulnpy/trigger/util.py | .py | ef38148eb9ade039 | 7.64 | 18 |
"""Detection and synthesis helpers for the HOG id "scheme" used by an OrthoXML file.
Three schemes are recognised:
- LOFT: after a duplication, paralogous branches get a ``.<num><letter>`` suffix
appended (e.g. ``1074943`` -> ``1074943.2a`` -> ``1074943.2a.7b``). Non-duplication
levels keep the same id as they mo... | DessimozLab/pyham | pyham/id_formats.py | .py | d116f2fa8c18561c | 7.54 | 11 |
import logging
import warnings
import gzip
import re
import collections
from os import PathLike
from typing import Union, Optional
from xml.etree.ElementTree import XMLParser
from ete4 import Tree
from .genome import ExtantGenome, AncestralGenome, Genome
logger = logging.getLogger(__name__)
def create_tree_from_new... | DessimozLab/pyham | pyham/taxonomy.py | .py | 1d7c8babc17d7496 | 7.54 | 11 |
import unittest
import pytest
from pyham import utils
from pyham import ham
from pyham.abstractgene import TaxonomicConflictError
import os
class AugmentedExampleTests(unittest.TestCase):
def setUp(self):
# embedded taxonomy is self-consistent by construction (no external tree given),
# so this bu... | DessimozLab/pyham | tests/test_augmented-v05.py | .py | 0d57dbd903954ea4 | 7.04 | 11 |
__author__ = 'admin'
import unittest
from pyham import Gene, HOG, AbstractGene, EvolutionaryConceptError
from unittest import skip
import pyham.genome as g
import ete4
class ExtantGenomeTest(unittest.TestCase):
def test_name_and_NCBITaxId_required(self):
# missing input should raises error
with... | DessimozLab/pyham | tests/test_genome.py | .py | b8070d566ca654c5 | 7.04 | 11 |
"""
Mechanistic Architecture Design (MAD) synthetics (Poli, Thomas, et al., 2024).
Generators follow ``mad-lab`` (https://github.com/athms/mad-lab): each of the six
tasks is a **separate** train/eval dataset, not one model tested on all six.
No runtime dependency on mad-lab.
"""
from __future__ import annotations
im... | LuCeHe/py-aromatics | src/pyaromatics/hf_tools/dataset_tools/mad/mad.py | .py | 76999a1b17411f85 | 7.42 | 6 |
"""
RegBench-style in-context language learning (Akyürek et al., 2024; seq_icl).
Each example concatenates several strings sampled from one random DFA/PFA,
separated by a separator token. Train/val/test use **disjoint** automata.
No runtime dependency on seq_icl / pythomata.
"""
from __future__ import annotations
im... | LuCeHe/py-aromatics | src/pyaromatics/hf_tools/dataset_tools/regbench/regbench.py | .py | 231c890925bc3b82 | 7.42 | 6 |
# coding=utf-8
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differences compared
# to G... | LuCeHe/py-aromatics | src/pyaromatics/hf_tools/models/configuration_minicpm.py | .py | bb83752ab610fa28 | 7.42 | 6 |
import os, sys
import re
import base64
import getpass
from urllib.parse import urlparse, parse_qs, unquote
from pykeepass import PyKeePass
import pyotp
def parse_otpauth_url(otpauth_url):
"""
Accepts an otpauth://totp/... URL and returns the secret (base32) and params dict.
"""
# Example: otpauth://t... | LuCeHe/py-aromatics | src/pyaromatics/stay_organized/keepass_tricks.py | .py | 0ac5b90fb8fc0414 | 7.42 | 6 |
#!/usr/bin/python3
import pytest
from conftest import Compiler, full_exec_supported, full_exec_reason
pytestmark = pytest.mark.hardware
from libcpu.cpu_helper import CPUHelper
from libcpu.assisted_cpu import AssistedCPU
from libcpu.opcodes import opcode_of
def test_dummy_local(cpu_helper: CPUHelper, acpu: AssistedC... | Velko/8-bit-CPU | pycontrol/tests/test_extended_opcodes.py | .py | 3088c25435218e34 | 7.1 | 15 |
#!/usr/bin/python3
import pytest
from conftest import Compiler, full_exec_supported, full_exec_reason
pytestmark = pytest.mark.hardware
from libcpu.cpu_helper import CPUHelper
@pytest.mark.hardware
@pytest.mark.skipif(not full_exec_supported, reason=full_exec_reason)
def test_ldi_on_hw(cpu_helper: CPUHelper, asm_co... | Velko/8-bit-CPU | pycontrol/tests/test_hwexec.py | .py | 577b5cad98b1aca7 | 7.1 | 15 |
"""Django settings for buoy_barn project.
Generated by 'django-admin startproject' using Django 2.0.9.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import logg... | gulfofmaine/buoy_barn | app/buoy_barn/settings.py | .py | ef731e0620d57dcd | 7.42 | 6 |
import uuid
import paho.mqtt.client as mqtt
from django.core.management.base import BaseCommand, CommandError, CommandParser
from deployments.models import ErddapDataset, ErddapServer
from deployments.tasks import single_refresh_dataset
def get_client_id() -> str:
"""Generate a unique client ID for the MQTT con... | gulfofmaine/buoy_barn | app/deployments/management/commands/erddap_mqtt.py | .py | fb35cd04c5c63288 | 7.42 | 6 |
# Generated by Django 2.1.5 on 2019-03-28 15:33
from django.db import migrations
def create_and_connect_datasets(apps, schema_editory):
"""Create and connect datasets to timeseries"""
ErddapDataset = apps.get_model("deployments", "ErddapDataset")
TimeSeries = apps.get_model("deployments", "TimeSeries")
... | gulfofmaine/buoy_barn | app/deployments/migrations/0022_Create and connect datasets.py | .py | c08572f385ad0a07 | 7.42 | 6 |
"""
Harpy Parallel Helpers
----------------------
Private helper module for harpy's per-bunch parallel orchestration:
- Resource estimation (peak resident memory per bunch, available RAM, usable cores),
- Dispatched workers count strategy.
The functions are kept free of side effects, aside from querying ``psutil`` f... | pylhc/omc3 | omc3/harpy/_parallel.py | .py | 8359c65479b030d7 | 7.63 | 17 |
"""
Clean
-----
This module contains the cleaning functionality of ``harpy``.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from omc3.utils import logging_tools
from omc3.utils.contexts import timeit
if TYPE_CHECKING:
from generic_parser.tools i... | pylhc/omc3 | omc3/harpy/clean.py | .py | e90e1c3898ef3bc0 | 7.63 | 17 |
"""
Handler
-------
This module contains high-level functions to manage the functionality of ``harpy``.
Various tools are provided to handle the cleaning, frequency analysis and resonance search
for a single-bunch `TbtData` input. Additionally, a running function exists to handle everything
for a single bunch, and a ... | pylhc/omc3 | omc3/harpy/handler.py | .py | 4d0e862a1092a72a | 7.63 | 17 |
"""
Kicker
------
This module contains phase correction functionality of ``harpy``.
It provides tools to correct phases of a main spectral line in a case where damped (exponentially
decaying) oscillations are analysed.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from ... | pylhc/omc3 | omc3/harpy/kicker.py | .py | f54e33620271849c | 7.63 | 17 |
"""
Constants
---------
Specific constants relating to the retrieval of machine settings information, to help with consistency.
"""
from omc3.optics_measurements.constants import EXT as TFS_SUFFIX
from omc3.utils.misc import StrEnum
class MSISummaryColumn(StrEnum):
"""
TFS columns for machine settings infor... | pylhc/omc3 | omc3/machine_data_extraction/constants.py | .py | d4a0dc1956ec5179 | 7.63 | 17 |
"""
DataClasses for Machine Data
----------------------------
This module contains the dataclasses that are used to hold
and pass on the extracted machine data.
Most of them are purely to hold the data in a structured way,
some have minor functionality to convert the data into different formats
such as TFS and MADX.
... | pylhc/omc3 | omc3/machine_data_extraction/data_classes.py | .py | 64050ebae77508d0 | 7.63 | 17 |
"""
LSA Beamprocesses
-----------------
This module contains functions to extract beamprocess - and related - information
from LSA.
"""
from __future__ import annotations
from datetime import datetime, timedelta
from typing import TYPE_CHECKING
import numpy as np
from dateutil import tz
from omc3.machine_data_extr... | pylhc/omc3 | omc3/machine_data_extraction/lsa_beamprocesses.py | .py | 60c9427383b96957 | 7.63 | 17 |
"""
LSA Knobs
---------
This module contains functions to extract knob information from LSA.
"""
from __future__ import annotations
import re
from typing import TYPE_CHECKING
from omc3.machine_data_extraction.data_classes import KnobDefinition, KnobPart, TrimHistories
from omc3.machine_data_extraction.madx_conversi... | pylhc/omc3 | omc3/machine_data_extraction/lsa_knobs.py | .py | 1421bdf09f84a7de | 7.63 | 17 |
"""
MQT knobs extraction
--------------------
This module provides functions to retrieve MQT (Quadrupole Trim) knob values for the LHC
for a specified beam and time using NXCALS and LSA.
There are two types per arc (focusing 'f' and defocusing 'd'), resulting in 16 MQT circuits
per beam (8 arcs * 2 planes).
The extr... | pylhc/omc3 | omc3/machine_data_extraction/mqt_extraction.py | .py | 014e95ec7c1a0ad3 | 7.63 | 17 |
"""
Utils
-----
Utilities to help with machine data extraction.
"""
from __future__ import annotations
from datetime import datetime
from typing import TYPE_CHECKING
from dateutil import tz
from omc3.utils import logging_tools
from omc3.utils.mock import cern_network_import
if TYPE_CHECKING:
from collections.... | pylhc/omc3 | omc3/machine_data_extraction/utils.py | .py | 5db5084f2799ac30 | 7.63 | 17 |
import json
from datetime import datetime
from urllib.parse import quote, urlencode
import requests
from nacl.bindings import crypto_sign
class DMarketClient:
def __init__(self, public_key: str, secret_key: str):
if not public_key or not secret_key:
raise ValueError("Public and secret keys m... | dmarket/dm-trading-tools | signature-builder/python/dmarket_client.py | .py | 7306aff56f0bbd1c | 7.65 | 19 |
import json
import os
from dmarket_client import DMarketClient
# Load API keys from environment variables
public_key = os.getenv("DMARKET_PUBLIC_KEY")
secret_key = os.getenv("DMARKET_SECRET_KEY")
def get_offer_from_market(client: DMarketClient):
path = "/exchange/v1/market/items"
params = {"gameId": "a8db", ... | dmarket/dm-trading-tools | signature-builder/python/main.py | .py | 65b4c83c1d34ccf5 | 7.65 | 19 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-FileCopyrightText: 2022-2025 Graz University of Technology.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
import click
from ..commands import AssetsCommands
from .utils import pass_cli_config, run_steps
@click.gr... | inveniosoftware/invenio-cli | invenio_cli/cli/assets.py | .py | c04aa1e8d6126932 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2019-2021 CERN.
# SPDX-FileCopyrightText: 2019 Northwestern University.
# SPDX-FileCopyrightText: 2022 Forschungszentrum Jülich GmbH.
# SPDX-FileCopyrightText: 2024-2025 Graz University of Technology.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of appl... | inveniosoftware/invenio-cli | invenio_cli/cli/cli.py | .py | 922462f7cb32f11a | 7.59 | 14 |
# SPDX-FileCopyrightText: 2020-2021 CERN.
# SPDX-FileCopyrightText: 2022-2025 Graz University of Technology.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
import click
from ..commands import AssetsCommands, PackagesCommands
from ..helpers.versions import _pa... | inveniosoftware/invenio-cli | invenio_cli/cli/packages.py | .py | 8d3f127b3b272c09 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
import click
from ..commands import ServicesCommands
from ..helpers.docker_helper import NoOpDockerHelper
from .utils import pass_cli_config, run_steps
@click.group()
def se... | inveniosoftware/invenio-cli | invenio_cli/cli/services.py | .py | 6858505153e62b95 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2022 CERN.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
from pathlib import Path
import click
from ..commands import TranslationsCommands
from .utils import pass_cli_config, run_steps
@click.group()
def translations():
"""Co... | inveniosoftware/invenio-cli | invenio_cli/cli/translations.py | .py | d30ede30d4fe9eeb | 7.59 | 14 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
import click
from ..helpers.cli_config import CLIConfig
pass_cli_config = click.make_pass_decorator(CLIConfig, ensure=True)
def run_steps(steps, fail_message, success_messa... | inveniosoftware/invenio-cli | invenio_cli/cli/utils.py | .py | 3f17ab2729bc2659 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2026 California Institute of Technology.
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
from pathlib import Path
from shutil import copyfile
import click
from ..helpers import env
from ..helpers.... | inveniosoftware/invenio-cli | invenio_cli/commands/assets.py | .py | ccddda6f0808e4d2 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
from ..helpers.cli_config import CLIConfig
from ..helpers.env import env
from ..helpers.process import run_interactive
from .steps import CommandStep
class Commands(object):
... | inveniosoftware/invenio-cli | invenio_cli/commands/commands.py | .py | ddf902f1b8b8dd0a | 7.59 | 14 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-FileCopyrightText: 2024-2025 Graz University of Technology.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
from ..helpers import filesystem
from ..helpers.process import run_cmd
from .local import LocalCommands
from ... | inveniosoftware/invenio-cli | invenio_cli/commands/install.py | .py | bd087677ee28567b | 7.59 | 14 |
# SPDX-FileCopyrightText: 2026 California Institute of Technology.
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-FileCopyrightText: 2022 Graz University of Technology.
# SPDX-FileCopyrightText: 2026 Northwestern University.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applicati... | inveniosoftware/invenio-cli | invenio_cli/commands/local.py | .py | a0593909b6f0b9ca | 7.59 | 14 |
# SPDX-FileCopyrightText: 2020-2021 CERN.
# SPDX-FileCopyrightText: 2021 TU Wien.
# SPDX-FileCopyrightText: 2023 ULB Münster.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
import json
import re
import sys
from ..helpers.docker_helper import DockerHelper
from... | inveniosoftware/invenio-cli | invenio_cli/commands/requirements.py | .py | 6542421567394647 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-FileCopyrightText: 2023 ULB Münster.
# SPDX-FileCopyrightText: 2024 Graz University of Technology.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
#####
# IMPORTANT NOTE: If you are going to modify any code here.
# Ch... | inveniosoftware/invenio-cli | invenio_cli/commands/services_health.py | .py | 9f8fde95b51fcdfa | 7.59 | 14 |
# SPDX-FileCopyrightText: 2020-2021 CERN.
# SPDX-FileCopyrightText: 2022 Graz University of Technology.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
from ..helpers.process import run_interactive
class Step(object):
"""Interface for step objects."""
... | inveniosoftware/invenio-cli | invenio_cli/commands/steps.py | .py | db361bd2dc950232 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2022 CERN.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
from ..commands import Commands
from ..helpers.cli_config import CLIConfig
from ..helpers.filesystem import force_symlink
from .steps import CommandStep, FunctionStep
class T... | inveniosoftware/invenio-cli | invenio_cli/commands/translations.py | .py | ca019ba15fce5c39 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2021 CERN.
# SPDX-License-Identifier: MIT
"""Invenio module to ease the creation and management of applications."""
from ..helpers.cli_config import CLIConfig
from .steps import CommandStep
class UpgradeCommands(object):
"""Local installation commands."""
def __init__(self, cli_co... | inveniosoftware/invenio-cli | invenio_cli/commands/upgrade.py | .py | b91383de2da8f7ba | 7.59 | 14 |
# SPDX-FileCopyrightText: 2019-2024 CERN.
# SPDX-FileCopyrightText: 2019-2020 Northwestern University.
# SPDX-FileCopyrightText: 2021 Esteban J. G. Gabancho.
# SPDX-FileCopyrightText: 2024 Graz University of Technology.
# SPDX-FileCopyrightText: 2025-2026 KTH Royal Institute of Technology.
# SPDX-License-Identifier: MI... | inveniosoftware/invenio-cli | invenio_cli/helpers/cli_config.py | .py | 4942351311321c98 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2019-2021 CERN.
# SPDX-FileCopyrightText: 2019-2021 Northwestern University.
# SPDX-FileCopyrightText: 2022 Forschungszentrum Jülich GmbH.
# SPDX-License-Identifier: MIT
"""Invenio Cookiecutter Config class."""
import tempfile
from configparser import ConfigParser
import yaml
from cookiecut... | inveniosoftware/invenio-cli | invenio_cli/helpers/cookiecutter_wrapper.py | .py | 0c103760c85ae1c9 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2019 CERN.
# SPDX-FileCopyrightText: 2019 Northwestern University.
# SPDX-FileCopyrightText: 2023 ULB Münster.
# SPDX-FileCopyrightText: 2024 Graz University of Technology.
# SPDX-License-Identifier: MIT
"""Invenio CLI Docker Compose class."""
import re
import docker
from .process import P... | inveniosoftware/invenio-cli | invenio_cli/helpers/docker_helper.py | .py | d2304b58c0b77073 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2019 CERN.
# SPDX-FileCopyrightText: 2019 Northwestern University.
# SPDX-License-Identifier: MIT
"""Invenio Filesystem helper functions."""
import errno
import hashlib
from os import listdir, remove, symlink
from os.path import isdir
from pathlib import Path
from .process import ProcessRes... | inveniosoftware/invenio-cli | invenio_cli/helpers/filesystem.py | .py | e84fdf7cf3a6cbef | 7.59 | 14 |
# SPDX-FileCopyrightText: 2019 CERN.
# SPDX-FileCopyrightText: 2019 Northwestern University.
# SPDX-FileCopyrightText: 2022 Graz University of Technology.
# SPDX-License-Identifier: MIT
"""Invenio CLI Process helper module."""
from os import environ
from subprocess import PIPE, CalledProcessError
from subprocess impo... | inveniosoftware/invenio-cli | invenio_cli/helpers/process.py | .py | eb4a31404da13f87 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2022-2025 CERN.
# SPDX-FileCopyrightText: 2025 TU Wien.
# SPDX-License-Identifier: MIT
"""Invenio CLI dependencies helper."""
import os
import re
try:
import tomli as tomllib
except ModuleNotFoundError:
import tomllib
from packaging.requirements import Requirement
from pipfile impo... | inveniosoftware/invenio-cli | invenio_cli/helpers/versions.py | .py | fed9845efe92af12 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2019-2020 CERN.
# SPDX-FileCopyrightText: 2019-2020 Northwestern University.
# SPDX-FileCopyrightText: 2021 Esteban J. G. Gabancho.
# SPDX-License-Identifier: MIT
"""Commands tests fixtures."""
from pathlib import Path
from unittest.mock import Mock
import pytest
@pytest.fixture
def mock_... | inveniosoftware/invenio-cli | tests/commands/conftest.py | .py | 595703502f27ba6d | 8.09 | 14 |
# SPDX-FileCopyrightText: 2019-2020 CERN.
# SPDX-FileCopyrightText: 2019-2020 Northwestern University.
# SPDX-License-Identifier: MIT
"""Module commands/commands.py's tests."""
from unittest.mock import patch
import pytest
from invenio_cli.commands import Commands
@pytest.mark.skip()
# NOTE: The patch is the actu... | inveniosoftware/invenio-cli | tests/commands/test_commands.py | .py | c15bc9fc94bfcda0 | 7.09 | 14 |
# SPDX-FileCopyrightText: 2019-2020 CERN.
# SPDX-FileCopyrightText: 2019-2020 Northwestern University.
# SPDX-License-Identifier: MIT
"""Module commands/containers.py's tests."""
from pathlib import Path
from unittest.mock import call, patch
import pytest
from invenio_cli.commands import ContainersCommands
@pytes... | inveniosoftware/invenio-cli | tests/commands/test_containers.py | .py | ca90ade5775b6e2c | 7.09 | 14 |
# SPDX-FileCopyrightText: 2019-2020 CERN.
# SPDX-FileCopyrightText: 2019-2020 Northwestern University.
# SPDX-License-Identifier: MIT
"""Module commands/local.py's tests."""
from os import environ
from pathlib import Path
from unittest.mock import MagicMock, Mock, call, patch
import pytest
from click import UsageErr... | inveniosoftware/invenio-cli | tests/commands/test_local.py | .py | 4ed682a972c0276d | 7.09 | 14 |
# SPDX-FileCopyrightText: 2021 CERN.
# SPDX-License-Identifier: MIT
"""Module commands/requirements.py's tests."""
from invenio_cli.commands.requirements import RequirementsCommands
def test_check_requirements():
# major
ok_major_higher = RequirementsCommands._check_version("random", "2.0.0", major=1)
a... | inveniosoftware/invenio-cli | tests/commands/test_requirements.py | .py | 776458b8fbfeb497 | 7.09 | 14 |
# SPDX-FileCopyrightText: 2021 CERN.
# SPDX-License-Identifier: MIT
"""Module for step tests."""
from invenio_cli.commands.steps import FunctionStep
from invenio_cli.helpers.process import ProcessResponse
def func():
return ProcessResponse(error="test", output="test", status_code=1, warning=False)
def test_fu... | inveniosoftware/invenio-cli | tests/commands/test_steps.py | .py | 2d7fb8deeab7d632 | 8.09 | 14 |
# SPDX-FileCopyrightText: 2019-2020 CERN.
# SPDX-FileCopyrightText: 2019-2021 Northwestern University.
# SPDX-FileCopyrightText: 2025-2026 KTH Royal Institute of Technology.
# SPDX-License-Identifier: MIT
"""Module config_file tests."""
import os
import tempfile
from configparser import ConfigParser
from pathlib impo... | inveniosoftware/invenio-cli | tests/helpers/test_cli_config.py | .py | d39a95a75f150fa0 | 7.09 | 14 |
# SPDX-FileCopyrightText: 2019-2020 CERN.
# SPDX-FileCopyrightText: 2019-2020 Northwestern University.
# SPDX-License-Identifier: MIT
"""Module cookiecutter wrapper tests."""
from invenio_cli.helpers.cookiecutter_wrapper import CookiecutterWrapper
def test_constructor():
cookiecutter = CookiecutterWrapper("RDM"... | inveniosoftware/invenio-cli | tests/helpers/test_cookiecutter_wrapper.py | .py | dd2c58bdaa82f7b9 | 8.09 | 14 |
# SPDX-FileCopyrightText: 2019-2020 CERN.
# SPDX-FileCopyrightText: 2019-2020 Northwestern University.
# SPDX-FileCopyrightText: 2023 ULB Münster.
# SPDX-License-Identifier: MIT
"""Module docker_helper tests."""
from unittest.mock import patch
import pytest
from invenio_cli.helpers.docker_helper import DockerHelper... | inveniosoftware/invenio-cli | tests/helpers/test_dockerhelper.py | .py | 35cf5a71a83917de | 8.09 | 14 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-FileCopyrightText: 2020 Northwestern University.
# SPDX-License-Identifier: MIT
"""Test environment variables context manager."""
import os
from invenio_cli.helpers.env import env
def test_env():
"""Test environment variables context manager."""
assert "SERVER_NA... | inveniosoftware/invenio-cli | tests/helpers/test_env.py | .py | 21219b8df6e90a68 | 7.09 | 14 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-FileCopyrightText: 2020 Northwestern University.
# SPDX-License-Identifier: MIT
"""Module docker_helper tests."""
import tempfile
from pathlib import Path
from invenio_cli.helpers.filesystem import get_created_files
def test_get_created_files():
tmp_dir = tempfile.Te... | inveniosoftware/invenio-cli | tests/helpers/test_filesystem.py | .py | f0d611895183b463 | 7.09 | 14 |
# SPDX-FileCopyrightText: 2020 CERN.
# SPDX-FileCopyrightText: 2020 Northwestern University.
# SPDX-License-Identifier: MIT
"""Pytest fixtures."""
from os.path import exists
import pytest
from click.testing import CliRunner
from invenio_cli.cli import cli
@pytest.fixture()
def runner():
"""Click CLI runner.""... | inveniosoftware/invenio-cli | tests/test_cli.py | .py | 8aa41d8ce23fa469 | 8.09 | 14 |
import ast
import inspect
import textwrap
from enum import Enum
from typing import Any, TypeVar
__all__ = ["attributes_doc", "enum_doc", "get_attributes_doc", "get_doc"]
T = TypeVar("T")
TEnum = TypeVar("TEnum", bound=Enum)
class FStringFound(Exception): # noqa: N818
pass
def get_attributes_doc(cls: type) -... | tkukushkin/attributes-doc | src/attributes_doc/_base.py | .py | bfdd8c00eba4473c | 7.52 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.