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
probability
spinoffs/fun_mc/fun_mc/util_tfp_test.py
.py
# Copyright 2021 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...
215
5,743
onnx
onnx/reference/ops/op_reciprocal.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class Reciprocal(OpRunUnaryNum): def _run(self, x): with np.errstate(divide="ignore"): return (np.reciprocal...
15
342
onnx
onnx/external_data_helper.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import os import re import sys import uuid import warnings from itertools import chain from typing import IO, TYPE_CHECKING import onnx.checker as onnx_checker import onnx.onnx_cpp2py_export.checker as...
429
16,641
openvino
tools/ovc/unit_tests/ovc/unit_test_with_mocked_telemetry.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import unittest from unittest.mock import Mock try: import openvino_telemetry as tm from openvino_telemetry.backend import backend_ga4 except ImportError: import openvino.tools.ovc.telemetry_stub as tm class UnitTestWithMo...
21
603
readthedocs.org
readthedocs/core/tests/test_contact.py
.py
from unittest import mock from django.contrib.auth import get_user_model from django.test import TestCase from django_dynamic_fixture import get from readthedocs.core.utils.contact import contact_users User = get_user_model() class TestContactUsers(TestCase): def setUp(self): self.user = get(User, user...
59
1,798
wagtail
wagtail/admin/tests/test_collections_views.py
.py
import json from django.contrib.auth.models import Group, Permission from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.urls import reverse from wagtail.admin.admin_url_finder import AdminURLFinder from wagtail.documents.models import Document from wagtail.models i...
885
35,093
probability
tensorflow_probability/python/bijectors/scale_matvec_tril.py
.py
# Copyright 2019 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...
114
4,322
hatch
src/hatch/template/files_feature_tests.py
.py
from hatch.template import File from hatch.utils.fs import Path class TestsPackageRoot(File): def __init__( self, template_config: dict, # noqa: ARG002 plugin_config: dict, # noqa: ARG002 ): super().__init__(Path("tests", "__init__.py"))
12
282
wagtail
wagtail/admin/tests/test_account_management.py
.py
import io import unittest import zoneinfo from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth import views as auth_views from django.contrib.auth.models import Group, Permission from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.core impo...
1,213
45,181
scikit-bio
skbio/stats/composition/__init__.py
.py
r"""Composition Statistics (:mod:`skbio.stats.composition`) ======================================================= .. currentmodule:: skbio.stats.composition This module provides functions for compositional data analysis. Many omics datasets are inherently compositional -- meaning that they are best interpreted as ...
207
5,171
marshmallow
tests/test_deserialization.py
.py
# mypy: disable-error-code="arg-type" import datetime as dt import decimal import ipaddress import math import typing import uuid from unittest.mock import patch import pytest from marshmallow import ( EXCLUDE, INCLUDE, RAISE, Schema, fields, missing, validate, ) from marshmallow.exception...
2,398
91,519
readthedocs.org
readthedocs/core/utils/extend.py
.py
"""Patterns for extending Read the Docs.""" import inspect from django.conf import settings from django.utils.module_loading import import_string def get_override_class(proxy_class, default_class=None): """ Determine which class to use in an override class. The `proxy_class` is the main class that is u...
81
2,827
astropy
astropy/cosmology/_src/tests/test_utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest import astropy.units as u from astropy.cosmology._src.utils import ( aszarr, deprecated_keywords, vectorize_redshift_method, ) from astropy.utils.compat.optional_deps import HAS_PANDAS from .test_core import ...
178
5,588
onnx
onnx/backend/test/case/node/isnan.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 IsNaN(Base): @staticmethod def export() -> None: node ...
37
962
pdm
tests/test_installer.py
.py
from __future__ import annotations import logging import os import venv from collections.abc import Callable from pathlib import Path import pytest from unearth import Link from pdm import utils from pdm.core import Core from pdm.environments.base import BaseEnvironment from pdm.environments.local import PythonLocal...
320
12,299
onnxruntime
onnxruntime/test/python/quantization/test_qdq_loss_debug.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """Tests ...
320
13,563
openvino
tests/layer_tests/jax_tests/test_rsqrt.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from jax import lax from jax import numpy as jnp from jax_layer_test_class import JaxLayerTest class TestRsqrt(JaxLayerTest): def _prepare_input(self): inp = jnp.array(np.random.rand(*self....
41
1,050
probability
tensorflow_probability/python/distributions/normal_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...
491
20,389
openvino
tests/layer_tests/tensorflow_tests/test_tf_Rank.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestRank(CommonTFLayerTest): def create_rank_net(self, input_shape, input_type): tf.compat.v1.reset_def...
74
2,865
jupytext
jupyterlab/scripts/install_extension.py
.py
# This script does the "same" job as `jupyter labextension develop --overwrite .` # # Seems like we cannot use the upstream script on our repo organization. # If we want to use the upstream script we need to have a setup.py or pyproject.toml # in jupyterlab/jupyterlab-jupytext folder with the name of the package. # # W...
49
1,461
kafka
docker/docker_release.py
.py
#!/usr/bin/env python # 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 "Lice...
75
3,387
pyomo
pyomo/repn/tests/ampl/small5_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...
47
2,522
mlflow
tests/tracing/test_fluent.py
.py
import asyncio import json import os import subprocess import sys import threading import time import uuid import warnings from concurrent.futures import ThreadPoolExecutor, as_completed from dataclasses import asdict from datetime import datetime from unittest import mock import pytest from opentelemetry.sdk.trace.ex...
3,255
112,287
probability
tensorflow_probability/python/internal/tf_keras.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...
44
1,528
cvxpy
cvxpy/reductions/solvers/nlp_solvers/nlp_solver.py
.py
""" Copyright 2025, the CVXPY developers 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, s...
256
9,867
bazel
scripts/docs/clr_converter_test.py
.py
# Copyright 2026 The Bazel Authors. All rights reserved. # # 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 la...
233
7,212
jupyterlab
jupyterlab/upgrade_extension.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import configparser import json import re import shutil import subprocess import sys try: import tomllib except ImportError: import tomli as tomllib from importlib.resources import files from pathlib import P...
344
12,544
cvxpy
cvxpy/atoms/affine/vstack.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...
81
2,378
saleor
saleor/tests/e2e/account/utils/fragments.py
.py
ADDRESS_FRAGMENT = """ fragment Address on Address { id firstName lastName companyName streetAddress1 streetAddress2 city cityArea postalCode countryArea phone country { code } } """
19
247
openvino
tests/layer_tests/tensorflow_tests/test_tf_Unique.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...
55
2,077
django-cms
cms/appresolver.py
.py
from collections import OrderedDict from importlib import import_module from django.contrib.sites.models import Site from django.core.exceptions import ImproperlyConfigured from django.db import OperationalError, ProgrammingError from django.urls import NoReverseMatch, Resolver404, URLResolver, reverse from django.url...
291
10,990
beam
sdks/python/apache_beam/runners/trivial_runner.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...
416
19,267
coveragepy
tests/modules/pkg2/p2b.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 t = 1 u = 1 v = 1
7
176
textual
src/textual/_widget_navigation.py
.py
""" Utilities to move index-based selections backward/forward. These utilities concern themselves with selections where not all options are available, otherwise it would be enough to increment/decrement the index and use the operator `%` to implement wrapping. """ from __future__ import annotations from itertools im...
183
5,702
gunicorn
tests/test_asgi_http_scope.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ ASGI HTTP scope validation tests. Tests for HTTP scope building, URL encoding, header handling, and extension support. """ from unittest import mock from gunicorn.config import Config # ==================...
765
26,230
mlflow
tests/sagemaker/test_cli.py
.py
import os import shutil from pathlib import Path from unittest import mock import docker import pytest from click.testing import CliRunner import mlflow from mlflow.models.docker_utils import build_image_from_context from mlflow.sagemaker.cli import build_and_push_container from tests.pyfunc.docker.test_docker impor...
161
5,612
textual
tests/snapshot_tests/snapshot_apps/scroll_page.py
.py
import os from textual.app import App from textual.widgets import RichLog class RichLogTest(App): def compose(self): ri = RichLog(auto_scroll=False) suffix = "A" * 100 for i in range(1, 100): ri.write(f"This is line number {i} {suffix}") yield ri if __name__ == "__mai...
18
364
saleor
saleor/webhook/tests/subscription_webhooks/test_create_deliveries_for_payment_gateway_initialize_session.py
.py
import json from decimal import Decimal import graphene from ...event_types import WebhookEventSyncType from ...models import Webhook from ...transport.asynchronous import create_deliveries_for_subscriptions PAYMENT_GATEWAY_INITIALIZE_SESSION = """ subscription { event{ ...on PaymentGatewayInitializeSession{ ...
162
4,637
wandb
wandb/sdk/artifacts/_generated/delete_registry.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult class DeleteRegistry(GQLResult): delete_model: DeleteRegistryDeleteModel | None = Field(alias="deleteModel") class DeleteRegistryDelete...
20
396
saleor
saleor/graphql/meta/resolvers.py
.py
import dataclasses from operator import itemgetter from django.db import models from ...account import models as account_models from ...app import models as app_models from ...attribute import models as attribute_models from ...channel import models as channel_models from ...checkout import models as checkout_models ...
144
6,321
hydra
tests/test_apps/sys_exit/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import sys from omegaconf import DictConfig import hydra @hydra.main() def my_app(_: DictConfig) -> None: sys.exit(42) if __name__ == "__main__": my_app()
16
240
openvino
tests/layer_tests/onnx_tests/test_or.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136") from common.layer_test_class import check_ir_version from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model fro...
284
10,329
pyro
tests/contrib/funsor/conftest.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest def pytest_collection_modifyitems(items): for item in items: if item.nodeid.startswith("tests/contrib/funsor"): if "stage" not in item.keywords: item.add_marker(pytest.mark.stage(...
16
602
pyro
pyro/contrib/funsor/handlers/runtime.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from collections import Counter, OrderedDict, namedtuple from enum import Enum class StackFrame: """ Consistent bidirectional mapping between integer positional dimensions and names. Can be queried like a dictionary (``va...
238
8,558
python-prompt-toolkit
src/prompt_toolkit/layout/processors.py
.py
""" Processors are little transformation blocks that transform the fragments list from a buffer before the BufferControl will render it to the screen. They can insert fragments before or after, or highlight fragments by replacing the fragment types. """ from __future__ import annotations import re from abc import AB...
1,018
34,323
openvino
tests/e2e_tests/common/ref_collector/dummy_ref_collector.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Dummy reference collector to be used when real collector is unavailable. Example usage: User do not have tensorflow installed and want to run pytorch-only tests. Tensorflow reference collector is substituted by the dummy so that no ...
26
823
astropy
astropy/io/misc/tests/test_parquet_votable.py
.py
import copy import numpy as np import pytest import astropy.units as u from astropy.io.misc.parquet import read_parquet_votable, write_parquet_votable from astropy.table import Table from astropy.utils.data import get_pkg_data_filename from astropy.utils.exceptions import AstropyUserWarning from astropy.utils.misc im...
201
6,856
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_tensor_operation.py
.py
# Copyright (c) 2023, 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 numpy as np from coremltools.converters.mil._deployment_compatibility import AvailableTarget ...
1,175
41,896
wandb
tests/system_tests/test_core/scripts/unix_socket_cleanup_child.py
.py
"""Child process for Unix socket temp-dir cleanup system tests.""" from __future__ import annotations import signal import sys import wandb from wandb.sdk import wandb_setup def main() -> int: run = wandb.init( id="unix-socket-cleanup-child", mode="offline", tags=["unix-socket-cleanup"]...
34
713
mlflow
tests/server/auth/test_sqlalchemy_store_rbac.py
.py
import pytest from mlflow.exceptions import MlflowException from mlflow.server.auth.entities import Role, RolePermission, UserRoleAssignment from mlflow.server.auth.permissions import EDIT, MANAGE, READ, USE, VALID_RESOURCE_TYPES # Every concrete resource type the resolver accepts, excluding the special # ``"workspac...
990
40,872
saleor
saleor/graphql/product/tests/queries/variants_where/test_over_attributes_datetime.py
.py
import datetime import pytest from ......attribute import AttributeInputType, AttributeType from ......attribute.models import Attribute from ......attribute.utils import associate_attribute_values_to_instance from .....tests.utils import get_graphql_content from .shared import PRODUCT_VARIANTS_WHERE_QUERY @pytest....
132
4,161
pyomo
pyomo/repn/tests/ampl/small13_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...
29
1,206
cvxpy
cvxpy/transforms/suppfunc.py
.py
import numpy as np from scipy import sparse from cvxpy.atoms.suppfunc import SuppFuncAtom from cvxpy.expressions.variable import Variable from cvxpy.reductions.cvx_attr2constr import CONVEX_ATTRIBUTES def scs_coniclift(x, constraints): """ Return (A, b, K) so that {x : x satisfies constraints} ca...
199
6,761
pymc
tests/distributions/test_discrete.py
.py
# Copyright 2024 - present The PyMC Developers # # 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...
1,050
37,598
probability
tensorflow_probability/python/bijectors/softsign.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...
106
3,318
pyomo
doc/OnlineDocs/src/data/import7.tab.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...
27
1,103
pyomo
examples/pyomo/benders/master.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...
134
3,907
saleor
saleor/graphql/core/tests/test_deprecated_field_monitoring.py
.py
from unittest.mock import patch import graphene import pytest from ....shipping.utils import convert_to_shipping_method_data from ....webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType from ...tests.utils import get_graphql_content from ...webhook.subscription_payload import ( generate_payload...
305
8,752
python-prompt-toolkit
src/prompt_toolkit/output/__init__.py
.py
from __future__ import annotations from .base import DummyOutput, Output from .color_depth import ColorDepth from .defaults import create_output __all__ = [ # Base. "Output", "DummyOutput", # Color depth. "ColorDepth", # Defaults. "create_output", ]
16
280
beam
sdks/python/apache_beam/examples/inference/anomaly_detection/write_data_to_pubsub_pipeline/setup.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...
45
1,569
saleor
saleor/graphql/order/tests/mutations/test_order_note_add.py
.py
from unittest.mock import ANY, patch import graphene import pytest from django.test import override_settings from .....account.models import CustomerEvent from .....core.models import EventDelivery from .....order import OrderStatus from .....order import events as order_events from .....order.error_codes import Orde...
282
9,195
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_conv_3d_transpose.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasConv3DTranspose(CommonTF2LayerTest): def create_keras_conv_3d_transpose_net(self, conv_params, input_n...
69
3,524
beam
sdks/python/apache_beam/io/parquetio_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...
1,020
38,677
metrics
src/torchmetrics/functional/image/sam.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...
122
4,198
readthedocs.org
readthedocs/oauth/services/githubapp.py
.py
from functools import cached_property from functools import lru_cache from itertools import groupby import structlog from allauth.socialaccount.models import SocialAccount from django.conf import settings from github import Github from github import GithubException from github.Installation import Installation as GHIns...
532
23,260
wagtail
wagtail/admin/panels/model_utils.py
.py
import functools from django.core.exceptions import ImproperlyConfigured from django.db.models.fields.reverse_related import ManyToOneRel from django.forms.models import fields_for_model from wagtail.admin.forms.models import formfield_for_dbfield from wagtail.models import PanelPlaceholder from .base import Panel f...
86
2,382
astropy
astropy/coordinates/builtin_frames/ecliptic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.attributes import QuantityAttribute, TimeAttribute from astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc from astropy.utils.decor...
270
9,891
biopython
Tests/test_SeqIO_UniprotIO.py
.py
# Copyright 2010 by Andrea Pierleoni # Revisions copyright 2010-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. """Test for the Uniprot parser on Uniprot XML ...
671
28,288
probability
tensorflow_probability/python/sts/components/seasonal_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...
697
28,962
mlflow
tests/utils/test_databricks_utils.py
.py
import builtins import json import os import platform import sys import time from unittest import mock import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.legacy_databricks_cli.configure.provider import ( DatabricksConfig, DatabricksModelServingConfigProvider, ) from mlflow.u...
1,467
58,783
confluent-kafka-python
tests/ducktape/test_transactions.py
.py
""" Ducktape tests for transactions in async producer and consumer. """ import asyncio import uuid from ducktape.tests.test import Test from tests.ducktape.consumer_strategy import AsyncConsumerStrategy, SyncConsumerStrategy from tests.ducktape.producer_strategy import AsyncProducerStrategy, SyncProducerStrategy fro...
310
13,171
openvino
tests/layer_tests/pytorch_tests/test_index_copy_.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, skip_if_export class TestIndexCopy(PytorchLayerTest): def _prepare_input(self): return (self.input_tensor, self.values) def create_mod...
90
3,136
mlflow
mlflow/entities/gateway_secrets.py
.py
from dataclasses import dataclass from typing import Any from mlflow.entities._mlflow_object import _MlflowObject from mlflow.protos.service_pb2 import GatewaySecretInfo as ProtoGatewaySecretInfo from mlflow.utils.workspace_utils import resolve_entity_workspace_name @dataclass(frozen=True) class GatewaySecretInfo(_M...
90
3,975
returns
returns/_internal/futures/_future.py
.py
from collections.abc import Awaitable, Callable from typing import TYPE_CHECKING, TypeVar from returns.io import IO from returns.primitives.hkt import Kind1, dekind if TYPE_CHECKING: from returns.future import Future _ValueType_co = TypeVar('_ValueType_co', covariant=True) _NewValueType = TypeVar('_NewValueType'...
64
2,035
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combinevalues_combinefn.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");...
92
2,948
jupytext
tests/external/cli/test_black.py
.py
import os from copy import deepcopy from shutil import copyfile import pytest from nbformat.v4.nbbase import new_code_cell, new_notebook from jupytext import read, write from jupytext.cli import jupytext, pipe_notebook, system from jupytext.combine import black_invariant from jupytext.compare import compare, compare_...
288
8,843
probability
tensorflow_probability/python/internal/backend/numpy/control_flow.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...
254
9,138
conda
tests/common/test_configuration.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from os import environ from os.path import expandvars from pathlib import Path from types import SimpleNamespace from uuid import uuid4 import pytest from pytest import MonkeyPatch, raises from conda.auxlib.ish import dals from conda.common.co...
1,050
30,268
pyro
pyro/ops/ssm_gp.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch from torch.distributions import constraints from pyro.nn import PyroModule, PyroParam, pyro_method root_three = math.sqrt(3.0) root_five = math.sqrt(5.0) five_thirds = 5.0 / 3.0 class MaternKernel(Pyro...
169
6,648
scikit-bio
skbio/stats/tests/test_gradient.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. # --------------------------------------------...
1,048
55,450
clearml
clearml/backend_api/services/v2_23/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, Union, Any import six from datetime import datetime from dateutil.parser import parse as parse_datetime from clearml.backend_api.session import ( Reque...
4,558
156,390
beam
sdks/python/apache_beam/examples/inference/rate_limiter_vertex_ai.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...
88
3,059
metrics
src/torchmetrics/regression/log_mse.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...
130
4,720
mlflow
examples/langchain/chain_autolog.py
.py
import os from operator import itemgetter from langchain.llms import OpenAI from langchain.prompts import PromptTemplate from langchain.schema.output_parser import StrOutputParser from langchain.schema.runnable import RunnableLambda import mlflow # Uncomment the following to use the full abilities of langchain autol...
71
2,122
onnxruntime
onnxruntime/python/tools/quantization/operators/embed_layernorm.py
.py
import logging import onnx from onnx import onnx_pb as onnx_proto # noqa: F401 from ..quant_utils import attribute_to_kwarg, ms_domain from .base_operator import QuantOperatorBase """ Quantizes the EmbedLayerNorm fused ONNXRuntime Op. This Quant operator keeps the input and segment IDs at int32 but will quantize a...
122
3,937
textual
docs/examples/styles/link_color_hover.py
.py
from textual.app import App from textual.widgets import Label class LinkHoverColorApp(App): CSS_PATH = "link_color_hover.tcss" def compose(self): yield Label( "Visit the [link='https://textualize.io']Textualize[/link] website.", id="lbl1", # (1)! ) yield Label...
30
763
mlflow
mlflow/store/db_migrations/versions/5d2d30f0abce_update_job_table.py
.py
"""update job table Create Date: 2025-12-16 16:31:47.921120 """ from alembic import op from sqlalchemy import String # revision identifiers, used by Alembic. revision = "5d2d30f0abce" down_revision = "b7c8d9e0f1a2" branch_labels = None depends_on = None def upgrade(): # Rename column `function_fullname` -> `j...
50
1,630
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Squeeze.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [1, 3], 'axis': [0]}, {'shape': [2, 1], 'axis': [1]}, {'shape': [1, 1, 2], 'axis': [0, 1]}, {'shape': [1, 1, 2, 2], 'axis': [1]}, {'shape': [1, 1, 2, 2], 'axis': [1, 1]}, ...
37
1,330
scikit-bio
skbio/io/format/qseq.py
.py
r"""QSeq format (:mod:`skbio.io.format.qseq`) ========================================= .. currentmodule:: skbio.io.format.qseq The QSeq format (`qseq`) is a record-based, plain text output format produced by some DNA sequencers for storing biological sequence data, quality scores, per-sequence filtering information,...
369
10,482
saleor
saleor/payment/transaction_item_calculations.py
.py
from collections import defaultdict from collections.abc import Iterable from dataclasses import dataclass, field from decimal import Decimal from typing import cast from . import TransactionEventType from .models import TransactionEvent, TransactionItem @dataclass class BaseEvent: request: TransactionEvent | No...
400
14,802
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/latest_per_key.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");...
95
3,077
openvino
src/frontends/onnx/tests/onnx_prototxt_converter.py
.py
#!/usr/bin/env python # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Converts protobuf files from binary message format into prototxt format and vice-versa. Supports files with only '.onnx' or '.prototxt' extensions. Application may accept only single argument denoting input fil...
93
3,067
jupytext
tests/data/notebooks/outputs/ipynb_to_script/Notebook_with_more_R_magic_111.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # + # %load_ext rpy2.ipython import pandas as pd df = pd.DataFrame( { "Letter": ["a", "a", "a", "b", "b", "b", "c", "c", "c"], "X": [4, 3, 5, 2, 1, 7, 7, 5, 9], "Y": [0, 4, 3, 6, ...
25
525
mlflow
mlflow/gateway/providers/ollama.py
.py
from mlflow.gateway.config import _OpenAICompatibleConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class OllamaConfig(_OpenAICompatibleConfig): # Ollama runs locally and doesn't require an API key by default api_key: str = "ollama" class OllamaProvider(OpenAICompatible...
21
771
astropy
astropy/table/tests/test_pprint.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys from io import StringIO from shutil import get_terminal_size import numpy as np import pytest from astropy import table from astropy import units as u from astropy.io import ascii from astropy.table import Column, QTable, Table from astropy....
1,266
41,992
pyomo
pyomo/repn/tests/ampl/small9_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...
49
1,886
cvxpy
cvxpy/problems/problem_form.py
.py
""" Copyright, 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, software ...
439
16,474
beam
sdks/python/apache_beam/ml/anomaly/detectors/__init__.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...
21
969
mlflow
tests/genai/discovery/test_pipeline.py
.py
import json from unittest.mock import MagicMock, patch import pytest import mlflow from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceType from mlflow.genai.discovery.clustering import recluster_singletons from mlflow.genai.discovery.constan...
1,292
43,343
probability
tensorflow_probability/python/distributions/von_mises_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...
463
18,613