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
orttraining/tools/ci_test/run_batch_size_test.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import collections import os import subprocess import sys def parse_args(): parser = argparse.ArgumentParser(description="Runs a BERT batch size test.") parser.add_argument("--...
118
3,499
pymc
tests/logprob/test_transform_value.py
.py
# Copyright 2024 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
642
20,786
probability
spinoffs/inference_gym/inference_gym/using_numpy.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...
24
823
pyomo
pyomo/contrib/trustregion/tests/test_examples.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...
87
4,439
pyomo
examples/pyomobook/optimization-ch/IC_model_dict.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...
62
1,931
wagtail
wagtail/documents/views/chooser.py
.py
from django import forms from django.core.exceptions import PermissionDenied from django.utils.functional import cached_property from django.utils.html import format_html from django.utils.translation import gettext_lazy as _ from django.views.generic.base import View from wagtail.admin.staticfiles import versioned_st...
229
7,097
probability
tensorflow_probability/python/stats/quantiles_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...
874
33,568
hatch
src/hatch/publish/plugin/hooks.py
.py
from hatch.publish.index import IndexPublisher from hatchling.plugin import hookimpl @hookimpl def hatch_register_publisher(): return IndexPublisher
8
155
scikit-optimize
examples/plots/partial-dependence-plot-with-categorical.py
.py
""" ================================================= Partial Dependence Plots with categorical values ================================================= Sigurd Carlsen Feb 2019 Holger Nahrstaedt 2020 .. currentmodule:: skopt Plot objective now supports optional use of partial dependence as well as different methods...
98
3,741
black
tests/data/cases/context_managers_39.py
.py
with \ make_context_manager1() as cm1, \ make_context_manager2() as cm2, \ make_context_manager3() as cm3, \ make_context_manager4() as cm4 \ : pass # Leading comment with \ make_context_manager1() as cm1, \ make_context_manager2(), \ make_context_manager3() as cm3, \ make_...
186
3,560
coremltools
coremltools/converters/mil/backend/nn/passes/test_mlmodel_passes.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 import unittest from sys import platform import numpy as np import coremltools.models.d...
1,053
37,208
readthedocs.org
readthedocs/subscriptions/tests/test_views.py
.py
from unittest import mock import requests_mock from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.urls import reverse from django.utils import timezone from django_dynamic_fixture import get from djstripe import models as djstrip...
226
8,740
mlflow
examples/flower_classifier/image_pyfunc.py
.py
""" Example of a custom python function implementing image classifier with image preprocessing embedded in the model. """ import base64 import importlib.metadata import os from io import BytesIO from typing import Any import keras import numpy as np import pandas as pd import PIL import tensorflow as tf import yaml f...
194
6,708
kafka
tests/kafkatest/services/kafka/quorum.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 ...
157
7,240
openvino
src/bindings/python/tests/test_runtime/test_tensor_string.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino as ov import pytest from enum import Enum class DataGetter(Enum): BYTES = 1 STRINGS = 2 def _check_tensor_string(tensor_data, test_data): assert tensor_data.sha...
300
10,871
saleor
saleor/tests/e2e/checkout/utils/checkout_create.py
.py
from ... import DEFAULT_ADDRESS from ...account.utils.fragments import ADDRESS_FRAGMENT from ...utils import get_graphql_content CHECKOUT_CREATE_MUTATION = ( """ mutation CreateCheckout($input: CheckoutCreateInput!) { checkoutCreate(input: $input) { errors { field code message } che...
190
3,574
mlflow
mlflow/store/artifact/databricks_artifact_repo.py
.py
import base64 import json import logging import os import posixpath import tempfile import uuid from pathlib import Path from typing import Any import requests import mlflow.tracking from mlflow.azure.client import ( patch_adls_file_upload, patch_adls_flush, put_adls_file_creation, put_block, put_...
938
39,084
pyomo
pyomo/core/tests/unit/test_set.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...
6,809
242,729
pymc
pymc/step_methods/hmc/__init__.py
.py
# Copyright 2024 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
19
742
onnx
onnx/backend/test/case/node/cosh.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Cosh(Base): @staticmethod def export() -> None: node =...
29
769
astropy
astropy/constants/codata2022.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants in SI units. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ import math from .constant import Constant, EMConstant # PHYSICAL CONSTANTS # https://en.wikipedia.org/wiki/201...
155
3,793
onnx
onnx/backend/test/case/node/cumsum.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class CumSum(Base): @staticmethod def export_cumsum_1d() -> None: ...
113
4,319
sphinx
sphinx/writers/html.py
.py
"""docutils writers handling Sphinx' custom nodes.""" from __future__ import annotations from typing import TYPE_CHECKING, cast from docutils.writers import html4css1 from sphinx.util import logging from sphinx.writers.html5 import HTML5Translator if TYPE_CHECKING: from sphinx.builders.html import StandaloneHT...
63
1,933
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_global_maxpool3D.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 TestKerasGlobalMaxPool3D(CommonTF2LayerTest): def create_keras_global_maxpool3D_net(self, input_names, input_shapes, input_type...
41
1,723
biopython
Tests/test_BioSQL_psycopg2_online.py
.py
# 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. """Run BioSQL tests using PostgreSQL.""" import unittest import requires_internet # Really do want "import *" to get all the test classes: from comm...
34
1,025
mlflow
mlflow/store/model_registry/file_store.py
.py
import logging import os import shutil import sys import time import urllib from os.path import join from mlflow.entities.model_registry import ( ModelVersion, ModelVersionTag, RegisteredModel, RegisteredModelAlias, RegisteredModelTag, ) from mlflow.entities.model_registry.model_version_stages impo...
1,116
45,571
coremltools
deps/pybind11/tests/test_builtin_casters.py
.py
from __future__ import annotations import sys import pytest import env from pybind11_tests import IncType, UserType from pybind11_tests import builtin_casters as m def test_simple_string(): assert m.string_roundtrip("const char *") == "const char *" def test_unicode_conversion(): """Tests unicode convers...
531
17,279
saleor
saleor/graphql/payment/tests/mutations/conftest.py
.py
import pytest from .....app.models import App @pytest.fixture def transaction_request_webhook(permission_manage_payments): app = App.objects.create( name="Sample app objects", is_active=True, identifier="saleor.app.payment", ) app.permissions.set([permission_manage_payments]) ...
19
462
wagtail
wagtail/permission_policies/collections.py
.py
from django.contrib.auth import get_permission_codename, get_user_model from django.contrib.auth.models import Group from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured from django.db.models import Q from wagtail.models import Collection, GroupCollectionPermission from .base import BaseDjangoAu...
495
20,817
jupytext
tests/functional/metadata/test_metadata_filter.py
.py
from copy import deepcopy import pytest from nbformat.v4.nbbase import new_code_cell, new_notebook from jupytext import reads, writes from jupytext.cli import jupytext as jupytext_cli from jupytext.compare import compare, compare_notebooks from jupytext.metadata_filter import filter_metadata, metadata_filter_as_dict ...
206
6,372
loguru
tests/test_coroutine_sink.py
.py
import asyncio import logging import multiprocessing import re import sys import threading import pytest from loguru import logger from .conftest import new_event_loop_context, set_event_loop_context async def async_writer(msg): await asyncio.sleep(0.01) print(msg, end="") class AsyncWriter: async de...
678
16,966
onnxruntime
onnxruntime/test/python/transformers/test_embedlayer_fusion.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import ...
112
5,429
conda
tests/_private/test_exception_guidance.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import pytest from conda import CondaError from conda._private.exception_guidance import ErrorGuidance, GuidanceHint def test_GuidanceHint() -> None: hint = GuidanceHint("Do the thing.", "do_the_thing")...
268
7,408
returns
tests/test_contrib/test_hypothesis/test_laws/test_wrong_custom_type_with_init.py
.py
from collections.abc import Callable from typing import TypeVar import pytest from returns.contrib.hypothesis.laws import check_all_laws from returns.interfaces import mappable from returns.primitives.container import BaseContainer from returns.primitives.hkt import SupportsKind1 pytestmark = pytest.mark.xfail(raise...
37
925
onnxruntime
tools/python/wgsl_template/types.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Shared data structures for the WGSL template engine.""" from __future__ import annotations from dataclasses import dataclass, field @dataclass class CodeReference: """Where a parsed line came from in the original so...
88
2,091
hydra
tests/test_apps/run_dir_test/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import time from pathlib import Path from omegaconf import DictConfig import hydra from hydra.core.hydra_config import HydraConfig from hydra.utils import get_original_cwd @hydra.main() def my_app(_: DictConfig) -> None: run_dir = str(Path.c...
22
523
metrics
tests/unittests/clustering/test_mutual_info_score.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
82
3,161
textual
src/textual/demo/widgets.py
.py
from __future__ import annotations import csv import io from math import sin from rich.syntax import Syntax from rich.table import Table from rich.traceback import Traceback from textual import containers, events, lazy, on from textual.app import ComposeResult from textual.binding import Binding from textual.demo.da...
823
23,870
pyomo
pyomo/core/plugins/transform/kkt.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...
257
9,306
textual
docs/examples/guide/reactivity/set_reactive03.py
.py
from textual.app import App, ComposeResult from textual.reactive import reactive from textual.widgets import Input, Label class MultiGreet(App): names: reactive[list[str]] = reactive(list, recompose=True) # (1)! def compose(self) -> ComposeResult: yield Input(placeholder="Give me a name") fo...
22
609
beam
sdks/python/apache_beam/examples/snippets/snippets_examples_wordcount_wordcount.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");...
103
3,228
coremltools
deps/pybind11/tests/test_thread.py
.py
from __future__ import annotations import threading from pybind11_tests import thread as m class Thread(threading.Thread): def __init__(self, fn): super().__init__() self.fn = fn self.e = None def run(self): try: for i in range(10): self.fn(i, i) ...
45
862
coveragepy
coverage/sqlitedb.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """SQLite abstraction for coverage.py""" from __future__ import annotations import contextlib import re import sqlite3 from collections.abc import Iterable, Ite...
224
9,258
wandb
tests/system_tests/test_functional/asyncio_manager_run/interrupt_run.py
.py
"""Tests that interrupting run() cancels its task, but not others.""" import asyncio import sys from wandb.sdk.lib import asyncio_manager _queue: asyncio.Queue[str] async def _init() -> None: global _queue _queue = asyncio.Queue() async def _print_queue() -> None: while s := await _queue.get(): ...
50
1,104
sqlmap
lib/core/log.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import logging import re import sys from lib.core.enums import CUSTOM_LOGGING logging.addLevelName(CUSTOM_LOGGING.PAYLOAD, "PAYLOAD") logging.addLevelName(CUSTOM_LOGGING.TRAFFIC...
117
5,488
marshmallow
tests/test_context.py
.py
import typing import pytest from marshmallow import ( Schema, fields, post_dump, post_load, pre_dump, pre_load, validates, validates_schema, ) from marshmallow.exceptions import ValidationError from marshmallow.experimental.context import Context from tests.base import Blog, User cla...
252
8,390
coremltools
coremltools/test/api/test_api_examples.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy import os import platform import shutil import tempfile from collections import Counter from...
980
39,103
loguru
tests/test_multiprocessing.py
.py
import copy import multiprocessing import os import platform import sys import threading import time import pytest from loguru import logger from .conftest import new_event_loop_context @pytest.fixture def fork_context(): return multiprocessing.get_context("fork") @pytest.fixture def spawn_context(): ret...
633
16,900
pymc
pymc/logprob/binary.py
.py
# Copyright 2024 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
162
5,322
black
tests/data/cases/trailing_comma_optional_parens2.py
.py
if (e123456.get_tk_patchlevel() >= (8, 6, 0, 'final') or (8, 5, 8) <= get_tk_patchlevel() < (8, 6)): pass # output if e123456.get_tk_patchlevel() >= (8, 6, 0, "final") or ( 8, 5, 8, ) <= get_tk_patchlevel() < (8, 6): pass
13
248
textual
src/textual/demo/page.py
.py
from __future__ import annotations import inspect from rich.syntax import Syntax from textual import work from textual.app import ComposeResult from textual.binding import Binding from textual.containers import ScrollableContainer from textual.screen import ModalScreen, Screen from textual.widgets import Static cl...
95
2,527
qutip
qutip/tests/test_simdiag.py
.py
import pytest import numpy as np import qutip @pytest.mark.flaky(reruns=2) @pytest.mark.parametrize('num_mat', [1, 2, 3, 5]) def test_simdiag(num_mat): N = 10 U = qutip.rand_unitary(N) commuting_matrices = [U * qutip.qdiags(np.random.rand(N), 0) * U.dag() for _ in range(num_mat)...
122
3,800
mlflow
tests/resources/data/dataset_source.py
.py
from typing import Any from urllib.parse import urlparse from mlflow.artifacts import download_artifacts from mlflow.data.dataset_source import DatasetSource from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE class SampleDatasetSource(DatasetSource): de...
55
1,522
biopython
Bio/PDB/mmtf/DefaultParser.py
.py
# Copyright 2016 Anthony Bradley. 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 handle loading mmt...
232
8,888
saleor
saleor/graphql/account/tests/mutations/account/test_account_address_delete.py
.py
from unittest.mock import patch import graphene import pytest from freezegun import freeze_time from ......webhook.event_types import WebhookEventAsyncType from .....tests.utils import assert_no_permission, get_graphql_content from ..utils import generate_address_webhook_call_args ACCOUNT_ADDRESS_DELETE_MUTATION = "...
84
2,721
textual
docs/examples/guide/reactivity/recompose01.py
.py
from datetime import datetime from textual.app import App, ComposeResult from textual.reactive import reactive from textual.widgets import Digits class Clock(App): CSS = """ Screen {align: center middle} Digits {width: auto} """ time: reactive[datetime] = reactive(datetime.now, init=False) ...
33
717
mlflow
tests/demo/test_api_routes.py
.py
from pathlib import Path import pytest import requests import mlflow from mlflow.server import handlers from mlflow.server.fastapi_app import app from mlflow.server.handlers import initialize_backend_stores from tests.helper_functions import get_safe_port from tests.tracking.integration_test_utils import ServerThrea...
104
3,413
clearml
clearml/utilities/seed.py
.py
import random import sys try: import numpy as np except Exception: np = None def make_deterministic(seed: int = 1337, cudnn_deterministic: bool = False) -> None: """ Ensure deterministic behavior across PyTorch using the provided random seed. This function makes sure that torch, numpy and random ...
72
2,173
textual
tests/snapshot_tests/snapshot_apps/rules.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical from textual.widgets import Rule RULE_STYLES = [ "ascii", "blank", "dashed", "double", "heavy", "hidden", "none", "solid", "thick", ] class RuleApp(App): def compose(self) -> Compose...
31
628
mlflow
tests/langchain/sample_code/no_config/chain.py
.py
import os from typing import Any # See `tests/langchain/sample_code/chain.py` for why fake creds are set. os.environ.setdefault("DATABRICKS_HOST", "https://fake-host") os.environ.setdefault("DATABRICKS_TOKEN", "fake-token") from databricks_langchain import ChatDatabricks from langchain_community.document_loaders impo...
68
2,281
beam
sdks/python/apache_beam/yaml/yaml_specifiable_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...
119
3,962
onnxruntime
onnxruntime/python/tools/transformers/onnx_model_tnlr.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging from fusion_attention import AttentionMask, FusionAttent...
227
8,179
openvino
src/bindings/python/tests/test_graph/test_roll.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset8 as ov import numpy as np def test_roll(): input_vals = np.reshape(np.arange(10), (2, 5)) input_tensor = ov.constant(input_vals) input_shift = ov.constant(np.array([-10, 7], dty...
19
610
django-cms
cms/forms/utils.py
.py
from django.contrib.sites.models import Site from django.db.models import Prefetch from django.db.models.signals import post_delete, post_save from django.utils.html import escape from django.utils.safestring import mark_safe from cms.cache.choices import ( _page_cache_key, _site_cache_key, clean_page_choi...
108
3,337
hydra
plugins/hydra_joblib_launcher/example/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import os import time import hydra from omegaconf import DictConfig log = logging.getLogger(__name__) @hydra.main(config_path=".", config_name="config") def my_app(cfg: DictConfig) -> None: log.info(f"Process ID {os.getpid()} ...
21
413
conda
conda/auxlib/logz.py
.py
import json from itertools import islice from logging import getLogger, INFO, Formatter, StreamHandler, DEBUG from sys import stderr from . import NullHandler from ..deprecations import deprecated log = getLogger(__name__) root_log = getLogger() NullHandler = NullHandler DEBUG_FORMATTER = Formatter( "[%(levelna...
199
6,467
saleor
saleor/graphql/payment/tests/deprecated/test_checkout_payment_create.py
.py
import graphene from .....checkout import calculations from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from .....payment.error_codes import PaymentErrorCode from .....payment.models import ChargeStatus, Payment from .....plugins.manager import get_plugins_manager from ....tests.utils import g...
139
4,590
mlflow
dev/flavors/tests/test_matrix.py
.py
import asyncio import functools import re import tempfile from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path from typing import Any, Callable, ParamSpec, TypeVar from unittest import mock import pytest pytestmark = pytest.mark.skip( reason="Disabled by #21985: dev ...
175
5,585
coremltools
coremltools/proto/BayesianProbitRegressor_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: BayesianProbitRegressor.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _m...
69
4,413
wagtail
wagtail/tests/test_page_search.py
.py
from unittest import mock from django.conf import settings from django.db.models import F from django.test import TestCase, override_settings from wagtail.search import index from wagtail.search.backends import get_search_backend from wagtail.search.backends.base import ( BaseSearchQueryCompiler, BaseSearchRe...
121
4,205
ipython
IPython/external/pickleshare.py
.py
""" Vendoring of pickleshare, reduced to used functionalities. --- PickleShare - a small 'shelve' like datastore with concurrency support Like shelve, a PickleShareDB object acts like a normal dictionary. Unlike shelve, many processes can access the database simultaneously. Changing a value in database is immediatel...
297
8,701
conda
tests/common/pkg_formats/test_python.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Test for python distribution information and metadata handling.""" import os import tempfile from errno import ENOENT from os.path import basename from pathlib import Path from pprint import pprint import pytest from conda.common.path impo...
722
24,876
structlog
src/structlog/tracebacks.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. """ Extract a structured traceback from an exception. Based on work by Will McGugan <https:/...
526
16,769
wandb
wandb/apis/public/registries/_freezable_list.py
.py
from __future__ import annotations from collections.abc import Iterable, Iterator, MutableSequence, Sequence from itertools import chain from typing import Any, TypeVar, overload from wandb._strutils import nameof T = TypeVar("T") class FreezableList(MutableSequence[T]): """A list-like container type that only...
169
6,299
textual
tests/test_keymap.py
.py
from __future__ import annotations from typing import Any from textual.app import App, ComposeResult from textual.binding import Binding, Keymap from textual.dom import DOMNode from textual.widget import Widget from textual.widgets import Label class Counter(App[None]): BINDINGS = [ Binding(key="i,up", ...
220
6,410
beam
sdks/python/apache_beam/io/avroio_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...
953
37,372
wandb
tests/system_tests/test_functional/terminput/test_terminput.py
.py
from __future__ import annotations import os import pathlib import subprocess import time from collections.abc import Sequence import click import pytest # Will skip on Windows. pytest.importorskip("pty") import pty # Import using normal syntax for IDE support. _TESTER_SCRIPT = pathlib.Path(__file__).parent / "ter...
235
7,324
pyomo
pyomo/tpl/ply/yacc.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...
3,487
136,997
conda
conda/cli/main_rename.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI implementation for `conda rename`. Renames an existing environment by cloning it and then removing the original environment. """ from __future__ import annotations import os from functools import partial from typing import TYPE_CHECKIN...
132
3,950
saleor
saleor/checkout/tests/test_base_calculations.py
.py
from decimal import Decimal from prices import Money, TaxedMoney from ...discount import DiscountValueType, RewardValueType, VoucherType from ...discount.models import PromotionRule from ...plugins.manager import get_plugins_manager from ...tax.utils import calculate_tax_rate from ..base_calculations import ( bas...
853
30,350
django-cms
cms/test_utils/project/sampleapp/urls_example.py
.py
from django.urls import re_path from ..placeholderapp import views app_name = 'example_app' urlpatterns = [ re_path(r'^example/$', views.example_view, name="example"), ]
10
177
beam
sdks/python/apache_beam/coders/row_coder.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...
213
8,178
funcy
funcy/types.py
.py
from collections.abc import Mapping, Set, Sequence, Iterator, Iterable __all__ = ('isa', 'is_mapping', 'is_set', 'is_seq', 'is_list', 'is_tuple', 'is_seqcoll', 'is_seqcont', 'iterable', 'is_iter') def isa(*types): """ Creates a function checking if its argument is of any of given t...
27
614
qutip
qutip/solver/options.py
.py
__all__ = [] import warnings import weakref class _SolverOptions(dict): """ Class to hold options for solver and integrator. Parameters ---------- default : dict Default dict, only keys in this will be accepted. on_update : callable, ``f(keys : set) -> None``, optional Functi...
117
3,472
openvino
src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/constants.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from sys import platform TEST_STATUS = { 'passed': ["[ OK ]"], 'failed': ["[ FAILED ]"], 'hanged': ["Test finished by timeout"], 'crashed': ["Unexpected application crash with code", "Segmentation fault", "Crash ...
72
1,769
hatch
backend/src/hatchling/metadata/spec.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, Any from hatchling.metadata.utils import split_import_name_annotation if TYPE_CHECKING: from collections.abc import Callable from hatchling.metadata.core import ProjectMetadata DEFAULT_METADATA_VERSION = "2.5" LATEST_METADATA_VERSION = "2...
729
28,970
lemur
lemur/plugins/lemur_aws/tests/test_acm.py
.py
from moto import mock_acm, mock_sts from lemur.common.utils import check_validation from lemur.tests.vectors import ROOTCA_CERT_STR, INTERMEDIATE_CERT_STR, SAN_CERT_STR, SAN_CERT_KEY def test_acm_source_certificates(app): from lemur.plugins.base import plugins p = plugins.get("aws-acm-source") assert p ...
55
1,468
pyro
pyro/infer/autoguide/utils.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import functools from contextlib import contextmanager from pyro import poutine from pyro.nn.module import PyroModule def _product(shape): """ Computes the product of the dimensions of a given shape tensor """ re...
87
2,979
openvino
tests/layer_tests/pytorch_tests/test_angle.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestAngle(PytorchLayerTest): def _prepare_input(self, complex_type): shape = (5, 6, 7) if complex_type: shape...
42
1,326
saleor
saleor/graphql/shipping/dataloaders.py
.py
from collections import defaultdict from django.db.models import Exists, F, OuterRef, Q from ...channel.models import Channel from ...shipping.models import ( ShippingMethod, ShippingMethodChannelListing, ShippingMethodPostalCodeRule, ShippingZone, ) from ..channel.dataloaders.by_self import ChannelBy...
247
9,077
saleor
saleor/graphql/product/tests/test_bulk_delete.py
.py
from unittest.mock import MagicMock, patch import graphene import pytest from django.core.files import File from django.utils import timezone from prices import Money, TaxedMoney from ....attribute.models import AttributeValue from ....attribute.utils import associate_attribute_values_to_instance from ....checkout.fe...
1,947
60,904
onnxruntime
tools/python/util/android/android.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from __future__ import annotations import collections import contextlib import datetime import os import signal import subprocess import time import typing from pathlib import Path from ..logger import get_logger from ..plat...
360
13,444
coremltools
coremltools/converters/mil/frontend/tensorflow2/test/test_tf2_conversion_api.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 itertools import os import platform from os import chdir, getcwd from shutil import rmtree fro...
550
21,884
sqlmap
lib/utils/keysetdump.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import re from lib.core.agent import agent from lib.core.bigarray import BigArray from lib.core.common import Backend from lib.core.common import isNoneValue from lib.core.common...
320
12,410
saleor
saleor/graphql/page/mutations/page_type_reorder_attributes.py
.py
import graphene from django.core.exceptions import ObjectDoesNotExist, ValidationError from ....core.tracing import traced_atomic_transaction from ....page import models as page_models from ....page.error_codes import PageErrorCode from ....permission.enums import PageTypePermissions from ...attribute.mutations import...
71
2,570
astropy
astropy/stats/spatial.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements functions and classes for spatial statistics. """ import math from typing import Literal, TypeAlias import numpy as np from numpy.typing import NDArray __all__ = ["RipleysKEstimator"] # TODO: consider replacing with `StrEnum`...
384
13,966
coremltools
coremltools/converters/mil/mil/ops/defs/iOS15/image_resizing.py
.py
# Copyright (c) 2022, 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 from coremltools.converters.mil.mil import (DefaultInputs, InputSpec, ...
897
34,112
wandb
wandb/sdk/artifacts/_generated/fetch_registries.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 PageInfoFragment, RegistryFragment class FetchRegistries(GQLResult): organization: FetchRegistriesOrganization | ...
39
1,135
wagtail
wagtail/snippets/tests/test_chooser_panel.py
.py
from django.contrib.auth.models import AnonymousUser from django.test import RequestFactory, TestCase from wagtail.admin.panels import FieldPanel, ObjectList, get_edit_handler from wagtail.snippets.widgets import AdminSnippetChooser from wagtail.test.testapp.models import ( Advert, AdvertWithCustomPrimaryKey, ...
152
5,884
wandb
wandb/sdk/lib/telemetry.py
.py
from __future__ import annotations import re import sys from contextlib import AbstractContextManager from types import TracebackType from typing import TYPE_CHECKING import wandb from wandb.proto.wandb_telemetry_pb2 import Imports as TelemetryImports from wandb.proto.wandb_telemetry_pb2 import TelemetryRecord # avo...
104
2,765