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
wandb
tests/system_tests/test_notebooks/test_notebooks.py
.py
import io import json import os import pathlib import re import subprocess import sys from unittest import mock import nbformat import pytest import wandb import wandb.sdk.lib.ipython as wb_ipython import wandb.util def test_login_timeout(notebook): with notebook("login_timeout.ipynb", skip_api_key_env=True) as ...
287
9,624
hydra
tools/configen/configen/configen.py
.py
import inspect import logging import os import pkgutil import sys from dataclasses import dataclass from enum import Enum from pathlib import Path # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from textwrap import dedent from typing import Any, Dict, List, Optional, Set, Type, cast, get_type_h...
268
8,079
lemur
lemur/plugins/lemur_acme/nsone.py
.py
"""ACME DNS providor for NS1""" import json import inspect import time import requests from flask import current_app from sentry_sdk import capture_exception from lemur.common import utils import lemur.dns_providers.util as dnsutil from lemur.extensions import metrics REQUIRED_VARIABLES = [ "ACME_NSONE_KEY", ] ...
361
9,980
pyomo
pyomo/contrib/viewer/ui.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...
383
14,021
loguru
tests/test_repr.py
.py
import logging import pathlib import re import sys from loguru import logger def test_no_handler(): assert repr(logger) == "<loguru.logger handlers=[]>" def test_stderr(): logger.add(sys.__stderr__) assert repr(logger) == "<loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>" def test_stdout():...
192
4,984
pyomo
pyomo/solvers/tests/piecewise_linear/kernel_problems/piecewise_var.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...
50
1,486
textual
src/textual/widgets/_sparkline.py
.py
from __future__ import annotations from typing import Callable, ClassVar, Optional, Sequence from textual.app import RenderResult from textual.color import Color from textual.reactive import reactive from textual.renderables.sparkline import Sparkline as SparklineRenderable from textual.widget import Widget def _ma...
110
3,884
metrics
tests/unittests/retrieval/test_recall.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...
206
7,641
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/map_function.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");...
63
1,781
coremltools
coremltools/test/sklearn_tests/test_imputer.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import unittest import numpy as np import numpy.random as rn from packaging.version import Version fro...
79
2,526
saleor
saleor/warehouse/validation.py
.py
from ..shipping.models import ShippingZone from .models import Warehouse def validate_warehouse_count(shipping_zones, instance: Warehouse) -> bool: """Every ShippingZone can be assigned to only one warehouse. If not there would be issue with automatically selecting stock for operation. """ warehouse...
25
730
pyomo
pyomo/core/base/logical_constraint.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...
493
16,733
pyomo
pyomo/contrib/pynumero/sparse/mpi_block_vector.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...
1,388
52,061
readthedocs.org
readthedocs/oauth/migrate.py
.py
"""This module contains the logic to help users migrate from the GitHub OAuth App to the GitHub App.""" from dataclasses import dataclass from functools import cached_property from typing import Iterator from urllib.parse import urlencode from allauth.socialaccount.models import SocialAccount from allauth.socialaccou...
412
14,912
openvino
tests/layer_tests/tensorflow_tests/test_tf_TruncateMod.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestTruncateMod(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'x:0' in inputs_info ...
50
1,910
probability
tensorflow_probability/python/experimental/marginalize/logeinsumexp.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...
240
8,536
pyomo
examples/pyomo/suffixes/gurobi_ampl_basis.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...
115
3,880
pdm
tests/cli/test_fix.py
.py
import sys from pathlib import Path def test_fix_non_existing_problem(project, pdm): result = pdm(["fix", "non-existing"], obj=project) assert result.exit_code == 1 def test_fix_individual_problem(project, pdm): project._saved_python = None old_config = project.root / ".pdm.toml" old_config.writ...
74
3,029
astropy
astropy/modeling/_fitting_parallel.py
.py
import traceback import warnings from copy import deepcopy from math import ceil, log10, prod from pathlib import Path import numpy as np import astropy.units as u from astropy.modeling.utils import _combine_equivalency_dict from astropy.nddata import NDUncertainty, StdDevUncertainty, support_nddata from astropy.wcs....
779
30,533
mlflow
examples/spark_udf/spark_udf_datetime.py
.py
import datetime import random from pyspark.sql import SparkSession from sklearn.compose import ColumnTransformer from sklearn.datasets import load_iris from sklearn.neighbors import KNeighborsClassifier from sklearn.pipeline import Pipeline from sklearn.preprocessing import FunctionTransformer import mlflow def pri...
68
2,221
clearml
examples/datasets/dataset_folder_syncing.py
.py
import shutil from uuid import uuid4 from pathlib2 import Path from clearml import Dataset, StorageManager def download_mnist_dataset(): manager = StorageManager() mnist_dataset = Path( manager.get_local_copy(remote_url="https://allegro-datasets.s3.amazonaws.com/datasets/MNIST.zip", name="MNIST") ...
53
1,591
metrics
tests/unittests/text/_inputs.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...
140
5,195
biopython
Tests/test_PDB_CEAligner.py
.py
# Copyright 2022 by Joao Rodrigues. 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. """Unit tests for the Bio...
112
3,605
pyomo
examples/dae/ReactionKinetics.py
.py
#!/usr/bin/env python # ____________________________________________________________________________________ # # 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 Engi...
436
14,740
openvino
tests/layer_tests/tensorflow_tests/test_tf_Softsign.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from common.tf_layer_test_class import CommonTFLayerTest class TestSoftsign(CommonTFLayerTest): def create_softsign_net(self, shape, ir_version): import tensorflow as tf tf.compat.v1.reset_default_gra...
38
1,318
pyomo
pyomo/opt/__init__.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...
71
1,753
saleor
saleor/tests/e2e/orders/utils/order_cancel.py
.py
from saleor.graphql.tests.utils import get_graphql_content ORDER_CANCEL_MUTATION = """ mutation OrderCancel($id: ID!) { orderCancel(id: $id) { errors { message field } order { id status paymentStatus isPaid totalBalance { amount } total { ...
43
729
readthedocs.org
readthedocs/api/v2/proxied_urls.py
.py
""" Proxied API URLs. Served from the same domain docs are served, so they can make use of features that require to have access to their cookies. """ from django.urls import path from readthedocs.analytics.proxied_api import AnalyticsView from readthedocs.api.v2.views.proxied import ProxiedEmbedAPI from readthedocs....
22
641
confluent-kafka-python
tests/avro/data_gen.py
.py
#!/usr/bin/env python # # Copyright 2016 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
101
2,738
metrics
src/torchmetrics/regression/wmape.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...
129
4,848
onnxruntime
onnxruntime/test/testdata/transform/fusion/layer_norm_with_cast_3.py
.py
import onnx from onnx import OperatorSetIdProto, TensorProto, helper def GenerateModel(model_name): # noqa: N802 nodes = [ # LayerNormWithCast3 subgraph helper.make_node("ReduceMean", ["A"], ["rd1_out"], "reduce", axes=[-1]), helper.make_node("Sub", ["A", "rd1_out"], ["sub1_out"], "sub"), ...
103
4,299
wandb
wandb/sdk/artifacts/_internal_artifact.py
.py
from __future__ import annotations import re from base64 import urlsafe_b64encode from typing import Any, Final from zlib import crc32 from wandb.sdk.artifacts.artifact import Artifact PLACEHOLDER: Final[str] = "PLACEHOLDER" def sanitize_artifact_name(name: str) -> str: """Sanitize the string to satisfy constr...
55
1,923
scikit-bio
skbio/table/_tabular.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. # --------------------------------------------...
301
10,607
astropy
astropy/utils/xml/setup_package.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import sys from collections import defaultdict from os.path import join from setuptools import Extension from extension_helpers import pkg_config def get_extensions(build_type="release"): XML_DIR = "astropy/utils/xml/src" cfg = defa...
49
1,656
wagtail
wagtail/embeds/signal_handlers.py
.py
from django.core.signals import setting_changed from django.dispatch import receiver from .finders import get_finders @receiver(setting_changed) def clear_embed_caches(*, setting: str, **kwargs: dict) -> None: """ Clear the embed caches when settings change """ if setting == "WAGTAILEMBEDS_FINDERS": ...
14
354
saleor
saleor/translations/error_codes.py
.py
from enum import Enum class AttributeTranslateErrorCode(Enum): GRAPHQL_ERROR = "graphql_error" INVALID = "invalid" NOT_FOUND = "not_found" REQUIRED = "required" class AttributeValueTranslateErrorCode(Enum): GRAPHQL_ERROR = "graphql_error" INVALID = "invalid" NOT_FOUND = "not_found" R...
30
658
saleor
saleor/graphql/payment/tests/mutations/test_payment_initialize.py
.py
import json from unittest.mock import patch from .....payment import PaymentError from .....payment.interface import InitializedPaymentResponse from .....plugins.manager import PluginsManager from ....tests.utils import get_graphql_content PAYMENT_INITIALIZE_MUTATION = """ mutation PaymentInitialize( $gateway: St...
112
3,502
onnxruntime
onnxruntime/test/python/quantization/test_quantizeblockwise_bnb4.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
136
5,285
dirty-equals
dirty_equals/_utils.py
.py
__all__ = 'plain_repr', 'PlainRepr', 'Omit', 'get_dict_arg' from typing import Any class PlainRepr: """ Hack to allow repr of string without quotes. """ def __init__(self, v: str): self.v = v def __repr__(self) -> str: return self.v def plain_repr(v: str) -> PlainRepr: ret...
47
1,121
saleor
saleor/graphql/storefront_traffic.py
.py
import warnings from django.conf import settings from django.contrib.sites.models import Site from django.core.cache import cache from jwt import InvalidTokenError from ..account.models import User from ..core.auth import get_token_from_request from ..site.models import SiteSettings from .core import SaleorContext S...
105
3,872
beam
sdks/python/apache_beam/runners/direct/test_stream_impl.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...
366
13,759
wandb
tests/unit_tests/test_file/test_file_public_api.py
.py
from unittest import mock import wandb from pytest import fixture from wandb.apis.public.files import File from wandb.proto import wandb_api_pb2 as apb @fixture def mock_client(mocker) -> mock.MagicMock: return mocker.MagicMock() @fixture def termwarn_spy(mocker) -> mock.MagicMock: return mocker.spy(wandb,...
138
4,311
beam
sdks/python/apache_beam/typehints/schemas.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,514
51,300
beam
sdks/python/apache_beam/io/gcp/bigquery_file_loads_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,637
62,779
bazel
tools/build_defs/hash/sha256.py
.py
# Copyright 2015 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
38
1,335
confluent-kafka-python
src/confluent_kafka/avro/error.py
.py
#!/usr/bin/env python # # Copyright 2017 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
32
1,004
beam
learning/katas/python/Common Transforms/Aggregation/Mean/tests/test_task.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
35
1,184
saleor
saleor/graphql/account/tests/mutations/account/test_account_address_update.py
.py
from unittest.mock import patch import graphene 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_UPDATE_MUTATION = """ mutatio...
257
8,193
lemur
lemur/plugins/lemur_verisign/tests/test_verisign.py
.py
def test_get_certificates(app): from lemur.plugins.base import plugins p = plugins.get("verisign-issuer") def test_create_cis_authority(app): from lemur.plugins.lemur_verisign.plugin import VerisignIssuerPlugin options = { "name": "test Verisign authority" } digicert_root, intermedia...
15
482
saleor
saleor/graphql/order/tests/queries/test_order_can_finalize.py
.py
import datetime import graphene from .....order import OrderStatus from .....order.error_codes import OrderErrorCode from .....product.models import ProductVariant from ....tests.utils import get_graphql_content ORDER_CAN_FINALIZE_QUERY = """ query OrderQuery($id: ID!){ order(id: $id){ canFin...
191
6,302
textual
tests/snapshot_tests/snapshot_apps/grid_gutter.py
.py
from rich.markdown import Markdown from textual.app import App, ComposeResult from textual.containers import Grid, Vertical from textual.widgets import Label, TabbedContent, TabPane class FooApp(App): TITLE = "Demonstrator" CSS = """ Screen { align: center middle; } ...
43
1,322
astropy
astropy/cosmology/_src/tests/io/test_.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test that all expected methods are present, before I/O tests import. This file is weirdly named so that it's the first test of I/O. """ from astropy.cosmology.io import convert_registry, readwrite_registry def test_expected_readwrite_io(): """T...
34
855
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/log1p_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...
23
837
cvxpy
cvxpy/atoms/affine/conv.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...
231
7,253
coremltools
coremltools/test/optimize/torch/quantization/test_configure.py
.py
# Copyright (c) 2024, 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 math import operator from collections import OrderedDict from typing import List import pytes...
1,280
48,198
saleor
saleor/warehouse/tests/test_stock.py
.py
import pytest from ..models import Stock COUNTRY_CODE = "US" @pytest.fixture def variant_with_stocks_in_two_channels( variant, warehouses, shipping_zone, channel_USD, channel_PLN ): """Variant with stocks in warehouses across two channels. - warehouse_usd (warehouses[0]): linked to channel_USD and ship...
320
8,327
pymc
pymc/variational/minibatch_rv.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...
107
3,838
readthedocs.org
readthedocs/proxito/tests/test_redirects.py
.py
# Copied from .org test_redirects from django.test import override_settings from django_dynamic_fixture import get from readthedocs.builds.models import Version from readthedocs.projects.constants import PUBLIC, SINGLE_VERSION_WITHOUT_TRANSLATIONS from readthedocs.proxito.constants import RedirectType from readthedocs...
535
21,850
onnxruntime
onnxruntime/test/testdata/transform/fusion/bias_dropout_residual_gen.py
.py
import onnx from onnx import OperatorSetIdProto, TensorProto, helper # inputs/outputs A = helper.make_tensor_value_info("A", TensorProto.FLOAT, ["unk_1", "unk_2", 3072]) B = helper.make_tensor_value_info("B", TensorProto.FLOAT, [3072]) R = helper.make_tensor_value_info("R", TensorProto.FLOAT, ["unk_1", "unk_2", 3072])...
297
9,426
biopython
Bio/Graphics/GenomeDiagram/_CrossLink.py
.py
# Copyright 2011-2017 by Peter Cock. 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. """Genome Diagram Featu...
101
3,309
pyro
tests/distributions/test_torch_patch.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro.distributions as dist from tests.common import assert_close, requires_cuda @requires_cuda def test_dirichlet_grad_cuda(): concentration = torch.ones(3, requires_grad=True) dist.Diri...
36
1,025
sphinx
sphinx/search/_stopwords/pt.py
.py
# automatically generated by utils/generate-snowball.py # from https://github.com/snowballstem/snowball-website/raw/efb4ae4d65769fb1652acbe608c0c817e746c730/algorithms/portuguese/stop.txt from __future__ import annotations PORTUGUESE_STOPWORDS = frozenset({ 'a', 'ao', 'aos', 'aquela', 'aquelas', ...
211
2,951
conda
tests/test_deferred_exceptions_imports.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Verify that importing conda.exceptions does not eagerly load heavy deps. These imports are only needed when formatting specific error messages, not when defining exception classes. """ from __future__ import annotations import subprocess i...
45
1,179
sqlmap
lib/core/subprocessng.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from __future__ import division import errno import os import subprocess import time from lib.core.compat import buffer from lib.core.convert import getBytes from lib.core.setti...
208
5,955
wagtail
wagtail/test/utils/decorators.py
.py
from functools import wraps class disconnect_signal_receiver: """ A decorator that disconnects a signal's receiver during the execution of a test and reconnects it back at its end. """ def __init__(self, signal, receiver): self.signal = signal self.receiver = receiver def __c...
31
769
wagtail
wagtail/contrib/simple_translation/models.py
.py
from django.conf import settings from django.db.models import Model from django.utils.translation import gettext_lazy as _ from wagtail import hooks from wagtail.models import Locale class SimpleTranslation(Model): """ SimpleTranslation, dummy model to create the `submit_translation` permission. We need...
42
1,566
hatch
tests/cli/env/test_find.py
.py
import os import sys import pytest from hatch.project.core import Project from hatchling.utils.constants import DEFAULT_CONFIG_FILE def test_undefined(hatch, helpers, temp_dir, config_file): config_file.model.template.plugins["default"]["tests"] = False config_file.save() project_name = "My.App" w...
238
6,487
onnxruntime
onnxruntime/test/testdata/test_shape_data_propagation_with_shape_related_nodes_v2.py
.py
import onnx from onnx import TensorProto, helper # === Graph input/output === input_tensor = helper.make_tensor_value_info("input", TensorProto.FLOAT, ["batch", 3, "width", "height"]) output_tensor = helper.make_tensor_value_info("output", TensorProto.FLOAT, ["batch", 3, "width*height"]) # === Initializers === B = he...
60
2,644
voila
tests/app/cwd_test.py
.py
# tests the --template argument of voila import os import pytest @pytest.fixture def voila_notebook(notebook_directory): return os.path.join(notebook_directory, "cwd.ipynb") async def test_template_cwd(http_server_client, base_url): response = await http_server_client.fetch(base_url) html_text = respon...
16
388
django-cms
cms/utils/plugins.py
.py
import logging import sys from collections import OrderedDict, defaultdict, deque from collections.abc import Iterable, Sequence from copy import deepcopy from itertools import starmap from operator import itemgetter from django.db import models, transaction from django.http import HttpRequest from django.utils.transl...
561
23,397
openvino
docs/articles_en/assets/snippets/Bfloat16Inference.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino as ov import openvino.properties.device as device import openvino.properties.hint as hints from snippets import get_model model = get_model() #! [part0] core = ov.Core() cpu_optimization_capabilities = core.get_proper...
28
633
metrics
src/torchmetrics/classification/sensitivity_specificity.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...
376
18,702
scikit-bio
skbio/io/format/emptyfile.py
.py
r"""Empty Files (:mod:`skbio.io.format.emptyfile`) ============================================== .. currentmodule:: skbio.io.format.emptyfile This format exists to make debugging simpler, often an empty file is a mistake which can take an embarrassing amount of time to notice. This format has only a sniffer and no r...
40
1,179
probability
tensorflow_probability/python/monte_carlo/expectation.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...
193
7,267
wagtail
wagtail/admin/tests/pages/test_bulk_actions/test_bulk_publish.py
.py
from unittest import mock import swapper from django.contrib.auth.models import Permission from django.http import HttpRequest, HttpResponse from django.test import TestCase from django.urls import reverse from django.utils.translation import gettext_lazy as _ from wagtail.admin.views.pages.bulk_actions.page_bulk_act...
386
14,526
mlflow
tests/resources/db/initial_models.py
.py
# Snapshot of MLflow DB models as of the 0.9.1 release, prior to the first database migration. # This file corresponds to the first database schema that we can reasonably expect users to be # running and exists to test that the oldest database schema can be brought up-to-date. # Copied from https://github.com/mlflow/ml...
242
8,156
sqlmap
tests/test_threads.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Threading helpers in lib/core/threads.py: the thread-local data model, current-thread accessors, the exception-isolating wrapper, and runThreads() (the worker-pool driver used through...
173
5,888
saleor
saleor/graphql/order/tests/test_utils.py
.py
import pytest from ....account.models import Address from ....order import OrderStatus from ....order.utils import invalidate_order_prices from ..mutations.utils import save_addresses @pytest.mark.parametrize( ("status", "invalid_prices"), [ (OrderStatus.DRAFT, True), (OrderStatus.UNCONFIRMED...
108
2,780
saleor
saleor/webhook/transport/asynchronous/tests/test_create_deliveries_for_subscriptions.py
.py
import json from unittest import mock import graphene from django.test import override_settings from .....graphql.webhook.subscription_payload import ( generate_payload_promise_from_subscription, ) from .....webhook.event_types import WebhookEventAsyncType from .....webhook.models import Webhook from ..transport ...
215
6,895
pyomo
pyomo/solvers/tests/mip/__init__.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...
12
576
pyomo
pyomo/dataportal/process_data.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,067
33,449
beam
sdks/python/apache_beam/examples/cookbook/ordered_window_elements/batch_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...
334
13,033
sphinx
tests/roots/test-roles-download/conf.py
.py
latex_documents = [ ( 'index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report', ) ]
10
161
astropy
astropy/cosmology/_src/tests/traits/__init__.py
.py
"""Test package for cosmology trait tests.""" __all__ = []
4
60
conda
conda/notices/fetch.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Notices network fetch logic.""" from __future__ import annotations import logging from concurrent.futures import ThreadPoolExecutor from typing import TYPE_CHECKING import requests # noqa: TID253 from ..gateways.connection.session import...
83
2,635
mlflow
dev/clint/tests/test_ignore_map.py
.py
from clint.linter import DisableComment, parse_comments def _parse(code: str) -> list[DisableComment]: disables, _ = parse_comments(code) return disables def test_single_rule() -> None: code = """ x = 1 # clint: disable=rule-a y = 2 """ assert _parse(code) == [DisableComment("rule-a", 1, 9, 1)] d...
79
1,895
coremltools
coremltools/proto/Parameters_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: Parameters.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 _message from g...
72
3,455
textual
tests/test_screens.py
.py
from __future__ import annotations import asyncio import sys import threading import pytest from textual import work from textual.app import App, ComposeResult, ScreenStackError from textual.events import MouseMove from textual.geometry import Offset from textual.screen import Screen from textual.widgets import Butt...
626
18,384
pymc
tests/distributions/test_timeseries.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...
966
34,711
textual
src/textual/drivers/web_driver.py
.py
""" The Remote driver uses the following packet structure. 1 byte for packet type. "D" for data, "M" for meta. 4 byte little endian integer for the size of the payload. Arbitrary payload. """ from __future__ import annotations import asyncio import json import os import signal import sys from codecs import getinc...
355
12,324
scikit-bio
skbio/diversity/alpha/tests/test_pd.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. # --------------------------------------------...
404
16,355
mlflow
mlflow/tracking/multimedia.py
.py
""" Internal module implementing multi-media objects and utilities in MLflow. Multi-media objects are exposed to users at the top-level :py:mod:`mlflow` module. """ import warnings from typing import TYPE_CHECKING, Any, Union if TYPE_CHECKING: import numpy import PIL COMPRESSED_IMAGE_SIZE = 256 def compre...
207
6,266
probability
discussion/neutra/neutra_kernel.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...
437
16,638
saleor
saleor/graphql/csv/mutations/export_products.py
.py
from typing import cast import graphene from django.core.exceptions import ValidationError from ....channel import models as channel_models from ....csv import models as csv_models from ....csv.events import export_started_event from ....csv.tasks import export_products_task from ....permission.enums import ProductPe...
202
6,937
beam
sdks/python/apache_beam/utils/counters_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...
169
5,202
probability
tensorflow_probability/python/experimental/mcmc/elliptical_slice_sampler.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...
409
14,205
sqlmap
tests/test_settings_regex.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Compiled-regex battery for lib/core/settings.py. settings.py defines ~40 module-level *_REGEX patterns that drive WAF/error/ charset/IP/title detection. A bad edit to any one of them...
67
2,723
probability
tensorflow_probability/python/distributions/cholesky_lkj_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...
196
9,774
pyomo
pyomo/solvers/plugins/solvers/CBCplugin.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...
1,133
50,797
pyomo
pyomo/contrib/viewer/residual_table.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...
169
5,515