repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
wandb
wandb/sdk/interface/interface_sock.py
.py
from __future__ import annotations import logging from typing import TYPE_CHECKING from typing_extensions import override from wandb.proto import wandb_server_pb2 as spb from wandb.sdk.lib import asyncio_manager from .interface_shared import InterfaceShared if TYPE_CHECKING: from wandb.proto import wandb_inter...
60
1,779
saleor
saleor/graphql/channel/dataloaders/by_self.py
.py
from ....channel.models import Channel from ...core.dataloaders import DataLoader class ChannelByIdLoader(DataLoader[int, Channel]): context_key = "channel_by_id" def batch_load(self, keys): channels = Channel.objects.using(self.database_connection_name).in_bulk(keys) return [channels.get(cha...
21
657
probability
spinoffs/inference_gym/inference_gym/tools/stan/util.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...
138
4,316
onnxruntime
onnxruntime/test/python/quantization/test_op_matmul_bnb4.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
179
5,759
hatch
src/hatch/env/collectors/plugin/hooks.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from hatch.env.collectors.custom import CustomEnvironmentCollector from hatch.env.collectors.default import DefaultEnvironmentCollector from hatchling.plugin import hookimpl if TYPE_CHECKING: from hatch.env.collectors.plugin.interface import Env...
17
633
sqlmap
plugins/dbms/vertica/__init__.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.enums import DBMS from lib.core.settings import VERTICA_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.vertica.enumeration import Enumeration...
31
919
saleor
saleor/webhook/tests/test_webhook_tasks.py
.py
import pytest from ...app.models import App from ..event_types import WebhookEventAsyncType from ..models import Webhook, WebhookEvent from ..utils import get_webhooks_for_event @pytest.fixture def webhooks_factory(): def factory(apps, event_type): webhooks = [Webhook(name=f"Webhook {i}", app=app) for i,...
36
1,189
coremltools
coremltools/converters/mil/backend/nn/passes/commingle_loop_vars.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass from coremltools.conv...
75
2,472
probability
discussion/robust_inverse_graphics/util/tree2_test.py
.py
# Copyright 2024 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...
335
9,123
pyomo
pyomo/contrib/incidence_analysis/connected.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...
51
1,930
pyfilesystem2
fs/_tzcompat.py
.py
"""Compatibility shim for python2's lack of datetime.timezone. This is the example code from the Python 2 documentation: https://docs.python.org/2.7/library/datetime.html#tzinfo-objects """ from datetime import timedelta, tzinfo ZERO = timedelta(0) class UTC(tzinfo): """UTC""" def utcoffset(self, dt): ...
30
475
wagtail
wagtail/images/tests/test_bulk_actions/test_bulk_delete.py
.py
from django.contrib.auth.models import Permission from django.test import TestCase from django.urls import reverse from django.utils.http import urlencode from wagtail.images import get_image_model from wagtail.images.tests.utils import get_test_image_file from wagtail.test.testapp.models import VariousOnDeleteModel f...
139
5,120
saleor
saleor/graphql/channel/tests/mutations/test_channel_deactivate.py
.py
import json from unittest import mock import graphene from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....channel.error_codes import ChannelErrorCode from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import WebhookEventAsyncType fr...
125
3,682
confluent-kafka-python
src/confluent_kafka/_oauthbearer/aws/__init__.py
.py
# Copyright 2026 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
28
1,033
biopython
Tests/test_SearchIO_fasta_m10_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 fasta-m10 indexing.""" import os import unittest from search_tests...
61
2,173
wagtail
wagtail/admin/tests/pages/test_page_locking.py
.py
from django.contrib.auth.models import Group, Permission from django.test import TestCase from django.urls import reverse from django.utils import timezone from django.utils.html import escape from wagtail.test.testapp.models import SimplePage from wagtail.test.utils import Page, WagtailTestUtils class TestLocking(W...
345
11,740
saleor
saleor/payment/utils.py
.py
import json import logging from decimal import Decimal from typing import Any, Optional, cast, get_args, overload from uuid import UUID import graphene from babel.numbers import get_currency_precision from django.conf import settings from django.core.serializers.json import DjangoJSONEncoder from django.db import Inte...
2,081
76,084
saleor
saleor/tests/e2e/gift_cards/utils/gift_card_create.py
.py
from ...utils import get_graphql_content GIFT_CARD_CREATE_MUTATION = """ mutation GiftCardCreate($input: GiftCardCreateInput!) { giftCardCreate(input: $input) { giftCard { id code initialBalance { amount } } errors { code field message } } } """ d...
55
1,086
saleor
saleor/permission/management.py
.py
from django.apps import apps as global_apps from django.contrib.auth import get_permission_codename from django.contrib.contenttypes.management import create_contenttypes from django.db import DEFAULT_DB_ALIAS, router def _get_all_permissions(opts): # noqa: D200, D212 """Return (codename, name) for all permissio...
98
3,060
sphinx
sphinx/search/no.py
.py
"""Norwegian search language.""" from __future__ import annotations import snowballstemmer from sphinx.search import SearchLanguage from sphinx.search._stopwords.no import NORWEGIAN_STOPWORDS class SearchNorwegian(SearchLanguage): lang = 'no' language_name = 'Norwegian' js_stemmer_rawcode = 'norwegian-...
23
610
scikit-bio
skbio/alignment/_distance.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. # --------------------------------------------...
264
9,815
qutip
qutip/solver/nm_mcsolve.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['nm_mcsolve', 'NonMarkovianMCSolver'] import numbers from typing import Any from collections.abc import Sequence import numpy as np from numpy.typing import ArrayLike from numpy.random import SeedSequence import scipy ...
687
27,288
probability
discussion/neutra/neutra_kernel_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...
135
4,751
onnxruntime
orttraining/orttraining/test/python/qat_poc_example/quantize.py
.py
import logging import numpy as np import torch from torchvision import datasets, transforms import onnxruntime.quantization as quantization def preprocess(input_model_dir, output_model_dir): """Preprocesses the given onnx model for quantization. Unused for QAT process.""" quantization.shape_inference.quant_...
63
2,232
lemur
lemur/utils.py
.py
""" .. module: lemur.utils :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import os import tempfile from contextlib import contextmanager import cryptography.fernet from sq...
131
3,848
wandb
wandb/proto/v7/wandb_otel_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: wandb/proto/wandb_otel.proto # Protobuf Python Version: 7.34.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_...
48
3,271
gunicorn
tests/test_asgi_disconnect.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Tests for ASGI graceful disconnect handling. Issue: https://github.com/benoitc/gunicorn/issues/3484 When a client disconnects, the ASGI worker should: 1. Send http.disconnect to the receive queue 2. Allow the...
317
11,157
beam
sdks/python/apache_beam/transforms/sql_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...
236
8,210
clearml
examples/optimization/hyper-parameter-optimization/multi_objective_hpo.py
.py
import sys from clearml import Task from clearml.automation import DiscreteParameterRange, HyperParameterOptimizer, UniformIntegerParameterRange try: from clearml.automation.optuna import OptimizerOptuna # noqa except ImportError: print("Multi-objective HPO is currently only supported via Optuna") sys.e...
112
5,864
biopython
Tests/common_BioSQL.py
.py
# 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. """Dealing with storage of biopython objects in a BioSQL relational db.""" import configparser import os import platform import tempfile import time im...
1,680
66,220
hatch
src/hatch/python/distributions.py
.py
from __future__ import annotations # fmt: off ORDERED_DISTRIBUTIONS: tuple[str, ...] = ( '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15', 'pypy2.7', 'pypy3.9', 'pypy3.10', 'pypy3.11', ) DISTRIBUTIONS: dict[str, dict[tuple[str, ...], str]] = { ...
515
52,057
wagtail
wagtail/admin/views/generic/ordering.py
.py
from django.contrib.admin.utils import unquote from django.db import transaction from django.db.models import F from django.http import JsonResponse from django.shortcuts import get_object_or_404 from django.views.generic import View from .permissions import PermissionCheckedMixin class ReorderView(PermissionChecked...
80
3,469
pyro
pyro/ops/tensor_utils.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch from torch.fft import irfft, rfft from .. import settings _ROOT_TWO_INVERSE = 1.0 / math.sqrt(2.0) CHOLESKY_RELATIVE_JITTER = 4.0 # in units of finfo.eps @settings.register("cholesky_relative_jitter",...
505
17,017
sqlmap
lib/core/unescaper.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.settings import EXCLUDE_UNESCAPE # Note: a plain dict (DBMS -> escape function) with a helper method; it is a runtime registry, ...
37
1,141
onnxruntime
onnxruntime/test/testdata/gh_issue_29071_if_constant_folding.py
.py
#!/usr/bin/env python3 """Standalone minimal problem for minimal_repro.onnx — the ORT 1.26 ConstantFolding HasExternalDataInMemory reproducer. Generated from the model; run to recreate an identical file. python3 onnxruntime/test/testdata/gh_issue_29071_if_constant_folding.py [out.onnx] """ import sys import nump...
389
13,007
luigi
luigi/contrib/dropbox.py
.py
# -*- coding: utf-8 -*- # # Copyright (c) 2019 Jose-Ignacio Riaño Chico # # 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 a...
329
11,571
mlflow
tests/gateway/providers/test_traffic_route_provider.py
.py
from typing import Any import pytest from mlflow.gateway.config import EndpointConfig from mlflow.gateway.providers.base import TrafficRouteProvider from tests.gateway.providers.test_openai import ( _run_test_chat, _run_test_chat_stream, _run_test_completions, _run_test_completions_stream, _run_t...
76
2,170
mkdocs
mkdocs/tests/__init__.py
.py
import logging import unittest.util unittest.util._MAX_LENGTH = 100000 # type: ignore[misc] class DisallowLogsHandler(logging.Handler): def __init__(self, level=logging.WARNING): super().__init__(level=level) self.formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s") def emit(...
17
469
astropy
astropy/convolution/tests/test_convolve.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from contextlib import nullcontext import numpy as np import numpy.ma as ma import pytest from numpy.testing import ( assert_allclose, assert_array_almost_equal, assert_array_almost_equal_nulp, ) from astropy import units as u from astropy.c...
1,416
48,030
biopython
Bio/PDB/ic_data.py
.py
# Copyright 2019-22 by Robert T. Miller. 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. """Per residue backb...
1,790
59,270
bazel
third_party/py/abseil/absl/testing/xml_reporter.py
.py
# Copyright 2017 The Abseil 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 ...
559
21,358
flit
flit/logo.py
.py
"""White and colored version for flit""" logo = """ ._ ._ ```. ```. .--.______ `. `-. `. / °,-—´ `. `~-.>.' / `. .` | -..;. / / /___ _____ /r_,.´| | | | ,' `/ |—— | | | .´...
21
448
coremltools
deps/protobuf/python/google/protobuf/pyext/cpp_message.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...
66
2,851
wagtail
wagtail/documents/tests/test_api_v3/test_create.py
.py
from unittest import mock from urllib.parse import urlsplit from django.contrib.auth.models import Group, Permission from django.core.files.uploadedfile import SimpleUploadedFile from django.db.models.signals import post_save from django.test import override_settings from django.urls import reverse from wagtail.docum...
191
7,345
pyro
pyro/optim/optim.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import inspect from typing import ( Any, Callable, Dict, Iterable, List, Optional, Type, Union, ValuesView, ) import torch from torch import Tensor from torch.nn.utils import clip_grad_norm_, cl...
289
10,660
wandb
wandb/automations/_generated/fragments.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from datetime import datetime from typing import Literal from pydantic import Field from wandb._pydantic import GQLId, GQLResult, Typename from .enums import AlertSeverity, EventTriggeringConditionType ...
167
4,854
readthedocs.org
readthedocs/oauth/tests/test_signals.py
.py
from unittest.mock import patch from allauth.account.models import EmailAddress from allauth.socialaccount.models import SocialAccount from django.contrib.auth.models import User from django.test import TestCase from django.urls import reverse from django_dynamic_fixture import get from readthedocs.allauth.providers....
118
4,708
onnxruntime
onnxruntime/python/tools/transformers/models/sam2/sam2_demo.py
.py
# ------------------------------------------------------------------------- # Copyright (R) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import os import matplotlib.image as mpimg import matplotlib.pyplot as ...
322
10,501
saleor
saleor/graphql/channel/utils.py
.py
from collections import defaultdict from django.core.exceptions import ValidationError from django.db.models import Exists, OuterRef, Q from django.utils.functional import SimpleLazyObject from graphql.error import GraphQLError from ...channel.exceptions import ChannelNotDefined, NoDefaultChannel from ...channel.mode...
161
5,850
saleor
saleor/webhook/tests/response_schemas/test_payment.py
.py
from unittest.mock import patch import pytest from pydantic import ValidationError from ....payment.interface import ( PaymentGatewayInitializeTokenizationResult, PaymentMethodTokenizationResult, StoredPaymentMethodRequestDeleteResult, ) from ...response_schemas.payment import ( CreditCardInfoSchema, ...
917
25,904
pyro
pyro/infer/smcfilter.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import contextlib import math import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.infer.util import is_validation_enabled from pyro.poutine.util import prune_subsample_sites class...
228
8,713
probability
tensorflow_probability/python/bijectors/cumsum.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...
122
3,590
coremltools
coremltools/proto/VisionFeaturePrint_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: VisionFeaturePrint.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _messag...
64
3,686
python-prompt-toolkit
src/prompt_toolkit/output/base.py
.py
""" Interface for an output. """ from __future__ import annotations from abc import ABCMeta, abstractmethod from typing import TextIO from prompt_toolkit.cursor_shapes import CursorShape from prompt_toolkit.data_structures import Size from prompt_toolkit.styles import Attrs from .color_depth import ColorDepth __al...
333
8,348
cvxpy
cvxpy/utilities/coo_array_compat.py
.py
""" Copyright 2025, the CVXPY authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
26
770
textual
tests/snapshot_tests/snapshot_apps/fr_with_min.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical, VerticalScroll from textual.widgets import Header, Footer, Static class ScreenSplitApp(App[None]): CSS = """ Horizontal { width: 1fr; } Vertical { width: 1fr; background: bl...
51
1,129
black
tests/data/cases/module_docstring_2.py
.py
"""I am a very helpful module docstring. With trailing spaces: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure do...
70
2,135
mlflow
tests/genai/test_scheduled_scorers.py
.py
from mlflow.genai.scheduled_scorers import ( ScorerScheduleConfig, ) from mlflow.genai.scorers.base import Scorer class MockScorer(Scorer): """Mock scorer for testing purposes.""" name: str = "mock_scorer" def __call__(self, *, outputs=None, **kwargs): return {"score": 1.0} def test_schedu...
29
795
beam
sdks/python/apache_beam/ml/inference/huggingface_inference.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...
750
29,816
pyomo
examples/mpec/munson1b.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...
34
1,094
astropy
astropy/utils/masked/tests/test_masked.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test masked class initialization, methods, and operators. Functions, including ufuncs, are tested in test_functions.py """ import operator import sys import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import u...
1,627
60,731
funcy
funcy/_inspect.py
.py
from __future__ import absolute_import from inspect import CO_VARARGS, CO_VARKEYWORDS, signature from collections import namedtuple import platform import re from .decorators import unwrap IS_PYPY = platform.python_implementation() == "PyPy" # This provides sufficient introspection for *curry() functions. # # We on...
187
6,352
onnxruntime
onnxruntime/test/python/transformers/test_onnx_attention/common.py
.py
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # Copyr...
921
37,522
textual
tests/tree/test_tree_node_children.py
.py
import pytest from textual.widgets import Tree from textual.widgets.tree import TreeNode def label_of(node: TreeNode[None]): """Get the label of a node as a string""" return str(node.label) async def test_tree_node_children() -> None: """A node's children property should act like an immutable list.""" ...
35
1,143
probability
spinoffs/fun_mc/fun_mc/using_tensorflow.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...
26
1,035
deap
examples/ga/onemax_numpy.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 ...
95
3,166
openvino
tests/layer_tests/tensorflow_tests/test_tf_Log1p.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 TestLog1p(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'x:0' in inputs_info ...
42
1,312
wagtail
wagtail/compat.py
.py
from django import VERSION as DJANGO_VERSION from django import forms from django.conf import settings from django.core.exceptions import ImproperlyConfigured # A setting that can be used in foreign key declarations AUTH_USER_MODEL = getattr(settings, "AUTH_USER_MODEL", "auth.User") # Two additional settings that are ...
46
1,454
beam
sdks/python/apache_beam/transforms/enrichment_handlers/bigquery.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...
301
12,497
bazel
src/test/py/bazel/cc_import_test.py
.py
# 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/LICENSE-2.0 # # Unless required by applicable la...
252
8,219
pyfilesystem2
tests/test_wrapfs.py
.py
from __future__ import unicode_literals import unittest from six import text_type from fs import wrapfs from fs.opener import open_fs class WrappedFS(wrapfs.WrapFS): wrap_name = "test" class TestWrapFS(unittest.TestCase): def setUp(self): self.wrapped_fs = open_fs("mem://") self.fs = Wrapp...
30
853
openvino
tests/layer_tests/tensorflow_tests/test_tf_Select.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 TestSelect(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'cond:0' in inputs_info, "...
98
4,637
conda
conda/core/path_actions.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Atomic actions that make up a package installation or removal transaction.""" from __future__ import annotations import os import re import sys from abc import ABC, abstractmethod from itertools import chain from logging import getLogger fr...
1,565
54,600
hydra
hydra/_internal/deprecation_warning.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os import warnings from typing import Type from hydra.errors import HydraDeprecationError def deprecation_warning( message: str, stacklevel: int = 1, category: Type[Warning] = UserWarning ) -> None: warnings_as_errors = os.environ....
17
523
openvino
src/bindings/python/tests/test_graph/test_ops_embedding.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino import Type from openvino import opset15 def test_embedding_bag_offsets_15(): emb_table = opset15.parameter([5, 2], name="emb_table", dtype=np.float32) ind...
101
4,276
pyomo
pyomo/contrib/pyros/tests/test_master.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...
718
27,671
onnxruntime
onnxruntime/test/python/onnxruntime_test_python_ort_parallel.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import ctypes import sys import threading import time import unittest import numpy as np from helper import get_name import onnxruntime as onnxrt class ThreadObj: def __init__(self, model_path: str, iterations: int, i...
155
5,308
notebook
notebook/_version.py
.py
"""Version info for notebook.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import re from collections import namedtuple # Use "hatch version xx.yy.zz" to handle version changes __version__ = "7.7.0a1" # PEP440 version parser _version_regex = re.compile( ...
41
988
wandb
tests/system_tests/test_core/test_file_stream.py
.py
import numpy as np import pytest import wandb from wandb.proto import wandb_internal_pb2 as pb @pytest.mark.parametrize("status_code", [429, 500]) def test_retries_retryable_codes(status_code, wandb_backend_spy): wandb_backend_spy.stub_filestream( "transient error", status=status_code, n_t...
88
2,589
saleor
saleor/graphql/translations/mutations/page_translate.py
.py
import graphene from ....page import models as page_models from ....permission.enums import SitePermissions from ...core.descriptions import RICH_CONTENT from ...core.enums import LanguageCodeEnum from ...core.fields import JSONString from ...core.types import TranslationError from .. import types as translation_types...
41
1,491
conda
conda/testing/solver_helpers.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Helpers for testing the solver.""" from __future__ import annotations import collections import functools import pathlib import time from tempfile import TemporaryDirectory import pytest from ..base.context import context from ..common.se...
1,339
47,555
pyro
pyro/infer/mcmc/adaptation.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math from collections import namedtuple import torch import pyro from pyro.ops.arrowhead import ( SymmArrowhead, sqrt, triu_gram, triu_inverse, triu_matvecmul, ) from pyro.ops.dual_averaging import Dual...
580
23,000
mlflow
mlflow/store/model_registry/rest_store.py
.py
import logging from mlflow.entities.model_registry import ModelVersion, RegisteredModel from mlflow.entities.webhook import Webhook, WebhookEvent, WebhookStatus, WebhookTestResult from mlflow.protos.model_registry_pb2 import ( CreateModelVersion, CreateRegisteredModel, DeleteModelVersion, DeleteModelVe...
596
22,257
mlflow
mlflow/genai/scorers/google_adk/registry.py
.py
"""Registry of Google ADK scorers exposed through ``get_scorer``.""" from __future__ import annotations from mlflow.exceptions import MlflowException def get_scorer_class(metric_name: str): """Return the Google ADK scorer class registered under ``metric_name``.""" from mlflow.genai.scorers.google_adk import...
33
920
ipython
tests/test_process.py
.py
""" Tests for platutils.py """ # ----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. # -------------...
241
6,933
mlflow
mlflow/utils/autologging_utils/events.py
.py
import warnings from typing import Any from mlflow.utils.autologging_utils import _logger def _catch_exception(fn): """A decorator that catches exceptions thrown by the wrapped function and logs them.""" def wrapper(*args): try: fn(*args) except Exception as e: _logge...
295
13,155
openvino
tools/commit_slider/commit_slider.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import subprocess # nosec B404 import os import shutil import sys from shutil import copytree from utils.cfg_manager import CfgManager from utils.helpers import safeClearDir, getParams, getActualCfg args, cfgData, customCfgPath = getPa...
122
4,366
sqlmap
tamper/__init__.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ pass
9
146
wandb
tests/system_tests/test_functional/sync/test_sync.py
.py
from __future__ import annotations import concurrent.futures import queue import subprocess import time import wandb from tests.fixtures.wandb_backend_spy import WandbBackendSpy _TIMEOUT_SLOW = 5 # Timeout for operations that may be slow. _TIMEOUT_NORMAL = 1 # Timeout for operations that are probably not too slow....
80
2,681
jupyterlab
jupyterlab/tests/test_extensions.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json import sys from unittest.mock import AsyncMock, Mock, patch import pytest from tornado import web from traitlets.config import Config, Configurable from jupyterlab.extensions import PyPIExtensionManager, ...
666
25,825
scikit-optimize
skopt/optimizer/gp.py
.py
"""Gaussian process-based minimization algorithms.""" import numpy as np from sklearn.utils import check_random_state from .base import base_minimize from ..utils import cook_estimator from ..utils import normalize_dimensions def gp_minimize(func, dimensions, base_estimator=None, n_calls=100, n_ran...
269
11,787
django-cms
cms/tests/test_check.py
.py
from contextlib import contextmanager from copy import deepcopy from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.test import TestCase from djangocms_text.cms_plugins import TextPlugin from cms.api import add_plugin from cms.models.placeholdermodel import Placeholder...
229
8,382
jupytext
tests/data/notebooks/outputs/ipynb_to_percent/Notebook with metadata and long cells.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [markdown] # # Part one - various cells # %% [markdown] # Here we have a markdown cell # # # with two blank lines # %% [markdown] # Now we have a markdown cell # with a code block inside it # # ```pyth...
53
833
saleor
saleor/graphql/app/tests/mutations/test_app_problem_dismiss.py
.py
import base64 import graphene from .....app.error_codes import AppProblemDismissErrorCode from ....tests.utils import assert_no_permission, get_graphql_content APP_PROBLEM_DISMISS_MUTATION = """ mutation AppProblemDismiss($input: AppProblemDismissInput!) { appProblemDismiss(input: $input) { e...
123
3,777
pyomo
pyomo/contrib/interior_point/examples/ex1.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...
43
1,697
wandb
wandb/sdk/artifacts/_generated/fetch_registry.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import RegistryFragment class FetchRegistry(GQLResult): entity: FetchRegistryEntity | None class FetchRegistryEntity(GQLResult): project: Regi...
21
408
mlflow
dev/clint/tests/rules/test_unsafe_version_parse.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import lint_file from clint.rules.unsafe_version_parse import UnsafeVersionParse def test_unsafe_version_parse(index: SymbolIndex) -> None: code = """ import importlib.metadata import importlib_metadata...
71
2,362
cvxpy
cvxpy/atoms/eye_minus_inv.py
.py
""" Copyright 2018 Akshay Agrawal 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...
129
3,503
mlflow
mlflow/gateway/providers/portkey.py
.py
from mlflow.gateway.config import PortkeyConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class PortkeyProvider(OpenAICompatibleProvider): DISPLAY_NAME = "Portkey" CONFIG_TYPE = PortkeyConfig DEFAULT_API_BASE = "https://api.portkey.ai/v1" @property def header...
44
2,203
luigi
luigi/contrib/pyspark_runner.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2012-2020 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 requ...
136
3,841