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 |
|---|---|---|---|---|---|
gunicorn | tests/test_asgi_proxy_protocol.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""ASGI PROXY protocol parser tests.
Covers the validation gaps that the WSGI parser already enforces:
- v1 TCP4/TCP6 addresses must be valid IP addresses (inet_pton).
- v2 must reject non-STREAM (UDP) protocols w... | 87 | 3,312 |
hydra | examples/instantiate/schema_recursive/my_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from dataclasses import dataclass
from typing import Optional
from omegaconf import MISSING
import hydra
from hydra.core.config_store import ConfigStore
from hydra.utils import instantiate, target_whitelist
class Tree:
def __init__(
... | 58 | 1,446 |
hatch | tests/helpers/templates/sdist/standard_include_config_file.py | .py | from hatch.template import File
from hatch.utils.fs import Path
from hatchling.metadata.spec import DEFAULT_METADATA_VERSION
from ..new.feature_no_src_layout import get_files as get_template_files
def get_files(**kwargs):
relative_root = kwargs.get("relative_root", "")
files = []
for f in get_template_f... | 54 | 1,328 |
pyomo | pyomo/contrib/mindtpy/tests/feasibility_pump1.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... | 60 | 1,984 |
pyomo | examples/pyomo/core/integrality1.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... | 22 | 860 |
wagtail | wagtail/test/testapp/views.py | .py | import calendar
from django import forms
from django.http import HttpResponse
from django.shortcuts import redirect, render
from django.template.response import TemplateResponse
from django.urls import path
from django.utils import timezone
from django.utils.translation import gettext_lazy
from django.views.generic im... | 467 | 13,531 |
beam | sdks/python/apache_beam/internal/cloudpickle_pickler_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... | 270 | 9,495 |
mlflow | tests/tracing/utils/test_otlp_auth.py | .py | import base64
from collections.abc import Generator
from contextlib import contextmanager
from unittest.mock import patch
from mlflow.tracing.utils.otlp import MLFLOW_EXPERIMENT_ID_HEADER, build_otlp_headers
from mlflow.utils.credentials import MlflowCreds
@contextmanager
def mock_creds(username: str | None = None, ... | 52 | 1,963 |
onnx | onnx/reference/ops/op_gathernd.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
def _gather_nd_impl(
data: np.ndarray, indices: np.ndarray, batch_dims: int
) -> tuple[np.ndarray]:
# Note the data rank - will be re... | 59 | 1,992 |
sqlmap | tests/test_datafiles.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Repo / data-file invariants - the cheap structural guards that catch whole
bug classes seen this session: tamper contract, per-DBMS query-tag coverage,
errors.xml regex compilation, X... | 182 | 9,011 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_LogSoftmax.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(435435)
class TestLogSoftmax(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
... | 45 | 1,697 |
cvxpy | cvxpy/reductions/complex2real/canonicalizers/pnorm_canon.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... | 23 | 815 |
hatch | src/hatch/env/lockers/hooks.py | .py | from hatch.env.lockers.pip import PipLocker
from hatch.env.lockers.uv import UvLocker
from hatchling.plugin import hookimpl
@hookimpl
def hatch_register_locker():
return [UvLocker, PipLocker]
| 9 | 198 |
onnxruntime | orttraining/orttraining/test/python/orttraining_test_gru.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import tempfile
import numpy as np
import onnx
import pytest
from onnx import TensorProto, helper
import onnxruntime as ort
def sigmoid(z):
"""Computes the sigmoid of the given numpy array."""
return 1 /... | 721 | 30,663 |
jupytext | tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/raw_cell_with_non_dict_yaml_content.py | .py | # ---
# Content.
# jupyter:
# jupytext:
# cell_markers: '{{{,}}}'
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
print("Hello, World!")
| 13 | 190 |
pyomo | pyomo/contrib/piecewise/tests/common_tests.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... | 111 | 4,308 |
textual | tests/test_box_drawing.py | .py | import pytest
from textual._box_drawing import combine_quads
@pytest.mark.parametrize(
"quad1, quad2, expected",
[
((0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0)),
((0, 0, 0, 1), (0, 0, 0, 0), (0, 0, 0, 1)),
((0, 0, 0, 1), (0, 0, 0, 1), (0, 0, 0, 1)),
((0, 0, 0, 2), (0, 0, 0, 1), (... | 26 | 905 |
pdm | src/pdm/models/session.py | .py | from __future__ import annotations
import os
import sqlite3
import threading
from contextlib import closing
from functools import cache
from pathlib import Path
from typing import TYPE_CHECKING, Any, cast
import hishel
import hishel.httpx
import httpx
from unearth.fetchers import PyPIClient
from pdm.__version__ impo... | 181 | 6,777 |
textual | tests/snapshot_tests/snapshot_apps/data_table_row_labels.py | .py | from textual.app import App, ComposeResult
from textual.widgets import DataTable
ROWS = [
("lane", "swimmer", "country", "time"),
(5, "Chad le Clos", "South Africa", 51.14),
(4, "Joseph Schooling", "Singapore", 50.39),
(2, "Michael Phelps", "United States", 51.14),
(6, "László Cseh", "Hungary", 51.... | 38 | 1,100 |
saleor | saleor/graphql/shipping/schema.py | .py | import graphene
from ...permission.enums import ShippingPermissions
from ...shipping import models
from ..core import ResolveInfo
from ..core.connection import create_connection_slice, filter_connection_queryset
from ..core.context import ChannelContext, get_database_connection_name
from ..core.doc_category import DOC... | 98 | 3,923 |
mlflow | mlflow/tracking/request_header/registry.py | .py | import logging
import warnings
from mlflow.tracking.request_header.databricks_request_header_provider import (
DatabricksRequestHeaderProvider,
)
from mlflow.tracking.request_header.default_request_header_provider import (
DefaultRequestHeaderProvider,
)
from mlflow.utils.plugins import get_entry_points
_logg... | 80 | 2,910 |
saleor | saleor/graphql/attribute/mutations/attribute_value_delete.py | .py | from typing import cast
import graphene
from ....attribute import models as models
from ....page.utils import mark_pages_search_vector_as_dirty_in_batches
from ....product.utils.search_helpers import (
mark_products_search_vector_as_dirty_in_batches,
)
from ....webhook.event_types import WebhookEventAsyncType
fro... | 90 | 3,819 |
saleor | saleor/plugins/__init__.py | .py | import importlib
PLUGIN_IDENTIFIER_PREFIX = "plugin:"
def discover_plugins_modules(plugins: list[str]):
plugins_modules = []
for dotted_path in plugins:
try:
module_path, class_name = dotted_path.rsplit(".", 1)
except ValueError as err:
raise ImportError(f"{dotted_path... | 17 | 498 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/max_per_key.py | .py | # coding=utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License");... | 60 | 1,726 |
probability | discussion/turnkey_inference_candidate/window_tune_nuts_sampling_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... | 69 | 2,359 |
textual | docs/examples/guide/widgets/hello06.py | .py | from itertools import cycle
from textual.app import App, ComposeResult
from textual.widgets import Static
hellos = cycle(
[
"Hola",
"Bonjour",
"Guten tag",
"Salve",
"Nǐn hǎo",
"Olá",
"Asalaam alaikum",
"Konnichiwa",
"Anyoung haseyo",
... | 48 | 968 |
biopython | Tests/test_Align_clustal.py | .py | # Copyright 2006-2014 by Peter Cock. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for Bio.Align.clustal module."""
import unittest
from io import StringIO
from tempfi... | 1,083 | 62,649 |
wandb | wandb/sdk/data_types/utils.py | .py | from __future__ import annotations
import datetime
import logging
import os
from collections.abc import Sequence
from decimal import Decimal
from typing import TYPE_CHECKING, Any, TypeAlias, cast
import wandb
from wandb import util
from ..internal import incremental_table_util
from .base_types.media import Batchable... | 266 | 9,029 |
openvino | tests/e2e_tests/common/comparator/classification.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Classification results comparator.
Compares reference and IE models results for top-N classes (usually, top-1 or
top-5).
Basic result example: list of 1000 class probabilities for ImageNet
classification dataset.
"""
import logging ... | 86 | 3,806 |
python-prompt-toolkit | examples/dialogs/radio_dialog.py | .py | #!/usr/bin/env python
"""
Example of a radio list box dialog.
"""
from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.shortcuts import radiolist_dialog
def main():
result = radiolist_dialog(
values=[
("red", "Red"),
("green", "Green"),
("blue", "Blue"),
... | 41 | 1,065 |
saleor | saleor/graphql/giftcard/mutations/gift_card_create.py | .py | from collections.abc import Iterable
from typing import cast
import graphene
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from ....account.models import User
from ....core.tracing import traced_atomic_transaction
from ....core.utils.promo_code import generate_pr... | 299 | 10,973 |
wandb | wandb/automations/_compat.py | .py | from __future__ import annotations
from collections.abc import Collection
from typing import TYPE_CHECKING, Final
from wandb._strutils import nameof
from ._generated import (
EntityScopeFields,
GenericWebhookActionFields,
NoOpActionFields,
NotificationActionFields,
QueueJobActionFields,
)
from .a... | 134 | 4,241 |
astropy | astropy/wcs/wcsapi/tests/helpers.py | .py | def assert_celestial_component(component, index):
assert component[:2] == ("celestial", index)
assert callable(component[2])
| 4 | 133 |
onnxruntime | plugin-ep-webgpu/csharp/pack_nuget.py | .py | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Build the Microsoft.ML.OnnxRuntime.EP.WebGpu NuGet package.
Stages native binaries from build artifacts into the runtimes/ layout expected
by the .csproj and runs `dotnet pack` to produce the .nupk... | 378 | 13,968 |
omegaconf | tests/test_container_unions.py | .py | """
Tests for Union[List[...], Dict[...], ...] support (issue #1261).
"""
import copy
import pickle
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Tuple, Union
from pytest import mark, param, raises
from omegaconf import OmegaConf, ReadonlyConfigError, TupleConfig, ValidationE... | 560 | 19,494 |
saleor | saleor/graphql/account/tests/mutations/account/test_account_set_default_address.py | .py | import graphene
from ......checkout import AddressType
from .....tests.utils import get_graphql_content
ACCOUNT_SET_DEFAULT_ADDRESS_MUTATION = """
mutation($id: ID!, $type: AddressTypeEnum!) {
accountSetDefaultAddress(id: $id, type: $type) {
errors {
field,
message
}
}
}
"""
def test_custome... | 99 | 3,133 |
openvino | tests/utils/platform_utils.py | .py | #!/usr/bin/env python3
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
""" Common utilities for working with OSes or platforms
"""
import platform
import subprocess
import sys
from enum import Enum
import distro
class UnsupportedOsError(Exception):
"""Exception for unsupporte... | 107 | 2,820 |
astropy | astropy/coordinates/tests/test_utils.py | .py | import erfa
import pytest
from astropy.coordinates.builtin_frames.utils import (
get_offset_sun_from_barycenter,
get_polar_motion,
)
from astropy.coordinates.solar_system import get_body_barycentric_posvel
from astropy.tests.helper import assert_quantity_allclose
from astropy.time import Time
from astropy.util... | 53 | 1,850 |
black | tests/data/cases/class_blank_parentheses.py | .py | class SimpleClassWithBlankParentheses():
pass
class ClassWithSpaceParentheses ( ):
first_test_data = 90
second_test_data = 100
def test_func(self):
return None
class ClassWithEmptyFunc(object):
def func_with_blank_parentheses():
return 5
def public_func_with_blank_parentheses():
... | 60 | 1,092 |
saleor | saleor/graphql/translations/mutations/collection_translate.py | .py | import graphene
from ....permission.enums import SitePermissions
from ....product import models as product_models
from ...core import ResolveInfo
from ...core.context import ChannelContext
from ...core.enums import LanguageCodeEnum
from ...core.types import TranslationError
from ...product.types import Collection
from... | 44 | 1,623 |
pyomo | pyomo/opt/results/solver.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... | 238 | 9,098 |
saleor | saleor/graphql/meta/tests/mutations/test_channel.py | .py | from unittest import mock
import graphene
from . import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE
from .test_delete_metadata import (
execute_clear_public_metadata_for_item,
item_without_public_metadata,
)
from .test_delete_private_metadata import (
execute_clear_private_metadata_for_item,
... | 158 | 4,796 |
openvino | src/bindings/python/src/openvino/frontend/tensorflow/node_decoder.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
import numpy as np
import tensorflow as tf
from openvino.frontend.tensorflow.py_tensorflow_frontend import _FrontEndDecoderBase as DecoderBase
from openvino import PartialShape, Type, OVAny, Tensor
... | 220 | 9,545 |
coremltools | deps/pybind11/tests/test_async.py | .py | from __future__ import annotations
import pytest
asyncio = pytest.importorskip("asyncio")
m = pytest.importorskip("pybind11_tests.async_module")
@pytest.fixture()
def event_loop():
loop = asyncio.new_event_loop()
yield loop
loop.close()
async def get_await_result(x):
return await x
def test_awai... | 27 | 572 |
httpie | httpie/output/formatters/xml.py | .py | from typing import TYPE_CHECKING, Optional
from ...encoding import UTF8
from ...plugins import FormatterPlugin
if TYPE_CHECKING:
from xml.dom.minidom import Document
XML_DECLARATION_OPEN = '<?xml'
XML_DECLARATION_CLOSE = '?>'
def parse_xml(data: str) -> 'Document':
"""Parse given XML `data` string into an... | 80 | 2,505 |
jupytext | tests/data/notebooks/outputs/ipynb_to_script_vscode_folding_markers/notebook_with_complex_metadata.py | .py | # ---
# jupyter:
# jupytext:
# cell_markers: region,endregion
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
| 12 | 164 |
scikit-optimize | examples/utils.py | .py | # Module to import functions from in examples for multiprocessing backend
import numpy as np
def obj_fun(x, noise_level=0.1):
return np.sin(5 * x[0]) * (1 - np.tanh(x[0] ** 2)) +\
np.random.randn() * noise_level
| 8 | 229 |
saleor | saleor/graphql/checkout/mutations/checkout_customer_attach.py | .py | import graphene
from django.forms import ValidationError
from ....checkout.actions import call_checkout_event
from ....checkout.error_codes import CheckoutErrorCode
from ....core.exceptions import PermissionDenied
from ....permission.auth_filters import AuthorizationFilters
from ....permission.enums import AccountPerm... | 131 | 4,623 |
beam | sdks/python/apache_beam/examples/snippets/transforms/elementwise/withtimestamps_event_time.py | .py | # coding=utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License");... | 75 | 2,413 |
wandb | tests/system_tests/test_notebooks/test_jupyter_server/conftest.py | .py | import json
import socket
import tempfile
import threading
import time
from collections.abc import Callable, Generator
from pathlib import Path
import jupyter_core
import nbformat
import nest_asyncio2
import pytest
import requests
from jupyter_client.blocking.client import BlockingKernelClient
from jupyter_server.serv... | 269 | 9,078 |
sqlmap | tamper/blindbinary.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.NORMAL
def dependencies():
pass
def _balancedEnd(payload, start):
"""Index of the ')' matching th... | 115 | 5,328 |
readthedocs.org | readthedocs/audit/serializers.py | .py | """
Serializers used to save the corresponding data from a model in a log entry.
.. note::
These aren't used in an API, but to extract data from objects to
save it in log entries (AuditLog.data).
"""
from django.contrib.auth.models import User
from rest_framework import serializers
from readthedocs.invitation... | 76 | 1,988 |
gunicorn | examples/streaming_chat/chat_app.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import time
import random
from gunicorn.dirty.app import DirtyApp
class ChatApp(DirtyApp):
"""Simulated LLM chat application demonstrating streaming responses.
This app mimics LLM token-by-token generati... | 137 | 4,911 |
metrics | src/torchmetrics/text/ter.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... | 162 | 6,765 |
textual | tests/test_textlog.py | .py | from rich.text import Text
from textual.widgets import RichLog
async def test_make_renderable_expand_tabs():
# Regression test for https://github.com/Textualize/textual/issues/3007
text_log = RichLog()
renderable = text_log._make_renderable("\tfoo")
assert isinstance(renderable, Text)
assert rend... | 12 | 350 |
onnxruntime | onnxruntime/python/tools/transformers/benchmark.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Copyright 2018 The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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... | 946 | 32,580 |
beam | sdks/python/apache_beam/examples/complete/autocomplete.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... | 92 | 3,043 |
wandb | tests/unit_tests/test_cli.py | .py | import getpass
import importlib
import netrc
import os
import subprocess
import time
import traceback
from unittest import mock
import pytest
import wandb
import wandb.docker
from wandb import env
from wandb.cli import cli
DOCKER_SHA = (
"wandb/deepo@sha256:"
"3ddd2547d83a056804cac6aac48d46c5394a76df76b672539... | 638 | 18,284 |
saleor | saleor/graphql/product/tests/queries/test_report_product_sales.py | .py | from decimal import Decimal
from ....core.enums import ReportingPeriod
from ....tests.utils import get_graphql_content
QUERY_REPORT_PRODUCT_SALES = """
query TopProducts($period: ReportingPeriod!, $channel: String!) {
reportProductSales(period: $period, first: 20, channel: $channel) {
edges {
... | 99 | 3,444 |
cvxpy | cvxpy/tests/test_pow_cone_nd.py | .py | """
Copyright 2025 CVXPY developers
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | 263 | 10,355 |
coremltools | coremltools/converters/mil/frontend/_utils.py | .py | # Copyright (c) 2021, 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 math as math
import string
from typing import List, Optional, Union
import n... | 938 | 36,451 |
beam | sdks/python/apache_beam/dataframe/frames_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... | 3,213 | 121,513 |
openvino | src/bindings/python/tests/test_graph/test_squeeze.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import openvino.opset1 as ov_opset1
import openvino.opset15 as ov_opset15
import numpy as np
import pytest
def test_squeeze_v1_operator():
data_shape = [1, 2, 1, 3, 1, 1]
parameter_data = ov_opset1.param... | 52 | 1,938 |
mlflow | mlflow/entities/dataset_summary.py | .py | from mlflow.protos.service_pb2 import DatasetSummary
class _DatasetSummary:
"""
DatasetSummary object.
This is used to return a list of dataset summaries across one or more experiments in the UI.
"""
def __init__(self, experiment_id, name, digest, context):
self._experiment_id = experime... | 63 | 1,581 |
gunicorn | gunicorn/http/wsgi.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import io
import logging
import os
import re
import sys
from gunicorn.http.message import TOKEN_RE
from gunicorn.http.errors import ConfigurationProblem, InvalidHeader, InvalidHeaderName
from gunicorn import SERVE... | 533 | 17,891 |
saleor | saleor/graphql/meta/tests/queries/test_payment.py | .py | from .....payment.models import Payment
from .....payment.utils import payment_owned_by_user
from .....permission.models import Permission
from ....tests.fixtures import ApiClient
from ....tests.utils import assert_no_permission
from .utils import (
assert_model_contains_metadata,
assert_model_contains_private_... | 211 | 5,489 |
sphinx | sphinx/search/it.py | .py | """Italian search language."""
from __future__ import annotations
import snowballstemmer
from sphinx.search import SearchLanguage
from sphinx.search._stopwords.it import ITALIAN_STOPWORDS
class SearchItalian(SearchLanguage):
lang = 'it'
language_name = 'Italian'
js_stemmer_rawcode = 'italian-stemmer.js... | 23 | 596 |
saleor | saleor/graphql/order/mutations/order_discount_delete.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....core.tracing import traced_atomic_transaction
from ....order import events
from ....order.error_codes import OrderErrorCode
from ....order.search import update_order_search_vector
from ....order.utils import invalidate_order_prices, remove_ord... | 74 | 2,739 |
confluent-kafka-python | examples/schema_registry_imds_azure.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 requi... | 50 | 1,716 |
saleor | saleor/graphql/shipping/bulk_mutations/shipping_price_bulk_delete.py | .py | import graphene
from django.conf import settings
from ....permission.enums import ShippingPermissions
from ....shipping import models
from ....webhook.event_types import WebhookEventAsyncType
from ....webhook.utils import get_webhooks_for_event
from ...core import ResolveInfo
from ...core.mutations import ModelBulkDel... | 60 | 2,005 |
pyomo | pyomo/core/tests/unit/test_check.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... | 190 | 5,109 |
saleor | saleor/graphql/product/tests/deprecated/test_collection_channel_listing_update.py | .py | import datetime
import graphene
from .....product.error_codes import CollectionErrorCode
from ....tests.utils import get_graphql_content
COLLECTION_CHANNEL_LISTING_UPDATE_MUTATION = """
mutation UpdateCollectionChannelListing(
$id: ID!
$input: CollectionChannelListingUpdateInput!
) {
collectionChannelLis... | 274 | 9,043 |
openvino | src/bindings/python/tests/test_graph/test_idft.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino import Type
import openvino.opset8 as ov
import numpy as np
import pytest
def get_data():
np.random.seed(202104)
return np.random.uniform(0, 1, (2, 10, 10, 2)).astype(np.float32)
def test... | 127 | 5,563 |
wandb | wandb/sdk/launch/builder/noop.py | .py | """NoOp builder implementation."""
from __future__ import annotations
from typing import Any
from wandb.sdk.launch.builder.abstract import AbstractBuilder
from wandb.sdk.launch.environment.abstract import AbstractEnvironment
from wandb.sdk.launch.errors import LaunchError
from wandb.sdk.launch.registry.abstract impo... | 61 | 1,917 |
sphinx | tests/roots/test-ext-autosummary-ext/conf.py | .py | import sys
from pathlib import Path
sys.path.insert(0, str(Path.cwd().resolve()))
extensions = ['sphinx.ext.autosummary']
autosummary_generate = True
exclude_patterns = ['_build']
| 11 | 184 |
sphinx | tests/test_builders/test_build_html_copyright.py | .py | from __future__ import annotations
import time
from typing import TYPE_CHECKING
import pytest
from sphinx.testing.util import SphinxTestApp
if TYPE_CHECKING:
from collections.abc import Iterator
from sphinx.testing.util import SphinxTestApp
LT = time.localtime()
LT_NEW = (2009, *LT[1:], LT.tm_zone, LT.tm_... | 110 | 3,728 |
luigi | test/visible_parameters_test.py | .py | import json
from helpers import unittest
import luigi
from luigi.parameter import ParameterVisibility
class TestTask1(luigi.Task):
param_one = luigi.Parameter(default="1", visibility=ParameterVisibility.HIDDEN, significant=True)
param_two = luigi.Parameter(default="2", significant=True)
param_three = lu... | 98 | 3,501 |
pyomo | examples/pyomobook/abstract-ch/param3a.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... | 35 | 1,143 |
wagtail | wagtail/documents/api/v3/registry.py | .py | from wagtail.api.v3.registry import ContentTypeRegistration, registry
from wagtail.documents import get_document_model
from .schemas import build_document_schemas
def register_content_types() -> None:
Document = get_document_model()
read_schema, create_schema, patch_schema = build_document_schemas()
regi... | 19 | 592 |
textual | src/textual/_text_area_theme.py | .py | from __future__ import annotations
from dataclasses import dataclass, field, fields
from typing import TYPE_CHECKING
from rich.style import Style
from textual.color import Color
if TYPE_CHECKING:
from textual.widgets import TextArea
@dataclass
class TextAreaTheme:
"""A theme for the `TextArea` widget.
... | 435 | 18,067 |
onnxruntime | onnxruntime/test/testdata/test_shape_data_propagation_unsqueeze_inmemory_int64.py | .py | import onnx
axis_count = 16
input_tensor = onnx.helper.make_tensor_value_info("input", onnx.TensorProto.FLOAT, [1] * axis_count)
output_tensor = onnx.helper.make_tensor_value_info("output", onnx.TensorProto.INT64, [1] * axis_count + [axis_count])
shape_node = onnx.helper.make_node("Shape", ["input"], ["shape_out"])
i... | 25 | 1,102 |
qutip | qutip/solver/result.py | .py | """ Class for solve function results"""
# Required for Sphinx to follow autodoc_type_aliases
from __future__ import annotations
from typing import TypedDict, Any, Callable
from ..core.numpy_backend import np
from numpy.typing import ArrayLike
from ..core import Qobj, QobjEvo, expect
__all__ = ["Result"]
class _Qob... | 523 | 16,829 |
openvino | docs/scripts/tests/validate_benchmarks.py | .py | import os
import json
import requests
import argparse
from jsonschema import Draft7Validator
import sys
def load_json(file_path):
"""Load JSON data from a file."""
with open(file_path, 'r') as file:
return json.load(file)
def validate_json_files(benchmarks_dir):
"""Validate all JSON files in the ... | 81 | 2,852 |
openvino | tools/commit_slider/utils/modes.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
from utils.helpers import CfgManager, fetchAppOutput, getActualPath, fetchBenchmarkMetric
from utils.helpers import getMeaningfullCommitTail, extractModelPath
from utils.helpers import handleCommit, getBlobDiff, applySubstituti... | 817 | 31,856 |
sqlmap | extra/dbwire/sybase.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
"""
Minimal pure-python Sybase ASE client speaking TDS 5.0 (stdlib only, no pymssql/FreeTDS).
Sybase and Microsoft share the 8-byte TDS packet framing (reused from tds.py) and pa... | 430 | 19,830 |
wagtail | wagtail/admin/views/generic/usage.py | .py | from django.contrib.admin.utils import quote
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.text import capfirst
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from wagtail.admin.admin_url_finder import AdminURL... | 149 | 5,085 |
toolz | toolz/compatibility.py | .py | import warnings
warnings.warn("The toolz.compatibility module is no longer "
"needed in Python 3 and has been deprecated. Please "
"import these utilities directly from the standard library. "
"This module will be removed in a future release.",
category=Deprecatio... | 31 | 997 |
mlflow | mlflow/projects/backend/loader.py | .py | import logging
from mlflow.projects.backend.local import LocalBackend
from mlflow.utils.plugins import get_entry_points
ENTRYPOINT_GROUP_NAME = "mlflow.project_backend"
_logger = logging.getLogger(__name__)
# Statically register backend defined in mlflow
MLFLOW_BACKENDS = {
"local": LocalBackend,
}
def load_... | 36 | 932 |
metrics | src/torchmetrics/functional/classification/exact_match.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... | 267 | 11,963 |
wagtail | wagtail/admin/api/filters.py | .py | import swapper
from rest_framework.filters import BaseFilterBackend
from wagtail import hooks
from wagtail.api.v2.utils import BadRequestError, parse_boolean
from wagtail.permissions import policy_registry
Page = swapper.load_model("wagtailcore", "Page")
class HasChildrenFilter(BaseFilterBackend):
"""
Filte... | 50 | 1,707 |
returns | tests/test_maybe/test_maybe_bind.py | .py | from returns.maybe import Maybe, Nothing, Some
def test_bind_some():
"""Ensures that bind works correctly."""
def factory(inner_value: int) -> Maybe[int]:
return Some(inner_value * 2)
input_value = 5
bound = Some(input_value).bind(factory)
assert bound == factory(input_value)
assert... | 26 | 675 |
textual | docs/examples/app/simple01.py | .py | from textual.app import App
class MyApp(App):
pass
| 6 | 57 |
rq | tests/test_worker.py | .py | import json
import multiprocessing
import os
import shutil
import signal
import subprocess
import sys
import threading
import time
import zlib
from datetime import datetime, timedelta, timezone
from multiprocessing import Process
from time import sleep
from unittest import mock, skipIf
from unittest.mock import Mock
i... | 1,901 | 77,580 |
mlflow | tests/store/model_registry/test_file_store.py | .py | import pytest
pytestmark = pytest.mark.skip(reason="FileStore is no longer supported")
import time
import uuid
from typing import NamedTuple
from unittest import mock
import pytest
import mlflow
from mlflow.entities.model_registry import (
ModelVersion,
ModelVersionTag,
RegisteredModelTag,
)
from mlflow... | 1,903 | 74,340 |
saleor | saleor/checkout/tests/test_calculations.py | .py | from decimal import Decimal
from typing import Literal
from unittest.mock import Mock, patch
import pytest
from django.db.models import F
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from graphene import Node
from prices import Money, TaxedMoney
from pro... | 1,544 | 52,118 |
httpie | httpie/plugins/registry.py | .py | from .manager import PluginManager
from .builtin import BasicAuthPlugin, DigestAuthPlugin, BearerAuthPlugin
from ..output.formatters.headers import HeadersFormatter
from ..output.formatters.json import JSONFormatter
from ..output.formatters.xml import XMLFormatter
from ..output.formatters.colors import ColorFormatter
... | 22 | 560 |
pdm | src/pdm/models/project_info.py | .py | from __future__ import annotations
import itertools
from collections.abc import Iterator
from dataclasses import dataclass, field
from email.message import Message
from typing import TYPE_CHECKING, cast
if TYPE_CHECKING:
from importlib.metadata import Distribution
@dataclass
class ProjectInfo:
name: str
... | 72 | 2,660 |
beam | sdks/python/apache_beam/examples/wordcount_rust/wordcount_rust.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... | 87 | 2,952 |
probability | tensorflow_probability/python/distributions/continuous_bernoulli_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... | 733 | 27,861 |
pymc | pymc/variational/opvi.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 1,685 | 60,013 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.