repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
saleor
saleor/tests/e2e/checkout/discounts/sales/test_checkout_product_on_percentage_sale.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils.preparing_product import prepare_products from ....sales.utils import ( create_sale, create_sale_channel_listing, sale_catalogues_add, ) from ....shop.utils import prepare_default_shop from ....
407
15,654
pyomo
examples/pyomobook/blocks-ch/lotsizing.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
73
2,115
saleor
saleor/webhook/tests/test_webhook_payloads.py
.py
import datetime import json from dataclasses import asdict from decimal import Decimal from itertools import chain from unittest import mock from unittest.mock import ANY, sentinel import graphene import pytest from django.contrib.sites.models import Site from django.core.serializers.json import DjangoJSONEncoder from...
1,813
67,599
onnx
onnx/backend/test/case/node/reduceprod.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class ReduceProd(Base): @staticmethod def export_do_not_keepdims() -...
188
5,303
httpie
httpie/manager/tasks/__init__.py
.py
from httpie.manager.tasks.sessions import cli_sessions from httpie.manager.tasks.export_args import cli_export_args from httpie.manager.tasks.plugins import cli_plugins from httpie.manager.tasks.check_updates import cli_check_updates CLI_TASKS = { 'sessions': cli_sessions, 'export-args': cli_export_args, '...
12
384
luigi
test/custom_metrics_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2017 Spotify AB # # 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...
107
3,638
probability
discussion/robust_inverse_graphics/util/tree_util.py
.py
# Copyright 2024 The TensorFlow Probability Authors. # # 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 o...
145
4,402
openvino
tests/e2e_tests/common/ref_collector/score_onnx_runtime.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import sys from e2e_tests.common.multiprocessing_utils import multiprocessing_run from e2e_tests.common.ref_collector.provider import ClassProvider class ONNXRuntimeRunner(ClassProvider): """Base class for in...
75
3,810
ipython
IPython/core/magics/history.py
.py
"""Implementation of magic functions related to History. """ #----------------------------------------------------------------------------- # Copyright (c) 2012, IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with th...
362
13,297
mlflow
tests/store/_unity_catalog/model_registry/test_unity_catalog_rest_store.py
.py
import base64 import json import os import shutil from itertools import combinations from unittest import mock from unittest.mock import ANY import pandas as pd import pytest import yaml from botocore.client import BaseClient from google.cloud.storage import Client from requests import Response from mlflow.data.datas...
3,005
112,981
saleor
saleor/webhook/tests/response_schemas/test_helpers.py
.py
from pydantic import BaseModel, ValidationError from ...response_schemas.utils.helpers import parse_validation_error class ExampleSchema(BaseModel): field1: int field2: str def test_parse_validation_error_single_error(): # given invalid_data = {"field1": "not_an_int", "field2": "valid_string"} ...
56
1,623
onnxruntime
onnxruntime/test/python/transformers/test_moe_cpu.py
.py
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # # Reg...
474
16,370
hatch
backend/src/hatchling/version/scheme/plugin/interface.py
.py
from __future__ import annotations import os from abc import ABC, abstractmethod from functools import cached_property class VersionSchemeInterface(ABC): # no cov """ Example usage: ```python tab="plugin.py" from hatchling.version.scheme.plugin.interface import VersionSchemeInterface class Sp...
86
2,384
mlflow
tests/rfunc/test_backend.py
.py
from unittest import mock import pytest from mlflow.rfunc.backend import RFuncBackend, _r_quote @pytest.mark.parametrize( ("value", "expected"), [ ("localhost", "'localhost'"), ("0.0.0.0", "'0.0.0.0'"), ("foo bar", "'foo bar'"), ("it's", "'it\\'s'"), ("back\\slash", "...
79
2,551
django-cms
cms/tests/test_i18n.py
.py
from importlib import import_module from unittest.mock import patch from django.conf import settings from django.template.context import Context from django.test.utils import override_settings from django.utils import translation from cms import api from cms.test_utils.testcases import CMSTestCase from cms.utils impo...
676
24,742
qutip
qutip/tests/test_qip.py
.py
import sys import pytest @pytest.fixture def without_qutip_qip(monkeypatch): monkeypatch.setitem(sys.modules, "qutip_qip", None) monkeypatch.delitem(sys.modules, "qutip.qip", raising=False) @pytest.fixture def with_qutip_qip_stub(tmp_path, monkeypatch): pkg_dir = tmp_path / "qutip_qip" pkg_dir.mkdi...
47
1,373
clearml
clearml/backend_api/services/v2_9/queues.py
.py
""" queues service Provides a management API for queues of tasks waiting to be executed by workers deployed anywhere (see Workers Service). """ from typing import List, Optional, Any from datetime import datetime import six from dateutil.parser import parse as parse_datetime from ....backend_api.session import ( N...
2,152
70,184
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/german_credit_numeric_sparse_logistic_regression.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # 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 o...
207
5,398
luigi
test/test_sigpipe.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
97
2,858
confluent-kafka-python
src/confluent_kafka/schema_registry/wildcard_matcher.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2024 Confluent 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 requi...
96
2,878
clearml
clearml/backend_api/services/v2_20/models.py
.py
""" models service This service provides a management interface for models (results of training tasks) stored in the system. """ from typing import List, Optional, Any import six from datetime import datetime from dateutil.parser import parse as parse_datetime from clearml.backend_api.session import ( Request, ...
4,549
155,511
black
tests/data/cases/long_strings__type_annotations.py
.py
def func( arg1, arg2, ) -> Set["this_is_a_very_long_module_name.AndAVeryLongClasName" ".WithAVeryVeryVeryVeryVeryLongSubClassName"]: pass def func( argument: ( "VeryLongClassNameWithAwkwardGenericSubtype[int] |" "VeryLongClassNameWithAwkwardGenericSubtype[str]" ), ) -> ( ...
60
1,075
ipython
tests/test_pylabtools.py
.py
"""Tests for pylab tools module.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import sys from binascii import a2b_base64 from io import BytesIO import pytest matplotlib = pytest.importorskip("matplotlib") matplotlib.use("Agg") from matplotlib.figure import...
412
12,360
saleor
saleor/graphql/app/tests/mutations/test_app_problem_create_aggregation.py
.py
import datetime from django.utils import timezone from .....app.models import AppProblem from ....tests.utils import get_graphql_content APP_PROBLEM_CREATE_MUTATION = """ mutation AppProblemCreate($input: AppProblemCreateInput!) { appProblemCreate(input: $input) { appProblem { ...
215
5,912
hypercorn
src/hypercorn/__main__.py
.py
from __future__ import annotations import argparse import ssl import sys import warnings from .config import Config from .run import run sentinel = object() def _load_config(config_path: str | None) -> Config: if config_path is None: return Config() elif config_path.startswith("python:"): r...
317
11,167
sqlmap
extra/dbwire/__init__.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ """ dbwire - minimal, dependency-free (stdlib-only) database wire-protocol clients used as a fallback for sqlmap's direct ('-d') connection when no native driver (and no SQLAlchem...
127
4,086
pdm
src/pdm/models/setup.py
.py
from __future__ import annotations import ast import os from collections.abc import Iterable from configparser import ConfigParser from dataclasses import asdict, dataclass, field, fields from importlib.metadata import Distribution from pathlib import Path from typing import TYPE_CHECKING, Any, no_type_check if TYPE_...
447
15,379
wagtail
wagtail/project_template/project_name/settings/production.py
.py
from .base import * DEBUG = False # ManifestStaticFilesStorage is recommended in production, to prevent # outdated JavaScript / CSS assets being served from cache # (e.g. after a Wagtail upgrade). # See https://docs.djangoproject.com/en/{{ docs_version }}/ref/contrib/staticfiles/#manifeststaticfilesstorage STORAGES["...
15
471
mlflow
dev/generate_protos.py
.py
import platform import subprocess import tempfile import textwrap import urllib.request import zipfile from pathlib import Path from typing import Literal SYSTEM = platform.system() MACHINE = platform.machine() CACHE_DIR = Path(".cache/protobuf_cache") MLFLOW_PROTOS_DIR = Path("mlflow/protos") TEST_PROTOS_DIR = Path("...
334
10,408
tablib
src/tablib/utils.py
.py
__lazy_modules__ = {"io"} from io import BytesIO, StringIO def normalize_input(stream): """ Accept either a str/bytes stream or a file-like object and always return a file-like object. """ if isinstance(stream, str): return StringIO(stream, newline='') elif isinstance(stream, bytes): ...
16
369
biopython
Tests/test_SearchIO_hmmer3_text.py
.py
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for SearchIO HmmerIO parsers.""" import os import unittest from Bio.SearchIO im...
2,810
128,263
hydra
plugins/hydra_optuna_sweeper/example/multi-objective.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Tuple import hydra from omegaconf import DictConfig @hydra.main(config_path="multi-objective-conf", config_name="config") def binh_and_korn(cfg: DictConfig) -> Tuple[float, float]: x: float = cfg.x y: float = cfg.y ...
20
450
astropy
astropy/visualization/time.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from datetime import datetime import numpy as np from astropy import units as u from astropy.time import Time __all__ = ["time_support"] __doctest_requires__ = {"time_support": ["matplotlib"]} UNSUPPORTED_FORMATS = ("datetime", "datetime64") YMDHMS_F...
248
9,546
kombu
t/unit/transport/test_consul.py
.py
from __future__ import annotations from array import array from queue import Empty from unittest.mock import Mock import pytest from kombu.transport.consul import Channel, Transport pytest.importorskip('consul') class test_Consul: def setup_method(self): self.connection = Mock() self.connecti...
86
2,681
saleor
saleor/tests/e2e/orders/test_order_created_by_staff_member.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..orders.utils.draft_order_complete import draft_order_complete from ..orders.utils.draft_order_create import draft_order_create from ..orders.utils.draft_order_update import draft_order_update from ..orders.utils.order_lines_create import order_lines_create from ..pro...
107
3,189
pyomo
pyomo/contrib/parmest/utils/mpi_utils.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
164
5,840
pyro
pyro/contrib/randomvariable/__init__.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from pyro.contrib.randomvariable.random_variable import RandomVariable __all__ = [ "RandomVariable", ]
9
193
readthedocs.org
readthedocs/api/v3/renderers.py
.py
"""Renders with some extra capabilities we require for our own purposes.""" import json from rest_framework.compat import INDENT_SEPARATORS from rest_framework.compat import LONG_SEPARATORS from rest_framework.compat import SHORT_SEPARATORS from rest_framework.renderers import JSONRenderer class AlphabeticalSortedJ...
58
1,951
python-prompt-toolkit
examples/print-text/true-color-demo.py
.py
#!/usr/bin/env python """ Demonstration of all the ANSI colors. """ from prompt_toolkit import print_formatted_text from prompt_toolkit.formatted_text import HTML, FormattedText from prompt_toolkit.output import ColorDepth print = print_formatted_text def main(): print(HTML("\n<u>True color test.</u>")) fo...
37
1,025
probability
tensorflow_probability/python/experimental/mcmc/elliptical_slice_sampler_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # 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 o...
208
7,236
pyro
tests/contrib/mue/test_missingdatahmm.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pyro.contrib.mue.missingdatahmm import MissingDataDiscreteHMM from pyro.distributions import Categorical, DiscreteHMM def test_hmm_log_prob(): a0 = torch.tensor([0.9, 0.08, 0.02]) a = torch.te...
557
18,642
onnx
onnx/backend/test/case/node/identity.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Identity(Base): @staticmethod def export() -> None: no...
94
2,369
deap
deap/tools/migration.py
.py
def migRing(populations, k, selection, replacement=None, migarray=None): """Perform a ring migration between the *populations*. The migration first select *k* emigrants from each population using the specified *selection* operator and then replace *k* individuals from the associated population in the *m...
52
2,726
mlflow
mlflow/genai/scorers/google_adk/utils.py
.py
"""Utility functions for Google ADK integration.""" from __future__ import annotations import asyncio import concurrent.futures import json from typing import Any from mlflow.entities.trace import Trace from mlflow.exceptions import MlflowException GOOGLE_ADK_NOT_INSTALLED_ERROR_MESSAGE = ( "Google ADK scorers ...
164
5,479
pyomo
pyomo/core/tests/unit/test_preprocess.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
51
1,843
pyomo
pyomo/contrib/pyros/config.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
906
31,449
mlflow
mlflow/genai/judges/builtin_judges.py
.py
from mlflow.genai.judges.base import Judge from mlflow.genai.scorers.builtin_scorers import BuiltInScorer class BuiltinJudge(BuiltInScorer, Judge): """ Base class for built-in AI judge scorers that use LLMs for evaluation. """
9
241
textual
tests/renderables/test_text_opacity.py
.py
import pytest from rich.text import Text from tests.utilities.render import render from textual.renderables.text_opacity import TextOpacity STOP = "\x1b[0m" @pytest.fixture def text(): return Text("Hello, world!", style="#ff0000 on #00ff00", end="") def test_simple_text_opacity(text): blended_red_on_green...
45
1,300
pyomo
pyomo/core/expr/base.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
451
15,427
pyomo
examples/pyomobook/abstract-ch/set4.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
21
736
ipython
IPython/core/extensions.py
.py
"""A class for managing IPython extensions.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import os.path import sys from importlib import import_module, reload from traitlets.config.configurable import Configurable from IPython.utils.path import ens...
135
4,980
astropy
astropy/constants/iau2012.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants in SI units. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ import numpy as np from .constant import Constant # ASTRONOMICAL CONSTANTS class IAU2012(Constant): defau...
149
2,570
probability
tensorflow_probability/tools/build_docs.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # 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 o...
81
2,486
openvino
src/bindings/python/tests/test_graph/test_any.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import OVAny import pytest @pytest.mark.parametrize(("value", "data_type"), [ ("test_string", str), (2137, int), (21.37, float), (False, bool), ([1, 2, 3], list), ((1, 2, 3)...
103
2,601
astropy
astropy/cosmology/_src/traits/scale_factor.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Scale factor. This is private API. See `~astropy.cosmology.traits` for public API. """ __all__ = ("ScaleFactor",) from numpy.typing import ArrayLike import astropy.units as u from astropy.cosmology._src.utils import aszarr class ScaleFactor: ...
58
1,635
conda
tests/cli/test_conda_argparse.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import importlib from inspect import isclass, isfunction from logging import getLogger from typing import TYPE_CHECKING import pytest from conda.cli.conda_argparse import ( ArgumentParser, _GreedySub...
160
6,491
saleor
saleor/core/notification/utils.py
.py
from django.contrib.sites.models import Site from django.contrib.staticfiles.storage import staticfiles_storage from ..utils import build_absolute_uri, get_domain LOGO_URL = "images/saleor-logo-sign.png" def get_site_context(): site: Site = Site.objects.get_current() site_context = { "domain": get_d...
17
466
openvino
tests/layer_tests/ovc_python_api_tests/test_ovc_cli_tool.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import re import sys import tempfile import unittest from pathlib import Path import numpy as np import openvino as ov from openvino import PartialShape, Model from openvino.test_utils import compare_functions from openvino.to...
211
7,778
pyomo
examples/pyomobook/abstract-ch/param7a.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
24
839
openvino
tools/benchmark_tool/openvino/tools/benchmark/parameters.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys, argparse from openvino.tools.benchmark.utils.utils import show_available_devices INPUT_OUTPUT_PRECISION_CHOICES = [ 'bool', \ 'f16', 'f32', 'f64', \ 'i8', 'i16', 'i32', 'i64', \ 'u8', 'u16', 'u32', 'u64'] d...
210
17,070
coremltools
coremltools/converters/mil/testing_reqs.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import os from typing import List import numpy as np import pytest from attrs import define, field, v...
175
6,533
sqlmap
lib/parse/html.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import re from xml.sax.handler import ContentHandler from lib.core.common import singleTimeWarnMessage from lib.core.common import urldecode from lib.core.common import parseXml...
106
3,506
wandb
wandb/errors/links.py
.py
"""Module containing the WBURLs class and WBURL dataclass. Used to store predefined URLs that can be associated with a name. The URLs are shortened using with the `wandb.me` domain, using dub.co as the shortening service. If the URLs need to be updates, use the dub.co service to point to the new URL. """ from __futur...
74
2,520
probability
tensorflow_probability/python/experimental/fastgp/schur_complement_test.py
.py
# Copyright 2024 The TensorFlow Probability Authors. # # 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 o...
98
3,081
coveragepy
coverage/templite.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """A simple Python template renderer, for a nano-subset of Django syntax. For a detailed discussion of this code, see this chapter from 500 Lines: http://aosaboo...
316
11,314
probability
tensorflow_probability/python/distributions/internal/stochastic_process_util.py
.py
# Copyright 2023 The TensorFlow Probability Authors. # # 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 o...
249
10,237
mlflow
tests/store/artifact/test_artifact_repository_registry.py
.py
from importlib import reload from unittest import mock import pytest import mlflow from mlflow.store.artifact import artifact_repository_registry from mlflow.store.artifact.artifact_repository_registry import ArtifactRepositoryRegistry def test_standard_artifact_registry(): mock_entrypoint = mock.Mock() moc...
117
4,103
sphinx
sphinx/util/console.py
.py
"""Format colored console output.""" from __future__ import annotations import shutil import sphinx._cli.util.colour from sphinx._cli.util.colour import ( # NoQA: F401 _create_input_mode_colour_func, black, blink, blue, bold, brown, colourise, darkblue, darkgray, darkgreen, ...
77
1,806
cvxpy
cvxpy/lin_ops/lin_constraints.py
.py
""" Copyright 2013 Steven Diamond 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, software...
31
1,126
scikit-optimize
skopt/sampler/grid.py
.py
""" Inspired by https://github.com/jonathf/chaospy/blob/master/chaospy/ distributions/sampler/sequences/grid.py """ import numpy as np from .base import InitialPointGenerator from ..space import Space from sklearn.utils import check_random_state def _quadrature_combine(args): args = [np.asarray(arg).reshape(len(a...
171
6,250
omegaconf
tests/test_tuple_merge.py
.py
from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Tuple from pytest import mark, raises from omegaconf import ( DictConfig, ListConfig, OmegaConf, TupleConfig, ValidationError, ) from omegaconf.basecontainer import _deep_update_type_hint from omegaconf.errors i...
164
4,849
httpie
tests/test_httpie.py
.py
"""High-level tests.""" import io from unittest import mock import pytest import httpie import httpie.__main__ from .fixtures import FILE_CONTENT, FILE_PATH from httpie.cli.exceptions import ParseError from httpie.context import Environment from httpie.encoding import UTF8 from httpie.status import ExitStatus from .u...
373
10,381
metrics
src/torchmetrics/functional/image/rase.py
.py
# Copyright The PyTorch Lightning team. # # 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 i...
103
3,980
saleor
saleor/graphql/account/mutations/authentication/verify_token.py
.py
import graphene from django.core.exceptions import ValidationError from graphene.types.generic import GenericScalar from ....core import ResolveInfo from ....core.doc_category import DOC_CATEGORY_AUTH from ....core.mutations import BaseMutation from ....core.types import AccountError from ...types import User from .ut...
56
1,748
probability
tensorflow_probability/python/distributions/mvn_diag_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # 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 o...
351
13,883
mlflow
mlflow/utils/databricks_sql_warehouse.py
.py
""" Helpers for making sure a Databricks SQL warehouse is running before MLflow tracing API calls that require it. """ import logging import time from datetime import timedelta from mlflow.environment_variables import ( MLFLOW_SQL_WAREHOUSE_AUTO_START, MLFLOW_SQL_WAREHOUSE_AUTO_START_TIMEOUT_SECONDS, ) from m...
85
3,115
probability
tensorflow_probability/python/internal/backend/numpy/__init__.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # 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 o...
58
3,664
coremltools
coremltools/proto/OneHotEncoder_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: OneHotEncoder.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message fro...
45
2,178
conda
tests/test_utils.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import sys from logging import getLogger from os import environ, pathsep from os.path import dirname, join from shutil import which from typing import TYPE_CHECKING import pytest from conda import CondaError...
204
7,288
cvxpy
cvxpy/tests/test_nonlinear_atoms.py
.py
""" Copyright 2013 Steven Diamond, Eric Chu 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...
233
8,107
wandb
wandb/sdk/launch/registry/google_artifact_registry.py
.py
"""Implementation of Google Artifact Registry for wandb launch.""" from __future__ import annotations import logging import google.auth # type: ignore import google.cloud.artifactregistry # type: ignore from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.utils import ( GCP_ARTIFACT_REGISTRY_...
221
8,494
openvino
tests/layer_tests/pytorch_tests/test_softplus.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_softplus(torch.nn.Module): def forward(self, x): return torch.nn.functional.softplus(x) class TestSoftplus(PytorchLayerTest): ...
25
663
django-cms
cms/test_utils/project/app_with_bad_cms_file/apps.py
.py
from django.apps import AppConfig class BadCMSFileConfig(AppConfig): name = 'cms.test_utils.project.app_with_bad_cms_file' label = 'bad_cms_file'
7
156
wandb
wandb/sdk/artifacts/_generated/link_artifact.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import ArtifactMembershipFragment class LinkArtifact(GQLResult): result: LinkArtifactResult | None class LinkArtifactR...
26
587
omegaconf
tests/test_basic_ops_list.py
.py
# -*- coding: utf-8 -*- import re from contextlib import AbstractContextManager, nullcontext from pathlib import Path from textwrap import dedent from typing import Any, Callable, List, MutableSequence, Optional, Union from pytest import mark, param, raises from omegaconf import ( MISSING, AnyNode, DictCo...
1,278
34,533
textual
tests/command_palette/test_run_on_select.py
.py
from functools import partial from textual.app import App from textual.command import CommandPalette, Hit, Hits, Provider from textual.widgets import Input class SimpleSource(Provider): async def search(self, _: str) -> Hits: def goes_nowhere_does_nothing(selection: int) -> None: assert isins...
68
2,390
saleor
saleor/shipping/tests/fixtures/shipping_method.py
.py
import pytest from ....core.prices import Money from ...models import ShippingMethod, ShippingMethodChannelListing, ShippingMethodType @pytest.fixture def shipping_method(shipping_zone, channel_USD, default_tax_class): method = ShippingMethod.objects.create( name="DHL", type=ShippingMethodType.PR...
101
2,957
django-cms
cms/test_utils/project/app_with_cms_feature/cms_config.py
.py
from cms.app_base import CMSAppExtension class CMSSomeFeatureConfig(CMSAppExtension): def __init__(self, *args, **kwargs): self.num_configured_apps = 0 self.configured_apps = [] def configure_app(self, cms_config): self.num_configured_apps += 1 self.configured_apps.append(cms...
13
346
mlflow
mlflow/tracking/_model_registry/client.py
.py
""" Internal package providing a Python CRUD interface to MLflow models and versions. This is a lower level API than the :py:mod:`mlflow.tracking.fluent` module, and is exposed in the :py:mod:`mlflow.tracking` module. """ import logging from typing import Any from pydantic import BaseModel from mlflow.entities.model...
926
32,992
onnxruntime
onnxruntime/test/contrib_ops/attention_lstm_data_gen.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import tensorflow as tf batchSize = 2 # noqa: N816 memMaxStep = 3 # noqa: N816 memDepth = 3 # noqa: N816 queryMaxStep = 4 # noqa: N816 queryDepth = 3 # noqa: N816 am_attn_size: int = 2 cell_hidden_size = 3 aw_attn_size...
425
11,825
mlflow
mlflow/genai/scorers/google_adk/__init__.py
.py
""" Google ADK integration for MLflow. This module provides integration with Google Agent Development Kit (ADK) evaluators, allowing them to be used with MLflow's scorer interface for agent evaluation. Example usage: .. code-block:: python from mlflow.genai.scorers.google_adk import ToolTrajectory, ResponseMatc...
722
24,388
textual
src/textual/app.py
.py
""" Here you will find the [App][textual.app.App] class, which is the base class for Textual apps. See [app basics](/guide/app) for how to build Textual apps. """ from __future__ import annotations import asyncio import importlib import inspect import io import mimetypes import os import signal import sys import th...
5,041
184,776
metrics
tests/unittests/text/test_rouge.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
328
11,821
saleor
saleor/shipping/tests/webhooks/test_shared.py
.py
from unittest import mock import graphene from promise import Promise from ....webhook.event_types import WebhookEventSyncType from ....webhook.models import Webhook from ....webhook.response_schemas.shipping import logger as schema_logger from ....webhook.response_schemas.utils.annotations import logger as annotatio...
125
3,838
saleor
saleor/graphql/product/tests/queries/variants_where/test_over_attributes.py
.py
import graphene import pytest from ......attribute.utils import associate_attribute_values_to_instance from .....tests.utils import get_graphql_content from .shared import PRODUCT_VARIANTS_WHERE_QUERY @pytest.mark.parametrize( ("_case", "attributes_value"), [ ("empty_list", []), ("null", None...
208
5,748
scikit-optimize
skopt/tests/test_gp_opt.py
.py
import numpy as np from numpy.testing import assert_array_equal import pytest from skopt import gp_minimize from skopt.benchmarks import bench1 from skopt.benchmarks import bench2 from skopt.benchmarks import bench3 from skopt.benchmarks import bench4 from skopt.benchmarks import branin from skopt.space.space import R...
168
5,625
jupytext
tests/data/notebooks/outputs/ipynb_to_marimo/Notebook with function and cell metadata 164.py
.py
import marimo __generated_with = "0.17.8" app = marimo.App() @app.cell def _(): 1 + 1 return @app.cell(hide_code=True) def _(mo): mo.md(r""" A markdown cell And below, the cell for function f has non trivial cell metadata. And the next cell as well. """) return @app.function def f(x):...
55
610
scikit-bio
skbio/diversity/beta/_unifrac.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
620
23,149
textual
src/textual/await_complete.py
.py
from __future__ import annotations from asyncio import Future, gather from typing import TYPE_CHECKING, Any, Awaitable, Generator import rich.repr from typing_extensions import Self from textual._debug import get_caller_file_and_line from textual.message_pump import MessagePump if TYPE_CHECKING: from textual.ty...
86
2,598
onnxruntime
onnxruntime/python/tools/transformers/models/longformer/longformer_helper.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # This s...
77
3,047