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
src/torchmetrics/functional/clustering/__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...
45
1,961
saleor
saleor/csv/models.py
.py
from django.db import models from django.db.models import JSONField from django.utils import timezone from ..account.models import User from ..app.models import App from ..core.models import Job from ..core.utils.json_serializer import CustomJsonEncoder from . import ExportEvents class ExportFile(Job): user = mo...
37
1,304
astropy
astropy/modeling/tests/data/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from pathlib import Path dpath = str(Path(__file__).parent.resolve())
6
136
beam
sdks/python/apache_beam/transforms/external_it_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...
67
2,299
kafka
tests/kafkatest/tests/core/compatibility_test_new_broker_test.py
.py
# 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 # distributed under the Li...
93
8,490
astropy
astropy/coordinates/builtin_frames/cirs_observed_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains the transformation functions for getting to "observed" systems from CIRS. """ import erfa import numpy as np from astropy import units as u from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.erfa_astrom ...
107
3,824
pyomo
pyomo/opt/results/__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...
36
1,285
mlflow
mlflow/store/artifact/s3_artifact_repo.py
.py
import json import logging import os import posixpath import urllib.parse from datetime import datetime, timezone from functools import lru_cache from io import BytesIO from mimetypes import guess_type from mlflow.entities import FileInfo from mlflow.entities.multipart_upload import ( CreateMultipartUploadResponse...
784
33,696
sphinx
tests/test_builders/test_incremental_reading.py
.py
"""Test the Builder class.""" from __future__ import annotations import sys from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from sphinx.testing.util import SphinxTestApp @pytest.mark.sphinx( 'dummy', testroot='root', srcdir='test_builder', freshenv=True, ) def test_incremental...
60
1,615
astropy
astropy/units/tests/test_photometric.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for the photometric module. Note that this is shorter than might be expected because a lot of the relevant tests that deal with magnidues are in `test_logarithmic.py` """ from astropy.tests.helper import assert_quantity_allclose from astropy.u...
45
1,167
wagtail
wagtail/documents/tests/test_api_v3/test_update.py
.py
import json from unittest import mock from django.contrib.auth.models import Group, Permission from django.db.models.signals import post_save from django.urls import reverse from wagtail.documents import get_document_model from wagtail.models import GroupCollectionPermission from .base import TestV3DocumentsBase Do...
171
6,468
saleor
saleor/discount/tests/test_discounts.py
.py
import datetime from decimal import Decimal import graphene import pytest from django.utils import timezone from prices import Money, TaxedMoney from ...checkout.fetch import CheckoutLineInfo from ...discount.interface import VariantPromotionRuleInfo from ...order import OrderStatus from .. import DiscountType, Disco...
804
23,466
pyro
tests/ops/conftest.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest def pytest_collection_modifyitems(items): for item in items: if item.nodeid.startswith("tests/ops"): if "stage" not in item.keywords: item.add_marker(pytest.mark.stage("unit")...
14
430
wandb
wandb/integration/openai/fine_tuning.py
.py
from __future__ import annotations import base64 import datetime import io import json import os import re import tempfile import time from typing import Any from packaging.version import parse import wandb from wandb import util from wandb.data_types import Table from wandb.sdk.lib import telemetry openai = util.g...
483
18,470
pyro
tests/contrib/forecast/test_util.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from torch.distributions import transform_to import pyro.distributions as dist from pyro.contrib.forecast.util import ( UNIVARIATE_DISTS, UNIVARIATE_TRANSFORMS, prefix_condition, reshape_batc...
157
5,539
saleor
saleor/tests/e2e/apps/utils/__init__.py
.py
from .app_create import add_app __all__ = [ "add_app", ]
6
62
readthedocs.org
readthedocs/projects/tests/test_version_handling.py
.py
import django_dynamic_fixture as fixture import pytest from readthedocs.builds.constants import BRANCH, TAG from readthedocs.builds.models import Build, Version from readthedocs.projects.models import Project from readthedocs.projects.version_handling import ( determine_stable_version, sort_versions_calver, ...
249
6,554
conda
conda/_preview/env_setup/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Preview feature: env-setup. Scaffolding for the upcoming Rich CLI and runner facade for create/install/update/remove. Currently non-operational — all CLI entry points raise ``OperationNotAllowed``. """ PREVIEW_LABEL = "env-setup"
10
312
scikit-bio
skbio/tests/test_workflow.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. # --------------------------------------------...
405
13,167
conda
tests/shell/test_cmd_exe.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import os import sys from logging import getLogger from pathlib import Path from re import escape from typing import TYPE_CHECKING import pytest from conda import CONDA_PACKAGE_ROOT from conda import __versi...
364
12,186
mlflow
mlflow/assistant/__init__.py
.py
from functools import lru_cache from mlflow.assistant.config import AssistantConfig @lru_cache(maxsize=100) def get_project_path(experiment_id: str) -> str | None: """Get the project path for a given experiment ID. Args: experiment_id: The experiment ID to look up. Returns: The project ...
26
668
deap
deap/benchmarks/gp.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 ...
137
3,825
ipython
tests/test_inputtransformer2_line.py
.py
"""Tests for the line-based transformers in IPython.core.inputtransformer2 Line-based transformers are the simpler ones; token-based transformers are more complex. See test_inputtransformer2 for tests for token-based transformers. """ import pytest from IPython.core import inputtransformer2 as ipt2 CELL_MAGIC = ( ...
350
5,785
tqdm
tests/tests_contrib_logging.py
.py
# pylint: disable=missing-module-docstring, missing-class-docstring # pylint: disable=missing-function-docstring, no-self-use import logging import logging.handlers import sys from io import StringIO import pytest from tqdm import tqdm from tqdm.contrib.logging import _get_first_found_console_logging_handler from tqd...
187
7,449
astropy
astropy/cosmology/_src/tests/flrw/conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Configure the tests for :mod:`astropy.cosmology`.""" from collections.abc import Iterable, Mapping, Sequence from typing import TypeVar from astropy.cosmology._src.tests.helper import clean_registry # noqa: F401 from astropy.tests.helper import pick...
33
956
openvino
tests/e2e_tests/common/plugins/e2e_test/conftest.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Local pytest plugin for tests execution.""" import inspect import itertools import logging as log # pylint:disable=import-error import re import os import sys import traceback from copy import copy from pathlib import Path import py...
411
17,173
probability
tensorflow_probability/python/glm/fisher_scoring_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...
349
12,320
ipython
IPython/utils/dir2.py
.py
"""A fancy version of Python's builtin :func:`dir` function.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations import inspect import types from typing import Any from collections.abc import Callable def safe_hasattr(obj: objec...
87
2,403
probability
tensorflow_probability/python/layers/dense_variational_v2.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...
201
7,567
sphinx
tests/roots/test-ext-autodoc/target/cached_property.py
.py
from functools import cached_property class Foo: @cached_property def prop(self) -> int: return 1 @cached_property def prop_with_type_comment(self): # type: () -> int return 1
13
219
deap
deap/benchmarks/binary.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 ...
143
4,928
kombu
kombu/utils/objects.py
.py
"""Object Utilities.""" from __future__ import annotations from threading import RLock __all__ = ('cached_property',) try: from functools import cached_property as _cached_property except ImportError: # TODO: Remove this fallback once we drop support for Python < 3.8 from cached_property import threaded...
68
2,043
onnxruntime
onnxruntime/test/testdata/trt_reshape_test.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import onnx from onnx import TensorProto, helper def generate_model(model_name): nodes = [ helper.make_node( "Reshape", ["data", "shape"], ["reshaped"],...
43
984
mkdocs-material
material/plugins/info/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...
36
1,656
astropy
astropy/io/ascii/tests/test_mesa.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for MESA stellar evolution code file format reader/writer. Test Data Files --------------- Test data files are located in astropy/io/ascii/tests/data/: - history_mesa.data : MESA history file with 25 models and 3 columns (truncated from a rea...
242
10,094
sphinx
sphinx/domains/index.py
.py
"""The index domain.""" from __future__ import annotations from typing import TYPE_CHECKING from docutils import nodes from docutils.parsers.rst import directives from sphinx import addnodes from sphinx.domains import Domain from sphinx.util import logging from sphinx.util.docutils import ReferenceRole, SphinxDirec...
131
4,358
saleor
saleor/graphql/giftcard/mutations/gift_card_assign_user.py
.py
import graphene from django.core.exceptions import ValidationError from ....account.models import User as UserModel from ....core.tracing import traced_atomic_transaction from ....core.utils.events import call_event from ....giftcard import events from ....giftcard.error_codes import GiftCardErrorCode from ....giftcar...
105
3,760
conda
conda/plugins/solvers.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Register the classic conda solver.""" from ..base.constants import CLASSIC_SOLVER from . import hookimpl from .types import CondaSolver @hookimpl(tryfirst=True) # make sure the classic solver can't be overwritten def conda_solvers(): ...
19
496
saleor
saleor/tests/e2e/checkout/utils/checkout_complete.py
.py
from ...account.utils.fragments import ADDRESS_FRAGMENT from ...utils import get_graphql_content CHECKOUT_COMPLETE_MUTATION = ( """ mutation CheckoutComplete($checkoutId: ID!) { checkoutComplete(id: $checkoutId) { errors { message field code } order { id userEmail ...
166
2,826
onnxruntime
onnxruntime/test/python/transformers/test_whisper_timestamp_processor.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import ...
83
3,475
sphinx
tests/roots/test-extensions/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve()))
5
83
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_add_with_undefined_constant.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() # Create the graph and model with tf.Session() as sess: x = tf.placeholder(tf.float32, [2, 3], 'x') const = tf.constant(value=[], dtype=tf.float32, shape=[3], name='Cons...
14
492
saleor
saleor/tests/e2e/checkout/discounts/sales/test_checkout_custom_price_and_fixed_sale.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....checkout.utils import checkout_lines_update from ....product.utils.preparing_product import prepare_product from ....sales.utils import ( create_sale, create_sale_channel_listing, sale_catalogues_add, ) fr...
150
5,147
django-cms
cms/apps.py
.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class CMSConfig(AppConfig): name = 'cms' verbose_name = _("django CMS") default_auto_field = 'django.db.models.AutoField' def ready(self): from cms.utils.setup import setup, setup_cms_apps setup(...
15
347
saleor
saleor/graphql/channel/tests/mutations/test_base_channel_listing.py
.py
from collections import defaultdict import graphene import pytest from django.core.exceptions import ValidationError from .....shipping.error_codes import ShippingErrorCode from ...mutations import BaseChannelListingMutation def test_validate_duplicated_channel_ids(channel_PLN, channel_USD): # given channel...
167
5,101
openvino
tests/layer_tests/pytorch_tests/test_embedding_bag.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from pytorch_layer_test_class import PytorchLayerTest class TestEmbeddingBag1dOffsets(PytorchLayerTest): def _prepare_input(self, indicies_dtype, per_sample_weights=False): import numpy as np...
247
8,972
returns
returns/unsafe.py
.py
from typing import TypeVar from returns.io import IO _ValueType = TypeVar('_ValueType') def unsafe_perform_io(wrapped_in_io: IO[_ValueType]) -> _ValueType: """ Compatibility utility and escape mechanism from ``IO`` world. Just unwraps the internal value from :class:`returns.io.IO` container. Sh...
32
829
saleor
saleor/core/editorjs/tests/conftest.py
.py
import pydantic_core import pytest @pytest.fixture def no_link_rel(cleaner_settings): """Disable ``rel`` attribute for links. This disables appending `rel="noopener noreferrer"` to link which simplifies tests. """ cleaner_settings.link_rel = None def assert_pydantic_errors( exc: pydantic_co...
23
593
confluent-kafka-python
examples/json_producer_encryption.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2024 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
213
7,419
pyro
profiler/distributions.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import argparse import torch from torch.autograd import Variable from profiler.profiling_utils import Profile, profile_print from pyro.distributions import ( Bernoulli, Beta, Categorical, Cauchy, Dirichlet, ...
191
5,360
astropy
astropy/utils/tests/test_data_info.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import numpy as np import pytest import astropy.units as u from astropy.coordinates import SkyCoord from astropy.table import QTable from astropy.table.index import SlicedIndex from astropy.time import Time from astropy.utils.data_info imp...
118
3,356
probability
tensorflow_probability/python/math/psd_kernels/internal/test_util.py
.py
# Copyright 2022 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...
64
2,588
clearml
clearml/binding/import_bind.py
.py
import sys import builtins import types from collections import defaultdict from typing import Callable, Any class PostImportHookPatching: _patched = False _post_import_hooks = defaultdict(list) @staticmethod def _init_hook() -> None: if PostImportHookPatching._patched: return ...
75
2,753
saleor
saleor/product/utils/variant_prices.py
.py
from collections import defaultdict from decimal import Decimal from typing import cast from uuid import UUID from django.conf import settings from django.db import transaction from django.db.models import Exists, OuterRef from prices import Money from ...channel.models import Channel from ...core.taxes import zero_m...
364
14,254
python-prompt-toolkit
examples/prompts/mouse-support.py
.py
#!/usr/bin/env python from prompt_toolkit import prompt if __name__ == "__main__": print( "This is multiline input. press [Meta+Enter] or [Esc] followed by [Enter] to accept input." ) print("You can click with the mouse in order to select text.") answer = prompt("Multiline input: ", multiline=T...
11
378
python-prompt-toolkit
src/prompt_toolkit/styles/base.py
.py
""" The base classes for the styling. """ from __future__ import annotations from abc import ABCMeta, abstractmethod from collections.abc import Callable, Hashable from typing import NamedTuple __all__ = [ "Attrs", "DEFAULT_ATTRS", "ANSI_COLOR_NAMES", "ANSI_COLOR_NAMES_ALIASES", "BaseStyle", ...
190
5,091
beam
sdks/python/apache_beam/io/external/xlang_bigqueryio_it_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...
645
22,266
mkdocs-material
material/plugins/tags/structure/mapping/__init__.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...
99
3,532
onnxruntime
onnxruntime/test/python/quantization/test_onnx_model.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. # ---------------------------------------------------------------...
174
6,724
textual
docs/examples/styles/color.py
.py
from textual.app import App from textual.widgets import Label class ColorApp(App): CSS_PATH = "color.tcss" def compose(self): yield Label("I'm red!", id="label1") yield Label("I'm rgb(0, 255, 0)!", id="label2") yield Label("I'm hsl(240, 100%, 50%)!", id="label3") if __name__ == "__m...
17
363
saleor
saleor/graphql/menu/bulk_mutations/menu_item_bulk_delete.py
.py
import graphene from django.conf import settings from ....menu import models from ....permission.enums import MenuPermissions from ....webhook.event_types import WebhookEventAsyncType from ....webhook.utils import get_webhooks_for_event from ...core import ResolveInfo from ...core.mutations import ModelBulkDeleteMutat...
50
1,825
astropy
astropy/coordinates/builtin_frames/itrs_observed_transforms.py
.py
import erfa import numpy as np from astropy import units as u from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix from astropy.coordinates.representation import CartesianRepresentation from astropy.coordinates.transformation...
145
5,630
mkdocs-material
material/plugins/tags/structure/listing/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...
116
4,226
flit
flit_core/tests_core/samples/moduleunimportable.py
.py
""" A sample unimportable module """ raise ImportError() __version__ = "0.1"
9
80
mlflow
mlflow/store/artifact/databricks_tracking_artifact_repo.py
.py
import logging import re from abc import ABC, abstractmethod from pathlib import Path from mlflow.entities import FileInfo from mlflow.exceptions import MlflowException from mlflow.store.artifact.artifact_repo import ArtifactRepository from mlflow.store.artifact.databricks_artifact_repo import DatabricksArtifactReposi...
112
5,096
openvino
tests/layer_tests/pytorch_tests/test_addmm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestAddMM(PytorchLayerTest): def _prepare_input(self, input_shape=(2, 2), matrix1_shape=(2, 2), matrix2_shape=(2, 2)): return ( self.ran...
97
3,944
onnxruntime
onnxruntime/python/tools/quantization/neural_compressor/util.py
.py
# # The implementation of this file is based on: # https://github.com/intel/neural-compressor/tree/master/neural_compressor # # Copyright (c) 2023 Intel Corporation # # 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 ...
81
2,682
luigi
luigi/__version__.py
.py
# coding: utf-8 VERSION = "3.8.1"
4
35
metrics
src/torchmetrics/functional/classification/precision_recall.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
799
36,816
mlflow
mlflow/shap/__init__.py
.py
import os import tempfile import types import warnings from contextlib import contextmanager from typing import Any import numpy as np import yaml import mlflow import mlflow.utils.autologging_utils from mlflow import pyfunc from mlflow.models import Model, ModelInputExample, ModelSignature from mlflow.models.model i...
692
25,527
saleor
saleor/graphql/discount/types/promotions.py
.py
import graphene from graphene import relay from ....discount import models from ....permission.auth_filters import AuthorizationFilters from ...channel.types import Channel from ...core import ResolveInfo from ...core.connection import CountableConnection from ...core.descriptions import PREVIEW_FEATURE from ...core.d...
171
6,321
django-cms
cms/wizards/helpers.py
.py
import warnings from cms.utils.compat.warnings import RemovedInDjangoCMS60Warning from .wizard_base import get_entries, get_entry # noqa: F401 warnings.warn( "The cms.wizards.helpers module is deprecated and will be removed in django CMS 6.0. " "Use cms.wizards.wizard_base.get_entries and cms.wizards.wizard...
13
400
scikit-bio
skbio/util/_optionals.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. # --------------------------------------------...
56
1,453
ipython
IPython/utils/tempdir.py
.py
"""This module contains classes - NamedFileInTemporaryDirectory, TemporaryWorkingDirectory. These classes add extra features such as creating a named file in temporary directory and creating a context manager for the working directory which is also temporary. """ from __future__ import annotations import os as _os f...
64
2,094
astropy
astropy/uncertainty/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sub-package contains classes and functions for creating distributions that work similar to `~astropy.units.Quantity` or array objects, but can propagate uncertainties. """ from .core import * from .distributions import *
11
296
jupytext
tests/data/notebooks/inputs/sphinx/plot_notebook.py
.py
# -*- coding: utf-8 -*- """ Notebook styled examples ======================== The gallery is capable of transforming Python files into reStructuredText files with a notebook structure. For this to be used you need to respect some syntax rules. It makes a lot of sense to contrast this output rst file with the :downloa...
117
4,231
saleor
saleor/graphql/account/tests/benchmark/test_permission_group.py
.py
import graphene import pytest from .....account.models import Group from .....permission.enums import AccountPermissions, OrderPermissions from ....tests.utils import get_graphql_content @pytest.mark.django_db @pytest.mark.count_queries(autouse=False) def test_permission_group_create( staff_user, permission_...
370
10,051
openvino
src/frontends/tensorflow/tests/test_models/gen_wrapper.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import shutil import subprocess import sys # do not print messages from TensorFlow os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' if len(sys.argv) < 4: print("Script[model in pbtxt format], output folder and mark file must be s...
35
1,013
pyomo
pyomo/contrib/piecewise/transform/nested_inner_repn.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...
210
9,229
coremltools
coremltools/converters/mil/backend/nn/op_mapping.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 numpy as _np from tqdm import tqdm as _tqdm from coremltools import _logger as logger from co...
3,837
129,701
openvino
tests/samples_tests/smoke_tests/test_classification_sample_async.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Copyright (C) 2018-2026 Intel Corporation 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.a...
75
2,711
cvxpy
cvxpy/atoms/lambda_max.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...
133
4,220
onnxruntime
onnxruntime/python/tools/transformers/models/torch_export_patches/patches/patch_transformers.py
.py
import inspect import sys from dataclasses import dataclass from typing import Any import torch from transformers.cache_utils import Cache, DynamicCache, StaticCache from transformers.generation.utils import GenerationMixin from transformers.modeling_attn_mask_utils import AttentionMaskConverter def _patch_make_caus...
475
20,997
wagtail
wagtail/admin/forms/tags.py
.py
from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ from taggit.forms import TagField as TaggitTagField from taggit.models import Tag, TagBase from wagtail.admin.widgets import AdminTagWidget def validate_tag_length( value, max_tag_length=TagBase._meta.get_fi...
69
2,178
mlflow
mlflow/genai/simulators/__init__.py
.py
from mlflow.genai.simulators.distillation import generate_test_cases from mlflow.genai.simulators.simulator import ( BaseSimulatedUserAgent, ConversationSimulator, SimulatedUserAgent, SimulatorContext, ) __all__ = [ "BaseSimulatedUserAgent", "ConversationSimulator", "SimulatedUserAgent", ...
16
371
saleor
saleor/checkout/webhooks/exclude_shipping.py
.py
import json import logging from typing import TYPE_CHECKING, Union from promise import Promise from ...core.db.connection import allow_writer from ...core.utils.json_serializer import CustomJsonEncoder from ...shipping.interface import ExcludedShippingMethod, ShippingMethodData from ...shipping.webhooks.shared import...
77
2,448
saleor
saleor/graphql/product/mutations/product/product_delete.py
.py
import graphene from django.db import transaction from django.db.models.expressions import Exists, OuterRef from .....attribute import AttributeInputType from .....attribute import models as attribute_models from .....attribute.lock_objects import attribute_value_qs_select_for_update from .....core.tracing import trac...
114
4,397
probability
tensorflow_probability/python/optimizer/linesearch/internal/hager_zhang_lib_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...
417
16,591
beam
sdks/python/apache_beam/utils/plugin.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...
42
1,542
beam
learning/tour-of-beam/learning-content/io/big-query-io/read-table/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...
65
2,459
saleor
saleor/graphql/core/tests/test_core_reordering.py
.py
import pytest from ....attribute import models as attribute_models from ..utils.reordering import perform_reordering SortedModel = attribute_models.AttributeValue def _sorted_by_order(items): return sorted(items, key=lambda o: o[1]) def _get_sorted_map(): return list( SortedModel.objects.values_li...
273
7,589
wagtail
wagtail/views.py
.py
import swapper from django.conf import settings from django.http import Http404, HttpResponse from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils.http import url_has_allowed_host_and_scheme from wagtail import hooks from wagtail.forms import PasswordViewRestrictio...
65
2,191
astropy
astropy/coordinates/errors.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module defines custom errors and exceptions used in astropy.coordinates.""" __all__ = [ "ConvertError", "NonRotationTransformationError", "NonRotationTransformationWarning", "UnknownSiteException", ] from typing import TYPE_CHECK...
93
2,881
wagtail
wagtail/test/demosite/apps.py
.py
from django.apps import AppConfig class DemositeAppConfig(AppConfig): default_auto_field = "django.db.models.AutoField" name = "wagtail.test.demosite"
7
161
lemur
lemur/tests/plugins/issuer_plugin.py
.py
from lemur.plugins.bases import IssuerPlugin from lemur.tests.vectors import SAN_CERT_STR, INTERMEDIATE_CERT_STR, IP_SAN_NO_CN_CERT_STR from lemur.common.utils import parse_csr from cryptography import x509 from cryptography.x509.oid import ExtensionOID class TestIssuerPlugin(IssuerPlugin): title = "Test" sl...
63
2,114
saleor
saleor/graphql/discount/tests/mutations/test_sale_catalogues_remove.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_REMOVE_MUTATION = """ ...
316
10,524
python-prompt-toolkit
src/prompt_toolkit/formatted_text/html.py
.py
from __future__ import annotations import xml.dom.minidom as minidom from string import Formatter from typing import Any from .base import FormattedText, StyleAndTextTuples __all__ = ["HTML"] class HTML: """ HTML formatted text. Take something HTML-like, for use as a formatted string. :: ...
146
4,374
textual
tests/test_modal.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.containers import Grid from textual.screen import ModalScreen from textual.widgets import Button, Footer, Header, Label TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration...
100
2,563
wagtail
wagtail/images/tests/test_bulk_actions/test_bulk_add_tags.py
.py
from django.contrib.auth.models import Permission from django.test import TestCase from django.urls import reverse from wagtail.images import get_image_model from wagtail.images.tests.utils import get_test_image_file from wagtail.test.utils import WagtailTestUtils Image = get_image_model() test_file = get_test_image_...
85
2,661
wagtail
wagtail/admin/views/generic/workflow.py
.py
from django.conf import settings from django.contrib.admin.utils import quote from django.core.exceptions import PermissionDenied from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils.translation import gettext as _ from django.views import View from wagtail.admin i...
276
9,947