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 |
|---|---|---|---|---|---|
saleor | saleor/checkout/tests/fixtures/__init__.py | .py | from .benchmark import * # noqa: F403
from .checkout import * # noqa: F403
from .checkout_info import * # noqa: F403
from .checkout_line import * # noqa: F403
from .checkout_line_info import * # noqa: F403
from .checkout_with_discount import * # noqa: F403
from .checkout_with_payment import * # noqa: F403
from .... | 10 | 419 |
pyomo | doc/OnlineDocs/src/kernel/examples/kernel_subclassing.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... | 92 | 2,274 |
lemur | lemur/sources/cli.py | .py | """
.. module: lemur.sources.cli
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
import sys
import time
from copy import deepcopy
import click
from flask import current_app
... | 451 | 15,302 |
dirty-equals | dirty_equals/_boolean.py | .py | from typing import Any
from ._base import DirtyEquals
from ._utils import Omit
class IsTrueLike(DirtyEquals[bool]):
"""
Check if the value is True like. `IsTrueLike` allows comparison to anything and effectively uses just
`return bool(other)`.
Example of basic usage:
```py title="IsTrueLike"
... | 80 | 2,416 |
mlflow | examples/pyfunc/train.py | .py | import os
from typing import Any
from custom_code import iris_classes
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
import mlflow
from mlflow.models import infer_signature
class CustomPredict(mlflow.pyfunc.PythonModel):
"""Custom pyfunc class used to create customize... | 44 | 1,467 |
pdm | src/pdm/installers/manager.py | .py | from __future__ import annotations
from importlib.metadata import Distribution
from typing import TYPE_CHECKING
from pdm import termui
from pdm.exceptions import UninstallError
from pdm.installers.installers import install_wheel
from pdm.installers.uninstallers import BaseRemovePaths, StashedRemovePaths
if TYPE_CHEC... | 71 | 2,966 |
probability | tensorflow_probability/python/distributions/discrete_rejection_sampling.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... | 134 | 5,370 |
onnxruntime | tools/python/get_submodules.py | .py | import argparse
import configparser
import json
import re
from pathlib import Path
import pygit2
def format_component(submod):
return {"component": {"type": "git", "git": {"commitHash": str(submod.head_id), "repositoryUrl": submod.url}}}
def lookup_submodule(repo, submodule_path):
submodule = repo.lookup_s... | 69 | 2,586 |
astropy | astropy/tests/figures/__init__.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from .helpers import figure_test
| 4 | 98 |
beam | sdks/python/apache_beam/ml/inference/onnx_inference_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... | 534 | 19,894 |
wandb | wandb/_pydantic/field_types.py | .py | """Reusable field types and annotations for pydantic fields."""
from __future__ import annotations
from typing import Annotated, TypeAlias, TypeVar
from pydantic import Field, StrictStr
T = TypeVar("T")
Typename: TypeAlias = Annotated[T, Field(alias="__typename")]
"""Annotates GraphQL `__typename` fields."""
GQL... | 17 | 437 |
beam | sdks/python/apache_beam/ml/transforms/utils.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... | 94 | 3,673 |
beam | sdks/python/apache_beam/examples/inference/anomaly_detection/write_data_to_pubsub_pipeline/main.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... | 90 | 2,764 |
biopython | Bio/SeqIO/SwissIO.py | .py | # Copyright 2006-2013,2020 by Peter Cock.
# Revisions copyright 2008-2009 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 i... | 125 | 5,327 |
saleor | saleor/plugins/webhook/tests/subscription_webhooks/filterable_webhooks/test_order_paid.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... | 232 | 6,916 |
probability | spinoffs/inference_gym/inference_gym/targets/sparse_logistic_regression.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... | 210 | 7,731 |
onnxruntime | onnxruntime/python/tools/transformers/fusion_biassplitgelu.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from logging import getLogger
from fusion_base import Fusion
from onnx ... | 111 | 4,381 |
openvino | tools/commit_slider/utils/log_parser.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import re
import zipfile
import os
import csv
import shutil
from utils.helpers import CfgError
def getMap(hashPatternList, intervalPatternList):
intervalPos = 2 # as in 'Check interval i1..i2' pattern
hashMap = {}
for i, ... | 112 | 3,210 |
astropy | astropy/coordinates/builtin_frames/ecliptic_transforms.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains the transformation functions for getting to/from ecliptic systems.
"""
import erfa
from astropy import units as u
from astropy.coordinates.baseframe import frame_transform_graph
from astropy.coordinates.errors import UnitsError
from astropy.... | 299 | 10,838 |
sqlmap | plugins/dbms/cubrid/__init__.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from lib.core.enums import DBMS
from lib.core.settings import CUBRID_SYSTEM_DBS
from lib.core.unescaper import unescaper
from plugins.dbms.cubrid.enumeration import Enumeration
f... | 31 | 909 |
textual | docs/examples/app/question03.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Label, Button
class QuestionApp(App[str]):
CSS = """
Screen {
layout: grid;
grid-size: 2;
grid-gutter: 2;
padding: 2;
}
#question {
width: 100%;
height: 100%;
column-span: 2;
... | 39 | 841 |
saleor | saleor/tests/e2e/checkout/test_checkout_should_be_able_to_remove_shipping_method.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
@pytest.mark.e2e
def test_checkout_should_be_able_to_remove_shipping_meth... | 89 | 2,942 |
onnxruntime | onnxruntime/python/tools/transformers/models/phi2/__init__.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import os
import sys
sys.path.append(os.path.dirname(__file__))
transf... | 13 | 478 |
onnxruntime | orttraining/orttraining/python/training/optim/_ds_modifier.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
# Copyright 2020 The Microsoft DeepSpeed Team
# Copyright (c) 2020, NVIDIA CORPORATION.
# Some functions in this file are adapted from following sou... | 257 | 12,585 |
textual | tests/test_markdownviewer.py | .py | from pathlib import Path
import pytest
from rich.text import Text
import textual.widgets._markdown as MD
from textual.app import App, ComposeResult
from textual.content import Content
from textual.geometry import Offset
from textual.widgets import Markdown, MarkdownViewer, Tree
TEST_MARKDOWN = """\
* [First]({{file}... | 92 | 3,272 |
conda | conda/plugins/manager.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
This module contains a subclass implementation of pluggy's
`PluginManager <https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluginManager>`_.
Additionally, it contains a function we use to construct the ``PluginManager`` ob... | 1,396 | 50,935 |
django-cms | cms/toolbar/toolbar.py | .py | import functools
import operator
from collections import OrderedDict
from urllib.parse import urlparse
from classytags.utils import flatten_context
from django.apps import apps
from django.conf import settings
from django.middleware.csrf import get_token
from django.template.loader import render_to_string
from django.... | 649 | 24,466 |
pyomo | examples/performance/jump/opf_6620bus.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... | 350 | 9,657 |
probability | tensorflow_probability/python/internal/backend/numpy/random_generators.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... | 359 | 14,546 |
sqlmap | plugins/dbms/vertica/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 getRoles(self, *args, **... | 17 | 458 |
beam | sdks/python/apache_beam/examples/snippets/transforms/other/window_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");... | 52 | 1,521 |
lemur | lemur/api_keys/service.py | .py | """
.. module: lemur.api_keys.service
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Eric Coan <kungfury@instructure.com>
"""
from lemur import database
from lemur.api_keys.models import ApiKey
from lemur.logs impo... | 105 | 2,442 |
eve | examples/security/bcrypt.py | .py | # -*- coding: utf-8 -*-
"""
Auth-BCrypt
~~~~~~~~~~~
Securing an Eve-powered API with Basic Authentication (RFC2617).
This script assumes that user accounts are stored in a MongoDB collection
('accounts'), and that passwords are stored as BCrypt hashes. All API
resources/methods will be secure... | 44 | 1,330 |
pyro | pyro/ops/rings.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import weakref
from abc import ABCMeta, abstractmethod
import torch
from pyro.ops.einsum import contract
from pyro.ops.einsum.adjoint import SAMPLE_SYMBOL, Backward
from pyro.util import ignore_jit_warnings
class Ring(object, m... | 339 | 11,388 |
cvxpy | cvxpy/interface/numpy_interface/sparse_matrix_interface.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... | 99 | 3,625 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_ListDiff.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 TestListDiff(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
assert 'x:0' in inputs_info, "T... | 47 | 1,775 |
saleor | saleor/graphql/account/tests/benchmark/test_account.py | .py | from unittest.mock import MagicMock
import graphene
import pytest
from django.core.files import File
from .....account.models import Group, User
from ....tests.utils import get_graphql_content
@pytest.mark.django_db
@pytest.mark.count_queries(autouse=False)
def test_query_staff_user(
staff_api_client,
addre... | 516 | 14,911 |
sphinx | tests/test_builders/test_build_texinfo.py | .py | """Test the build process with Texinfo builder with the test root."""
from __future__ import annotations
import re
import subprocess
from pathlib import Path
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
from unittest.mock import Mock
import pytest
from sphinx.builders.texinfo import de... | 155 | 5,553 |
saleor | saleor/graphql/webhook/mutations/webhook_dry_run.py | .py | from typing import cast
import graphene
from graphene.utils.str_converters import to_camel_case
from ....app.models import App
from ....discount import models as discount_models
from ....permission.auth_filters import AuthorizationFilters
from ....webhook.error_codes import WebhookDryRunErrorCode
from ....webhook.eve... | 148 | 5,578 |
saleor | saleor/graphql/translations/mutations/sale_translate.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....discount import models as discount_models
from ....discount.error_codes import DiscountErrorCode
from ....permission.enums import SitePermissions
from ...core import ResolveInfo
from ...core.context import ChannelContext
from ...core.enums imp... | 95 | 3,519 |
astropy | astropy/table/mixins/dask.py | .py | import dask.array as da
from astropy.utils.data_info import ParentDtypeInfo
__all__ = ["as_dask_column"]
class DaskInfo(ParentDtypeInfo):
@staticmethod
def default_format(val):
return f"{val.compute()}"
class DaskColumn(da.Array):
info = DaskInfo()
def copy(self):
# Array hard-cod... | 38 | 1,008 |
pynacl | src/nacl/secret.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... | 308 | 12,122 |
wandb | tests/unit_tests/test_artifacts/test_s3_handler.py | .py | import pytest
from wandb.sdk.artifacts.storage_handlers.s3_handler import S3Handler
COREWEAVE_ENDPOINT_TEST_CASES = [
# Direct matches from the predefined list
("https://cwobject.com", True),
("https://cwobject.com/", True),
("http://cwlota.com", True),
("accel-object.lga1.coreweave.com", True),
... | 31 | 1,161 |
sphinx | sphinx/__init__.py | .py | """The Sphinx documentation toolchain."""
# Keep this file executable as-is in Python 3!
# (Otherwise getting the version out of it when packaging is impossible.)
from __future__ import annotations
from sphinx.util._pathlib import _StrPath
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Final
__vers... | 49 | 1,423 |
probability | spinoffs/fun_mc/fun_mc/util.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... | 18 | 802 |
beam | sdks/python/apache_beam/runners/worker/operations.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 1,542 | 56,787 |
onnx | tests/python/external_data_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import pathlib
import shutil
import uuid
import warnings
from typing import TYPE_CHECKING, Any
import numpy as np
import pytest
import onnx
from onnx import (
ModelProto,
NodeProto,
... | 1,344 | 54,125 |
pyomo | examples/pyomo/suffixes/duals_pyomo.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... | 26 | 1,155 |
wagtail | wagtail/whitelist.py | .py | """
A generic HTML whitelisting engine, designed to accommodate subclassing to override
specific rules.
"""
import re
from bs4 import BeautifulSoup, Comment, NavigableString, Tag
from django.utils.html import escape
ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "mailto", "tel"]
PROTOCOL_RE = re.compile("^[a-z0-9][... | 157 | 5,666 |
wagtail | wagtail/tests/test_form_data_utils.py | .py | from django.test import SimpleTestCase
from wagtail.test.utils.form_data import querydict_from_html
class TestQueryDictFromHTML(SimpleTestCase):
html = """
<form id="personal-details">
<input type="hidden" name="csrfmiddlewaretoken" value="Z783HTL5Bc2J54WhAtEeR3eefM1FBkq0EbTfNnYnepFGuJSOfvosFvwjeKYtM... | 190 | 7,329 |
pdm | tests/models/test_backends.py | .py | import shutil
from pathlib import Path
import pytest
from pdm.models.backends import _BACKENDS, get_backend, get_relative_path
from pdm.project import Project
from pdm.utils import cd
from tests import FIXTURES
def _setup_backend(project: Project, backend: str):
project.pyproject.metadata["requires-python"] = "... | 89 | 3,742 |
textual | docs/examples/styles/scrollbar_corner_color.py | .py | from textual.app import App
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where th... | 24 | 633 |
lemur | lemur/plugins/lemur_slack/tests/test_slack.py | .py | from datetime import timedelta
import arrow
from moto import mock_ses
from lemur.tests.factories import NotificationFactory, CertificateFactory
from lemur.tests.test_messaging import verify_sender_email
def test_formatting(certificate):
from lemur.plugins.lemur_slack.plugin import create_expiration_attachments
... | 110 | 4,066 |
rq | tests/test_helpers.py | .py | from unittest import mock
from rq.cli.helpers import get_redis_from_config
from tests import RQTestCase
class TestHelpers(RQTestCase):
@mock.patch('rq.cli.helpers.Sentinel')
def test_get_redis_from_config(self, sentinel_class_mock):
"""Ensure Redis connection params are properly parsed"""
set... | 90 | 3,336 |
onnxruntime | onnxruntime/python/tools/transformers/models/gpt2/gpt2_parity.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# This ... | 514 | 17,735 |
wandb | wandb/automations/_generated/get_entity_automations_legacy.py | .py | # Generated by ariadne-codegen
# Source: tools/graphql_codegen/automations/
from __future__ import annotations
from pydantic import Field
from wandb._pydantic import GQLResult
from .fragments import PageInfoFields, ProjectTriggersFields
class GetEntityAutomationsLegacy(GQLResult):
scope: GetEntityAutomationsL... | 34 | 943 |
lemur | lemur/pending_certificates/schemas.py | .py | from marshmallow import fields, validates_schema, post_load
from marshmallow.exceptions import ValidationError
from lemur.authorities.schemas import AuthorityNestedOutputSchema
from lemur.certificates.schemas import CertificateNestedOutputSchema
from lemur.common import utils, validators
from lemur.common.schema impor... | 142 | 5,259 |
readthedocs.org | readthedocs/builds/reporting.py | .py | from dataclasses import dataclass
from django.conf import settings
from django.template.loader import render_to_string
from readthedocs.builds.models import Build
from readthedocs.filetreediff import get_diff
from readthedocs.filetreediff.dataclasses import FileTreeDiff
@dataclass
class BuildOverview:
content: ... | 55 | 1,554 |
mlflow | tests/langchain/sample_code/chain.py | .py | import dbutils
dbutils.library.restartPython()
import os
from typing import Any
# `databricks-langchain` versions older than ~0.9 eagerly construct a
# `WorkspaceClient` inside `ChatDatabricks.__init__`, which requires
# Databricks credentials. Cross-version test jobs pin those older releases
# (e.g. 0.8.2 with `lan... | 90 | 3,071 |
sqlmap | tests/test_esperanto.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
Regression suite for the DBMS-agnostic engine (extra/esperanto/), in two parts:
1. Semantic corpus - round-trips awkward values through an in-memory SQLite bo... | 1,096 | 54,697 |
probability | tensorflow_probability/python/experimental/mcmc/particle_filter_augmentation.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... | 227 | 9,626 |
probability | tensorflow_probability/python/distributions/logitnormal.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... | 555 | 23,205 |
saleor | saleor/tests/e2e/shipping_zone/utils/shipping_method_channel_listing.py | .py | from ...utils import get_graphql_content
SHIPPING_METHOD_CHANNEL_LISTING_MUTATION = """
mutation ShippingMethodChannelListingUpdate(
$id: ID!, $input: ShippingMethodChannelListingInput!
) {
shippingMethodChannelListingUpdate(id: $id, input: $input) {
errors {
field
code
message
}
sh... | 65 | 1,646 |
cvxpy | cvxpy/tests/test_domain.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... | 193 | 7,205 |
confluent-kafka-python | examples/share_consumer.py | .py | #!/usr/bin/env python
#
# Copyright 2026 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 85 | 3,078 |
saleor | saleor/plugins/sendgrid/tests/test_tasks.py | .py | from dataclasses import asdict
from unittest.mock import Mock, patch
import pytest
from ....account import CustomerEvents
from ....account.models import CustomerEvent
from ....account.notifications import get_default_user_payload
from ....giftcard import GiftCardEvents
from ....giftcard.models import GiftCardEvent
fr... | 951 | 29,270 |
readthedocs.org | readthedocs/rtd_tests/tests/test_views.py | .py | import csv
from unittest import mock
from urllib.parse import urlsplit
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import timezone
from django_dynamic_fixture import get, new
from readthedocs.builds.constants import ... | 303 | 10,919 |
mlflow | tests/store/model_registry/test_databricks_workspace_model_registry_store.py | .py | from unittest import mock
import pytest
from mlflow.entities.model_registry import ModelVersion, ModelVersionTag
from mlflow.exceptions import MlflowException
from mlflow.store.model_registry.databricks_workspace_model_registry_rest_store import (
DatabricksWorkspaceModelRegistryRestStore,
_extract_workspace_... | 395 | 15,014 |
pyomo | pyomo/solvers/tests/models/LP_trivial_constraints.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... | 147 | 5,426 |
biopython | Tests/test_BioSQL_psycopg2.py | .py | # This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Run BioSQL tests using PostgreSQL."""
import unittest
# Really do want "import *" to get all the test classes:
from common_BioSQL import * # noqa... | 27 | 805 |
astropy | astropy/utils/compat/numpycompat.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is a collection of monkey patches and workarounds for bugs in
earlier versions of Numpy.
"""
import warnings
import numpy as np
from astropy.utils import minversion
from astropy.utils.exceptions import (
AstropyDeprecationWarning,
Astro... | 92 | 3,088 |
openvino | tests/layer_tests/pytorch_tests/test_scaled_dot_product_attention.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from pytorch_layer_test_class import PytorchLayerTest
class TestScaledDotProductAttention(PytorchLayerTest):
def _prepare_input(self, dtype):
return (self.random.randn(1, 2, 8, 4, dtype=dty... | 142 | 7,216 |
python-prompt-toolkit | src/prompt_toolkit/key_binding/bindings/cpr.py | .py | from __future__ import annotations
from prompt_toolkit.key_binding.key_processor import KeyPressEvent
from prompt_toolkit.keys import Keys
from ..key_bindings import KeyBindings
__all__ = [
"load_cpr_bindings",
]
E = KeyPressEvent
def load_cpr_bindings() -> KeyBindings:
key_bindings = KeyBindings()
@... | 31 | 786 |
sqlmap | tests/test_deps.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Optional-dependency probe (lib/utils/deps.py, the --dependencies feature).
checkDependencies() attempts to import every supported DBMS driver and warns
on the ones missing; it must ne... | 117 | 3,899 |
pyomo | pyomo/contrib/solver/plugins.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 61 | 2,448 |
astropy | astropy/coordinates/builtin_frames/intermediate_rotation_transforms.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains the transformation functions for getting to/from ITRS, TEME, GCRS, and CIRS.
These are distinct from the ICRS and AltAz functions because they are just
rotations without aberration corrections or offsets.
"""
import erfa
import numpy as np
f... | 305 | 11,778 |
beam | sdks/python/apache_beam/examples/cookbook/custom_ptransform_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... | 61 | 2,022 |
cvxpy | cvxpy/atoms/mixed_norm.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... | 45 | 1,272 |
beam | sdks/python/apache_beam/ml/rag/embeddings/huggingface.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... | 198 | 7,805 |
astropy | astropy/units/format/vounit.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles the "VOUnit" unit format.
"""
import re
import warnings
from re import Pattern
from typing import ClassVar, Literal
import numpy as np
from astropy.extern.ply.lex import LexToken
from astropy.units.core import (
CompositeUnit,
NamedU... | 223 | 8,093 |
sphinx | tests/test_extensions/test_ext_autosectionlabel.py | .py | """Test sphinx.ext.autosectionlabel extension."""
from __future__ import annotations
import re
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from sphinx.testing.util import SphinxTestApp
@pytest.mark.sphinx('html', testroot='ext-autosectionlabel')
def test_autosectionlabel_html(app: SphinxT... | 108 | 3,457 |
cvxpy | cvxpy/tests/test_curvature.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... | 85 | 3,491 |
jupytext | tests/data/notebooks/outputs/ipynb_to_hydrogen/Notebook with html and latex cells.py | .py | # ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
%%html
<p><a href="https://github.com/mwouts/jupytext", style="color: rgb(0,0,255)">Jupytext</a> on GitHub</p>
# %%
%%latex
$\frac{\pi}{2}$
# %%
%load_ext rpy2.ipython
# %%
%%R
library(ggplot2)
ggplot... | 29 | 497 |
mlflow | mlflow/gateway/base_models.py | .py | from typing import Any
from pydantic import BaseModel
class RequestModel(
BaseModel,
# Allow extra fields for pydantic request models, e.g. to support
# vendor-specific embeddings parameters
extra="allow",
):
"""
A pydantic model representing Gateway request data, such as a chat or completion... | 61 | 1,572 |
mlflow | mlflow/models/evaluation/__init__.py | .py | from mlflow.data.evaluation_dataset import EvaluationDataset
from mlflow.models.evaluation.base import (
EvaluationArtifact,
EvaluationMetric,
EvaluationResult,
ModelEvaluator,
evaluate,
list_evaluators,
make_metric,
)
from mlflow.models.evaluation.validation import MetricThreshold
__all__ ... | 24 | 528 |
wandb | wandb/sdk/interface/summary_record.py | .py | """Summary Record.
This module implements a summary record as an intermediate format before being converted
to a protocol buffer.
"""
from __future__ import annotations
import typing as t
class SummaryRecord:
"""Encodes a diff -- analogous to the SummaryRecord protobuf message."""
update: list[SummaryItem... | 70 | 1,703 |
biopython | Tests/test_AlignIO_convert.py | .py | # Copyright 2009 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.
"""Unit tests for Bio.SeqIO.convert(...) function."""
import unittest
from io import StringIO
fr... | 95 | 3,588 |
pyomo | pyomo/network/foqus_graph.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... | 936 | 34,794 |
wagtail | wagtail/snippets/tests/test_workflows.py | .py | import datetime
from django.conf import settings
from django.contrib.admin.utils import quote
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import timezon... | 528 | 19,428 |
openvino | tests/layer_tests/pytorch_tests/test_unary_ops.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
import torch.nn.functional as F
from pytorch_layer_test_class import PytorchLayerTest, skip_if_export
OPS = {
"aten::abs": torch.abs,
"aten::abs_": torch.abs_,
"aten::rsqrt": torch.rsqrt,
"ate... | 328 | 12,915 |
mkdocs-material | material/plugins/projects/config.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... | 65 | 2,480 |
conda | conda/plugins/prefix_data_loaders/pypi/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Reads PyPI packages in a conda prefix that have been installed with non-conda tools."""
from __future__ import annotations
import sys
import traceback
from logging import getLogger
from pathlib import Path
from typing import TYPE_CHECKING
... | 151 | 6,029 |
colorama | demos/demo04.py | .py | #!/usr/bin/python
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
# check that stripped ANSI in redirected stderr does not affect stdout
import sys
import fixpath
from colorama import init, Fore
init()
print(Fore.GREEN + 'GREEN set on stdout. ', end='')
print(Fore.RED + 'RED redirected stde... | 13 | 438 |
beam | sdks/python/apache_beam/testing/benchmarks/inference/pytorch_language_modeling_benchmarks.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... | 43 | 1,665 |
saleor | saleor/order/tests/test_calculations.py | .py | import dataclasses
from decimal import Decimal
from typing import Literal
from unittest.mock import Mock, patch, sentinel
import pytest
from django.test import override_settings
from prices import Money, TaxedMoney
from promise import Promise
from ...core.prices import quantize_price
from ...core.taxes import (
T... | 1,998 | 69,725 |
astropy | scripts/update-credits.py | .py | # /// script
# requires-python = ">=3.11"
# dependencies = []
# ///
import re
import subprocess
import sys
import unicodedata
MAIN_SECTION = """
Core Package Contributors
=========================
"""
OTHER_SECTION = """
Other Credits
=============
"""
# These manual additions are for people who contributed code at ... | 107 | 2,606 |
hydra | tests/test_plugin_interface.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import sys
import types
from typing import List, Sequence, Type
from omegaconf import DictConfig, OmegaConf
from pytest import MonkeyPatch, mark, raises
from hydra.core.config_search_path import ConfigSearchPath
from hydra.core.plugins import Plug... | 107 | 3,523 |
mlflow | tests/langchain/test_langchain_databricks_integration.py | .py | # Test integration with the `databricks-langchain` package.
from typing import Generator
from unittest import mock
import langchain
import pytest
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import PromptTemplate
from openai.types.chat.chat_completion import ChatCompletion
from... | 79 | 2,482 |
textual | tests/test_slug.py | .py | import pytest
from textual._slug import TrackedSlugs, slug, slug_for_tcss_id
from textual.dom import check_identifiers
@pytest.mark.xdist_group("group1")
@pytest.mark.parametrize(
"text, expected",
[
("test", "test"),
("Test", "test"),
(" Test ", "test"),
("-test-", "-test-"),... | 89 | 2,605 |
gunicorn | tests/requests/valid/006.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/get_no_headers_no_body/world"),
"version": (1, 1),
"headers": [],
"body": b""
}
| 12 | 248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.