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 |
|---|---|---|---|---|---|---|
from setuptools import setup
import os
def is_package(path):
return (
os.path.isdir(path) and
os.path.isfile(os.path.join(path, '__init__.py'))
)
def find_packages(path, base="" ):
""" Find all packages in path """
packages = {}
for item in os.listdir(path):
dir = os... | bcgov/lear | colin-api/setup.py | .py | 7a6545c62a71023a | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/__init__.py | .py | a7369720a5cb2809 | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/config.py | .py | 150bd3fb680459be | 7.66 | 20 |
# Copyright © 2023 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/errorhandlers.py | .py | 08eadc4707e50751 | 7.66 | 20 |
# Copyright © 2026 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/models/business_snapshot.py | .py | 0ae66ed9e5fdb166 | 7.66 | 20 |
# Copyright © 2024 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/models/cont_out.py | .py | cf3ae3960f32d47f | 7.66 | 20 |
# Copyright © 2024 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/models/corp_involved.py | .py | 6dfc39fc992221f4 | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/models/corp_name.py | .py | e2ba9a70165291cc | 7.66 | 20 |
# Copyright © 2024 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/models/jurisdiction.py | .py | d04eaec68eddeb10 | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/models/office.py | .py | 3a5e6ad788678ede | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/resources/db.py | .py | 4c9cde7be0b77867 | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/resources/event.py | .py | 875437b7c5e8ec07 | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/resources/office.py | .py | c066312c611f3e0d | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/resources/ops.py | .py | 873c89c598439aef | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/resources/parties.py | .py | 1f9a4146767ac727 | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/resources/reset.py | .py | 84d5fab2220c151a | 7.66 | 20 |
# Copyright © 2020 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/resources/share_struct.py | .py | aa92e6a1db185690 | 7.66 | 20 |
# Copyright © 2025 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/src/colin_api/services/account.py | .py | af519542144cd65b | 7.66 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/tests/conftest.py | .py | ba50bd42ec29ccce | 8.16 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/tests/unit/__init__.py | .py | 7d01cccf28086abc | 8.16 | 20 |
# Copyright © 2020 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/tests/unit/api/test_alteration.py | .py | 056eac9609a14547 | 7.16 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/tests/unit/api/test_ar.py | .py | 05609feb02c47d4d | 7.16 | 20 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | bcgov/lear | colin-api/tests/unit/api/test_business.py | .py | 0e83f14aee01e5c6 | 8.16 | 20 |
// Copyright 2021 Google 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 applicable law or agreed to in ... | googleapis/doc-pipeline | canonical/main_test.go | .go | 885bca914a6d9eae | 7.09 | 14 |
# Copyright 2020 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/doc-pipeline | docpipeline/generate.py | .py | 5692e1022a7fad1c | 7.59 | 14 |
// Copyright 2021 Google 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | googleapis/doc-pipeline | genrobots/main_test.go | .go | 36dc56323b0beab2 | 7.09 | 14 |
# Copyright 2020 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/doc-pipeline | tests/test_generate.py | .py | 953d2b637421fd6f | 7.09 | 14 |
#! /usr/bin/python3
"""
Diecast Remote Raceway - FinisLine
Interface for communication with the FinishLine over Bluetooth.
Author: Tom Quiggle
tquiggle@gmail.com
https://github.com/tquiggle/Die-Cast-Remote-Raceway
Copyright (c) Thomas Quiggle. All rights reserved.
Licensed under the MIT license. See LICENSE file i... | tquiggle/Diecast-Remote-Raceway | StartingGate/finishline.py | .py | 03d74943f42e8b75 | 7.5 | 9 |
#! /usr/bin/python3
"""
Diecast Remote Raceway - Input
The Input class implements text input using the Waveshare 1.3" LCD HAT joystick and keys.
Author: Tom Quiggle
tquiggle@gmail.com
https://github.com/tquiggle/Die-Cast-Remote-Raceway
Copyright (c) Thomas Quiggle. All rights reserved.
Licensed under the MIT licen... | tquiggle/Diecast-Remote-Raceway | StartingGate/input.py | .py | 2c4129b6a9f79e1e | 7.5 | 9 |
#!/usr/bin/python3
import bluetooth
import time
from gpiozero import *
NANOSECONDS_TO_SECONDS = 1000000000.0
target_name = "FinishLine"
target_address = None
port = 1
sock = None
nearby_devices = bluetooth.discover_devices()
for bdaddr in nearby_devices:
if target_name == bluetooth.lookup_name(bdaddr):
... | tquiggle/Diecast-Remote-Raceway | StartingGate/util/test.py | .py | 07b5bdf95906091f | 7 | 9 |
from django.conf import settings
from rest_framework.throttling import SimpleRateThrottle
class FrontendOriginThrottle(SimpleRateThrottle):
"""Generous quota for requests that appear to come from our own
frontend. Not a security mechanism (Origin/Referer are spoofable):
it only avoids penalizing normal si... | MTES-MCT/acceslibre | api/throttling.py | .py | 975740fd0cdd0e5c | 7.65 | 19 |
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.db.models import Q
# FIXME: move to core
class EmailOrUsernameModelBackend(ModelBackend):
"""https://stackoverflow.com/a/35836674/330911"""
def authenticate(self, request, username=None, password... | MTES-MCT/acceslibre | compte/auth.py | .py | 0f7410661982fc23 | 7.65 | 19 |
#!/usr/bin/env python3
# encoding: utf-8
"""
T3 executable module
"""
import argparse
import os
from arc.common import read_yaml_file
from t3 import T3
from t3.utils.dependencies import check_dependencies
def parse_command_line_arguments(command_line_args=None):
"""
Parse command-line arguments.
Args... | ReactionMechanismGenerator/T3 | T3.py | .py | 4c89b5b35f711236 | 7.59 | 14 |
"""
t3 pdep barrierless module
Which path reactions must never be sent to a transition-state search.
A barrierless reaction has no saddle point on its potential energy surface, so a TS search for it
cannot succeed no matter how many adapters are tried or how long they run. The group's own
reference note is unambiguou... | ReactionMechanismGenerator/T3 | t3/pdep/barrierless.py | .py | 0f61a2f7b814b23d | 7.59 | 14 |
"""
t3 pdep hashing module
The one home for T3's content-hash format for PDep artifacts.
Everything T3 records as provenance -- the SA cache sidecar's ``network_file_hash`` and
``sa_file_hash``, the join sidecar's ``source_sha256``, a captured network's vendored digest, and a
``PDepNetworkSelection``'s ``network_sour... | ReactionMechanismGenerator/T3 | t3/pdep/hashing.py | .py | d62ea8bac28a692e | 7.59 | 14 |
"""
t3 pdep me_success module
Decides whether a completed Arkane pressure-dependence (ME, master equation) job's
``output.py`` represents a genuine ME solve, as opposed to a hard crash or a soft failure that
Arkane itself silently accepts as "successful" (exit code 0, empty stderr) while writing out a
kinetics result ... | ReactionMechanismGenerator/T3 | t3/pdep/me_success.py | .py | 8684ab5901f5a7ac | 7.59 | 14 |
"""
t3 pdep provenance module
Classify WHERE the energy of a stationary point on a P-dep surface came from, so T3's PES diagram
can colour every level by the trustworthiness of its energy rather than by its type. Four
provenance classes, ordered by decreasing confidence:
1. ``PROVENANCE_QM`` -- computed by quant... | ReactionMechanismGenerator/T3 | t3/pdep/provenance.py | .py | 13c6ea188a0fd9bf | 7.59 | 14 |
"""
t3 pdep yaml_safe module
A restricted YAML loader for reading Arkane sensitivity-analysis (SA) YAML files.
Arkane's PDep sensitivity output tags its ``(T, 'K', P, 'bar')`` condition keys with
``!!python/tuple``, so the file cannot be parsed by a plain ``yaml.SafeLoader``. T3's in-run path
reads it with ``arc.comm... | ReactionMechanismGenerator/T3 | t3/pdep/yaml_safe.py | .py | a4b5eedb8566cf50 | 7.59 | 14 |
import copy
import logging
import numpy as np
import warnings
from typing import Optional, Union
from autoarray import exc
from autoarray.mask.mask_1d import Mask1D
from autoarray.mask.mask_2d import Mask2D
from autoarray.structures.abstract_structure import Structure
from autoarray.structures.arrays.uniform_2d import... | PyAutoLabs/PyAutoArray | autoarray/dataset/abstract/dataset.py | .py | f069bcacceb68a8b | 7.52 | 10 |
from typing import Optional, Union
from autoarray.mask.mask_2d import Mask2D
from autoarray.structures.arrays.uniform_2d import Array2D
from autoarray.operators.convolver import Convolver
from autoarray.structures.grids.uniform_2d import Grid2D
from autoarray.inversion.mesh.border_relocator import BorderRelocator
fr... | PyAutoLabs/PyAutoArray | autoarray/dataset/grids.py | .py | c8116dcbfab05412 | 7.52 | 10 |
import logging
import numpy as np
from typing import Optional, Union
from autoarray.dataset.imaging.dataset import Imaging
from autoarray.structures.arrays.uniform_2d import Array2D
from autoarray.operators.convolver import Convolver
from autoarray.mask.mask_2d import Mask2D
from autoarray import exc
from autoarray.d... | PyAutoLabs/PyAutoArray | autoarray/dataset/imaging/simulator.py | .py | b9894e5f9c24c8b2 | 7.52 | 10 |
import numpy as np
from autoarray.dataset.interferometer.dataset import Interferometer
from autoarray.operators.transformer import TransformerDFT
from autoarray.structures.visibilities import VisibilitiesNoiseMap
from autoarray import exc
from autoarray.dataset import preprocess
_INTERFEROMETER_PYTREES_REGISTERED = ... | PyAutoLabs/PyAutoArray | autoarray/dataset/interferometer/simulator.py | .py | 3e20038f04aa16eb | 7.52 | 10 |
from autoarray.structures.grids.uniform_2d import Grid2D
from autoarray.dataset.grids import GridsInterface
class MockDataset:
"""
A lightweight mock dataset for use in tests and unit testing fixtures.
Provides a minimal dataset-like interface with `grids`, `psf` and `mask` attributes,
without any re... | PyAutoLabs/PyAutoArray | autoarray/dataset/mock/mock_dataset.py | .py | b16879d3a23353ee | 7.52 | 10 |
import numpy as np
from autoarray.dataset.imaging.dataset import Imaging
from autoarray.dataset.dataset_model import DatasetModel
from autoarray.fit.fit_dataset import FitDataset
from autoarray.structures.arrays.uniform_2d import Array2D
from autoarray import type as ty
class FitImaging(FitDataset):
def __init_... | PyAutoLabs/PyAutoArray | autoarray/fit/fit_imaging.py | .py | 5bd30f2da8ecdbda | 7.52 | 10 |
import numpy as np
from autoarray.dataset.interferometer.dataset import Interferometer
from autoarray.dataset.dataset_model import DatasetModel
from autoarray.structures.arrays.uniform_2d import Array2D
from autoarray.structures.visibilities import Visibilities
from autoarray.fit.fit_dataset import FitDataset
from a... | PyAutoLabs/PyAutoArray | autoarray/fit/fit_interferometer.py | .py | 9c13e818a2cee5ea | 7.52 | 10 |
import numpy as np
from typing import Tuple
class AbstractGeometry2D:
@property
def extent(self) -> Tuple[float, float, float, float]:
"""
The extent of the 2D geometry in scaled units, returned as (x_min, x_max, y_min, y_max).
This format matches the ``extent`` argument of ``matplotl... | PyAutoLabs/PyAutoArray | autoarray/geometry/abstract_2d.py | .py | 150697817b6c8e65 | 7.52 | 10 |
from __future__ import annotations
import logging
from typing import Tuple
from autoarray import type as ty
logging.basicConfig()
logger = logging.getLogger(__name__)
class Geometry1D:
def __init__(
self,
shape_native: Tuple[int],
pixel_scales: ty.PixelScales,
origin: Tuple[float... | PyAutoLabs/PyAutoArray | autoarray/geometry/geometry_1d.py | .py | 5ff717f090288f47 | 7.52 | 10 |
from typing import Tuple
from autoarray.geometry.abstract_2d import AbstractGeometry2D
class Geometry2DIrregular(AbstractGeometry2D):
def __init__(
self,
shape_native_scaled: Tuple[float, float],
scaled_maxima: Tuple[float, float],
scaled_minima: Tuple[float, float],
):
... | PyAutoLabs/PyAutoArray | autoarray/geometry/geometry_2d_irregular.py | .py | 3fe249b7ef2bec71 | 7.52 | 10 |
import numpy as np
from typing import Dict, List, Union, Type
from autonerves import cached_property
from autoarray.dataset.imaging.dataset import Imaging
from autoarray.inversion.inversion.dataset_interface import DatasetInterface
from autoarray.inversion.linear_obj.func_list import AbstractLinearObjFuncList
from au... | PyAutoLabs/PyAutoArray | autoarray/inversion/inversion/imaging/abstract.py | .py | 58b9740fd2718753 | 7.52 | 10 |
import numpy as np
from typing import Dict, List, Optional, Union
from autonerves import cached_property
from autoarray.dataset.imaging.dataset import Imaging
from autoarray.inversion.inversion.dataset_interface import DatasetInterface
from autoarray.inversion.inversion.imaging.abstract import AbstractInversionImagin... | PyAutoLabs/PyAutoArray | autoarray/inversion/inversion/imaging/mapping.py | .py | 9dedf36768e86194 | 7.52 | 10 |
"""
Microsoft Azure identity/auth support.
See:
https://azuresdkdocs.blob.core.windows.net/$web/python/azure-identity/1.12.0/index.html
https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python
https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identit... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/azure_auth.py | .py | f8031b0f0ba8c9f1 | 7.48 | 8 |
import os
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
from typing import Optional, Union
from getm import default_chunk_size
from getm.concurrent.collections import ConcurrentHeap
from terra_notebook_utils.blobstore.gs import GSBlobStore, GSBlob
from terra_notebook_utils.blobstore.url im... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/blobstore/copy_client.py | .py | 78d34678e806113b | 7.48 | 8 |
"""
Configure the CLI
"""
import typing
import argparse
from terra_notebook_utils.cli import CLIConfig, dispatch
config_cli = dispatch.group("config", help=__doc__)
@config_cli.command("set-workspace", arguments={
"workspace": dict()
})
def set_config_workspace(args: argparse.Namespace):
"""
Set worksp... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/cli/commands/config.py | .py | 052a1c22734d5699 | 7.48 | 8 |
import sys
import json
import argparse
from typing import Any, Dict
from terra_notebook_utils import drs
from terra_notebook_utils.cli import dispatch, CLIConfig
from terra_notebook_utils.drs import DRSResolutionError
drs_cli = dispatch.group("drs", help=drs.__doc__)
workspace_args: Dict[str, Dict[str, Any]] = {
... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/cli/commands/drs.py | .py | bcc4195596f88c93 | 7.48 | 8 |
import json
import argparse
from uuid import uuid4
from terra_notebook_utils import table as tnu_table
from terra_notebook_utils.cli import dispatch, CLIConfig
table_cli = dispatch.group("table", help=tnu_table.__doc__, arguments={
"--workspace": dict(
type=str,
default=None,
help="worksp... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/cli/commands/table.py | .py | 2c9d152f4fb8164b | 7.48 | 8 |
import json
import argparse
from terra_notebook_utils import vcf, WORKSPACE_GOOGLE_PROJECT
from terra_notebook_utils.cli import dispatch
from terra_notebook_utils.drs import blob_for_url
vcf_cli = dispatch.group("vcf", help=vcf.__doc__, arguments={
"path": dict(
help="local path, gs://, or drs://"
),... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/cli/commands/vcf.py | .py | f9053a1d9ee135c1 | 7.48 | 8 |
import json
import typing
import argparse
from firecloud import fiss
from terra_notebook_utils import workspace
from terra_notebook_utils.cli import CLIConfig, dispatch
workspace_cli = dispatch.group("workspace", help=workspace.__doc__)
@workspace_cli.command("list")
def list_workspaces(args: argparse.Namespace):... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/cli/commands/workspace.py | .py | bebf1beb7da30ca1 | 7.48 | 8 |
from math import ceil
SECOND = 1.0
MINUTE = SECOND * 60
HOUR = MINUTE * 60
DAY = HOUR * 24
MONTH = DAY * 30.437 # Not critical to be exact
class PersistentDisk:
"""GCP persistent disk costs: https://cloud.google.com/compute/disks-image-pricing#persistentdisk"""
standard = 0.04 / MONTH # GCP disk prices are... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/costs.py | .py | f2b83699521d5994 | 7.48 | 8 |
"""
Support for auth with Terra backend services.
"""
from azure.core.exceptions import ClientAuthenticationError
from google.auth.exceptions import DefaultCredentialsError
from terra_notebook_utils import azure_auth, gs, ExecutionPlatform
from terra_notebook_utils.logger import logger
from terra_notebook_utils.utils ... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/terra_auth.py | .py | f619e385e3391582 | 7.48 | 8 |
import json
import os
import threading
from functools import lru_cache
from concurrent.futures import ThreadPoolExecutor, Future, as_completed
from typing import Any, Callable, Dict, Optional, Iterable, Set
import jmespath
from terra_notebook_utils import ExecutionEnvironment, ExecutionPlatform, ExecutionContext
cl... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/utils.py | .py | e7f0c382cd62f2f8 | 7.48 | 8 |
"""Workspace information and operations."""
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import List, Optional
from firecloud import fiss
from terra_notebook_utils import gs, WORKSPACE_BUCKET, WORKSPACE_NAME
def get_workspace(workspace: Optional[str]=WORKSPACE_NAME, namespace: Optiona... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/workspace.py | .py | bce78f3ccbef731f | 7.48 | 8 |
import time
from contextlib import AbstractContextManager
class profile(AbstractContextManager):
"""Profile methods or code blocks with decorators or contexts, respectively.
@profile("profiling my method")
def my_method(*args, **kwargs):
...
with profile("profiling my block"):
...
"... | DataBiosphere/terra-notebook-utils | terra_notebook_utils/xprofile.py | .py | 6541c00f8aabd26c | 7.48 | 8 |
#!/usr/bin/env python
"""
Test auth for Terra running on Microsoft Azure.
Ideally tests should be run in a Terra Azure workspace.
Unit test this module by mocking as needed to run in a generic context.
"""
import os
import sys
import unittest
from unittest import mock
from unittest.mock import patch
from collections im... | DataBiosphere/terra-notebook-utils | tests/test_azure_auth.py | .py | 97e1ab3f4e694e9d | 7.98 | 8 |
# SPDX-License-Identifier: MIT
import functools
import types
from ._make import _make_ne
_operation_names = {"eq": "==", "lt": "<", "le": "<=", "gt": ">", "ge": ">="}
def cmp_using(
eq=None,
lt=None,
le=None,
gt=None,
ge=None,
require_same_type=True,
class_name="Comparable",
):
""... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/attr/_cmp.py | .py | dee987881b60b046 | 7.48 | 8 |
# SPDX-License-Identifier: MIT
import inspect
import platform
import sys
import threading
from collections.abc import Mapping, Sequence # noqa: F401
from typing import _GenericAlias
PYPY = platform.python_implementation() == "PyPy"
PY_3_8_PLUS = sys.version_info[:2] >= (3, 8)
PY_3_9_PLUS = sys.version_info[:2] >= ... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/attr/_compat.py | .py | 9f6524ddcfb2c2fd | 7.48 | 8 |
# SPDX-License-Identifier: MIT
__all__ = ["set_run_validators", "get_run_validators"]
_run_validators = True
def set_run_validators(run):
"""
Set whether or not validators are run. By default, they are run.
.. deprecated:: 21.3.0 It will not be removed, but it also will not be
moved to new ``a... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/attr/_config.py | .py | cfcd55b7e19e4ffd | 7.48 | 8 |
# SPDX-License-Identifier: MIT
from functools import total_ordering
from ._funcs import astuple
from ._make import attrib, attrs
@total_ordering
@attrs(eq=False, order=False, slots=True, frozen=True)
class VersionInfo:
"""
A version object that can be compared to tuple of length 1--4:
>>> attr.Version... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/attr/_version_info.py | .py | 7b14aa6f76f913e7 | 7.48 | 8 |
# SPDX-License-Identifier: MIT
"""
Commonly useful converters.
"""
import typing
from ._compat import _AnnotationExtractor
from ._make import NOTHING, Factory, pipe
__all__ = [
"default_if_none",
"optional",
"pipe",
"to_bool",
]
def optional(converter):
"""
A converter that allows an att... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/attr/converters.py | .py | bcd6b9f29662f55e | 7.48 | 8 |
"""
certifi.py
~~~~~~~~~~
This module returns the installation location of cacert.pem or its contents.
"""
import sys
import atexit
def exit_cacert_ctx() -> None:
_CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr]
if sys.version_info >= (3, 11):
from importlib.resources import as_file, file... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/certifi/core.py | .py | a910c31725d52704 | 7.48 | 8 |
import importlib
from codecs import IncrementalDecoder
from collections import Counter, OrderedDict
from functools import lru_cache
from typing import Dict, List, Optional, Tuple
from .assets import FREQUENCIES
from .constant import KO_NAMES, LANGUAGE_SUPPORTED_COUNT, TOO_SMALL_SEQUENCE, ZH_NAMES
from .md import is_su... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/charset_normalizer/cd.py | .py | 6bd2b3cddf6d1e5f | 7.48 | 8 |
import warnings
from collections import Counter
from encodings.aliases import aliases
from hashlib import sha256
from json import dumps
from re import sub
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
from .constant import NOT_PRINTABLE_PATTERN, TOO_BIG_SEQUENCE
from .md import mess_ratio
from .... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/charset_normalizer/models.py | .py | 5eb1a95717e89e17 | 7.48 | 8 |
#
# Copyright 2025 Splunk Inc.
#
# 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... | hRun/SA-haveibeenpwned | bin/sa_haveibeenpwned/aob_py3/cloudconnectlib/client.py | .py | 00d8596c070322bd | 7.48 | 8 |
"""grafana_metadata.
This library implements endpoint wrappers for the grafana-metadata interface. The grafana-metadata interface is used to
transfer information about an instance of Grafana, such as how to access and uniquely identify it. Typically, this is
useful for charms that operate a Grafana instance to give ... | canonical/grafana-k8s-operator | lib/charms/grafana_k8s/v0/grafana_metadata.py | .py | 7d67fca3bf0cab14 | 7.56 | 12 |
# Copyright 2026 Canonical
# See LICENSE file for licensing details.
"""Validation for custom ("extra") ini sections."""
import configparser
import re
from typing import Callable, Literal, Optional
from pydantic import BaseModel, ConfigDict, EmailStr, ValidationError
class _SMTPSection(BaseModel):
"""SMTP serv... | canonical/grafana-k8s-operator | src/custom_ini_config.py | .py | 5849d8dfb5dfa811 | 7.56 | 12 |
# Copyright 2021 Canonical 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 ... | canonical/grafana-k8s-operator | src/grafana_client.py | .py | 4e2d25127bd90741 | 7.56 | 12 |
# Copyright 2025 Canonical
# See LICENSE file for licensing details.
"""Grafana config generator."""
import configparser
import logging
from io import StringIO
from typing import Any, Callable, Dict, Optional
import yaml
from charms.hydra.v0.oauth import OauthProviderConfig
from ops import ActiveStatus, BlockedStatus... | canonical/grafana-k8s-operator | src/grafana_config.py | .py | 55382ead77ca4207 | 7.56 | 12 |
# Copyright 2025 Canonical
# See LICENSE file for licensing details.
"""Data models class."""
import dataclasses
from typing import Callable, List, Optional
@dataclasses.dataclass
class TLSConfig:
"""TLS config model."""
certificate: str
key: str
ca: str
@dataclasses.dataclass
class DatasourceConfig... | canonical/grafana-k8s-operator | src/models.py | .py | f129ddfe5b4dc7e8 | 7.56 | 12 |
# Copyright 2025 Canonical
# See LICENSE file for licensing details.
"""Relation class."""
import json
from typing import Any, Optional
import ops
class Relation:
"""A helper class to manage relation data."""
def __init__(self, app:ops.Application, relation: Optional[ops.Relation]):
self._relation = r... | canonical/grafana-k8s-operator | src/relation.py | .py | e6d526cb865ed87d | 7.56 | 12 |
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""A class to manage a secret for securely storing data between peers."""
import logging
import secrets
import string
from typing import Optional, Callable, Dict
import ops
logger = logging.getLogger()
def generate_password() -> str:
""... | canonical/grafana-k8s-operator | src/secret_storage.py | .py | 365a7e968c5d58ed | 7.56 | 12 |
#!/usr/bin/env python3
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
"""A Juju secrets getter for sensitive data."""
import logging
from typing import Optional
from urllib.parse import urlparse
import ops
logger = logging.getLogger(__name__)
class SecretError(Exception):
"""Raised ... | canonical/grafana-k8s-operator | src/secrets_helper.py | .py | 545bb328b023bbc7 | 7.56 | 12 |
#!/usr/bin/env python3
# Copyright 2021 Canonical Ltd.
# See LICENSE file for licensing details.
import functools
import logging
import os
import shutil
from collections import defaultdict
from datetime import datetime
from pathlib import Path
import juju.utils
import pytest
from playwright.async_api import Playwright... | canonical/grafana-k8s-operator | tests/integration/conftest.py | .py | e813faadbc1dba31 | 8.06 | 12 |
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
r"""# Interface Library for ingress_per_unit.
This library wraps relation endpoints using the `ingress_per_unit` interface
and provides a Python API for both requesting and providing per-unit
ingress.
## Getting Started
To get started using t... | canonical/grafana-k8s-operator | tests/integration/grafana-tester/lib/charms/traefik_k8s/v1/ingress_per_unit.py | .py | d1f690afb5b95456 | 7.06 | 12 |
#!/usr/bin/env python3
# Copyright 2021 Canonical Ltd.
# See LICENSE file for licensing details.
"""A Charm to functionally test the Grafana Operator."""
import logging
from typing import cast
from charms.grafana_k8s.v1.grafana_source import GrafanaSourceProvider
from charms.grafana_k8s.v0.grafana_auth import Grafan... | canonical/grafana-k8s-operator | tests/integration/grafana-tester/src/charm.py | .py | a6659968befc71b3 | 8.06 | 12 |
#!/usr/bin/env python3
# Copyright 2021 Canonical Ltd.
# See LICENSE file for licensing details.
import json
import logging
from pathlib import Path
from typing import Optional, Tuple
import requests
import yaml
from asyncstdlib import functools
from pytest_operator.plugin import OpsTest
from urllib.parse import urlpa... | canonical/grafana-k8s-operator | tests/integration/helpers.py | .py | 232bae71c6f5bc98 | 7.06 | 12 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""Integration test to verify that dashboard relation doesn't cause continuous databag updates.
This test reproduces the issue documented in:
https://github.com/canonical/opentelemetry-collector-operator/issues/331
The p... | canonical/grafana-k8s-operator | tests/integration/test_dashboard_relation_stability.py | .py | 4782fbf38153a773 | 8.06 | 12 |
#!/usr/bin/env python3
# Copyright 2021 Canonical Ltd.
# See LICENSE file for licensing details.
"""Integration tests for the grafana-source relation.
This module covers both the basic grafana-source relation interface and the datasource
topology matrix (issue #49).
Matrix: 2 ingress x 2 TLS x 2 scale x 2 mode = 16 ... | canonical/grafana-k8s-operator | tests/integration/test_grafana_source.py | .py | 0d2b5f249db4c835 | 8.06 | 12 |
import xarray as xr
import logging
import os
import re
import cftime as cft
import logging as log
from collections import OrderedDict
from mom6_tools.DiagsCase import DiagsCase
class ClimoGenerator(object,):
""" A class to generate climatology and average datasets
Attributes
----------
fields
... | NCAR/mom6-tools | mom6_tools/ClimoGenerator.py | .py | 2457adc49abbd800 | 7.62 | 16 |
import xarray as xr
# -- return MOM6 grid object
def MOM6grid(grd_file, geom_file, xrformat=False):
"""
Return an object or xarray Dataset with the MOM6 grid data.
Parameters
----------
grd_file : str
Path to the static file.
geom_file : str
Override the coordinates in grd_file using ... | NCAR/mom6-tools | mom6_tools/MOM6grid.py | .py | 0483c525331c146d | 7.62 | 16 |
from __future__ import unicode_literals
import numpy as np
from numpy import ma
import matplotlib
from matplotlib import scale as mscale
from matplotlib import transforms as mtransforms
from matplotlib.ticker import Formatter, FixedLocator, MaxNLocator, AutoLocator
mpl_version = str(matplotlib.__version__).split('.')... | NCAR/mom6-tools | mom6_tools/VerticalSplitScale.py | .py | 012631964f3c0c41 | 7.62 | 16 |
#!/usr/bin/env python
import io, yaml, os
import matplotlib.pyplot as plt
import numpy as np
import warnings, dask, netCDF4, intake
from datetime import datetime, date
import xarray as xr
from ncar_jobqueue import NCARCluster
from dask.distributed import Client
import momlevel as ml
from mom6_tools import m6plot
from ... | NCAR/mom6-tools | mom6_tools/aaiw_pv.py | .py | 5fd129e498ebded6 | 7.62 | 16 |
#!/usr/bin/env python
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import warnings, os, yaml, argparse
import pandas as pd
import dask
from datetime import datetime, date
from ncar_jobqueue import NCARCluster
from dask.distributed import Client
from mom6_tools.DiagsCase import DiagsCase
from ... | NCAR/mom6-tools | mom6_tools/bouyancy_flux.py | .py | 00cc4fffffb58247 | 7.62 | 16 |
#!/usr/bin/env python
import os
import yaml
import xarray as xr
import numpy as np
import glob
import textwrap
import re
import subprocess
import nbformat
import argparse, warnings
from datetime import datetime
from ncar_jobqueue import NCARCluster
from dask.distributed import Client
from mom6_tools.m6toolbox import w... | NCAR/mom6-tools | mom6_tools/compute_basin_reductions.py | .py | 5ac4ecac6f77ce4b | 7.62 | 16 |
#!/usr/bin/env python
'''
Create directory and template yaml file for a new case to be processed using mom6_tools.
'''
import os, yaml
from mom6_tools.DiagsCase import DiagsCase
import socket
def options():
try: import argparse
except: raise Exception('This version of python is not new enough. python 2.7 or newer... | NCAR/mom6-tools | mom6_tools/create_cesm_diagnostic.py | .py | 70cca4398d5dee3e | 7.62 | 16 |
#!/usr/bin/env python
import os
import yaml
import xarray as xr
import numpy as np
import glob
import textwrap
import subprocess
import argparse, warnings
from datetime import datetime
from ncar_jobqueue import NCARCluster
from dask.distributed import Client
from mom6_tools.m6toolbox import weighted_temporal_mean_vars... | NCAR/mom6-tools | mom6_tools/create_climatology.py | .py | 4575740ac41b468c | 7.62 | 16 |
#!/usr/bin/env python
'''
Create directory and template yaml file for a new case to be processed using mom6_tools.
'''
import os, yaml
from mom6_tools.DiagsCase import DiagsCase
def options():
try: import argparse
except: raise Exception('This version of python is not new enough. python 2.7 or newer is required.'... | NCAR/mom6-tools | mom6_tools/create_mom6_tools.py | .py | f03c42201624154f | 7.62 | 16 |
#!/usr/bin/env python
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.interpolate import interp1d
import warnings, os, yaml, argparse, dask
from datetime import datetime
import gsw
from ncar_jobqueue import NCARCluster
from dask.distributed import Client
from ... | NCAR/mom6-tools | mom6_tools/dwbc.py | .py | d746f6e974d50721 | 7.62 | 16 |
#!/usr/bin/env python
import io, yaml, os
import matplotlib.pyplot as plt
import numpy as np
import warnings, dask, netCDF4, intake
from datetime import datetime, date
import xarray as xr
from ncar_jobqueue import NCARCluster
from dask.distributed import Client
import cftime
import nc_time_axis
import momlevel as ml
i... | NCAR/mom6-tools | mom6_tools/enso.py | .py | cc02abf1a6818b75 | 7.62 | 16 |
#!/usr/bin/env python
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import warnings, os, yaml, argparse
import pandas as pd
import dask, intake
from datetime import datetime, date
from ncar_jobqueue import NCARCluster
from dask.distributed import Client
from mom6_tools.DiagsC... | NCAR/mom6-tools | mom6_tools/equatorial_comparison.py | .py | 5c2b72e218661984 | 7.62 | 16 |
#!/usr/bin/env python
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import warnings, os, yaml, argparse
import pandas as pd
import dask
from datetime import datetime, date
from ncar_jobqueue import NCARCluster
from dask.distributed import Client
from mom6_tools.DiagsCase import DiagsCase
from ... | NCAR/mom6-tools | mom6_tools/forcing.py | .py | d49825b39ef7fb7d | 7.62 | 16 |
import copy
import os
import warnings
from glob import glob
from pathlib import Path
import dask
import kerchunk
import ujson
import xarray as xr
from kerchunk.combine import MultiZarrToZarr
from kerchunk.netCDF3 import NetCDF3ToZarr
def gen_ref(f, inline_threshold):
refs = NetCDF3ToZarr(f, inline_threshold=inli... | NCAR/mom6-tools | mom6_tools/kerchunk.py | .py | 11eb2e4b083079b2 | 7.62 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.