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/graphql/payment/mutations/stored_payment_methods/payment_method_request_delete.py
.py
import graphene from django.core.exceptions import ValidationError from .....payment.interface import ( StoredPaymentMethodRequestDeleteData, StoredPaymentMethodRequestDeleteResult, ) from .....permission.auth_filters import AuthorizationFilters from .....webhook.event_types import WebhookEventSyncType from .....
100
3,827
coremltools
coremltools/converters/mil/mil/ops/defs/iOS17/activation.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 from coremltools.converters.mil.mil import types from coremltools.converters.mil.mil.input_type impor...
358
9,885
mlflow
tests/pyfunc/custom_model/mod1/__init__.py
.py
from . import mod2 # noqa __all__ = ["mod2"]
4
47
sphinx
tests/roots/test-ext-coverage/grog/coverage_missing.py
.py
"""This module is intentionally not documented.""" class Missing: """An undocumented class.""" def missing_a(self): """An undocumented method."""
9
165
kombu
kombu/transport/virtual/__init__.py
.py
from __future__ import annotations from .base import (AbstractChannel, Base64, BrokerState, Channel, Empty, Management, Message, NotEquivalentError, QoS, Transport, UndeliverableWarning, binding_key_t, queue_binding_t) __all__ = ( 'Base64', 'NotEquivalentError', 'Undeliverabl...
12
476
probability
tensorflow_probability/python/mcmc/dual_averaging_step_size_adaptation_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...
785
29,724
openvino
tests/model_hub_tests/pytorch/test_aliked.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import math import os import platform import subprocess import sys import tempfile import numpy as np import openvino.opset12 as ops import pytest import torch from openvino import convert_model, Model, PartialShape, Type from openvino....
150
5,874
onnxruntime
orttraining/orttraining/python/training/optim/config.py
.py
from enum import IntEnum, unique class _OptimizerConfig: r"""Base class for optimizer configuration This class is not an optimizer, but a means to configure existing ones from ORT backend. Once configured, no user intervention is needed to update weights or zero gradients during training. The 'parame...
275
12,348
sqlmap
plugins/dbms/mimersql/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ try: import mimerpy except: pass import logging from lib.core.common import getSafeExString from lib.core.data import conf from lib.core.data import logger from lib.core...
62
1,992
lemur
lemur/plugins/lemur_acme/tests/test_acme_dns.py
.py
import unittest from unittest.mock import MagicMock from unittest.mock import patch, Mock import josepy as jose from acme.messages import STATUS_PENDING, STATUS_VALID from cryptography.x509 import DNSName from flask import Flask, current_app from lemur.common.utils import generate_private_key from lemur.plugins.lemur...
474
19,769
coremltools
deps/protobuf/python/stubout.py
.py
#!/usr/bin/python2.4 # # Copyright 2008 Google 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 o...
144
4,957
wandb
wandb/docker/names.py
.py
from __future__ import annotations class InvalidRepositoryError(Exception): """The given string is not a valid repository name.""" def resolve_repository_name(repo_name: str) -> tuple[str, str]: if "://" in repo_name: raise InvalidRepositoryError( f"Repository name cannot contain a schem...
41
1,311
onnx
onnx/reference/ops/_op_common_pool.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import itertools import numpy as np from onnx.reference.op_run import OpRun from onnx.reference.ops._op_common_indices import _get_index, _get_indices def _get_pad_shape( auto_pad: str, input...
302
10,283
clearml
examples/reporting/artifacts_retrieval.py
.py
# ClearML - example code, retrieve other task artifacts and print the artifacts # Please run examples/reporting/artifacts.py example before running this example # from pprint import pprint from clearml import Task def main(): # Getting the task we want to get the artifacts from artifacts_task = Task.get_task...
69
3,020
mlflow
mlflow/entities/model_registry/model_version_search.py
.py
from mlflow.entities.model_registry import ModelVersion class ModelVersionSearch(ModelVersion): def __init__(self, *args, **kwargs): kwargs["tags"] = [] kwargs["aliases"] = [] super().__init__(*args, **kwargs) def tags(self): raise Exception( "UC Model Versions gat...
26
863
hydra
plugins/hydra_nevergrad_sweeper/tests/test_nevergrad_sweeper_plugin.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import sys import warnings from pathlib import Path from typing import Any, Optional import nevergrad as ng from hydra.core.override_parser.overrides_parser import OverridesParser from hydra.core.plugins import Plugins from hydra.plugins.sweeper im...
290
10,068
kombu
t/unit/transport/test_gcpubsub.py
.py
from __future__ import annotations import os from concurrent.futures import Future from datetime import datetime from queue import Empty from unittest.mock import MagicMock, PropertyMock, call, patch import pytest from _socket import timeout as socket_timeout from google.api_core.exceptions import (AlreadyExists, Dea...
1,350
52,107
gunicorn
tests/requests/valid/008.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "GET", "uri": uri("/unusual_content_length"), "version": (1, 0), "headers": [ ("CONTENT-LENGTH", "5") ], "body": b"HELLO" }
14
284
beam
sdks/python/apache_beam/internal/http_client_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...
110
4,661
wandb
wandb/sdk/artifacts/_generated/delete_artifact_sequence.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from typing import Literal from pydantic import Field from wandb._pydantic import GQLResult, Typename from .enums import ArtifactCollectionState class DeleteArtifactSequence(GQLResult): result: Delete...
34
820
textual
src/textual/_dispatch_key.py
.py
from __future__ import annotations from typing import Callable from textual import events from textual._callback import invoke from textual.dom import DOMNode from textual.errors import DuplicateKeyHandlers from textual.message_pump import MessagePump async def dispatch_key(node: DOMNode, event: events.Key) -> bool...
69
2,462
pyomo
pyomo/core/plugins/transform/logical_to_linear.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...
391
17,348
confluent-kafka-python
tests/schema_registry/test_dlq_action.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2026 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
345
13,019
wagtail
wagtail/api/v2/tests/test_renderer_classes.py
.py
import json from unittest.mock import patch from django.test import TestCase from django.urls import reverse from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer from wagtail.api.v2.views import BaseAPIViewSet from wagtail.test.numberformat import ignore_numberformat from wagtail.test.utils import ...
92
3,832
cvxpy
cvxpy/reductions/dcp2cone/dcp2cone.py
.py
""" Copyright 2013 Steven Diamond, 2017 Akshay Agrawal, 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by app...
303
13,090
wagtail
wagtail/embeds/rich_text/__init__.py
.py
from wagtail.embeds import format from wagtail.embeds.embeds import get_embed from wagtail.embeds.models import Embed from wagtail.rich_text import EmbedHandler # Front-end conversion class MediaEmbedHandler(EmbedHandler): identifier = "media" @staticmethod def get_model(): return Embed @st...
27
678
textual
src/textual/css/scalar_animation.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from textual._animator import Animation, EasingFunction from textual._types import AnimationLevel, CallbackType from textual.css.scalar import Scalar, ScalarOffset if TYPE_CHECKING: from textual.css.styles import StylesBase from textual.widg...
99
3,159
mlflow
mlflow/pydantic_ai/autolog.py
.py
import contextvars import inspect import logging from contextlib import asynccontextmanager from dataclasses import is_dataclass from typing import Any import mlflow from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.pydantic_ai.utils import parse_usage as _parse_usage from mlfl...
498
19,723
kafka
tests/kafkatest/utils/remote_account.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 ...
59
2,124
biopython
Bio/PDB/PSEA.py
.py
# Copyright (C) 2006, Thomas Hamelryck (thamelry@binf.ku.dk) # # 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. """Wrappers for PSEA...
121
3,141
textual
src/textual/drivers/_input_reader_windows.py
.py
import os import sys from threading import Event from typing import Iterator class InputReader: """Read input from stdin.""" def __init__(self, timeout: float = 0.1) -> None: """ Args: timeout: Seconds to block for input. """ self._fileno = sys.__stdin__.fileno() ...
34
830
openvino
src/bindings/python/src/openvino/utils/postponed_constant.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from typing import Optional from collections.abc import Callable from openvino import Op, Type, Shape, Tensor, PartialShape, TensorVector class PostponedConstant(Op): """Postponed Constant is a way to mater...
70
2,514
readthedocs.org
readthedocs/projects/views/public.py
.py
"""Public project views.""" import hashlib import mimetypes import os import structlog from django.conf import settings from django.contrib import messages from django.db.models import prefetch_related_objects from django.http import Http404 from django.http import HttpResponse from django.http import HttpResponseRed...
457
15,461
onnxruntime
onnxruntime/python/onnxruntime_validation.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ Check OS requirements for ONNX Runtime Python Bindings. """ import l...
155
6,795
scikit-bio
skbio/io/format/biom.py
.py
r"""BIOM-Format (:mod:`skbio.io.format.biom`) ============================================ .. currentmodule:: skbio.io.format.biom The BIOM-Format (format v2.1.0) is an HDF5-based format to represent sample/feature counts or relative abundances. It is designed specifically for sparse data. Internally, it stores the d...
140
4,279
saleor
saleor/core/tests/test_postgresql_search.py
.py
import pytest from django.contrib.postgres.search import SearchVector from django.db.models import Value from django.utils.text import slugify from ...account.models import Address from ...product.models import Product, ProductChannelListing from ...tests.utils import dummy_editorjs from ..postgres import FlatConcat f...
129
4,178
metrics
tests/unittests/image/test_psnrb.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...
140
5,303
loguru
tests/test_colorama.py
.py
import builtins import os import sys from unittest.mock import MagicMock import pytest from loguru import logger from loguru._colorama import should_colorize, should_wrap from .conftest import ( StreamFilenoException, StreamIsattyException, StreamIsattyFalse, StreamIsattyTrue, ) @pytest.fixture(aut...
375
13,727
tomli
src/tomli/_types.py
.py
# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Taneli Hukkinen # Licensed to PSF under a Contributor Agreement. from typing import Any, Callable, Tuple # Type annotations ParseFloat = Callable[[str], Any] Key = Tuple[str, ...] Pos = int
11
254
openvino
tests/e2e_tests/common/comparator/semantic_segmentation.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import sys import numpy as np from e2e_tests.common.table_utils import make_table from .provider import ClassProvider from e2e_tests.common.comparator.threshold_utils import get_default_iou_threshold class Seman...
74
3,559
conda
tests/shell/test_csh.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations from typing import TYPE_CHECKING import pytest from conda import __version__ as CONDA_VERSION from conda.common.compat import on_linux, on_win if TYPE_CHECKING: from . import Shell pytestmark = [ p...
62
1,855
wagtail
wagtail/project_template/home/models.py
.py
from django.db import models from wagtail.models import Page class HomePage(Page): pass
8
95
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Resize.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest from common.utils.tflite_utils import parametrize_tests test_ops = [ {'op_name': ['RESIZE_BILINEAR'], 'op_func': 'tf.compat.v1.image.resize_bilinear'}, {'op_name': ['RESIZE_NEAREST_NEIGHBOR'], 'op_func': 'tf.compa...
51
2,466
saleor
saleor/graphql/account/mutations/account/account_update.py
.py
from typing import cast import graphene from .....account import models from .....account.search import update_user_search_vector from .....core.tracing import traced_atomic_transaction from .....permission.auth_filters import AuthorizationFilters from .....webhook.event_types import WebhookEventAsyncType from ....ac...
135
5,070
textual
src/textual/css/styles.py
.py
from __future__ import annotations import weakref from dataclasses import dataclass, field from functools import partial from operator import attrgetter from typing import TYPE_CHECKING, Any, Callable, Iterable, Iterator, Literal, cast import rich.repr from rich.style import Style from typing_extensions import TypedD...
1,529
52,117
openvino
docs/articles_en/assets/snippets/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from .utils import get_image from .utils import get_model from .utils import get_path_to_model
7
178
hatch
tests/helpers/templates/wheel/standard_editable_pth.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.default import get_files as get_template_files from .utils import update_record_file_contents def get_files(**kwargs): metadata_direc...
49
1,397
probability
tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_zeros.py
.py
# Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`. # DO NOT MODIFY DIRECTLY. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
537
22,077
probability
tensorflow_probability/python/distributions/kullback_leibler_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...
195
6,916
biopython
Bio/PDB/StructureAlignment.py
.py
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk) # # 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. """Map residues of t...
185
7,021
saleor
saleor/tests/e2e/vouchers/utils/query_vouchers.py
.py
from ...utils import get_graphql_content VOUCHERS_QUERY = """ query vouchersQuery{ vouchers(first: 10) { edges { node { id } } } } """ def get_vouchers( api_client, ): response = api_client.post_graphql(VOUCHERS_QUERY) content = get_graphql_content(response) return ...
23
336
readthedocs.org
dockerfiles/settings/celery.py
.py
from .docker_compose import DockerBaseSettings class CeleryDevSettings(DockerBaseSettings): DONT_HIT_DB = False # TODO: review this since it may not be needed with RustFS (S3). For now, # this is still required, but the CORS issue may have disappeared in RustFS. # Since we can't properly set CORS on...
20
740
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/withtimestamps_logical_clock.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");...
67
2,237
jupytext
tests/data/notebooks/outputs/ipynb_to_hydrogen/Line_breaks_in_LateX_305.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [markdown] # This cell uses no particular cell marker # # $$ # \begin{align} # \dot{x} & = \sigma(y-x)\\ # \dot{y} & = \rho x - y - xz \\ # \dot{z} & = -\beta z + xy # \end{align} # $$ # %% [markdown] #...
43
783
returns
returns/maybe.py
.py
from abc import ABC from collections.abc import Callable, Generator, Iterator from functools import wraps from typing import TYPE_CHECKING, Any, ClassVar, Never, Optional, TypeVar, final from typing_extensions import ParamSpec from returns.interfaces.specific.maybe import MaybeBased2 from returns.primitives.container...
492
13,755
black
tests/data/cases/comments_in_double_parens.py
.py
if ( True # sdf ): print("hw") if (( True # sdf )): print("hw") if (( # type: ignore True )): print("hw") if (( True # type: ignore )): print("hw") if ( # a long comment about # the condition below (a or b) ): pass def return_true(): return ( ...
114
1,142
beam
sdks/python/apache_beam/io/tfrecordio.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...
389
14,265
httpie
httpie/cookies.py
.py
from http import cookiejar _LOCALHOST = 'localhost' _LOCALHOST_SUFFIX = '.localhost' class HTTPieCookiePolicy(cookiejar.DefaultCookiePolicy): def return_ok_secure(self, cookie, request): """Check whether the given cookie is sent to a secure host.""" is_secure_protocol = super().return_ok_secure...
26
1,069
pdm
tests/cli/test_config.py
.py
import pytest from pdm.exceptions import PdmUsageError from pdm.project.config import Config from pdm.utils import cd def test_config_command(project, pdm): result = pdm(["config"], obj=project) assert result.exit_code == 0 assert "python.use_pyenv = True" in result.output result = pdm(["config", "-...
288
11,282
textual
tests/test_animator.py
.py
from __future__ import annotations from dataclasses import dataclass from unittest.mock import Mock import pytest from textual._animator import Animator, SimpleAnimation from textual._easing import DEFAULT_EASING, EASING class Animatable: """An animatable object.""" def __init__(self, value): self...
293
7,495
onnx
onnx/reference/ops/op_string_split.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun _acceptable_str_dtypes = ("U", "O") def pad_empty_string( split_lists: list | np.ndarray, padding_requirement: list | int ) -> list: ...
47
1,695
voila
tests/notebooks/print.py
.py
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.2.1 # kernelspec: # display_name: Python 3 # language: python # name: python # --- print("Hi Voilà!")
16
284
beam
sdks/python/apache_beam/io/azure/blobstorageio.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...
694
23,858
sphinx
tests/roots/test-ext-autodoc/target/canonical/original.py
.py
class Foo: """docstring""" def meth(self): """docstring""" def bar(): class Bar: """docstring""" return Bar Bar = bar()
16
158
clearml
clearml/storage/callbacks.py
.py
import logging import os from time import time from typing import Optional, AnyStr, IO, Any from ..config import config try: from tqdm import tqdm # noqa except ImportError: tqdm = None class ProgressReport: report_upload_chunk_size_mb = None report_download_chunk_size_mb = None def __init__( ...
217
7,655
probability
tensorflow_probability/python/distributions/relaxed_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...
344
13,822
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/mltransform.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");...
122
3,513
ipython
IPython/core/builtin_trap.py
.py
""" A context manager for managing things injected into :mod:`builtins`. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations import builtins as builtin_mod from typing import Any, Literal, TYPE_CHECKING from traitlets.config.confi...
100
3,249
qutip
qutip/tests/core/data/test_reshape.py
.py
from .test_mathematics import UnaryOpMixin import pytest import numpy as np from qutip import data from qutip.core.data import CSR, Dense, Dia class TestSplitColumns(UnaryOpMixin): def op_numpy(self, matrix): return [column[:, np.newaxis] for column in matrix.T] specialisations = [ pytest.par...
127
4,694
textual
tests/snapshot_tests/snapshot_apps/command_palette.py
.py
from textual.app import App from textual.command import Hit, Hits, Provider class TestSource(Provider): def goes_nowhere_does_nothing(self) -> None: pass async def search(self, query: str) -> Hits: matcher = self.matcher(query) for n in range(10): command = f"This is a tes...
30
714
mlflow
mlflow/telemetry/installation_id.py
.py
import json import os import threading import uuid from datetime import datetime, timezone from pathlib import Path from mlflow.utils.os import is_windows from mlflow.version import VERSION _KEY_INSTALLATION_ID = "installation_id" _CACHE_LOCK = threading.RLock() _INSTALLATION_ID_CACHE: str | None = None def get_or_...
89
2,966
saleor
saleor/tests/e2e/orders/discounts/test_order_promotion_not_applied_when_not_within_time_range.py
.py
import datetime import pytest from django.utils import timezone from freezegun import freeze_time from .....product.tasks import recalculate_discounted_price_for_products_task from ... import DEFAULT_ADDRESS from ...product.utils import get_product from ...product.utils.preparing_product import prepare_product from ....
125
4,447
tablib
src/tablib/formats/_dbf.py
.py
""" Tablib - DBF Support. """ __lazy_modules__ = { "io", "os", "tablib._vendor", "tempfile", } import io import os import tempfile from .._vendor.dbfpy import dbf, dbfnew from .._vendor.dbfpy import record as dbfrecord class DBFFormat: title = 'dbf' extensions = ('csv',) DEFAULT_ENCODI...
75
2,001
confluent-kafka-python
tests/soak/setup_all_versions.py
.py
#!/usr/bin/env python3 import os import subprocess PYTHON_SOAK_TEST_BRANCH = 'master' LIBRDKAFKA_VERSIONS = [ '2.15.0', '2.14.2', '2.13.2', '2.13.0', '2.12.1', '2.11.1', '2.10.1', '2.8.0', '2.6.1', '2.5.3', '2.4.0', '2.3.0', '2.2.0', '2.1.1', '2.0.2', ] PYT...
67
1,671
onnxruntime
onnxruntime/python/tools/transformers/fusion_mha_mmdit.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger import numpy as np from fusion_base impor...
668
25,149
saleor
saleor/graphql/account/tests/benchmark/test_customer_type.py
.py
import graphene import pytest from .....account.models import CustomerType from ....tests.utils import get_graphql_content ATTRIBUTE_FRAGMENT = """ fragment AttributeFields on Attribute { slug name type inputType choices(first: 10) { edges { node...
135
3,635
python-prompt-toolkit
src/prompt_toolkit/formatted_text/base.py
.py
from __future__ import annotations from collections.abc import Callable, Iterable from typing import TYPE_CHECKING, Union, cast from prompt_toolkit.mouse_events import MouseEvent if TYPE_CHECKING: from typing_extensions import Protocol from prompt_toolkit.key_binding.key_bindings import NotImplementedOrNone...
180
5,071
openvino
src/bindings/python/tests/test_runtime/test_stateful.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import os import pytest from openvino import ( Core, CompiledModel, InferRequest, Tensor, compile_model, ) from tests.utils.helpers import generate_model_with_memory from o...
99
3,594
gunicorn
tests/config/test_cfg_alt.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. proc_name = "not-fooey"
6
130
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/map_tuple.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");...
61
1,725
astropy
astropy/io/fits/hdu/compressed/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings from math import ceil import numpy as np from astropy.utils.exceptions import AstropyUserWarning __all__ = ["_validate_tile_shape"] def _validate_tile_shape(*, tile_shape, compression_type, image_header): naxis = image_header["NAX...
156
5,465
astropy
astropy/config/configuration.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains classes and functions to standardize access to configuration files for Astropy and affiliated packages. .. note:: The configuration system makes use of the 'configobj' package, which stores configuration in a text format li...
844
28,002
beam
sdks/python/apache_beam/runners/interactive/cache_manager_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...
286
10,684
voila
tests/server/conftest.py
.py
import os import pytest from jupyter_server.serverapp import ServerApp from tornado import httpserver BASE_DIR = os.path.dirname(__file__) @pytest.fixture def jupyter_server_config(): return lambda app: None @pytest.fixture def jupyter_server_args_extra(): return [] @pytest.fixture def jupyter_server_ar...
48
1,250
scikit-bio
skbio/stats/distance/_anosim.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. # --------------------------------------------...
229
9,216
scikit-bio
skbio/io/format/tests/test_qseq.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. # --------------------------------------------...
353
13,189
saleor
saleor/tests/e2e/orders/utils/draft_order_complete.py
.py
from ...account.utils.fragments import ADDRESS_FRAGMENT from ...utils import get_graphql_content DRAFT_ORDER_COMPLETE_MUTATION = ( """ mutation DraftOrderComplete($id: ID!) { draftOrderComplete(id: $id) { errors { message field code } order { id user { id ...
136
2,267
gunicorn
tests/requests/invalid/pp_03.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.config import Config from gunicorn.http.errors import InvalidProxyLine cfg = Config() cfg.set('proxy_protocol', True) request = InvalidProxyLine
12
267
mlflow
mlflow/genai/labeling/stores.py
.py
""" Labeling store functionality for MLflow GenAI. This module provides store implementations to manage labeling sessions and schemas """ import warnings from abc import ABCMeta, abstractmethod from typing import TYPE_CHECKING, Any, Callable from mlflow.entities import Trace from mlflow.exceptions import MlflowExcep...
490
18,164
textual
tests/test_visible.py
.py
from textual.app import App, ComposeResult from textual.containers import VerticalScroll from textual.widget import Widget async def test_visibility_changes() -> None: """Test changing visibility via code and CSS. See https://github.com/Textualize/textual/issues/1355 as the motivation for these tests. ""...
79
2,647
saleor
saleor/graphql/order/tests/benchmark/test_order_fulfill.py
.py
from unittest.mock import patch import graphene import pytest from ....tests.utils import get_graphql_content ORDER_FULFILL_QUERY = """ mutation fulfillOrder( $order: ID, $input: OrderFulfillInput! ) { orderFulfill( order: $order, input: $input ) { ...
117
3,616
saleor
saleor/graphql/core/tests/test_pagination.py
.py
import base64 import math import graphene import orjson import pytest from ....tests.models import Book from ..connection import CountableConnection, create_connection_slice from ..fields import ConnectionField class BookType(graphene.ObjectType): name = graphene.String() class BookTypeCountableConnection(Cou...
490
15,399
deap
tests/test_benchmarks.py
.py
"""Test functions from deap/benchmarks.""" import sys import unittest from deap import base from deap import creator from deap.benchmarks import binary class BenchmarkTest(unittest.TestCase): """Test object for unittest of deap/benchmarks.""" def setUp(self): @binary.bin2float(0, 1023, 10) ...
62
2,356
textual
src/textual/renderables/sparkline.py
.py
from __future__ import annotations import statistics from fractions import Fraction from typing import Callable, Generic, Iterable, Sequence, TypeVar from rich.color import Color from rich.console import Console, ConsoleOptions, RenderResult from rich.measure import Measurement from rich.segment import Segment from r...
166
5,475
hatch
src/hatch/config/model.py
.py
import os FIELD_TO_PARSE = object() class ConfigurationError(Exception): def __init__(self, *args, location): self.location = location super().__init__(*args) def __str__(self): return f"Error parsing config:\n{self.location}\n {super().__str__()}" def parse_config(obj): if is...
790
25,374
probability
tensorflow_probability/python/experimental/sts_gibbs/benchmarks_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...
103
4,004
textual
tests/snapshot_tests/snapshot_apps/log_write_lines.py
.py
from textual.app import App, ComposeResult from textual.widgets import Log from textual.containers import Horizontal TEXT = ( """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has g...
39
1,146
sqlmap
plugins/dbms/presto/__init__.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.enums import DBMS from lib.core.settings import PRESTO_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.presto.enumeration import Enumeration f...
31
909
textual
tests/text_area/test_languages.py
.py
import pytest from textual.app import App, ComposeResult from textual.widgets import TextArea from textual.widgets.text_area import LanguageDoesNotExist class TextAreaApp(App): def compose(self) -> ComposeResult: yield TextArea("print('hello')", language="python") async def test_setting_builtin_languag...
96
2,801
saleor
saleor/graphql/app/mutations/app_create.py
.py
import graphene from ....app import models from ....permission.enums import AppPermission, get_permissions from ....webhook.event_types import WebhookEventAsyncType from ...core.doc_category import DOC_CATEGORY_APPS from ...core.enums import PermissionEnum from ...core.mutations import DeprecatedModelMutation from ......
100
3,765