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
coremltools
deps/pybind11/tests/test_factory_constructors.py
.py
from __future__ import annotations import re import pytest from pybind11_tests import ConstructorStats from pybind11_tests import factory_constructors as m from pybind11_tests.factory_constructors import tag def test_init_factory_basic(): """Tests py::init_factory() wrapper around various ways of returning the...
519
16,527
textual
docs/examples/widgets/progress_bar_isolated_.py
.py
from textual.app import App, ComposeResult from textual.clock import MockClock from textual.containers import Center, Middle from textual.timer import Timer from textual.widgets import Footer, ProgressBar class IndeterminateProgressBar(App[None]): BINDINGS = [("s", "start", "Start")] progress_timer: Timer ...
53
1,663
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineglobally_lambda.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");...
60
1,905
astropy
docs/conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file needs to be included here to make sure commands such # as ``pytest docs/...`` works, since this # will ignore the conftest.py file at the root of the repository # and the one in astropy/conftest.py import os from pathlib import Path import p...
50
1,934
biopython
Bio/SeqIO/UniprotIO.py
.py
# Copyright 2010 by Andrea Pierleoni # Revisions copyright 2010, 2016 by Peter Cock # 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...
572
24,714
beam
sdks/python/apache_beam/examples/snippets/transforms/other/create_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");...
52
1,482
beam
sdks/python/apache_beam/runners/portability/portable_runner_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...
579
20,995
onnxruntime
onnxruntime/test/testdata/transform/computation_reduction/gathernd/gathernd_layernormalization.py
.py
import numpy as np import onnx from onnx import OperatorSetIdProto, TensorProto, helper, numpy_helper X = helper.make_tensor_value_info("input", TensorProto.FLOAT, ["batch", "seqlen", 128]) unsqueezed_masked_lm_positions = helper.make_tensor_value_info( "unsqueezed_masked_lm_positions", TensorProto.INT64, ...
71
2,278
wagtail
wagtail/images/tests/test_api_v3/test_schemas.py
.py
from django.urls import reverse from wagtail.api.v3.registry import registry from wagtail.images import get_image_model from .base import TestV3ImagesBase class TestV3ImageSchemas(TestV3ImagesBase): def setUp(self): super().setUp() self.Image = get_image_model() self.registration = regis...
74
3,012
pymc
pymc/dims/distributions/transforms.py
.py
# Copyright 2025 - 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...
207
6,518
pyro
pyro/contrib/tracking/dynamic_models.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from abc import ABCMeta, abstractmethod import torch from torch import nn from torch.nn import Parameter import pyro.distributions as dist from pyro.distributions.util import eye_like class DynamicModel(nn.Module, metaclass=ABC...
468
16,560
astropy
astropy/coordinates/angles/formats.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module includes files automatically generated from ply (these end in # _lextab.py and _parsetab.py). To generate these files, remove them from this # folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace #...
453
13,967
wagtail
wagtail/contrib/settings/tests/shared/test_preview.py
.py
from django.contrib.auth.models import Permission from django.test import TestCase from django.test.utils import override_settings from django.urls import reverse from django.utils import timezone from wagtail.admin.models import FormState from wagtail.admin.staticfiles import versioned_static from wagtail.models impo...
263
10,439
pyomo
pyomo/common/collections/component_map.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...
185
6,291
kombu
t/unit/asynchronous/aws/sqs/test_queue.py
.py
from __future__ import annotations from unittest.mock import Mock import pytest from kombu.asynchronous.aws.sqs.message import AsyncMessage from kombu.asynchronous.aws.sqs.queue import AsyncQueue from t.mocks import PromiseMock from ..case import AWSCase class test_AsyncQueue(AWSCase): def setup_method(self)...
206
7,147
pyomo
pyomo/contrib/mpc/interfaces/load_data.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...
199
6,925
biopython
Tests/test_SearchIO_hmmer3_domtab.py
.py
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for SearchIO HmmerIO hmmer3-domtab parsers.""" import os import unittest from B...
648
27,800
beam
sdks/python/apache_beam/examples/snippets/util.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...
65
2,317
pyomo
pyomo/core/tests/unit/test_derivs.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...
407
15,991
clearml
clearml/binding/artifacts.py
.py
import gzip import io import json import mimetypes import os import pickle from copy import deepcopy from datetime import datetime from multiprocessing.pool import ThreadPool from tempfile import mkdtemp, mkstemp from threading import Thread from time import time from typing import Dict, Union, Optional, Sequence, Call...
1,375
58,240
beam
learning/tour-of-beam/learning-content/core-transforms/map/map-elements/python-example/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...
52
1,697
probability
tensorflow_probability/python/bijectors/generalized_pareto_test.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...
129
4,274
astropy
astropy/time/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Time utilities. In particular, routines to do basic arithmetic on numbers represented by two doubles, using the procedure of Shewchuk, 1997, Discrete & Computational Geometry 18(3):305-363 -- http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf Furtherm...
251
8,256
ipython
IPython/core/oinspect.py
.py
"""Tools for inspecting Python objects. Uses syntax highlighting for presenting the various information elements. Similar in spirit to the inspect module, but all calls take a name argument to reference the name under which an object is being read. """ from __future__ import annotations # Copyright (c) IPython Devel...
1,197
39,530
readthedocs.org
readthedocs/rtd_tests/tests/test_project.py
.py
import datetime import json from unittest import mock from unittest.mock import patch import pytest from django.contrib.auth.models import User from django.forms.models import model_to_dict from django.test import TestCase from django.urls import reverse from django.utils import timezone from django_dynamic_fixture im...
589
20,870
wandb
tests/unit_tests/test_lib/test_paths.py
.py
import itertools import platform import re from pathlib import Path, PurePath, PurePosixPath, PureWindowsPath import pytest from wandb.sdk.lib.paths import LogicalPath from wandb.util import to_forward_slash_path # Once upon a time I used hypothesis and fspaths to generate test cases. This was a good # thing, and un...
179
7,616
kafka
tests/kafkatest/tests/core/get_offset_shell_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 ...
253
14,117
cvxpy
cvxpy/reductions/__init__.py
.py
""" Copyright 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
30
1,303
conda
tests/plugins/test_post_commands.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import pytest from conda import plugins from conda.plugins.reporter_backends import plugins as reporter_backends_plugins from conda.plugins.types import CondaPostCommand class PostCommandPlugin: def post_command_action(self, command: str)...
65
2,000
beam
sdks/python/apache_beam/examples/complete/game/hourly_team_score.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...
316
11,316
luigi
test/test_ssh.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...
49
1,712
pyomo
pyomo/contrib/preprocessing/tests/test_strip_bounds.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...
130
5,027
mamba
libmambapy/tests/test_solver.py
.py
import random import copy import pytest import libmambapy def test_import_submodule(): import libmambapy.solver as solver # Dummy execution _r = solver.Request def test_import_recursive(): import libmambapy as mamba # Dummy execution _r = mamba.solver.Request @pytest.mark.parametrize( ...
347
10,199
mlflow
examples/shap/binary_classification.py
.py
import os import numpy as np import shap from sklearn.datasets import load_breast_cancer from sklearn.ensemble import RandomForestClassifier import mlflow from mlflow.artifacts import download_artifacts from mlflow.tracking import MlflowClient # prepare training data X, y = load_breast_cancer(return_X_y=True, as_fra...
39
1,123
pyro
pyro/contrib/autoname/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ The :mod:`pyro.contrib.autoname` module provides tools for automatically generating unique, semantically meaningful names for sample sites. """ from pyro.contrib.autoname import named from pyro.contrib.autoname.autoname import...
20
487
textual
tests/test_node_list.py
.py
import pytest from textual._node_list import NodeList from textual.widget import Widget def test_empty_list(): """Does an empty node list report as being empty?""" assert len(NodeList()) == 0 async def test_add_one(): """Does adding a node to the node list report as having one item?""" nodes = Node...
114
2,824
django-cms
cms/tests/test_sitemap.py
.py
import copy from django.db.models import QuerySet from cms.api import create_page, create_page_content from cms.models import PageUrl from cms.sitemaps import CMSSitemap from cms.test_utils.testcases import CMSTestCase from cms.utils.conf import get_cms_setting protocol = "https" class SitemapTestCase(CMSTestCase)...
131
5,085
mlflow
tests/genai/judges/test_make_judge.py
.py
import json import sys import types import typing from dataclasses import asdict from typing import Any, Literal from unittest import mock from unittest.mock import patch import pandas as pd import pydantic import pytest from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan import mlflow import mlflow....
4,196
143,063
cvxpy
cvxpy/tests/nlp_tests/test_matmul.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 ...
205
7,455
scikit-bio
skbio/stats/ordination/tests/test_mmvec.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. # --------------------------------------------...
949
35,315
pyomo
pyomo/contrib/pynumero/algorithms/solvers/tests/test_cyipopt_solver.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...
493
18,841
confluent-kafka-python
src/confluent_kafka/_util/validation_util.py
.py
# Copyright 2022 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 required by applicable law or agreed to in writing, s...
59
2,098
onnx
onnx/reference/ops/op_optional_has_element.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class OptionalHasElement(OpRun): def _run(self, x=None): return (np.array(x is not None),)
14
282
textual
src/textual/widgets/_toggle_button.py
.py
"""Provides the base code and implementations of toggle widgets. In particular it provides `Checkbox`, `RadioButton` and `RadioSet`. """ from __future__ import annotations from typing import TYPE_CHECKING, ClassVar from rich.console import RenderableType from textual.binding import Binding, BindingType from textua...
286
8,942
textual
src/textual/_queue.py
.py
from __future__ import annotations import asyncio from asyncio import Event from collections import deque from typing import Generic, TypeVar QueueType = TypeVar("QueueType") class Queue(Generic[QueueType]): """A cut-down version of asyncio.Queue This has just enough functionality to run the message pumps....
50
1,211
saleor
saleor/graphql/channel/dataloaders/by_order.py
.py
from uuid import UUID from django.db.models import Exists, OuterRef from ....channel.models import Channel from ....order.models import Order from ...core.dataloaders import DataLoader from ...order.dataloaders import OrderByIdLoader from .by_self import ChannelByIdLoader class ChannelByOrderIdLoader(DataLoader[UUI...
47
1,532
coremltools
coremltools/models/neural_network/flexible_shape_utils.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 """ Utilities to annotate neural network features with flexible shape information. """ from typing impo...
825
29,618
python-dotenv
tests/test_is_interactive.py
.py
import builtins import sys from unittest import mock from dotenv.main import find_dotenv class TestIsInteractive: """Tests for the _is_interactive helper function within find_dotenv. The _is_interactive function is used by find_dotenv to determine if the code is running in an interactive environment (li...
233
8,921
openvino
tests/layer_tests/onnx_tests/test_argmax.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...
160
6,507
readthedocs.org
readthedocs/core/middleware.py
.py
import structlog from django.conf import settings from django.core.exceptions import TooManyFieldsSent from django.http import HttpResponse log = structlog.get_logger(__name__) class NullCharactersMiddleware: """ Block all requests that contains NULL characters (0x00) on their GET attributes. Requests ...
93
3,180
biopython
Bio/SeqIO/SnapGeneIO.py
.py
# Copyright 2017-2019 Damien Goutte-Gattat. 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.SeqIO sup...
357
12,451
textual
src/textual/widgets/_button.py
.py
from __future__ import annotations from functools import partial from typing import TYPE_CHECKING, cast import rich.repr from rich.cells import cell_len from rich.console import ConsoleRenderable, RenderableType from typing_extensions import Literal, Self from textual import events if TYPE_CHECKING: from textua...
559
17,246
onnxruntime
onnxruntime/test/python/transformers/profile_gqa.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ Simple profiling script for GroupQueryAttention with quantized KV c...
250
9,374
astropy
astropy/tests/tests/test_quantity_helpers.py
.py
import pytest from astropy import units as u from astropy.tests.helper import assert_quantity_allclose def test_assert_quantity_allclose(): assert_quantity_allclose([1, 2], [1, 2]) assert_quantity_allclose([1, 2] * u.m, [100, 200] * u.cm) assert_quantity_allclose([1, 2] * u.m, [101, 201] * u.cm, atol=2...
46
1,538
wagtail
wagtail/users/tests/test_bulk_actions/test_bulk_assign_role.py
.py
from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.http import HttpRequest, HttpResponse from django.test import TestCase from django.urls import reverse from wagtail.test.utils import WagtailTestUtils from wagtail.users.views.bulk_actions.user_bulk_action import Us...
110
3,906
mlflow
mlflow/server/artifact_router.py
.py
""" Native FastAPI artifact upload and download endpoints. When MLflow runs under uvicorn/FastAPI (the default), these endpoints handle artifact upload and download requests directly via ASGI, bypassing the WSGI bridge and avoiding full-body buffering. This enables true streaming for large artifact transfers. When ML...
182
6,448
metrics
tests/unittests/detection/test_map.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...
1,099
43,284
coremltools
coremltools/converters/mil/frontend/tensorflow/test/test_ops.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import math import os import platform import shutil import tempfile from typing impo...
8,127
281,494
omegaconf
tests/test_tuple_structured.py
.py
from dataclasses import dataclass, field from types import GenericAlias from typing import Any, List, NamedTuple, Optional, Tuple import attr from pytest import mark, param, raises from typing_extensions import TypeVarTuple, Unpack from omegaconf import MISSING, ListConfig, OmegaConf, TupleConfig, ValidationError @...
206
6,551
probability
tensorflow_probability/python/experimental/distributions/importance_resample.py
.py
"""Meta-distribution to apply importance resampling to a proposal dist.""" # 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://...
673
31,075
kafka
tests/kafkatest/services/performance/share_consumer_performance.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 ...
144
6,245
saleor
saleor/tests/e2e/checkout/test_guest_user_can_complete_checkout_without_saving_addresses.py
.py
import pytest from .. import ADDRESS_DE from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assert_address_data, assign_permissions from .utils import ( checkout_complete, checkout_create, checkout_delivery_method_up...
109
3,547
probability
tensorflow_probability/python/experimental/fastgp/linalg.py
.py
# Copyright 2024 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
192
6,353
pyomo
examples/pyomo/diet/diet2.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...
90
2,288
onnxruntime
onnxruntime/test/testdata/ort_github_issue_10305.py
.py
import onnx from onnx import TensorProto, helper # Loop is so the Tranpose output is used in a subgraph loop_body = helper.make_graph( [ helper.make_node("Add", ["transpose:0", "loop_state_in"], ["loop_state_out"], "Add1"), ], "Loop_body", [ helper.make_tensor_value_info("iteration_num"...
73
2,374
pyomo
examples/pyomobook/scripts-ch/warehouse_solver_options.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...
42
1,285
hypercorn
tests/trio/test_sanity.py
.py
from __future__ import annotations from typing import cast from unittest.mock import AsyncMock, Mock, PropertyMock import h2 import h11 import pytest import trio import wsproto from hypercorn.app_wrappers import ASGIWrapper from hypercorn.config import Config from hypercorn.trio.tcp_server import TCPServer from hype...
210
8,563
openvino
tests/layer_tests/jax_tests/test_negative.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 rng = np.random.default_rng(56342) class TestNeg(JaxLayerTest): def _prepare_input(self): if n...
51
1,689
beam
sdks/python/apache_beam/examples/inference/anomaly_detection/anomaly_detection_pipeline/pipeline/transformations.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...
195
6,714
returns
returns/interfaces/specific/result.py
.py
""" An interface that represents a pure computation result. For impure result see :class:`returns.interfaces.specific.ioresult.IOResultLikeN` type. """ from __future__ import annotations from abc import abstractmethod from collections.abc import Callable from typing import TYPE_CHECKING, Never, TypeVar from returns...
109
2,891
saleor
saleor/graphql/checkout/dataloaders/promotion_rule_infos.py
.py
from collections import defaultdict from uuid import UUID from promise import Promise from ....discount.interface import VariantPromotionRuleInfo from ...core.dataloaders import DataLoader from ...discount.dataloaders import ( PromotionByRuleIdLoader, PromotionRuleByIdLoader, ) from ...product.dataloaders imp...
196
9,154
returns
tests/test_future/test_future_container/test_future_equality.py
.py
import pytest from returns.future import Future def test_nonequality(): """Ensures that containers can be compared.""" assert Future.from_value(1) != Future.from_value(1) assert hash(Future.from_value(1)) @pytest.mark.anyio async def test_equality(): """Ensures that containers are not compared to r...
16
406
conda
conda/testing/fixtures.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Collection of pytest fixtures used in conda tests.""" from __future__ import annotations import os import subprocess import uuid import warnings from contextlib import contextmanager, nullcontext from dataclasses import dataclass from itert...
887
27,928
beam
sdks/python/apache_beam/io/watch_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...
859
36,179
scikit-bio
skbio/diversity/alpha/_chao1.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. # --------------------------------------------...
221
6,370
confluent-kafka-python
examples/eos_transactions.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...
191
6,756
scikit-bio
skbio/io/format/tests/test_embed.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. # --------------------------------------------...
226
8,940
gunicorn
tests/dirty/test_client_streaming.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for dirty client sync streaming functionality.""" import socket import struct import pytest from unittest import mock from gunicorn.dirty.protocol import ( DirtyProtocol, BinaryProtocol, make...
233
7,341
biopython
Tests/test_PhyloXML.py
.py
# Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com) # 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. """Unit tests for the PhyloXML and PhyloXMLIO modules.""" import os import platform # ...
826
31,387
biopython
Bio/Nexus/Nodes.py
.py
# Copyright 2005-2008 by Frank Kauff & Cymon J. Cox. 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. """Link...
181
5,828
onnx
onnx/backend/test/case/node/lrn.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import math import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class LRN(Base): @staticmethod def export() -> None: ...
71
2,096
clearml
clearml/automation/optuna/optuna.py
.py
from time import sleep from typing import Optional, Sequence, Any from ..optimization import Objective, SearchStrategy from ..parameters import ( DiscreteParameterRange, Parameter, UniformIntegerParameterRange, UniformParameterRange, LogUniformParameterRange, ) from ...task import Task try: # ...
286
12,944
beam
sdks/python/apache_beam/runners/pipeline_context_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...
92
3,727
astropy
astropy/io/fits/verify.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import operator import warnings from textwrap import indent from astropy.utils.exceptions import AstropyUserWarning class VerifyError(Exception): """ Verify exception class. """ class VerifyWarning(AstropyUserWarning): """ Verify w...
178
5,506
coremltools
coremltools/test/ml_program/experimental/__init__.py
.py
# Copyright (c) 2025, 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
5
215
openvino
tests/e2e_tests/common/ref_collector/score_tf_v2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import gc import logging as log import os import tempfile from distutils.version import LooseVersion from pathlib import Path from utils.path_utils import resolve_dir_path from e2e_tests.common.ref_collector.provider import ClassProvide...
79
2,875
textual
tests/listview/test_listview_navigation.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label, ListItem, ListView class ListViewDisabledItemsApp(App[None]): def compose(self) -> ComposeResult: self.highlighted = [] yield ListView( ListItem(Label("0"), disabled=True), ListItem(Label("1")), ...
46
1,357
ipython
IPython/testing/plugin/pytest_ipdoctest.py
.py
# Based on Pytest doctest.py # Original license: # The MIT License (MIT) # # Copyright (c) 2004-2021 Holger Krekel and others """Discover and run ipdoctests in modules and test files.""" from __future__ import annotations import bdb import builtins import inspect import os import platform import sys import traceback i...
869
29,873
black
tests/data/cases/pep_701.py
.py
# flags: --minimum-version=3.12 x = f"foo" x = f'foo' x = f"""foo""" x = f'''foo''' x = f"foo {{ bar {{ baz" x = f"foo {{ {2 + 2}bar {{ baz" x = f'foo {{ {2 + 2}bar {{ baz' x = f"""foo {{ {2 + 2}bar {{ baz""" x = f'''foo {{ {2 + 2}bar {{ baz''' # edge case: FSTRING_MIDDLE containing only whitespace should not be strip...
277
4,699
coremltools
coremltools/test/neural_network/test_nn_builder.py
.py
# Copyright (c) 2021, 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 import unittest import coremltools from coremltools import ComputeUnit...
628
24,047
onnxruntime
onnxruntime/test/testdata/model_with_external_initializers.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import numpy as np import onnx from onnx import TensorProto, helper from onnx.external_data_helper import set_external_data from onnx.numpy_helper import from_array def create_external_data_tensor(value, tensor_n...
78
2,466
openvino
tests/model_hub_tests/pytorch/test_tpsmm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import subprocess import sys import tempfile import pytest import torch import yaml from torch_utils import TestTorchConvertModel # To make tests reproducible we seed the random generator torch.manual_seed(0) class TestThi...
71
2,761
wandb
wandb/integration/sb3/sb3.py
.py
"""W&B callback for sb3. Really simple callback to get logging for each tree Example usage: ```python import gym from stable_baselines3 import PPO from stable_baselines3.common.monitor import Monitor from stable_baselines3.common.vec_env import DummyVecEnv, VecVideoRecorder import wandb from wandb.integration.sb3 im...
152
4,829
probability
tensorflow_probability/python/sts/default_model_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...
144
6,566
mlflow
mlflow/genai/judges/optimizers/memalign/__init__.py
.py
from mlflow.genai.judges.optimizers.memalign.optimizer import MemAlignOptimizer __all__ = ["MemAlignOptimizer"]
4
113
mlflow
mlflow/utils/yaml_utils.py
.py
import codecs import os import shutil import tempfile import yaml from mlflow.utils.file_utils import ENCODING, exists, get_parent_dir try: from yaml import CSafeDumper as YamlSafeDumper from yaml import CSafeLoader as YamlSafeLoader except ImportError: from yaml import SafeDumper as YamlSafeDumper ...
122
4,339
hatch
src/hatch/env/lockers/uv.py
.py
from __future__ import annotations import tempfile from typing import TYPE_CHECKING from hatch.env.lockers.interface import LockerInterface from hatch.env.utils import add_verbosity_flag from hatch.utils.fs import Path if TYPE_CHECKING: from hatch.env.plugin.interface import EnvironmentInterface from hatch.e...
173
5,612
mlflow
dev/clint/src/clint/rules/extraneous_docstring_param.py
.py
from clint.rules.base import Rule class ExtraneousDocstringParam(Rule): def __init__(self, params: set[str]) -> None: self.params = params def _message(self) -> str: return f"Extraneous parameters in docstring: {self.params}"
10
253
wandb
tests/unit_tests/test_automations/conftest.py
.py
from __future__ import annotations import json import secrets from functools import cache from typing import TypeAlias from unittest.mock import Mock from hypothesis import settings from pytest import FixtureRequest, fixture, skip from pytest_mock import MockerFixture from wandb._strutils import b64encode_ascii from ...
613
19,206
gunicorn
examples/frameworks/flask_sendfile.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import io from flask import Flask, send_file app = Flask(__name__) @app.route('/') def index(): buf = io.BytesIO() buf.write(b'hello world') buf.seek(0) return send_file(buf, ...
19
397