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
onnxruntime
onnxruntime/test/testdata/test_kernel_info_get_const_input.py
.py
import onnx from onnx import TensorProto, helper def GenerateModel(model_name): # noqa: N802 initializers = [ helper.make_tensor( "weight", TensorProto.FLOAT, [1, 4], [1.0, 2.0, 3.0, 4.0], ), ] nodes = [ helper.make_node( ...
43
953
mlflow
tests/gateway/providers/test_litellm.py
.py
from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.gateway.config import EndpointConfig from mlflow.gateway.providers.base import PassthroughAction from mlflow.gateway.providers.litellm import LiteLLMAdapter, LiteLLMProvider from mlflow.gateway.schemas import chat, embed...
989
33,619
sqlmap
extra/esperanto/discovery.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from .atlas import _BANNER_KEYWORDS from .atlas import _BANNERS from .atlas import _BINWRAP from .atlas import _BYTELEN from .atlas import _CATALOGS from .atlas import _CHARCODE f...
605
30,700
cvxpy
cvxpy/reductions/complex2real/canonicalizers/psd_canon.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
33
1,042
readthedocs.org
readthedocs/oauth/management/commands/reconnect_remoterepositories.py
.py
import json from django.core.management.base import BaseCommand from django.db.models import Q from django.db.models import Subquery from readthedocs.oauth.models import RemoteRepository from readthedocs.oauth.services import registry from readthedocs.oauth.services.base import SyncServiceError from readthedocs.organ...
116
4,853
ipython
IPython/core/magics/namespace.py
.py
"""Implementation of namespace-related magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with ...
724
25,296
beam
sdks/python/apache_beam/runners/direct/consumer_tracking_pipeline_visitor.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...
69
2,565
astropy
astropy/cosmology/_src/tests/traits/helper.py
.py
import inspect from collections.abc import Callable def is_positional_only(func: Callable, /, param: str) -> bool: """Return True if ``param:str`` is a positional-only parameter. Parameters ---------- func: Callable Function to check whether parameter `param` is positional-only. param : s...
18
526
ipython
IPython/lib/__init__.py
.py
""" Extra capabilities for IPython """ # ----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. # -----...
11
393
readthedocs.org
readthedocs/organizations/constants.py
.py
"""Constants for ACL.""" from django.utils.translation import gettext_lazy as _ READ_ONLY_ACCESS = "readonly" ADMIN_ACCESS = "admin" ACCESS_LEVELS = ( (READ_ONLY_ACCESS, _("Read-only")), (ADMIN_ACCESS, _("Admin")), )
13
229
saleor
saleor/graphql/product/tests/queries/test_collections_query_with_filter_and_sort.py
.py
import datetime import graphene import pytest from .....product.models import Collection, CollectionChannelListing from .....tests.utils import dummy_editorjs from ....tests.utils import ( assert_graphql_error_with_message, get_graphql_content, ) @pytest.mark.parametrize( ("collection_filter", "count"),...
536
15,447
astropy
astropy/wcs/wcsapi/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import importlib import numpy as np __all__ = ["deserialize_class", "wcs_info_str"] def deserialize_class(tpl, construct=True): """ Deserialize classes recursively. """ if not isinstance(tpl, tuple) or len(tpl) != 3: raise Valu...
153
5,224
openvino
src/bindings/python/tests/test_graph/test_type_info.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino import Op from openvino import DiscreteTypeInfo, Shape import openvino.opset14 as ops from openvino.utils.node_factory import NodeFactory class CustomAdd(Op): class_type_inf...
80
2,476
hydra
hydra/_internal/core_plugins/fish_completion.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import os import sys from typing import List, Optional, Tuple from hydra.plugins.completion_plugin import CompletionPlugin log = logging.getLogger(__name__) class FishCompletion(CompletionPlugin): def install(self) -> None: ...
82
2,395
pyomo
pyomo/contrib/mindtpy/tests/eight_process_problem.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...
261
9,524
astropy
astropy/utils/system_info.py
.py
r""" A helper script to automate system info in bug reports. This can be run as:: python -c "import astropy; astropy.system_info()" (note that the interpreter might be called python3 instead of python, depending on your system's details) This script should not require anything else than the standard library and...
87
1,944
sphinx
sphinx/util/rst.py
.py
"""reStructuredText helper functions.""" from __future__ import annotations import re from collections import defaultdict from contextlib import contextmanager from typing import TYPE_CHECKING from unicodedata import east_asian_width from docutils.parsers.rst import roles from docutils.parsers.rst.languages import e...
116
3,500
wandb
wandb/sdk/artifacts/_generated/operations.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ __all__ = [ "ADD_ALIASES_GQL", "ADD_ARTIFACT_COLLECTION_TAGS_GQL", "ARTIFACT_BY_ID_GQL", "ARTIFACT_COLLECTION_ALIASES_GQL", "ARTIFACT_CREATED_BY_GQL", "ARTIFACT_MEMBERSHIP_BY_NAME_GQL", "ARTIFACT_MEMBERSHIP_FILES_GQL"...
1,909
31,990
wagtail
wagtail/api/v3/tests/test_page_update.py
.py
import json from django.contrib.auth.models import Group, Permission from django.test import TestCase from django.urls import reverse from django.utils import timezone from wagtail.api.v3.tests.base import TestV3Base from wagtail.images.models import Image from wagtail.images.tests.utils import get_test_image_file fr...
876
32,551
saleor
saleor/tests/e2e/orders/test_order_create_invoice_with_metadata.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils import prepare_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_paid, order_fulfill, ...
145
3,881
pyomo
pyomo/solvers/tests/piecewise_linear/problems/concave_multi_vararray2.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...
75
2,729
wandb
tests/unit_tests/test_lib/test_service_token.py
.py
import os import pathlib import socket import pytest from wandb.sdk.lib import asyncio_manager from wandb.sdk.lib.service import ipc_support, service_token @pytest.fixture def chdir_to_tmp_path(tmp_path): cwd = pathlib.Path.cwd() os.chdir(tmp_path) try: yield finally: os.chdir(cwd) ...
64
1,608
probability
tensorflow_probability/python/internal/callable_util.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...
66
2,556
pyro
tests/distributions/test_rejector.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from torch.autograd import grad from pyro.distributions import Exponential, Gamma from pyro.distributions.testing.rejection_exponential import RejectionExponential from pyro.distributions.testing.rejecti...
178
6,748
pyomo
pyomo/repn/tests/test_standard.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...
4,442
163,904
probability
spinoffs/inference_gym/inference_gym/targets/brownian_motion.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...
339
12,422
biopython
Tests/test_prodoc.py
.py
# Copyright 1999 by Cayte Lindner. All rights reserved. # Copyright 2009 by Michiel de Hoon. 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 Bio.ExPASy.Prodoc modul...
1,362
57,975
coremltools
coremltools/models/__init__.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 from . import ( _feature_management, _interface_management, array_feature_extractor, com...
40
1,105
cvxpy
cvxpy/atoms/elementwise/log_normcdf.py
.py
""" Copyright 2021 the CVXPY 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 law or agreed to in writing, softw...
58
2,069
pyro
pyro/contrib/timeseries/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ The :mod:`pyro.contrib.timeseries` module provides a collection of Bayesian time series models useful for forecasting applications. """ from pyro.contrib.timeseries.base import TimeSeriesModel from pyro.contrib.timeseries.gp i...
26
712
wandb
wandb/sdk/lib/asyncio_compat.py
.py
"""Functions for compatibility with asyncio.""" from __future__ import annotations import asyncio import concurrent import concurrent.futures import contextlib import threading from collections.abc import AsyncGenerator, Callable, Coroutine from typing import Any, TypeVar _T = TypeVar("_T") def run(fn: Callable[[]...
293
9,751
mlflow
mlflow/demo/generators/prompts.py
.py
from __future__ import annotations import logging from mlflow.demo.base import ( DEMO_EXPERIMENT_NAME, DEMO_PROMPT_PREFIX, BaseDemoGenerator, DemoFeature, DemoResult, ) from mlflow.demo.data import DEMO_PROMPTS, DemoPromptDef from mlflow.genai.prompts import ( delete_prompt_alias, register...
132
4,401
mlflow
tests/bedrock/test_bedrock_autolog.py
.py
import base64 import io import json from pathlib import Path from unittest import mock import boto3 import pytest from botocore.exceptions import NoCredentialsError from botocore.response import StreamingBody from packaging.version import Version import mlflow from mlflow.entities import SpanLogLevel from mlflow.trac...
1,540
49,709
confluent-kafka-python
examples/sasl_producer.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
136
4,701
probability
tensorflow_probability/python/experimental/sequential/iterated_filter.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...
839
37,071
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_price_exclude_products.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...
159
5,387
kafka
tests/kafkatest/services/performance/performance.py
.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
73
3,133
cvxpy
cvxpy/reductions/solvers/conic_solvers/nag_conif.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
306
10,715
mlflow
examples/pyspark_ml_autologging/logistic_regression.py
.py
from pyspark.ml.classification import LogisticRegression from pyspark.ml.feature import VectorAssembler from pyspark.sql import SparkSession from sklearn.datasets import load_iris import mlflow with SparkSession.builder.getOrCreate() as spark: df = load_iris(as_frame=True).frame.rename(columns={"target": "label"}...
22
718
coremltools
coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/variable_node_transform.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from ..basic_graph_ops import delete_node, disconnect_vertex_ins # Variable nodes are not horribly ...
86
2,898
openvino
tests/e2e_tests/common/postprocessors/provider.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import inspect import torch from e2e_tests.common.common.base_provider import BaseProvider, BaseStepProvider class ClassProvider(BaseProvider): registry = {} @classmethod def validate(cls): methods = [ ...
49
1,606
probability
tensorflow_probability/python/internal/hypothesis_testlib_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...
72
2,425
sqlmap
plugins/dbms/mssqlserver/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 _mssql import pymssql except: pass import logging from lib.core.common import getSafeExString from lib.core.convert import getText from lib.core.data imp...
91
3,172
pyomo
pyomo/core/tests/data/test_odbc_ini.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...
171
5,637
jupyterlab
jupyterlab/commands.py
.py
"""JupyterLab command handler""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import contextlib import errno import hashlib import itertools import json import logging import os import os.path as osp import re import shutil import site import stat import subproce...
2,785
98,953
httpie
tests/test_regressions.py
.py
"""Miscellaneous regression tests""" import pytest from httpie.compat import is_windows from .utils.matching import assert_output_matches, Expect from .utils import HTTP_OK, MockEnvironment, http def test_Host_header_overwrite(httpbin): """ https://github.com/httpie/cli/issues/235 """ host = 'pie.de...
50
1,142
jupytext
tests/data/notebooks/outputs/ipynb_to_marimo/Line_breaks_in_LateX_305.py
.py
import marimo __generated_with = "0.17.8" app = marimo.App() @app.cell(hide_code=True) def _(mo): mo.md(r""" 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} $$ """) re...
63
1,064
sphinx
tests/roots/test-ext-autodoc/bug2437/autodoc_dummy_foo.py
.py
class Foo: """Dummy class Foo.""" pass
5
48
mlflow
mlflow/store/artifact/local_artifact_repo.py
.py
import asyncio import os import shutil import tempfile import threading from contextlib import suppress from typing import Any, AsyncIterable, BinaryIO, Callable from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import RESOURCE_DOES_NOT_EXIST from mlflow.store.artifact.artifact_repo impor...
302
12,165
beam
sdks/python/apache_beam/ml/anomaly/univariate/mean.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...
147
4,554
textual
docs/examples/widgets/selection_list_tuples.py
.py
from textual.app import App, ComposeResult from textual.widgets import Footer, Header, SelectionList class SelectionListApp(App[None]): CSS_PATH = "selection_list.tcss" def compose(self) -> ComposeResult: yield Header() yield SelectionList[int]( # (1)! ("Falken's Maze", 0, True),...
29
769
probability
spinoffs/inference_gym/inference_gym/targets/plasma_spectroscopy.py
.py
# Copyright 2021 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
431
15,183
probability
tensorflow_probability/python/distributions/logitnormal_test.py
.py
# Copyright 2019 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
191
8,222
mlflow
examples/llama_index/simple_index.py
.py
""" This is an example for logging a LlamaIndex index to MLflow and loading it back for querying via specific engine types - query engine, chat engine, and retriever. For more information about MLflow LlamaIndex integration, see: https://mlflow.org/docs/latest/llms/llama-index/index.html """ import os from llama_ind...
80
3,043
coremltools
coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/insert_get_tuple.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy from ..parsed_tf_node import ParsedTFNode def insert_get_tuple(gddict): """ Te...
112
3,398
mlflow
mlflow/experiments.py
.py
import json import os import click import mlflow from mlflow.entities import ExperimentTag, ViewType from mlflow.exceptions import MlflowException from mlflow.mcp.decorator import mlflow_mcp from mlflow.protos import databricks_pb2 from mlflow.tracing.constant import TraceExperimentTagKey from mlflow.tracking import ...
420
14,909
beam
sdks/python/apache_beam/io/gcp/bigquery_avro_tools.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...
143
4,449
toolz
toolz/functoolz.py
.py
from functools import reduce, partial import inspect import sys from operator import attrgetter, not_ from importlib import import_module from types import MethodType from .utils import no_default PYPY = hasattr(sys, 'pypy_version_info') and sys.version_info[0] > 2 __all__ = ('identity', 'apply', 'thread_first', 't...
1,050
29,757
openvino
docs/scripts/create_mapping.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import json import logging from lxml import etree from pathlib import Path REPOSITORIES = [ 'openvino', 'omz', 'pot', 'ovms', 'ote', ] def create_mapping(xml_input: Path, output_dir: Path, strip_pat...
91
3,204
saleor
saleor/graphql/account/tests/queries/test_customers_where_filtering.py
.py
import datetime import graphene import pytest from django.utils import timezone from freezegun import freeze_time from .....account.models import Address, CustomerType, User from .....account.tests.fixtures.user import dangerously_create_test_user from .....order import OrderOrigin from ....tests.utils import get_gra...
768
23,734
attrs
tests/dataclass_transform_example.py
.py
# SPDX-License-Identifier: MIT import attr import attrs @attr.define() class Define: a: str b: int reveal_type(Define.__init__) # noqa: F821 @attr.define() class DefineConverter: with_converter: int = attr.field(converter=int) reveal_type(DefineConverter.__init__) # noqa: F821 DefineConverter(wi...
63
820
saleor
saleor/graphql/checkout/tests/test_checkout_no_shipping_needed.py
.py
"""Test the API's checkout process over fully non-shippable orders.""" from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from ....plugins.manager import get_plugins_manager from ...core.utils import to_global_id_or_none from ...tests.utils import get_graphql_content from ..mutations.utils import...
60
2,011
beam
sdks/python/apache_beam/transforms/enrichment_handlers/utils.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...
39
1,282
textual
tests/snapshot_tests/snapshot_apps/split.py
.py
from textual.app import App, ComposeResult from textual.widgets import Placeholder class SplitApp(App): CSS = """ #split1 { split: right; width: 20; } #split2 { split: bottom; height: 10; } #split3 { split: top; height: 6; } #split4 {...
49
946
wandb
wandb/sdk/artifacts/_generated/update_artifact_sequence_type.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import ArtifactCollectionFragment class UpdateArtifactSequenceType(GQLResult): result: UpdateArtifactSequenceTypeResult ...
25
583
cvxpy
cvxpy/utilities/power_tools.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...
697
20,009
mamba
docs/source/conf.py
.py
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
76
2,401
returns
tests/test_trampolines/test_trampoline_decorator.py
.py
import sys from collections.abc import Callable, Iterator import pytest from returns.trampolines import Trampoline, trampoline @trampoline def _accumulate( numbers: Iterator[int], acc: int = 0, ) -> int | Trampoline[int]: number = next(numbers, None) if number is None: return acc return ...
57
1,297
pdm
tests/environments/test_shebangs.py
.py
import io import os import shlex import zipfile from pathlib import Path import pytest from pdm.environments.local import PythonLocalEnvironment, _get_shebang_path, _is_console_script, _replace_shebang @pytest.mark.parametrize( "executable,is_launcher,expected", [ ("/usr/bin/python", True, b"/usr/bi...
120
4,119
saleor
saleor/graphql/attribute/mutations/mixins.py
.py
from typing import cast from django.core.exceptions import ValidationError from django.utils.text import slugify from text_unidecode import unidecode from ....attribute import ( ATTRIBUTE_PROPERTIES_CONFIGURATION, AttributeEntityType, AttributeInputType, ) from ....attribute import models as models from ....
314
11,691
saleor
saleor/tests/e2e/account/account/test_should_login_before_email_confirmation.py
.py
from unittest import mock import pytest from .....account.models import User from .....graphql.core.utils import to_global_id_or_none from ...shop.utils import prepare_shop from ...utils import assign_permissions from ..utils import account_register, token_create @mock.patch("saleor.account.throttling.cache") @pyte...
79
2,170
wagtail
wagtail/blocks/field_block.py
.py
import copy import datetime from decimal import Decimal import swapper from django import VERSION as DJANGO_VERSION from django import forms from django.db.models import Model from django.utils.choices import CallableChoiceIterator from django.utils.dateparse import parse_date, parse_datetime, parse_time from django.u...
1,090
36,001
biopython
Bio/motifs/clusterbuster.py
.py
# Copyright 2015 by Gert Hulselmans. 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. """Parse Cluster Buster ...
118
3,852
hatch
backend/tests/downstream/integrate.py
.py
import errno import json import os import platform import shutil import stat import subprocess import sys import tempfile from contextlib import contextmanager from zipfile import ZipFile import requests import tomli from packaging.requirements import Requirement from packaging.specifiers import SpecifierSet from virt...
263
9,462
hydra
examples/patterns/write_protect_config_node/frozen.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from dataclasses import dataclass import hydra from hydra.core.config_store import ConfigStore @dataclass(frozen=True) class SerialPort: baud_rate: int = 19200 data_bits: int = 8 stop_bits: int = 1 cs = ConfigStore.instance() cs.sto...
26
485
textual
tests/snapshot_tests/snapshot_apps/recompose.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical from textual.reactive import reactive from textual.widgets import Digits, ProgressBar class Numbers(Vertical): DEFAULT_CSS = """ Digits { border: red; } """ d...
57
1,447
openvino
tests/e2e_tests/common/infer/network_modifiers/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from . import network_modifiers from .container import Container
6
148
saleor
saleor/graphql/shop/tests/test_shop_utils.py
.py
from django_countries import countries from ..utils import get_countries_codes_list, get_track_inventory_by_default def test_get_countries_codes_list(shipping_zones): # given all_countries = {country[0] for country in countries} # when countries_list_all = get_countries_codes_list() # then ...
44
1,189
gunicorn
tests/ctl/test_server.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for control socket server.""" import os import tempfile import time from unittest.mock import MagicMock import pytest from gunicorn.ctl.server import ControlSocketServer from gunicorn.ctl.client import ...
470
14,859
beam
learning/katas/python/Streaming/Triggers/Event Time Triggers/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...
42
1,644
saleor
saleor/graphql/webhook/mutations/event_delivery_retry.py
.py
import graphene from django.db.models import Exists, OuterRef from ....app.models import App from ....core import models from ....permission.enums import AppPermission from ....webhook.models import Webhook from ...core import ResolveInfo from ...core.doc_category import DOC_CATEGORY_WEBHOOKS from ...core.mutations im...
49
1,671
saleor
saleor/graphql/shipping/tests/benchmark/test_shipping_zones.py
.py
import pytest from ....tests.utils import get_graphql_content SHIPPING_ZONES_QUERY = """ query GetShippingZones($channel: String) { shippingZones(first: 100, channel: $channel) { edges { node { warehouses { id } } } } } """ @pytest.mark.django_db @pytest.mark.coun...
42
948
sphinx
tests/test_extensions/test_ext_math.py
.py
"""Test math extensions.""" from __future__ import annotations import re import shutil import subprocess import warnings from typing import TYPE_CHECKING import pytest from docutils import nodes from sphinx.ext.mathjax import MATHJAX_URL from sphinx.testing.util import assert_node from tests.utils import extract_n...
628
18,777
qutip
qutip/tests/core/test_superoper.py
.py
import numpy as np import scipy.linalg import qutip from qutip.core import data as _data import pytest def f(t): return t * (1 - 0.5j) def liouvillian_ref(H, c_ops=()): L = -1.0j * (qutip.spre(H) - qutip.spost(H)) if H else 0 for c in c_ops: if c.issuper: L += c else: ...
284
10,245
saleor
saleor/tests/e2e/orders/utils/order_void.py
.py
from ...utils import get_graphql_content ORDER_VOID_MUTATION = """ mutation VoidOrder ($id:ID!){ orderVoid(id: $id) { errors { code field message } order { id status payments { id } statusDisplay events { type } } } } """ ...
57
852
mlflow
mlflow/genai/scorers/phoenix/__init__.py
.py
""" Phoenix (Arize) integration for MLflow. This module provides integration with Phoenix evaluators, allowing them to be used with MLflow's scorer interface. Example usage: .. code-block:: python from mlflow.genai.scorers.phoenix import get_scorer scorer = get_scorer("Hallucination", model="openai:/gpt-4"...
280
8,245
beam
sdks/python/apache_beam/transforms/enrichment_handlers/bigquery_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...
153
5,086
astropy
astropy/timeseries/core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from contextlib import contextmanager from functools import wraps from types import FunctionType from astropy.table import QTable __all__ = ["BaseTimeSeries", "autocheck_required_columns"] COLUMN_RELATED_METHODS = [ "add_column", "add_columns",...
104
3,526
probability
tensorflow_probability/python/distributions/stopping_ratio_logistic_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...
136
5,205
pyro
tests/infer/reparam/test_hmm.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro import pyro.distributions as dist from pyro import poutine from pyro.infer.reparam import ( LinearHMMReparam, StableReparam, StudentTReparam, SymmetricStableReparam, ) from tests....
298
12,130
cvxpy
cvxpy/reductions/solvers/solver.py
.py
""" Copyright 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
178
5,976
wandb
wandb/sdk/launch/create_job.py
.py
from __future__ import annotations import json import logging import os import re import sys import tempfile from typing import Any import wandb from wandb.apis.internal import Api from wandb.sdk.artifacts.artifact import Artifact from wandb.sdk.internal.job_builder import JobBuilder from wandb.sdk.launch.git_referen...
544
17,614
conda
tests/gateways/test_subprocess.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import pytest from pytest import CaptureFixture from conda.gateways.subprocess import subprocess_call, subprocess_call_with_clean_env def test_subprocess_call_without_capture_output(capfd: CaptureFixture): resp = subprocess_call( ...
54
1,546
onnx
onnx/reference/ops/aionnxml/op_tree_ensemble_helper.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np class TreeEnsembleAttributes: def __init__(self): self._names = [] def add(self, name, value): if not name.endswith("_as_tensor"): self._names.ap...
104
3,591
beam
sdks/python/apache_beam/io/gcp/gcsio_retry_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...
89
3,020
openvino
src/bindings/python/tests/test_runtime/test_output_const_node.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from copy import copy, deepcopy import openvino.opset13 as ops from openvino import ( Shape, PartialShape, Type, Core, OVAny, ) from openvino import ( ConstOutput, Output...
169
5,096
beam
sdks/python/apache_beam/testing/test_stream_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...
1,053
41,025
beam
sdks/python/apache_beam/io/aws/s3filesystem.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...
329
10,761
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_use_deleted_voucher.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, voucher_delete, ) from ...utils import che...
127
3,545
confluent-kafka-python
tests/schema_registry/_sync/test_dlq_serdes.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...
649
26,171