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
saleor
saleor/checkout/tests/test_migrations_tasks.py
.py
from decimal import Decimal from unittest import mock from ..migrations.tasks.saleor3_21 import ( BILLING_FIELD, SHIPPING_FIELD, fix_shared_address_instances_task, ) from ..migrations.tasks.saleor3_23 import propagate_checkout_deliveries_task from ..models import Checkout, CheckoutDelivery def test_fix_s...
326
11,058
black
src/black/parsing.py
.py
""" Parse Python code and perform AST validation. """ import ast import sys import warnings from collections.abc import Collection, Iterator from black.mode import VERSION_TO_FEATURES, Feature, TargetVersion, supports_feature from black.nodes import syms from blib2to3 import pygram from blib2to3.pgen2 import driver f...
296
10,051
openvino
tests/layer_tests/onnx_tests/test_mean_variance_normalization.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model class TestMeanVarianceNormalization(OnnxRuntimeLayerTest): def _prepare_input(self, inputs_dict): for input in...
75
2,263
onnx
onnx/backend/test/case/node/image_decoder.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import io import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import _image_decoder_data, expect def generate_checkerboard(width: int, height...
250
7,381
probability
tensorflow_probability/python/math/scan_associative.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...
352
14,739
sqlmap
lib/utils/gui.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import io import os import subprocess import sys import tempfile import threading import time import webbrowser from lib.core.common import getSafeExString from lib.core.common i...
1,912
79,949
mlflow
mlflow/tracing/export/async_export_queue.py
.py
import atexit import logging import threading import time from concurrent.futures import FIRST_COMPLETED, ThreadPoolExecutor, wait from dataclasses import dataclass from queue import Empty, Queue from queue import Full as queue_Full from typing import Any, Callable, Sequence from mlflow.environment_variables import ( ...
188
6,851
beam
infra/iam/roles/generate_roles.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...
278
11,072
pyro
tests/infer/mcmc/test_adaptation.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pyro.infer.mcmc.adaptation import ( ArrowheadMassMatrix, BlockMassMatrix, WarmupAdapter, adapt_window, ) from tests.common import assert_close, assert_equal @pytest.mark.parametriz...
73
2,472
saleor
saleor/graphql/checkout/mutations/checkout_shipping_address_update.py
.py
from typing import TYPE_CHECKING import graphene from django.core.exceptions import ValidationError from ....checkout import AddressType, models from ....checkout.actions import call_checkout_info_event from ....checkout.error_codes import CheckoutErrorCode from ....checkout.fetch import ( CheckoutLineInfo, f...
221
7,720
beam
sdks/python/apache_beam/ml/rag/ingestion/jdbc_common.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...
77
2,895
gunicorn
tests/requests/valid/001.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "PUT", "uri": uri("/stuff/here?foo=bar"), "version": (1, 0), "headers": [ ("SERVER", "http://127.0.0.1:5984"), ("CONTENT-TYPE", "application/json"), ("C...
16
381
saleor
saleor/graphql/menu/tests/queries/test_menu.py
.py
import logging import graphene from .....menu.models import Menu from ....tests.utils import get_graphql_content, get_graphql_content_from_response QUERY_MENU = """ query ($id: ID, $name: String, $slug: String){ menu( id: $id, name: $name, slug: $slug ) { ...
223
5,814
biopython
Tests/test_PDB_ResidueDepth.py
.py
# Copyright 2018 by Francesco Gastaldello. All rights reserved. # # Converted by Francesco Gastaldello from an older unit test copyright 2002 # by Thomas Hamelryck. # # Merged related test files into one, by Joao Rodrigues (2020) # # This file is part of the Biopython distribution and governed by your # choice of the "...
121
4,504
hatch
tests/helpers/templates/wheel/standard_entry_points.py
.py
from hatch.template import File from hatch.utils.fs import Path from hatchling.__about__ import __version__ from hatchling.metadata.spec import DEFAULT_METADATA_VERSION from ..new.feature_no_src_layout import get_files as get_template_files from .utils import update_record_file_contents def get_files(**kwargs): ...
58
1,432
astropy
astropy/cosmology/_src/tests/traits/test_trait_neutrino.py
.py
import numpy as np import pytest import astropy.units as u from astropy.cosmology._src.traits.neutrino import NeutrinoComponent from astropy.tests.helper import assert_quantity_allclose class DummyNeutrino(NeutrinoComponent): Tcmb0 = 2.7255 * u.K Ogamma0 = 5e-5 @property def has_massive_nu(self): ...
40
919
pyomo
pyomo/core/base/PyomoModel.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...
947
34,887
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_softplus.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 TestKerasSoftplus(CommonTF2LayerTest): def create_keras_softplus_net(self, input_names, input_shapes, input_type, ir_version): ...
56
2,641
wagtail
wagtail/actions/delete.py
.py
from django.core.exceptions import PermissionDenied from django.db import transaction from wagtail.actions.base import BaseAction from wagtail.log_actions import log class DeletePermissionError(PermissionDenied): """ Raised when deleting an object is not permitted. """ pass class DeleteAction(Base...
49
1,490
pyro
pyro/poutine/reentrant_messenger.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import functools from types import TracebackType from typing import Callable, Optional, Type, TypeVar from typing_extensions import ParamSpec, Self from pyro.poutine.messenger import Messenger _P = ParamSpec("_P") _T = TypeVar("...
39
1,031
mlflow
tests/resources/mlflow-test-plugin/mlflow_test_plugin/dummy_backend.py
.py
from mlflow.entities import RunStatus from mlflow.projects.backend.abstract_backend import AbstractBackend from mlflow.projects.submitted_run import SubmittedRun from mlflow.projects.utils import fetch_and_validate_project, get_or_create_run class DummySubmittedRun(SubmittedRun): """ A run that just does noth...
45
1,109
jupytext
tests/functional/others/test_invalid_file.py
.py
"""Jupytext should refuse to open a file with invalid content""" from pathlib import Path import pytest from jupyter_server.utils import ensure_async from tornado.web import HTTPError from jupytext import read from jupytext.cli import jupytext as jupytext_cli @pytest.fixture def invalid_md_file(): return Path(...
36
1,004
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/approximatequantiles_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");...
46
1,516
textual
tests/snapshot_tests/snapshot_apps/richlog_scroll.py
.py
from textual.app import App, ComposeResult from textual.widgets import RichLog from textual.containers import Horizontal class RichLogScrollApp(App): CSS = """ RichLog{ width: 1fr; height: 10; } """ def compose(self) -> ComposeResult: with Horizontal(): # Don't...
36
1,036
astropy
astropy/wcs/tests/test_profiling.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import numpy as np import pytest from astropy import wcs from astropy.utils.data import get_pkg_data_contents, get_pkg_data_filenames from astropy.utils.misc import NumpyRNGContext from astropy.wcs.wcs import FITSFixedWarning # use the base n...
80
2,570
mkdocs
mkdocs/theme.py
.py
from __future__ import annotations import logging import os import warnings from typing import Any, Collection, MutableMapping import jinja2 import yaml try: from yaml import CSafeLoader as SafeLoader except ImportError: # pragma: no cover from yaml import SafeLoader # type: ignore from mkdocs import loca...
167
5,304
gunicorn
tests/requests/invalid/chunked_07.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.http.errors import InvalidHeaderName from gunicorn.config import Config cfg = Config() cfg.set("header_map", "refuse") request = InvalidHeaderName
12
269
saleor
saleor/graphql/account/tests/mutations/staff/test_customer_delete.py
.py
from functools import partial from unittest.mock import ANY, Mock, patch import graphene import pytest from django.core.exceptions import ValidationError from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from ......account.models import User from ......attribute.models import Assi...
360
12,898
confluent-kafka-python
src/confluent_kafka/admin/_metadata.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...
186
6,255
black
scripts/check_version_in_basics_example.py
.py
""" Check that the rev value in the example from ``the_basics.md`` matches the latest version of Black. This saves us from forgetting to update that during the release process. """ import os import sys import commonmark from bs4 import BeautifulSoup def main(changes: str, the_basics: str) -> None: changes_html ...
55
1,782
saleor
saleor/graphql/account/tests/mutations/staff/test_address_create.py
.py
from unittest.mock import patch import graphene import pytest from django.test import override_settings from freezegun import freeze_time from ......account.models import Address from ......webhook.event_types import WebhookEventAsyncType from .....tests.utils import get_graphql_content from ..utils import generate_a...
275
8,677
saleor
saleor/graphql/account/mixins.py
.py
from ...account import models from ...account.error_codes import AccountErrorCode from ...app.models import App from ...core.exceptions import PermissionDenied from ...core.utils import metadata_manager from ...permission.enums import AccountPermissions from ..core.utils import raise_validation_error from ..meta.inputs...
57
2,198
hatch
tests/cli/python/test_find.py
.py
def test_not_installed(hatch, helpers): name = "3.10" result = hatch("python", "find", name) assert result.exit_code == 1, result.output assert result.output == helpers.dedent( f""" Distribution not installed: {name} """ ) def test_binary(hatch, helpers, temp_dir_data, dis...
39
1,039
cvxpy
cvxpy/atoms/lambda_min.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
816
black
src/blib2to3/pgen2/__init__.py
.py
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """The pgen2 package."""
5
143
eve
examples/security/sha1-hmac.py
.py
# -*- coding: utf-8 -*- """ Auth-SHA1/HMAC ~~~~~~~~~~~~~~ Securing an Eve-powered API with Basic Authentication (RFC2617). This script assumes that user accounts are stored in a MongoDB collection ('accounts'), and that passwords are stored as SHA1/HMAC hashes. All API resources/methods will ...
42
1,378
luigi
luigi/contrib/pai.py
.py
# -*- coding: utf-8 -*- # # Copyright 2017 Open Targets # # 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...
304
10,923
wandb
wandb/sdk/interface/interface_queue.py
.py
from __future__ import annotations import logging from multiprocessing.process import BaseProcess from typing import TYPE_CHECKING from typing_extensions import override from .interface_shared import InterfaceShared if TYPE_CHECKING: from queue import Queue from wandb.proto import wandb_internal_pb2 as pb ...
60
1,736
probability
tensorflow_probability/python/distributions/mixture_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...
1,016
40,633
biopython
Bio/SwissProt/KeyWList.py
.py
# Copyright 1999 by Jeffrey Chang. 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 parse the keywli...
91
3,468
wagtail
wagtail/snippets/tests/test_api_v3/test_update.py
.py
import json from django.contrib.auth.models import Permission from django.test import TestCase from django.urls import reverse from wagtail.api.v3.tests.base import TestV3Base from wagtail.documents.models import Document from wagtail.images.models import Image from wagtail.images.tests.utils import get_test_image_fi...
638
25,089
omegaconf
tests/data/save.py
.py
import pickle from omegaconf import OmegaConf, __version__ cfg = OmegaConf.create({"a": [{"b": 10}]}) with open(f"{__version__}.pickle", mode="wb") as fp: pickle.dump(cfg, fp)
9
183
wagtail
wagtail/api/conf.py
.py
from django.core.exceptions import FieldDoesNotExist from django.db.models import Model class APIField: def __init__(self, name: str, serializer=None, writable=False): self.name = name self.serializer = serializer self.writable = writable def __hash__(self): return hash(self.n...
49
1,584
textual
src/textual/widgets/tabbed_content.py
.py
from textual.widgets._tabbed_content import ContentTab, ContentTabs __all__ = [ "ContentTab", "ContentTabs", ]
7
120
probability
tensorflow_probability/python/math/interpolation_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...
1,064
38,270
scikit-bio
skbio/util/tests/test_testing.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. # --------------------------------------------...
934
36,262
wandb
wandb/integration/sklearn/utils.py
.py
"""Shared utilities for the modules in wandb.sklearn.""" from collections.abc import Iterable, Sequence import numpy as np import pandas as pd import scipy import sklearn import wandb chart_limit = 1000 def check_against_limit(count, chart, limit=None): if limit is None: limit = chart_limit if cou...
183
5,794
probability
tensorflow_probability/python/sts/structural_time_series.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...
547
23,599
mlflow
tests/transformers/test_transformers_autolog.py
.py
import random import numpy as np import optuna import pytest import sklearn.cluster import sklearn.datasets import torch import transformers from datasets import load_dataset from packaging.version import Version from transformers import ( DistilBertForSequenceClassification, DistilBertTokenizerFast, Train...
578
18,175
saleor
saleor/webhook/transport/asynchronous/__init__.py
.py
from .transport import ( create_deliveries_for_subscriptions, send_webhook_request_async, trigger_webhooks_async, ) __all__ = [ "create_deliveries_for_subscriptions", "trigger_webhooks_async", "send_webhook_request_async", ]
12
250
metrics
src/torchmetrics/functional/segmentation/generalized_dice.py
.py
# Copyright The PyTorch 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 i...
153
6,838
kombu
kombu/asynchronous/aws/ext.py
.py
"""Amazon boto3 interface.""" from __future__ import annotations try: import boto3 from botocore import exceptions from botocore.awsrequest import AWSRequest from botocore.httpsession import get_cert_path from botocore.response import get_response except ImportError: boto3 = None class _v...
34
866
pyro
pyro/infer/tracegraph_elbo.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import weakref from collections import defaultdict from operator import itemgetter import torch import pyro import pyro.ops.jit from pyro.distributions.util import detach, is_identically_zero from pyro.infer import ELBO from pyro...
424
16,980
wandb
wandb/integration/lightning/fabric/__init__.py
.py
from wandb.integration.lightning.fabric.logger import WandbLogger __all__ = ("WandbLogger",)
4
94
textual
tests/test_auto_scroll.py
.py
import pytest from textual._auto_scroll import get_auto_scroll_regions from textual.geometry import Region @pytest.mark.parametrize( "region, lines, expected", [ # Simple case ( Region(0, 0, 100, 20), 1, (Region(0, 0, 100, 1), Region(0, 19, 100, 1)), ...
44
1,146
sphinx
tests/test_ext_napoleon/test_ext_napoleon.py
.py
"""Tests for :mod:`sphinx.ext.napoleon.__init__` module.""" from __future__ import annotations import functools from collections import namedtuple from unittest import mock import pytest from sphinx.application import Sphinx from sphinx.ext.napoleon import Config, _process_docstring, _skip_member, setup TYPE_CHECK...
299
8,251
wagtail
wagtail/snippets/tests/test_list_view.py
.py
from django.contrib.admin.utils import quote from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.test import TestCase, TransactionTestCase, tag from django.test.utils import override_settings from django....
746
29,460
beam
sdks/python/apache_beam/yaml/examples/testing/examples_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");...
1,362
49,837
probability
tensorflow_probability/python/internal/cache_util_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...
392
12,254
mlflow
dev/dev_stubs/__init__.py
.py
"""Credential-free dev/CI stubs for reviewing provider-gated MLflow UI. ``run_dev_server.py --stub-providers <names>`` installs these before launching the dev server so features gated on external providers/credentials render without real keys, cost, or nondeterminism. - ``claude`` -- a fake ``claude`` CLI on PATH, sa...
87
3,021
openvino
tests/layer_tests/pytorch_tests/test_quantized_add_relu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class quantized_add_relu(torch.nn.Module): def __init__(self, scale, zero_point, dtype) -> None: torch.nn...
53
1,884
scikit-bio
skbio/diversity/alpha/_gini.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. # --------------------------------------------...
124
3,614
readthedocs.org
readthedocs/audit/tests/test_tasks.py
.py
from unittest import mock from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.utils import timezone from django_dynamic_fixture import get from readthedocs.audit.models import AuditLog from readthedocs.audit.tasks import delete_old_personal_audit_logs from readt...
117
3,531
sqlmap
tests/test_heuristic_signatures.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Cross-engine invariants of the non-SQL heuristic signatures in lib/core/settings.py. heuristicCheckSqlInjection() tries every one of these regexes against the same response and print...
235
16,415
omegaconf
omegaconf/grammar_visitor.py
.py
import sys import warnings from itertools import zip_longest from typing import ( TYPE_CHECKING, Any, Callable, Dict, Generator, List, NoReturn, Optional, Set, Tuple, Union, cast, ) from .errors import InterpolationResolutionError from .vendor.antlr4 import TerminalNode ...
405
16,874
conda
conda/common/io.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Common I/O utilities.""" from __future__ import annotations import logging import os import signal import sys from collections import defaultdict from contextlib import contextmanager from enum import Enum from errno import EPIPE, ESHUTDOWN...
705
22,780
openvino
src/bindings/python/src/openvino/frontend/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Package: openvino Low level wrappers for the FrontEnd C++ API. """ # flake8: noqa from openvino._pyopenvino import get_version __version__ = get_version() # main classes from openvino.frontend.frontend import FrontEndManager from...
35
1,066
sphinx
tests/roots/test-directive-include/conf.py
.py
project = 'test-directive-include' exclude_patterns = ['_build']
3
65
onnxruntime
onnxruntime/python/tools/quantization/operators/where.py
.py
import onnx from ..quant_utils import TENSOR_NAME_QUANT_SUFFIX, QuantizedValue, QuantizedValueType, attribute_to_kwarg, ms_domain from .base_operator import QuantOperatorBase from .qdq_base_operator import QDQOperatorBase class QLinearWhere(QuantOperatorBase): def should_quantize(self): return True ...
88
3,040
python-prompt-toolkit
src/prompt_toolkit/win32_types.py
.py
from __future__ import annotations from ctypes import Structure, Union, c_char, c_long, c_short, c_ulong from ctypes.wintypes import BOOL, DWORD, LPVOID, WCHAR, WORD from typing import TYPE_CHECKING # Input/Output standard device numbers. Note that these are not handle objects. # It's the `windll.kernel32.GetStdHandl...
230
5,551
structlog
src/structlog/types.py
.py
# SPDX-License-Identifier: MIT OR Apache-2.0 # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the MIT License. See the LICENSE file in the root of this # repository for complete details. """ Deprecated name for :mod:`structlog.typing`. .. versionadded:: 20.2.0 .. deprecated:: 22...
39
764
black
tests/data/cases/form_feeds.py
.py
# Warning! This file contains form feeds (ASCII 0x0C, often represented by \f or ^L). # These may be invisible in your editor: ensure you can see them before making changes here. # There's one at the start that'll get stripped # Comment and statement processing is different enough that we'll test variations of bot...
228
1,933
openvino
tests/layer_tests/tensorflow_tests/test_tf_Pack.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestPack(CommonTFLayerTest): def _prepare_input(self, inputs_info): inputs_data = {} for input_...
116
4,602
wandb
tests/unit_tests/test_launch/test_environment/test_azure.py
.py
from unittest.mock import MagicMock import pytest from wandb.sdk.launch.environment.azure_environment import AzureEnvironment from wandb.sdk.launch.errors import LaunchError def test_azure_environment_from_config(mocker): """Test AzureEnvironment class.""" mocker.patch( "wandb.sdk.launch.environment....
105
3,321
saleor
saleor/graphql/order/tests/queries/test_order_with_sort.py
.py
import pytest from freezegun import freeze_time from prices import Money, TaxedMoney from .....core.postgres import FlatConcatSearchVector from .....order import OrderStatus from .....order.models import Order from .....order.search import ( prepare_order_search_vector_value, ) from ....tests.utils import get_grap...
235
7,360
coremltools
coremltools/test/xgboost_tests/test_decision_tree_regression.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 import unittest from ..utils import load_boston from coremltools._deps import _HAS_SKLEARN, _HAS_XGBOOS...
83
2,902
astropy
astropy/samp/tests/test_client.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import platform import warnings import pytest # By default, tests should not use the internet. from astropy.samp import SAMPProxyError, SAMPWarning, conf from astropy.samp.client import SAMPClient from astropy.samp.hub import SAMPHubServer from astropy....
79
2,604
metrics
src/torchmetrics/detection/diou.py
.py
# Copyright The PyTorch 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 i...
196
8,133
saleor
saleor/graphql/product/tests/mutations/test_product_media_reorder.py
.py
from unittest.mock import patch import graphene import pytest from django.db import transaction from .....graphql.tests.utils import get_graphql_content from .....product.error_codes import ProductErrorCode from .....tests import race_condition PRODUCT_MEDIA_REORDER = """ mutation reorderMedia($product_id: ID!, ...
126
4,002
astropy
astropy/units/si.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package defines the SI units. They are also available in (and should be used through) the `astropy.units` namespace. """ # avoid ruff complaints about undefined names defined by def_unit # ruff: noqa: F821 import numpy as np from .core import C...
486
10,235
luigi
test/metrics_test.py
.py
import unittest import luigi.metrics as metrics from luigi.contrib.datadog_metric import DatadogMetricsCollector from luigi.contrib.prometheus_metric import PrometheusMetricsCollector class TestMetricsCollectors(unittest.TestCase): def test_default_value(self): collector = metrics.MetricsCollectors.defau...
39
1,322
onnxruntime
onnxruntime/test/python/transformers/test_parity_t5_mha.py
.py
# -------------------------------------------------------------------------- # Copyright 2020 The HuggingFace Inc. 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/l...
877
35,210
pyro
pyro/distributions/omt_mvn.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.distributions import constraints from pyro.distributions.torch import MultivariateNormal from pyro.distributions.u...
91
3,183
openvino
src/bindings/python/src/openvino/opset1/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for all openvino ops.""" from typing import Optional, Union, get_args import numpy as np from functools import partial from openvino import Node, PartialShape, Type from openvino.op import C...
2,980
110,562
biopython
Bio/SeqIO/QualityIO.py
.py
# Copyright 2009-2020 by Peter Cock. All rights reserved. # Copyright 2020 by Michael R. Crusoe # # 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 t...
2,527
96,018
wagtail
wagtail/snippets/tests/test_revert_view.py
.py
from django.conf import settings from django.contrib.admin.utils import quote from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.urls import reverse from django.utils.timezone import now from freezegun import freeze_t...
344
14,035
beam
sdks/python/apache_beam/ml/anomaly/univariate/stdev.py
.py
# 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 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...
157
5,028
coremltools
coremltools/converters/mil/frontend/torch/quantization_ops.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as _np import torch as _torch from packaging.version import Version from coremltools im...
808
31,371
onnxruntime
orttraining/orttraining/python/training/ortmodule/_io.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import copy import gc import inspect from collections import OrderedDict...
591
26,116
httpie
tests/test_plugins_cli.py
.py
import pytest from httpie.status import ExitStatus from tests.utils.plugins_cli import parse_listing @pytest.mark.requires_installation @pytest.mark.parametrize('cli_mode', [True, False]) def test_plugins_installation(httpie_plugins_success, interface, dummy_plugin, cli_mode): lines = httpie_plugins_success('ins...
156
5,784
bazel
src/test/py/bazel/test_base.py
.py
# pylint: disable=g-bad-file-header # pylint: disable=superfluous-parens # Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:/...
658
22,232
mlflow
tests/server/jobs/test_trace_archival_jobs.py
.py
import json from contextlib import contextmanager, nullcontext from pathlib import Path from unittest.mock import MagicMock, patch from opentelemetry import trace as trace_api from opentelemetry.sdk.resources import Resource as _OTelResource from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan import ...
696
25,057
probability
discussion/adaptive_malt/utils.py
.py
# Copyright 2022 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
120
3,048
django-cms
cms/utils/i18n.py
.py
from contextlib import contextmanager from django.conf import settings from django.urls import LocalePrefixPattern, get_resolver from django.utils import translation from django.utils.translation import gettext_lazy as _ from cms.exceptions import LanguageError from cms.utils.compat.warnings import RemovedInDjangoCMS...
256
8,035
astropy
astropy/coordinates/tests/test_solar_system.py
.py
from urllib.error import HTTPError import numpy as np import pytest from astropy import units as u from astropy.constants import c from astropy.coordinates.builtin_frames import TETE from astropy.coordinates.earth import EarthLocation from astropy.coordinates.funcs import get_sun from astropy.coordinates.representati...
440
16,485
sphinx
sphinx/util/inspect.py
.py
"""Helpers for inspecting Python modules.""" from __future__ import annotations import ast import builtins import contextlib import enum import inspect import re import sys import types import typing from collections.abc import Mapping from functools import cached_property, partial, partialmethod, singledispatchmetho...
1,101
38,422
beam
sdks/python/apache_beam/runners/interactive/caching/expression_cache.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...
110
4,205
wagtail
wagtail/actions/unpublish.py
.py
import logging from django.core.exceptions import PermissionDenied from wagtail.actions.base import BaseAction from wagtail.log_actions import log from wagtail.signals import unpublished logger = logging.getLogger("wagtail") class UnpublishPermissionError(PermissionDenied): """ Raised when the object unpub...
87
2,497
readthedocs.org
readthedocs/subscriptions/tasks.py
.py
"""Organization tasks.""" import datetime import structlog from django.contrib.auth.models import User from django.db.models import Count from django.utils import timezone from djstripe import models as djstripe from readthedocs.builds.models import Build from readthedocs.core.utils import send_email from readthedoc...
113
3,935
kafka
tests/kafkatest/tests/tools/kibosh_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 ...
86
3,651