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 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/documents/__init__.py | .py | a0de49673438e86d | 7.45 | 7 |
# Copyright 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/documents/discovery.py | .py | 6fd30ae150a63d71 | 7.45 | 7 |
# Copyright 2022 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/documents/healthcheck.py | .py | cb4f714aef86aa24 | 7.45 | 7 |
# Copyright 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/documents/topology.py | .py | 9b161a4fd3ccac88 | 7.45 | 7 |
# Copyright 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/job/shared.py | .py | 80637c09bfd0c091 | 7.45 | 7 |
"""NRM port_id to device/interface mapping from a YAML file."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
import yaml
@dataclass
class _PortInfo:
device: str
interface: str
class PortResolver:
"""Resolves NRM port_id to device hostname and interface... | workfloworchestrator/SuPA | src/supa/mcp/port_mapping.py | .py | 33158ddec190215d | 7.45 | 7 |
"""Read-only database query functions for MCP tools."""
from __future__ import annotations
import uuid
from typing import Any
import structlog
from supa.db.model import Connection, Reservation
from supa.db.session import db_session
from supa.mcp.port_mapping import PortResolver
logger = structlog.get_logger(__name... | workfloworchestrator/SuPA | src/supa/mcp/queries.py | .py | 6e2d480054c8b714 | 7.45 | 7 |
"""MCP server wiring for SuPA read-only circuit data."""
from __future__ import annotations
import asyncio
import importlib.metadata
import logging
from datetime import datetime, timezone
import structlog
import uvicorn
from mcp.server.mcpserver import MCPServer
from supa import settings
from supa.mcp.port_mapping ... | workfloworchestrator/SuPA | src/supa/mcp/server.py | .py | c45867c292d233ef | 7.45 | 7 |
"""MCP tool definitions for SuPA circuit data."""
from __future__ import annotations
import json
import time
import uuid
import structlog
from mcp.server.mcpserver import Context, MCPServer
from supa.mcp.port_mapping import PortResolver
from supa.mcp.queries import get_circuit_endpoints_query, get_circuit_query, li... | workfloworchestrator/SuPA | src/supa/mcp/tools.py | .py | e518de28673bd90e | 7.45 | 7 |
# Copyright 2025 Internet2.
# 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 writ... | workfloworchestrator/SuPA | src/supa/nrm/backends/nso.py | .py | 153b3c80f795551f | 7.45 | 7 |
import ncs
from ncs.application import Service
from ncs.dp import Action
from ncs.maagic import get_root
class NsiCircuit(Service):
@Service.create
def cb_create(self, tctx, root, service, proplist):
self.log.info("Service create(service=", service._path, ")")
if validate_vlan(self, root, ser... | workfloworchestrator/SuPA | src/supa/nrm/backends/nso_service_model/nsi-circuit/python/nsi-circuit/main.py | .py | d667704975999b45 | 7.45 | 7 |
# Copyright 2023 ESnet / UCSD / SURF.
# 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 ... | workfloworchestrator/SuPA | src/supa/nrm/backends/paristaEOS4-untested.py | .py | d23978086d61b233 | 7.95 | 7 |
# Copyright 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/util/converter.py | .py | 75c5592f59529335 | 7.45 | 7 |
# Copyright 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/util/find.py | .py | a0add83e54f49880 | 7.45 | 7 |
# Copyright 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/util/functional.py | .py | 66838f31082b2909 | 7.45 | 7 |
# Copyright 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/util/nsi.py | .py | 3fafd0340d49f86f | 7.45 | 7 |
# Copyright 2020 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/util/timestamp.py | .py | 0eff4694996373fd | 7.45 | 7 |
# Copyright 2023 SURF.
# 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, ... | workfloworchestrator/SuPA | src/supa/util/type.py | .py | 9548ad92a60667aa | 7.45 | 7 |
#!/usr/bin/env python3
import requests
import json
import logging
from argparse import ArgumentParser
# Set up logging
log_format = "[%(asctime)s] [%(levelname)s] %(message)s"
logging.basicConfig(level=logging.INFO, format=log_format)
LOG = logging.getLogger(__name__)
HELP_DESCRIPTION = """
This is a utility script f... | status-im/infra-utils | elasticsearch/shard_migration.py | .py | b486613aba9c7d0f | 7.42 | 6 |
#!/usr/bin/env python
import os
import sys
import json
import base64
import hashlib
from pathlib import Path
from cryptography.fernet import Fernet
import shutil
from datetime import datetime
def get_encryption_key():
"""Generate encryption key using CONSUL_HTTP_TOKEN"""
consul_token = os.environ.get('CONSUL_... | status-im/infra-utils | terraform/decrypt_tf_backup.py | .py | dc3530f1266e2d45 | 7.42 | 6 |
import json
from libs.http_client import AuthenticatedHttpClient
from utils.utils import Machines, log
class MakeMachines(object):
def __init__(self):
pass
def osd(self):
osd1 = Machines("10.8.128.77", "magna077")
osd2 = Machines("10.8.128.52", "magna052")
osd3 = Machines("10... | red-hat-storage/ceph-qe-scripts | calamari/api_tests/config.py | .py | 5bbd46bb46eb7b24 | 7.06 | 12 |
#!/usr/bin/env python
import json
import logging
import requests
log = logging.getLogger(__name__)
class AuthenticatedHttpClient(requests.Session):
"""
Client for the calamari REST API, principally exists to do
authentication, but also helpfully prefixes
URLs in requests with the API base URL and J... | red-hat-storage/ceph-qe-scripts | calamari/api_tests/libs/http_client.py | .py | 1b1466aec37ba19d | 8.06 | 12 |
import json
class AbaCard:
def __init__(self):
self.__asset_id = None # type: str
self.__card_nick_name = None # type: str
self.__masked_card_no = None # type: str
self.__card_status = None # type: str
self.__card_brand = None # type: str
self.__crea... | alipay/global-open-sdk-python | com/alipay/ams/api/model/aba_card.py | .py | 61ef212537d2804d | 7.59 | 14 |
import json
from com.alipay.ams.api.model.amount import Amount
from com.alipay.ams.api.model.amount import Amount
from com.alipay.ams.api.model.amount import Amount
class AccountBalance:
def __init__(self):
self.__currency = None # type: str
self.__available_balance = None # type: Amo... | alipay/global-open-sdk-python | com/alipay/ams/api/model/account_balance.py | .py | 5e76caa6c436be0e | 7.59 | 14 |
import json
class AcquirerInfo:
def __init__(self):
self.__acquirer_name = None # type: str
self.__reference_request_id = None # type: str
self.__acquirer_transaction_id = None # type: str
self.__acquirer_merchant_id = None # type: str
self.__acquirer_result_... | alipay/global-open-sdk-python | com/alipay/ams/api/model/acquirer_info.py | .py | cecd16bfa6bf4ac2 | 7.59 | 14 |
import json
class Address:
def __init__(self):
self.__region = None # type: str
self.__state = None # type: str
self.__city = None # type: str
self.__address1 = None # type: str
self.__address2 = None # type: str
self.__zip_code = None # type: str
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/address.py | .py | 6dc8b0a2bd106e26 | 7.59 | 14 |
import json
class AgreementInfo:
def __init__(self):
self.__auth_state = None # type: str
self.__user_login_id = None # type: str
self.__user_login_type = None # type: str
self.__display_user_login_id = None # type: str
@property
def auth_state(self... | alipay/global-open-sdk-python | com/alipay/ams/api/model/agreement_info.py | .py | 0ea15c81873dde80 | 7.59 | 14 |
import json
class Amount:
def __init__(self, currency=None, value=None):
self.__currency = currency # type: str
self.__value = value # type: str
@property
def currency(self):
"""
The 3-letter currency code that follows the ISO 4217 standard. More in... | alipay/global-open-sdk-python | com/alipay/ams/api/model/amount.py | .py | c7b8d0a7a5e98615 | 7.59 | 14 |
import json
from com.alipay.ams.api.model.amount import Amount
from com.alipay.ams.api.model.amount import Amount
from com.alipay.ams.api.model.amount import Amount
class AmountLimit:
def __init__(self):
self.__max_amount = None # type: Amount
self.__min_amount = None # type: Amount
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/amount_limit.py | .py | fd9b10be4398ee24 | 7.59 | 14 |
import json
from com.alipay.ams.api.model.amount_limit import AmountLimit
from com.alipay.ams.api.model.amount_limit import AmountLimit
from com.alipay.ams.api.model.amount_limit import AmountLimit
class AmountLimitInfo:
def __init__(self):
self.__single_limit = None # type: AmountLimit
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/amount_limit_info.py | .py | d1418dc5bb2d4250 | 7.59 | 14 |
import json
from com.alipay.ams.api.model.service import Service
class AncillaryData:
def __init__(self):
self.__services = None # type: [Service]
self.__connected_ticket_number = None # type: str
@property
def services(self):
"""
List of services for... | alipay/global-open-sdk-python | com/alipay/ams/api/model/ancillary_data.py | .py | b46ae4918f08b815 | 7.59 | 14 |
import json
class Applicability:
def __init__(self):
self.__scope = None # type: str
self.__price_ids = None # type: [str]
@property
def scope(self):
"""
The scope. Maximum length: 8 characters.
"""
return self.__scope
@scope.sett... | alipay/global-open-sdk-python | com/alipay/ams/api/model/applicability.py | .py | 6c41d268cf5a3d0e | 7.59 | 14 |
import json
class Attachment:
def __init__(self):
self.__attachment_type = None # type: str
self.__file = None # type: str
self.__attachment_name = None # type: str
self.__file_key = None # type: str
@property
def attachment_type(self):
"""
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/attachment.py | .py | e2d4d23b28250589 | 7.59 | 14 |
import json
class AuthMetaData:
def __init__(self):
self.__account_holder_name = None # type: str
self.__account_holder_cert_no = None # type: str
@property
def account_holder_name(self):
"""Gets the account_holder_name of this AuthMetaData.
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/auth_meta_data.py | .py | 6a128ef73743c8ac | 7.59 | 14 |
import json
from com.alipay.ams.api.model.card_limit_detail import CardLimitDetail
from com.alipay.ams.api.model.card_limit_info import CardLimitInfo
from com.alipay.ams.api.model.refund_preference import RefundPreference
class AuthorizationControl:
def __init__(self):
self.__card_active_time =... | alipay/global-open-sdk-python | com/alipay/ams/api/model/authorization_control.py | .py | b47a674c710bcfdd | 7.59 | 14 |
import json
class AvailableAmount:
def __init__(self):
self.__currency = None # type: str
self.__value = None # type: str
@property
def currency(self):
"""
The 3-letter currency code that follows the ISO 4217 standard. Maximum length: 3 characters.
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/available_amount.py | .py | e886ea39e3c12b15 | 7.59 | 14 |
import json
from com.alipay.ams.api.model.payment_method_type_item import PaymentMethodTypeItem
class AvailablePaymentMethod:
def __init__(self):
self.__payment_method_meta_data = None # type: {str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)}
self.__paymen... | alipay/global-open-sdk-python | com/alipay/ams/api/model/available_payment_method.py | .py | 6aa9844b7b790adc | 7.59 | 14 |
import json
class BillingDiscount:
def __init__(self):
self.__coupon_id = None # type: str
self.__promotion_code_id = None # type: str
@property
def coupon_id(self):
"""
Coupon ID associated with the discount. Exactly one of `couponId` and &... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_discount.py | .py | 94f3c370c1b49598 | 7.59 | 14 |
import json
from com.alipay.ams.api.model.billing_trial_settings import BillingTrialSettings
from com.alipay.ams.api.model.billing_discount import BillingDiscount
class BillingSubscription:
def __init__(self):
self.__customer_id = None # type: str
self.__trial_settings = None # type: ... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription.py | .py | 9d89ae8e6a1104dc | 7.59 | 14 |
import json
class BillingSubscriptionCancelCancellationDetails:
def __init__(self):
self.__feedback = None # type: str
self.__comment = None # type: str
@property
def feedback(self):
"""
The feedback. Maximum length: 17 characters. Note: See documenta... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription_cancel_cancellation_details.py | .py | c355dec682805615 | 7.59 | 14 |
import json
class BillingSubscriptionCancellationDetails:
def __init__(self):
self.__feedback = None # type: str
self.__comment = None # type: str
@property
def feedback(self):
"""
Structured cancellation feedback. Recommended values include TOO_EXPEN... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription_cancellation_details.py | .py | af76bcb49a04c4cb | 7.59 | 14 |
import json
from com.alipay.ams.api.model.amount import Amount
class BillingSubscriptionDiscountInfo:
def __init__(self):
self.__discount_id = None # type: str
self.__coupon_id = None # type: str
self.__type = None # type: str
self.__percent_off = None # type: str
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription_discount_info.py | .py | 58c2eb323f10f586 | 7.59 | 14 |
import json
class BillingSubscriptionInquireDetailsCancellationDetails:
def __init__(self):
self.__feedback = None # type: str
self.__comment = None # type: str
@property
def feedback(self):
"""
The feedback. Maximum length: 17 characters.
"""... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription_inquire_details_cancellation_details.py | .py | 2872e90c619c3652 | 7.59 | 14 |
import json
from com.alipay.ams.api.model.amount import Amount
from com.alipay.ams.api.model.tier import Tier
from com.alipay.ams.api.model.amount import Amount
class BillingSubscriptionPriceItem:
def __init__(self):
self.__current_period_end = None # type: str
self.__current_period_st... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription_price_item.py | .py | 7529d5b51a49d086 | 7.59 | 14 |
import json
class BillingSubscriptionStatusChange:
def __init__(self):
self.__action = None # type: str
@property
def action(self):
"""
The subscription status change action. The currently supported value is PAUSE, which pauses payment collection and changes t... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription_status_change.py | .py | d86b652e62f22d35 | 7.59 | 14 |
import json
from com.alipay.ams.api.model.billing_subscription_trial_settings_end_behavior import BillingSubscriptionTrialSettingsEndBehavior
class BillingSubscriptionTrialSettings:
def __init__(self):
self.__end_behavior = None # type: BillingSubscriptionTrialSettingsEndBehavior
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription_trial_settings.py | .py | b240865b36294df2 | 7.59 | 14 |
import json
class BillingSubscriptionTrialSettingsEndBehavior:
def __init__(self):
self.__missing_payment_method = None # type: str
@property
def missing_payment_method(self):
"""
The behavior applied when the trial ends without an available payment method. Va... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_subscription_trial_settings_end_behavior.py | .py | d0cb2334739d83f3 | 7.59 | 14 |
import json
class BillingTrialSettings:
def __init__(self):
self.__trial_period_days = None # type: int
self.__trial_end = None # type: str
self.__trial_end_behavior = None # type: str
@property
def trial_period_days(self):
"""
Relative trial... | alipay/global-open-sdk-python | com/alipay/ams/api/model/billing_trial_settings.py | .py | 33e9c555b3bafdd1 | 7.59 | 14 |
import json
class BrowserInfo:
def __init__(self):
self.__accept_header = None # type: str
self.__java_enabled = None # type: bool
self.__java_script_enabled = None # type: bool
self.__language = None # type: str
self.__user_agent = None # type: str
... | alipay/global-open-sdk-python | com/alipay/ams/api/model/browser_info.py | .py | 2dc581674c845f8a | 7.59 | 14 |
import numpy as np
import so3g
from pixell import enmap
from .. import core, tod_ops, coords
def make_map(tod,
P=None, wcs_kernel=None,
res=0.1 * coords.DEG,
dsT=None, demodQ=None, demodU=None,
cuts=None,
det_weights=None, det_weights_demod=None,
... | simonsobs/sotodlib | sotodlib/coords/demod.py | .py | 9ca6dce5d0314ee8 | 7.64 | 18 |
"""
Helper functions for Healpix operations
Functions are provided to transform between "full", "compressed", and "tiled"
Healpix maps. This follows a scheme in which the full map is broken up into
individual tiles defined by a lower resolution map. The setup ("geometry") is
defined by the base nside, nside_tile of th... | simonsobs/sotodlib | sotodlib/coords/healpix_utils.py | .py | 80d5a7abd75242c3 | 7.64 | 18 |
from matplotlib.axes import Axes
from matplotlib.ticker import Formatter, MultipleLocator
from matplotlib.projections import register_projection
import numpy as np
from pixell import enmap
__all__ = ['BeamMapAxes']
class _RescaleFormatter(Formatter):
"""Tick formatter that divides the tick positions by some uni... | simonsobs/sotodlib | sotodlib/coords/plotting.py | .py | de15b540eff41a14 | 7.64 | 18 |
import numpy as np
from pixell import enmap, utils, coordsys
from sotodlib import coords, mapmaking
import so3g
def get_cuts(aman, args, sidelobe_cutters=None, object_list=None):
"""
Function to calculate cuts (RangesMatrix) for Sun and Moon
from a binary sidelobe mask with an arbitrary shape.
The mask... | simonsobs/sotodlib | sotodlib/coords/sidelobes.py | .py | 842924f9db78bd9c | 7.64 | 18 |
import inspect
import so3g
import numpy as np
import json
import h5py
## "temporary" fix to deal with scipy>1.8 changing the sparse setup
try:
from scipy.sparse import csr_array
except ImportError:
from scipy.sparse import csr_matrix as csr_array
import astropy.units as u
import flacarray
from .axisman impor... | simonsobs/sotodlib | sotodlib/core/axisman_io.py | .py | 37526f663ba64d16 | 7.64 | 18 |
"""
Various AxisManager utility functions
"""
import numpy as np
from sotodlib.core import AxisManager
class RestrictionException(Exception):
"""Exception for when cannot restrict AxisManager properly"""
def restrict_to_times(am, t0, t1, in_place=False):
"""
Restricts axis manager to a time range (t0, t1... | simonsobs/sotodlib | sotodlib/core/axisman_util.py | .py | 6980f716434213d9 | 7.64 | 18 |
import sqlite3
import gzip
import os
def sqlite_to_file(db, filename, overwrite=True, fmt=None):
"""Write an sqlite db to file. Supports several output formats.
Args:
db (sqlite3.Connection): the sqlite3 database connection.
filename (str): the path to the output file.
overwrite (bool): wh... | simonsobs/sotodlib | sotodlib/core/metadata/common.py | .py | 227c8d1d6fbc91dc | 7.64 | 18 |
import os
import re
import shutil
import time
import numpy as np
import h5py
class H5LockTimeoutError(Exception):
"""Raised when an HDF5 file cannot be opened due to lock timeouts."""
pass
class H5ContextManager:
"""
Class to open an HDF5 file with retry logic on file locking. This class
can b... | simonsobs/sotodlib | sotodlib/core/util.py | .py | 8ef3b247e0f878bf | 7.64 | 18 |
# Copyright (c) 2018-2019 Simons Observatory.
# Full license can be found in the top level "LICENSE" file.
"""Data Filtering
This module contains code for filtering data in G3Frames
"""
import numpy as np
import scipy.signal as signal
from spt3g import core
from .core.g3_core import DataG3Module
class Filter(DataG3... | simonsobs/sotodlib | sotodlib/g3_filter.py | .py | d15ede297806f6af | 7.64 | 18 |
# Copyright (c) 2018-2020 Simons Observatory.
# Full license can be found in the top level "LICENSE" file.
"""Data simulation.
This module contains code for simulating data.
"""
import numpy as np
from spt3g import core
from .core.g3_core import DataG3Module
class PipelineSeeder(list):
"""
A way to introd... | simonsobs/sotodlib | sotodlib/g3_sim.py | .py | 7a62b40ed87c71c1 | 7.64 | 18 |
import numpy as np
from sotodlib import core
import logging
logger = logging.getLogger(__name__)
def default_model(telescope):
"""Returns default hwp_angle_model. This will be deleted in future.
"""
model = core.AxisManager()
if telescope == 'satp1':
sign = core.AxisManager()
sign.wr... | simonsobs/sotodlib | sotodlib/hwp/hwp_angle_model.py | .py | cd9e2d3391fde35c | 7.64 | 18 |
"""This ancil submodule specializes in radiometer data from the APEX
telescope.
"""
import logging
import math
import requests
import datetime as dt
import numpy as np
from . import utils
from . import configcls as cc
logger = logging.getLogger(__name__)
APEX_DATA_URL = 'http://archive.eso.org/wdb/wdb/eso/meteo_... | simonsobs/sotodlib | sotodlib/io/ancil/apex.py | .py | 9024f7e97feda2ae | 7.64 | 18 |
from functools import wraps
from django.core.exceptions import PermissionDenied
from django.utils.translation import gettext_lazy as _
from graphql.type import GraphQLResolveInfo
from open_city_profile.exceptions import ServiceNotIdentifiedError
PERMISSION_DENIED_MESSAGE = _("You do not have permission to perform th... | City-of-Helsinki/open-city-profile | open_city_profile/decorators.py | .py | b198dad4617e4eb6 | 7.45 | 7 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Assemble Property dashboard configuration from template parameters.
"""
from .column import ColumnMaker, ColumnSyntaxException
from .grouping import GroupingConfigurationMaker
from .grouping_link import GroupingLinkSyntaxException
from .sparql_utils import SparqlEngineBuil... | JeanFred/inteGraality | integraality/config_assembler.py | .py | 1ab664173c585526 | 7.57 | 13 |
"""Database connection and schema management."""
import logging
import os
from pathlib import Path
from pymysql.cursors import DictCursor
logger = logging.getLogger(__name__)
SCHEMA_PATH = Path(__file__).parent / "schema.sql"
def _read_schema():
"""Read the SQL schema file and split into individual statements... | JeanFred/inteGraality | integraality/db.py | .py | 8dfdc151b35455f0 | 7.57 | 13 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Create pages linked from grouping rows, seeded with Listeria lists.
"""
import logging
import pywikibot
from .page_saving import save_to_wiki_or_local
class _NonLocalPageError(Exception):
pass
class GroupingPageCreator:
def __init__(self, site, selector_sparq... | JeanFred/inteGraality | integraality/grouping_page_creator.py | .py | bec5c05dad880b25 | 7.57 | 13 |
"""Writing results to wiki or local files."""
import os
import pywikibot
def save_to_wiki_or_local(page, summary, content, minor=True):
"""
Save the content to the page on a given site or store it locally.
Whether the pages are outputted locally (and where to) is controlled by the
LOCAL_WRITE_PATH ... | JeanFred/inteGraality | integraality/page_saving.py | .py | 1d2a804f9a153a26 | 7.57 | 13 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Core logic — builds SPARQL queries, processes results."""
import collections
import logging
from .column import ColumnMaker
from .grouping import GroupingConfiguration, ItemGroupingType
from .line import (
NoGroupGrouping,
TotalsGrouping,
UnknownValueGrouping,
... | JeanFred/inteGraality | integraality/property_statistics.py | .py | 6f1e245e37d6bbbd | 7.57 | 13 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Results formatting as wikitext table."""
class ResultsFormatter:
"""Format groupings into WikiText table."""
def __init__(
self,
columns,
grouping_configuration,
property_threshold=0,
cell_template="Integraality cell",
... | JeanFred/inteGraality | integraality/results_formatter.py | .py | 608b33b7783fedce | 7.57 | 13 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""SPARQL engine abstraction (WDQS and QLever)."""
import pywikibot
import pywikibot.data.sparql
import requests
from .error_category import ErrorCategory
class QueryException(Exception):
error_category = ErrorCategory.QUERY
def __init__(self, message, query):
... | JeanFred/inteGraality | integraality/sparql_utils.py | .py | 1c41a65cf8681fb9 | 7.57 | 13 |
# -*- coding: utf-8 -*-
"""Tests for db module."""
import unittest
from unittest.mock import MagicMock, patch
from pymysql.cursors import DictCursor
from ..db import _read_schema, ensure_schema, get_connection
class TestReadSchema(unittest.TestCase):
def test_returns_non_empty_list(self):
result = _re... | JeanFred/inteGraality | integraality/tests/test_db.py | .py | 163e3b714097b21b | 8.07 | 13 |
# -*- coding: utf-8 -*-
"""Unit tests for pages_processor.py."""
import argparse
import unittest
from unittest.mock import patch
import fakeredis
from ..pages_processor import PagesProcessor, main
class ProcessortTest(unittest.TestCase):
def setUp(self):
fake_cache_client = fakeredis.FakeStrictRedis()... | JeanFred/inteGraality | integraality/tests/test_pages_processor.py | .py | 290cc132d149ef04 | 7.07 | 13 |
import base64
import hmac
import ipaddress
import os.path
from typing import Dict, List
from urllib.parse import quote, unquote
from botocore.exceptions import ClientError
from lambda_r2_lib import S3_BUCKET_NAME, get_r2_s3_client, get_secrets_manager_secret_dict
# Dicts of usernames and passwords which will be popul... | openshift-eng/art-tools | art-cluster/cloudfront/mirror/lambda_r2_art-srv-request-basic-auth.py | .py | 92bf999f3d1e7e06 | 7.56 | 12 |
import asyncio
import logging
import typing
from artcommonlib import constants
from google.cloud import bigquery
from google.cloud.bigquery.table import RowIterator
from sqlalchemy import BinaryExpression, UnaryExpression
from sqlalchemy.dialects import mysql
class BigQueryClient:
def __init__(self):
try... | openshift-eng/art-tools | artcommon/artcommonlib/bigquery.py | .py | 70ee93fb2e12118d | 7.56 | 12 |
from typing import Dict, Iterable, List, Optional
from artcommonlib import logutil
from artcommonlib.release_util import isolate_assembly_in_release
LOGGER = logutil.get_logger(__name__)
def find_latest_build(builds: List[Dict], assembly: Optional[str]) -> Optional[Dict]:
"""Find the latest build specific to th... | openshift-eng/art-tools | artcommon/artcommonlib/build_util.py | .py | 32ffbedfa8d42c5b | 7.56 | 12 |
import re
from enum import Enum
from typing import List, Optional
# from doozerlib.util import isolate_pflag_in_release
class BuildVisibility(Enum):
PUBLIC = 0
PRIVATE = 1
VISIBILITY_SUFFIX = {
'brew': {
BuildVisibility.PUBLIC: 'p0',
BuildVisibility.PRIVATE: 'p1',
},
'konflux': ... | openshift-eng/art-tools | artcommon/artcommonlib/build_visibility.py | .py | e0a4a4891e45a45b | 7.56 | 12 |
from io import StringIO
from logging import Logger, getLogger
from pathlib import Path
from typing import Any, Literal
from artcommonlib.assembly import assembly_field
from artcommonlib.gitdata import GitData
from artcommonlib.util import deep_merge
from ruamel.yaml import YAML
yaml = YAML(typ='safe')
class _Includ... | openshift-eng/art-tools | artcommon/artcommonlib/config/__init__.py | .py | d552902c09a61405 | 7.56 | 12 |
import string
import warnings
from typing import TYPE_CHECKING, Literal
from pydantic import BaseModel, RootModel
if TYPE_CHECKING:
from artcommonlib.config.plashet import PlashetConfig
RepoType = Literal['external', 'plashet']
BrewArch = Literal['x86_64', 's390x', 'ppc64le', 'aarch64']
class PlashetRepo(BaseM... | openshift-eng/art-tools | artcommon/artcommonlib/config/repo.py | .py | bd83e2579bfac40d | 7.56 | 12 |
import click
def stringify(val):
"""
Accepts either str or bytes and returns a str
"""
try:
val = val.decode('utf-8')
except (UnicodeDecodeError, AttributeError):
pass
return val
def red_prefix(msg, file=None):
"""Print out a message prefix in bold red letters, like for "... | openshift-eng/art-tools | artcommon/artcommonlib/format_util.py | .py | 0bd23b415cffb55e | 7.56 | 12 |
import copy
import logging
import os
import sys
import tempfile
from pathlib import Path
from typing import Dict, Optional, Sequence
from artcommonlib import constants, exectools
from artcommonlib import util as art_util
from artcommonlib.github_auth import get_github_git_auth_env
from artcommonlib.lock import get_nam... | openshift-eng/art-tools | artcommon/artcommonlib/git_helper.py | .py | 5ac1b0f6fa1e6e2e | 7.56 | 12 |
"""
GitHub App authentication helpers for art-tools.
Primary API -- org-aware client with PAT fallback:
from artcommonlib.github_auth import get_github_client_for_org
client = get_github_client_for_org("openshift-eng")
# auto-discovers installation ID for the org, caches clients per-org
# falls back to... | openshift-eng/art-tools | artcommon/artcommonlib/github_auth.py | .py | 813227764f4fabeb | 7.56 | 12 |
"""
GitLab client for ART tools.
"""
import os
from logging import getLogger
from urllib.parse import urlparse
import gitlab
logger = getLogger(__name__)
class GitLabClient:
"""
GitLab client for ART tools.
Provides high-level operations for managing merge requests and CI pipelines.
"""
def __... | openshift-eng/art-tools | artcommon/artcommonlib/gitlab.py | .py | 144b9c7815e6013f | 7.56 | 12 |
#!/usr/bin/env python3
"""
Centralized JIRA configuration for all ART tools (doozer, elliott, pyartcd).
This module provides a single source of truth for JIRA-related URLs and settings.
When migrating between JIRA instances (e.g., from issues.redhat.com to Atlassian Cloud),
only this file needs to be updated.
Enviro... | openshift-eng/art-tools | artcommon/artcommonlib/jira_config.py | .py | 418783846c73550f | 7.56 | 12 |
import logging
from typing import Dict, List
from artcommonlib.konflux.konflux_build_record import KonfluxBuildRecord
from doozerlib import brew
class PackageRpmFinder:
"""
This class serves a cache, mapping package names as they are listed in a Konflux build record
to a list of Brew RPMs. During a Konfl... | openshift-eng/art-tools | artcommon/artcommonlib/konflux/package_rpm_finder.py | .py | 6f858ca2674d9470 | 7.56 | 12 |
import logging
import re
class EntityLoggingAdapter(logging.LoggerAdapter):
def process(self, msg, kwargs):
return '[%s] %s' % (self.extra['entity'], msg), kwargs
class RedactingFilter(logging.Filter):
"""A filter to remove sensitive information like passwords, tokens, and keys from logs
https:/... | openshift-eng/art-tools | artcommon/artcommonlib/logutil.py | .py | 8acf616b8bb149f1 | 7.56 | 12 |
"""
This file contains the definition of a class that can be used like shell
pushd and popd.
The Dir object is a context_manager that can be used with the Python 'with'
clause. The context manager idiom allows the user to execute some commands
in a working directory other than the CWD and return without needing to
ex... | openshift-eng/art-tools | artcommon/artcommonlib/pushd.py | .py | 5601df7395a7d065 | 7.56 | 12 |
"""
Download ASCT+B table as JSON and extract its date and version
"""
import argparse
import json
from ast import literal_eval
import requests
API_SHEET_CONFIG = "https://apps.humanatlas.io/api/v1/asctb-sheet-config"
API_URL_GSHEET_CSV = (
"https://docs.google.com/spreadsheets/d/{sheetId}/export?format=csv"
)
A... | hubmapconsortium/ccf-validation-tools | src/download_resource.py | .py | 7d87bc5cf8f58692 | 7.42 | 6 |
"""
Description: This script is used to query the Human Reference Atlas (HRA)
SPARQL endpoint to get the 3D images of the reference organs.
"""
import pandas as pd
from rdflib.graph import ConjunctiveGraph
from SPARQLWrapper import JSON, RDFXML, SPARQLWrapper
REF_ORGAN_BASE_URI = "https://purl.humanatlas.io/ref-organ/... | hubmapconsortium/ccf-validation-tools | src/hra_wrapper.py | .py | f8b944bc23f24bd1 | 7.42 | 6 |
import logging
import pandas as pd
from rdflib.graph import ConjunctiveGraph
from ccf_tools import add_rows, chunks, split_terms, transform_to_str
from uberongraph_tools import UberonGraph
# logger = logging.getLogger('ASCT-b Tables Log')
# olabel slabel o s
# 0 kidney ... | hubmapconsortium/ccf-validation-tools | src/template_generation_tools.py | .py | 60b20d2f770078a1 | 7.42 | 6 |
"""Generate the API reference tree under /reference/.
Walks the popoto source tree under ``src/popoto`` and emits one virtual
mkdocstrings stub page per importable module. mkdocstrings then renders each
module from its docstrings at build time, respecting ``__all__`` declarations.
Skip rules:
* ``__pycache__`` di... | tomcounsell/popoto | docs/scripts/gen_api_pages.py | .py | 2009f764b91ebda2 | 7.5 | 9 |
"""Main Popoto Kitchen TUI Application.
A terminal-based demo showcasing Popoto Redis ORM capabilities
through an interactive food delivery system interface.
"""
from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import Footer, Header, TabbedContent, TabPane
from .scr... | tomcounsell/popoto | examples/popoto_kitchen/app.py | .py | 7396b1b51d3af8f1 | 7.5 | 9 |
"""Food delivery domain models for Popoto Kitchen demo.
These models demonstrate all major Popoto features:
- KeyField, AutoKeyField, UniqueKeyField
- SortedField for range queries
- GeoField for location-based queries
- Relationship for model associations
- DatetimeField with auto timestamps
- Model Meta options (ttl... | tomcounsell/popoto | examples/popoto_kitchen/models.py | .py | 3d313254090e4a59 | 7.5 | 9 |
"""Operational workflow demos for Popoto Kitchen.
Demonstrates v1.4.4 features that are useful for production operations:
- get_many() for bulk-loading instances in a single pipeline call
- check_indexes() for read-only index health checks
- clean_indexes() for removing orphaned index entries
- get_data_hash_key() for... | tomcounsell/popoto | examples/popoto_kitchen/operations.py | .py | a56a087d7fec7bda | 7.5 | 9 |
"""Dashboard screen showing overview statistics and recent activity."""
from textual.app import ComposeResult
from textual.containers import Container, Horizontal
from textual.widgets import Button, DataTable, Label, Static
from ..models import Customer, Driver, MenuItem, Order, Restaurant
class StatBox(Static):
... | tomcounsell/popoto | examples/popoto_kitchen/screens/dashboard.py | .py | 9c164bfcc8e98d5d | 7.5 | 9 |
"""Drivers screen with location tracking and availability management."""
from textual.app import ComposeResult
from textual.containers import Container, Horizontal
from textual.widgets import Button, DataTable, Input, Label, Select, Static
from ..models import Driver
class DriversScreen(Container):
"""Driver ma... | tomcounsell/popoto | examples/popoto_kitchen/screens/drivers.py | .py | 42c2edf3741833f3 | 7.5 | 9 |
"""Menu screen with price filtering and restaurant relationship display."""
from textual.app import ComposeResult
from textual.containers import Container, Horizontal
from textual.widgets import Button, DataTable, Input, Label, Select, Static
from ..models import CATEGORIES, MenuItem, Restaurant
class MenuScreen(Co... | tomcounsell/popoto | examples/popoto_kitchen/screens/menu.py | .py | fc107837ae5a19c9 | 7.5 | 9 |
"""Orders screen with status management and driver assignment."""
from textual.app import ComposeResult
from textual.containers import Container, Horizontal
from textual.widgets import Button, DataTable, Input, Label, Select, Static
from ..models import Customer, Driver, Order, Restaurant
class OrdersScreen(Contain... | tomcounsell/popoto | examples/popoto_kitchen/screens/orders.py | .py | b3dc116592a2ee84 | 7.5 | 9 |
"""Seed script to populate the database with sample data.
Generates:
- 100 restaurants across 10 cuisines
- 1,000 menu items (10 per restaurant)
- 500 customers
- 50 drivers with random locations
- 2,000 orders (mix of statuses)
- 100 review scores with confidence signals (v1.4.4)
"""
import random
from datetime impo... | tomcounsell/popoto | examples/popoto_kitchen/seed.py | .py | ef7bd41a14e99474 | 7.5 | 9 |
"""Hermes hook handler for Popoto subconscious memory.
Hermes is the only harness in scope whose hooks are Python, so this runs
in-process: no subprocess, no interpreter startup, just the Redis round trip.
The service is built once and reused for the life of the gateway.
Copy this file and ``HOOK.yaml`` into ``~/.her... | tomcounsell/popoto | plugins/hermes/handler.py | .py | ee2c55d5da293564 | 7.5 | 9 |
"""
Embedding providers for Popoto EmbeddingField.
This module provides the AbstractEmbeddingProvider interface and built-in
provider implementations for generating text embeddings via external APIs.
Providers are pluggable -- configure a default via popoto.configure() or
pass a provider instance directly to Embeddin... | tomcounsell/popoto | src/popoto/embeddings/__init__.py | .py | d3b5a7c1cb201cd2 | 7.5 | 9 |
"""
Ollama embedding provider.
Wraps a locally-running Ollama server behind the AbstractEmbeddingProvider
interface. Uses only the Python standard library (urllib.request) -- no
additional dependencies required.
Ollama runs locally and requires:
- An Ollama server running (``ollama serve``)
- The embedding mo... | tomcounsell/popoto | src/popoto/embeddings/ollama.py | .py | 80547bf1403c492d | 7.5 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.