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
metrics
tests/unittests/classification/test_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...
621
24,825
saleor
saleor/webhook/payload_serializers.py
.py
from collections import OrderedDict from collections.abc import Iterable from typing import Any import graphene from django.core.serializers.json import Serializer as JSONSerializer from django.core.serializers.python import Serializer as PythonBaseSerializer from django.utils.functional import SimpleLazyObject clas...
106
4,583
probability
spinoffs/fun_mc/fun_mc/prefab_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...
410
12,077
astropy
astropy/time/tests/test_custom_formats.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from datetime import date from itertools import count import numpy as np import pytest from erfa import DJM0 from astropy.time import Time, TimeFormat from astropy.time.utils import day_frac class SpecificException(ValueError): pass @pytest.fixt...
282
7,496
beam
sdks/python/apache_beam/utils/transform_service_launcher.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...
288
9,854
cvxpy
cvxpy/tests/nlp_tests/stress_tests_diff_engine/test_quad_form.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
228
8,159
probability
tensorflow_probability/python/experimental/nn/__init__.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...
62
3,313
mlflow
mlflow/genai/simulators/utils.py
.py
from __future__ import annotations import json import logging from contextlib import contextmanager from typing import TYPE_CHECKING, Any import pydantic import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.judges.adapters.databricks_managed_judge_adapter import ( _create_message_from_da...
107
3,655
openvino
tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestRandomUniform(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 's...
47
1,964
readthedocs.org
readthedocs/projects/validators.py
.py
"""Validators for projects app.""" import re from urllib.parse import urlparse from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import RegexValidator from django.db.models import Sum from django.db.models.functions import Length from django.utils.deconstr...
258
8,523
sqlmap
plugins/dbms/monetdb/fingerprint.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.common import Backend from lib.core.common import Format from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.e...
95
2,550
astropy
astropy/extern/_strptime.py
.py
"""Strptime-related classes and functions. CLASSES: LocaleTime -- Discovers and stores locale-specific time information TimeRE -- Creates regexes for pattern matching a string of text containing time information FUNCTIONS: _getlang -- Figure out what language is being used for the locale ...
530
22,516
wandb
tests/system_tests/test_core/test_torch_full.py
.py
import pytest import wandb import wandb.sdk try: import torch import torch.nn as nn import torch.nn.functional as F # noqa: N812 except ImportError: class nn: # noqa: N801 Module = object def dummy_torch_tensor(size, requires_grad=True): return torch.ones(size, requires_grad=requires_g...
245
7,333
ipython
IPython/core/magics/osm.py
.py
"""Implementation of magic functions for interaction with the OS. Note: this module is named 'osm' instead of 'os' to avoid a collision with the builtin. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import io import os import pathlib import re import sys fro...
857
30,660
mlflow
mlflow/store/db_migrations/versions/76601a5f987d_add_issues_table.py
.py
"""add issues table Create Date: 2026-02-26 00:00:00.000000 """ import sqlalchemy as sa from alembic import op from mlflow.store.tracking.dbmodels.models import SqlIssue # revision identifiers, used by Alembic. revision = "76601a5f987d" down_revision = "e1f2a3b4c5d6" branch_labels = None depends_on = None def up...
69
2,244
readthedocs.org
readthedocs/proxito/views/hosting.py
.py
"""Views for hosting features.""" from functools import lru_cache import packaging import structlog from django.conf import settings from django.contrib.auth.models import AnonymousUser from django.db.models import Q from django.http import Http404 from django.http import JsonResponse from django.shortcuts import get...
702
28,433
pyomo
examples/pyomobook/mpec-ch/ex1c.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...
31
1,094
coremltools
coremltools/test/optimize/torch/layerwise_compression/test_algorithms.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 from contextlib import nullcontext as does_not_raise import pytest import torch import torch.nn as n...
361
11,863
astropy
astropy/coordinates/baseframe.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Framework and base classes for coordinate frames/"low-level" coordinate classes. """ __all__ = [ "BaseCoordinateFrame", "CoordinateFrameInfo", "GenericFrame", "RepresentationMapping", "frame_transform_graph", ] import copy import ...
2,284
93,326
openvino
tools/commit_slider/utils/preprocess/replace.py
.py
import re import fileinput import os from utils.helpers import CfgError def replace(cfg, commit=None): prepCfg = cfg["runConfig"]["preprocess"] filePath = prepCfg["file"] curDir = os.path.abspath(os.path.join( os.path.dirname(__file__), "../../../../")) filePath = os.path.join(curDir, filePath)...
34
1,302
textual
tests/snapshot_tests/snapshot_apps/dock_scroll_off_by_one.py
.py
from textual.app import App, ComposeResult from textual.widgets import Checkbox, Footer class ScrollOffByOne(App): AUTO_FOCUS = None def compose(self) -> ComposeResult: for number in range(1, 100): yield Checkbox(str(number)) yield Footer() def on_mount(self) -> None: ...
20
412
saleor
saleor/graphql/discount/tests/mutations/test_sale_catalogues_add.py
.py
from unittest.mock import patch import graphene from .....discount.error_codes import DiscountErrorCode from .....product.models import ProductChannelListing from ....tests.utils import get_graphql_content from ...utils import convert_migrated_sale_predicate_to_catalogue_info SALE_CATALOGUES_ADD_MUTATION = """ m...
386
12,596
probability
tensorflow_probability/python/experimental/mcmc/thinning_kernel.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...
117
3,896
saleor
saleor/graphql/account/tests/mutations/authentication/test_token_verify.py
.py
from ......account.error_codes import AccountErrorCode from ......core.jwt import ( PERMISSIONS_FIELD, create_access_token, create_access_token_for_app, ) from .....tests.utils import get_graphql_content MUTATION_TOKEN_VERIFY = """ mutation tokenVerify($token: String!){ tokenVerify(token: $toke...
90
3,313
saleor
saleor/tests/e2e/checkout/test_checkout_create_order_transactions_and_inactive_payment.py
.py
import pytest from ..apps.utils import add_app from ..orders.utils import order_query from ..payment.utils import get_payment from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..transactions.utils import transaction_initialize from ..utils i...
139
4,252
mlflow
tests/genai/scorers/test_scorer_CRUD.py
.py
import json from unittest.mock import Mock, patch import pytest import mlflow import mlflow.genai from mlflow.entities import GatewayEndpointModelConfig, GatewayModelLinkageType, LifecycleStage from mlflow.entities.gateway_endpoint import GatewayEndpoint from mlflow.exceptions import MlflowException from mlflow.genai...
1,011
39,974
gunicorn
examples/celery_alternative/tests/test_integration.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Integration Tests for Celery Replacement Example These tests run against the full application with Gunicorn and dirty arbiters. They can be run locally or in Docker. Usage: # Local (with gunicorn running)...
436
13,489
pyomo
pyomo/contrib/cp/tests/test_logical_to_disjunctive.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...
887
31,329
hydra
tests/test_utils.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import io import json import os import re import sys from pathlib import Path from textwrap import dedent from types import TracebackType from typing import Any, NoReturn, Optional from unittest.mock import patch from omegaconf import DictConfig, O...
372
12,979
saleor
saleor/shipping/error_codes.py
.py
from enum import Enum class ShippingErrorCode(Enum): ALREADY_EXISTS = "already_exists" GRAPHQL_ERROR = "graphql_error" INVALID = "invalid" MAX_LESS_THAN_MIN = "max_less_than_min" NOT_FOUND = "not_found" REQUIRED = "required" UNIQUE = "unique" DUPLICATED_INPUT_ITEM = "duplicated_input_i...
19
462
onnxruntime
onnxruntime/python/tools/transformers/onnx_utils.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from fusion_utils import NumpyHelper from onnx import ModelProto, Tensor...
56
2,120
pyomo
pyomo/repn/tests/ampl/small15_testCase.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...
32
1,161
deap
tests/test_statistics.py
.py
from operator import itemgetter import unittest import numpy from deap import tools class LogbookTest(unittest.TestCase): def test_statistics_compile(self): s = tools.Statistics() s.register("mean", numpy.mean) s.register("max", max) res = s.compile([1, 2, 3, 4]) self.ass...
28
957
biopython
Tests/test_NCBI_qblast.py
.py
# Copyright 2008-2016 by Peter Cock. 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. """Testing online code for fetching NCBI qblast. Uses Bio.Blast.NCBIWWW.qblast() to run some...
388
16,589
biopython
Bio/Align/emboss.py
.py
# Copyright 2008-2016 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. """Bio.Align support fo...
247
10,387
sphinx
tests/test_builders/test_build_gettext.py
.py
"""Test the build process with gettext builder with the test root.""" from __future__ import annotations import gettext import re import subprocess from contextlib import chdir from pathlib import Path from subprocess import CalledProcessError from typing import TYPE_CHECKING import pytest from sphinx.builders.gett...
352
11,272
openvino
tests/layer_tests/tensorflow_tests/test_tf_Angle.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 TestAngle(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'y:0' in inputs_info ...
46
1,778
returns
tests/test_context/test_requires_context_result/test_requires_context_result_cast.py
.py
from returns.context import ( ReaderResult, ReaderResultE, RequiresContextResult, RequiresContextResultE, ) def _function(arg: int) -> RequiresContextResultE[float, int]: if arg == 0: return RequiresContextResult.from_failure( ZeroDivisionError('Divided by 0'), ) re...
34
1,144
saleor
saleor/thumbnail/__init__.py
.py
# defines the available thumbnail resolutions THUMBNAIL_SIZES = [32, 64, 128, 256, 512, 1024, 2048, 4096] DEFAULT_THUMBNAIL_SIZE = 4096 FILE_NAME_MAX_LENGTH = 55 class ThumbnailFormat: ORIGINAL = "original" AVIF = "avif" WEBP = "webp" CHOICES = [ (ORIGINAL, "Original"), (AVIF, "AVIF...
65
1,501
probability
tensorflow_probability/python/distributions/blockwise.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...
462
17,173
probability
tensorflow_probability/python/internal/dtype_util_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...
305
12,002
sqlmap
lib/request/multiparthandler.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import io import mimetypes import re from lib.core.compat import choose_boundary from lib.core.convert import getBytes from lib.core.exception import SqlmapDataException from thi...
90
3,718
saleor
saleor/graphql/core/types/sync_webhook_control.py
.py
from typing import Generic, TypeVar from django.db.models import Model from graphene.types.resolver import get_default_resolver from .. import ResolveInfo from ..context import SyncWebhookControlContext from . import BaseObjectType from .model import ModelObjectType N = TypeVar("N") class SyncWebhookControlContext...
38
887
beam
sdks/python/apache_beam/ml/anomaly/detectors/iqr_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...
53
1,506
astropy
astropy/table/setup_package.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from pathlib import Path from numpy import get_include as get_numpy_include from setuptools import Extension ROOT = Path(__file__).parent.relative_to(Path.cwd()) def get_extensions(): sources = [ROOT / "_np_utils.pyx", ROOT / "_column_mixins.pyx"...
26
582
toolz
toolz/curried/exceptions.py
.py
import toolz __all__ = ['merge_with', 'merge'] @toolz.curry def merge_with(func, d, *dicts, **kwargs): return toolz.merge_with(func, d, *dicts, **kwargs) @toolz.curry def merge(d, *dicts, **kwargs): return toolz.merge(d, *dicts, **kwargs) merge_with.__doc__ = toolz.merge_with.__doc__ merge.__doc__ = too...
19
337
biopython
Tests/test_Align_phylip.py
.py
# Copyright 2006-2014 by Peter Cock. All rights reserved. # Revisions copyright 2011 Brandon Invergo. 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.phyli...
1,099
56,435
mlflow
tests/projects/test_virtualenv_projects.py
.py
import os from unittest import mock import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.utils.virtualenv import _create_virtualenv from mlflow.utils.yaml_utils import read_yaml, write_yaml from tests.projects.utils import ( TEST_VIRTUALENV_CONDA_PROJECT_DIR, TEST_VIRTUALENV_...
148
4,827
tomli
src/tomli/_parser.py
.py
# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Taneli Hukkinen # Licensed to PSF under a Contributor Agreement. from __future__ import annotations # Defer loading regular expressions until we actually need them in # parse_value(). __lazy_modules__ = ["tomli._re"] import sys from ._re import ( RE_...
800
26,622
pyomo
pyomo/contrib/solver/solvers/gms_sol_reader.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...
123
4,185
saleor
saleor/graphql/discount/tests/mutations/test_promotion_bulk_delete.py
.py
from unittest import mock import graphene from .....discount.models import Promotion, PromotionRule from .....product.models import ProductChannelListing, ProductVariant from ....tests.utils import get_graphql_content PROMOTION_BULK_DELETE_MUTATION = """ mutation promotionBulkDelete($ids: [ID!]!) { promo...
140
3,812
pyomo
pyomo/core/tests/unit/kernel/test_list_container.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,058
39,998
pyomo
pyomo/contrib/gdpopt/discrete_problem_initialize.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...
382
15,082
jupytext
tests/functional/simple_notebooks/test_ipynb_to_myst.py
.py
import json import unittest.mock as mock from textwrap import dedent import pytest from jupyter_server.utils import ensure_async from nbformat.v4.nbbase import new_notebook from tornado.web import HTTPError import jupytext from jupytext.cli import jupytext as jupytext_cli from jupytext.compare import compare from jup...
260
6,896
wandb
wandb/sdk/integration_utils/auto_logging.py
.py
from __future__ import annotations import asyncio import functools import inspect import logging from collections.abc import Sequence from typing import Any, Protocol, TypeVar import wandb.sdk import wandb.util from wandb.sdk.lib import telemetry as wb_telemetry from wandb.sdk.lib.timer import Timer logger = logging...
234
8,163
sphinx
sphinx/search/_stopwords/fi.py
.py
# automatically generated by utils/generate-snowball.py # from https://github.com/snowballstem/snowball-website/raw/efb4ae4d65769fb1652acbe608c0c817e746c730/algorithms/finnish/stop.txt from __future__ import annotations FINNISH_STOPWORDS = frozenset({ 'ei', 'eivät', 'emme', 'en', 'et', 'ette',...
237
3,401
sqlmap
tests/test_convert.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Encoding / decoding / serialization round-trips and known vectors. Covers: hex, base64 (std + url-safe), DBMS hex decode, byte<->text conversion, JSON (de)seri...
141
6,061
mlflow
tests/store/artifact/test_databricks_models_artifact_repo.py
.py
import json from unittest import mock from unittest.mock import ANY import pytest import requests from mlflow.entities import FileInfo from mlflow.entities.model_registry import ModelVersion from mlflow.environment_variables import MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE from mlflow.exceptions import MlflowException fro...
448
16,930
saleor
saleor/graphql/discount/utils.py
.py
from collections import defaultdict from copy import deepcopy from enum import Enum from typing import Any, cast import graphene from django.conf import settings from django.db.models import Exists, OuterRef, QuerySet from graphene.utils.str_converters import to_snake_case from ...checkout.models import Checkout from...
510
17,066
eve
tests/response.py
.py
# -*- coding: utf-8 -*- import os from ast import literal_eval import simplejson as json import eve from . import TestBase class TestResponse(TestBase): def setUp(self): super().setUp() self.r = self.test_client.get("/%s/" % self.empty_resource) def test_response_data(self): respo...
110
4,073
beam
sdks/python/apache_beam/testing/benchmarks/nexmark/queries/query7.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...
58
2,145
wagtail
wagtail/admin/tests/pages/test_workflow_history.py
.py
import datetime from django.conf import settings from django.contrib.auth.models import Permission from django.test import TestCase from django.urls import reverse from django.utils import timezone from django.utils.formats import localize from freezegun import freeze_time from wagtail.admin.utils import get_user_dis...
386
13,517
biopython
BioSQL/Loader.py
.py
# Copyright 2002 by Andrew Dalke. All rights reserved. # Revisions 2007-2016 copyright by Peter Cock. All rights reserved. # Revisions 2008 copyright by Cymon J. Cox. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BS...
1,261
51,599
wagtail
wagtail/api/v3/schemas/generators/read.py
.py
import copy from typing import Any, Callable, Literal, cast from django.core.exceptions import FieldDoesNotExist from django.db.models import ForeignKey, Model from django.db.models.fields import Field from django.db.models.fields.reverse_related import ForeignObjectRel from ninja import Schema from ninja.errors impor...
362
14,756
lemur
lemur/plugins/lemur_sftp/tests/test_sftp.py
.py
import unittest from unittest.mock import patch, Mock, MagicMock, mock_open from flask import Flask from lemur.plugins.lemur_sftp import plugin from paramiko.ssh_exception import AuthenticationException class TestSftp(unittest.TestCase): def setUp(self): self.sftp_destination = plugin.SFTPDestinationPlug...
145
6,654
wagtail
wagtail/images/tests/utils.py
.py
import os from io import BytesIO import PIL.Image from django.conf import settings from django.core import serializers from django.core.files.images import ImageFile from wagtail.images import get_image_model Image = get_image_model() def get_test_image_filename(image, filterspec): """ Get the generated fi...
94
2,906
beam
learning/tour-of-beam/learning-content/final-challenge/final-challenge-2/python-solution/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...
136
5,027
hydra
plugins/hydra_ax_sweeper/hydra_plugins/hydra_ax_sweeper/ax_sweeper.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import List, Optional from hydra.plugins.sweeper import Sweeper from hydra.types import HydraContext, TaskFunction from omegaconf import DictConfig from .config import AxConfig class AxSweeper(Sweeper): """Class to interface with...
32
907
django-cms
cms/test_utils/util/mock.py
.py
class AttributeObject: """ mock = AttributeObject(hello='world') mock.hello # 'world' """ def __init__(self, **kwargs): self.kwargs = kwargs for key, value in kwargs.items(): setattr(self, key, value) def __repr__(self): return '<AttributeObject: %r>' % self....
19
487
coveragepy
coverage/inorout.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 """Determining whether files are being measured/reported or not.""" from __future__ import annotations import importlib.util import inspect import itertools imp...
652
25,400
coremltools
coremltools/converters/lightgbm/_tree.py
.py
# Copyright (c) 2026, 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 coremltools as ct from coremltools import __version__ as ct_version from ._tree_ensemble import ...
94
2,913
wagtail
wagtail/admin/views/reports/base.py
.py
import swapper from django.utils.translation import gettext_lazy as _ from wagtail.admin.views.generic import BaseListingView, PermissionCheckedMixin from wagtail.admin.views.mixins import SpreadsheetExportMixin Page = swapper.load_model("wagtailcore", "Page") class ReportView(SpreadsheetExportMixin, PermissionChec...
56
2,028
luigi
luigi/contrib/beam_dataflow.py
.py
# -*- coding: utf-8 -*- # # Copyright 2019 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 or a...
489
16,331
saleor
saleor/graphql/views.py
.py
import decimal import hashlib import importlib import time from inspect import isclass from typing import Any, cast from urllib.parse import urljoin import orjson from django.conf import settings from django.core.cache import cache from django.core.exceptions import RequestDataTooBig from django.http import HttpReques...
686
27,159
coremltools
coremltools/test/optimize/torch/smoke_test.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 torch class TestSmokeTest: def test_coremltools_optimize_torch_import(self): imp...
32
1,322
mlflow
dev/clint/src/clint/rules/empty_notebook_cell.py
.py
from clint.rules.base import Rule class EmptyNotebookCell(Rule): def _message(self) -> str: return "Empty notebook cell. Remove it or add some content."
7
167
mlflow
tests/gateway/providers/test_mosaicml.py
.py
from unittest import mock import pytest from aiohttp import ClientTimeout from fastapi import HTTPException from fastapi.encoders import jsonable_encoder from pydantic import ValidationError from mlflow import MlflowException from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS from mlflow.ga...
567
18,649
saleor
saleor/webhook/transport/asynchronous/tests/test_deferred_payload.py
.py
import datetime import json import uuid from dataclasses import asdict from decimal import Decimal from unittest import mock import graphene import pytest from celery.exceptions import Retry from django.test import override_settings from .....checkout.calculations import fetch_checkout_data from .....checkout.fetch i...
609
19,938
pyomo
pyomo/contrib/viewer/report.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...
168
5,137
pyomo
pyomo/gdp/plugins/partition_disjuncts.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...
916
38,297
coremltools
coremltools/optimize/torch/palettization/__init__.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 """ .. _coremltools_optimize_torch_palettization: .. include:: palettization_desc.rst :end-line...
68
2,283
sqlmap
tests/test_configfile.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Offline tests for the '-c' configuration-file contract. configFileParser() walks optDict and reads an option only from the section named after the family that declares it, so an opti...
133
5,019
pyfilesystem2
fs/info.py
.py
"""Container for filesystem resource informations. """ from __future__ import absolute_import, print_function, unicode_literals import typing from typing import cast import six from copy import deepcopy from ._typing import Text, overload from .enums import ResourceType from .errors import MissingInfoNamespace from...
466
13,457
wandb
wandb/cli/beta.py
.py
"""Beta versions of wandb CLI commands. These commands are experimental and may change or be removed in future versions. """ from __future__ import annotations import pathlib import click from wandb.analytics import get_sentry from wandb.errors import WandbCoreNotAvailableError from wandb.util import get_core_path...
259
6,602
sqlmap
plugins/dbms/mysql/filesystem.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.agent import agent from lib.core.common import getSQLSnippet from lib.core.common import isNumPosStrValue from lib.core.common import isTechniqueAvailable from lib.c...
178
7,734
saleor
saleor/webhook/transport/asynchronous/tests/test_send_webhooks_async_for_app.py
.py
from unittest.mock import ANY, patch from .....core.models import EventDelivery, EventDeliveryAttempt, EventDeliveryStatus from ..transport import ( WebhookResponse, send_webhooks_async_for_app, ) @patch( "saleor.webhook.transport.asynchronous.transport.send_webhook_using_scheme_method" ) @patch( "sa...
217
6,650
hydra
tools/configen/tests/test_modules/generated_future_annotations.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Generated by configen, do not edit. # See https://github.com/hydra-ecosystem/hydra/tree/main/tools/configen # fmt: off # isort:skip_file # flake8: noqa from dataclasses import dataclass, field from omegaconf import MISSING from tests.test_modules...
26
834
probability
tensorflow_probability/python/sts/components/regression_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...
249
9,770
deap
examples/gp/ant.py
.py
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
213
6,844
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupintobatches_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");...
54
1,762
openvino
tests/layer_tests/pytorch_tests/test_sum.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestSum(PytorchLayerTest): def _prepare_input(self, out=False, input_dtype="float32", out_dtype="float32", axes=None, keep_dims=None): ...
116
5,328
pyomo
pyomo/environ/tests/test_package_layout.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...
165
6,163
hydra
tests/test_apps/app_with_callbacks/keyboard_interrupt/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging from typing import Any from omegaconf import DictConfig import hydra from hydra.core.utils import JobReturn from hydra.experimental.callback import Callback log = logging.getLogger(__name__) class CustomCallback(Callback): d...
54
1,566
mlflow
tests/genai/judges/test_judge_tool_get_root_span.py
.py
import pytest from mlflow.entities.span import Span from mlflow.entities.trace import Trace from mlflow.entities.trace_data import TraceData from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow.entities.trace_state import TraceState from mlflow.genai.jud...
259
7,772
pyomo
pyomo/solvers/tests/checks/test_gurobi_direct.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...
439
17,510
python-prompt-toolkit
src/prompt_toolkit/shortcuts/progress_bar/__init__.py
.py
from __future__ import annotations from .base import ProgressBar, ProgressBarCounter from .formatters import ( Bar, Formatter, IterationsPerSecond, Label, Percentage, Progress, Rainbow, SpinningWheel, Text, TimeElapsed, TimeLeft, ) __all__ = [ "ProgressBar", "Progre...
34
540
saleor
saleor/core/telemetry/__init__.py
.py
import uuid from importlib import import_module from typing import Any from opentelemetry.sdk._configuration import _OTelSDKConfigurator from opentelemetry.sdk.resources import SERVICE_INSTANCE_ID from opentelemetry.util.types import Attributes from .metric import DEFAULT_DURATION_BUCKETS, Meter, MeterProxy, MetricTy...
79
2,303
textual
tests/option_list/test_option_list_movement.py
.py
"""Test movement within an option list.""" from __future__ import annotations import pytest from textual.app import App, ComposeResult from textual.widgets import OptionList from textual.widgets.option_list import Option class OptionListApp(App[None]): """Test option list application.""" def compose(self)...
212
7,187
hypercorn
tests/middleware/test_proxy_fix.py
.py
from __future__ import annotations from unittest.mock import AsyncMock import pytest from hypercorn.middleware import ProxyFixMiddleware from hypercorn.typing import ConnectionState, HTTPScope @pytest.mark.asyncio async def test_proxy_fix_legacy() -> None: mock = AsyncMock() app = ProxyFixMiddleware(mock) ...
74
2,197
clearml
examples/reporting/plotly_reporting.py
.py
# ClearML - Example of Plotly integration and reporting # from clearml import Task import plotly.express as px # Connecting ClearML with the current process, # from here on everything is logged automatically task = Task.init('examples', 'plotly reporting') print('reporting plotly figures') # Iris dataset df = px.da...
23
607