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
pyomo
pyomo/contrib/parmest/utils/__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...
24
1,006
pyomo
pyomo/repn/beta/__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...
11
582
luigi
luigi/contrib/hadoop_jar.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...
164
5,415
sqlmap
tamper/overlongutf8.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import string from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOWEST def dependencies(): pass def tamper(payload, **kwargs): """ Converts all (non-alph...
52
1,754
readthedocs.org
readthedocs/proxito/tests/mixins.py
.py
from readthedocs.proxito.tests.storage import BuildMediaStorageTest class MockStorageMixin: """ Mixin to controls ``BuildMediaStorageTests.exists`` method. This mixin provides a helper to update which files does exist in the storage backend and reset them to an empty list on tear down. """ ...
19
511
django-cms
cms/utils/setup.py
.py
from django.core.exceptions import ImproperlyConfigured from django.template import engines from django.template.backends.django import DjangoTemplates from cms.app_registration import ( autodiscover_cms_configs, backwards_compatibility_config, configure_cms_apps, get_cms_extension_apps, ready_cms_...
74
2,350
gunicorn
gunicorn/dirty/arbiter.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Dirty Arbiter Process Asyncio-based arbiter that manages the dirty worker pool and routes requests from HTTP workers to available dirty workers. """ import asyncio import errno import fnmatch import os import...
1,153
41,576
textual
docs/examples/how-to/center03.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static class CenterApp(App): """How to center things.""" CSS = """ Screen { align: center middle; } #hello { background: blue 50%; border: wide white; width: auto; } """ def compos...
27
461
onnxruntime
orttraining/tools/scripts/train.py
.py
import shlex import subprocess import sys def main(argv=None): if argv is None: argv = sys.argv[1:] cmd = ["/workspace/onnxruntime_training_bert", *argv] print(shlex.join(cmd)) subprocess.run(cmd, check=True) if __name__ == "__main__": main()
17
276
beam
sdks/python/apache_beam/testing/test_stream_service.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...
87
3,157
wagtail
wagtail/snippets/tests/test_compare_revisions_view.py
.py
import datetime from django.contrib.admin.utils import quote from django.contrib.auth.models import Permission from django.test import TestCase from django.urls import reverse from django.utils.timezone import make_aware from wagtail.test.testapp.models import ( RevisableChildModel, RevisableModel, ) from wag...
168
6,284
flit
flit_core/tests_core/samples/imported_version/package1/__init__.py
.py
"""This module has a __version__ that requires a relative import""" from ._version import __version__ import a_package_that_doesnt_exist
6
139
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/entr_canon.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...
35
1,187
mlflow
mlflow/genai/judges/adapters/gateway_adapter.py
.py
"""Gateway-based judge adapter with tool-calling loop support. Uses the MLflow Gateway provider infrastructure for request/response transformation and provider configuration, with retry logic, context window management, and proactive pruning. """ from __future__ import annotations import json import logging from dat...
672
26,629
colorama
colorama/__init__.py
.py
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. from .initialise import init, deinit, reinit, colorama_text, just_fix_windows_console from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 __version__ = '0.4.7dev1'
8
270
textual
src/textual/worker_manager.py
.py
""" Contains `WorkerManager`, a class to manage [workers](/guide/workers) for an app. You access this object via [App.workers][textual.app.App.workers] or [Widget.workers][textual.dom.DOMNode.workers]. """ from __future__ import annotations import asyncio from collections import Counter from operator import attrgett...
182
5,602
openvino
tests/layer_tests/onnx_tests/test_gemm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import numpy as np import pytest import torch from common.layer_test_class import CommonLayerTest from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model class TestGemm(OnnxRuntimeLayerTest): def _...
342
11,969
saleor
saleor/core/management/commands/delete_event_payloads.py
.py
from django.core.management.base import BaseCommand from ...tasks import delete_event_payloads_task class Command(BaseCommand): help = ( "Delete EventPayloads and EventDelivery from database " "that are older than the value set " "in EVENT_PAYLOAD_DELETE_PERIOD environment variable." ...
15
393
hydra
tests/test_apps/app_with_callbacks/on_job_start_accepts_task_function/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging from typing import Any from omegaconf import DictConfig import hydra from hydra.experimental.callback import Callback from hydra.types import TaskFunction from hydra.utils import target_whitelist log = logging.getLogger(__name__) ...
32
794
pyro
tests/infer/autoguide/conftest.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest def pytest_collection_modifyitems(items): for item in items: if item.nodeid.startswith("tests/infer/autoguide"): if "stage" not in item.keywords: item.add_marker(pytest.mark.s...
14
442
astropy
astropy/units/tests/test_quantity_helpers.py
.py
""" Test ``allclose`` and ``isclose``. ``allclose`` was ``quantity_allclose`` in ``astropy.tests.helper``. """ import numpy as np import pytest from astropy import units as u @pytest.mark.parametrize( ("a", "b"), [ ([1, 2], [1, 2]), ([1, 2] * u.m, [100, 200] * u.cm), (1 * u.s, 1000 *...
35
724
python-prompt-toolkit
src/prompt_toolkit/filters/__init__.py
.py
""" Filters decide whether something is active or not (they decide about a boolean state). This is used to enable/disable features, like key bindings, parts of the layout and other stuff. For instance, we could have a `HasSearch` filter attached to some part of the layout, in order to show that part of the user interfa...
72
1,990
textual
tests/test_pipe.py
.py
import subprocess import sys from pathlib import Path import pytest skip_windows = pytest.mark.skipif( sys.platform == "win32", reason="Syntax not supported on Windows" ) @skip_windows def test_deadlock(): """Regression test for https://github.com/Textualize/textual/issues/4643""" app_path = (Path(__fil...
22
570
saleor
saleor/graphql/payment/mutations/transaction/payment_gateway_initialize.py
.py
import graphene from django.conf import settings from .....payment.interface import PaymentGatewayData from ....core.doc_category import DOC_CATEGORY_PAYMENTS from ....core.enums import PaymentGatewayInitializeErrorCode from ....core.scalars import JSON, PositiveDecimal from ....core.types import BaseInputObjectType, ...
152
5,766
wagtail
wagtail/api/v3/tests/test_pages.py
.py
import unittest from io import StringIO import swapper from django.core import management from django.test import TestCase, TransactionTestCase, override_settings, tag from django.urls import reverse from wagtail.api.v3.tests.base import TestV3Base from wagtail.models import Locale, Site from wagtail.models.view_rest...
1,389
51,450
metrics
tests/unittests/text/test_cer.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...
71
2,453
kombu
t/unit/transport/SQS/conftest.py
.py
"""Testing module for the kombu.transport.SQS package. NOTE: The SQSQueueMock and SQSConnectionMock classes originally come from http://github.com/pcsforeducation/sqs-mock-python. They have been patched slightly. """ from __future__ import annotations import datetime from unittest.mock import MagicMock, patch import...
152
4,251
luigi
test/contrib/hdfs_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...
265
9,498
probability
spinoffs/inference_gym/inference_gym/targets/ill_conditioned_gaussian.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
130
4,363
openvino
tests/layer_tests/pytorch_tests/test_scalar_tensor.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestScalarTensor(PytorchLayerTest): def _prepare_input(self): return (np.array(self.random.randn(), dtype=np.float3...
40
1,219
gunicorn
tests/support_dirty_app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Support module for dirty app tests.""" from gunicorn.dirty.app import DirtyApp class TestDirtyApp(DirtyApp): """A simple dirty app for testing.""" def __init__(self): self.initialized = False...
158
3,768
beam
sdks/python/apache_beam/io/flink/flink_streaming_impulse_source_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...
40
1,428
hypercorn
src/hypercorn/protocol/__init__.py
.py
from __future__ import annotations from collections.abc import Awaitable, Callable from .h2 import H2Protocol from .h11 import H2CProtocolRequiredError, H2ProtocolAssumedError, H11Protocol from ..config import Config from ..events import Event, RawData from ..typing import AppWrapper, ConnectionState, TaskGroup, Work...
97
2,966
beam
sdks/python/apache_beam/ml/anomaly/univariate/stdev_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...
158
4,608
probability
tensorflow_probability/python/stats/leave_one_out.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...
261
11,219
textual
docs/examples/styles/box_sizing.py
.py
from textual.app import App from textual.widgets import Static class BoxSizingApp(App): CSS_PATH = "box_sizing.tcss" def compose(self): yield Static("I'm using border-box!", id="static1") yield Static("I'm using content-box!", id="static2") if __name__ == "__main__": app = BoxSizingApp(...
16
336
wagtail
wagtail/admin/signal_handlers.py
.py
from wagtail.admin.mail import ( GroupApprovalTaskStateSubmissionEmailNotifier, WorkflowStateApprovalEmailNotifier, WorkflowStateRejectionEmailNotifier, WorkflowStateSubmissionEmailNotifier, ) from wagtail.models import TaskState, WorkflowState from wagtail.signals import ( task_submitted, workf...
43
1,428
lemur
lemur/tests/test_user_service.py
.py
from unittest.mock import MagicMock, patch from lemur.users import service as user_service def _role(name): r = MagicMock() r.name = name return r def _patch_config(overrides=None): mock_app = MagicMock() def config_get(key, default=None): return (overrides or {}).get(key, default) ...
109
5,180
lemur
lemur/plugins/utils.py
.py
""" .. module: lemur.plugins.utils :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ def get_plugin_option(name, options): """ Retrieve option name from options di...
32
699
beam
sdks/python/apache_beam/io/filebasedsource.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...
474
18,738
astropy
astropy/coordinates/tests/test_atc_replacements.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test replacements for ERFA functions atciqz and aticq.""" import erfa import pytest import astropy.units as u from astropy.coordinates import SphericalRepresentation from astropy.coordinates.builtin_frames.utils import atciqz, aticq, get_jd12 from as...
33
1,091
biopython
Bio/SeqUtils/CheckSum.py
.py
# Copyright 2002 by Yves Bastide and Brad Chapman. # Copyright 2007 by Sebastian Bassi # 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 a...
145
3,510
cvxpy
cvxpy/tests/test_grad.py
.py
""" Copyright 2013 Steven Diamond, 2025 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...
1,237
48,251
jupytext
tests/unit/test_paired_paths.py
.py
import os import unittest.mock as mock import pytest import jupytext from jupytext.cli import jupytext as jupytext_cli from jupytext.compare import compare from jupytext.formats import ( long_form_multiple_formats, long_form_one_format, short_form_multiple_formats, ) from jupytext.paired_paths import ( ...
351
12,734
pyro
examples/cvae/mnist.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import numpy as np import torch from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, functional from pyro.contrib.examples.util import MNIST class CVAEMNIST(Dataset): def __init__(self, ro...
95
3,204
probability
tensorflow_probability/python/distributions/weibull_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
367
13,151
pyfilesystem2
tests/test_copy.py
.py
from __future__ import unicode_literals import calendar import datetime import errno import os import shutil import tempfile import unittest from parameterized import parameterized import fs.copy from fs import open_fs def _create_sandbox_dir(prefix="pyfilesystem2_sandbox_", home=None): if home is None: ...
1,050
34,200
onnx
onnx/backend/test/case/node/stringnormalizer.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 StringNormalizer(Base): @staticmethod def export_nostopwords_n...
149
4,428
python-prompt-toolkit
examples/prompts/no-wrapping.py
.py
#!/usr/bin/env python from prompt_toolkit import prompt if __name__ == "__main__": answer = prompt("Give me some input: ", wrap_lines=False, multiline=True) print(f"You said: {answer}")
7
195
kombu
t/unit/utils/test_amq_manager.py
.py
from __future__ import annotations from unittest.mock import patch import pytest from kombu import Connection class test_get_manager: @pytest.mark.masked_modules('pyrabbit') def test_without_pyrabbit(self, mask_modules): with pytest.raises(ImportError): Connection('amqp://').get_manage...
39
1,281
python-prompt-toolkit
src/prompt_toolkit/key_binding/bindings/auto_suggest.py
.py
""" Key bindings for auto suggestion (for fish-style auto suggestion). """ from __future__ import annotations import re from prompt_toolkit.application.current import get_app from prompt_toolkit.filters import Condition, emacs_mode from prompt_toolkit.key_binding.key_bindings import KeyBindings from prompt_toolkit.k...
67
1,855
metrics
tests/unittests/image/test_uqi.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...
207
7,835
saleor
saleor/core/tests/test_hashers.py
.py
from ..hashers import SHA512Base64PBKDF2PasswordHasher def test_encode_and_verify_sha512_base64_pbkdf2(): generated_token = SHA512Base64PBKDF2PasswordHasher().encode( "Saleor123!", salt=SHA512Base64PBKDF2PasswordHasher().salt() ) assert 90 == len(generated_token) assert SHA512Base64PBKDF2Passw...
10
370
mlflow
dev/ruff.py
.py
import os import re import subprocess import sys RUFF = [sys.executable, "-m", "ruff", "check", "--output-format=concise"] MESSAGE_REGEX = re.compile(r"^.+:\d+:\d+: ([A-Z0-9]+) (\[\*\] )?.+$") def transform(stdout: str, is_maintainer: bool) -> str: transformed = [] for line in stdout.splitlines(): if...
57
1,691
pynacl
src/nacl/hash.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # 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...
181
6,390
readthedocs.org
readthedocs/storage/mixins.py
.py
"""Django storage mixin classes for different storage backends (Azure, S3).""" from functools import cached_property from pathlib import Path from typing import Iterator from urllib.parse import urlsplit from urllib.parse import urlunsplit import structlog from django.conf import settings from django.core.exceptions ...
124
4,029
cvxpy
cvxpy/tests/test_dpp.py
.py
import warnings import numpy as np import pytest import cvxpy as cp import cvxpy.error as error from cvxpy.tests.base_test import BaseTest SOLVER = cp.CLARABEL class TestDcp(BaseTest): def test_multiply_scalar_params_not_dpp(self) -> None: x = cp.Parameter() product = x * x self.assertF...
957
36,828
pyomo
examples/pyomobook/overview-ch/wl_scalar.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...
54
1,853
wandb
wandb/sdk/artifacts/storage_layout.py
.py
"""Storage layout.""" from __future__ import annotations from enum import Enum class StorageLayout(str, Enum): V1 = "V1" V2 = "V2" @classmethod def from_env(cls) -> StorageLayout: from wandb.env import get_use_v1_artifacts return cls.V1 if get_use_v1_artifacts() else cls.V2
17
313
saleor
saleor/csv/tasks.py
.py
from celery.utils.log import get_task_logger from django.conf import settings from django.core.files.storage import default_storage from django.db.models import Q from django.db.models.expressions import Exists, OuterRef from django.utils import timezone from ..celeryconf import app from ..core import JobStatus from ....
135
4,369
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_cropping_2d.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasCropping2D(CommonTF2LayerTest): def create_keras_cropping_2d_net(self, cropping, input_names, input_shapes, input_type...
41
1,786
wandb
wandb/sdk/artifacts/storage_handlers/tracking_handler.py
.py
"""Tracking storage handler.""" from __future__ import annotations from typing import TYPE_CHECKING from urllib.parse import urlparse from wandb.errors.term import termwarn from wandb.sdk.artifacts.artifact_manifest_entry import ArtifactManifestEntry from wandb.sdk.artifacts.storage_handler import StorageHandler fro...
71
2,476
metrics
src/torchmetrics/clustering/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...
126
4,886
readthedocs.org
readthedocs/doc_builder/backends/mkdocs.py
.py
""" MkDocs_ backend for building docs. .. _MkDocs: http://www.mkdocs.org/ """ import os import structlog import yaml from django.conf import settings from readthedocs.doc_builder.base import BaseBuilder from readthedocs.doc_builder.python_environments import UvEnv from readthedocs.projects.exceptions import UserFil...
163
4,493
saleor
saleor/product/tests/test_translation.py
.py
import pytest from ...attribute.models import AttributeValueTranslation from ...core.utils.translations import get_translation from ...tests.utils import dummy_editorjs from ..models import ProductTranslation, ProductVariantTranslation @pytest.fixture def product_translation_pl(product): return ProductTranslatio...
88
3,083
wagtail
wagtail/admin/views/generic/preview.py
.py
from django.contrib.admin.utils import unquote from django.core.exceptions import PermissionDenied from django.http import Http404, JsonResponse from django.http.request import QueryDict from django.shortcuts import get_object_or_404 from django.template.response import TemplateResponse from django.utils.decorators imp...
230
8,062
probability
tensorflow_probability/python/math/ode/runge_kutta_util_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...
154
6,458
pyomo
pyomo/gdp/basic_step.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...
176
6,125
probability
tensorflow_probability/python/distributions/bernoulli_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...
610
24,776
wandb
tests/system_tests/test_functional/metaflow/test_metaflow.py
.py
import pathlib import subprocess def test_flow_decoboth(wandb_backend_spy): """Test that the flow_decoboth.py script runs correctly.""" script_path = pathlib.Path(__file__).parent / "flow_decoboth.py" subprocess.check_call(["python", str(script_path), "--no-pylint", "run"]) with wandb_backend_spy.fre...
127
5,095
saleor
saleor/site/apps.py
.py
from collections.abc import Callable from typing import TYPE_CHECKING from django.apps import AppConfig from django.conf import settings from django.utils.module_loading import import_string if TYPE_CHECKING is True: from ..graphql.shop.types import Announcement class SiteAppConfig(AppConfig): name = "saleo...
26
711
mlflow
tests/assistant/test_custom_view.py
.py
import json from unittest.mock import patch import pytest from pydantic import ValidationError from mlflow.assistant.custom_view import ( CUSTOM_VIEW_RESPONSE_SCHEMA, STRINGIFIED_CUSTOM_VIEW_RESPONSE_SCHEMA, custom_view_response_events, parse_custom_view_response, ) from mlflow.assistant.types import ...
130
4,117
pyomo
examples/pyomo/amplbook2/steel.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...
58
1,447
openvino
src/bindings/python/tests/test_utils/test_data_dispatch.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import pytest from copy import deepcopy import numpy as np from tests.utils.helpers import generate_add_compiled_model, generate_relu_compiled_model from openvino import Core, Model, Type, Shape, Tenso...
438
17,046
pyomo
pyomo/contrib/pynumero/algorithms/solvers/scipy_solvers.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...
502
17,044
onnx
onnx/backend/test/case/node/_image_decoder_data.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 # This file contains freeze NumPy array for ImageDecoder backend test's input/output # They were generated by image_decoder.py's generate_test_data with pillow # To make ONNX backend test generation simple, use freeze NumPy array directl...
6,354
210,448
beam
sdks/python/apache_beam/examples/dataframe/wordcount.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
2,925
beam
sdks/python/apache_beam/testing/benchmarks/cloudml/criteo_tft/criteo.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...
163
5,042
openvino
tests/layer_tests/ovc_python_api_tests/test_onnx.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import io import tempfile import unittest import numpy as np import openvino as ov import pytest from openvino import Model from openvino.test_utils import compare_functions from common.mo_convert_test_class import CommonMOConvertTest ...
135
4,245
cvxpy
cvxpy/tests/test_copy.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 ...
123
2,983
mlflow
dev/clint/tests/rules/test_isinstance_union_syntax.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules import IsinstanceUnionSyntax def test_isinstance_union_syntax(index: SymbolIndex) -> None: code = """ # Bad - basic union syntax isinstance(obj, str | ...
45
1,189
mlflow
examples/hyperparam/train.py
.py
""" Train a simple Keras DL model on the dataset used in MLflow tutorial (wine-quality.csv). Dataset is split into train (~ 0.56), validation(~ 0.19) and test (0.25). Validation data is used to select the best hyperparameters, test set performance is evaluated only at epochs which improved performance on the validatio...
170
6,808
pyro
pyro/distributions/polya_gamma.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import math import torch from torch.distributions import constraints from pyro.distributions.torch import Exponential from pyro.distributions.torch_distribution import TorchDistribution class TruncatedPolyaGamma(TorchDistribution):...
81
3,090
readthedocs.org
readthedocs/api/v3/tests/test_filters.py
.py
""" Tests for API v3 filters. These tests verify that the django-filters on our API endpoints correctly filter querysets. See https://github.com/readthedocs/readthedocs.org/issues/8238 """ from unittest import mock from django.test import override_settings from django.urls import reverse from django_dynamic_fixture ...
171
5,849
coremltools
deps/pybind11/tests/test_virtual_functions.py
.py
from __future__ import annotations import pytest import env # noqa: F401 m = pytest.importorskip("pybind11_tests.virtual_functions") from pybind11_tests import ConstructorStats # noqa: E402 def test_override(capture, msg): class ExtendedExampleVirt(m.ExampleVirt): def __init__(self, state): ...
461
12,949
pyomo
pyomo/core/tests/unit/test_relational_expr.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...
594
19,383
onnxruntime
onnxruntime/test/python/transformers/test_conformer.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import ...
156
7,022
openvino
src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/export_decompositions.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Decomposition lists for the ``torch.export`` path. Unlike ``decompositions.py``, this module does **not** register any global decompositions (via ``@register_decomposition``). It is safe to import from code p...
273
10,015
wandb
wandb/automations/integrations.py
.py
from __future__ import annotations from typing import Annotated from pydantic import Field, TypeAdapter from ._generated import SlackIntegrationFields, WebhookIntegrationFields class SlackIntegration(SlackIntegrationFields): team_name: str """Slack workspace (not W&B team) where this integration will post ...
40
959
mlflow
mlflow/utils/lazy_load.py
.py
"""Utility to lazy load modules.""" import importlib import sys import types class LazyLoader(types.ModuleType): """Class for module lazy loading. This class helps lazily load modules at package level, which avoids pulling in large dependencies like `tensorflow` or `torch`. This class is mirrored from w...
52
1,726
wandb
wandb/integration/lightning/fabric/logger.py
.py
from __future__ import annotations import os from argparse import Namespace from collections.abc import Mapping from pathlib import Path from typing import TYPE_CHECKING, Any, Literal from packaging import version from typing_extensions import override import wandb from wandb import Artifact from wandb.sdk.lib impor...
773
27,329
wandb
wandb/integration/gym/__init__.py
.py
from __future__ import annotations import re from typing import Literal import wandb import wandb.util _gym_version_lt_0_26: bool | None = None _gymnasium_version_lt_1_0_0: bool | None = None _required_error_msg = ( "Couldn't import the gymnasium python package, install with `pip install gymnasium`" ) GymLib = ...
100
3,000
saleor
saleor/payment/gateways/stripe/tests/conftest.py
.py
import pytest from stripe.stripe_object import StripeObject from .....checkout import calculations from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from .....plugins.manager import get_plugins_manager from .....plugins.models import PluginConfiguration from .... import TransactionKind from ......
167
5,846
mlflow
mlflow/genai/scorers/__init__.py
.py
from typing import TYPE_CHECKING from mlflow.genai.scorers.base import Scorer, ScorerSamplingConfig, make_scorer_ensemble, scorer from mlflow.genai.scorers.ensemble import agg_all, agg_any, majority_vote, maximum, mean, minimum from mlflow.genai.scorers.registry import delete_scorer, get_scorer, list_scorers # Metada...
154
4,717
beam
sdks/python/apache_beam/typehints/native_type_compatibility.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
651
22,312
wandb
wandb/sdk/lib/module.py
.py
# import wandb from . import preinit def set_global( run=None, config=None, log=None, summary=None, save=None, use_artifact=None, log_artifact=None, define_metric=None, alert=None, mark_preempting=None, log_model=None, use_model=None, link_model=None, watch=Non...
73
1,916
lemur
lemur/plugins/lemur_google_ca/tests/test_google_ca.py
.py
import json import pytest import unittest from unittest.mock import MagicMock from unittest.mock import patch import arrow from flask import Flask import google.cloud.security.privateca_v1 as privateca from google.protobuf import duration_pb2 from lemur.constants import CRLReason from lemur.plugins.lemur_google_ca im...
172
7,172
metrics
src/torchmetrics/functional/segmentation/utils.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...
901
50,136
saleor
saleor/tests/e2e/channel/utils/channel_update.py
.py
from ...utils import get_graphql_content CHANNEL_UPDATE_MUTATION = """ mutation ChannelUpdate($id: ID!, $input: ChannelUpdateInput!) { channelUpdate(id: $id, input: $input) { channel { id orderSettings { deleteExpiredOrdersAfter allowUnpaidOrders automaticallyFulfillNonShippab...
42
912
textual
docs/examples/widgets/select_widget.py
.py
from textual import on from textual.app import App, ComposeResult from textual.widgets import Header, Select LINES = """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.""".splitlines() class Select...
27
665