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
hydra
plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/config.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from dataclasses import dataclass, field from typing import Any, Dict, Optional from hydra.core.config_store import ConfigStore @dataclass class ScalarConfigSpec: """Representation of all the options to define a scalar. """ # low...
91
2,587
bazel
tools/android/instrumentation_test_check.py
.py
# pylint: disable=g-direct-third-party-import # Copyright 2017 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/LI...
132
5,033
onnx
docs/docsgen/source/conf.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import os import sys import warnings import onnx sys.path.append(os.path.abspath(os.path.dirname(__file__))) # -- Project information ----------------------------------------------------- author ...
109
2,698
readthedocs.org
readthedocs/core/utils/tasks/__init__.py
.py
"""Common task exports.""" from .permission_checks import ( # noqa for unused import user_id_matches, user_id_matches_or_superuser, ) from .public import PublicTask # noqa from .public import TaskNoPermission # noqa from .retrieve import TaskNotFound # noqa
10
271
metrics
tests/unittests/nominal/test_fleiss_kappa.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...
118
4,011
wagtail
wagtail/tests/test_page_assertions.py
.py
from unittest import mock from django.conf import settings from wagtail.test.routablepage.models import RoutablePageTest from wagtail.test.utils import Page, WagtailPageTestCase class TestCustomPageAssertions(WagtailPageTestCase): @classmethod def setUpTestData(cls): cls.superuser = cls.create_super...
173
6,689
onnx
onnx/fuzz/make_seed_corpus.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import struct import sys import zipfile from typing import TYPE_CHECKING from onnx import TensorProto, helper if TYPE_CHECKING: from collections.abc import Mapping def _make_model( op_type: st...
551
18,626
probability
tensorflow_probability/python/distributions/student_t.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,079
40,475
wandb
tests/system_tests/test_core/test_offline_sync_beta.py
.py
from __future__ import annotations import asyncio import pathlib import re from collections.abc import Callable from typing import cast import looptime import pytest import wandb from click.testing import CliRunner from typing_extensions import Any, TypeVar from wandb.cli import beta_sync, cli from wandb.proto import...
615
19,424
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/convection_lorenz_bridge_unknown_scales.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...
330
8,383
saleor
saleor/core/utils/json_serializer.py
.py
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import Serializer as JsonSerializer from measurement.measures import Weight from prices import Money MONEY_TYPE = "Money" class Serializer(JsonSerializer): def _init_options(self): super()._init_options() # type...
23
806
probability
tensorflow_probability/substrates/meta/numpy_integration_test.py
.py
# Copyright 2019 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
52
1,390
pyro
examples/air/modules.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch import torch.nn as nn from torch.nn.functional import softplus # Takes pixel intensities of the attention window to parameters (mean, # standard deviation) of the distribution over the latent code, # z_what. class En...
91
2,991
dirty-equals
tests/test_inspection.py
.py
import pytest from dirty_equals import AnyThing, HasAttributes, HasName, HasRepr, IsInstance, IsInt, IsStr class Foo: def __init__(self, a=1, b=2): self.a = a self.b = b def spam(self): pass def dirty_repr(value): if hasattr(value, 'equals'): return repr(value) retu...
103
2,559
wagtail
scripts/nightly/upload.py
.py
import json import pathlib import sys import uuid import boto3 dist_folder = pathlib.Path.cwd() / "dist" try: f = next(dist_folder.glob("*.whl")) except StopIteration: print("No .whl files found in ./dist!") # noqa: T201 sys.exit() print("Uploading", f.name) # noqa: T201 s3 = boto3.client("s3") s3.upl...
53
1,194
astropy
astropy/table/groups.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import numpy as np from astropy.utils.exceptions import AstropyUserWarning from .index import get_index_by_names __all__ = ["ColumnGroups", "TableGroups"] def table_group_by(table, keys): # index copies are unnecessary and slow d...
441
14,959
beam
sdks/python/apache_beam/examples/ml_transform/mltransform_generate_vocab.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...
266
8,902
cvxpy
cvxpy/tests/test_versioning.py
.py
""" Copyright 2022, the CVXPY developers. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
47
1,894
wagtail
wagtail/documents/api/v3/router.py
.py
from typing import cast from django.http import HttpRequest from django.shortcuts import get_object_or_404 from ninja import Body, File, Form, Query, Router, Status, UploadedFile from ninja.pagination import paginate from pydantic import BaseModel from wagtail.actions import action_registry from wagtail.api.v3.auth i...
155
5,326
gunicorn
tests/docker/asgi_framework_compat/frameworks/starlette_app/app.py
.py
""" Starlette ASGI Application for Compatibility Testing Implements the contract endpoints for ASGI 3.0 compliance testing. """ import asyncio import json import sys import traceback from contextlib import asynccontextmanager from typing import Any from starlette.applications import Starlette from starlette.response...
285
8,629
textual
src/textual/widgets/_rule.py
.py
from __future__ import annotations from typing import Iterable from rich.console import Console, ConsoleOptions from rich.segment import Segment from rich.style import Style from typing_extensions import Literal from textual.app import RenderResult from textual.css._error_tools import friendly_list from textual.geom...
269
7,481
hydra
tests/test_apps/init_in_app_without_module/main.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os from hydra import compose, initialize, initialize_config_dir if __name__ == "__main__": with initialize(config_path="."): cfg = compose(config_name="config", return_hydra_config=True) assert cfg.config == {"hello": "w...
27
1,109
saleor
saleor/plugins/avatax/plugin.py
.py
import logging from collections.abc import Callable, Iterable from dataclasses import asdict from decimal import Decimal from functools import partial from typing import TYPE_CHECKING, Any, Optional, Union from urllib.parse import urljoin from django.core.exceptions import ValidationError from django.utils.functional ...
1,001
37,819
gunicorn
tests/requests/valid/020.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "GET", "uri": uri("/first"), "version": (1, 0), "headers": [('CONTENT-LENGTH', '24')], "body": b"GET /second HTTP/1.1\r\n\r\n" }
12
277
astropy
astropy/io/ascii/tests/test_qdp.py
.py
import numpy as np import pytest from astropy.io import ascii from astropy.io.ascii.qdp import _get_lines_from_file, _read_table_qdp, _write_table_qdp from astropy.table import Column, MaskedColumn, Table from astropy.utils.exceptions import AstropyUserWarning def test_get_tables_from_qdp_file(tmp_path): example...
264
9,484
beam
sdks/python/apache_beam/examples/ml-orchestration/kfp/components/train/src/train.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 ...
84
2,815
saleor
saleor/graphql/core/tests/test_core.py
.py
import enum import os from unittest.mock import patch import django_filters import graphene import pytest from django.core.exceptions import ImproperlyConfigured, ValidationError from django.utils import timezone from graphene import InputField from micawber import ProviderException, ProviderRegistry from ....core.ex...
374
11,294
pyomo
pyomo/dataportal/_parse_table_datacmds.py
.py
# _parse_table_datacmds.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_module_signature = 'b16a81c79d1db99fb552f8798bdfd7ad19f632b78a8eee8b1a4bbb3fd4a6c87c' _lr_signature = '' _lr_action_items = {'$end':([0,1,2,3,13,42,43,77,78,79,80...
130
19,615
mlflow
mlflow/mistral/__init__.py
.py
from mlflow.mistral.autolog import async_patched_class_call, patched_class_call from mlflow.telemetry.events import AutologgingEvent from mlflow.telemetry.track import _record_event from mlflow.utils.autologging_utils import autologging_integration, safe_patch FLAVOR_NAME = "mistral" @autologging_integration(FLAVOR_...
48
1,575
pynacl
tests/test_utils.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # 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...
60
1,919
mlflow
tests/store/artifact/test_b2_artifact_repo.py
.py
import posixpath from unittest import mock from unittest.mock import ANY import pytest from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository from mlflow.store.artifact.b2_artifact_repo import _B2_USER_AGENT, _add_b2_user_agent from mlflow.store.artifact.s3_artifact_repo import _cached...
93
3,306
luigi
test/setup_logging_test.py
.py
from helpers import unittest from luigi.configuration import LuigiConfigParser, LuigiTomlParser, get_config from luigi.setup_logging import DaemonLogging, InterfaceLogging class TestDaemonLogging(unittest.TestCase): cls = DaemonLogging def setUp(self): self.cls._configured = False def tearDown(...
210
6,255
sqlmap
lib/takeover/icmpsh.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os import re import socket import time from extra.icmpsh.icmpsh_m import main as icmpshmaster from lib.core.common import getLocalIP from lib.core.common import getRemoteI...
141
4,738
probability
tensorflow_probability/python/experimental/tangent_spaces/symmetric_matrix_test.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...
383
12,446
astropy
astropy/timeseries/periodograms/bls/methods.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ["bls_fast", "bls_slow"] from functools import partial import numpy as np from ._impl import bls_impl def bls_slow(t, y, ivar, period, duration, oversample, use_likelihood): """Compute the periodogram using a brute force reference metho...
151
5,316
hydra
tests/instantiate/import_error.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved assert False
3
84
biopython
Tests/test_SearchIO_blat_psl_index.py
.py
# Copyright 2012 by Wibowo Arindrarto. 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 SearchIO blat-psl indexing.""" import os import unittest from search_tests_...
71
2,609
black
tests/data/cases/preview_hug_comparator.py
.py
# flags: --preview --line-length=88 # Regression test for https://github.com/psf/black/issues/4514 # Black used to split between a variable and its comparator (`if t / not in`) # whenever the RHS was a bracketed expression that had to break. With the fix, # the comparator stays attached to its left operand and the bra...
135
4,038
mlflow
mlflow/genai/scorers/online/trace_processor.py
.py
"""Online scoring processor for executing scorers on traces.""" import logging import time from concurrent.futures import ThreadPoolExecutor, as_completed from dataclasses import dataclass from mlflow.entities import Trace from mlflow.environment_variables import MLFLOW_ONLINE_SCORING_MAX_WORKER_THREADS from mlflow.g...
297
11,956
clearml
clearml/config/__init__.py
.py
""" Configuration module. Uses backend_config to load system configuration. """ import logging import os import sys from os.path import expandvars, expanduser from typing import Optional, Callable, Iterable, Tuple, List, Any from pathlib2 import Path from clearml.utilities.hashing import md5_safe_hash from .defs impo...
292
8,617
openvino
tools/ovc/unit_tests/ovc/convert/import_from_mo_test.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import tempfile from openvino import serialize from pathlib import Path from unit_tests.ovc.convert.utils import create_onnx_model, save_to_onnx from unit_tests.ovc.unit_test_with_mocked_telemetry import UnitTestWithMockedTelem...
90
3,077
wagtail
wagtail/contrib/table_block/blocks.py
.py
import json from django import forms from django.core.exceptions import ValidationError from django.forms.fields import Field from django.forms.utils import ErrorList from django.template.loader import render_to_string from django.utils import translation from django.utils.functional import cached_property from django...
268
9,549
biopython
Tests/test_KGML_graphics.py
.py
# Copyright 2013, 2014 by Leighton Pritchard. 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 general functionality of the KGML modules.""" # Builtins import os im...
194
7,785
coremltools
deps/protobuf/python/google/protobuf/proto_builder.py
.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
135
5,506
probability
tensorflow_probability/python/distributions/relaxed_onehot_categorical.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...
568
24,305
returns
tests/test_pattern_matching.py
.py
import pytest from returns.io import IO, IOFailure, IOResult, IOSuccess from returns.maybe import Maybe, Nothing, Some from returns.result import Failure, Result, Success @pytest.mark.parametrize( 'container', [ Success(10), Success(42), Failure(RuntimeError()), Failure(Except...
83
2,609
textual
docs/examples/widgets/sparkline_basic.py
.py
from textual.app import App, ComposeResult from textual.widgets import Sparkline data = [1, 2, 2, 1, 1, 4, 3, 1, 1, 8, 8, 2] # (1)! class SparklineBasicApp(App[None]): CSS_PATH = "sparkline_basic.tcss" def compose(self) -> ComposeResult: yield Sparkline( # (2)! data, # (3)! ...
20
431
saleor
saleor/graphql/product/tests/mutations/test_product_variant_stocks_create.py
.py
from unittest import mock import graphene from .....warehouse import WarehouseClickAndCollectOption from .....warehouse.error_codes import StockErrorCode from .....warehouse.models import Stock, Warehouse from ....tests.utils import get_graphql_content VARIANT_STOCKS_CREATE_MUTATION = """ mutation ProductVariant...
439
13,916
biopython
Bio/SeqUtils/MeltingTemp.py
.py
# Copyright 2004-2008 by Sebastian Bassi. # Copyright 2013-2018 by Markus Piotrowski. # 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...
1,077
43,151
probability
tensorflow_probability/python/bijectors/power_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
123
4,659
mkdocs-material
material/plugins/meta/plugin.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...
123
5,067
pyomo
pyomo/contrib/alternative_solutions/solnpool.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...
126
4,918
pyomo
pyomo/core/tests/unit/test_enums.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...
61
2,770
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_conv_1d.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 TestKerasConv1D(CommonTF2LayerTest): def create_keras_conv1d_net(self, conv_params, input_names, input_shapes, input_type, ...
65
3,174
coveragepy
coverage/version.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 """The version and URL for coverage.py""" # This file is exec'ed in setup.py, don't import anything! from __future__ import annotations # version_info: same sem...
36
1,094
pyomo
examples/pyomobook/pyomo-components-ch/set_validation.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...
30
886
python-prompt-toolkit
tests/test_layout.py
.py
from __future__ import annotations import pytest from prompt_toolkit.layout import InvalidLayoutError, Layout from prompt_toolkit.layout.containers import HSplit, VSplit, Window from prompt_toolkit.layout.controls import BufferControl def test_layout_class(): c1 = BufferControl() c2 = BufferControl() c3...
54
1,536
saleor
saleor/product/apps.py
.py
from django.apps import AppConfig from django.db.models.signals import post_delete class ProductAppConfig(AppConfig): name = "saleor.product" def ready(self): from .models import Category, Collection, ProductMedia from .signals import ( delete_background_image, delete_...
31
882
pyomo
pyomo/common/tests/test_typing.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...
24
1,008
beam
learning/tour-of-beam/learning-content/common-transforms/aggregation/count/python-example/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"); y...
51
1,724
luigi
examples/hello_world.py
.py
""" You can run this example like this: .. code:: console $ luigi --module examples.hello_world examples.HelloWorldTask --local-scheduler If that does not work, see :ref:`CommandLine`. """ import luigi class HelloWorldTask(luigi.Task): task_namespace = "examples" def run(self): pr...
23
501
beam
sdks/python/apache_beam/ml/inference/vllm_inference_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...
158
5,486
textual
src/textual/_easing.py
.py
""" Define a series of easing functions for more natural-looking animations. Taken from https://easings.net/ and translated from JavaScript. """ from math import cos, pi, sin, sqrt def _in_out_expo(x: float) -> float: """https://easings.net/#easeInOutExpo""" if 0 < x < 0.5: return pow(2, 20 * x - 10)...
132
4,101
conda
conda/cli/main_export.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI implementation for `conda export`. Dumps specified environment package specifications to the screen. """ import warnings from argparse import ( ArgumentParser, Namespace, _SubParsersAction, ) from conda.base.constants impor...
299
10,091
pynacl
src/nacl/bindings/crypto_hash.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # 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...
63
2,174
wagtail
wagtail/models/audit_log.py
.py
""" Base model definitions for audit logging. These may be subclassed to accommodate specific models such as Page, but the definitions here should remain generic and not depend on the base wagtail.models module or specific models such as Page. """ from collections import defaultdict from django.conf import settings f...
382
13,448
beam
sdks/python/apache_beam/runners/interactive/interactive_runner_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...
730
28,464
loguru
tests/exceptions/source/diagnose/truncating.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True) def div(): var = "9" * 150 return 1 / var try: div() except TypeError: logger.exception("")
18
248
pyro
tests/poutine/test_properties.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.util import set_rng_seed from tests.common import assert_equal EXAMPLE_MODELS = [] EXAMPLE_MODEL_IDS = [] class E...
147
3,965
hatch
tests/helpers/templates/wheel/standard_default_license_multiple.py
.py
from hatch.template import File from hatch.utils.fs import Path from hatchling.__about__ import __version__ from hatchling.metadata.spec import DEFAULT_METADATA_VERSION from ..new.licenses_multiple import get_files as get_template_files from .utils import update_record_file_contents def get_files(**kwargs): meta...
53
1,398
pyomo
pyomo/core/tests/unit/test_sets.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,943
133,634
onnx
onnx/backend/test/case/node/pad.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 def pad_impl(data, raw_pads, mode, constant_values=0.0, axes=None): inpu...
130
3,971
saleor
saleor/plugins/email_common.py
.py
import logging import operator import os import re from collections.abc import Callable from dataclasses import asdict, dataclass from decimal import Decimal, InvalidOperation from email.headerregistry import Address from typing import TYPE_CHECKING, Any import dateutil.parser import i18naddress import pybars from bab...
427
13,620
saleor
saleor/graphql/translations/tests/test_translations.py
.py
import json from unittest.mock import ANY, patch import graphene import pytest from ....attribute.tests.model_helpers import ( get_product_attribute_values, get_product_attributes, ) from ....attribute.utils import associate_attribute_values_to_instance from ....discount.error_codes import DiscountErrorCode f...
4,643
152,384
onnxruntime
onnxruntime/test/testdata/test_data_generation/adamw_test/adamw_test_data_generator.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """This file is used to generate test data for Adam optimizer tests in orttraining/orttraining/test/training_ops/cuda/optimizer/adamw_test.cc.""" import torch class SingleParameterModule(torch.nn.Module): """A dummy mo...
200
7,133
pyomo
examples/performance/jump/clnlbeam.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,769
probability
tensorflow_probability/python/math/custom_gradient_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...
123
4,302
saleor
saleor/graphql/webhook/tests/deprecated/test_webhook.py
.py
import graphene from .....webhook.deprecated_event_types import WebhookEventType from .....webhook.models import Webhook from ....tests.utils import assert_no_permission, get_graphql_content from ...enums import WebhookEventTypeEnum WEBHOOK_CREATE_BY_APP = """ mutation webhookCreate($name: String, $target_url: St...
270
8,126
sphinx
tests/test_environment/test_environment_record_dependencies.py
.py
"""Tests for ``record_dependencies``.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from sphinx.testing.util import SphinxTestApp @pytest.mark.sphinx('html', testroot='environment-record-dependencies') def test_record_dependencies_cleared(app: SphinxTes...
18
482
biopython
Bio/SearchIO/ExonerateIO/exonerate_vulgar.py
.py
# 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 included as part of this # package. """Bio.SearchIO parser ...
221
8,307
django-cms
cms/test_utils/tmpdir.py
.py
import os import random import shutil import stat from contextlib import contextmanager from tempfile import mkdtemp @contextmanager def temp_dir(): name = make_temp_dir() yield name shutil.rmtree(name) def make_temp_dir(): if os.path.exists('/dev/shm/'): if os.stat('/dev/shm').st_mode & sta...
27
711
openvino
tests/layer_tests/tensorflow_tests/test_tf_SparseSegmentOp.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 rng = np.random.default_rng(475912) class TestSparseSegmentMean(CommonTFLayerTest): def _prepare_input(self, inputs_...
88
3,591
onnx
onnx/backend/test/case/node/bernoulli.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 def bernoulli_reference_implementation(x, dtype): # binomial n = 1 equal...
60
1,870
onnxruntime
onnxruntime/python/tools/transformers/onnx_model_conformer.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging from fusion_attention import AttentionMask from fusion_c...
33
1,380
hydra
plugins/hydra_ax_sweeper/tests/apps/polynomial.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Any import hydra from omegaconf import DictConfig @hydra.main(config_path=".", config_name="polynomial") def polynomial(cfg: DictConfig) -> Any: x = cfg.polynomial.x y = cfg.polynomial.y z = cfg.polynomial.x a =...
22
450
voila
voila/treehandler.py
.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
64
2,644
sqlmap
lib/request/ntlm.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ # Native, dependency-free NTLM-over-HTTP authentication (MS-NLMP / MS-NTHT), replacing the ancient # and unmaintained 'python-ntlm' third-party library. Pure standard library + th...
270
12,084
saleor
saleor/graphql/order/tests/mutations/test_order_update.py
.py
from unittest.mock import ANY, patch import graphene from django.test import override_settings from .....core.models import EventDelivery from .....order import OrderStatus from .....order.actions import call_order_event from .....order.error_codes import OrderErrorCode from .....order.models import Order from .....p...
1,360
44,351
beam
sdks/python/apache_beam/utils/annotations_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 use ...
230
8,407
openvino
tests/layer_tests/pytorch_tests/test_add.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest, skip_check @pytest.mark.parametrize('alpha', (-0.5, 0, 0.5, 1, 2)) @pytest.mark.parametrize('input_shape_rhs', [ [2, 5, 3, 4], [1, 5, 3, 4], ...
311
12,195
ipython
tests/test_debugger_backport.py
.py
"""Tests for IPython.core.debugger_backport. ``PdbClosureBackport`` is a backport of the CPython 3.13 pdb changes making closures work in the debugger (gh-83151). It is mixed into ``IPython.core.debugger.Pdb`` on Python < 3.13 only, so the tests going through ``Pdb`` commands are skipped on newer versions, while the ...
172
5,140
sqlmap
plugins/dbms/spanner/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): pass
12
254
probability
tensorflow_probability/python/optimizer/convergence_criteria/loss_not_decreasing.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...
161
6,326
pyomo
pyomo/devel/initialization/lp_approx_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...
224
8,432
sqlmap
thirdparty/chardet/big5freq.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights R...
387
31,254
sqlmap
lib/utils/timeout.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import threading from lib.core.data import logger from lib.core.enums import CUSTOM_LOGGING from lib.core.enums import TIMEOUT_STATE def timeout(func, args=None, kwargs=None, du...
38
1,110
django-cms
cms/test_utils/project/app_with_bad_cms_file/cms_config.py
.py
# Use this app to test what happens when exceptions are raised in this # file. RuntimeError is just an example exception raise RuntimeError
4
140
python-prompt-toolkit
src/prompt_toolkit/styles/__init__.py
.py
""" Styling for prompt_toolkit applications. """ from __future__ import annotations from .base import ( ANSI_COLOR_NAMES, DEFAULT_ATTRS, Attrs, BaseStyle, DummyStyle, DynamicStyle, ) from .defaults import default_pygments_style, default_ui_style from .named_colors import NAMED_COLORS from .pyg...
68
1,640
saleor
saleor/graphql/warehouse/mutations/warehouse_delete.py
.py
import graphene from ....core.tracing import traced_atomic_transaction from ....core.utils.events import call_event from ....permission.enums import ProductPermissions from ....warehouse import models from ....warehouse.channel_stock_availability import ( get_source_warehouses_data, trigger_out_of_stock_in_cha...
135
5,380
gunicorn
tests/test_http2_stream.py
.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for HTTP/2 stream state management.""" import pytest from gunicorn.http2.stream import HTTP2Stream, StreamState from gunicorn.http2.errors import HTTP2StreamError class MockConnec...
828
27,766