repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
saleor
saleor/product/tests/fixtures/product_media.py
.py
import pytest from ... import ProductMediaTypes from ...models import ProductMedia @pytest.fixture def product_media_image(product, image, media_root): return ProductMedia.objects.create( product=product, image=image, alt="image", type=ProductMediaTypes.IMAGE, oembed_data=...
34
778
mlflow
tests/assistant/providers/test_claude_code_provider.py
.py
import errno import json import subprocess import tempfile from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch import pytest from mlflow.assistant.providers.base import NotAuthenticatedError from mlflow.assistant.providers.claude_code import ClaudeCodeProvider from mlflow.assistant.types im...
861
28,015
onnxruntime
onnxruntime/test/python/transformers/test_clean_graph.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. # -------------------------------------------------------------...
294
12,898
mlflow
mlflow/genai/judges/prompts/safety.py
.py
from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the safety assessment. SAFETY_ASSESSMENT_NAME = "safety" SAFETY_PROMPT = """\ You are a content safety classifier. Analyze the given text against policies prohibiting hate speech, harassment, incitement of violence, and the promotion of ...
22
928
coremltools
coremltools/converters/mil/frontend/tensorflow2/ssa_passes/remove_vacuous_cond.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 coremltools import _logger as logger from coremltools.converters.mil.mil import Builder as mb fr...
119
4,645
pyomo
pyomo/common/docutils.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...
54
2,059
toolz
examples/graph.py
.py
from toolz.curried import * a, b, c, d, e, f, g = 'abcdefg' edges = [(a, b), (b, a), (a, c), (a, d), (d, a), (d, e), (e, f), (d, f), (f, d), (d, g), (e, g)] out_degrees = countby(first, edges) # {'a': 3, 'b': 1, 'd': 4, 'e': 2, 'f': 1} in_degrees = countby(second, edges) # {'a': 2, 'b': 1, 'c': 1, 'd': 2,...
32
771
onnxruntime
onnxruntime/test/testdata/transform/gh_issue_18338.py
.py
import google.protobuf.text_format import onnx from numpy import array, float16 import onnxruntime as ort # Run n times N = 1 onnx_model_text = """ ir_version: 8 producer_name: "pytorch" producer_version: "2.2.0" graph { node { output: "_val_1" name: "Constant_0" op_type: "Constant" attribute { ...
860
21,558
biopython
Tests/test_SeqIO_NibIO.py
.py
"""Tests for SeqIO NibIO module.""" import unittest from io import BytesIO from Bio import SeqIO class TestNibReaderWriter(unittest.TestCase): def test_read_even(self): with open("Nib/test_even.fa") as handle: record = SeqIO.read(handle, "fasta") sequence = record.seq with op...
62
2,068
coremltools
coremltools/test/sklearn_tests/test_random_forest_classifier_numeric.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 itertools import unittest import numpy as np import pandas as pd import pytest from packaging.ve...
142
5,039
mkdocs-material
material/plugins/blog/config.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
103
4,698
black
docs/conf.py
.py
# # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- #...
236
7,298
pyomo
pyomo/contrib/preprocessing/plugins/int_to_binary.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...
173
6,144
astropy
astropy/visualization/wcsaxes/tests/test_frame.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from matplotlib.figure import Figure from astropy.tests.figures import figure_test from astropy.visualization.wcsaxes import WCSAxes from astropy.visualization.wcsaxes.frame import BaseFrame from astropy.wcs import WCS from .test_image...
158
4,620
luigi
test/util_previous_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
185
6,493
textual
docs/examples/widgets/select_widget_no_blank.py
.py
from textual import on from textual.app import App, ComposeResult from textual.widgets import Header, Select LINES = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me.""".splitlines() ALTERNATE_LIN...
39
1,053
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/flatmap_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");...
60
1,714
metrics
src/torchmetrics/audio/__init__.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...
77
2,536
pdm
src/pdm/project/lockfile/pdmlock.py
.py
from __future__ import annotations from collections.abc import Iterable from functools import cached_property from typing import TYPE_CHECKING import tomlkit from pdm.project.lockfile.base import ( FLAG_CROSS_PLATFORM, FLAG_DIRECT_MINIMAL_VERSIONS, FLAG_INHERIT_METADATA, FLAG_STATIC_URLS, Compati...
145
5,892
scikit-bio
doc/source/conf.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. # --------------------------------------------...
334
9,253
onnxruntime
orttraining/orttraining/test/python/orttraining_test_data_loader.py
.py
import random from enum import Enum import torch from torch.utils.data import DataLoader, Dataset global_rng = random.Random() def ids_tensor(shape, vocab_size, rng=None, name=None): """Creates a random int32 tensor of the shape within the vocab size.""" if rng is None: rng = global_rng total_d...
102
3,228
saleor
saleor/graphql/product/mutations/product_variant/product_variant_set_default.py
.py
import graphene from django.core.exceptions import ValidationError from .....permission.enums import ProductPermissions from .....product import models from .....product.error_codes import ProductErrorCode from ....core import ResolveInfo from ....core.context import ChannelContext from ....core.doc_category import DO...
69
2,540
onnx
onnx/backend/test/case/__init__.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import sys from onnx.backend.test.case.base import Snippets from onnx.backend.test.case.utils import import_recursive def collect_snippets() -> dict[str, list[tuple[str, str]]]: import_recursive(s...
15
362
readthedocs.org
readthedocs/proxito/redirects.py
.py
from urllib.parse import urlparse import structlog from django.http import HttpResponseRedirect from readthedocs.core.resolver import Resolver from readthedocs.core.utils.url import unsafe_join_url_path from readthedocs.proxito.cache import cache_response from readthedocs.proxito.constants import RedirectType from re...
89
3,623
beam
sdks/python/apache_beam/runners/interactive/sql/sql_chain.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...
224
8,846
probability
tensorflow_probability/python/distributions/batch_broadcast_test.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...
326
13,527
pyro
pyro/contrib/randomvariable/random_variable.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from typing import Union from torch import Tensor from pyro.distributions import TransformedDistribution from pyro.distributions.transforms import ( AbsTransform, AffineTransform, ExpTransform, PowerTransform, Sig...
176
5,424
python-prompt-toolkit
examples/full-screen/full-screen-demo.py
.py
#!/usr/bin/env python """ """ from pygments.lexers.html import HtmlLexer from prompt_toolkit.application import Application from prompt_toolkit.application.current import get_app from prompt_toolkit.completion import WordCompleter from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.key_binding.bind...
226
5,606
django-cms
cms/test_utils/project/app_with_two_cms_config_classes/apps.py
.py
from django.apps import AppConfig class TwoCMSAppClassesConfig(AppConfig): name = 'cms.test_utils.project.app_with_two_cms_config_classes' label = 'app_with_two_cms_config_classes'
7
191
onnxruntime
onnxruntime/python/tools/transformers/convert_tf_models_to_pytorch.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import glob import os import tarfile import zipfile TFMODELS = { "...
252
8,993
onnxruntime
onnxruntime/python/tools/transformers/models/stable_diffusion/engine_builder.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import hashlib import os from enum import Enum import torch from diffus...
296
11,670
onnxruntime
orttraining/orttraining/python/training/ort_triton/kernel/_flash_attn.py
.py
""" *Experimental* implementation of FlashAttention in Triton. Tested with triton==2.0.0.dev20221202. Triton 2.0 has a new backend (MLIR) but seems like it doesn't yet work for head dimensions other than 64: https://github.com/openai/triton/blob/d376020f90002757eea3ea9475d4f7cfc2ec5ead/python/triton/ops/flash_attention...
1,244
45,607
pyro
pyro/distributions/testing/rejection_exponential.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions.utils import broadcast_all import pyro.distributions.constraints as constraints from pyro.distributions.rejector import Rejector from pyro.distributions.torch import Exponential from pyro.dist...
38
1,167
biopython
Tests/test_Align_nexus.py
.py
# Copyright 2021 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.Align.nexus module.""" import unittest from io import StringIO from tempfi...
417
18,820
saleor
saleor/graphql/meta/tests/mutations/test_account.py
.py
from unittest.mock import patch import graphene import pytest from .....account.error_codes import AccountErrorCode from .....account.models import User from .....core.error_codes import MetadataErrorCode from ....tests.utils import assert_no_permission, get_graphql_content from . import ( PRIVATE_KEY, PRIVAT...
1,787
52,889
probability
tensorflow_probability/examples/disentangled_vae.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
1,229
50,084
loguru
tests/exceptions/source/modern/exception_formatting_async_generator.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=True, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=True, colorize=False) logger.add(sys.std...
23
523
wandb
tests/system_tests/test_artifacts/test_artifact_cli.py
.py
from __future__ import annotations import os import platform from pathlib import Path from pytest import mark from wandb.cli import cli from wandb.sdk.artifacts.artifact_file_cache import get_artifact_file_cache from wandb.sdk.lib.filesystem import mkdir_exists_ok def test_artifact(runner, user): # wandb artifa...
98
3,382
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combinevalues_simple.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");...
58
1,664
beam
sdks/python/apache_beam/coders/observable.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...
43
1,416
biopython
Bio/AlignIO/NexusIO.py
.py
# Copyright 2008-2010, 2012-2014, 2016-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. "...
174
6,226
ipython
IPython/testing/plugin/test_refs.py
.py
"""Some simple tests for the plugin while running scripts. """ # Module imports # Std lib # Our own #----------------------------------------------------------------------------- # Testing functions def test_trivial(): """A trivial passing test.""" pass def doctest_run(): """Test running a trivial scrip...
39
700
onnx
onnx/reference/ops/op_reduce_min.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunReduceNumpy class ReduceMin_1(OpRunReduceNumpy): def _run(self, data, axes=None, keepdims=None): axes = tuple(axes) if axes is no...
51
1,647
coveragepy
tests/modules/pkg1/__init__.py
.py
# A simple package for testing with. print(f"pkg1.__init__: {__name__}")
3
73
wandb
wandb/apis/_generated/get_sweep_agents.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/api/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import AgentFragment class GetSweepAgents(GQLResult): project: GetSweepAgentsProject | None class GetSweepAgentsProject(GQLResult): sweep: GetSweepA...
36
844
scikit-bio
skbio/table/tests/test_base.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. # --------------------------------------------...
62
2,535
cvxpy
cvxpy/tests/test_interfaces.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...
145
6,304
pymc
pymc/dims/distributions/scalar.py
.py
# Copyright 2025 - 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...
350
11,504
metrics
src/torchmetrics/image/rmse_sw.py
.py
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
139
5,429
httpie
httpie/ssl_.py
.py
import ssl from typing import NamedTuple, Optional # noinspection PyPackageRequirements from urllib3.util.ssl_ import ( create_urllib3_context, resolve_ssl_version, ) from .adapters import HTTPAdapter from .compat import ensure_default_certs_loaded SSL_VERSION_ARG_MAPPING = { 'ssl2.3': 'PROTOCOL_SSLv23'...
110
3,408
coremltools
coremltools/proto/FeatureTypes_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: FeatureTypes.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...
198
12,905
saleor
saleor/graphql/payment/tests/mutations/test_check_payment_balance.py
.py
from unittest.mock import Mock, patch from .....payment import PaymentError from .....payment.error_codes import PaymentErrorCode from .....plugins.manager import PluginsManager from ....tests.utils import get_graphql_content from ...mutations import PaymentCheckBalance MUTATION_CHECK_PAYMENT_BALANCE = """ mutati...
215
6,772
saleor
saleor/graphql/page/tests/deprecated/test_page_update.py
.py
import datetime import graphene from .....page.error_codes import PageErrorCode from .....page.models import Page from ....tests.utils import get_graphql_content UPDATE_PAGE_MUTATION = """ mutation updatePage( $id: ID!, $input: PageInput! ) { pageUpdate( id: $id, input: $input ...
112
3,173
openvino
tests/model_hub_tests/tensorflow/test_tf_convert_model.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import gc import os import platform import pytest import shutil import subprocess import tempfile import tensorflow as tf import tensorflow.compat.v1 as tf_v1 import tensorflow_hub as hub # noinspection PyUnresolvedReferences #import ten...
225
10,651
mlflow
tests/genai/datasets/test_databricks_evaluation_dataset_source.py
.py
import json import pytest from mlflow.genai.datasets.databricks_evaluation_dataset_source import ( DatabricksEvaluationDatasetSource, ) def test_databricks_evaluation_dataset_source_init(): source = DatabricksEvaluationDatasetSource( table_name="catalog.schema.table", dataset_id="12345" ) as...
105
3,469
pyro
tests/distributions/testing/test_gof.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import torch import torch.distributions as dist from pyro.distributions.testing.gof import multinomial_goodness_of_fit def test_multinomial_goodness_of_fit(): N = 100000 K = 20 logits = torch.randn(K) probs = (logits...
21
612
conda
conda/auxlib/exceptions.py
.py
from logging import getLogger from ..deprecations import deprecated log = getLogger(__name__) def Raise(exception): # NOQA raise exception class AuxlibError: """Mixin to identify exceptions associated with the auxlib package.""" class ValidationError(AuxlibError, TypeError): def __init__(self, key,...
33
901
pyomo
pyomo/core/tests/examples/pmedian2.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...
44
1,357
saleor
saleor/checkout/calculations.py
.py
import logging from collections.abc import Iterable from decimal import Decimal from typing import TYPE_CHECKING, Union, cast from django.conf import settings from django.db import transaction from django.utils import timezone from prices import Money, TaxedMoney from promise import Promise from ..core.db.connection ...
907
31,937
pyro
tests/distributions/test_stable.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import warnings import pytest import torch from scipy.integrate.quadpack import IntegrationWarning from scipy.stats import ks_2samp, kstest, levy_stable import pyro.distributions as dist import pyro.distributions.stable from test...
152
5,202
kombu
kombu/transport/__init__.py
.py
"""Built-in transports.""" from __future__ import annotations from kombu.utils.compat import _detect_environment from kombu.utils.imports import symbol_by_name def supports_librabbitmq() -> bool | None: """Return true if :pypi:`librabbitmq` can be used.""" if _detect_environment() == 'default': try:...
94
3,487
beam
sdks/python/apache_beam/examples/snippets/snippets_test.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
1,486
54,392
probability
tensorflow_probability/python/internal/backend/numpy/composite_tensor_gradient.py
.py
# Copyright 2023 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...
22
815
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/regex_matches_kv.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");...
64
2,019
qutip
qutip/tests/solver/test_transfertensor.py
.py
import pytest import qutip import numpy as np from qutip.solver.nonmarkov.transfertensor import ttmsolve @pytest.mark.parametrize("call", [True, False]) def test_ttmsolve_jc_model(call): """ Checks the output of ttmsolve using an example from Jaynes-Cumming model, which can also be found in the qutip-note...
54
1,998
onnxruntime
plugin-ep-webgpu/_packaging_utils.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Shared utilities for the WebGPU plugin EP packaging scripts. Not a public API.""" from __future__ import annotations import re from pathlib import Path # Matches "@var@" template variables. _TEMPLATE_VARIABLE_PATTERN = ...
46
1,724
wagtail
wagtail/documents/signal_handlers.py
.py
from django.db import transaction from django.db.models.signals import post_delete from wagtail.documents import get_document_model from wagtail.tasks import delete_file_from_storage_task def post_delete_file_cleanup(instance, **kwargs): transaction.on_commit( lambda: delete_file_from_storage_task.enqueu...
19
544
openvino
tests/layer_tests/pytorch_tests/test_unique.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np from packaging.version import parse as parse_version import torch import sys from pytorch_layer_test_class import PytorchLayerTest class TestUnique2(PytorchLayerTest): def _prepare_input(self): ...
84
3,227
cvxpy
cvxpy/atoms/affine/squeeze.py
.py
""" Copyright 2025 CVXYPY 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...
62
1,932
mlflow
tests/demo/test_generate.py
.py
import threading from unittest import mock from mlflow.demo import generate_all_demos from mlflow.demo.base import BaseDemoGenerator, DemoFeature, DemoResult from mlflow.environment_variables import MLFLOW_WORKSPACE from mlflow.utils.workspace_context import ( clear_server_request_workspace, get_request_worksp...
122
4,029
saleor
saleor/graphql/checkout/mutations/checkout_delivery_method_update.py
.py
from typing import TYPE_CHECKING, Union import graphene from django.core.exceptions import ValidationError from ....checkout.delivery_context import ( assign_delivery_method_to_checkout, get_or_fetch_checkout_deliveries, is_shipping_required, ) from ....checkout.error_codes import CheckoutErrorCode from ....
263
8,982
saleor
saleor/webhook/event_types.py
.py
from typing import Any from ..permission.enums import ( AccountPermissions, AppPermission, BasePermissionEnum, ChannelPermissions, CheckoutPermissions, CustomerTypePermissions, DiscountPermissions, GiftcardPermissions, MenuPermissions, OrderPermissions, PagePermissions, ...
1,047
38,722
openvino
src/bindings/python/src/openvino/opset9/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for all openvino ops.""" from functools import partial from typing import Optional import numpy as np from openvino import Node from openvino.utils.node_factory import _get_node_factory from ...
353
13,869
hydra
examples/configure_hydra/logging/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging from omegaconf import DictConfig import hydra log = logging.getLogger(__name__) @hydra.main(config_path="conf", config_name="config") def my_app(_cfg: DictConfig) -> None: log.info("Info level message") if __name__ == "__ma...
18
340
saleor
saleor/graphql/meta/mutations/update_private_metadata.py
.py
import graphene from ...core import ResolveInfo from ...core.types import MetadataError, NonNullList from ..inputs import MetadataInput, MetadataInputDescription from ..permissions import PRIVATE_META_PERMISSION_MAP from .base import BaseMetadataMutation from .utils import get_valid_metadata_instance, update_private_m...
48
1,599
beam
sdks/python/apache_beam/runners/pipeline_context.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...
322
12,150
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_random.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 numpy as np import pytest from coremltools.converters.mil.mil import Builde...
432
14,824
mkdocs-material
material/plugins/search/config.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
64
2,524
readthedocs.org
readthedocs/embed/tests/test_links.py
.py
from collections import namedtuple import pytest from pyquery import PyQuery from readthedocs.embed.utils import clean_references URLData = namedtuple("URLData", ["docurl", "ref", "expected"]) html_base_url = "https://t.readthedocs.io/en/latest/page.html" dirhtml_base_url = "https://t.readthedocs.io/en/latest/page/...
168
5,402
wagtail
wagtail/admin/ui/fields.py
.py
from django.core.exceptions import ImproperlyConfigured from django.db import models from wagtail.admin.ui.components import Component from wagtail.utils.registry import ModelFieldRegistry display_class_registry = ModelFieldRegistry() def register_display_class(field_class, to=None, display_class=None, exact_class=...
41
1,377
openvino
cmake/rpi_cross/scons-site-init.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import SCons.Platform import SCons.Script _environment = SCons.Script.Environment def Environment(*args, **kwargs): kwargs.setdefault("tools", ["gcc", "g++", "gnulink", "ar", "as", "gas"]) env = _environment(*args, **kwargs) ...
21
594
probability
tensorflow_probability/python/internal/backend/numpy/numpy_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...
2,081
80,299
returns
tests/test_pipeline/test_managed/test_managed_future_result.py
.py
import pytest from returns.future import FutureResult from returns.io import IOFailure, IOSuccess from returns.pipeline import managed from returns.result import Failure, Result, Success def _acquire_success() -> FutureResult[str, str]: return FutureResult.from_value('acquire success') def _acquire_failure() -...
137
3,611
lemur
lemur/plugins/lemur_vault_dest/tests/plugin.py
.py
from validators.url import url from lemur.plugins.bases import SourcePlugin import pytest from lemur.plugins.lemur_vault_dest.plugin import VaultSourcePlugin, VaultDestinationPlugin class TestSourcePlugin(SourcePlugin): title = "Test" slug = "test-source" description = "Enables testing" author = "Te...
145
4,197
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_upsampling1d.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 TestKerasUpSampling1D(CommonTF2LayerTest): def create_keras_upsampling1d_net(self, input_names, input_shapes, input_type, size,...
38
1,607
wandb
wandb/proto/v5/wandb_sync_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: wandb/proto/wandb_sync.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from goo...
48
3,993
conda
conda/common/serialize/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """YAML and JSON serialization and deserialization functions.""" import functools from io import StringIO from logging import getLogger from ...deprecations import deprecated log = getLogger(__name__) @deprecated( "26.9", "27.3", ...
127
2,813
sqlmap
tamper/equaltorlike.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.enums import PRIORITY __priority__ = PRIORITY.HIGHEST def dependencies(): pass def tamper(payload, **kwargs): """ Replaces all occurrences ...
38
836
readthedocs.org
readthedocs/rtd_tests/base.py
.py
"""Base classes and mixins for unit tests.""" import structlog from collections import OrderedDict from unittest.mock import patch from django.contrib.auth.models import AnonymousUser from django.contrib.messages.storage.fallback import FallbackStorage from django.contrib.sessions.middleware import SessionMiddleware f...
143
4,790
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_SpaceToDepth.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [8, 10, 10, 16], 'block_size': 2}, {'shape': [24, 10, 10, 50], 'block_size': 5}, ] class TestTFLiteSpaceToDepthLayerTest(TFLiteLayerTest): inputs = ["Input"] outputs = ["SpaceTo...
32
1,184
textual
tests/css/test_grid_rows_columns_relative_units.py
.py
""" Regression tests for #1406 https://github.com/Textualize/textual/issues/1406 The scalars in grid-rows and grid-columns were not aware of the dimension they should be relative to. """ from textual.css.parse import parse_declarations from textual.css.scalar import Unit from textual.css.styles import Styles def te...
43
1,285
hydra
tools/copyright/test_check_new_files.py
.py
# SPDX-FileCopyrightText: Contributors to Hydra # SPDX-License-Identifier: MIT import subprocess from pathlib import Path import check_new_files NEW_HEADER = """\ # SPDX-FileCopyrightText: Contributors to Hydra # SPDX-License-Identifier: MIT """ def write(root: Path, relative_path: str, content: str) -> Path: ...
133
4,100
sphinx
sphinx/ext/autodoc/_directive_options.py
.py
from __future__ import annotations import warnings from typing import TYPE_CHECKING from docutils.utils import assemble_option_dict from sphinx.deprecation import RemovedInSphinx11Warning from sphinx.ext.autodoc._sentinels import ALL, EMPTY, SUPPRESS from sphinx.locale import __ if TYPE_CHECKING: from collectio...
351
12,252
pyomo
pyomo/repn/ampl.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,295
49,208
cvxpy
cvxpy/reductions/solvers/conic_solvers/moreau_conif.py
.py
""" Copyright 2025, 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, sof...
305
9,862
pyro
tests/contrib/oed/test_finite_spaces_eig.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from contextlib import ExitStack import pytest import torch import pyro import pyro.distributions as dist import pyro.optim as optim from pyro.contrib.oed.eig import ( donsker_varadhan_eig, lfire_eig, marginal_eig, ...
273
7,851
probability
spinoffs/inference_gym/inference_gym/targets/dirichlet.py
.py
# Copyright 2025 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...
107
3,369
astropy
astropy/wcs/tests/test_wtbarr.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst def test_wtbarr_i(tab_wcs_2di): assert tab_wcs_2di.wcs.wtb[0].i == 1 def test_wtbarr_m(tab_wcs_2di): assert tab_wcs_2di.wcs.wtb[0].m == 1 def test_wtbarr_kind(tab_wcs_2di): assert tab_wcs_2di.wcs.wtb[0].kind == "c" def test_wtbarr_extna...
59
1,531
biopython
Bio/_utils.py
.py
# Copyright 2010 by Eric Talevich. All rights reserved. # Copyright 2012 by Wibowo Arindrarto. 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 in...
93
2,918
openvino
tests/layer_tests/pytorch_tests/test_constant_pad_nd.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestConstantPadND(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 5, 3, 4),) def create_model(self, pad, value): ...
36
1,163