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 |
|---|---|---|---|---|---|---|
# test_utils.py
import hashlib
from client.ayon_usd import utils
def test_validate_file_checksum(file_info, tmp_path):
# Create a temporary file
file_path = tmp_path / file_info["filename"]
file_path.write_text("Hello, World!")
# Update the checksum to match the file's content
file_info["checksum... | ynput/ayon-usd | tests/client/ayon_usd/test_utils.py | .py | 8bf51e7c5f3d7beb | 7.06 | 12 |
import os
import random
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
class BaseDataset(Dataset):
"""Characterizes a dataset for PyTorch -- this dataset pre-loads all paths in memory"""
def __init__(self, data, transform, class_indices=None, name='cvc'):
"""Initializat... | gmum/ICICLE | src/datasets/base_dataset.py | .py | dfa31c5c9bb0fd77 | 7.5 | 9 |
import importlib
from argparse import ArgumentParser
from datasets.memory_dataset import MemoryDataset
class ExemplarsDataset(MemoryDataset):
"""Exemplar storage for approaches with an interface of Dataset"""
def __init__(self, transform, class_indices,
num_exemplars=0, num_exemplars_per_cl... | gmum/ICICLE | src/datasets/exemplars_dataset.py | .py | 8a2e647ea47d823a | 7.5 | 9 |
import random
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
class MemoryDataset(Dataset):
"""Characterizes a dataset for PyTorch -- this dataset pre-loads all images in memory"""
def __init__(self, data, transform, class_indices=None):
"""Initialization"""
self... | gmum/ICICLE | src/datasets/memory_dataset.py | .py | 47254279dc9769ce | 7.5 | 9 |
import importlib
from copy import deepcopy
from argparse import ArgumentParser
import utils
class GridSearch:
"""Basic class for implementing hyperparameter grid search"""
def __init__(self, appr_ft, seed, gs_config='gridsearch_config', acc_drop_thr=0.2, hparam_decay=0.5,
max_num_searches=7... | gmum/ICICLE | src/gridsearch.py | .py | a02296ea20887173 | 7.5 | 9 |
import os
import torch
import random
import numpy as np
cudnn_deterministic = True
def seed_everything(seed=0):
"""Fix all random seeds"""
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
torch.backend... | gmum/ICICLE | src/utils.py | .py | d2db1ff1e614a45f | 7.5 | 9 |
import jax
import jax.numpy as jnp
import pennylane as qml
import time
from datetime import datetime
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import matplotlib.ticker
import csv
import numpy as np
import logging
from qml_essentials.jaqsi import (
Script,
)
from qml_essentials.operations im... | cirKITers/qml-essentials | docs/benchmarks.py | .py | 928b846465776b22 | 7.45 | 7 |
from typing import List, Union, Callable
from contextlib import contextmanager
import numbers
import jax.numpy as jnp
import jax
# Imports to keep the api `from gates import ...`
from qml_essentials.unitary import UnitaryGates
from qml_essentials.pulses import (
PulseGates,
PulseParams,
PulseEnvelope, # n... | cirKITers/qml-essentials | qml_essentials/gates.py | .py | 092369d9ce23677e | 7.45 | 7 |
"""Pulse/gate-independent entry point for building and simulating circuits.
This module is the main interaction point for manually creating circuits. It
exposes the :class:`~qml_essentials.script.Script` circuit container, the
:func:`Hamiltonian` factory for time-evolution sources, and a few general
(pulse/gate-indep... | cirKITers/qml-essentials | qml_essentials/jaqsi.py | .py | 7de1075f8d8a14d2 | 7.45 | 7 |
"""Memory estimation and memory-aware batch chunking.
These helpers let :class:`~qml_essentials.script.Script` decide whether a batched
simulation fits in available RAM and, if not, split it into chunks that do. They
are pure functions (the estimates are plain Python arithmetic) so they add
essentially zero overhead ... | cirKITers/qml-essentials | qml_essentials/memory.py | .py | 6015d138cc358a22 | 7.45 | 7 |
"""Pauli-Clifford circuit transform for the Fourier-tree algorithm.
This module hosts :class:`PauliCircuit`, which transpiles a circuit into the
*canonical Pauli-Clifford normal form* used by the Nemkov et al. algorithm: all
Clifford gates are commuted to the end and absorbed into the observable, leaving
a sequence of... | cirKITers/qml-essentials | qml_essentials/pauli.py | .py | 89ef7e75dbf5f7a5 | 7.45 | 7 |
"""Pure simulation and measurement kernels for :class:`~qml_essentials.script.Script`.
These functions are stateless: they take a recorded tape (a list of
:class:`~qml_essentials.operations.Operation`) plus measurement parameters and
return JAX arrays. Keeping them as module-level free functions (rather than
static m... | cirKITers/qml-essentials | qml_essentials/simulation.py | .py | 6291900f53a04d2d | 7.45 | 7 |
from __future__ import annotations
import threading
from contextlib import contextmanager
from typing import TYPE_CHECKING, Callable, Iterator, List, Optional
if TYPE_CHECKING:
from qml_essentials.operations import Operation
_local = threading.local()
def _tape_stack() -> List[List["Operation"]]:
"""Return... | cirKITers/qml-essentials | qml_essentials/tape.py | .py | 72121c28bac5f6a0 | 7.45 | 7 |
"""Empirical loss-variance (barren-plateau) diagnostics over random circuits.
Estimates ``Var_W[<O>]`` for a fixed input state evolved by a random
parameterised circuit, sampling the circuit parameters ``W ~ U[0, 2pi)``. This
is the empirical left-hand side of the Ragone/Fontana LASA identity
``Var_W[<O>] = sum_j P_j... | cirKITers/qml-essentials | qml_essentials/trainability.py | .py | 1eebad4c6fb916d5 | 7.45 | 7 |
"""Tests for the dynamical Lie algebra closure helpers.
Closure dimensions are validated against closed-form values: the single-qubit
algebra su(2) has dimension 3, and the matchgate algebra so(2n) generated by
{Z_k} u {X_k X_{k+1}} has dimension n(2n-1).
"""
from itertools import combinations
import numpy as np
imp... | cirKITers/qml-essentials | tests/test_algebra.py | .py | 22ab7235bde4c72e | 7.95 | 7 |
"""Tests for the symbolic Pauli/Clifford layer (PauliWord) and the
Pauli-Clifford circuit transform (PauliCircuit).
Correctness of the symbolic algebra is validated against dense-matrix ground
truth, so these tests do not depend on the matrix helpers they are meant to
replace.
"""
import itertools
import numpy as np... | cirKITers/qml-essentials | tests/test_pauli.py | .py | 647f70025fdf7815 | 7.95 | 7 |
import pytest
import jax
import jax.numpy as jnp
from qml_essentials.pulses import PulseGates, PulseInformation
from qml_essentials.jaqsi import Evolution, Script
jax.config.update("jax_enable_x64", True)
def assert_default_pulse_state():
assert PulseInformation.get_envelope() == PulseInformation.DEFAULT_ENVELO... | cirKITers/qml-essentials | tests/test_pulse_state.py | .py | 7bfeec31ab9a02fc | 7.95 | 7 |
import pytest
import jax
import jax.numpy as jnp
import itertools
from qml_essentials import jaqsi as js
from qml_essentials.pulses import PulseInformation
from qml_essentials.qoc import (
Cost,
CostFnRegistry,
QOC,
fidelity_cost_fn,
pulse_width_cost_fn,
evolution_time_cost_fn,
spectral_den... | cirKITers/qml-essentials | tests/test_qoc.py | .py | 0b03509085ddf75b | 7.95 | 7 |
import jax
import jax.numpy as jnp
import math
import pytest
from qml_essentials.random_sampling import DensityMatrix
jax.config.update("jax_enable_x64", True)
KEY = jax.random.key(1000)
# The four samplers share the common (n_qubits, n_samples, random_key) signature
# and can therefore be exercised uniformly by th... | cirKITers/qml-essentials | tests/test_random_sampling.py | .py | 23a526d4ebce0be9 | 7.95 | 7 |
"""Helpers for dealing with pandas.DataFrames"""
from typing import Any
import numpy as np
import pandas
import pandas as pd
from pandas import testing as pd_test
POSSIBLE_INTEGER_DTYPES = (int, pd.Int8Dtype, pd.Int16Dtype, pd.Int32Dtype, pd.Int64Dtype)
def standardize_frame_numerics(df: pandas.DataFrame, float_pr... | ottogroup/bquest | src/bquest/dataframe.py | .py | f7ec38d334b4b53a | 7.65 | 19 |
"""Module for Running BQuest Tests"""
import ast
import copy
import os
from typing import Any, Callable, Dict, List, Optional
import pandas
from google.cloud import bigquery as bq
from bquest.tables import BQTable, BQTableDefinition, BQTableDefinitionBuilder
class BQConfigSubstitutor:
"""Substitutes parameters... | ottogroup/bquest | src/bquest/runner.py | .py | f575f6557698c556 | 7.65 | 19 |
import pytest
from bquest.util import is_sql
pytestmark = pytest.mark.unit
def test_is_sql_negatives():
"""Test is_sql negatives"""
assert not is_sql("table")
assert not is_sql("project.dataset.table")
assert not is_sql("* FROM project.dataset.table")
assert not is_sql("SELECT * FROM")
asser... | ottogroup/bquest | tests/unit/test_util.py | .py | bab255752fbf1f7e | 8.15 | 19 |
#!/usr/bin/env python3
# Copyright (c) 2023, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# 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
#
# ht... | ARM-software/sbmr-acs | bin/auto_status_file.py | .py | 06095616ddbfd9f8 | 7.5 | 9 |
#!/usr/bin/env python3
# Copyright (c) 2026, Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# 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
#
# htt... | ARM-software/sbmr-acs | bin/generate_level_argumentfile.py | .py | e270542df61a3219 | 7.5 | 9 |
#!/usr/bin/env python3
# Copyright (c) 2023, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# 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
#
# ht... | ARM-software/sbmr-acs | bin/validate_plug_ins.py | .py | c7c15e99584333a6 | 7.5 | 9 |
#!/usr/bin/env python3
# Copyright (c) 2023, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# 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
#
# ht... | ARM-software/sbmr-acs | extended/run_keyword.py | .py | af45bbbf30a975bf | 7.5 | 9 |
#!/usr/bin/env python3
# Copyright (c) 2023, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# 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
#
# ht... | ARM-software/sbmr-acs | lib/gen_robot_print.py | .py | a48f2d54a9ba7944 | 7.5 | 9 |
#!/usr/bin/env python3
# Copyright (c) 2023-2025, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# 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
#... | ARM-software/sbmr-acs | lib/obmc_boot_test.py | .py | 4ff58b35c57f6ee8 | 7 | 9 |
#!/usr/bin/env python3
# Copyright (c) 2026, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# 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
#
# ht... | ARM-software/sbmr-acs | lib/redfish_instance_discovery.py | .py | 21215953b53c8dbe | 7.5 | 9 |
#!/usr/bin/env python3
r"""
Custom rules file for robotframework-lint.
Installation : pip3 install --upgrade robotframework-lint
Example usage:
python3 -m rflint -rA robot_standards -R robot_custom_rules.py .
"""
import re
from rflint.common import ERROR, SuiteRule
class ExtendInvalidTable(SuiteRule):
r"""
... | ARM-software/sbmr-acs | tools/robot_custom_rules.py | .py | 7d1a414a1eb15f54 | 7.5 | 9 |
"""Button platform for t_smart."""
from __future__ import annotations
import logging
from homeassistant.components.button import ButtonEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
fro... | andrew-codechimp/tsmart_ha | custom_components/t_smart/button.py | .py | 12940f6d0d19d812 | 7.57 | 13 |
"""Climate platform for t_smart."""
import asyncio
import logging
from homeassistant.components.climate import (
ATTR_HVAC_MODE,
PRESET_AWAY,
PRESET_BOOST,
PRESET_ECO,
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.const import (
ATTR_TEMPERATURE,
... | andrew-codechimp/tsmart_ha | custom_components/t_smart/climate.py | .py | 5651b75955ef5c53 | 7.57 | 13 |
"""Config flow for T-Smart Thermostat integration."""
from __future__ import annotations
import asyncio
import copy
import logging
from typing import Any
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry, OptionsFlow
from homeassistant.const impor... | andrew-codechimp/tsmart_ha | custom_components/t_smart/config_flow.py | .py | 135e5f8f35442912 | 7.57 | 13 |
"""DataUpdateCoordinator for thermostats."""
import logging
from datetime import timedelta
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import (
DataUpdateCoordinator,
UpdateFailed,
)
from .const import DOMAIN
... | andrew-codechimp/tsmart_ha | custom_components/t_smart/coordinator.py | .py | e0bb6745f33f0bd8 | 7.57 | 13 |
"""Base entity for t_smart."""
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN
from .coordinator import TSmartCoordinator
class TSmartEntity(CoordinatorEntity[TSmartCoordinator]):
"""Base entity."""
_attr_h... | andrew-codechimp/tsmart_ha | custom_components/t_smart/entity.py | .py | 3a8dfdc2fc88a127 | 7.57 | 13 |
"""Sensor platform for t_smart."""
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorStateClass,
)
from homeassistant.const import (
PRECISION_TENTHS,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform impo... | andrew-codechimp/tsmart_ha | custom_components/t_smart/sensor.py | .py | a72fba4820ab17a7 | 7.57 | 13 |
"""Andrews & Arnold API Client."""
# mypy: disable-error-code="no-untyped-def"
from __future__ import annotations
from typing import Any
from asyncio import timeout
import aiohttp
from .const import LOGGER, API_URL
class AndrewsArnoldQuotaApiClient:
"""Andrews & Arnold API Client."""
def __init__(
... | andrew-codechimp/HA-Andrews-Arnold-Quota | custom_components/andrews_arnold_quota/api.py | .py | 320f70651d1f9817 | 7.48 | 8 |
"""Adds config flow for AndrewsArnoldQuota."""
# mypy: disable-error-code="no-untyped-def,override,return-value"
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_PASSWORD,
CONF_USERNAME,
)
from ... | andrew-codechimp/HA-Andrews-Arnold-Quota | custom_components/andrews_arnold_quota/config_flow.py | .py | 5532734bb97df083 | 7.48 | 8 |
"""DataUpdateCoordinator for andrews_arnold_quota."""
# mypy: disable-error-code="no-untyped-def,method-assign,misc"
from __future__ import annotations
from datetime import timedelta
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.config_entr... | andrew-codechimp/HA-Andrews-Arnold-Quota | custom_components/andrews_arnold_quota/coordinator.py | .py | ff105aa413c40892 | 7.48 | 8 |
"""AndrewsArnoldQuotaEntity class."""
# mypy: disable-error-code="arg-type"
from __future__ import annotations
from dataclasses import dataclass
from homeassistant.helpers.entity import DeviceInfo, EntityDescription
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import NAME, DOMA... | andrew-codechimp/HA-Andrews-Arnold-Quota | custom_components/andrews_arnold_quota/entity.py | .py | 211ebbc1b540aa50 | 7.48 | 8 |
"""Sensor platform for andrews_arnold_quota."""
# mypy: disable-error-code="no-untyped-def,misc,union-attr,return-value"
from __future__ import annotations
from dataclasses import dataclass
from homeassistant.util import slugify
from homeassistant.const import (
UnitOfInformation,
)
from homeassistant.components... | andrew-codechimp/HA-Andrews-Arnold-Quota | custom_components/andrews_arnold_quota/sensor.py | .py | ed5bc98c960bf807 | 7.48 | 8 |
import shutil
from olman_client import graph, install_manager
from olman_client.internal import local_index, remote_index
def update(force: bool = False) -> bool:
"Update the index."
return remote_index.update(force=force)
def install(name: str, version: str | None = None, *, force: bool = False) -> bool:... | openscad/openscad-library-manager | olman-client/olman_client/api.py | .py | 51ebe17271297e2c | 7.59 | 14 |
from pathlib import Path
from shutil import copy2
from urllib.request import urlretrieve
def getFileDownloadLink(repo_url: str, file_path: str, branch: str = "main"):
# Remove any leading or trailing slashes from the arguments
repo_url = repo_url.strip("/")
branch = branch.strip("/")
file_path = file_... | openscad/openscad-library-manager | olman-vcs-utils/olman_vcs_utils/vcs_utils.py | .py | 0b3b5ce4c07f4431 | 7.59 | 14 |
# SPDX-FileCopyrightText: 2024 Gispo Ltd. <info@gispo.fi>
#
# SPDX-License-Identifier: MIT
# ruff: noqa: T201
"""Tool for creating a virtual environment for QGIS plugin development.
Originated from https://github.com/GispoCoding/qgis-venv-creator
Usage:
python create_qgis_venv.py [--help] [--venv-parent <path-to-ve... | GispoCoding/qgis-venv-creator | src/qgis_venv_creator/create_qgis_venv.py | .py | 8d50ab32c1c6a57c | 7.63 | 17 |
# SPDX-FileCopyrightText: 2024 Gispo Ltd. <info@gispo.fi>
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import platform
import pytest
platform_markers = {"windows", "linux", "macos"}
platform_to_marker = {"Windows": "windows", "Linux": "linux", "Darwin": "macos"}
def pytest_addoption(parser:... | GispoCoding/qgis-venv-creator | tests/conftest.py | .py | e622ae1d8eb3d1d6 | 7.13 | 17 |
# SPDX-FileCopyrightText: 2024 Gispo Ltd. <info@gispo.fi>
#
# SPDX-License-Identifier: MIT
import subprocess
from pathlib import Path
import pytest
from tests.utils import fail
# Mark the whole module to run only on Windows
pytestmark = [pytest.mark.linux, pytest.mark.e2e]
@pytest.fixture(scope="session")
def ven... | GispoCoding/qgis-venv-creator | tests/e2e/test_venv_creation_linux.py | .py | bbe0827888331678 | 7.13 | 17 |
# SPDX-FileCopyrightText: 2024 Gispo Ltd. <info@gispo.fi>
#
# SPDX-License-Identifier: MIT
import os
import re
import subprocess
from pathlib import Path
import pytest
from tests.utils import fail
# Mark the whole module to run only on Windows
pytestmark = [pytest.mark.windows, pytest.mark.e2e]
@pytest.fixture(sc... | GispoCoding/qgis-venv-creator | tests/e2e/test_venv_creation_win.py | .py | 61d505c99dfea169 | 8.13 | 17 |
# SPDX-FileCopyrightText: 2024 Gispo Ltd. <info@gispo.fi>
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
from typing import TYPE_CHECKING, NoReturn, cast
import pytest
if TYPE_CHECKING:
from collections.abc import Callable
def fail(reason: str) -> NoReturn:
"""Wrap pytest.fail for typ... | GispoCoding/qgis-venv-creator | tests/utils.py | .py | 67f4c00889270fcb | 7.13 | 17 |
# Coding: utf-8
# Handling missing data and imputation
import pandas as pd
import os
import missingno as msno
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import seaborn as sns
import matplotlib.dates as mdates
def load_missing_value_visualization(input_df, save_path):
"""visualize t... | yuruotao/District-power | utils/load_missing.py | .py | 84931a60f88ec57d | 7.64 | 18 |
from __future__ import annotations
from typing import TYPE_CHECKING
import cupy as cp
import cupyx.scipy.fft as cufft
if TYPE_CHECKING:
from ft_system import PolymerSystem
class CL_RK2(object):
"""
Class used to update the state of a polymer field system using the complex langevin
integrator with e... | rotskoff-group/polycomp | polycomp/complex_langevin_ETD.py | .py | 0647df9ea3020dc8 | 7.5 | 9 |
from typing import Tuple, Union
import cupy as cp
ArrayLike = Union[Tuple[float, ...], list, cp.ndarray]
class Grid:
"""
This class manages the grids (real and k-space) needed for the field theoretic
simulations. It stores and pre-computes useful quantities for the
modified diffusion equation and in... | rotskoff-group/polycomp | polycomp/grid.py | .py | b2ac4387494b1769 | 7.5 | 9 |
from __future__ import annotations
from typing import TYPE_CHECKING
import cupy as cp
import cupyx.scipy.fft as cufft
from polycomp._kernels import exp_mult, exp_mult_comp
if TYPE_CHECKING:
import numpy as np
from grid import Grid
def s_step(q_r: cp.ndarray, h: float, w_P: cp.ndarray, grid: Grid) -> cp.nd... | rotskoff-group/polycomp | polycomp/mde.py | .py | e2c908851f5092be | 7.5 | 9 |
import unittest
import cupy as cp
import polycomp.ft_system as p
from polycomp.mde import integrate_s, s_step
def build_polysystem(charge):
cp.random.seed(0)
A_mon = p.Monomer("A", charge)
B_mon = p.Monomer("B", -charge)
S_mon = p.Monomer("S", 0)
monomers = [A_mon, B_mon, S_mon]
FH_terms =... | rotskoff-group/polycomp | test/tests.py | .py | 9c10664be0d45607 | 7 | 9 |
"""
This module contains functions to determine generic parameters and arguments.
Currently, this module only works for real types, i.e. something like
>>> get_filled_type(List[int], List, 0)
will not work. This is because these "primitive" types are different from "normal" generic types and currently there
is no need ... | Hochfrequenz/python-generics | src/generics/__init__.py | .py | de352a320d1e92c1 | 7.56 | 12 |
"""
A module with unit tests for the `get_filled_type` function.
"""
from typing import Any, Generic, TypeVar
import pytest
from pydantic import BaseModel
from generics import get_filled_type
class TestGetFilledType:
"""
Test `get_filled_type`
"""
def test_generic_alias_with_type_var(self):
... | Hochfrequenz/python-generics | unittests/test_get_filled_type.py | .py | f56008a7da5faf91 | 7.06 | 12 |
"""
A module with unit tests for the `get_type_vars` function.
"""
from typing import Generic, TypeVar
from pydantic import BaseModel
from generics import get_type_vars
class TestGetTypeVars:
"""
Test `get_type_vars`
"""
def test_generic_class(self):
"""
Test `get_type_vars` by pas... | Hochfrequenz/python-generics | unittests/test_get_type_vars.py | .py | 5f8aa82511af7f23 | 7.06 | 12 |
"""
Tests for Python 3.12 features.
"""
from generics import get_filled_type
class TestPy312:
"""
Tests for Python 3.12 features
"""
def test_get_filled_type_with_pep695_generics(self):
"""
Test `get_filled_type` with PEP 695 generics syntax.
https://peps.python.org/pep-0695/... | Hochfrequenz/python-generics | unittests/test_py_312.py | .py | ab8ee78e350c024f | 7.06 | 12 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
import os
import shutil
from typing import Any
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class HatchCustomBuildHook(BuildHookInterface):
"""
This class implements Hatch's [custom build hook] (https://hatch.pyp... | aws-deadline/deadline-cloud-for-3ds-max | hatch_custom_hook.py | .py | 4c4e0651a73043b4 | 7.62 | 16 |
#!/usr/bin/env python3
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Setup runner for 3ds Max integration tests in CodeBuild."""
import argparse
import hashlib
import os
import platform
import shlex
import shutil
import subprocess
import sys
from pathlib import Path
import boto3
from botoco... | aws-deadline/deadline-cloud-for-3ds-max | pipeline/setup-runner.py | .py | 472f4e92bef9588f | 7.62 | 16 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Script to create platform-specific Deadline Client installers using InstallBuilder."""
import os
import sys
import shutil
import tempfile
from datetime import datetime
from typing import Optional
from pathlib import Path
from common import Evalua... | aws-deadline/deadline-cloud-for-3ds-max | scripts/build_installer.py | .py | f761308920f719e9 | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - 3dsMax Regex Callback Handler
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
from __future__ import annotations
import re
from openjd.adaptor_runtime.app_handlers import RegexCallback
class MaxRegexCallback(RegexCallback):
def __init__(
self,... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/MaxAdaptor/regex_callback_handler.py | .py | 37adc8600a5ee95f | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - Logger Interceptor
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
import logging
import sys
from typing import Callable, List, Optional
from pymxs import runtime as rt
from deadline.max_adaptor.executable_handler import MaxExecutableHandler, SupportedMaxE... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/MaxClient/logger_interceptor.py | .py | ca37c49b5023549c | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - 3dsMax Client Interface
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
from __future__ import annotations
import logging
import os
import sys
from types import FrameType
from typing import Optional
import pymxs # noqa
from pymxs import runtime as rt
# T... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/MaxClient/max_client.py | .py | c2b8b28efe50da4e | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - Arnold (MAXtoA) specific actions
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
import sys
from typing import Any, List, Optional
import pymxs # noqa
from pymxs import runtime as rt
from .default_max_handler import DefaultMaxHandler
# Re-assign sys stdo... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/MaxClient/render_handlers/arnold_handler.py | .py | c53e3c1f6647d461 | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - ART Renderer specific actions
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
import sys
import pymxs # noqa
from pymxs import runtime as rt
from .default_max_handler import DefaultMaxHandler
# Re-assign sys stdout and stderr to print in the console inst... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/MaxClient/render_handlers/art_handler.py | .py | 3e828e7e9594927c | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - Corona specific actions
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
import sys
import pymxs # noqa
from pymxs import runtime as rt
from .default_max_handler import DefaultMaxHandler
# Re-assign sys stdout and stderr to print in the console instead of... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/MaxClient/render_handlers/corona_handler.py | .py | 926f138b77bb460f | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - Redshift specific actions
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
import sys
import pymxs # noqa
from pymxs import runtime as rt
from .default_max_handler import DefaultMaxHandler
# Re-assign sys stdout and stderr to print in the console instead ... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/MaxClient/render_handlers/redshift_handler.py | .py | 5c293b40f5f3ae01 | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - V-Ray specific actions
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
import os
import sys
from typing import Any
from pymxs import runtime as rt
from deadline.max_shared.utilities.max_utils import (
configure_vray_raw_output,
get_max_version_year... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/MaxClient/render_handlers/vray_handler.py | .py | 15650f1309944114 | 7.62 | 16 |
"""
3ds Max Deadline Cloud Adaptor - 3dsMax Executable Handler
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
from enum import Enum
from os import environ
from functools import cache
import re
from typing import List, Dict, Match, Optional
from dataclasses import dataclass
class SupportedMax... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_adaptor/executable_handler.py | .py | cd63a5d39b0cab66 | 7.62 | 16 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
Shared output filename utilities for Deadline Cloud 3ds Max integration.
Provides token-based output filename formatting.
Everything else in the pattern is literal text (base name, frame padding, delimiters).
"""
# Single source of truth for su... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_shared/utilities/filename_utils.py | .py | f668deae8e57ae5a | 7.62 | 16 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""3ds Max Command-Line (3dsmaxcmd) Render Settings Data Class."""
import dataclasses
import json
from dataclasses import dataclass, field
from pathlib import Path
from data_const import MAXCMD_SUBMITTER_SETTINGS_FILE_EXT
from pymxs import runtime ... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_submitter/maxcmd_settings.py | .py | fce3e99ee3dd6709 | 7.62 | 16 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
3ds Max Deadline Cloud Submitter - Sanity checks for job bundle creation
"""
import logging
import pymxs # noqa
from pymxs import runtime as rt
from deadline.max_shared.utilities.max_utils import get_batch_render_views
from deadline.max_submi... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_submitter/sanity_checks.py | .py | b7d8fc823408c527 | 7.62 | 16 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
3ds Max Command-Line Render task driver.
Runs on the worker for each task. Reads Deadline Cloud path-mapping rules,
generates a pre-render MAXScript that remaps the scene's asset paths to their
session locations, then invokes 3dsmaxcmd.exe to ren... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_submitter/scripts/maxcmd_render.py | .py | c8b39703b1d592c4 | 7.62 | 16 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
3ds Max Deadline Cloud Submitter - 3dsmaxcmd Command-Line Render Tab UI
"""
from qtpy.QtWidgets import ( # type: ignore
QCheckBox,
QGridLayout,
QGroupBox,
QHBoxLayout,
QLabel,
QLineEdit,
QPushButton,
QSizePolicy,... | aws-deadline/deadline-cloud-for-3ds-max | src/deadline/max_submitter/ui/maxcmd_tab.py | .py | 11f21aa650fab9f2 | 7.62 | 16 |
"""Optional weekly models.dev catalogue refresh.
The bundled snapshot (``collie_core/catalog/snapshot.json``) is the runtime
fallback and always works offline. This module implements the optional,
HTTPS-fetched, schema-validated refresh: it re-fetches models.dev api.json,
re-trims it with the curated layer, and only t... | FoxRick/Collie | collie-core/collie_core/catalog/refresh.py | .py | 14811cd94cd05443 | 7.48 | 8 |
"""Snapshot trimming + schema validation shared by the builder, loader and refresh.
Kept out of ``catalog/__init__.py`` so ``refresh`` can import it without a
circular import (``__init__`` imports ``refresh`` for the store API).
"""
from __future__ import annotations
import hashlib
import json
from typing import Any... | FoxRick/Collie | collie-core/collie_core/catalog/snapshot_util.py | .py | 5d4b6e63f59aa1a7 | 7.48 | 8 |
"""Official provider-hosted MCP connector driver."""
from __future__ import annotations
import asyncio
from typing import Any
import httpx
from collie_core.connectors.auth import build_oauth_provider
from collie_core.connectors.models import (
ConnectorDefinition,
ProbeResult,
RemoteRevocationStatus,
)
... | FoxRick/Collie | collie-core/collie_core/connectors/drivers/official_mcp.py | .py | aff175ebd19483ca | 7.48 | 8 |
"""Compile MCP hints and curated overrides into stable connector risk policy."""
from __future__ import annotations
import hashlib
import json
from typing import Any
_READ_WORDS = ("search", "list", "get", "read", "find", "fetch", "lookup", "view")
_IMPORTANT_WORDS = ("send", "publish", "invite", "share", "pay", "pu... | FoxRick/Collie | collie-core/collie_core/connectors/policy.py | .py | fffde1dae14c4b98 | 7.48 | 8 |
"""Gardener evidence queries — read-only signals over run-record telemetry.
The Gardener's evidence layer answers four questions from the telemetry
tables (``turn_events`` / ``tool_events``) plus the workspace files:
1. **Repeated tool failures** — tools that error or are denied often enough
to be worth a fix (e.g... | FoxRick/Collie | collie-core/collie_core/gardener/evidence.py | .py | 4073f4a994018128 | 7.48 | 8 |
"""Gardener proposal step — bounded subagent call + strict validation.
The Gardener runs one **bounded, read-only** subagent turn (a single model
call, no tools, ``read_only`` posture — the same machinery the Dream runner
uses) with a fixed prompt: the evidence summary and the current agent /
memory texts go in, a str... | FoxRick/Collie | collie-core/collie_core/gardener/propose.py | .py | d7578ba8a27bfc93 | 7.48 | 8 |
"""Gardener runner — evidence → proposals → review cards → versioned apply.
The runner ties the Gardener story together:
1. :func:`run_gardener` collects evidence (read-only telemetry queries),
runs the bounded proposal turn, validates every suggestion, and returns
the suggestion list for the review surface (ch... | FoxRick/Collie | collie-core/collie_core/gardener/runner.py | .py | 4fb0a4f1d5f4a50a | 7.48 | 8 |
"""Thinking states (spec §3.10, F082-F092).
Maps engine activity (tool calls, streaming, errors) to the friendly
phrases shown in the ThinkingBar and mirrored by the desktop pet.
"""
from __future__ import annotations
__all__ = ["PHRASES", "phrase_for_state", "thinking_state_for_tool"]
# state -> (phrase, pet anima... | FoxRick/Collie | collie-core/collie_core/ipc/thinking.py | .py | a1e8cfd6156fa79f | 7.48 | 8 |
"""HTTP client for the Electron main-process OS keychain bridge.
The Electron shell owns the real platform keychain (DPAPI on Windows,
Keychain on macOS, libsecret/gnome-keyring on Linux) via Electron
``safeStorage``. Connector OAuth tokens must be encrypted with that same
keychain so they are recoverable only by the ... | FoxRick/Collie | collie-core/collie_core/keychain.py | .py | 077ae669f66705d7 | 7.48 | 8 |
"""Collie's Dream runner — episodic memory consolidation (Gardener PR 3).
Wires nanobot's already-vendored Dream machinery (cursor, prompt builder,
session keys, pruning) into Collie:
1. Build the Dream prompt from unprocessed conversation history via
``MemoryStore.build_dream_prompt()``.
2. Run a **bounded, read-... | FoxRick/Collie | collie-core/collie_core/memory/dream.py | .py | 0abbaa34223cfe16 | 7.48 | 8 |
"""Name-sanity helpers shared by the starter conversation and the remember tool.
A name worth remembering is a single short line. Sentences, instructions, or
preference statements are not names — they must never land in the profile's
Name field (wrong memory is worse than none: it resurfaced as the user's
name in QA).... | FoxRick/Collie | collie-core/collie_core/memory/names.py | .py | f7ca3edee371c2a1 | 7.48 | 8 |
"""Message bus with an inbound observer hook.
The engine's ``MessageBus`` decouples channels from the agent loop. Collie
additionally wants to *see* messenger traffic so it can mirror those chats
into the desktop UI. ``CollieBus`` calls an optional observer for every
inbound message before handing it to the loop; fail... | FoxRick/Collie | collie-core/collie_core/messengers/bus.py | .py | 2c515f153b6110c7 | 7.48 | 8 |
"""Starter conversation: the scripted, local first message after connect.
After a provider is connected the app goes straight to chat — no empty
state. The conversation opens with a scripted greeting from Collie (instant,
local, can never fail — it is NOT model-generated). The greeting appears
only once per conversati... | FoxRick/Collie | collie-core/collie_core/onboarding.py | .py | f24d4528dad2ccd0 | 7.48 | 8 |
"""Deterministic allow/ask/deny precedence."""
from __future__ import annotations
import fnmatch
import os
from collections.abc import Callable
from datetime import UTC, datetime
from pathlib import Path
from typing import Any
from urllib.parse import urlsplit
from collie_core.permissions.defaults import is_automati... | FoxRick/Collie | collie-core/collie_core/permissions/evaluator.py | .py | 97e343140ba5f33f | 7.48 | 8 |
"""Permission model shared by chat, subagents, MCP tools, and routines."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import StrEnum
from typing import Any
class Effect(StrEnum):
ALLOW = "allow"
ASK = "ask"
DENY = "deny"
class Risk(StrEnum):
READ = "read"... | FoxRick/Collie | collie-core/collie_core/permissions/models.py | .py | ba1b01b15f01eb1c | 7.48 | 8 |
"""Owned-lifetime ActiveTaskRegistry — retires producer/consumer tasks at turn teardown (#1713).
Upstream bug (a2a-sdk 1.1.0, reported as a2aproject/a2a-python#1121 / #1123): at the end
of a turn the SDK's ``ActiveTask`` teardown drops the last external strong reference to
the still-*pending* ``producer:<task_id>`` as... | protoLabsAI/protoAgent | a2a_impl/registry.py | .py | 5439ff0714b80d90 | 7.5 | 9 |
"""Activity provenance feed (ADR 0022).
Besides the :class:`ActivityLog` store, this package is the ONE seam through
which in-graph code surfaces operator-relevant notices into the console feed
(#2262): ``graph/`` must not import ``server/`` (import-linter contract), and
the feed's path derivation needs server-side id... | protoLabsAI/protoAgent | activity/__init__.py | .py | 3c6c118f77f2d820 | 7.5 | 9 |
"""ActivityLog — the provenance feed behind the Activity surface (ADR 0022).
One row per terminal turn in the Activity context: *what the agent produced* +
*what triggered it* (origin / trigger label / inbox priority) + when. This is the
timeline source for the console feed — a distinct concern from telemetry
(cost/la... | protoLabsAI/protoAgent | activity/store.py | .py | 9f98fb31e6cd52f6 | 7.5 | 9 |
import { expect, test } from "@playwright/test";
// Slug navigation → activate (#806): a window opening /app/agent/<slug>/ ensures its
// agent is running (cold resume from checkpoint) + touches it for keep-N-warm. The
// fixture's "roxy" is STOPPED, so this is the exact navigate-to-a-cold-agent path.
test("opening a... | protoLabsAI/protoAgent | apps/web/e2e/activate.spec.ts | .ts | fc637c7a3c45a753 | 7 | 9 |
import { expect, test } from "@playwright/test";
// The unified feed is ONE read-only utility-bar widget (#3029) that merged the former
// separate Activity and Inbox pills: a bottom-left pill whose unread badge tracks BOTH
// the `inbox.item` (pending inbound stimuli, ADR 0003) and `activity.message` (completed
// ag... | protoLabsAI/protoAgent | apps/web/e2e/activity.spec.ts | .ts | 80e98637fbe1bdd7 | 7 | 9 |
import { expect, test } from "@playwright/test";
// Static-asset wiring. The favicon href is base-sensitive: a hardcoded "/app/"
// prefix double-prepends under Vite's dev base (→ "/app/app/…", 404). This
// guards that the icon link actually resolves so the tab favicon shows.
test("favicon link resolves to the icon ... | protoLabsAI/protoAgent | apps/web/e2e/assets.spec.ts | .ts | 7638979b89600394 | 7 | 9 |
import { expect, test } from "@playwright/test";
// Auth UX (#873): a token-gated deployment answers 401 until the operator
// supplies the bearer. The console must surface a token prompt (not just
// per-panel 401 cards), persist the token, and recover in place. The mock
// server isn't token-gated, so the gate is si... | protoLabsAI/protoAgent | apps/web/e2e/auth-gate.spec.ts | .ts | 8fe91f3d6a3c7753 | 7 | 9 |
import { expect, test } from "@playwright/test";
// Real bearer gate, real auth flow (#2886). auth-gate.spec.ts simulates a gated
// deployment via Playwright route interception — which can inject Authorization
// on EVERY request, including <script src> module loads, something no real
// browser can do. That shape ca... | protoLabsAI/protoAgent | apps/web/e2e/auth-gated-views.spec.ts | .ts | 2e128402ed1e2033 | 7 | 9 |
import { expect, test } from "@playwright/test";
// #2896: background delegations — delegate_to(background=true) / task(run_in_background=
// true) — are dispatch RECEIPTS, not work product (the results arrive later as their own
// report messages). They fold into ONE compact "N background jobs" chip instead of stacki... | protoLabsAI/protoAgent | apps/web/e2e/background-chip.spec.ts | .ts | d485b248ca64209f | 7 | 9 |
import { expect, test } from "@playwright/test";
// Copy a finished background job's FULL result out of the Background-agents panel (#2352).
//
// The reported friction: a delegate's reply landed in the panel and the operator had to
// select several thousand words out of a scrolling markdown pane by hand. The panel
/... | protoLabsAI/protoAgent | apps/web/e2e/background-copy.spec.ts | .ts | 740beb11849b4aa2 | 7 | 9 |
import { expect, test } from "@playwright/test";
// #2692 — a background job's completion could silently fail to render live in its
// origin chat tab, with only a generic (and sometimes misleading) toast as fallback.
// Two fixes covered here:
// 1. The Background-agents pill's unread badge is DURABLE (localStorage... | protoLabsAI/protoAgent | apps/web/e2e/background-visibility.spec.ts | .ts | 9763dd29e86e9ad4 | 7 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.