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
mlflow
tests/pytorch/test_pytorch_model_export.py
.py
import importlib import json import logging import os import pickle import re from pathlib import Path from unittest import mock import numpy as np import pandas as pd import pytest import torch import yaml from packaging.version import Version from sklearn import datasets from torch import nn from torch.utils.data im...
1,527
56,825
sphinx
tests/roots/test-ext-doctest-with-autodoc/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) project = 'test project for doctest + autodoc reporting' extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest']
8
199
onnx
onnx/reference/ops/op_mel_weight_matrix.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.helper import tensor_dtype_to_np_dtype from onnx.reference.op_run import OpRun class MelWeightMatrix(OpRun): def _run( self, num_mel_bins, dft_...
62
2,353
voila
voila/voila_identity_provider.py
.py
from typing import Any, Optional from jupyter_server.auth.identity import IdentityProvider from jupyter_server.auth.login import LoginFormHandler class VoilaLoginHandler(LoginFormHandler): def static_url( self, path: str, include_host: Optional[bool] = None, **kwargs: Any ) -> str: settings = ...
22
663
saleor
saleor/core/db/connection.py
.py
import logging import traceback from contextlib import contextmanager from django.conf import settings from django.core.management.color import color_style from django.db import connections from django.db.backends.base.base import BaseDatabaseWrapper from ...graphql.core.context import SaleorContext, get_database_con...
135
4,994
pyomo
pyomo/contrib/multistart/high_conf_stop.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...
63
2,511
tomli
profiler/profiler_script.py
.py
"""A script for profiling. To generate and read results: - `tox -e profile` - `firefox .tox/prof/output.svg` """ from pathlib import Path import tomli benchmark_toml = ( (Path(__file__).parent.parent / "benchmark" / "data.toml").read_bytes().decode() ) # Run this a few times to emphasize over imports and o...
19
395
metrics
tests/unittests/image/test_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...
148
5,018
rq
tests/test_worker_registration.py
.py
from unittest.mock import patch from rq import Queue, Worker from rq.utils import ceildiv from rq.worker_registration import ( REDIS_WORKER_KEYS, WORKERS_BY_QUEUE_KEY, clean_worker_registry, get_keys, register, unregister, ) from tests import RQTestCase class TestWorkerRegistry(RQTestCase): ...
104
4,352
beam
sdks/python/apache_beam/io/gcp/bigquery_geography_it_test.py
.py
#!/usr/bin/env python # -*- 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,...
545
18,428
confluent-kafka-python
src/confluent_kafka/schema_registry/_sync/json_schema.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 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...
847
44,250
luigi
examples/top_artists_spark.py
.py
# -*- coding: utf-8 -*- import operator import sys from pyspark.sql import SparkSession def main(argv): input_paths = argv[1].split(",") output_path = argv[2] spark = SparkSession.builder.getOrCreate() streams = spark.read.option("sep", "\t").csv(input_paths[0]) for stream_path in input_paths[...
27
623
coremltools
coremltools/converters/mil/mil/tests/test_types.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 import pytest from coremltools import ImageType, StateType, TensorType from corem...
118
5,138
mlflow
tests/pyfunc/docker/test_docker_flavors.py
.py
import contextlib import os import shutil import sys import threading import time import pandas as pd import pytest import requests import mlflow from mlflow.environment_variables import _MLFLOW_RUN_SLOW_TESTS from mlflow.models.flavor_backend_registry import get_flavor_backend from mlflow.models.utils import load_se...
405
11,951
pyomo
examples/gdp/stickies.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...
737
30,539
openvino
src/bindings/python/src/openvino/frontend/pytorch/gptq.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # mypy: ignore-errors from functools import partial import logging import torch log = logging.getLogger(__name__) # Wraps a single tensor to a module to prevent it from jit.freezing # It depends on a tensor dt...
186
7,637
wagtail
wagtail/api/v2/tests/test_documents.py
.py
import json from unittest import mock from django.test import TestCase, TransactionTestCase, tag from django.test.utils import override_settings from django.urls import reverse from wagtail.api.v2 import signal_handlers from wagtail.documents import get_document_model from wagtail.models import CollectionViewRestrict...
642
24,055
clearml
examples/distributed/subprocess_example.py
.py
# ClearML - example of multiple sub-processes interacting and reporting to a single master experiment import multiprocessing import os import subprocess import sys import time from argparse import ArgumentParser from random import randint from clearml import Task def mp_worker(arguments): print("sub process", o...
146
4,270
metrics
src/torchmetrics/image/d_lambda.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...
153
6,006
wagtail
wagtail/snippets/bulk_actions/snippet_bulk_action.py
.py
from django.utils.functional import cached_property, classproperty from wagtail.admin.admin_url_finder import AdminURLFinder from wagtail.admin.views.bulk_action import BulkAction from wagtail.permissions import policy_registry from wagtail.snippets.models import get_snippet_models class SnippetBulkAction(BulkAction...
42
1,478
saleor
saleor/tests/e2e/account/utils/create_customer.py
.py
from ...utils import get_graphql_content CUSTOMER_CREATE_MUTATION = """ mutation CreateCustomer ($input: UserCreateInput!) { customerCreate( input: $input ) { errors { field message code } user { id email metadata { key value } private...
48
800
biopython
Bio/SCOP/Cla.py
.py
# Copyright 2001 by Gavin E. Crooks. All rights reserved. # Revisions copyright 2010 Jeffrey Finkelstein. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should ...
129
3,922
pyomo
examples/doc/samples/case_studies/network_flow/networkFlow1.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...
50
1,721
mkdocs
mkdocs/tests/structure/file_tests.py
.py
import os import sys import unittest from unittest import mock from mkdocs.structure.files import File, Files, _sort_files, file_sort_key, get_files from mkdocs.tests.base import PathAssertionMixin, load_config, tempdir class TestFiles(PathAssertionMixin, unittest.TestCase): @unittest.skipUnless(sys.platform.sta...
747
34,496
pyomo
pyomo/scripting/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
586
mlflow
mlflow/pytorch/__init__.py
.py
""" The ``mlflow.pytorch`` module provides an API for logging and loading PyTorch models. This module exports PyTorch models with the following flavors: PyTorch (native) format This is the main flavor that can be loaded back into PyTorch. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfunc-based deploym...
1,393
56,781
onnxruntime
onnxruntime/test/testdata/transform/computation_reduction/gather/gather_matmul.py
.py
import onnx from onnx import OperatorSetIdProto, TensorProto, helper def _create_model_proto(output_shapes, axis_to_gather, slice_dims, slices_values, model_name): # inputs and outputs hidden = 1024 inputs = [ helper.make_tensor_value_info("input1", TensorProto.FLOAT, ["batch_size", "sequence_leng...
66
2,458
sphinx
tests/test_ext_autodoc/test_ext_autodoc_preserve_defaults.py
.py
"""Test the autodoc extension.""" from __future__ import annotations import pytest from sphinx.ext.autodoc._shared import _AutodocConfig from tests.test_ext_autodoc.autodoc_util import do_autodoc pytestmark = pytest.mark.usefixtures('inject_autodoc_root_into_sys_path') def test_preserve_defaults() -> None: c...
205
6,289
mlflow
examples/langchain/simple_agent.py
.py
import os from langchain.agents import AgentType, initialize_agent, load_tools from langchain.llms import OpenAI import mlflow # Note: Ensure that the package 'google-search-results' is installed via pypi to run this example # and that you have a accounts with SerpAPI and OpenAI to use their APIs. # Ensuring necess...
37
1,463
mlflow
tests/uc_oss/test_uc_oss_integration.py
.py
import os import subprocess import sys import pandas as pd import pytest from sklearn import datasets from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split import mlflow from mlflow.exceptions import MlflowException from tests.helper_functions import get_safe_port f...
157
5,710
metrics
src/torchmetrics/regression/cosine_similarity.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...
140
5,235
openvino
tests/e2e_tests/common/infer/dummy_infer_class.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Dummy infer provider to be used when real provider is unavailable due to absence of IE Python API e.g. for IR collection environment """ from .provider import ClassProvider def use_dummy(name, message): class DummyInfer(ClassPr...
22
529
saleor
saleor/plugins/user_email/tests/test_notify_events.py
.py
from unittest import mock from ....account.notifications import get_default_user_payload from ....core.notify import NotifyHandler from ....order.notifications import ( get_default_fulfillment_payload, get_default_order_payload, ) from ..notify_events import ( send_account_change_email_confirm, send_ac...
669
22,744
pdm
src/pdm/project/core.py
.py
from __future__ import annotations import contextlib import hashlib import itertools import operator import os import shutil import sys from collections.abc import Callable, Collection, Iterable, Mapping, Sequence from copy import deepcopy from functools import cached_property, reduce from pathlib import Path from typ...
1,162
50,604
wagtail
wagtail/snippets/api/v3/schemas.py
.py
from typing import ClassVar, Literal from django.db.models import Model from django.urls import reverse from django.urls.exceptions import NoReverseMatch from wagtail.api.v2.utils import get_full_url from wagtail.api.v3.schemas.base import ( BaseCreateMetaSchema, BaseCreateSchema, BaseMetaSchema, Base...
73
1,887
sqlmap
lib/techniques/dns/test.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.common import Backend from lib.core.common import randomInt from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.cor...
34
1,124
probability
tensorflow_probability/python/bijectors/householder_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...
75
2,813
loguru
tests/conftest.py
.py
import asyncio import builtins import contextlib import datetime import io import logging import multiprocessing import os import pathlib import sys import threading import time import traceback import warnings from typing import NamedTuple import freezegun import pytest import loguru if sys.version_info < (3, 5, 3)...
372
10,751
probability
tensorflow_probability/python/experimental/sts_gibbs/sample_parameters_test.py
.py
# Copyright 2022 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...
120
5,296
readthedocs.org
readthedocs/proxito/tests/test_headers.py
.py
import django_dynamic_fixture as fixture from corsheaders.middleware import ( ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ) from django.test import override_settings from django_dynamic_fixture import get from readthedocs.builds.constants import EXTERNAL fro...
423
16,949
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/batchelements_test.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");...
66
2,105
saleor
saleor/asgi/cors_handler.py
.py
from fnmatch import fnmatchcase from asgiref.typing import ( ASGI3Application, ASGIReceiveCallable, ASGISendCallable, ASGISendEvent, HTTPResponseBodyEvent, HTTPResponseStartEvent, Scope, ) from django.conf import settings def cors_handler(application: ASGI3Application) -> ASGI3Application...
112
4,260
onnxruntime
onnxruntime/test/onnx/gen_test_models.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import os import warnings from datetime import date import numpy as np import onnx from onnx import AttributeProto, GraphProto, TensorProto, helper, numpy_helper, utils # noqa: F401 #...
206
7,936
biopython
Bio/SearchIO/_model/__init__.py
.py
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.SearchIO objects...
60
2,479
black
tests/data/cases/numeric_literals.py
.py
x = 123456789 x = 123456 x = .1 x = 1. x = 1E+1 x = 1E-1 x = 1.000_000_01 x = 123456789.123456789 x = 123456789.123456789E123456789 x = 123456789E123456789 x = 123456789J x = 123456789.123456789J x = 0XB1ACC x = 0B1011 x = 0O777 x = 0.000000006 x = 10000 x = 133333 # output x = 123456789 x = 123456 x = 0.1 x = 1.0 x ...
40
544
mlflow
examples/jwt_auth/jwt_auth.py
.py
"""Sample JWT authentication module for testing purposes. NOT SUITABLE FOR PRODUCTION USE. """ import logging import jwt from flask import Response, make_response, request from werkzeug.datastructures import Authorization BEARER_PREFIX = "bearer " _logger = logging.getLogger(__name__) def authenticate_request() ...
45
1,537
mlflow
mlflow/entities/trace_location.py
.py
from abc import ABC, abstractmethod from dataclasses import dataclass from enum import Enum from typing import Any from mlflow.entities._mlflow_object import _MlflowObject from mlflow.exceptions import MlflowException from mlflow.protos import service_pb2 as pb from mlflow.utils.annotations import deprecated, experime...
397
13,937
probability
spinoffs/fun_mc/fun_mc/backend.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...
18
801
saleor
saleor/graphql/giftcard/tests/mutations/test_gift_card_assign_user.py
.py
import graphene from django.utils import timezone from .....giftcard import GiftCardEvents from .....giftcard.error_codes import GiftCardErrorCode from .....giftcard.utils import assign_gift_card_to_user from ....tests.utils import assert_no_permission, get_graphql_content MUTATION = """ mutation Assign($id: ID!,...
212
6,681
mlflow
tests/telemetry/test_installation_id.py
.py
import json import uuid from unittest import mock import pytest import mlflow from mlflow.telemetry.client import get_telemetry_client, set_telemetry_client from mlflow.telemetry.installation_id import get_or_create_installation_id from mlflow.utils.os import is_windows from mlflow.version import VERSION @pytest.fi...
92
3,204
black
tests/data/cases/preview_simplify_power_operator_hugging.py
.py
# flags: --preview # This is a copy of `power_op_spacing.py`. Remove when `simplify_power_operator_hugging` becomes stable. def function(**kwargs): t = a**2 + b**3 return t ** 2 def function_replace_spaces(**kwargs): t = a **2 + b** 3 + c ** 4 def function_dont_replace_spaces(): {**a, **b, **c} a...
154
3,763
saleor
saleor/app/management/commands/install_app.py
.py
import json from typing import Any from django.core.exceptions import ValidationError from django.core.management import BaseCommand, CommandError from django.core.management.base import CommandParser from ....app.models import App from ....app.validators import AppURLValidator from ....core import JobStatus from ......
83
2,730
textual
docs/examples/guide/styles/padding02.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past, I will turn the inner eye to see i...
28
755
mlflow
mlflow/gateway/providers/bedrock.py
.py
import asyncio import json import queue import time from enum import Enum from typing import Any, AsyncIterable from mlflow.gateway.config import ( AmazonBedrockConfig, AWSBearerToken, AWSIdAndKey, AWSRole, EndpointConfig, ) from mlflow.gateway.constants import ( MLFLOW_AI_GATEWAY_ANTHROPIC_DEF...
756
28,695
luigi
luigi/contrib/ecs.py
.py
# -*- coding: utf-8 -*- # # Copyright 2015 Outlier Bio, LLC # # 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...
271
9,535
probability
tensorflow_probability/python/random/random_ops.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...
179
7,148
probability
tensorflow_probability/python/mcmc/hmc.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...
906
36,096
pyro
pyro/distributions/mixture.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions import constraints from torch.distributions.utils import lazy_property from pyro.distributions.torch_distribution import TorchDistribution from pyro.distributions.util import broadcast_shape ...
164
6,150
hydra
tools/landscape/analyze_hydra_projects.py
.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """Classify project-level Hydra usage from the dependent-repository crawl. The existing crawl is mechanical discovery evidence. This analyzer first routes those records with deterministic rules, then optionally asks Codex t...
902
32,617
saleor
saleor/graphql/checkout/tests/mutations/test_checkout_remove_promo_code.py
.py
import datetime from decimal import Decimal from unittest.mock import ANY, patch import graphene import pytest from django.test import override_settings from django.utils import timezone from freezegun import freeze_time from prices import Money from .....checkout import base_calculations from .....checkout.actions i...
988
33,550
bazel
examples/py_native/fail.py
.py
"""A tiny example binary for the native Python rules of Bazel.""" import unittest from examples.py_native.lib import GetNumber class TestGetNumber(unittest.TestCase): def test_fail(self): self.assertEqual(GetNumber(), 0) if __name__ == '__main__': unittest.main()
14
277
probability
tensorflow_probability/python/internal/backend/numpy/gen/property_hint_util.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. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
124
4,913
metrics
tests/unittests/clustering/test_adjusted_rand_score.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...
70
2,671
beam
sdks/python/apache_beam/typehints/tagged_output_typehints_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...
441
15,625
saleor
saleor/graphql/order/tests/queries/test_order_entity.py
.py
import graphene from .....order import OrderStatus from .....order.models import Order from ....tests.utils import get_graphql_content ORDER_FEDERATION_QUERY = """ query GetOrderInFederation($representations: [_Any!]!) { _entities(representations: $representations) { __typename ... on Order { ...
163
4,544
beam
learning/katas/python/Streaming/Timestamps/Add Timestamps/task.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"); y...
63
2,264
hydra
examples/plugins/example_registered_plugin/tests/test_example_registered_plugin.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from hydra.core.plugins import Plugins from hydra.plugins.plugin import Plugin from example_registered_plugin import ExampleRegisteredPlugin, register_example_plugin def test_discovery() -> None: # Tests that this plugin can be discovered aft...
23
707
pyomo
doc/OnlineDocs/src/data/diet1.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...
85
2,428
onnx
onnx/backend/test/case/node/cumprod.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 CumProd(Base): @staticmethod def export_cumprod_1d() -> None: ...
130
4,714
saleor
saleor/graphql/checkout/mutations/checkout_billing_address_update.py
.py
import graphene from ....checkout import AddressType from ....checkout.actions import call_checkout_info_event from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from ....checkout.utils import change_billing_address_in_checkout, invalidate_checkout from ....core.tracing import traced_atomic_trans...
125
4,687
cvxpy
cvxpy/tests/test_expressions.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...
2,194
83,657
scikit-bio
skbio/alignment/tests/test_pair.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,422
63,640
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_roll.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # round paddle model generator # import numpy as np from save_model import saveModel import paddle import sys data_type = 'float32' def paddle_roll(name: str, x, shifts, axis=None, shifts_is_var=False): paddle.enable_static() ...
55
1,850
conda
conda/common/path/_cygpath.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import ntpath import os import posixpath import re from functools import partial from typing import TYPE_CHECKING if TYPE_CHECKING: from . import PathType def nt_to_posix(path: PathType, prefix: PathTyp...
269
7,046
wandb
tests/unit_tests/test_wandb_save.py
.py
import glob as glob_module import os import pathlib import platform import pytest # ---------------------------------- # wandb.save # ---------------------------------- def test_save_glob_metacharacters_not_matched_by_default( monkeypatch, tmp_path: pathlib.Path, mock_run, parse_records, record_...
407
11,998
coremltools
coremltools/converters/mil/mil/passes/tests/test_cleanup_passes.py
.py
# Copyright (c) 2024, 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 copy import itertools import unittest import numpy as np import pytest from mock import patch...
2,838
106,139
openvino
tests/e2e_tests/common/parsers.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import xml.etree.ElementTree def mapping_parser(file): """ Parse mapping file if it exists :param file: Name of mapping file :return: Dictionary with framework layers as keys and IR layers as values """ ...
42
1,431
astropy
astropy/io/fits/file.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import errno import gzip import http.client import io import math import mmap import os import re import sys import tempfile import warnings import zipfile import numpy as np # NOTE: Python can be built without bz2. from astropy.utils.compat.optional_dep...
790
29,016
mlflow
tests/entities/test_run_status.py
.py
import pytest from mlflow.entities import RunStatus def test_all_status_covered(): # ensure that all known status are returned. Test will fail if new status are added to PB all_statuses = { RunStatus.RUNNING, RunStatus.SCHEDULED, RunStatus.FINISHED, RunStatus.FAILED, R...
50
1,732
mlflow
examples/rapids/mlflow_project/src/rf_test/train_simple.py
.py
"""Simple example integrating cuML with MLflow""" import argparse from cuml.ensemble import RandomForestClassifier from cuml.metrics.accuracy import accuracy_score from cuml.preprocessing.model_selection import train_test_split import mlflow import mlflow.sklearn from mlflow.models import infer_signature def load_...
105
3,190
mlflow
tests/paddle/test_paddle_model_export.py
.py
import json import os from typing import Any, NamedTuple from unittest import mock import numpy as np import paddle import paddle.nn.functional as F import pandas as pd import pytest import yaml from packaging.version import Version from paddle.nn import Linear from sklearn import preprocessing from sklearn.datasets i...
633
24,013
saleor
saleor/plugins/webhook/tests/subscription_webhooks/filterable_webhooks/test_order_metadata_updated.py
.py
import json from unittest.mock import patch import graphene from django.test import override_settings from ......core.models import EventDelivery from ......graphql.webhook.subscription_query import SubscriptionQuery from ......webhook.event_types import WebhookEventAsyncType from .....manager import get_plugins_mana...
233
7,133
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/IntProperty.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class IntProperty(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(flat...
68
1,970
conda
conda/plugins/subcommands/plugins/list.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Implementation for `conda plugins list` subcommand.""" from __future__ import annotations from typing import TYPE_CHECKING from ....base.context import context from ....cli.helpers import add_parser_json from ....common.serialize import js...
59
1,518
pyomo
pyomo/contrib/piecewise/transform/inner_representation_gdp.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...
107
5,128
gunicorn
tests/docker/asgi_compliance/test_concurrency.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Concurrency integration tests for ASGI. Tests concurrent connections, mixed protocols, and load handling. """ import asyncio import json import pytest pytestmark = [ pytest.mark.docker, pytest.mark....
477
17,591
mlflow
tests/store/tracking/sqlalchemy_store/test_sqlalchemy_store_core.py
.py
import json import os import shutil from unittest import mock import pytest import sqlalchemy import mlflow.db from mlflow import entities from mlflow.exceptions import MlflowException from mlflow.store.db.db_types import MSSQL, MYSQL from mlflow.store.db.utils import ( _get_latest_schema_revision, _get_schem...
357
13,569
pyomo
pyomo/core/base/disable_methods.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...
143
5,681
mlflow
mlflow/entities/dataset_input.py
.py
from mlflow.entities._mlflow_object import _MlflowObject from mlflow.entities.dataset import Dataset from mlflow.entities.input_tag import InputTag from mlflow.protos.service_pb2 import DatasetInput as ProtoDatasetInput class DatasetInput(_MlflowObject): """DatasetInput object associated with an experiment.""" ...
50
1,581
pyro
pyro/contrib/gp/models/vsgp.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions import constraints from torch.nn import Parameter import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.contrib.gp.models.model import GPModel from pyro.contri...
218
8,417
jupytext
tests/unit/test_compare.py
.py
import pytest from nbformat.v4.nbbase import ( new_code_cell, new_markdown_cell, new_notebook, new_raw_cell, ) from jupytext.compare import ( NotebookDifference, compare, compare_cells, compare_notebooks, ) from jupytext.compare import test_round_trip_conversion as round_trip_conversion...
301
9,750
saleor
saleor/tests/e2e/orders/discounts/test_order_products_on_catalog_promotion_and_order_promotion.py
.py
import pytest from .....product.tasks import recalculate_discounted_price_for_products_task from ... import DEFAULT_ADDRESS from ...product.utils import ( create_category, create_product, create_product_channel_listing, create_product_type, create_product_variant, create_product_variant_channel...
465
15,684
pymc
pymc/variational/approximations.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...
401
13,080
beam
sdks/python/apache_beam/transforms/combiners_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,303
49,854
scikit-bio
skbio/io/format/tests/test_clustal.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. # --------------------------------------------...
292
11,715
mlflow
mlflow/protos/assessments_pb2.py
.py
import google.protobuf from packaging.version import Version if Version(google.protobuf.__version__).major >= 5: # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: assessments.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" from google...
191
13,983
coremltools
coremltools/converters/mil/mil/input_type.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 collections import OrderedDict from coremltools.converters.mil.mil import types from coremltool...
352
11,482
saleor
saleor/tests/e2e/checkout/test_unlogged_customer_should_be_able_to_buy_by_click_and_collect.py
.py
import pytest from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from ..warehouse.utils import update_warehouse from .utils import ( checkout_complete, checkout_create, checkout_delivery_method_up...
97
2,764
mlflow
tests/genai/scorers/ragas/test_registry.py
.py
from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.genai.scorers.ragas.registry import ( get_metric_class, is_agentic_or_multiturn_metric, requires_args_from_placeholders, requires_embeddings, requires_llm_at_score_time, requires_llm_in_constructo...
113
3,160
luigi
test/dynamic_import_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...
39
1,178