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 |
|---|---|---|---|---|---|
textual | tests/snapshot_tests/snapshot_apps/tabbed_content_style_leak_test.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Button, Label, TabbedContent, Tabs, TabPane
class TabbedContentStyleLeakTestApp(App[None]):
def compose(self) -> ComposeResult:
with TabbedContent():
with TabPane("Leak Test"):
yield Label("This label should... | 15 | 537 |
metrics | src/torchmetrics/classification/stat_scores.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... | 563 | 26,230 |
flit | tests/test_install.py | .py | import json
import os
import pathlib
import sys
import tempfile
from unittest import TestCase, SkipTest, skipIf
from unittest.mock import patch
import pytest
from testpath import (
assert_isfile, assert_isdir, assert_islink, assert_not_path_exists, MockCommand
)
from flit import install
from flit.install import I... | 371 | 15,849 |
probability | tensorflow_probability/python/bijectors/softfloor_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... | 179 | 7,310 |
saleor | saleor/graphql/shipping/tests/queries/test_shipping_zones.py | .py | from ....tests.utils import get_graphql_content
MULTIPLE_SHIPPING_QUERY = """
query MultipleShippings($channel: String) {
shippingZones(first: 100, channel: $channel) {
edges {
node {
id
name
priceRange {
... | 110 | 2,861 |
sphinx | tests/roots/test-ext-autosummary-skip-member/target.py | .py | class Foo:
"""docstring of Foo."""
def meth(self):
"""docstring of meth."""
pass
def skipmeth(self):
"""docstring of skipmeth."""
pass
def _privatemeth(self):
"""docstring of _privatemeth."""
pass
| 15 | 264 |
onnxruntime | onnxruntime/test/python/transformers/test_gelu_fusions.py | .py | import math
import os
import unittest
import torch
from parameterized import parameterized
from parity_utilities import find_transformers_source
if find_transformers_source():
from optimizer import optimize_model
else:
from onnxruntime.transformers.optimizer import optimize_model
class HuggingfaceGelu(torch... | 106 | 3,991 |
coremltools | coremltools/converters/mil/_deployment_compatibility.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
from enum import IntEnum
from coremltools import (
_SPECIFICATION_VERSION_IOS_13,
_SPECIFICATIO... | 181 | 6,426 |
saleor | saleor/graphql/product/bulk_mutations/product_bulk_create.py | .py | import datetime
from collections import defaultdict
import graphene
from django.core.exceptions import ValidationError
from django.db import transaction
from django.db.models import F
from django.utils.text import slugify
from graphene.utils.str_converters import to_camel_case
from text_unidecode import unidecode
fro... | 973 | 37,314 |
sqlmap | tamper/apostrophemask.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOWEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces single quotes (') with their... | 30 | 938 |
loguru | tests/exceptions/source/diagnose/encoding.py | .py | import sys
from loguru import logger
logger.remove()
logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True)
def _deep(val):
return 1 / val
def div():
return _deep("天")
try:
div()
except TypeError:
logger.exception("")
| 21 | 270 |
metrics | src/torchmetrics/regression/js_divergence.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... | 173 | 6,775 |
black | tests/data/cases/comments6.py | .py | from typing import Any, Tuple
def f(
a, # type: int
):
pass
# test type comments
def f(a, b, c, d, e, f, g, h, i):
# type: (int, int, int, int, int, int, int, int, int) -> None
pass
def f(
a, # type: int
b, # type: int
c, # type: int
d, # type: int
e, # type: int
f, ... | 119 | 2,479 |
metrics | src/torchmetrics/classification/precision_recall.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 1,087 | 48,258 |
mkdocs-material | material/plugins/privacy/plugin.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... | 681 | 28,438 |
wagtail | wagtail/utils/timestamps.py | .py | import datetime
from django.conf import settings
from django.utils import formats, timezone
from django.utils.dateparse import parse_datetime
def ensure_utc(value):
"""
Similar to how django-modelcluster stores the revision's data and similar to how
django stores dates in the database, this converts the ... | 44 | 1,503 |
sphinx | tests/roots/test-double-inheriting-theme/conf.py | .py | templates_path = ['_templates']
html_theme = 'base_theme2'
html_theme_path = ['base_themes_dir']
exclude_patterns = ['_build']
| 5 | 127 |
ipython | tests/test_magic_terminal.py | .py | """Tests for various magic functions specific to the terminal frontend."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import sys
from io import StringIO
import pytest
from IPython.testing i... | 229 | 5,280 |
ipython | tests/test_interactiveshell.py | .py | # -*- coding: utf-8 -*-
"""Tests for the key interactiveshell module.
Historically the main classes in interactiveshell have been under-tested. This
module should grow as many single-method tests as possible to trap many of the
recurring bugs we seem to encounter with high-level interaction.
"""
# Copyright (c) IPyt... | 1,446 | 41,370 |
httpie | httpie/internal/__build_channel__.py | .py | # Represents the packaging method. This file should
# be overridden by every build system we support on
# the packaging step.
BUILD_CHANNEL = 'unknown'
| 6 | 153 |
deap | tests/test_convergence.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 ... | 443 | 16,010 |
pyomo | pyomo/core/kernel/objective.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... | 88 | 2,466 |
mlflow | mlflow/protos/jobs_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: jobs.proto
# Protobuf Python Version: 5.26.0
"""Generated protocol buffer code."""
from google.protob... | 102 | 5,270 |
onnxruntime | tools/python/util/android/__init__.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from .android import ( # noqa: F401
SdkToolPaths,
create_virtual_device,
get_sdk_tool_paths,
start_emulator,
stop_emulator,
)
| 11 | 242 |
httpie | tests/test_cli_ui.py | .py | import pytest
import shutil
import os
from tests.utils import http
NAKED_BASE_TEMPLATE = """\
usage:
http {extra_args}[METHOD] URL [REQUEST_ITEM ...]
error:
{error_msg}
for more information:
run 'http --help' or visit https://httpie.io/docs/cli
"""
NAKED_HELP_MESSAGE = NAKED_BASE_TEMPLATE.format(
e... | 66 | 2,025 |
jupytext | tests/data/notebooks/outputs/ipynb_to_percent/convert_to_py_then_test_with_update83.py | .py | # ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
# %%time
print('asdf')
# %% [markdown]
# Thanks for jupytext!
# %%
| 18 | 187 |
sqlmap | tests/test_wafbypass.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
T1 - automatic WAF-bypass tamper selection (lib/utils/wafbypass.py). These cover the pure,
offline pieces: the identYwaf blind-signature decoder (which provocation vectors a known WAF... | 82 | 3,455 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_Unpack.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestUnpack(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
assert 'x:0' in inputs_info, "Tes... | 54 | 2,060 |
hydra | examples/plugins/example_generic_plugin/tests/test_example_plugin.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from hydra.core.plugins import Plugins
from hydra.plugins.plugin import Plugin
from hydra_plugins.example_generic_plugin.example_plugin import ExamplePlugin
def test_discovery() -> None:
# Tests that this plugin can be discovered via the plug... | 18 | 561 |
bazel | src/test/py/bazel/bzlmod/remote_repo_contents_cache_test.py | .py | # pylint: disable=g-backslash-continuation
# Copyright 2025 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/LICEN... | 2,710 | 104,828 |
mlflow | tests/genai/scorers/trulens/test_models.py | .py | import importlib
from unittest.mock import Mock, patch
import pytest
import trulens # noqa: F401
from mlflow.exceptions import MlflowException
from mlflow.genai.scorers.trulens.models import create_trulens_provider
@pytest.fixture
def mock_call_chat_completions():
with patch(
"mlflow.genai.judges.adapt... | 108 | 3,635 |
saleor | saleor/plugins/webhook/tests/subscription_webhooks/filterable_webhooks/test_checkout_metadata_updated.py | .py | import json
from unittest.mock import patch
import graphene
from django.test import override_settings
from ......core.models import EventDelivery
from ......graphql.webhook.subscription_query import SubscriptionQuery
from ......webhook.event_types import WebhookEventAsyncType
from .....manager import get_plugins_mana... | 274 | 8,554 |
mkdocs | mkdocs/utils/__init__.py | .py | """
Standalone file utils.
Nothing in this module should have an knowledge of config or the layout
and structure of the site and pages in the site.
"""
from __future__ import annotations
import functools
import logging
import os
import posixpath
import re
import shutil
import sys
import warnings
from collections impo... | 411 | 12,280 |
ipython | tests/print_argv.py | .py | import sys
print(sys.argv[1:])
| 4 | 32 |
saleor | saleor/tests/e2e/taxes/utils/tax_configuration_update.py | .py | from ...utils import get_graphql_content
TAX_CONFIGURATION_UPDATE_MUTATION = """
mutation TaxConfigurationUpdate($id: ID!, $input: TaxConfigurationUpdateInput!) {
taxConfigurationUpdate(id: $id, input: $input) {
errors {
field
code
message
countryCodes
}
taxConfiguration {
i... | 75 | 1,962 |
sphinx | sphinx/util/build_phase.py | .py | """Build phase of Sphinx application."""
from __future__ import annotations
from enum import IntEnum
class BuildPhase(IntEnum):
"""Build phase of Sphinx application."""
INITIALIZATION = 1
READING = 2
CONSISTENCY_CHECK = 3
RESOLVING = 3
WRITING = 4
| 16 | 277 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/cogroupbykey_test.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,975 |
mlflow | tests/llama_index/sample_code/with_model_config_yaml_file.py | .py | """
Sample code to define a chat engine and save it with model config (YAML file).
"""
from llama_index.core import Document, VectorStoreIndex
from llama_index.core.chat_engine.types import ChatMode
from llama_index.llms.openai import OpenAI
import mlflow
model_config = mlflow.models.ModelConfig(development_config="... | 22 | 768 |
mlflow | tests/store/tracking/__init__.py | .py | import json
import pytest
from mlflow.entities import RunTag
from mlflow.models import Model
from mlflow.utils.mlflow_tags import MLFLOW_LOGGED_MODELS
class AbstractStoreTest:
def create_test_run(self):
raise Exception("this should be overridden")
def get_store(self):
raise Exception("this ... | 70 | 2,562 |
mlflow | mlflow/webhooks/ssrf.py | .py | """Connection-time SSRF protection for outbound webhook delivery.
``_validate_webhook_url`` resolves the webhook hostname and checks that every
resolved IP is public, but it discards the resolved IP and the subsequent
``requests.post`` re-resolves the hostname independently. That TOCTOU gap lets a
DNS-rebinding attack... | 145 | 5,265 |
conda | conda/cli/conda_argparse.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Conda command line interface parsers."""
from __future__ import annotations
import argparse
import os
import sys
from argparse import (
SUPPRESS,
RawDescriptionHelpFormatter,
)
from argparse import ArgumentParser as ArgumentParserBa... | 390 | 14,118 |
conda | tests/test_priority.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda.testing.integration import package_is_installed
if TYPE_CHECKING:
from pathlib import Path
from pytest import MonkeyPatch
from conda.t... | 81 | 2,745 |
metrics | src/torchmetrics/functional/detection/_deprecated.py | .py | from collections.abc import Collection
from torch import Tensor
from torchmetrics.functional.detection.panoptic_qualities import modified_panoptic_quality, panoptic_quality
from torchmetrics.utilities.prints import _deprecated_root_import_func
def _modified_panoptic_quality(
preds: Tensor,
target: Tensor,
... | 67 | 2,308 |
onnxruntime | onnxruntime/test/testdata/ort_github_issue_4031.py | .py | import onnx
from onnx import TensorProto, helper
if_body = helper.make_graph(
[
# need to use main_graph_initializer in a way that can't be constant folded
helper.make_node("Add", ["state_var_in", "main_graph_initializer"], ["add_out"], "If_add"),
helper.make_node("Cast", ["add_out"], ["out... | 81 | 2,779 |
hypercorn | tests/trio/test_lifespan.py | .py | from __future__ import annotations
import sys
if sys.version_info < (3, 11):
from exceptiongroup import ExceptionGroup
import pytest
import trio
from hypercorn.app_wrappers import ASGIWrapper
from hypercorn.config import Config
from hypercorn.trio.lifespan import Lifespan
from hypercorn.typing import ASGIReceiv... | 50 | 1,721 |
sqlmap | lib/takeover/abstraction.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import sys
from lib.core.common import Backend
from lib.core.common import dataToStdout
from lib.core.common import getSQLSnippet
from lib.... | 246 | 8,920 |
saleor | saleor/payment/tests/test_utils/test_parse_transaction_action_data_for_action_webhook.py | .py | import datetime
from decimal import Decimal
import pytest
from freezegun import freeze_time
from ... import TransactionEventType
from ...interface import (
TransactionRequestEventResponse,
TransactionRequestResponse,
)
from ...utils import (
parse_transaction_action_data_for_action_webhook,
)
def test_p... | 271 | 8,870 |
onnxruntime | onnxruntime/python/tools/transformers/models/torch_export_patches/patch_inputs.py | .py | import inspect
from typing import Any
import torch
from transformers.cache_utils import DynamicCache
from . import string_type
from .cache_helper import make_dynamic_cache
def _process_cache(k: str, v):
assert k != "position_ids" or isinstance(k, torch.Tensor), (
f"Unexpected type for parameter {k!r} {s... | 167 | 6,629 |
probability | tensorflow_probability/python/sts/components/autoregressive_moving_average_test.py | .py | # Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 239 | 9,389 |
kafka | tests/kafkatest/tests/core/consumer_group_command_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 use ... | 111 | 5,104 |
scikit-bio | skbio/tree/_nj.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.
# --------------------------------------------... | 347 | 12,483 |
astropy | astropy/coordinates/tests/accuracy/test_ecliptic.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Accuracy tests for Ecliptic coordinate systems.
"""
import numpy as np
import pytest
from astropy import units as u
from astropy.constants import R_earth, R_sun
from astropy.coordinates import SkyCoord
from astropy.coordinates.builtin_frames import (... | 274 | 10,139 |
black | tests/data/cases/preview_fmt_off_class_blank_lines.py | .py | # flags: --preview
import sys
# fmt: off
class C:
def foo(self):
print(sys.platform)
# output
import sys
# fmt: off
class C:
def foo(self):
print(sys.platform)
| 18 | 189 |
saleor | saleor/webhook/observability/tests/test_utils.py | .py | import datetime
import json
from unittest.mock import patch
import pytest
from celery.exceptions import Retry
from django.http import HttpResponse
from freezegun import freeze_time
from ..exceptions import ApiCallTruncationError, EventDeliveryAttemptTruncationError
from ..payload_schema import JsonTruncText
from ..pa... | 293 | 8,625 |
astropy | astropy/coordinates/builtin_frames/galactocentric.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
from collections.abc import MappingView
from types import MappingProxyType
import numpy as np
from astropy import units as u
from astropy.coordinates import Angle
from astropy.coordinates import representation as r
from astropy.coordinates.a... | 600 | 25,249 |
luigi | luigi/contrib/datadog_metric.py | .py | import logging
from luigi import parameter
from luigi.metrics import MetricsCollector
from luigi.task import Config
logger = logging.getLogger("luigi-interface")
try:
from datadog import api, initialize, statsd
except ImportError:
logger.warning("Loading datadog module without datadog installed. Will crash a... | 120 | 5,430 |
saleor | saleor/tests/e2e/orders/utils/order_line_update.py | .py | from saleor.graphql.tests.utils import get_graphql_content
ORDER_LINE_UPDATE_MUTATION = """
mutation orderLineUpdate($id: ID!, $input: OrderLineInput!) {
orderLineUpdate(id: $id, input: $input) {
order {
id
shippingMethods {
id
price {
amount
}
}
total {
... | 94 | 1,566 |
probability | tensorflow_probability/python/experimental/distribute/joint_distribution.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... | 184 | 7,410 |
sqlmap | plugins/dbms/raima/takeover.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.exception import SqlmapUnsupportedFeatureException
from plugins.generic.takeover import Takeover as GenericTakeover
class Takeover(GenericTakeover):
def osCmd(s... | 29 | 1,034 |
saleor | saleor/plugins/user_email/constants.py | .py | import os
from django.conf import settings
PLUGIN_ID = "mirumee.notifications.user_email"
DEFAULT_EMAIL_TEMPLATES_PATH = os.path.join(
settings.PROJECT_ROOT, "saleor/plugins/user_email/default_email_templates"
)
ACCOUNT_CONFIRMATION_TEMPLATE_FIELD = "account_confirmation"
ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE... | 99 | 4,966 |
openvino | thirdparty/itt_collector/runtool/sea.py | .py | # Intel® Single Event API
#
# This file is provided under the BSD 3-Clause license.
# Copyright (c) 2021, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# Redistri... | 302 | 12,987 |
clearml | examples/frameworks/fire/fire_dict_cmd.py | .py | # ClearML - Example of Python Fire integration, with commands derived from a dictionary
#
from clearml import Task
import fire
def add(x, y):
return x + y
def multiply(x, y):
return x * y
if __name__ == "__main__":
Task.init(project_name="examples", task_name="Fire dict command")
fire.Fire(
... | 24 | 400 |
wandb | wandb/sdk/internal/datastore.py | .py | """leveldb log datastore.
Format is described at:
https://github.com/google/leveldb/blob/master/doc/log_format.md
block := record* trailer?
record :=
checksum: uint32 // crc32c of type and data[] ; little-endian
length: uint16 // little-endian
type: uint8 // One of FULL, FIRST, MIDDLE, LA... | 284 | 9,469 |
metrics | src/torchmetrics/functional/text/edit.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... | 121 | 4,806 |
saleor | saleor/graphql/order/tests/benchmark/test_order_lines_create.py | .py | from decimal import Decimal
import graphene
import pytest
from .....discount import RewardValueType
from .....order import OrderStatus
from .....product.models import (
ProductVariant,
ProductVariantChannelListing,
VariantChannelListingPromotionRule,
)
from ....tests.utils import get_graphql_content
ORDE... | 144 | 3,920 |
saleor | saleor/tests/e2e/checkout/test_checkout_unable_to_make_purchase_with_no_payment.py | .py | import pytest
from ..product.utils.preparing_product import prepare_product
from ..shop.utils.preparing_shop import prepare_default_shop
from ..utils import assign_permissions
from .utils import (
checkout_create,
checkout_delivery_method_update,
raw_checkout_complete,
)
@pytest.mark.e2e
def test_should_... | 90 | 2,451 |
django-cms | setup.py | .py | #!/usr/bin/env python
from setuptools import setup
setup()
| 5 | 60 |
mlflow | mlflow/entities/span_event.py | .py | import json
import time
import traceback
from dataclasses import dataclass, field
from datetime import datetime
from opentelemetry.util.types import AttributeValue
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.tracing.utils.otlp import _set_otel_proto_anyvalue
@dataclass
class SpanEvent(_Mlfl... | 104 | 3,382 |
mlflow | tests/assistant/providers/test_mlflow_gateway_provider.py | .py | from types import SimpleNamespace
from unittest import mock
import pytest
from mlflow.assistant.providers import MlflowGatewayProvider, list_providers
def _gateway_provider():
for p in list_providers():
if p.name == MlflowGatewayProvider.GATEWAY_PROVIDER_NAME:
return p
raise AssertionErr... | 67 | 2,476 |
sqlmap | extra/esperanto/engine.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from .atlas import _FREQ_ORDER
from .atlas import _hardWarnings
from .atlas import _PRINTABLE_SORTED
from .atlas import _REPL
from .atlas import _unichr
from .records import Diale... | 199 | 11,079 |
mlflow | tests/assistant/test_skill_installer.py | .py | from unittest import mock
from mlflow.assistant.skill_installer import (
install_skills,
list_bundled_skills,
list_installed_skills,
)
def test_install_skills_copies_to_destination(tmp_path):
destination = tmp_path / "skills"
installed = install_skills(destination)
assert destination.exists(... | 70 | 1,994 |
metrics | tests/unittests/bases/test_composition.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... | 582 | 17,579 |
textual | tests/snapshot_tests/snapshot_apps/unscoped_css.py | .py | from textual.app import App, ComposeResult
from textual.widget import Widget
from textual.widgets import Label
class MyWidget(Widget):
SCOPED_CSS = False
DEFAULT_CSS = """
MyWidget {
height: auto;
border: magenta;
}
Label {
border: solid green;
}
"""
def compos... | 36 | 689 |
pyomo | pyomo/contrib/pynumero/examples/callback/cyipopt_callback_halt.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... | 46 | 1,200 |
biopython | Bio/Align/bigbed.py | .py | # Copyright 2022 by Michiel de Hoon. 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.
"""Bio.Align support fo... | 2,242 | 81,893 |
mlflow | tests/entities/test_span_attachments.py | .py | from unittest import mock
from mlflow.entities.span import LiveSpan, Span
from mlflow.tracing.attachments import Attachment
def _make_live_span(trace_id="tr-test123"):
from opentelemetry.sdk.trace import TracerProvider
tracer = TracerProvider().get_tracer("test")
otel_span = tracer.start_span("test_span... | 146 | 4,691 |
cvxpy | tools/release_notes.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
... | 185 | 6,297 |
saleor | saleor/webhook/response_schemas/shipping.py | .py | import logging
from decimal import Decimal
from typing import Annotated, TypeVar
from graphql.error import GraphQLError
from prices import Money
from pydantic import (
BaseModel,
Field,
RootModel,
ValidationInfo,
field_validator,
)
from ...app.models import App
from ...graphql.core.utils import fr... | 137 | 4,287 |
pymc | pymc/blocking.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... | 122 | 3,579 |
hydra | tests/test_apps/glob_searchpath/my_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from omegaconf import DictConfig
import hydra
@hydra.main(config_path="conf", config_name="config")
def my_app(cfg: DictConfig) -> None:
print(f"foo={cfg.foo}")
if __name__ == "__main__":
my_app()
| 14 | 281 |
kombu | t/unit/test_common.py | .py | from __future__ import annotations
import socket
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
from amqp import RecoverableConnectionError
from kombu import common
from kombu.common import (PREFETCH_COUNT_MAX, Broadcast, QoS, collect_replies,
declarati... | 684 | 23,571 |
django-cms | cms/app_base.py | .py | from abc import ABCMeta, abstractmethod
class CMSApp:
"""Base class for creating apphooks. Apphooks live in a file called ``cms_apps.py``.
To create an AppHook subclass ``CMSApp`` in ``cms_apps.py``
::
class MyAppHook(CMSApp):
name = "Problem solver"
"""
#: list of urlconfs: ex... | 260 | 9,715 |
probability | tensorflow_probability/python/experimental/mcmc/sample_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... | 128 | 4,730 |
beam | sdks/python/apache_beam/internal/metrics/metric.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... | 225 | 7,729 |
beam | sdks/python/apache_beam/examples/snippets/transforms/elementwise/regex_find_kv.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");... | 62 | 1,985 |
voila | tests/app/preheat_multiple_notebooks_test.py | .py | import asyncio
import os
import time
import pytest
BASE_DIR = os.path.dirname(__file__)
NOTEBOOK_EXECUTION_TIME = 3
NUMBER_PREHEATED_KERNEL = 2
TIME_THRESHOLD = 1
@pytest.fixture
def voila_config_file_paths_arg():
path = os.path.join(BASE_DIR, "..", "configs", "preheat")
return "--VoilaTest.config_file_path... | 60 | 1,577 |
pyomo | pyomo/dae/__init__.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 16 | 774 |
python-prompt-toolkit | examples/full-screen/ansi-art-and-textarea.py | .py | #!/usr/bin/env python
from prompt_toolkit.application import Application
from prompt_toolkit.formatted_text import ANSI, HTML
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.layout import HSplit, Layout, VSplit, WindowAlign
from prompt_toolkit.widgets import Dialog, Label, TextArea
def main():... | 83 | 23,815 |
mlflow | mlflow/entities/logged_model_parameter.py | .py | import sys
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos import service_pb2 as pb2
class LoggedModelParameter(_MlflowObject):
"""
MLflow entity representing a parameter of a Model.
"""
def __init__(self, key, value):
if "pyspark.ml" in sys.modules:
i... | 47 | 1,140 |
wandb | wandb/sdk/launch/builder/templates/dockerfile.py | .py | DOCKERFILE_TEMPLATE = """
# ----- stage 1: build -----
FROM {py_build_image} as build
# requirements section depends on pip vs conda, and presence of buildx
ENV PIP_PROGRESS_BAR off
{requirements_section}
# ----- stage 2: base -----
{base_setup}
COPY --from=build /env /env
ENV PATH="/env/bin:$PATH"
ENV SHELL /bin/b... | 93 | 2,264 |
probability | tensorflow_probability/python/experimental/mcmc/weighted_resampling.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 ... | 582 | 26,377 |
beam | sdks/python/apache_beam/testing/benchmarks/nexmark/queries/query11.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... | 55 | 2,235 |
coremltools | coremltools/optimize/torch/palettization/post_training_palettization.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
import logging as _logging
from collections import OrderedDict as _OrderedDict
from typing import Any... | 345 | 15,751 |
omegaconf | tests/test_unions.py | .py | from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Literal, Union
from pytest import mark, param, raises
from omegaconf import OmegaConf, UnionNode, ValidationError
from omegaconf._utils import _get_value, get_type_hint
from tests import Color
@dataclass
class Lite... | 172 | 5,144 |
sqlmap | plugins/dbms/maxdb/enumeration.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.common import isListLike
from lib.core.common import isTechniqueAvailable
from lib.core.common import readInput
from lib.core.common import safeSQLIdentif... | 247 | 9,396 |
textual | docs/examples/guide/widgets/fizzbuzz01.py | .py | from rich.table import Table
from textual.app import App, ComposeResult
from textual.widgets import Static
class FizzBuzz(Static):
def on_mount(self) -> None:
table = Table("Number", "Fizz?", "Buzz?")
for n in range(1, 16):
fizz = not n % 3
buzz = not n % 5
tab... | 31 | 669 |
python-prompt-toolkit | src/prompt_toolkit/renderer.py | .py | """
Renders the command line on the console.
(Redraws parts of the input line that were changed.)
"""
from __future__ import annotations
from asyncio import FIRST_COMPLETED, Future, ensure_future, sleep, wait
from collections import deque
from collections.abc import Callable, Hashable
from enum import Enum
from typin... | 822 | 29,419 |
ipython | examples/auto_suggest_llm.py | .py | """
This is an example of Fake LLM Completer for IPython, as
well as example on how to configure IPython for LLMs.
8.32 – this is provisional and may change.
To test this you can run the following command from the root of IPython
directory:
$ ipython --TerminalInteractiveShell.llm_provider_class=examples.auto_su... | 175 | 5,682 |
mlflow | dev/detect_flaky_tests.py | .py | """Detect flaky tests from user-triggered CI re-runs.
Ground-truth flake signal: a job that **failed on one run attempt and passed on the
next attempt of the same commit** flaked by definition (same code, different outcome),
and a human already judged it worth re-running by hitting "Re-run failed jobs".
This script m... | 260 | 10,892 |
pyomo | pyomo/contrib/preprocessing/plugins/remove_zero_terms.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... | 88 | 3,569 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.