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
wagtail
wagtail/documents/tests/test_document_field.py
.py
from django.core.exceptions import ValidationError from django.core.files.uploadedfile import SimpleUploadedFile from django.template.defaultfilters import filesizeformat from django.test import TestCase, override_settings from wagtail.documents.fields import WagtailDocumentField class TestWagtailDocumentField(TestC...
84
3,631
saleor
saleor/graphql/attribute/mutations/attribute_value_create.py
.py
import graphene from django.core.exceptions import ValidationError from ....attribute import AttributeInputType from ....attribute import models as models from ....attribute.error_codes import AttributeErrorCode from ....core.utils import generate_unique_slug from ....webhook.event_types import WebhookEventAsyncType f...
128
5,252
qutip
qutip/tests/test_distributions.py
.py
import numpy as np from qutip import basis, tensor import pytest from qutip.distributions import ( TwoModeQuadratureCorrelation, HarmonicOscillatorWaveFunction, HarmonicOscillatorProbabilityFunction ) # Fixtures provide reusable test data for the test functions below. @pytest.fixture def harmonic_oscillator_g...
212
6,849
saleor
saleor/graphql/menu/tests/mutations/test_menu_item_delete.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import WebhookEventAsyncType from .....webhook.payloads import generate...
90
2,783
cvxpy
cvxpy/atoms/lambda_sum_smallest.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...
26
840
mlflow
mlflow/store/db_migrations/versions/ae8bbe7743c9_add_guardrails_tables.py
.py
"""add guardrails and guardrail_configs tables Create Date: 2026-03-24 00:00:00.000000 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "ae8bbe7743c9" down_revision = "a5b4c3d2e1f0" branch_labels = None depends_on = None def upgrade(): op.create_table( ...
91
3,601
conda
tests/env/specs/test_yaml_file.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from unittest import mock import pytest from conda.env import env from conda.env.specs.cep_24 import Cep24YamlFileSpec from conda.env.specs.yaml_file import YamlFileSpec from conda.exceptions import EnvironmentFileNotFound, PluginError from ....
59
1,534
mlflow
examples/sklearn_autolog/linear_regression.py
.py
from pprint import pprint import numpy as np from sklearn.linear_model import LinearRegression from utils import fetch_logged_data import mlflow def main(): # enable autologging mlflow.sklearn.autolog() # prepare training data X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]]) y = np.dot(X, np.arra...
32
705
saleor
saleor/plugins/admin_email/constants.py
.py
import os from django.conf import settings DEFAULT_EMAIL_TEMPLATES_PATH = os.path.join( settings.PROJECT_ROOT, "saleor/plugins/admin_email/default_email_templates" ) STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD = "staff_order_confirmation_template" SET_STAFF_PASSWORD_TEMPLATE_FIELD = "set_staff_password_template" CSV...
45
1,825
returns
returns/curry.py
.py
from collections.abc import Callable from functools import partial as _partial from functools import wraps from inspect import BoundArguments, Signature from typing import Any, TypeAlias, TypeVar _ReturnType = TypeVar('_ReturnType') def partial( func: Callable[..., _ReturnType], *args: Any, **kwargs: Any...
191
6,466
coremltools
coremltools/converters/mil/backend/backend_helper.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 from coremltools import proto from coremltools.converters.mil import input_types from coremltools.con...
81
4,045
astropy
astropy/time/tests/test_basic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import datetime import functools import gc import os import warnings from copy import deepcopy from decimal import Decimal, localcontext from io import StringIO import erfa import numpy as np import pytest from erfa import ErfaWarning from nu...
3,046
110,299
mlflow
mlflow/genai/scorers/ragas/models.py
.py
from __future__ import annotations import json import typing as t from openai import AsyncOpenAI from pydantic import BaseModel from ragas.embeddings import OpenAIEmbeddings from ragas.llms import InstructorBaseRagasLLM from mlflow.genai.judges.utils.parsing_utils import _strip_markdown_code_blocks from mlflow.genai...
82
2,594
textual
src/textual/constants.py
.py
""" This module contains constants, which may be set in environment variables. """ from __future__ import annotations import os from typing import get_args from typing_extensions import Final, TypeGuard from textual._types import AnimationLevel get_environ = os.environ.get def _get_environ_bool(name: str) -> boo...
176
5,666
sqlmap
tamper/unionvaluesrow.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os import re from lib.core.common import singleTimeWarnMessage from lib.core.enums import DBMS from lib.core.enums import PRIORITY __priority__ = PRIORITY.HIGHEST def de...
55
1,984
textual
tests/snapshot_tests/snapshot_apps/modal_screen_bindings.py
.py
from textual.app import App, ComposeResult from textual.screen import ModalScreen from textual.widgets import Button, Footer, Header, Label, Input class Dialog(ModalScreen): def compose(self) -> ComposeResult: yield Label("Dialog") yield Input() yield Button("OK", id="ok") def on_butt...
35
893
mlflow
mlflow/store/artifact/presigned_url_artifact_repo.py
.py
import json import os import posixpath from mlflow.entities import FileInfo from mlflow.environment_variables import MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE from mlflow.exceptions import RestException from mlflow.protos.databricks_artifacts_pb2 import ArtifactCredentialInfo from mlflow.protos.databricks_filesystem_servic...
181
7,527
conda
conda/gateways/connection/adapters/http.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2008-2023 The pip developers # SPDX-License-Identifier: MIT # """Defines HTTP transport adapter for CondaSession (requests.Session). Closely derived from pip: https://github.com/pypa/pip/blob/8c24fd2a80bad21aa29aec02fb48bd89a1e...
92
3,245
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_method_channel_listing_update.py
.py
import json from unittest.mock import patch import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....shipping.error_codes import ShippingErrorCode from .....shipping.models import Shippi...
796
23,589
saleor
saleor/tests/e2e/product/test_create_product_with_all_attributes_types.py
.py
import datetime import json import pytest from django.conf import settings from ....tests.utils import dummy_editorjs from ..attributes.utils import prepare_all_attributes_in_bulk from ..pages.utils import create_page, create_page_type from ..utils import assign_permissions from .utils import ( create_category, ...
114
3,772
openvino
src/bindings/python/src/openvino/torch/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.frontend.pytorch.torchdynamo import backend
6
165
luigi
luigi/configuration/base_parser.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...
42
1,305
pdm
tests/models/test_marker.py
.py
import pytest from pdm.models.markers import EnvSpec, get_marker from pdm.models.specifiers import PySpecSet @pytest.mark.parametrize( "original,marker,py_spec", [ ("python_version > '3'", "", ">=3.1"), ("python_version > '3.8'", "", ">=3.9"), ("python_version != '3.8'", "", "!=3.8.*"...
55
2,190
onnxruntime
onnxruntime/test/python/quantization/test_op_concat.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 un...
186
6,818
onnxruntime
orttraining/orttraining/python/training/ort_triton/_decompose.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ Decompose a complicated op into a series of simple ops. "simple ops"...
376
18,633
loguru
tests/test_template_strings.py
.py
import sys from unittest.mock import MagicMock import pytest from loguru import logger from .conftest import parse if sys.version_info >= (3, 14): from string.templatelib import Interpolation, Template @pytest.mark.skipif(sys.version_info < (3, 14), reason="Template Strings not supported") def test_template_s...
208
6,849
pyomo
pyomo/contrib/mpc/data/tests/test_scalar_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...
118
4,450
metrics
tests/unittests/audio/test_nisqa.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...
203
8,629
saleor
saleor/graphql/discount/tests/benchmark/test_voucher_code_bulk_delete.py
.py
import graphene import pytest from ....tests.utils import get_graphql_content VOUCHER_CODE_BULK_DELETE_MUTATION = """ mutation voucherCodeBulkDelete($ids: [ID!]!) { voucherCodeBulkDelete(ids: $ids) { count } } """ @pytest.mark.django_db @pytest.mark.count_queries(autouse=False) d...
48
1,390
returns
tests/test_io/test_io_container/test_io.py
.py
import pytest from returns.io import IO, IOFailure, IOResult, IOSuccess def test_io_map(): """Ensures that IO container supports ``.map()`` method.""" io: IO[float] = IO(1).map( lambda number: number / 2, ) assert io == IO(0.5) def test_io_bind(): """Ensures that IO container supports ...
41
892
biopython
Bio/Sequencing/__init__.py
.py
# Copyright 2004 Frank Kauff. 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. """Code to deal with various pr...
13
530
saleor
saleor/app/tests/test_installation_utils.py
.py
import json from unittest.mock import ANY, Mock, patch import graphene import pytest import requests from celery.exceptions import Retry from django.core.exceptions import ValidationError from django.core.files import File from django.core.files.base import ContentFile from django.db import DatabaseError from freezegu...
1,060
35,151
textual
docs/examples/guide/content/playground.py
.py
from textual._markup_playground import MarkupPlayground if __name__ == "__main__": app = MarkupPlayground() app.run()
6
127
readthedocs.org
readthedocs/core/adapters.py
.py
"""Allauth overrides.""" import structlog from allauth.account.adapter import DefaultAccountAdapter from allauth.account.adapter import get_adapter as get_account_adapter from allauth.core.exceptions import ImmediateHttpResponse from allauth.socialaccount.adapter import DefaultSocialAccountAdapter from allauth.sociala...
163
6,607
pyfilesystem2
fs/opener/memoryfs.py
.py
# coding: utf-8 """`MemoryFS` opener definition. """ from __future__ import absolute_import, print_function, unicode_literals import typing from .base import Opener from .registry import registry if typing.TYPE_CHECKING: from typing import Text from ..memoryfs import MemoryFS # noqa: F401 from .parse ...
38
765
saleor
saleor/menu/tests/fixtures/__init__.py
.py
from .menu import * # noqa: F403 from .menu_item import * # noqa: F403 from .menu_item_translation import * # noqa: F403
4
124
mlflow
tests/lightgbm/test_lightgbm_autolog.py
.py
import functools import json import os import pickle from unittest import mock from unittest.mock import patch import lightgbm as lgb import matplotlib as mpl import numpy as np import pandas as pd import polars as pl import pytest from packaging.version import Version from sklearn import datasets import mlflow impor...
830
29,671
pyomo
pyomo/contrib/appsi/plugins.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...
34
1,447
hatch
src/hatch/cli/version/__init__.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import click if TYPE_CHECKING: from hatch.cli.application import Application @click.command(short_help="View or set a project's version") @click.argument("desired_version", required=False) @click.option( "--force", "-f", is_flag=Tr...
82
2,920
beam
learning/katas/python/Common Transforms/Aggregation/Largest/tests/test_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"); you may not...
35
1,195
onnx
onnx/backend/sample/ops/abs.py
.py
# SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np def abs(input: np.ndarray) -> np.ndarray: # noqa: A001 return np.abs(input) # type: ignore[no-any-return]
9
207
astropy
astropy/timeseries/periodograms/lombscargle/tests/test_lombscargle.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose from astropy import units as u from astropy.tests.helper import assert_quantity_allclose from astropy.time import Time, TimeDelta from astropy.timeseries.periodograms.lombscargle import LombScargle from astropy.timeseries.periodograms.lombscarg...
562
17,895
textual
src/textual/events.py
.py
""" Builtin events sent by Textual. Events may be marked as "Bubbles" and "Verbose". See the [events guide](/guide/events/#bubbling) for an explanation of bubbling. Verbose events are excluded from the textual console, unless you explicitly request them with the `-v` switch as follows: ``` textual console -v ``` """...
997
26,355
biopython
Tests/test_SearchIO_exonerate_vulgar_index.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 exonerate-vulgar indexing.""" import os import unittest from searc...
31
968
django-cms
cms/utils/check.py
.py
import inspect from contextlib import contextmanager from itertools import chain from django.conf import settings from django.utils.decorators import method_decorator from django.utils.termcolors import colorize from sekizai.helpers import validate_template from cms import constants from cms.models import AliasPlugin...
497
20,925
saleor
saleor/product/utils/costs.py
.py
from collections.abc import Iterable from dataclasses import dataclass from typing import TYPE_CHECKING from prices import MoneyRange from ...core.taxes import zero_money from ..models import ProductVariantChannelListing if TYPE_CHECKING: from prices import Money @dataclass class CostsData: costs: list["Mo...
82
2,550
saleor
saleor/graphql/product/mutations/category/__init__.py
.py
from .category_create import CategoryCreate from .category_delete import CategoryDelete from .category_update import CategoryUpdate __all__ = ["CategoryCreate", "CategoryDelete", "CategoryUpdate"]
6
198
qutip
doc/guide/scripts/floquet_ex1.py
.py
import numpy as np from matplotlib import pyplot import qutip delta = 0.2 * 2*np.pi eps0 = 1.0 * 2*np.pi A = 0.5 * 2*np.pi omega = 1.0 * 2*np.pi T = (2*np.pi)/omega tlist = np.linspace(0.0, 10 * T, 101) psi0 = qutip.basis(2, 0) H0 = - delta/2.0 * qutip.sigmax() - eps0/2.0 * qutip.sigmaz() H1 = A/2.0 * q...
41
1,320
scikit-optimize
skopt/tests/test_acquisition.py
.py
import numpy as np import pytest from scipy import optimize from sklearn.multioutput import MultiOutputRegressor from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from numpy.testing import assert_raises from skopt.acquisition import _gaussian_acquisition from skopt.acqu...
177
5,891
hydra
examples/advanced/package_overrides/two_packages.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig, OmegaConf import hydra @hydra.main(config_path="conf", config_name="two_packages") def my_app(cfg: DictConfig) -> None: print(OmegaConf.to_yaml(cfg)) if __name__ == "__main__": my_app()
14
304
beam
sdks/python/apache_beam/transforms/dataflow_distribution_counter_test.py
.py
# 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 # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied....
84
2,898
saleor
saleor/graphql/account/mutations/customer_type/customer_type_create.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from .....account import models from .....account.lock_objects import customer_type_qs_select_for_update from .....core.tracing import traced_atomic_transaction from .....permission.enums import CustomerTypePermissi...
114
4,517
mlflow
tests/spark/autologging/ml/test_pyspark_ml_autologging_custom_allowlist.py
.py
import os from pyspark.sql import SparkSession import mlflow # Put this test in separate module because it require a spark context # with a special conf and the conf is immutable in runtime. def test_custom_log_model_allowlist(tmp_path): allowlist_file_path = os.path.join(tmp_path, "allowlist") with open(al...
88
3,808
astropy
astropy/io/ascii/tests/test_fixedwidth.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from io import StringIO import numpy as np import pytest from numpy.testing import assert_allclose from astropy.io import ascii from astropy.io.ascii.core import InconsistentTableError from .common import assert_equal_splitlines def test_read_normal...
629
17,702
textual
src/textual/widgets/_log.py
.py
from __future__ import annotations import re from typing import TYPE_CHECKING, Iterable, Optional, Sequence from rich.cells import cell_len from rich.highlighter import Highlighter, ReprHighlighter from rich.style import Style from rich.text import Text from textual import work from textual._line_split import line_s...
363
11,504
python-prompt-toolkit
examples/full-screen/simple-demos/floats.py
.py
#!/usr/bin/env python """ Floats example. """ from prompt_toolkit.application import Application from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout.containers import Float, FloatContainer, Window from prompt_toolkit.layout.controls import FormattedTextControl from prompt_toolkit.layout.layou...
118
3,418
wagtail
wagtail/models/view_restrictions.py
.py
""" Base model definitions for validating front-end user access to resources such as pages and documents. These may be subclassed to accommodate specific models such as Page or Collection, but the definitions here should remain generic and not depend on the base wagtail.models module or specific models defined there. "...
82
3,101
sqlmap
extra/kerberos/__init__.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """
7
140
openvino
tests/layer_tests/pytorch_tests/test_sub.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestSub(PytorchLayerTest): def _prepare_input(self): return self.input_data def create_model(self, inplace): class aten_s...
254
10,133
pyro
pyro/ops/special.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import functools import math import operator import weakref from typing import Dict import numpy as np import torch from numpy.polynomial.hermite import hermgauss class _SafeLog(torch.autograd.Function): @staticmethod def fo...
219
7,034
gunicorn
tests/ctl/test_handlers.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for control socket command handlers.""" import signal import time from unittest.mock import MagicMock, patch from gunicorn.ctl.handlers import CommandHandlers class MockWorker: """Mock worker for t...
469
13,207
coveragepy
setup.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """Code coverage measurement for Python""" # Setuptools setup for coverage.py # This file is used unchanged under all versions of Python. import re import os im...
274
9,407
mlflow
mlflow/models/evaluation/base.py
.py
import inspect import json import keyword import logging import os import pathlib import signal import urllib.parse from abc import ABCMeta, abstractmethod from contextlib import contextmanager, nullcontext from dataclasses import dataclass from inspect import Parameter, Signature from types import FunctionType from ty...
1,812
81,237
sqlmap
plugins/dbms/cache/enumeration.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.data import logger from lib.core.settings import CACHE_DEFAULT_SCHEMA from plugins.generic.enumeration import Enumeration as GenericEnumeration class Enumeration(Ge...
49
1,355
rich-cli
src/rich_cli/pager.py
.py
from enum import auto from typing import Iterable, List from rich.console import Console, ConsoleOptions, RenderResult from rich.measure import Measurement from rich.segment import Segment from textual import events from textual.app import App from textual.widgets import ScrollView class PagerRenderable: def __...
81
2,525
textual
tests/test_issue_4248.py
.py
"""Test https://github.com/Textualize/textual/issues/4248""" from textual.app import App, ComposeResult from textual.widgets import Label async def test_issue_4248() -> None: """Various forms of click parameters should be fine.""" bumps = 0 class ActionApp(App[None]): def compose(self) -> Compo...
43
1,608
django-cms
cms/management/commands/subcommands/check.py
.py
from django.core.management.base import CommandError from cms.utils.check import FileOutputWrapper, check from .base import SubcommandsCommand class CheckInstallation(SubcommandsCommand): help_string = 'Checks your settings and environment' command_name = 'check' def handle(self, *args, **options): ...
15
417
more-itertools
tests/test_more.py
.py
from __future__ import annotations import cmath import gc import platform import types import weakref from collections import Counter, deque from collections.abc import Set, Sequence, Iterable, Iterator, Hashable from datetime import datetime, timedelta from decimal import Decimal from doctest import DocTestSuite fro...
7,079
242,480
openvino
tests/layer_tests/tensorflow_tests/test_tf_MatMul.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.tf_layer_test_class import CommonTFLayerTest class TestMatMul(CommonTFLayerTest): def create_net_with_matmul_op(self, x_shape, y_shape, x_bool, y_bool, op_type, ir_version): imp...
90
3,880
saleor
saleor/plugins/webhook/tests/subscription_webhooks/filterable_webhooks/test_order_fully_paid.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...
231
7,019
onnxruntime
orttraining/orttraining/python/training/ortmodule/experimental/json_config/_load_config_from_json.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # _load_config_from_json.py import json import logging import os from functools import reduce from types import SimpleNamespace from onnxruntime.capi import _pybind_state as C from onnxruntime.training.ortmodule._fallback im...
306
12,996
hatch
src/hatch/dep/core.py
.py
from __future__ import annotations from functools import cached_property from packaging.requirements import InvalidRequirement, Requirement from hatch.utils.fs import Path InvalidDependencyError = InvalidRequirement class Dependency(Requirement): def __init__(self, s: str, *, editable: bool = False) -> None: ...
58
1,575
cvxpy
cvxpy/lin_ops/backends/rust_backend.py
.py
""" Copyright 2025, the CVXPY authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
49
1,884
wandb
wandb/sdk/artifacts/artifact_manifest_entry.py
.py
"""Artifact manifest entry.""" # Keep older-style type annotations in this legacy model. # ruff: noqa: UP006, UP007, UP035, UP045 from __future__ import annotations import concurrent.futures import hashlib import logging import os from contextlib import suppress from os.path import getsize from typing import TYPE_CH...
265
9,613
sphinx
sphinx/ext/imgmath.py
.py
"""Render math in HTML via dvipng or dvisvgm.""" from __future__ import annotations __all__ = () import base64 import contextlib import os import os.path import re import shutil import subprocess import tempfile from hashlib import sha1 from pathlib import Path from subprocess import CalledProcessError from typing i...
423
15,226
saleor
saleor/checkout/tests/test_utils.py
.py
from decimal import Decimal import graphene import pytest from prices import Money, TaxedMoney from ...discount import DiscountType, DiscountValueType from ...tax.calculations import get_taxed_undiscounted_price from ..utils import checkout_info_for_logs BASE = Money("35.00", "USD") @pytest.mark.parametrize( (...
92
2,940
wandb
tests/unit_tests/test_automations/test_scopes.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from pydantic import BaseModel, ValidationError from pytest import mark, raises from wandb._strutils import nameof from wandb.automations import ( ArtifactCollectionScope, EntityScope, ProjectScope, RegistryScope, ScopeType, ) fro...
202
6,573
qutip
qutip/solver/integrator/qutip_integrator.py
.py
from ..integrator import IntegratorException, Integrator from ..solver_base import Solver from .explicit_rk import Explicit_RungeKutta import numpy as np from qutip import data as _data from .verner7efficient import vern7_coeff from .verner9efficient import vern9_coeff from .tsit5 import tsit5_coeff __all__ = [ 'I...
256
7,667
sphinx
sphinx/domains/_index.py
.py
"""Domain indices.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, NamedTuple from sphinx.errors import SphinxError if TYPE_CHECKING: from collections.abc import Iterable from typing import ClassVar from sphinx.domains import Domain class In...
109
3,259
wagtail
wagtail/rich_text/feature_registry.py
.py
from wagtail import hooks class FeatureRegistry: """ A central store of information about optional features that can be enabled in rich text editors by passing a ``features`` list to the RichTextField, such as how to whitelist / convert HTML tags, and how to enable the feature on various editors. ...
118
4,976
mlflow
mlflow/store/artifact/b2_artifact_repo.py
.py
from urllib.parse import urlparse from mlflow.store.artifact.optimized_s3_artifact_repo import OptimizedS3ArtifactRepository from mlflow.store.artifact.s3_artifact_repo import _get_s3_client _B2_USER_AGENT = "b2ai-mlflow" def _add_b2_user_agent(request, **kwargs): ua = request.headers.get("User-Agent", "") ...
91
3,224
mlflow
tests/keras/test_save.py
.py
import keras import numpy as np import pytest import mlflow from mlflow.keras.utils import get_model_signature from mlflow.models import ModelSignature from mlflow.types import Schema, TensorSpec def _get_keras_model(): return keras.Sequential([ keras.Input([28, 28, 3]), keras.layers.Flatten(), ...
116
3,986
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/PropertyBag.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 PropertyBag(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(flat...
153
4,947
astropy
astropy/io/fits/tests/test_structured.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import sys import numpy as np from astropy.io import fits from .conftest import FitsTestCase def compare_arrays(arr1in, arr2in, verbose=False): """ Compare the values field-by-field in two sets of numpy arrays or recarrays. """ ar...
104
3,116
pymc
tests/sampling/test_population.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...
91
3,417
beam
sdks/python/apache_beam/internal/cloudpickle/cloudpickle_fast.py
.py
"""Compatibility module. It can be necessary to load files generated by previous versions of cloudpickle that rely on symbols being defined under the `cloudpickle.cloudpickle_fast` namespace. See: tests/test_backward_compat.py """ from . import cloudpickle def __getattr__(name): return getattr(cloudpickle, name)...
15
321
openvino
src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_variables.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import tensorflow as tf # Create the graph and model class AddVariable(tf.Module): def __init__(self): super(AddVariable, self).__init__() self.var1 = tf.Variable(123.0) @tf.function(input_signature=[tf...
20
527
metrics
src/torchmetrics/classification/jaccard.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...
486
20,552
beam
sdks/python/apache_beam/examples/cookbook/custom_ptransform_it_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...
71
2,617
jupytext
tests/functional/others/test_save_multiple.py
.py
import os import pytest from jupyter_server.utils import ensure_async from nbformat.v4.nbbase import new_notebook from nbformat.validator import NotebookValidationError from tornado.web import HTTPError import jupytext from jupytext.compare import compare_notebooks, notebook_model pytestmark = pytest.mark.asyncio ...
122
3,310
pymc
pymc/sampling/population.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...
484
17,824
saleor
saleor/graphql/product/tests/queries/test_product_query.py
.py
import datetime import logging from unittest.mock import MagicMock import graphene import pytest from django.contrib.sites.models import Site from django.core.files import File from django.utils import timezone from measurement.measures import Weight from .....attribute.models import AttributeValue from .....attribut...
3,114
92,850
mlflow
mlflow/deployments/databricks/__init__.py
.py
import json import posixpath import warnings from typing import Any, Iterator from mlflow.deployments import BaseDeploymentClient from mlflow.deployments.constants import ( MLFLOW_DEPLOYMENT_CLIENT_REQUEST_RETRY_CODES, ) from mlflow.environment_variables import ( MLFLOW_DEPLOYMENT_PREDICT_TIMEOUT, MLFLOW_D...
850
30,292
mlflow
dev/clint/tests/rules/test_forbidden_top_level_import.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.forbidden_top_level_import import ForbiddenTopLevelImport def test_forbidden_top_level_import(index: SymbolIndex) -> None: code = """ # Bad import foo ...
46
1,352
saleor
saleor/product/utils/product.py
.py
from collections import defaultdict from django.conf import settings from django.db import transaction from django.db.models import Exists, OuterRef, QuerySet from ...discount.models import PromotionRule from ...product.models import ProductChannelListing from ..models import ProductVariant def get_channel_to_produ...
137
5,318
beam
sdks/python/apache_beam/utils/urns.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...
180
5,949
wandb
wandb/sdk/artifacts/_generated/update_team_registry_role.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from wandb._pydantic import GQLResult class UpdateTeamRegistryRole(GQLResult): result: UpdateTeamRegistryRoleResult | None class UpdateTeamRegistryRoleResult(GQLResult): success: bool UpdateTeamR...
18
348
sqlmap
plugins/dbms/mckoi/fingerprint.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 Format from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.e...
94
2,589
mlflow
bin/install.py
.py
""" Install binary tools for MLflow development. """ # ruff: noqa: T201 import argparse import gzip import hashlib import http.client import platform import re import shutil import subprocess import tarfile import tempfile import time import urllib.request from dataclasses import dataclass from pathlib import Path fro...
338
12,008
mlflow
examples/prophet/train.py
.py
import numpy as np import pandas as pd from prophet import Prophet, serialize from prophet.diagnostics import cross_validation, performance_metrics import mlflow SOURCE_DATA = ( "https://raw.githubusercontent.com/facebook/prophet/master/examples/example_retail_sales.csv" ) np.random.seed(12345) def extract_para...
55
1,483