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
textual
tests/suggester/test_suggest_from_list.py
.py
from __future__ import annotations import pytest from textual.dom import DOMNode from textual.suggester import SuggestFromList, SuggestionReady countries = ["England", "Portugal", "Scotland", "portugal", "PORTUGAL"] class LogListNode(DOMNode): def __init__(self, log_list: list[tuple[str, str]]) -> None: ...
56
1,470
openvino
src/frontends/onnx/tests/tests_python/test_ops_unary.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import onnx import pytest from onnx.helper import make_graph, make_model, make_node, make_tensor_value_info from openvino.exceptions import OVTypeError from tests.runtime import get_runtime fro...
513
18,722
pyomo
pyomo/neos/tests/__init__.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...
12
588
hydra
examples/configure_hydra/job_override_dirname/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os from omegaconf import DictConfig import hydra @hydra.main(config_path=".", config_name="config") def my_app(_cfg: DictConfig) -> None: print(f"Working dir {os.getcwd()}") if __name__ == "__main__": my_app()
16
302
sqlmap
tests/test_dump_format.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Output formatting of the result dumper (lib/core/dump.py) and the SQLite replication backend (lib/core/replication.py). dump.Dump turns extracted DB structures (schemas, table/column...
470
19,831
kafka
tests/kafkatest/tests/client/truncation_test.py
.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
158
7,057
readthedocs.org
readthedocs/profiles/views.py
.py
"""Views for creating, editing and viewing site-specific user profiles.""" from enum import StrEnum from enum import auto import structlog from allauth.account.views import LoginView as AllAuthLoginView from allauth.account.views import LogoutView as AllAuthLogoutView from allauth.socialaccount import providers from ...
478
17,794
luigi
test/recursion_test.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...
52
1,547
wagtail
wagtail/admin/forms/view_restrictions.py
.py
from django import forms from django.contrib.auth.models import Group from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy from wagtail.models import BaseViewRestriction class BaseViewRestrictionForm(forms.ModelForm): restriction_type = forms.ChoiceField( la...
45
1,472
pyro
pyro/distributions/folded.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from torch.distributions import constraints from torch.distributions.transforms import AbsTransform from pyro.distributions.torch import TransformedDistribution class FoldedDistribution(TransformedDistribution): """ Equi...
36
1,290
mlflow
mlflow/tracing/locations.py
.py
from mlflow.entities.trace_location import UnityCatalog __all__ = ["UnityCatalog"]
4
84
deap
doc/code/benchmarks/bohachevsky.py
.py
from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.colors import LogNorm import matplotlib.pyplot as plt try: import numpy as np except: exit() from deap import benchmarks def bohachevsky_arg0(sol): return benchmarks.bohachevsky(sol)[0] fig = plt.figure() ax = Axes3D(fig, ...
30
699
coremltools
coremltools/models/tree_ensemble.py
.py
# Copyright (c) 2017, 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 """ Tree ensemble builder class to construct CoreML models. """ import collections as _collections from...
432
15,797
pyomo
examples/pyomobook/pyomo-components-ch/set_misc.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...
94
2,532
ipython
IPython/utils/timing.py
.py
""" Utilities for timing code execution. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #-...
136
4,600
saleor
saleor/graphql/order/tests/mutations/test_order_refund.py
.py
from decimal import Decimal from unittest.mock import patch import graphene from .....order import FulfillmentStatus from .....order import events as order_events from .....order.error_codes import OrderErrorCode from .....payment import ChargeStatus from ....payment.types import PaymentChargeStatusEnum from ....test...
226
8,095
wagtail
wagtail/documents/tests/utils.py
.py
from django.core.files.base import ContentFile def get_test_document_file(): fake_file = ContentFile(b"A boring example document") fake_file.name = "test.txt" return fake_file
8
190
textual
tests/suggester/test_suggester.py
.py
from __future__ import annotations import pytest from textual.dom import DOMNode from textual.suggester import Suggester, SuggestionReady class FillSuggester(Suggester): async def get_suggestion(self, value: str): if len(value) <= 10: return f"{value:x<10}" class LogListNode(DOMNode): ...
112
3,211
openvino
docs/openvino_sphinx_theme/setup.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from setuptools import setup setup( name='openvino-sphinx-theme', version='0.0.2', packages=['openvino_sphinx_theme'], maintainer='OpenVINO Documentation Team', include_package_data=True, entry_points={"sphinx.ht...
22
665
saleor
saleor/account/i18n.py
.py
import logging from collections import defaultdict import i18naddress from django import forms from django.core.exceptions import ValidationError from django.forms import BoundField from django.forms.models import ModelFormMetaclass from django_countries import countries from .i18n_valid_address_extension import VALI...
344
12,214
django-cms
cms/test_utils/project/emailuserapp/forms.py
.py
from django import forms from django.contrib.auth import get_user_model from django.contrib.auth.forms import ReadOnlyPasswordHashField from .models import EmailUser class UserCreationForm(forms.ModelForm): """ A form for creating a new user, including the required email and password fields. """ ...
114
3,518
probability
tensorflow_probability/python/bijectors/cholesky_outer_product_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...
162
6,507
qutip
qutip/tests/solver/test_dysolve_propagator.py
.py
from qutip.solver.dysolve_propagator import DysolvePropagator, dysolve_propagator from qutip.solver import propagator from qutip.solver.cy.dysolve import cy_compute_integrals from qutip import ( sigmax, sigmay, sigmaz, qeye, qeye_like, tensor, enr_destroy, CoreOptions ) from scipy.special import factorial import nu...
367
9,881
coveragepy
tests/moremodules/othermods/otherb.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 q = 3 r = 4
6
170
onnx
onnx/backend/test/case/node/momentum.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 from onnx.defs import AI_ONNX_PREVIEW_TRAINING_DOMAIN def apply_momentum(r, ...
163
5,293
cvxpy
cvxpy/tests/test_quad_form.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...
358
13,856
pyfilesystem2
fs/opener/zipfs.py
.py
# coding: utf-8 """`ZipFS` opener definition. """ from __future__ import absolute_import, print_function, unicode_literals import typing from .base import Opener from .errors import NotWriteable from .registry import registry if typing.TYPE_CHECKING: from typing import Text from ..zipfs import ZipFS # noq...
41
925
astropy
astropy/io/misc/tests/test_yaml.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests some of the methods related to YAML serialization. """ from io import StringIO import numpy as np import pytest from yaml import SafeDumper import astropy.coordinates as coords import astropy.units as u from astropy.coordinates im...
372
10,385
wandb
tests/unit_tests/test_public_api/test_service_api.py
.py
from typing import Any import pytest from wandb.apis.public.service_api import ServiceApi from wandb.proto import wandb_api_pb2 as apb from wandb.sdk.lib.service.service_connection import WandbApiFailedError from wandb.sdk.wandb_settings import Settings def test_execute_graphql_sends_query_unchanged_and_timeout(): ...
51
1,665
wandb
wandb/proto/v5/wandb_server_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: wandb/proto/wandb_server.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from g...
71
8,690
conda
conda/plugins/environment_exporters/requirements_txt.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Built-in conda requirements environment exporter plugin. This module implements the requirements format defined in CEP 23: Files with MatchSpec strings (no @EXPLICIT marker) for flexible package specifications. """ from __future__ import an...
65
2,267
mlflow
tests/deployments/openai/test_openai.py
.py
from unittest import mock import pytest from mlflow.deployments import get_deploy_client from mlflow.exceptions import MlflowException @pytest.fixture def mock_openai_creds(monkeypatch): monkeypatch.setenv("OPENAI_API_KEY", "my-secret-key") @pytest.fixture def mock_azure_openai_creds(monkeypatch): monkeyp...
217
6,547
openvino
tests/layer_tests/pytorch_tests/test_gather.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestGather(PytorchLayerTest): def _prepare_input(self, m, n, max_val, out=False): import numpy as np index = self.random.ran...
50
1,698
textual
src/textual/widgets/_key_panel.py
.py
from __future__ import annotations from collections import defaultdict from itertools import groupby from operator import itemgetter from typing import TYPE_CHECKING from rich import box from rich.table import Table from rich.text import Text from textual.app import ComposeResult from textual.binding import Binding ...
183
5,569
wandb
tests/unit_tests/test_launch/test_project/test_project.py
.py
import os from unittest.mock import MagicMock import pytest from wandb.sdk.launch._project_spec import LaunchProject, LaunchSource from wandb.sdk.launch.errors import LaunchError def test_project_build_required(): mock_args = { "job": "mock-test-entity/mock-test-project/mock-test-job:v0", "api": ...
332
10,747
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/distinct.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
61
1,656
probability
tensorflow_probability/python/internal/backend/numpy/gen/linear_operator.py
.py
# Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`. # DO NOT MODIFY DIRECTLY. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
1,730
65,632
sqlmap
plugins/dbms/extremedb/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): def co...
16
506
saleor
saleor/graphql/core/filters/__init__.py
.py
from .filter_input import ( ChannelFilterInputObjectType, FilterInputObjectType, ) from .filters import ( BaseJobFilter, EnumFilter, ListObjectTypeFilter, MetadataFilter, MetadataFilterBase, ObjectTypeFilter, OperationObjectTypeFilter, ) from .shared_filters import ( GlobalIDFilt...
78
1,860
saleor
saleor/tests/e2e/orders/test_delete_draft_order.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_create, draft_order_delete, draft_order_update, order_lines_cre...
96
2,554
mlflow
tests/models/test_model.py
.py
import json import os import pathlib import time import uuid from datetime import date from unittest import mock import numpy as np import pandas as pd import pydantic import pytest import sklearn.datasets import sklearn.linear_model from packaging.version import Version from scipy.sparse import csc_matrix import mlf...
787
29,835
saleor
saleor/graphql/order/tests/mutations/test_draft_order_complete.py
.py
import datetime from decimal import Decimal from unittest.mock import ANY, call, patch import graphene import pytest from django.db.models import Sum from django.test import override_settings from django.utils import timezone from freezegun import freeze_time from prices import Money, TaxedMoney from promise import Pr...
2,092
72,303
wagtail
wagtail/sites/tests.py
.py
from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.urls import reverse from wagtail import hooks from wagtail.admin.admin_url_finder import AdminURLFinder from wagtail.models import Site from wagtail.test.utils impor...
500
17,205
saleor
saleor/graphql/translations/schema.py
.py
import graphene from ...attribute import AttributeType from ...attribute.models import Attribute, AttributeValue from ...discount.models import Promotion, PromotionRule, Voucher from ...menu.models import MenuItem from ...page.models import Page from ...permission.enums import SitePermissions from ...product.models im...
186
7,781
pyomo
pyomo/contrib/solver/common/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...
388
13,773
probability
spinoffs/inference_gym/inference_gym/tools/stan/stochastic_volatility.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...
105
3,566
tqdm
tqdm/auto.py
.py
""" Enables multiple commonly used features. Method resolution order: - `tqdm.autonotebook` without import warnings - `tqdm.asyncio` - `tqdm.std` base class Usage: >>> from tqdm.auto import trange, tqdm >>> for i in trange(10): ... ... """ import warnings from .std import TqdmExperimentalWarning with warnings....
41
871
cvxpy
cvxpy/tests/test_backend_selection.py
.py
"""Tests for canonicalization backend selection logic. The backend selection priority is: 1. User-specified backend (via canon_backend parameter) 2. COO for DPP problems with total parameter size >= DPP_PARAM_THRESHOLD (1000) 3. CPP if supported 4. SCIPY as fallback when CPP doesn't work """ from __future__ import an...
223
8,797
openvino
src/frontends/onnx/tests/conftest.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import pytest import tests import logging from pathlib import Path def _get_default_model_zoo_dir(): return Path(os.getenv("ONNX_HOME", Path.home() / ".onnx/model_zoo")) def pytest_a...
118
4,269
pyomo
examples/dae/Heat_Conduction.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...
68
1,969
beam
sdks/python/apache_beam/utils/retry_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
250
8,147
wandb
tools/telemetry-tool.py
.py
#!/usr/bin/env python """Generate dbt files for telemetry. Data directory for telemetry records: https://github.com/wandb/analytics/tree/master/dbt/data Usage: ./wandb/tools/telemetry-tool.py --output-dir analytics/dbt/seeds/ """ import argparse import csv import os from typing import Any from wandb.proto i...
72
2,370
saleor
saleor/graphql/attribute/bulk_mutations.py
.py
import graphene from django.conf import settings from django.db import transaction from django.db.models import Exists, OuterRef, Q from ...attribute import models from ...attribute.lock_objects import attribute_value_qs_select_for_update from ...product import models as product_models from ...product.utils.search_hel...
209
8,727
voila
tests/server/nbextensions_test.py
.py
# tests programmatic config of template system import os import pytest BASE_DIR = os.path.dirname(__file__) @pytest.fixture def jupyter_server_config(): def config(app): pass os.environ["JUPYTER_CONFIG_DIR"] = os.path.join( BASE_DIR, "..", "configs", "general" ) yield config del...
28
702
clearml
examples/optimization/hyper-parameter-optimization/base_template_keras_simple.py
.py
# ClearML - Keras with Tensorboard example code, automatic logging model and Tensorboard outputs # # Train a simple deep NN on the MNIST dataset. # Gets to 98.40% test accuracy after 20 epochs # (there is *a lot* of margin for parameter tuning). # 2 seconds per epoch on a K520 GPU. from __future__ import print_function...
88
3,040
mlflow
mlflow/demo/data.py
.py
from __future__ import annotations import base64 import functools import math import struct import zlib from dataclasses import dataclass, field from typing import Any from mlflow.demo.base import DEMO_PROMPT_PREFIX from mlflow.entities.issue import IssueSeverity from mlflow.entities.model_registry import PromptVersi...
1,234
49,213
pyomo
pyomo/repn/tests/gams/small14a_testCase.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...
66
2,053
coremltools
coremltools/converters/libsvm/__init__.py
.py
# Copyright (c) 2017, 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 from ..._deps import _HAS_LIBSVM from . import _libsvm_converter, _libsvm_util if _HAS_LIBSVM: fro...
109
3,399
metrics
src/torchmetrics/image/inception.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...
222
9,235
openvino
tests/layer_tests/tensorflow_tests/test_tf_UniqueWithCounts.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestUnique(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'x:0' in inputs_info, "Tes...
46
1,862
scikit-optimize
examples/plots/partial-dependence-plot-2D.py
.py
""" =========================== Partial Dependence Plots 2D =========================== Hvass-Labs Dec 2017 Holger Nahrstaedt 2020 .. currentmodule:: skopt Simple example to show the new 2D plots. """ print(__doc__) import numpy as np from math import exp from skopt import gp_minimize from skopt.space import Real, ...
106
3,291
sqlmap
lib/utils/brotli.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ # Native, dependency-free Brotli (RFC 7932) decompressor, so sqlmap can advertise a browser-realistic # 'Accept-Encoding: gzip, deflate, br' and read 'Content-Encoding: br' respon...
725
29,410
astropy
astropy/timeseries/periodograms/lombscargle_multiband/implementations/mbfast_impl.py
.py
import numpy as np from astropy.timeseries.periodograms.lombscargle.implementations import lombscargle __all__ = ["lombscargle_mbfast"] def lombscargle_mbfast( t, y, bands, dy=None, frequency=None, sb_method="auto", assume_regular_frequency=False, normalization="standard", fit_me...
66
1,842
sphinx
doc/development/tutorials/examples/todo.py
.py
from docutils import nodes from docutils.parsers.rst import Directive from sphinx.application import Sphinx from sphinx.locale import _ from sphinx.util.docutils import SphinxDirective from sphinx.util.typing import ExtensionMetadata class todo(nodes.Admonition, nodes.Element): pass class todolist(nodes.Genera...
143
4,070
probability
tensorflow_probability/python/distributions/joint_distribution_sequential_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...
946
37,040
textual
tests/test_mount.py
.py
"""Regression test for https://github.com/Textualize/textual/issues/2914 Make sure that calls to render only happen after a widget being mounted. """ import asyncio from textual.app import App from textual.widget import Widget class W(Widget): def render(self): return self.renderable async def on_...
28
653
readthedocs.org
readthedocs/rtd_tests/tests/test_project_forms.py
.py
from unittest import mock from allauth.socialaccount.models import SocialAccount from allauth.socialaccount.providers.github.provider import GitHubProvider from django.contrib.auth.models import User from django.core.exceptions import NON_FIELD_ERRORS from django.test import TestCase from django.test.utils import over...
1,546
57,647
mlflow
tests/genai/judges/adapters/test_litellm_adapter.py
.py
from unittest import mock import litellm import pytest from litellm import RetryPolicy from litellm.types.utils import ModelResponse from pydantic import BaseModel, Field, ValidationError from mlflow.entities.trace import Trace from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location impor...
1,018
38,235
lemur
lemur/plugins/lemur_vault_dest/tests/conftest.py
.py
from lemur.tests.conftest import * # noqa @pytest.fixture def vault_source_plugin(): from lemur.plugins.base import register from lemur.plugins.lemur_vault_dest.tests.plugin import TestSourcePlugin register(TestSourcePlugin) return TestSourcePlugin
11
269
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_dynamic_pool2d.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # pool2d paddle dynamic model generator # import paddle import numpy as np import sys import os from save_model import saveModel if paddle.__version__ >= '2.6.0': import paddle.base as fluid else: from paddle import fluid pa...
49
1,317
mlflow
mlflow/genai/scorers/phoenix/utils.py
.py
from __future__ import annotations from typing import Any from mlflow.entities.trace import Trace from mlflow.exceptions import MlflowException from mlflow.genai.utils.trace_utils import ( extract_retrieval_context_from_trace, parse_inputs_to_str, parse_outputs_to_str, resolve_expectations_from_trace,...
92
2,823
biopython
Tests/search_tests_common.py
.py
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # Revisions Copyright 2012-2015 by Peter Cock. 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. """Common code for Sear...
158
6,444
beam
sdks/python/apache_beam/typehints/arrow_type_compatibility.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
402
14,065
luigi
luigi/contrib/lsf.py
.py
# -*- coding: utf-8 -*- """ .. Copyright 2012-2015 Spotify AB Copyright 2018 Copyright 2018 EMBL-European Bioinformatics Institute 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 ...
344
12,008
cvxpy
cvxpy/reductions/solvers/qp_solvers/mpax_qpif.py
.py
""" Copyright 2025, the CVXPY 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 or agreed to in writing, sof...
171
5,627
pdm
tests/cli/test_info.py
.py
"""Additional tests for the info command to improve coverage""" import json def test_info_command_packages_option(project, pdm): """Test info command with --packages option""" result = pdm(["info", "--packages"], obj=project) assert result.exit_code == 0 # Should show packages path assert result....
113
3,878
onnx
onnx/backend/test/case/node/det.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 Det(Base): @staticmethod def export_2d() -> None: node...
39
1,010
coremltools
coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/visitors.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 from ..parsed_tf_node import ParsedTFNode class FindAllDownstreamTerminals: # Find all nodes ma...
234
6,425
probability
tensorflow_probability/python/math/root_search_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...
357
13,719
pyomo
pyomo/core/tests/diet/test_diet.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...
171
5,911
beam
sdks/python/apache_beam/runners/common_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
650
23,560
eve
tests/auth.py
.py
# -*- coding: utf-8 -*- from io import BytesIO import simplejson as json from bson import ObjectId import eve from eve import Eve from eve.auth import BasicAuth, HMACAuth, TokenAuth from . import TestBase from .test_settings import MONGO_DBNAME class ValidBasicAuth(BasicAuth): def __init__(self): self....
931
34,630
scikit-optimize
benchmarks/bench_hart6.py
.py
import argparse import numpy as np from skopt.benchmarks import hart6 from skopt import gp_minimize from skopt import forest_minimize from skopt import gbrt_minimize from skopt import dummy_minimize def run(n_calls=200, n_runs=10, acq_optimizer="lbfgs"): bounds = np.tile((0., 1.), (6, 1)) optimizers = [("gp_...
67
2,543
openvino
tests/layer_tests/pytorch_tests/test_shift_operations.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestShiftOperators(PytorchLayerTest): def _prepare_input(self, lhs_dtype, rhs_dtype, lhs_shape, rhs_shape): choices =...
108
3,630
probability
tensorflow_probability/python/distributions/dpp.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...
574
23,683
mlflow
mlflow/store/workspace/sqlalchemy_store.py
.py
from __future__ import annotations import logging from threading import Lock from typing import Iterable from cachetools import TTLCache from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import sessionmaker from mlflow.entities.workspace import TraceArchivalConfig, Workspace, WorkspaceDeletionMode from m...
373
16,288
pyro
pyro/infer/reparam/hmm.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pyro.distributions as dist from .reparam import Reparam class LinearHMMReparam(Reparam): """ Auxiliary variable reparameterizer for :class:`~pyro.distributions.LinearHMM` random variables. This defers to comp...
163
6,406
textual
tests/option_list/test_option_list_id_stability.py
.py
"""Tests inspired by https://github.com/Textualize/textual/issues/4101""" from __future__ import annotations from textual.app import App, ComposeResult from textual.widgets import OptionList from textual.widgets.option_list import Option class OptionListApp(App[None]): """Test option list application.""" d...
23
704
readthedocs.org
readthedocs/core/tasks.py
.py
"""Basic tasks.""" import math import redis import structlog from django.apps import apps from django.conf import settings from django.contrib.auth.models import User from django.core.mail import EmailMultiAlternatives from readthedocs.builds.utils import memcache_lock from readthedocs.core.history import set_change...
113
3,494
clearml
examples/pipeline/pipeline_from_functions.py
.py
from clearml import PipelineController # We will use the following function an independent pipeline component step # notice all package imports inside the function will be automatically logged as # required packages for the pipeline execution step def step_one(pickle_data_url): # make sure we have scikit-learn fo...
104
4,098
readthedocs.org
readthedocs/embed/urls.py
.py
from django.urls import path from .views import EmbedAPI urlpatterns = [ path("", EmbedAPI.as_view(), name="embed_api"), ]
9
130
pyomo
examples/dae/run_disease.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...
30
1,074
omegaconf
noxfile.py
.py
import os from typing import Tuple import nox from nox import Session DEFAULT_PYTHON_VERSIONS = ["3.10", "3.11", "3.12", "3.13", "3.14"] PYTHON_VERSIONS = os.environ.get( "NOX_PYTHON_VERSIONS", ",".join(DEFAULT_PYTHON_VERSIONS) ).split(",") nox.options.error_on_missing_interpreters = True def deps( sessio...
105
3,796
onnxruntime
onnxruntime/test/testdata/transform/fusion/layer_norm_with_cast_2.py
.py
import onnx from onnx import OperatorSetIdProto, TensorProto, helper def GenerateModel(model_name): # noqa: N802 nodes = [ # LayerNormWithCast2 subgraph helper.make_node("ReduceMean", ["A"], ["rd1_out"], "reduce", axes=[-1]), helper.make_node("Sub", ["A", "rd1_out"], ["sub1_out"], "sub"), ...
52
2,107
wandb
tests/unit_tests/test_retry.py
.py
"""retry tests.""" import dataclasses import datetime from collections.abc import Generator from unittest import mock import pytest from wandb.sdk.lib import retry @dataclasses.dataclass class MockTime: now: datetime.datetime sleep: mock.Mock @pytest.fixture(autouse=True) def mock_time() -> Generator[Mock...
178
4,528
beam
sdks/python/apache_beam/ml/inference/vertex_ai_inference_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
123
4,593
openvino
tests/layer_tests/pytorch_tests/test_round.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestRound(PytorchLayerTest): def _prepare_input(self, out=False, dtype="float32"): import numpy as np input = self.random.ra...
92
3,273
jupytext
tests/functional/others/test_combine.py
.py
from copy import deepcopy import pytest from jupyter_server.utils import ensure_async from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook import jupytext from jupytext.combine import combine_inputs_with_outputs from jupytext.compare import compare, compare_notebooks def test_combine(): ...
225
5,481
ipython
IPython/core/usage.py
.py
"""Usage information for the main IPython applications. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu> # # Distributed under the terms of the BSD License. The f...
341
13,382
saleor
saleor/graphql/menu/mutations/menu_item_update.py
.py
import graphene from ....menu import models from ....permission.enums import MenuPermissions from ....webhook.event_types import WebhookEventAsyncType from ...core import ResolveInfo from ...core.types import MenuError from ...core.utils import WebhookEventInfo from ...plugins.dataloaders import get_plugin_manager_pro...
52
1,817