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 |
|---|---|---|---|---|---|
coremltools | coremltools/optimize/coreml/__init__.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
from ._config import (
OpLinearQuantizerConfig,
OpMagnitudePrunerConfig,
OpPalettizerConf... | 26 | 739 |
textual | tests/renderables/test_tint.py | .py | import io
from rich.console import Console
from rich.segment import Segments
from rich.terminal_theme import DIMMED_MONOKAI
from rich.text import Text
from textual._ansi_theme import DEFAULT_TERMINAL_THEME
from textual.color import Color
from textual.renderables.tint import Tint
def test_tint():
console = Conso... | 49 | 1,492 |
bazel | src/test/py/bazel/runfiles_sandboxed_test.py | .py | # pylint: disable=g-bad-file-header
# Copyright 2018 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
... | 124 | 4,946 |
scikit-optimize | examples/optimizer-with-different-base-estimator.py | .py | """
==============================================
Use different base estimators for optimization
==============================================
Sigurd Carlen, September 2019.
Reformatted by Holger Nahrstaedt 2020
.. currentmodule:: skopt
To use different base_estimator or create a regressor with different paramete... | 140 | 4,857 |
wandb | tests/system_tests/test_registries/conftest.py | .py | from __future__ import annotations
import os
from collections.abc import Callable
from typing import TYPE_CHECKING, Literal
import wandb
from pytest import FixtureRequest, fixture, skip
from pytest_mock import MockerFixture
from wandb import Api, Artifact
from wandb.apis.public.registries._utils import fetch_org_enti... | 236 | 8,167 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/conformance_vs_accuracy_comparator.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import re
import csv
import os
from argparse import ArgumentParser
def parse_arguments():
parser = ArgumentParser()
accuracy_help = "Path to csv file with accuracy results"
conformance_help = "Path to csv file with conforma... | 185 | 7,603 |
sphinx | sphinx/transforms/compact_bullet_list.py | .py | """Docutils transforms used by Sphinx when reading documents."""
from __future__ import annotations
from typing import TYPE_CHECKING, cast
from docutils import nodes
from sphinx import addnodes
from sphinx.transforms import SphinxTransform
if TYPE_CHECKING:
from typing import Any
from docutils.nodes impor... | 95 | 2,861 |
probability | tensorflow_probability/python/bijectors/scale_matvec_diag_test.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... | 86 | 3,235 |
wagtail | wagtail/admin/panels/field_panel.py | .py | import functools
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db.models import ForeignKey
from django.forms.models import ModelChoiceIterator
from django.template.loader import get_template
from django.utils.functional import cached_property
from django.utils.text import capfi... | 408 | 14,616 |
mlflow | mlflow/transformers/torch_utils.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from packaging.version import Version
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
if TYPE_CHECKING:
import torch
_TORCH_DTYPE_KEY = "torch_dtype"
# transformers 4.56.0 renamed ... | 79 | 2,686 |
ipython | tests/test_tempdir.py | .py | # -----------------------------------------------------------------------------
# Copyright (C) 2012- 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.
# -------------------------------------------------... | 31 | 1,117 |
python-prompt-toolkit | examples/progress-bar/colored-title-and-label.py | .py | #!/usr/bin/env python
"""
A progress bar that displays a formatted title above the progress bar and has a
colored label.
"""
import time
from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.shortcuts import ProgressBar
def main():
title = HTML('Downloading <style bg="yellow" fg="black">4 files...<... | 24 | 538 |
beam | sdks/python/apache_beam/io/external/xlang_snowflakeio_it_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 278 | 9,092 |
openvino | tools/ovc/openvino/tools/ovc/convert_data_type.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.ovc.error import Error
"""
Packed data of custom types are stored in numpy uint8 data type.
To distinguish true uint8 and custom data we introduce this class not to store,
but to have unique data ... | 83 | 2,500 |
probability | tensorflow_probability/python/layers/initializers_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... | 47 | 1,732 |
metrics | tests/unittests/text/_helpers.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... | 465 | 19,499 |
saleor | saleor/graphql/translations/tests/mutations/test_attribute_value_bulk_transalte.py | .py | import json
from unittest.mock import patch
import graphene
import pytest
from .....tests.utils import dummy_editorjs
from ....core.enums import (
AttributeValueTranslateErrorCode,
ErrorPolicyEnum,
LanguageCodeEnum,
TranslationErrorCode,
)
from ....tests.utils import get_graphql_content
from ...mutati... | 568 | 18,904 |
mlflow | mlflow/protos/label_schemas_pb2.py | .py |
import google.protobuf
from packaging.version import Version
if Version(google.protobuf.__version__).major >= 5:
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: label_schemas.proto
# Protobuf Python Version: 5.26.0
"""Generated protocol buffer code."""
from goog... | 358 | 26,745 |
saleor | saleor/plugins/sendgrid/plugin.py | .py | import logging
from collections.abc import Callable
from dataclasses import asdict
from django.core.exceptions import ValidationError
from ...core.notify import NotifyEventType, UserNotifyEvent
from ...plugins.sendgrid.tasks import send_email_with_dynamic_template_id
from ..base_plugin import BasePlugin, Configuratio... | 285 | 10,973 |
onnx | onnx/printer.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import onnx
import onnx.onnx_cpp2py_export.printer as C # noqa: N812
def to_text(
proto: onnx.ModelProto | onnx.FunctionProto | onnx.GraphProto | onnx.NodeProto,
) -> str:
if isinstance(proto... | 22 | 755 |
onnxruntime | onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/ArgType.py | .py | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: fbs
class ArgType(object):
INPUT = 0
OUTPUT = 1
| 8 | 140 |
pyomo | pyomo/network/tests/test_decomposition.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... | 858 | 29,156 |
saleor | saleor/order/tests/webhooks/subscriptions/test_exclude_shipping.py | .py | import json
import graphene
import pytest
from .....shipping.models import ShippingMethodChannelListing
from .....webhook.event_types import WebhookEventSyncType
from .....webhook.transport.synchronous.transport import (
create_delivery_for_subscription_sync_event,
)
from ....delivery_context import get_all_shipp... | 156 | 4,213 |
openvino | tests/layer_tests/pytorch_tests/test_any.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import numpy as np
import pytest
import torch
from pytorch_layer_test_class import PytorchLayerTest, skip_if_export
class aten_any_noparam(torch.nn.Module):
def __init__(self) -> None:
torch.nn.Module.__ini... | 128 | 4,798 |
ipython | IPython/core/magics/logging.py | .py | """Implementation of magic functions for IPython's own logging.
"""
#-----------------------------------------------------------------------------
# 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, distribut... | 196 | 6,884 |
onnxruntime | onnxruntime/test/testdata/transform/computation_reduction/gathernd/gathernd_add.py | .py | import numpy as np
import onnx
from onnx import OperatorSetIdProto, TensorProto, helper, numpy_helper
X = helper.make_tensor_value_info("input", TensorProto.FLOAT, ["batch", "seqlen", 128])
unsqueezed_masked_lm_positions = helper.make_tensor_value_info(
"unsqueezed_masked_lm_positions",
TensorProto.INT64,
... | 73 | 2,259 |
coremltools | deps/pybind11/tools/codespell_ignore_lines_from_errors.py | .py | """Simple script for rebuilding .codespell-ignore-lines
Usage:
cat < /dev/null > .codespell-ignore-lines
pre-commit run --all-files codespell >& /tmp/codespell_errors.txt
python3 tools/codespell_ignore_lines_from_errors.py /tmp/codespell_errors.txt > .codespell-ignore-lines
git diff to review changes, then commit, p... | 41 | 1,129 |
textual | tests/snapshot_tests/snapshot_apps/notifications_above_loading.py | .py | from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Label
class LoadingOverlayApp(App[None]):
CSS = """
VerticalScroll {
height: 20;
}
Toast {
max-width: 100%;
width: 70%; /* We need this to cover the dots o... | 30 | 848 |
clearml | clearml/hyperdatasets/core.py | .py | import logging
import os
import re
from concurrent.futures import ThreadPoolExecutor
from typing import Optional, List, Any, Sequence, Dict, Union
import psutil
from requests.compat import json as requests_json
from clearml.backend_api import Session
from clearml.backend_interface.datasets.hyper_dataset import HyperD... | 928 | 37,680 |
confluent-kafka-python | tests/soak/soakclient.py | .py | #!/usr/bin/env python
#
# Copyright 2018 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... | 971 | 37,917 |
bazel | src/test/shell/bazel/testing_server.py | .py | # Copyright 2015 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... | 189 | 5,399 |
readthedocs.org | readthedocs/core/tests/test_adapters.py | .py | from unittest import mock
from allauth.core.exceptions import ImmediateHttpResponse
from allauth.socialaccount.adapter import get_adapter as get_social_account_adapter
from allauth.socialaccount.models import SocialAccount, SocialLogin
from allauth.socialaccount.providers.github.provider import GitHubProvider
from dja... | 217 | 7,525 |
textual | src/textual/widgets/_tabbed_content.py | .py | from __future__ import annotations
from asyncio import gather
from dataclasses import dataclass
from itertools import zip_longest
from typing import Awaitable
from rich.repr import Result
from typing_extensions import Final
from textual import events
from textual.app import ComposeResult
from textual.await_complete ... | 717 | 23,958 |
onnxruntime | onnxruntime/test/python/transformers/benchmark_gqa_windows.py | .py | import argparse
import os
import time
import torch
from gqa_test_helper import GroupQueryAttentionConfig, OrtGroupQueryAttention
def save_results(results, filename):
import pandas as pd # noqa: PLC0415
df = pd.DataFrame(
results,
columns=[
"Inference Interval (ms)",
... | 237 | 8,879 |
coremltools | coremltools/optimize/torch/layerwise_compression/__init__.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
"""
.. _coremltools_optimize_torch_layerwise_compression:
_`LayerwiseCompressor`
===================... | 99 | 2,939 |
probability | tensorflow_probability/python/experimental/bayesopt/acquisition/weighted_power_scalarization.py | .py | # Copyright 2023 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... | 227 | 8,543 |
onnx | onnx/backend/test/case/node/ai_onnx_ml/label_encoder.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.helper import make_tensor
class LabelEncoder(Base):
@staticmeth... | 102 | 3,045 |
textual | docs/examples/guide/reactivity/world_clock01.py | .py | from datetime import datetime
from pytz import timezone
from textual.app import App, ComposeResult
from textual.reactive import reactive
from textual.widget import Widget
from textual.widgets import Digits, Label
class WorldClock(Widget):
time: reactive[datetime] = reactive(datetime.now)
def __init__(self... | 53 | 1,372 |
beam | learning/katas/python/Common Transforms/Aggregation/Count/tests/test_task.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 35 | 1,184 |
mlflow | dev/clint/src/clint/rules/mock_patch_as_decorator.py | .py | import ast
from clint.resolver import Resolver
from clint.rules.base import Rule
class MockPatchAsDecorator(Rule):
def _message(self) -> str:
return (
"Do not use `unittest.mock.patch` as a decorator. "
"Use it as a context manager to avoid patches being active longer than needed ... | 28 | 981 |
wandb | tests/unit_tests/test_launch/test_runner/test_vertex.py | .py | from unittest.mock import MagicMock
import pytest
from wandb.apis.internal import Api
from wandb.sdk.launch._project_spec import LaunchProject
from wandb.sdk.launch.errors import LaunchError
from wandb.sdk.launch.runner.vertex_runner import VertexRunner, VertexSubmittedRun
class MockCustomJob:
"""Mock of the Cus... | 214 | 7,289 |
lemur | lemur/plugins/lemur_aws/s3.py | .py | """
.. module: lemur.plugins.lemur_aws.s3
:platform: Unix
:synopsis: Contains helper functions for interactive with AWS S3 Apis.
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from boto... | 76 | 2,449 |
hydra | plugins/hydra_colorlog/setup.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# type: ignore
from pathlib import Path
from read_version import read_version
from setuptools import find_namespace_packages, setup
setup(
name="hydra-colorlog",
version=read_version("hydra_plugins/hydra_colorlog", "__init__.py"),
auth... | 31 | 1,125 |
django-cms | cms/signals/log_entries.py | .py | import json
from django.contrib.admin.models import ADDITION, CHANGE, DELETION, LogEntry
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import gettext_lazy as _
from cms import operations
from cms.models import Page, PageType
_page_operations_map = {
operations.MOVE_PAGE... | 154 | 4,852 |
pyro | examples/svi_torch.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# Using vanilla PyTorch to perform optimization in SVI.
#
# This tutorial demonstrates how to use standard PyTorch optimizers, dataloaders and training loops
# to perform optimization in SVI. This is useful when you want to use custom ... | 112 | 5,054 |
sqlmap | thirdparty/chardet/sjisprober.py | .py | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | 93 | 3,774 |
bazel | third_party/py/mock/tests/testmock.py | .py | # Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
from tests.support import (
callable, unittest2, inPy3k, is_instance, next
)
import copy
import pickle
import sys
import mock
from mock import (
call, DEFAULT, pat... | 1,352 | 42,396 |
wandb | tests/system_tests/test_functional/dspy/dspy_callback.py | .py | import dspy
import wandb
from dspy.evaluate.evaluate import EvaluationResult # type: ignore
class MinimalProgram(dspy.Module):
"""Minimal DSPy module exposing a `Predict` param for signature extraction.
Examples:
>>> mod = MinimalProgram()
"""
def __init__(self) -> None:
super().__i... | 86 | 2,564 |
kombu | kombu/utils/scheduling.py | .py | """Scheduling Utilities."""
from __future__ import annotations
from itertools import count
from .imports import symbol_by_name
__all__ = (
'FairCycle', 'priority_cycle', 'round_robin_cycle', 'sorted_cycle',
)
CYCLE_ALIASES = {
'priority': 'kombu.utils.scheduling:priority_cycle',
'round_robin': 'kombu.u... | 112 | 2,927 |
sqlmap | plugins/dbms/raima/enumeration.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.data import logger
from plugins.generic.enumeration import Enumeration as GenericEnumeration
class Enumeration(GenericEnumeration):
def getBanner(self):
... | 85 | 2,608 |
coremltools | coremltools/optimize/torch/layerwise_compression/input_cacher.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
# Original implementation from https://github.com/IST-DASLab/sparsegpt
# Copyright 2023 IST Austria D... | 185 | 6,584 |
openvino | tools/ovc/openvino/tools/ovc/main.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import sys
try:
import openvino_telemetry as tm
from openvino_telemetry.backend import backend_ga4
except ImportError:
import openvino.tools.ovc.telemetry_stub as tm
from openvino.tools.ovc.convert_impl import _convert
from ... | 41 | 1,336 |
pymc | pymc/distributions/simulator.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... | 374 | 12,992 |
luigi | test/util_test.py | .py | # -*- coding: utf-8 -*-
#
# Copyright 2016 VNG Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 214 | 7,287 |
saleor | saleor/discount/tests/fixtures/promotion_rule.py | .py | from decimal import Decimal
import graphene
import pytest
from ....tests.utils import dummy_editorjs
from ... import RewardType, RewardValueType
from ...interface import VariantPromotionRuleInfo
from ...models import PromotionRule
@pytest.fixture
def promotion_rule(channel_USD, catalogue_promotion, product):
ru... | 98 | 3,279 |
mlflow | tests/gateway/providers/test_databricks.py | .py | from unittest import mock
import pytest
from fastapi.encoders import jsonable_encoder
from mlflow.gateway.config import EndpointConfig
from mlflow.gateway.providers.base import PassthroughAction
from mlflow.gateway.providers.databricks import DatabricksConfig, DatabricksProvider
from mlflow.gateway.schemas import cha... | 355 | 12,210 |
wagtail | wagtail/admin/tests/test_contentstate.py | .py | import json
from unittest.mock import patch
from django.test import TestCase
from draftjs_exporter import DOM, HTMLExporter
from wagtail.admin.rich_text.converters.contentstate import (
ContentstateConverter,
persist_key_for_block,
)
from wagtail.embeds.models import Embed
from wagtail.test.utils import PageF... | 2,086 | 73,038 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_billing_address_update.py | .py | import graphene
from .....checkout.error_codes import CheckoutErrorCode
from ....tests.utils import get_graphql_content
MUTATION_CHECKOUT_BILLING_ADDRESS_UPDATE = """
mutation checkoutBillingAddressUpdate(
$token: UUID, $id: ID, $billingAddress: AddressInput!) {
checkoutBillingAddressUpdate(
... | 201 | 7,124 |
gunicorn | tests/requests/valid/040_compat.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("header_map", "dangerous")
request = {
"method": "GET",
"uri": uri("/keep/same/as?invalid/040"),
"version": (1, 0),
"headers": [
(... | 21 | 455 |
onnxruntime | orttraining/orttraining/python/training/ort_triton/_ir.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from abc import abstractmethod
from collections import defaultdict
from ... | 399 | 17,314 |
onnxruntime | onnxruntime/test/python/quantization/test_op_embed_layernorm.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.
# ---------------------------------------------------------------... | 225 | 8,778 |
openvino | src/bindings/python/tests/test_graph/test_ops_binary.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import operator
import numpy as np
import pytest
import warnings
from openvino import Type
import openvino.opset13 as ov
import openvino.opset15 as ov_opset15
@pytest.mark.parametrize(
("graph_api_helper",... | 275 | 8,757 |
kombu | t/unit/asynchronous/aws/test_connection.py | .py | from __future__ import annotations
from contextlib import contextmanager
from io import StringIO
from unittest.mock import Mock
import pytest
from vine.abstract import Thenable
from kombu.asynchronous import http
from kombu.asynchronous.aws.connection import (AsyncAWSQueryConnection,
... | 288 | 9,561 |
beam | sdks/python/apache_beam/io/gcp/bigtableio_it_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 417 | 15,805 |
saleor | saleor/tests/e2e/checkout/test_checkout_with_gift_promotion_updates.py | .py | """E2E test for gift promotion with discount price expiration.
This test verifies the complete flow of gift promotions with dynamic updates:
1. Create checkout with a product line
2. Create a gift promotion (order promotion with gift reward)
3. Update shipping - gift line should be added
4. Update gift promotion - cha... | 336 | 10,822 |
voila | tests/app/template_cli_test.py | .py | # tests programmatic config of template system
import os
import pytest
BASE_DIR = os.path.dirname(__file__)
@pytest.fixture
def voila_args_extra():
path_test_template = os.path.abspath(
os.path.join(
BASE_DIR, "../test_template/share/jupyter/voila/templates/test_template/"
)
)
... | 32 | 860 |
wagtail | wagtail/admin/views/workflows.py | .py | import django_filters
import swapper
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import PermissionDenied
from django.core.paginator import Paginator
from django.db import transaction
from django.db.models import Count, Prefetch
from django.db.models.fu... | 1,049 | 37,098 |
sqlmap | plugins/dbms/clickhouse/syntax.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.convert import getOrds
from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax):
@staticmethod
def escape(expression, quote=Tr... | 23 | 686 |
pyro | pyro/contrib/examples/scanvi_data.py | .py | # Copyright Contributors to the Pyro project.
# Copyright (c) 2020, YosefLab.
# SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
"""
The data preprocessing code in this script is adapted from:
https://github.com/YosefLab/scvi-tutorials/blob/50dd3269abfe0c375ec47114f2c20725a016736f/seed_labeling.ipynb
"""
import m... | 234 | 7,442 |
wagtail | wagtail/api/v3/tests/test_page_create.py | .py | import json
import swapper
from django.contrib.auth.models import Group, Permission
from django.test import TestCase
from django.urls import reverse
from wagtail.api.v3.tests.base import TestV3Base
from wagtail.documents.models import Document
from wagtail.images.models import Image
from wagtail.images.tests.utils im... | 1,010 | 38,502 |
beam | sdks/python/apache_beam/yaml/yaml_io_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... | 989 | 36,541 |
coremltools | coremltools/proto/AudioFeaturePrint_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: AudioFeaturePrint.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 _message... | 50 | 2,462 |
saleor | saleor/order/tests/test_fulfillments_actions.py | .py | from unittest.mock import patch
import pytest
from django.core.exceptions import ValidationError
from ...core.exceptions import InsufficientStock
from ...order import OrderEvents
from ...plugins.manager import get_plugins_manager
from ...warehouse.models import Allocation, Stock
from ..actions import create_fulfillme... | 802 | 25,456 |
astropy | astropy/cosmology/_src/__init__.py | .py | """Astropy Cosmology. **NOT public API**.
The public API is provided by `astropy.cosmology`.
"""
# Licensed under a 3-clause BSD style license - see LICENSE.rst
| 6 | 162 |
wandb | wandb/automations/_generated/create_generic_webhook_integration.py | .py | # Generated by ariadne-codegen
# Source: tools/graphql_codegen/automations/
from __future__ import annotations
from typing import Literal
from pydantic import Field
from wandb._pydantic import GQLResult, Typename
from .fragments import WebhookIntegrationFields
class CreateGenericWebhookIntegration(GQLResult):
... | 34 | 890 |
probability | tensorflow_probability/substrates/jax/__init__.py | .py | # Copyright 2019 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 62 | 2,682 |
pynacl | src/nacl/bindings/crypto_sign.py | .py | # Copyright 2013 Donald Stufft and individual contributors
#
# 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... | 323 | 10,288 |
onnxruntime | orttraining/orttraining/test/python/orttraining_test_ortmodule_deepspeed_zero_stage_1.py | .py | """Test for a simple ORTModule using the high-level DeepSpeed API.
To run on the local GPU(s):
```
$ pip install deepspeed
$ deepspeed orttraining_test_ortmodule_deepspeed_zero_stage_1.py \
--deepspeed_config=orttraining_test_ortmodule_deepspeed_zero_stage_1_config.json
```
"""
import argparse
import time
impor... | 261 | 9,694 |
pyro | tests/infer/reparam/test_softmax.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from torch.autograd import grad
import pyro
import pyro.distributions as dist
from pyro import poutine
from pyro.infer.reparam import GumbelSoftmaxReparam
from tests.common import assert_close
from .uti... | 68 | 2,305 |
wagtail | wagtail/admin/tests/pages/test_custom_listing.py | .py | from django.contrib.auth.models import Group
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from wagtail.test.testapp.models import EventPage
from wagtail.test.utils import Page, PageFixturesMixin, WagtailTestUtils
from wagtail.test.utils.template_tests... | 165 | 7,087 |
saleor | saleor/graphql/order/tests/queries/test_order_with_where.py | .py | import datetime
from uuid import uuid4
import graphene
import pytest
from django.utils import timezone
from freezegun import freeze_time
from .....account.models import Address
from .....core.postgres import FlatConcatSearchVector
from .....giftcard.events import gift_cards_bought_event, gift_cards_used_in_order_even... | 3,533 | 105,165 |
scikit-optimize | skopt/optimizer/forest.py | .py | """Forest based minimization algorithms."""
from sklearn.utils import check_random_state
from .base import base_minimize
from ..utils import cook_estimator
def forest_minimize(func, dimensions, base_estimator="ET", n_calls=100,
n_random_starts=None, n_initial_points=10, acq_func="EI",
... | 197 | 8,477 |
openvino | docs/optimization_guide/nncf/ptq/code/ptq_aa_openvino.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#! [dataset]
import nncf
import torch
calibration_loader = torch.utils.data.DataLoader(...)
def transform_fn(data_item):
images, _ = data_item
return images
calibration_dataset = nncf.Dataset(calibration_loader, transform_fn)
... | 73 | 1,997 |
django-cms | cms/test_utils/project/sampleapp/urls_sample_config.py | .py | from django.urls import re_path
from . import views
urlpatterns = [
re_path(r'^$', views.sample_view, {'message': 'sample root page', }, name='sample-config-root'),
]
| 8 | 173 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_nonexistent_add.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# unsupported add tensorflow model generator
#
import numpy as np
import os
import sys
import tensorflow as tf
def main():
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as s... | 41 | 1,129 |
mlflow | dev/clint/src/clint/rules/unnamed_thread_pool.py | .py | import ast
from clint.resolver import Resolver
from clint.rules.base import Rule
class UnnamedThreadPool(Rule):
def _message(self) -> str:
return (
"`ThreadPoolExecutor()` must be called with a `thread_name_prefix` argument to improve "
"debugging and traceability of thread-relate... | 24 | 779 |
wagtail | wagtail/documents/api/v3/schemas.py | .py | from typing import Literal, cast
from django.urls import reverse
from django.urls.exceptions import NoReverseMatch
from ninja import Schema
from wagtail.api.v2.utils import get_full_url
from wagtail.api.v3.schemas import create_generator, patch_generator, read_generator
from wagtail.api.v3.schemas.base import BaseMet... | 85 | 2,607 |
ipython | IPython/core/compilerop.py | .py | """Compiler tools with improved interactive support.
Provides compilation machinery similar to codeop, but with caching support so
we can provide interactive tracebacks.
Authors
-------
* Robert Kern
* Fernando Perez
* Thomas Kluyver
"""
# Note: though it might be more natural to name this module 'compiler', that
# ... | 197 | 7,265 |
gunicorn | tests/docker/asgi_compliance/test_http_compliance.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
HTTP compliance integration tests for ASGI.
Tests HTTP request/response handling, headers, methods, status codes,
and ASGI scope correctness through actual HTTP requests.
"""
import json
import pytest
pytes... | 533 | 20,668 |
sqlmap | tests/test_boolean_jitter.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Adversarial "shitty response" JITTER harness for BOOLEAN-based blind extraction.
Boolean-blind decides each bit through the REAL comparison() oracle (--string... | 297 | 15,324 |
readthedocs.org | readthedocs/builds/constants.py | .py | """Constants for the builds app."""
from django.conf import settings
from django.utils.translation import gettext_lazy as _
# BUILD_STATE is our *INTERNAL* representation of build states.
# This is not to be confused with external representations of 'status'
# that are sent back to Git providers.
BUILD_STATE_TRIGGER... | 196 | 6,086 |
sphinx | tests/roots/test-ext-coverage/grog/coverage_ignored.py | .py | class Documented:
"""Documented"""
def ignored1(self):
pass
def ignored2(self):
pass
def not_ignored1(self):
pass
def not_ignored2(self):
pass
class Ignored:
pass
class NotIgnored:
pass
| 23 | 254 |
bazel | third_party/py/abseil/absl/flags/__init__.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 ... | 224 | 7,665 |
black | tests/data/cases/fmtskip_multiple_in_clause.py | .py | # Multiple fmt: skip in multi-part if-clause
class ClassWithALongName:
Constant1 = 1
Constant2 = 2
Constant3 = 3
def test():
if (
"cond1" == "cond1"
and "cond2" == "cond2"
and 1 in (
ClassWithALongName.Constant1,
ClassWithALongName.Constant2,
... | 44 | 871 |
scikit-bio | skbio/stats/composition/tests/test_base.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.
# --------------------------------------------... | 1,483 | 56,402 |
clearml | clearml/utilities/attrs.py | .py | from typing import Any
import attr
from .version import Version
try:
# noinspection PyUnresolvedReferences
import importlib.metadata
attr_version = importlib.metadata.version("attrs")
except ImportError:
attr_version = attr.__version__
class attrs:
def __init__(self, *args: Any, **kwargs: Any)... | 29 | 808 |
biopython | Bio/motifs/minimal.py | .py | # Copyright 2018 by Ariel Aptekmann.
# 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.
"""Module for the supp... | 222 | 7,161 |
saleor | saleor/product/tests/test_collections_availability.py | .py | from .. import models
def test_visible_to_customer_user(customer_user, published_collections, channel_USD):
# given
collection = published_collections[0]
collection.channel_listings.all().delete()
# when
available_collections = models.Collection.objects.visible_to_user(
customer_user, cha... | 76 | 1,900 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_softplus.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# softplus paddle model generator
#
import numpy as np
import sys
from save_model import saveModel
def softplus(name: str, x, beta, threshold):
import paddle
paddle.enable_static()
node_x = paddle.static.data(name='x', s... | 47 | 1,210 |
pyomo | pyomo/core/base/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... | 75 | 2,824 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.