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 Suite for `fetch_data` for the NL """ from unittest.mock import MagicMock, Mock, patch import numpy as np import pandas as pd from entsoe.exceptions import NoMatchingDataError from solar_consumer.data.fetch_nl_data import ( check_national_capacity_equals_regional_sum, fetch_nl_data, get_entsoe_d...
openclimatefix/solar-consumer
tests/unit/test_fetch_data_nl.py
.py
6e66e67353f0d50b
7.04
11
""" Test Suite for `fetch_de_data` for Germany """ from unittest.mock import MagicMock, patch import pandas as pd import pytest from entsoe.exceptions import NoMatchingDataError from solar_consumer.constants import DE_AREAS from solar_consumer.data.fetch_de_data import fetch_de_data def make_generation_df(values_m...
openclimatefix/solar-consumer
tests/unit/test_fetch_de_data.py
.py
a160f8c39c569300
7.04
11
import unittest import uuid from unittest.mock import AsyncMock, patch import pandas as pd from betterproto.lib.google.protobuf import Struct, Value from ocf import dp # Import the function to test from solar_consumer.save.save_data_platform import save_generation_to_data_platform class TestMixedCountryHandling(uni...
openclimatefix/solar-consumer
tests/unit/test_mixed_country_isolation.py
.py
5143ed4b0fb7c40d
7.04
11
from unittest.mock import patch import pandas as pd import requests from freezegun import freeze_time from solar_consumer.data.fetch_be_data import ( BASE_URL_FORECAST, fetch_be_data, ) pytest_plugins = ["requests_mock"] # Helper utilities def load_mock_response(filename: str) -> str: """ Load a mo...
openclimatefix/solar-consumer
tests/unit/test_unit_fetch_be_forecast.py
.py
46e1bcc9e41d8bb5
7.04
11
""" Unit tests for fetch_ind_rajasthan_data. These tests validate the behavior of the RUVNL data fetcher using mocked API responses. Test cases covered: - Valid JSON response with both solar and wind data - Valid response with negative power values - Valid response with missing solar generation data - Non-200 HTTP re...
openclimatefix/solar-consumer
tests/unit/test_unit_fetch_ind_rajasthan_data.py
.py
ad12549d7b7e8885
7.04
11
// Load-time smoke check for the TPoS frontend assets. // // Every script that a TPoS page loads is evaluated in a mocked browser // environment, in the same order as the templates include them. This catches // load-time failures (e.g. template literals interpolating undefined symbols // when a component file is parsed...
lnbits/tpos
tests/check_static_load.js
.js
68bc165508b59e7d
7.14
18
# # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: MIT # """Translation service""" import json import logging import os from copy import deepcopy from time import perf_counter from typing import TypedDict import ctranslate2 from nc_py_api.ex_app import setup_nextclou...
nextcloud/translate2
lib/Service.py
.py
3a23d89190390436
7.42
6
# # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: MIT # """Utility functions""" import json import os import re from nc_py_api.ex_app import persistent_storage CONFIG_FILENAME = "config.json" def clean_text(text: str) -> str: return re.sub(r"(\r?\n)+", " ", te...
nextcloud/translate2
lib/util.py
.py
1e27242e02b237e3
7.42
6
import os import sys if sys.version_info >= (3, 11): import tomllib else: import tomli as tomllib from typing import List from pydantic import BaseModel from pydantic import Field from ansys.aedt.toolkits.common.backend.models import CommonProperties from ansys.aedt.toolkits.common.backend.models import com...
ansys/pyaedt-toolkits-common
doc/source/examples/properties_common/models.py
.py
2c272c78f613de59
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
ansys/pyaedt-toolkits-common
examples/toolkit/pyaedt_toolkit/backend/api.py
.py
6ae25b039c73c6c3
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
ansys/pyaedt-toolkits-common
examples/toolkit/pyaedt_toolkit/backend/models.py
.py
53c932b2c436258c
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
ansys/pyaedt-toolkits-common
examples/toolkit/pyaedt_toolkit/backend/run_backend.py
.py
4ca7df2161ad167b
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
ansys/pyaedt-toolkits-common
examples/toolkit/pyaedt_toolkit/run_toolkit.py
.py
d1df0a43d753c139
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
ansys/pyaedt-toolkits-common
examples/toolkit/pyaedt_toolkit/ui/models.py
.py
bdd8c203df007d4d
7.65
19
from PySide6 import QtCore, QtGui, QtWidgets from PySide6.QtWidgets import QLabel from PySide6.QtWidgets import QGridLayout from PySide6.QtWidgets import QWidget from examples.toolkit.pyaedt_toolkit.ui.windows.plot_design.plot_design_column import Ui_LeftColumn from examples.toolkit.pyaedt_toolkit.ui.windows.plot_desig...
ansys/pyaedt-toolkits-common
examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py
.py
96013921a298622e
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
ansys/pyaedt-toolkits-common
examples/toolkit_webapp/pyaedt_toolkit/backend/api.py
.py
8dbd9589f2a4c356
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
ansys/pyaedt-toolkits-common
examples/toolkit_webapp/pyaedt_toolkit/backend/run_backend.py
.py
c9c8dcb74d5cb253
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
ansys/pyaedt-toolkits-common
examples/toolkit_webapp/run_toolkit.py
.py
fb7ea5961f4653df
7.65
19
# -*- coding: utf-8 -*- # # Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software wi...
ansys/pyaedt-toolkits-common
src/ansys/aedt/toolkits/common/backend/models.py
.py
bface83dc8b50980
7.65
19
""" ORM Orbit Response Matrix Measurement """ # PyTango imports import threading import numpy as np import tango from tango import AttrQuality, AttrWriteType, DebugIt, DevState, DispLevel from tango.server import Device, attribute, command, device_property, run from pyaml.accelerator import Accelerator # Additiona...
python-accelerator-middle-layer/pyaml
examples/other_examples/ORM_Tango_server/ORM.py
.py
05d433fd043705eb
7.56
12
""" Accelerator class """ import warnings from .arrays.array import ArrayConfig from .common.element import Element, __pyaml_repr__ from .common.exception import PyAMLConfigException from .common.holders.element_holder import ElementHolder from .configuration import ConfigurationManager, UnsupportedConfigurationRootE...
python-accelerator-middle-layer/pyaml
pyaml/accelerator.py
.py
5a9be334e30cf7c3
7.56
12
""" Array configuration """ from pyaml.common.exception import PyAMLException from ..common.element import __pyaml_repr__ from ..common.holders.element_holder import ElementHolder from ..validation import DynamicValidation, register_schema @register_schema class ArrayConfig(DynamicValidation): """ Base clas...
python-accelerator-middle-layer/pyaml
pyaml/arrays/array.py
.py
adae4efd21e88644
7.56
12
from ..common.holders.element_holder import ElementHolder from ..validation import DynamicValidation, register_schema from .array import ArrayConfig # Define the main class name for this module PYAMLCLASS = "BPM" @register_schema class BPM(ArrayConfig, DynamicValidation): """ :py:class:`.BPMArray` configurat...
python-accelerator-middle-layer/pyaml
pyaml/arrays/bpm.py
.py
364e8fce2d096901
7.56
12
from ..common.holders.element_holder import ElementHolder from ..validation import DynamicValidation, register_schema from .array import ArrayConfig # Define the main class name for this module PYAMLCLASS = "CombinedFunctionMagnet" @register_schema class CombinedFunctionMagnet(ArrayConfig, DynamicValidation): ""...
python-accelerator-middle-layer/pyaml
pyaml/arrays/cfm_magnet.py
.py
2135d0880b108ea7
7.56
12
from ..common.holders.element_holder import ElementHolder from ..validation import DynamicValidation, register_schema from .array import ArrayConfig # Define the main class name for this module PYAMLCLASS = "Element" @register_schema class Element(ArrayConfig, DynamicValidation): """ :py:class:`.ElementArray...
python-accelerator-middle-layer/pyaml
pyaml/arrays/element.py
.py
0683bd8975404b36
7.56
12
from ..common.holders.element_holder import ElementHolder from ..validation import DynamicValidation, register_schema from .array import ArrayConfig # Define the main class name for this module PYAMLCLASS = "Magnet" @register_schema class Magnet(ArrayConfig, DynamicValidation): """ Magnet array confirguratio...
python-accelerator-middle-layer/pyaml
pyaml/arrays/magnet.py
.py
214e0ed34f81d4d4
7.56
12
from ..common.holders.element_holder import ElementHolder from ..validation import DynamicValidation, register_schema from .array import ArrayConfig # Define the main class name for this module PYAMLCLASS = "SerializedMagnets" @register_schema class SerializedMagnets(ArrayConfig, DynamicValidation): """ Seri...
python-accelerator-middle-layer/pyaml
pyaml/arrays/serialized_magnet.py
.py
9b5fa3261ec2a19d
7.56
12
import copy from typing import Self from ..common.abstract import ReadFloatArray, ReadWriteFloatArray, ReadWriteFloatScalar from ..common.element import Element, __pyaml_repr__ from ..common.exception import PyAMLException from ..validation import DynamicValidation, register_schema PYAMLCLASS = "BPM" @register_sche...
python-accelerator-middle-layer/pyaml
pyaml/bpm/bpm.py
.py
3c48a54ff664338e
7.56
12
from typing import TYPE_CHECKING, Any from pydantic import BaseModel, ConfigDict from .exception import PyAMLException if TYPE_CHECKING: from .holders.element_holder import ElementHolder def __pyaml_repr__(obj, exclude: list[str] | None = None): """ Returns a string representation of a pyaml object. ...
python-accelerator-middle-layer/pyaml
pyaml/common/element.py
.py
1e0c93c74189948c
7.56
12
from collections.abc import Callable from typing import TYPE_CHECKING, Generic, TypeVar from ..element import Element if TYPE_CHECKING: from .element_holder import ElementHolder T = TypeVar("T", bound=Element) A = TypeVar("A") class GenericArrayHolder(Generic[T, A]): """ Generic holder for arrays of el...
python-accelerator-middle-layer/pyaml
pyaml/common/holders/generic_array_holder.py
.py
7f5bbce7db9f3e05
7.56
12
from typing import TYPE_CHECKING, Generic, TypeVar from ..element import Element if TYPE_CHECKING: from .element_holder import ElementHolder T = TypeVar("T", bound=Element) class GenericElementHolder(Generic[T]): """ Generic holder for a single kind of element (e.g. magnets, BPMs). Concrete holder...
python-accelerator-middle-layer/pyaml
pyaml/common/holders/generic_element_holder.py
.py
52d2950cdf6e08bc
7.56
12
"""PyAML configuration file loader.""" import io import json import logging import os import re from abc import ABC, abstractmethod from collections.abc import Callable, Hashable from contextlib import contextmanager from dataclasses import dataclass, field from pathlib import Path from typing import Any, Union impor...
python-accelerator-middle-layer/pyaml
pyaml/configuration/fileloader.py
.py
90f2e3d3a63b94a4
7.56
12
from pydantic import BaseModel from ..common.element import Element from ..common.exception import PyAMLConfigException class UnboundElement(Element): """ Class that holds a configuration for an element created on the fly when ElementHolder is filled """ def __init__(self, element_class, module_name...
python-accelerator-middle-layer/pyaml
pyaml/configuration/unbound_element.py
.py
9fc154f42bc8569a
7.56
12
from abc import ABCMeta, abstractmethod from pydantic import BaseModel from ..bpm.bpm import BPM from ..common.abstract import RWMapper from ..common.abstract_aggregator import ScalarAggregator from ..common.element import Element from ..common.exception import PyAMLException from ..common.holders.element_holder impo...
python-accelerator-middle-layer/pyaml
pyaml/control/controlsystem.py
.py
03a3966a8b317481
7.56
12
#!/usr/bin/env python3 """ Run all generators in sequence. """ from __future__ import annotations import os import subprocess import sys from pathlib import Path ROOT = Path(__file__).resolve().parent.parent HISTORY_SCRIPT = "scripts/gen_history.py" SCRIPTS = [ "scripts/validate_metadata.py", "scripts/validat...
logos-co/logos-lips
scripts/run_runtime_generators.py
.py
157c49142f6efa86
7.45
7
from typing import Annotated, Optional, TypeAlias import typer from anystore.cli import ErrorHandler from anystore.io import ( IOFormat, smart_stream_data, smart_stream_json_models, smart_write, smart_write_data, smart_write_models, ) from anystore.logging import configure_logging, get_logger f...
dataresearchcenter/investigraph-etl
investigraph/cli.py
.py
92954bb4f95c3e75
7.45
7
# thanks, zavod: https://zavod.opensanctions.org/helpers/#zavod.helpers.make_address from functools import lru_cache from typing import Optional from followthemoney import EntityProxy, registry from rigour.addresses import format_address_line from investigraph.model import SourceContext from investigraph.util import...
dataresearchcenter/investigraph-etl
investigraph/helpers/addresses.py
.py
e81c757443079ee9
7.45
7
""" Inspect dataset pipeline config """ from anystore.logging import get_logger from anystore.types import Uri from investigraph.model.config import Config, get_config log = get_logger(__name__) def log_error(msg: str): log.error(f"[bold red]ERROR[/bold red] {msg}") def inspect_config(p: Uri) -> Config: ...
dataresearchcenter/investigraph-etl
investigraph/inspect.py
.py
8fc087b745d78102
7.95
7
""" aggregate fragments to export """ from typing import TYPE_CHECKING from anystore.io import logged_items, smart_write_model from anystore.logging import get_logger from followthemoney import StatementEntity from followthemoney.proxy import E from ftm_lakehouse import operation as lake_ops from ftm_lakehouse import...
dataresearchcenter/investigraph-etl
investigraph/logic/export.py
.py
4dd38dfe5a630ff2
7.45
7
""" Extract sources to iterate objects to dict records """ from runpandarun import Playbook from runpandarun.io import guess_handler_from_mimetype from investigraph.exceptions import ImproperlyConfigured from investigraph.model.context import SourceContext from investigraph.types import RecordGenerator def extract_...
dataresearchcenter/investigraph-etl
investigraph/logic/extract.py
.py
3fd113c35441a4d1
7.45
7
"""Fetch remote files (e.g. PDFs), store in archive and get Document entities back to work with""" from functools import cache from anystore.types import SDict from anystore.util import join_uri from banal import ensure_dict from ftm_lakehouse import get_archive as get_lakehouse_archive from ftm_lakehouse.model impor...
dataresearchcenter/investigraph-etl
investigraph/logic/fetch.py
.py
eeb91b564ebe87ef
7.45
7
from typing import TYPE_CHECKING from anystore.types import Uri from followthemoney import StatementEntity from ftmq.types import StatementEntities from investigraph.model.context import get_source_context from investigraph.model.mapping import QueryMapping if TYPE_CHECKING: from investigraph.model import Source...
dataresearchcenter/investigraph-etl
investigraph/logic/transform.py
.py
2c63d95085975f61
7.45
7
from anystore.model import Stats from anystore.store.resource import UriResource from anystore.util import ensure_uri, join_relpaths from anystore.util.checksum import make_uri_key from normality import slugify from pydantic import BaseModel from runpandarun import Playbook from runpandarun.util import PathLike, absolu...
dataresearchcenter/investigraph-etl
investigraph/model/source.py
.py
80a609c72d72c98f
7.45
7
""" The main entrypoint for running a dataset config """ from datetime import datetime from anystore.types import Uri from pydantic import BaseModel from investigraph.model.config import Config, get_config from investigraph.model.context import DatasetContext class WorkflowRun(BaseModel): """ Defines a wor...
dataresearchcenter/investigraph-etl
investigraph/pipeline.py
.py
00499a70b2f013cf
7.45
7
import os from pathlib import Path from anystore.model import StoreModel from pydantic import Field from pydantic_settings import BaseSettings, SettingsConfigDict VERSION = "0.9.0" DATA_ROOT = Path( os.environ.get("INVESTIGRAPH_DATA_ROOT", Path.cwd() / "data") ).absolute() class Settings(BaseSettings): """...
dataresearchcenter/investigraph-etl
investigraph/settings.py
.py
c2a381b39a875a41
7.45
7
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/__init__.py
.py
e8545f34eef11f5f
7.66
20
# Copyright 2026 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/_pyqir_compat.py
.py
45f897b2d0b80ec8
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/cirq/elements.py
.py
daf7578415ad7767
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/cirq/qir_target_gateset.py
.py
f563498dd4ecff42
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/cirq/visitor.py
.py
0de3890e0be664d9
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/profiles/core.py
.py
011a45f33637300b
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/qasm3/convert.py
.py
b924e4901e396460
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/qasm3/elements.py
.py
45e16e1c20ddee82
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/qasm3/exceptions.py
.py
289df6f15add4887
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/qasm3/maps.py
.py
db1ff1f2ba017f0e
7.66
20
# Copyright 2026 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/qiskit/elements.py
.py
ddc242773a99f320
7.66
20
# Copyright 2026 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/qiskit/maps.py
.py
33b3f761a4268876
7.66
20
# Copyright 2026 qBraid # # 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, softw...
qBraid/qbraid-qir
qbraid_qir/qiskit/visitor.py
.py
0e029d564ec6d8ff
7.66
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
tests/cirq_qir/fixtures/basic_gates.py
.py
5f011c6c4d6625b3
7.16
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
tests/cirq_qir/test_cirq_decompose.py
.py
e9cc7f8bf606bbb0
7.16
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
tests/cirq_qir/test_cirq_module.py
.py
662b50c5df121e5d
8.16
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
tests/cirq_qir/test_cirq_to_qir.py
.py
a851e51bff906b84
8.16
20
# Copyright 2025 qBraid # # 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, softw...
qBraid/qbraid-qir
tests/cirq_qir/test_serialization.py
.py
9a5dd0c42769a63f
8.16
20
"""Core utilities for detecting the installed Google Chrome version. The functions in this module provide platform-specific strategies to determine the locally installed Google Chrome version. """ # Copyright (c) 2023 Hasan Sezer Taşan <hasansezertasan@gmail.com> # Licensed under the MIT License from __future__ impor...
hasansezertasan/chrome-version
src/chrome_version/core.py
.py
804b4b085d1e728f
7.5
9
"""Tests for the ``chrome-version`` console-script entrypoint.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest from chrome_version import cli if TYPE_CHECKING: from pytest_mock import MockerFixture def test_main_prints_detected_version( monkeypatch: pytest.MonkeyPatch...
hasansezertasan/chrome-version
tests/test_cli.py
.py
3eeb530b908badf2
7
9
"""Tests for the platform-specific Chrome-detection logic in ``core``.""" from __future__ import annotations import subprocess from typing import TYPE_CHECKING, cast from chrome_version import core if TYPE_CHECKING: from pytest_mock import MockerFixture _APP_DIR = r"C:\Program Files\Google\Chrome\Application" ...
hasansezertasan/chrome-version
tests/test_core.py
.py
0d19a1456a1c08d6
7
9
class ApplicationNotFound(Exception): """Application was not found in ApplicationManager by name.""" def __init__(self, app_name): self.app_name = app_name super().__init__( f"Application \"{app_name}\" was not found." ) class ApplicationExecutableNotFound(Exception): ...
ynput/ayon-applications
client/ayon_applications/exceptions.py
.py
83c237f2da79af0e
7.5
9
from __future__ import annotations import platform import logging from abc import ABC, abstractmethod import warnings import typing from typing import Optional, Any from ayon_core.lib import Logger from ayon_core.addon import AddonsManager from .defs import LaunchTypes, ApplicationGroup, Application if typing.TYPE_...
ynput/ayon-applications
client/ayon_applications/hooks.py
.py
56dd2dd733900987
7.5
9
import subprocess from ayon_applications import PreLaunchHook, LaunchTypes class LaunchTerminalWindowsCreationflags(PreLaunchHook): """Avoid running the terminal without new console""" # Should be as last hook because must change launch arguments to string order = 1000 app_groups = {"terminal"} p...
ynput/ayon-applications
client/ayon_applications/hooks/prelaunch_shell_windows.py
.py
8c466a54da2e582b
7.5
9
"""Loader action to open source workfiles in Tray Browser.""" from __future__ import annotations import os import collections from typing import Optional, Any, TYPE_CHECKING import ayon_api from ayon_core.addon import IHostAddon from ayon_core.pipeline.actions import ( LoaderSimpleActionPlugin, LoaderActionSel...
ynput/ayon-applications
client/ayon_applications/plugins/load_actions/open_source_workfile.py
.py
147f6518c30a0013
7.5
9
""" Run after global plugin 'CollectHostName' in ayon_core. Requires: None Provides: context -> hostName (str) context -> appName (str) context -> appLabel (str) """ import os import pyblish.api from ayon_applications import ApplicationManager class CollectAppName(pyblish.api.ContextPlugin): ""...
ynput/ayon-applications
client/ayon_applications/plugins/publish/collect_app_name.py
.py
83c11143d1b338a6
7.5
9
import os import pyblish.api try: from ayon_core.pipeline.publish import FARM_JOB_ENV_DATA_KEY except ImportError: # NOTE Can be removed when ayon-core >= 1.0.10 is required in package.py FARM_JOB_ENV_DATA_KEY = "farmJobEnv" class CollectApplicationsJobEnvVars(pyblish.api.ContextPlugin): """Collect ...
ynput/ayon-applications
client/ayon_applications/plugins/publish/collect_farm_env_variables.py
.py
6924761810b8abe2
7.5
9
import pyblish.api class IntegrateVersionAppNameData(pyblish.api.InstancePlugin): """Add application name to version data.""" label = "Add app name to version data" order = pyblish.api.IntegratorOrder - 0.49 def process(self, instance): version_data = instance.data.setdefault("versionData", {...
ynput/ayon-applications
client/ayon_applications/plugins/publish/integrate_app_name.py
.py
1735929f42caa880
7.5
9
"""ANSI to HTML converter for rendering colored terminal output in a web UI.""" import html import re class AnsiToHtmlConverter: """Convert ANSI escape sequences to HTML formatting.""" # ANSI color codes to HTML colors ANSI_COLORS = { 30: "#000000", # Black 31: "#AA0000", # Red ...
ynput/ayon-applications
client/ayon_applications/ui/ansi_parser.py
.py
0d9bf128f6235ea3
7.5
9
"""Backwards compatibility for applications addon. This should have been backwards compatibility fix for older addons using attributes for applications and tools. But the first release of addon that allows to disable kept the attributes in play and the fix was not needed. This is preparation for following release of ...
ynput/ayon-applications
server/_backwards.py
.py
6aba050b4cc09516
7.5
9
import logging import rv from ayon_core.pipeline.context_tools import get_current_folder_entity log = logging.getLogger(__name__) def reset_frame_range(): """ Set timeline frame range. """ folder_entity = get_current_folder_entity(fields={"path", "attrib"}) folder_path = folder_entity["path"] fo...
ynput/ayon-openrv
client/ayon_openrv/api/commands.py
.py
e9d9c8db370ad95a
7.54
11
import contextlib import rv @contextlib.contextmanager def maintained_view(): """Reset to original view node after context""" original = rv.commands.viewNode() try: yield finally: rv.commands.setViewNode(original) @contextlib.contextmanager def active_view(node): """Set active v...
ynput/ayon-openrv
client/ayon_openrv/api/lib.py
.py
79356e9307fe0279
7.54
11
# -*- coding: utf-8 -*- import os import json import pyblish import rv from ..constants import OPENRV_ROOT_DIR from ayon_core.host import HostBase, ILoadHost, IWorkfileHost, IPublishHost from ayon_core.pipeline import ( register_loader_plugin_path, register_inventory_action_path, register_creator_plugin_...
ynput/ayon-openrv
client/ayon_openrv/api/pipeline.py
.py
e87736dbe340c3ac
7.54
11
"""Networking module for RV communication. Provides socket-based communication with RV for remote control and container loading functionality. """ from __future__ import annotations import json import os import socket from time import sleep, time from typing import TYPE_CHECKING from ayon_api import get_addon_setti...
ynput/ayon-openrv
client/ayon_openrv/networking.py
.py
2fe8183e62705205
7.54
11
import json from ayon_core.lib.transcoding import ( IMAGE_EXTENSIONS, VIDEO_EXTENSIONS ) from ayon_core.pipeline import load from ayon_core.pipeline.load import LoadError from ayon_openrv.networking import RVConnector class PlayInExistingRV(load.LoaderPlugin): """Opens representation with network connected ...
ynput/ayon-openrv
client/ayon_openrv/plugins/load/global/play_in_existing_rv.py
.py
50d3ab1591e3b0b2
7.54
11
import json import ayon_api from ayon_applications import ApplicationManager from ayon_core.lib.transcoding import ( IMAGE_EXTENSIONS, VIDEO_EXTENSIONS ) from ayon_core.pipeline import load from ayon_core.pipeline.load import LoadError from ayon_openrv.networking import RVConnector class PlayInRV(load.LoaderPl...
ynput/ayon-openrv
client/ayon_openrv/plugins/load/global/play_in_rv.py
.py
c8d584daa7e7bb5c
7.54
11
"""Loader for image sequences and single frames in OpenRV.""" from __future__ import annotations import os from typing import ClassVar from ayon_core.lib.transcoding import IMAGE_EXTENSIONS from ayon_core.pipeline import load from ayon_openrv.api.ocio import ( set_group_ocio_active_state, set_group_ocio_colo...
ynput/ayon-openrv
client/ayon_openrv/plugins/load/openrv/load_media.py
.py
86af3762851d113b
7.54
11
import pyblish.api from ayon_core.pipeline import registered_host class CollectCurrentFile(pyblish.api.ContextPlugin): """Inject the current working file into context""" order = pyblish.api.CollectorOrder - 0.5 label = "Collect Current File" hosts = ["openrv"] def process(self, context): ...
ynput/ayon-openrv
client/ayon_openrv/plugins/publish/collect_current_file.py
.py
0f2eb5808a944c44
7.04
11
import os import pyblish.api class CollectWorkfile(pyblish.api.InstancePlugin): """Inject the current working file into context""" order = pyblish.api.CollectorOrder - 0.49 label = "OpenRV Session Workfile" hosts = ["openrv"] families = ["workfile"] def process(self, instance): """In...
ynput/ayon-openrv
client/ayon_openrv/plugins/publish/collect_workfile.py
.py
1d601373522ee867
7.54
11
import os import pyblish.api from ayon_core.lib import version_up from ayon_core.pipeline import registered_host from ayon_core.pipeline.publish import get_errored_plugins_from_context class IncrementWorkfile(pyblish.api.InstancePlugin): """Increment the current workfile. Saves the current scene with an in...
ynput/ayon-openrv
client/ayon_openrv/plugins/publish/increment_workfile.py
.py
d4da58eda695acd5
7.54
11
import pyblish.api from ayon_core.pipeline.publish import PublishValidationError class ValidateCurrentWorkFile(pyblish.api.InstancePlugin): """There must be workfile to publish.""" label = "Validate Workfile" order = pyblish.api.ValidatorOrder - 0.1 hosts = ["openrv"] families = ["workfile"] ...
ynput/ayon-openrv
client/ayon_openrv/plugins/publish/validate_workfile.py
.py
9c8e3f9fd8aaaffc
7.54
11
import importlib import json import logging import os import sys import traceback from functools import partial from typing import Callable import rv.qtutils from ayon_api import get_representations from ayon_core.pipeline import ( get_current_project_name, install_host, load_container, registered_host...
ynput/ayon-openrv
client/ayon_openrv/startup/pkgs_source/ayon_menus/ayon_menus.py
.py
db1f1f2c30702162
7.54
11
import rv.commands import rv.qtutils from rv.rvtypes import MinorMode from qtpy import QtCore from ayon_core.tools.console_interpreter.ui.window import ( ConsoleInterpreterWindow ) class AYONMenus(MinorMode): def __init__(self): MinorMode.__init__(self) self.init( name="py-ayon-...
ynput/ayon-openrv
client/ayon_openrv/startup/pkgs_source/ayon_scripteditor/ayon_scripteditor.py
.py
5612d7c406453971
7.54
11
"""Type hints for rv.commands module.""" from typing import Any, Callable, Dict, List, Optional, Tuple, Union # Type aliases for common return types Vector2f = List[float] # 2D vector Vector4f = List[float] # 4D vector (RGBA) StringProperty = str IntProperty = int FloatProperty = float HalfProperty = float ByteProp...
ynput/ayon-openrv
client/ayon_openrv/typing/rv/commands/__init__.py
.py
80052dce5d560248
7.54
11
#!/usr/bin/env python """Prepares server package from addon repo to upload to server. Requires Python 3.9. (Or at least 3.8+). This script should be called from cloned addon repo. It will produce 'package' subdirectory which could be pasted into server addon directory directly (eg. into `ayon-backend/addons`). For...
ynput/ayon-openrv
create_package.py
.py
c97d95f32e2a279e
7.54
11
"""Providing models and setting values for image IO in OpenRV.""" from ayon_server.settings import ( BaseSettingsModel, SettingsField, ) class ImageIOConfigModel(BaseSettingsModel): override_global_config: bool = SettingsField( False, title="Override global OCIO config" ) filepath...
ynput/ayon-openrv
server/settings/imageio.py
.py
c57b9a50d515b5a9
7.54
11
import pathlib from typing import TextIO from toktagger.api.config import Settings def create_default_toml_file(file_path: pathlib.Path | str): """ Create a TOML file containing all possible settings options, with their defaults and descriptions (if available) Parameters ---------- file_path : pa...
ukaea/toktagger
scripts/generate_example_config.py
.py
d383da99a5b8c51b
7.45
7
"""Tests which are common to multiple endpoints which can be parametrized.""" import pytest from bson.objectid import ObjectId from tests.db_definitions import SAMPLE_1, ANNOTATION_1 def create_endpoint( endpoint: str, test_component: str, db_ids: dict, invalid_obj_id: bool ): """Create valid endpoint by ins...
ukaea/toktagger
tests/api/routers/test_common.py
.py
62b3ff1d52ac7ff1
7.95
7
from abc import ABC from typing import Optional import random from toktagger.api.schemas.samples import Sample from toktagger.api.schemas.annotations import Annotation from toktagger.api.schemas.projects import QueryStrategyType import logging logger = logging.getLogger(__name__) class QueryStrategy(ABC): """B...
ukaea/toktagger
toktagger/api/core/query_strategy.py
.py
82bf955fd6e19f23
7.45
7
import requests from toktagger.api.schemas.samples import SampleUpdateBatchItem from toktagger.api.schemas.models import ModelUpdate from toktagger.api.schemas.annotations import AnnotationBatchTypes import typing import os def send_updates( object_type: str, url: str, updates: ModelUpdate | list[typi...
ukaea/toktagger
toktagger/api/core/sender.py
.py
43c24d2a2b6e96b1
7.45
7
"""Store SDK runtime helpers in the current execution context. Why context variables are used ------------------------------ An application can run several SDK instances at the same time. The instances can also use the same event loop. A thread-local variable cannot distinguish tasks that share one thread. A normal m...
nebius/pysdk
src/nebius/aio/_task_context.py
.py
fc01ac50341770ec
7.62
16
"""Define asynchronous protocols for the SDK. The channel and related components implement these small :class:`typing.Protocol` interfaces. Applicable protocols support runtime checks for unit tests. """ from collections.abc import Awaitable from typing import Protocol, TypeVar, runtime_checkable from .authorization...
nebius/pysdk
src/nebius/aio/abc.py
.py
b4338473bbfabd8e
7.62
16
"""Token-based authenticators and providers. This module provides a small concrete implementation of the authorization interfaces that fetches bearer tokens from a token provider and injects them into request metadata. """ from ...base.metadata import Metadata from ..token import token from .authorization import Auth...
nebius/pysdk
src/nebius/aio/authorization/token.py
.py
84bc4d44cb5d7807
7.62
16
"""Thin wrappers around the underlying gRPC channel used by the SDK. This module exposes two small helper classes: - :class:`AddressChannel` pairs a :class:`grpc.aio.Channel` with the resolved address string used to create it. The SDK uses this wrapper to keep track of which transport channel corresponds to which...
nebius/pysdk
src/nebius/aio/base.py
.py
718a9d16b439b4ae
7.62
16
"""Define base classes for generated SDK clients. Generated clients inherit these small base classes. The classes wrap a ``ClientChannelInterface`` and supply a ``request`` factory for generated RPC methods. Application code must not create these types directly. They supply a common structure for code generated from ...
nebius/pysdk
src/nebius/aio/client.py
.py
1ac93c8da3d704e8
7.62
16