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
qutip
qutip/core/data/eigen.py
.py
import numpy as np import scipy.linalg import scipy.sparse as sp import scipy.sparse.linalg from itertools import combinations from .dense import Dense, from_csr from .csr import CSR, nnz from .properties import isherm as _isherm from qutip.settings import settings __all__ = [ 'eigs', 'eigs_csr', 'eigs_dense', ...
467
15,513
saleor
saleor/graphql/shipping/tests/mutations/test_delivery_options_calculate.py
.py
import datetime from decimal import Decimal from unittest import mock import graphene from django.utils import timezone from prices import Money from promise import Promise from .....checkout.delivery_context import fetch_shipping_methods_for_checkout from .....checkout.models import Checkout, CheckoutDelivery from ....
464
15,403
black
tests/data/cases/t_docstring.py
.py
# flags: --minimum-version=3.14 def tea(): t" not a docstring" def tea2(): t' also not a docstring' def triple_quoted_template(): t""" not a docstring """ def triple_quoted_template2(): t''' also not a docstring ''' def raw_template(): rt" not a docstring " def capitalized_tem...
59
871
cvxpy
cvxpy/tests/nlp_tests/test_interfaces.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 ...
274
10,389
wagtail
wagtail/project_template/project_name/wsgi.py
.py
""" WSGI config for {{ project_name }} project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.enviro...
17
432
onnx
onnx/reference/ops/op_tanh.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class Tanh(OpRunUnaryNum): def _run(self, x): return (np.tanh(x),)
14
267
mlflow
tests/pyfunc/test_logged_models.py
.py
import json import os from concurrent.futures import ThreadPoolExecutor import pytest import mlflow from mlflow.entities.logged_model_status import LoggedModelStatus from mlflow.exceptions import MlflowException from mlflow.models import Model from mlflow.tracing.constant import TraceMetadataKey from mlflow.utils.mlf...
158
6,171
probability
tensorflow_probability/python/experimental/nn/util/random_variable_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
97
3,618
openvino
src/bindings/python/src/openvino/opset5/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.opset1.ops import absolute from openvino.opset1.ops import absolute as abs from openvino.opset1.ops import acos from openvino.opset4.ops import acosh from openvino.opset1.ops import add from openvino...
153
6,424
onnx
onnx/reference/ops/op_unsqueeze.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class Unsqueeze_1(OpRun): def _run(self, data, axes=None): if isinstance(axes, np.ndarray): axes = tuple(axes) ...
53
1,592
pyomo
examples/mpec/indexed.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...
27
896
astropy
astropy/visualization/wcsaxes/tests/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This sub-package makes use of image testing with the pytest-mpl package: # # https://pypi.org/project/pytest-mpl # # For more information on writing image tests, see the 'Image tests with # pytest-mpl' section of the developer docs.
9
300
saleor
saleor/graphql/giftcard/mutations/gift_card_balance_adjust.py
.py
from decimal import Decimal import graphene from django.core.exceptions import ValidationError 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 ....giftcard.lock_objects impor...
110
4,260
pyomo
examples/pyomo/piecewise/indexed.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
61
2,145
wagtail
wagtail/admin/tests/test_compare.py
.py
from functools import partial from django.test import TestCase from django.utils.safestring import SafeString from wagtail.admin import compare from wagtail.blocks import StreamValue from wagtail.images import get_image_model from wagtail.images.tests.utils import get_test_image_file from wagtail.test.testapp.models ...
1,726
61,273
beam
sdks/python/apache_beam/runners/portability/fn_api_runner/translations_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...
465
19,147
openvino
tests/layer_tests/tensorflow_tests/test_tf_SpaceToBatch.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from common.tf_layer_test_class import CommonTFLayerTest class TestSpaceToBatch(CommonTFLayerTest): def create_space_to_batch_net(self, in_shape, pads_value, block_shape_value): import tensor...
67
2,752
saleor
saleor/graphql/translations/tests/mutations/test_collection_translate.py
.py
import graphene from ....core.enums import LanguageCodeEnum from ....tests.utils import get_graphql_content COLLECTION_TRANSLATE_MUTATION = """ mutation ( $id: ID!, $languageCode: LanguageCodeEnum!, $input: TranslationInput! ) { collectionTranslate( id: $id, ...
181
5,003
coremltools
deps/protobuf/python/google/protobuf/text_format.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...
1,796
60,006
onnxruntime
onnxruntime/python/tools/transformers/onnx_model_gpt2.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging import onnx from fusion_gpt_attention import FusionGptAt...
102
3,812
cvxpy
cvxpy/reductions/solvers/conic_solvers/glpk_mi_conif.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...
134
4,761
conda
tests/shards/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ Sharded repodata tests """
6
106
deap
examples/ga/evoknn_jmlr.py
.py
#!/usr/bin/env python2.7 # 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. # ...
47
1,929
sphinx
sphinx/deprecation.py
.py
"""Sphinx deprecation classes and utilities.""" from __future__ import annotations import os import warnings class RemovedInSphinx10Warning(DeprecationWarning): pass class RemovedInSphinx11Warning(PendingDeprecationWarning): pass RemovedInNextVersionWarning = RemovedInSphinx10Warning # By default, all...
90
2,777
openvino
tests/layer_tests/pytorch_tests/test_min_max.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 TestMinMax(PytorchLayerTest): def _prepare_input(self, input_dtype="float32", second_input=False, second_input_dtype="float32"): imp...
352
14,153
conda
tests/plugins/test_exception_observers.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import sys from typing import TYPE_CHECKING import pytest from conda import CondaError, plugins from conda import __version__ as CONDA_VERSION from conda.exception_handler import ExceptionHandler from conda....
380
11,103
wandb
wandb/analytics/opentelemetry/__init__.py
.py
"""OpenTelemetry-based analytics for the wandb SDK. Forwards telemetry events (metrics and logs) to wandb-core. Wandb-core then forwards the telemetry events to the W&B backend for ingestion into Datadog. """ __all__ = ( "TelemetryContext", "TelemetryRecorder", ) from .opentelemetry_proxy import TelemetryCon...
14
344
onnxruntime
tools/python/util/add_openvino_win_libs.py
.py
# Copyright (C) 2022-2023 Intel Corporation # Licensed under the MIT License import os import site import sys def add_openvino_libs_to_path() -> None: """Adds OpenVINO libraries to the PATH environment variable on Windows.""" if sys.platform == "win32": # Installer, pip installs openvino dlls to the ...
36
1,637
wandb
tests/system_tests/test_registries/test_registry_artifacts_public_api.py
.py
from __future__ import annotations from typing import Any from urllib.parse import quote import wandb from pytest import fixture from wandb import Api, Artifact from wandb._strutils import b64encode_ascii, nameof from wandb.apis.public.registries.registry import Registry from wandb.sdk.artifacts._generated import ( ...
159
4,473
saleor
saleor/app/utils.py
.py
from ..webhook.event_types import WebhookEventSyncType from ..webhook.utils import get_webhooks_for_event def get_active_tax_apps(identifiers: list[str] | None = None): checkout_webhooks = get_webhooks_for_event( event_type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES, apps_identifier=identifiers...
19
652
saleor
saleor/core/utils/tests/test_cache.py
.py
from ..cache import CacheDict def test_capacity(): # given cache = CacheDict(2) cache[1] = "a" cache[2] = "b" # when cache[3] = "c" # then assert 1 not in cache assert 2 in cache assert 3 in cache def test_persistence(): # given cache = CacheDict(2) watchdog = o...
45
638
python-prompt-toolkit
examples/dialogs/button_dialog.py
.py
#!/usr/bin/env python """ Example of button dialog window. """ from prompt_toolkit.shortcuts import button_dialog def main(): result = button_dialog( title="Button dialog example", text="Are you sure?", buttons=[("Yes", True), ("No", False), ("Maybe...", None)], ).run() print(f"R...
21
379
pyomo
doc/OnlineDocs/src/expr/index.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...
20
706
saleor
saleor/discount/tests/test_utils/test_calculate_discounted_price_for_promotions.py
.py
from decimal import Decimal import graphene from ... import PromotionRuleInfo, RewardValueType from ...models import Promotion, PromotionRule from ...utils.promotion import calculate_discounted_price_for_promotions def test_variant_discounts_multiple_promotions(product, channel_USD): # given variant = produ...
169
5,333
confluent-kafka-python
src/confluent_kafka/schema_registry/json_schema.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 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...
21
748
pyomo
pyomo/opt/plugins/sol.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...
274
12,041
ipython
IPython/core/magics/__init__.py
.py
"""Implementation of all the magic functions built into IPython. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distribu...
43
1,619
conda
tests/test_reporters.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations from contextlib import nullcontext from io import StringIO from typing import TYPE_CHECKING import pytest from conda.base.context import context, reset_context from conda.exceptions import CondaSystemExit, D...
120
3,372
beam
sdks/python/apache_beam/dataframe/doctests_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...
248
6,816
deap
examples/coev/coop_adapt.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 ...
139
4,952
scikit-optimize
skopt/tests/test_gpr.py
.py
import pytest import numpy as np from skopt.learning import GaussianProcessRegressor @pytest.mark.fast_test def test_gpr_uses_noise(): """ Test that gpr is using WhiteKernel""" X = np.random.normal(size=[100, 2]) Y = np.random.normal(size=[100]) g_gaussian = GaussianProcessRegressor(noise='gaussian...
18
428
mkdocs-material
material/overrides/hooks/shortcodes.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...
295
11,290
lemur
lemur/tests/test_auth.py
.py
from unittest.mock import patch import pytest from cryptography.hazmat.primitives import hashes from cryptography.hazmat.backends import default_backend import jwt from lemur.auth.service import decode_with_multiple_secrets @patch("lemur.auth.service.metrics") def test_decode_with_multiple_secrets(mock_metrics): ...
84
3,610
mkdocs-material
material/plugins/tags/__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...
47
1,989
openvino
src/bindings/python/docs/examples/custom_module/custom_helpers.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 def top1_index(results: list) -> int: return results.index(max(results))
7
184
hydra
tools/landscape/test_refresh_landscape_metadata.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import json from pathlib import Path from types import SimpleNamespace import refresh_landscape_metadata as refresh def test_default_input_uses_analyzer_output() -> None: assert refresh.DEFAULT_INPUT.name == "hydra-project-analysis-v1.ndjson...
121
4,047
saleor
saleor/graphql/order/tests/queries/test_orders.py
.py
from decimal import Decimal from unittest.mock import patch from .....order import OrderStatus from .....order.events import ( draft_order_created_from_replace_event, fulfillment_fulfilled_items_event, order_added_products_event, ) from .....tax.calculations.order import update_order_prices_with_flat_rates...
255
8,302
clearml
examples/frameworks/catboost/catboost_example.py
.py
# ClearML - Example of CatBoost training, saving model and loading model # import argparse from catboost import CatBoostRegressor, Pool from catboost.datasets import msrank from clearml import Task import numpy as np from sklearn.model_selection import train_test_split def main(iterations): # Download train a...
61
2,186
jupyterlab
examples/example_check.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """ This file is mean to be called with a path to an example directory as its argument. We import the application entry point for the example and add instrument them with a Playwright test that makes sure there are no...
160
5,509
saleor
saleor/webhook/tests/response_schemas/test_transaction.py
.py
import math from datetime import UTC, datetime from decimal import Decimal import pytest from django.utils import timezone from freezegun import freeze_time from pydantic import ValidationError from ....payment import TransactionAction, TransactionEventType from ...response_schemas.transaction import ( PaymentGat...
1,277
35,329
sphinx
sphinx/ext/autodoc/_dynamic/_signatures.py
.py
"""Signature utilities for autodoc""" from __future__ import annotations import sys from inspect import Parameter, Signature from typing import TYPE_CHECKING, NewType, TypeVar from sphinx.errors import PycodeError from sphinx.ext.autodoc._dynamic._preserve_defaults import update_default_value from sphinx.ext.autodoc...
647
23,987
marshmallow
src/marshmallow/types.py
.py
"""Type aliases. .. warning:: This module is provisional. Types may be modified, added, and removed between minor releases. """ from __future__ import annotations import typing T = typing.TypeVar("T") #: A type that can be either a sequence of strings or a set of strings StrSequenceOrSet: typing.TypeAlias = t...
55
1,634
mlflow
tests/pyfunc/sample_code/streamable_model_code.py
.py
from mlflow.models import set_model from mlflow.pyfunc import PythonModel class StreamableModel(PythonModel): def __init__(self): pass def predict(self, context, model_input, params=None): pass def predict_stream(self, context, model_input, params=None): yield "test1" yie...
18
362
coremltools
coremltools/proto/__init__.py
.py
### Module for proto generated Python code. import os as _os if int(_os.environ.get("IMPORT_COREMLTOOLS_PROTO", "1")): from . import FeatureTypes_pb2, MIL_pb2, Model_pb2, NeuralNetwork_pb2
7
199
mlflow
mlflow/data/filesystem_dataset_source.py
.py
from abc import abstractmethod from typing import Any from mlflow.data.dataset_source import DatasetSource class FileSystemDatasetSource(DatasetSource): """ Represents the source of a dataset stored on a filesystem, e.g. a local UNIX filesystem, blob storage services like S3, etc. """ @property ...
82
2,540
mlflow
tests/genai/labeling/test_labeling.py
.py
from mlflow.genai import labeling from mlflow.genai.labeling import ( Agent, LabelingSession, ReviewApp, create_labeling_session, delete_labeling_session, get_labeling_session, get_labeling_sessions, get_review_app, ) from tests.genai.conftest import databricks_only @databricks_only d...
26
825
wandb
wandb/integration/lightgbm/__init__.py
.py
"""W&B callback for lightgbm. Really simple callback to get logging for each tree Example usage: param_list = [("eta", 0.08), ("max_depth", 6), ("subsample", 0.8), ("colsample_bytree", 0.8), ("alpha", 8), ("num_class", 10)] config.update(dict(param_list)) lgb = lgb.train(param_list, d_train, callbacks=[wandb_callbac...
243
8,005
mlflow
dev/clint/src/clint/rules/unparameterized_generic_type.py
.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class UnparameterizedGenericType(Rule): def __init__(self, type_hint: str) -> None: self.type_hint = type_hint @staticmethod def is_generic_type(node: ast.Name | ast.Attribute, resolver: Resolver) -> bool: i...
33
902
textual
tests/snapshot_tests/snapshot_apps/tooltips.py
.py
from textual.app import App, ComposeResult from textual.widgets import ProgressBar class TooltipApp(App[None]): TOOLTIP_DELAY = 0.4 def compose(self) -> ComposeResult: progress_bar = ProgressBar(100, show_eta=False) progress_bar.advance(10) progress_bar.tooltip = "Hello, Tooltip!" ...
18
410
clearml
clearml/utilities/lowlevel/astor_unparse.py
.py
from __future__ import print_function, unicode_literals import ast import sys from typing import Callable, Iterable, TextIO, Tuple, Optional, Any import six from six import StringIO # Large float and imaginary literals get turned into infinities in the AST. # We unparse those infinities to INFSTR. INFSTR = "1e" + re...
927
28,907
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_matmul_v2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from save_model import saveModel import sys def matmul(name, x1, x2, x_transpose=False, y_transpose=False): import paddle paddle.enable_static() with paddle.static.program_guard(paddle.static.Program(), p...
64
2,410
beam
sdks/python/apache_beam/options/value_provider.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...
197
5,796
openvino
tests/layer_tests/tensorflow_tests/test_tf_AdjustContrastv2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest rng = np.random.default_rng(2323534) class TestAdjustContrastv2(CommonTFLayerTest): def _prepare_input(self, inputs_...
42
1,769
openvino
tests/layer_tests/tensorflow_tests/test_tf_AssignOps.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest rng = np.random.default_rng() OPS = { 'tf.raw_ops.AssignAdd': tf.raw_ops.AssignAdd, 'tf.raw_ops.AssignSub': tf.ra...
121
5,809
gunicorn
tests/test_reload.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import unittest.mock as mock from gunicorn.app.base import Application from gunicorn.workers.base import Worker from gunicorn.reloader import reloader_engines class ReloadApp(Application): def __init__(self)...
73
1,957
probability
spinoffs/inference_gym/inference_gym/targets/dirichlet_test.py
.py
# Copyright 2025 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
79
2,558
django-cms
cms/test_utils/project/placeholderapp/cms_config.py
.py
from cms.app_base import CMSAppConfig from .models import Example1 from .views import render_example_content class Example1CMSAppConfig(CMSAppConfig): cms_enabled = True cms_toolbar_enabled_models = [(Example1, render_example_content)]
10
247
conda
tests/data/recipes/small_python_package/small_python_package/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ A small Python package for conda testing. """ __version__ = "1.0.0" def hello(): """Return a friendly greeting.""" return "Hello from small-python-package!"
13
247
httpie
httpie/cli/dicts.py
.py
from collections import OrderedDict from multidict import MultiDict, CIMultiDict class BaseMultiDict(MultiDict): """ Base class for all MultiDicts. """ class HTTPHeadersDict(CIMultiDict, BaseMultiDict): """ Headers are case-insensitive and multiple values are supported through the `add()` A...
95
2,317
sphinx
tests/roots/test-ext-intersphinx-role/conf.py
.py
extensions = ['sphinx.ext.intersphinx'] # the role should not honor this conf var intersphinx_disabled_reftypes = ['*']
4
120
probability
tensorflow_probability/python/math/minimize.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...
632
27,799
mlflow
mlflow/store/tracking/_sql_backend_utils.py
.py
from functools import wraps from typing import Any, Callable, TypeVar, cast from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import FEATURE_DISABLED F = TypeVar("F", bound=Callable[..., Any]) def filestore_not_supported(func: F) -> F: """ Decorator for FileStore methods that a...
34
1,163
wandb
wandb/sdk/lib/lazyloader.py
.py
"""module lazyloader.""" import importlib import sys import types class LazyLoader(types.ModuleType): """Lazily import a module, mainly to avoid pulling in large dependencies. We use this for tensorflow and other optional libraries primarily at the top module level. """ # The lint error here is...
64
1,891
jupytext
tests/functional/others/test_cell_tags_are_preserved.py
.py
import pytest from nbformat.v4.nbbase import new_code_cell, new_markdown_cell from jupytext import reads, writes from jupytext.formats import formats_with_support_for_cell_metadata, is_myst_available @pytest.fixture() def notebook_with_tags(python_notebook): nb = python_notebook nb.cells = [ new_code...
30
1,063
onnxruntime
tools/nuget/generate_nuspec_for_native_nuget.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import os import re import shutil import sys from pathlib import Path # These platform version values are the default target platform versions for .NET 9 from the table here: # https://learn.microsoft.com/en-...
1,261
52,190
saleor
saleor/graphql/page/tests/queries/pages_with_where/test_with_where_validation.py
.py
import pytest from .....tests.utils import get_graphql_content from .shared import QUERY_PAGES_WITH_WHERE @pytest.mark.parametrize( "attribute_value_filter", [{"numeric": None}, {"name": None}, {"slug": None}, {"boolean": False}], ) def test_pages_query_failed_filter_validation_for_numeric_with_slug_input( ...
301
8,649
httpie
httpie/output/ui/rich_help.py
.py
import re import textwrap from typing import AbstractSet, Iterable, Optional, Tuple from rich.console import RenderableType from rich.highlighter import RegexHighlighter from rich.padding import Padding from rich.table import Table from rich.text import Text from httpie.cli.constants import SEPARATOR_GROUP_ALL_ITEMS ...
231
6,565
wagtail
wagtail/admin/tests/pages/test_bulk_actions/test_bulk_delete.py
.py
from unittest import mock import swapper from django.contrib.auth.models import Permission from django.db.models.signals import post_delete, pre_delete from django.http import HttpRequest from django.http.response import HttpResponse from django.test import TestCase, override_settings from django.urls import reverse f...
606
25,208
pyro
pyro/distributions/stable.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch from torch.distributions import constraints from torch.distributions.utils import broadcast_all from pyro.distributions.stable_log_prob import _stable_log_prob from pyro.distributions.torch_distribution i...
247
9,997
probability
tensorflow_probability/python/distributions/mixture.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...
466
18,796
onnxruntime
onnxruntime/contrib_ops/cuda/sparse/sparse_attention_v1/sparse_attention_triton.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import triton import triton.language as tl # This kernel is for prompt...
167
6,670
metrics
src/torchmetrics/functional/text/eed.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...
416
17,569
saleor
saleor/graphql/shop/tests/benchmark/test_homepage.py
.py
import pytest from ....order.tests.benchmark.test_order import FRAGMENT_SHIPPING_METHODS from ....tests.utils import get_graphql_content @pytest.mark.django_db @pytest.mark.count_queries(autouse=False) def test_retrieve_shop(api_client, channel_USD, count_queries): query = ( FRAGMENT_SHIPPING_METHODS ...
34
807
tablib
src/tablib/_vendor/dbfpy/dbfnew.py
.py
#!/usr/bin/python __version__ = "$Revision: 1.4 $"[11:-2] __date__ = "$Date: 2006/07/04 08:18:18 $"[7:-2] __all__ = ["dbf_new"] from .dbf import Dbf from .fields import ( DbfCharacterFieldDef, DbfDateFieldDef, DbfDateTimeFieldDef, DbfLogicalFieldDef, DbfNumericFieldDef, ) from .header import DbfH...
189
5,362
qutip
doc/guide/scripts/spectrum_ex1.py
.py
import numpy as np from matplotlib import pyplot import qutip N = 4 # number of cavity fock states wc = wa = 1.0 * 2 * np.pi # cavity and atom frequency g = 0.1 * 2 * np.pi # coupling strength kappa = 0.75 # cavity dissipation rate gamma = 0.25 # atom dissipatio...
49
1,759
sphinx
sphinx/builders/_epub_base.py
.py
"""Base class of epub2/epub3 builders.""" from __future__ import annotations import html import os import os.path import re import time from pathlib import Path from typing import TYPE_CHECKING, NamedTuple from urllib.parse import quote from zipfile import ZIP_DEFLATED, ZIP_STORED, ZipFile from docutils import nodes...
810
29,875
beam
sdks/python/apache_beam/runners/direct/direct_userstate.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...
311
11,290
beam
sdks/python/apache_beam/metrics/cells.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...
1,038
29,149
structlog
tests/conftest.py
.py
# SPDX-License-Identifier: MIT OR Apache-2.0 # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the MIT License. See the LICENSE file in the root of this # repository for complete details. import logging from io import StringIO import pytest import structlog from structlog._log...
77
1,531
probability
tensorflow_probability/python/bijectors/sinh_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
73
2,843
mlflow
tests/dspy/test_save.py
.py
import importlib import json from unittest import mock import dspy import dspy.teleprompt import pytest from dspy.utils.dummies import DummyLM, dummy_rm from packaging.version import Version import mlflow from mlflow.exceptions import MlflowException from mlflow.models import Model, ModelSignature from mlflow.types.s...
624
21,010
wagtail
wagtail/admin/views/pages/edit.py
.py
import json from urllib.parse import quote import swapper from django.conf import settings from django.contrib.auth import get_user_model from django.core.exceptions import PermissionDenied from django.db import transaction from django.db.models import Prefetch, Q from django.http import HttpResponse, JsonResponse fro...
1,164
45,386
saleor
saleor/tests/e2e/product/utils/__init__.py
.py
from .category import create_category from .collection import create_collection from .collection_add_products import add_product_to_collection from .collection_listing_update import create_collection_channel_listing from .product import create_product, raw_create_product from .product_attribute_assignment_update import...
47
1,703
pyomo
examples/kernel/piecewise_functions.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...
82
2,100
pyomo
doc/OnlineDocs/src/scripting/concrete1.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...
19
804
saleor
saleor/graphql/tax/tests/mutations/test_tax_country_configuration_delete.py
.py
from .....tax.models import TaxClass from ....tests.utils import assert_no_permission, get_graphql_content from ..fragments import TAX_COUNTRY_CONFIGURATION_FRAGMENT MUTATION = ( """ mutation TaxCountryConfigurationDelete($countryCode: CountryCode!) { taxCountryConfigurationDelete(countryCode: $country...
73
2,104
coremltools
coremltools/converters/mil/mil/ops/tests/iOS15/test_elementwise_unary.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest from coremltools.converters.mil.mil.ops.defs.iOS15 ...
41
1,184
textual
examples/clock.py
.py
""" An App to show the current time. """ from datetime import datetime from textual.app import App, ComposeResult from textual.widgets import Digits class ClockApp(App): CSS = """ Screen { align: center middle; } Digits { width: auto; } """ def compose(self) -> ComposeResult: yield Digi...
32
628
sqlmap
tests/test_comparison_json.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission D1 - structure-aware (JSON) detection oracle. Two layers: * jsonMinimize() (lib/core/common.py): the order-independent leaf-path projection. * comparison() (lib/request/comparison...
143
6,192
pyomo
pyomo/contrib/solver/solvers/ipopt.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...
732
28,515