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/tests/e2e/orders/test_unable_to_void_order_without_payment.py | .py | import pytest
from .. import DEFAULT_ADDRESS
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 (
draft_order_complete,
draft_order_create,
draft_order_update,
order_lines_c... | 105 | 2,964 |
pyro | tests/test_generic.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
from pyroapi.testing import MODELS
from pyro.generic import handlers, infer, ops, pyro, pyro_backend
from tests.common import xfail_if_not_implemented
pytestmark = pytest.mark.stage("unit")
@pytest.mark.filterwarn... | 94 | 3,354 |
metrics | src/torchmetrics/text/infolm.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... | 268 | 10,949 |
astropy | astropy/io/fits/column.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import copy
import math
import numbers
import re
import sys
import warnings
import weakref
from collections import OrderedDict
from contextlib import suppress
from itertools import pairwise
from textwrap import indent
import numpy as np
from astropy.util... | 2,865 | 104,848 |
pyomo | pyomo/common/backports.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... | 13 | 697 |
coremltools | coremltools/converters/mil/mil/ops/tests/iOS14/test_conv.py | .py | # Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import itertools
import numpy as np
import pytest
import coremltools as ct
from coremltools._deps i... | 1,016 | 34,245 |
luigi | test/contrib/dropbox_test.py | .py | import bz2
import os
import tempfile
import unittest
import uuid
from datetime import datetime
import pytest
import luigi
from luigi.format import NopFormat
try:
import dropbox
import dropbox.exceptions
from luigi.contrib.dropbox import DropboxClient
except ImportError:
raise unittest.SkipTest("Drop... | 361 | 16,498 |
coremltools | deps/protobuf/python/google/protobuf/internal/text_format_test.py | .py | # -*- coding: utf-8 -*-
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | 2,429 | 97,367 |
conda | conda/common/_logic.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import sys
from array import array
from itertools import combinations
from logging import DEBUG, getLogger
from .constants import TRACE
log = getLogger(__name__)
TRUE = sys.maxsize
FALSE = -TRUE
class _ClauseList:
"""Storage for the CN... | 782 | 27,442 |
ipython | examples/IPython Kernel/gui/gui-qt.py | .py | #!/usr/bin/env python
"""Simple Qt4 example to manually test event loop integration.
This is meant to run tests manually in ipython as:
In [5]: %gui qt
In [6]: %run gui-qt.py
Ref: Modified from http://zetcode.com/tutorials/pyqt4/firstprograms/
"""
from PyQt4 import QtGui, QtCore
class SimpleWindow(QtGui.QWidget):... | 41 | 1,009 |
readthedocs.org | readthedocs/embed/v3/views.py | .py | """Views for the EmbedAPI v3 app."""
import re
import urllib.parse
from urllib.parse import urlparse
import requests
import structlog
from django.conf import settings
from django.core.cache import cache
from rest_framework import status
from rest_framework.renderers import BrowsableAPIRenderer
from rest_framework.ren... | 417 | 16,135 |
mlflow | mlflow/genai/scorers/ragas/scorers/rag_metrics.py | .py | from __future__ import annotations
from typing import ClassVar
from ragas.embeddings.base import Embeddings
from mlflow.genai.judges.builtin import _MODEL_API_DOC
from mlflow.genai.scorers.ragas import RagasScorer
from mlflow.utils.annotations import experimental
from mlflow.utils.docstring_utils import format_docst... | 250 | 6,776 |
saleor | saleor/graphql/attribute/tests/queries/test_attribute_filter.py | .py | from unittest import mock
import graphene
import pytest
from .....attribute.models import Attribute
from .....attribute.utils import associate_attribute_values_to_instance
from .....product import ProductTypeKind
from .....product.models import Product, ProductChannelListing, ProductType
from ....tests.utils import g... | 1,287 | 38,604 |
onnxruntime | onnxruntime/test/testdata/scan_mul.py | .py | from onnx import TensorProto, checker, helper, save, shape_inference
# Scan body: y_t = x_t * 2.0
scan_body = helper.make_graph(
nodes=[
helper.make_node(
"Mul",
inputs=["x_t", "ConstTwo"],
outputs=["y_t"],
name="mul_0",
),
],
name="scan_body"... | 52 | 1,300 |
textual | docs/examples/themes/muted_backgrounds.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Label
COLORS = ("primary", "secondary", "accent", "warning", "error", "success")
class MutedBackgrounds(App[None]):
CSS = "\n".join(
f".text-{color} {{padding: 0 1; color: $text-{color}; background: ${color}-muted;}}"
for colo... | 21 | 561 |
onnxruntime | onnxruntime/test/run_benchmark.py | .py | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import annotations
import argparse
import dataclasses
import json
import pathlib
import subprocess
import sys
import tempfile
def warn(message: str):
print(f"WARNING: {message}",... | 202 | 5,708 |
onnx | onnx/backend/test/case/node/ai_onnx_ml/tree_ensemble.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 TreeEnsemble(Base):
@staticmeth... | 124 | 3,907 |
textual | docs/examples/tutorial/stopwatch05.py | .py | from time import monotonic
from textual.app import App, ComposeResult
from textual.containers import HorizontalGroup, VerticalScroll
from textual.reactive import reactive
from textual.widgets import Button, Digits, Footer, Header
class TimeDisplay(Digits):
"""A widget to display elapsed time."""
start_time ... | 70 | 2,199 |
mlflow | tests/gemini/test_legacy_gemini_autolog.py | .py | # Tests for the legacy Gemini Python SDK:
# https://github.com/google-gemini/generative-ai-python
import base64
from unittest.mock import patch
import google.generativeai as genai
import pytest
from packaging.version import Version
import mlflow
from mlflow.entities.span import SpanType
from tests.tracing.helper im... | 354 | 11,180 |
gunicorn | examples/celery_alternative/tests/test_tasks.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Unit Tests for Task Workers
These tests verify the task worker logic without running Gunicorn.
They test the DirtyApp classes directly.
"""
import pytest
from examples.celery_alternative.tasks import (
Em... | 309 | 10,322 |
bazel | scripts/docs/rewriter.py | .py | # Lint as: python3
# pylint: disable=g-direct-third-party-import
# Copyright 2022 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.apa... | 145 | 4,456 |
saleor | saleor/graphql/shipping/mutations/shipping_zone_delete.py | .py | import graphene
from ....permission.enums import ShippingPermissions
from ....shipping import models
from ...core import ResolveInfo
from ...core.context import ChannelContext
from ...core.mutations import ModelDeleteMutation
from ...core.types import ShippingError
from ...plugins.dataloaders import get_plugin_manager... | 36 | 1,233 |
wagtail | wagtail/admin/api/urls.py | .py | from django.urls import path
from wagtail import hooks
from wagtail.api.v2.router import WagtailAPIRouter
from .views import PagesAdminAPIViewSet
admin_api = WagtailAPIRouter("wagtailadmin_api")
admin_api.register_endpoint("pages", PagesAdminAPIViewSet)
for fn in hooks.get_hooks("construct_admin_api"):
fn(admin... | 17 | 380 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_BinaryComparison.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
from common.utils.tf_utils import mix_array_with_several_values
rng = np.random.default_rng(23356)
class TestBinaryCompa... | 95 | 4,199 |
saleor | saleor/graphql/notifications/mutations/external_notification_trigger.py | .py | import graphene
from ....core.exceptions import PermissionDenied
from ....core.notification.mutation_handler import (
get_external_notification_payload,
send_notification,
)
from ....core.notification.validation import (
validate_and_get_channel,
validate_and_get_external_event_type,
validate_and_g... | 99 | 3,726 |
wandb | wandb/apis/reports/v2/__init__.py | .py | import wandb
try:
from wandb_workspaces.reports.v2 import * # noqa: F403
except ImportError:
wandb.termerror(
"Failed to import wandb_workspaces. To edit reports programmatically, please install it using `pip install wandb[workspaces]`."
)
| 9 | 263 |
sqlmap | plugins/dbms/mimersql/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 getPasswordHashes(self):... | 33 | 925 |
openvino | tests/layer_tests/pytorch_tests/test_sign.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from pytorch_layer_test_class import PytorchLayerTest
class TestSilu(PytorchLayerTest):
def _prepare_input(self, inp_type="mixed", out=False):
import numpy as np
inp = np.arange(0, 10).astype(np.float... | 54 | 1,661 |
sqlmap | plugins/dbms/spanner/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... | 27 | 938 |
biopython | Bio/Graphics/BasicChromosome.py | .py | # Copyright 2001, 2003 by Brad Chapman. All rights reserved.
# Revisions copyright 2011 by Peter Cock. 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 ha... | 820 | 31,526 |
pyomo | pyomo/contrib/pynumero/examples/callback/cyipopt_functor_callback.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... | 62 | 1,939 |
mlflow | mlflow/llama_index/serialize_objects.py | .py | import importlib
import inspect
import json
import logging
from typing import Any, Callable
from llama_index.core import PromptTemplate
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.schema import BaseComponent
_logger ... | 193 | 7,152 |
toolz | toolz/tests/test_curried_doctests.py | .py | import doctest
import toolz
def test_doctests():
toolz.__test__ = {}
for name, func in vars(toolz).items():
if isinstance(func, toolz.curry):
toolz.__test__[name] = func.func
assert doctest.testmod(toolz).failed == 0
del toolz.__test__
| 12 | 274 |
wagtail | wagtail/templatetags/wagtailcore_tags.py | .py | import swapper
from django import template
from django.shortcuts import resolve_url
from django.template.defaulttags import token_kwargs
from django.template.loader import render_to_string
from django.utils.encoding import force_str
from django.utils.functional import Promise
from django.utils.html import conditional_e... | 219 | 6,885 |
wandb | tests/system_tests/test_registries/test_registry_members.py | .py | from __future__ import annotations
import os
from collections.abc import Callable, Generator
from typing import TYPE_CHECKING
from pytest import fixture, mark, skip
from wandb import Api
from wandb.apis.public import Registry, Team, User
from wandb.apis.public.registries._members import MemberKind
if TYPE_CHECKING:
... | 288 | 11,283 |
pyomo | pyomo/common/env.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... | 512 | 17,630 |
onnxruntime | orttraining/orttraining/python/training/ort_triton/_lowering.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import itertools
import warnings
from collections import defaultdict
fro... | 561 | 26,270 |
lemur | lemur/notifications/schemas.py | .py | """
.. module: lemur.notifications.schemas
: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>
"""
from marshmallow import fields, post_dump
from lemur.common.schema import LemurInp... | 57 | 1,845 |
pyomo | pyomo/contrib/fme/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... | 13 | 617 |
cvxpy | cvxpy/reductions/eliminate_pwl/canonicalizers/cumsum_canon.py | .py | """
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 61 | 2,042 |
probability | tensorflow_probability/python/distributions/binomial_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... | 497 | 20,710 |
scikit-optimize | skopt/learning/tests/test_gbrt.py | .py | import numpy as np
import pytest
from scipy import stats
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.ensemble import RandomForestRegressor
from numpy.testing import assert_equal
from numpy.testing import assert_array_equal
from numpy.testing import assert_almost_equal
from skopt.learning imp... | 114 | 3,289 |
metrics | src/torchmetrics/retrieval/average_precision.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... | 161 | 6,567 |
hydra | tests/test_apps/defaults_pkg_with_dot/my_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from omegaconf import DictConfig
import hydra
@hydra.main(config_path=".", config_name="config")
def my_app(cfg: DictConfig) -> None:
print(cfg)
if __name__ == "__main__":
my_app()
| 14 | 265 |
onnx | onnx/backend/test/case/node/min.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.backend.test.case.utils import all_numeric_dtypes
class Min(Base):... | 67 | 2,044 |
beam | sdks/python/apache_beam/typehints/testing/strategies.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... | 103 | 3,725 |
sphinx | tests/test_builders/test_build_dirhtml.py | .py | """Test dirhtml builder."""
from __future__ import annotations
import posixpath
from typing import TYPE_CHECKING
import pytest
from sphinx.util.inventory import InventoryFile, _InventoryItem
if TYPE_CHECKING:
from sphinx.testing.util import SphinxTestApp
@pytest.mark.sphinx('dirhtml', testroot='builder-dirht... | 68 | 2,069 |
mlflow | tests/store/_unity_catalog/conftest.py | .py | from unittest import mock
import pytest
import mlflow
from mlflow.utils.rest_utils import MlflowHostCreds
_DATABRICKS_UC_REGISTRY_URI = "databricks-uc"
_DATABRICKS_TRACKING_URI = "databricks"
_DATABRICKS_UC_OSS_REGISTRY_URI = "uc"
_REGISTRY_HOST_CREDS = MlflowHostCreds("https://hello-registry")
_TRACKING_HOST_CREDS ... | 51 | 1,476 |
pyomo | pyomo/contrib/appsi/utils/tests/test_collect_vars_and_named_exprs.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... | 66 | 2,710 |
luigi | test/worker_keep_alive_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... | 119 | 4,245 |
saleor | saleor/core/utils/tests/test_update_mutation_manager.py | .py | from ....order import OrderStatus
from ..update_mutation_manager import InstanceTracker
def test_instance_tracker(product):
# given
fields_to_track = ["name", "slug"]
tracker = InstanceTracker(product, fields_to_track)
# when
product.name = product.name + "_updated"
modified_field = tracker.g... | 103 | 2,932 |
onnxruntime | onnxruntime/test/python/transformers/test_gqa_cpu.py | .py | # --------------------------------------------------------------------------
# Copyright 2020 The HuggingFace Inc. 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/l... | 2,752 | 94,725 |
probability | tensorflow_probability/python/bijectors/split_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... | 368 | 14,320 |
mlflow | tests/metrics/genai/prompts/test_v1.py | .py | import re
import pytest
from mlflow.metrics.genai import EvaluationExample
from mlflow.metrics.genai.prompts.v1 import EvaluationModel
def test_evaluation_model_output():
model1 = EvaluationModel(
name="correctness",
definition="Correctness refers to how well the generated output matches "
... | 267 | 11,367 |
readthedocs.org | readthedocs/organizations/tests/test_access.py | .py | import django_dynamic_fixture as fixture
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from readthedocs.invitations.models import Invitation
from readthedocs.organizations.models import Organization, OrganizationOwner, Team
from readthedocs.projects.models import Proje... | 239 | 8,563 |
onnxruntime | onnxruntime/test/python/transformers/qwen3_model_generator.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""Synt... | 454 | 19,112 |
wagtail | wagtail/admin/templatetags/wagtailuserbar.py | .py | from django import template
from wagtail.admin.userbar import Userbar
from wagtail.models import PAGE_TEMPLATE_VAR, AbstractPage
register = template.Library()
def get_page_instance(context):
"""
Given a template context, try and find a Page variable in the common
places. Returns None if a page can not b... | 43 | 1,182 |
cvxpy | cvxpy/constraints/second_order.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... | 342 | 12,061 |
coveragepy | tests/plugin_config.py | .py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt
"""A configuring plugin for test_plugins.py to import."""
from __future__ import annotations
from typing import Any, cast
import coverage
from coverage.plugin_... | 33 | 1,026 |
textual | src/textual/message.py | .py | """
The base class for all messages (including events).
"""
from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar
import rich.repr
from typing_extensions import Self
from textual import _time
from textual._context import active_message_pump
from textual.case import camel_to_snake
if TYPE_C... | 159 | 4,893 |
cvxpy | cvxpy/atoms/affine/wraps.py | .py | """
Copyright 2013 Steven Diamond, 2022 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 agree... | 179 | 4,779 |
scikit-bio | skbio/io/tests/test_iosources.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.
# --------------------------------------------... | 61 | 1,953 |
astropy | astropy/cosmology/_src/io/builtin/yaml.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
r"""|Cosmology| <-> YAML I/O, using |Cosmology.to_format| and |Cosmology.from_format|.
This module provides functions to transform a |Cosmology| object to and from a `yaml
<https://yaml.org>`_ representation. The functions are registered with
``convert_re... | 266 | 9,482 |
probability | tensorflow_probability/python/internal/empirical_statistical_testing_test.py | .py | # Copyright 2022 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 79 | 3,516 |
beam | sdks/python/apache_beam/ml/inference/model_manager_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... | 192 | 7,023 |
wandb | tests/unit_tests/test_launch/test_environment/test_aws.py | .py | import os
from unittest.mock import MagicMock
import pytest
from botocore.exceptions import ClientError
from wandb.sdk.launch.environment.aws_environment import AwsEnvironment
from wandb.sdk.launch.errors import LaunchError
def _get_environment():
return AwsEnvironment(
region="us-west-2",
secret... | 282 | 9,160 |
pyomo | pyomo/contrib/simplification/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... | 16 | 731 |
kafka | tests/kafkatest/tests/client/pluggable_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 ... | 57 | 2,516 |
biopython | Bio/codonalign/__init__.py | .py | # Copyright 2013 by Zheng Ruan (zruan1991@gmail.com). 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.
"""Code... | 809 | 30,114 |
saleor | saleor/core/tests/utils.py | .py | from django.conf import settings
from ..notification.utils import LOGO_URL
def get_site_context_payload(site):
return {
"site_name": site.name,
"domain": "example.com",
"logo_url": f"https://example.com{settings.STATIC_URL}{LOGO_URL}",
}
| 12 | 273 |
beam | playground/frontend/playground_components/test/tools/extract_symbols_python/sdk_mock/file1.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 ... | 48 | 1,234 |
saleor | saleor/graphql/account/mutations/account/confirm_email_change.py | .py | import logging
from typing import cast
import graphene
import jwt
from django.core.exceptions import ValidationError
from .....account import models, notifications, search
from .....account.error_codes import AccountErrorCode
from .....core.jwt import JWT_CONFIRM_CHANGE_EMAIL_TYPE, jwt_decode
from .....giftcard.utils... | 151 | 5,588 |
clearml | examples/services/cleanup/cleanup_service.py | .py | """
This service will delete archived experiments and their accompanying debug samples, artifacts and models
older than 30 days.
You can configure the run by changing the `args` dictionary:
- delete_threshold_days (float): The earliest day for cleanup.
Only tasks older to this will be ... | 107 | 3,889 |
qutip | qutip/visualization.py | .py | """
Functions for visualizing results of quantum dynamics simulations,
visualizations of quantum states and processes.
"""
__all__ = ['plot_wigner_sphere', 'hinton', 'sphereplot',
'matrix_histogram', 'plot_energy_levels', 'plot_fock_distribution',
'plot_wigner', 'plot_qfunc', 'plot_expectation_va... | 2,115 | 65,494 |
onnx | onnx/backend/test/case/node/matmulinteger.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
class MatMulInteger(Base):
@staticmethod
def export() -> None:
... | 61 | 1,331 |
kafka | tests/kafkatest/services/performance/consumer_performance.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 ... | 156 | 6,486 |
onnxruntime | onnxruntime/test/testdata/transform/fusion/not_where.py | .py | import onnx
from onnx import OperatorSetIdProto, TensorProto, helper
opsets = []
onnxdomain = OperatorSetIdProto()
onnxdomain.version = 12
onnxdomain.domain = "" # The empty string ("") or absence of this field implies the operator set that is defined as part of the ONNX specification.
opsets.append(onnxdomain)
msdo... | 65 | 2,409 |
pyomo | pyomo/solvers/tests/piecewise_linear/problems/concave_vararray.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... | 68 | 2,181 |
mlflow | tests/mistral/test_mistral_autolog.py | .py | from unittest.mock import patch
import httpx
import pytest
try:
from mistralai.client import Mistral # mistralai >= 2.0
from mistralai.client.models import (
AssistantMessage,
ChatCompletionChoice,
ChatCompletionResponse,
FunctionCall,
ToolCall,
UsageInfo,
... | 318 | 10,868 |
deap | examples/coev/coop_gen.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 ... | 131 | 4,762 |
wandb | wandb/sdk/wandb_settings.py | .py | from __future__ import annotations
import json
import logging
import os
import pathlib
import platform
import re
import shutil
import socket
import sys
import traceback
from collections.abc import Callable, Sequence
from datetime import datetime
from typing import Any, Literal
from urllib.parse import quote, unquote
... | 2,334 | 77,834 |
beam | sdks/python/apache_beam/runners/portability/spark_runner_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... | 190 | 6,823 |
readthedocs.org | readthedocs/domains/tests/test_querysets.py | .py | from datetime import timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
from django_dynamic_fixture import get
from readthedocs.projects.constants import (
SSL_STATUS_INVALID,
SSL_STATUS_PENDING,
SSL_STA... | 77 | 2,711 |
loguru | loguru/_handler.py | .py | import functools
import json
import multiprocessing
import os
import threading
from contextlib import contextmanager
from threading import Thread
from ._colorizer import Colorizer
from ._locks_machinery import create_handler_lock
def prepare_colored_format(format_, ansi_level):
colored = Colorizer.prepare_format... | 358 | 13,540 |
cvxpy | cvxpy/atoms/elementwise/power.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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed o... | 477 | 16,544 |
ipython | IPython/utils/module_paths.py | .py | """Utility functions for finding modules
Utility functions for finding modules on sys.path.
"""
from __future__ import annotations
#-----------------------------------------------------------------------------
# Copyright (c) 2011, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD Lic... | 80 | 2,657 |
sqlmap | tests/test_search_enum.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Unit tests for plugins/generic/search.py (Search), exercising searchDb /
searchTable / searchColumn by MOCKING the injection layer
(lib.request.inject.getValue) and the dumper.
No ne... | 586 | 22,410 |
mlflow | tests/utils/test_doctor.py | .py | from unittest import mock
import mlflow
def test_doctor(capsys):
mlflow.doctor()
captured = capsys.readouterr()
assert f"MLflow version: {mlflow.__version__}" in captured.out
def test_doctor_active_run(capsys):
with mlflow.start_run() as run:
mlflow.doctor()
captured = capsys.readou... | 28 | 780 |
sphinx | sphinx/util/matching.py | .py | """Pattern-matching utility functions for Sphinx."""
from __future__ import annotations
import os.path
import re
import unicodedata
from pathlib import Path
from typing import TYPE_CHECKING
from sphinx.util.osutil import canon_path
if TYPE_CHECKING:
from collections.abc import Callable, Iterable, Iterator
def... | 179 | 5,593 |
hatch | backend/src/hatchling/version/source/code.py | .py | from __future__ import annotations
import os
from hatchling.version.source.plugin.interface import VersionSourceInterface
class CodeSource(VersionSourceInterface):
PLUGIN_NAME = "code"
def get_version_data(self) -> dict:
import sys
from importlib.util import module_from_spec, spec_from_file... | 65 | 2,348 |
wandb | wandb/sdk/lib/timed_input.py | .py | """timed_input: add a timeout to standard input.
Approach was inspired by: https://github.com/johejo/inputimeout
"""
import sys
import threading
import wandb
SP = " "
CR = "\r"
LF = "\n"
CRLF = CR + LF
def _echo(prompt: str, *, err: bool) -> None:
stream = sys.stderr if err else sys.stdout
stream.write(pr... | 141 | 3,508 |
wagtail | wagtail/users/views/bulk_actions/delete.py | .py | from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext
from wagtail.admin.views.bulk_action.mixins import ReferenceIndexMixin
from wagtail.users.utils import user_can_delete_user
from wagtail.users.views.bulk_actions.user_bulk_action import ... | 43 | 1,554 |
saleor | saleor/graphql/shipping/tests/mutations/test_shipping_price_delete.py | .py | import json
from unittest import mock
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....core.utils.json_serializer import CustomJsonEncoder
from .....webhook.event_types import WebhookEventAsyncType
from .....webhook.payloads import generate_meta, generat... | 106 | 3,047 |
coremltools | coremltools/test/neural_network/test_tf_numeric.py | .py | # Copyright (c) 2017, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import itertools
import unittest
import numpy as np
import pytest
import coremltools.models.datatypes ... | 515 | 19,569 |
django-cms | cms/cms_plugins.py | .py | from django.utils.translation import gettext_lazy as _
from cms.models.placeholderpluginmodel import PlaceholderReference
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
class PlaceholderPlugin(CMSPluginBase):
name = _("Placeholder")
parent_classes = ['0'] # so you will not... | 20 | 530 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import inspect
import logging
import typing
import torch
from openvino.frontend.pytorch.py_pytorch_frontend import (
_FrontEndPytorchDecoder as Decoder,
_Type as DecoderType
)
from ... | 665 | 29,637 |
wandb | wandb/sdk/artifacts/artifact_ttl.py | .py | """Artifact TTL."""
from __future__ import annotations
from enum import Enum
class ArtifactTTL(Enum):
INHERIT = 0
| 10 | 122 |
sqlmap | thirdparty/identywaf/__init__.py | .py | #!/usr/bin/env python
#
# Copyright (c) 2019-2021 Miroslav Stampar (@stamparm), MIT
# See the file 'LICENSE' for copying permission
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
pass
| 10 | 270 |
cvxpy | cvxpy/expressions/variable.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... | 133 | 4,755 |
astropy | astropy/io/fits/tests/test_fitsheader.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy import __version__ as version
from astropy.io import fits
from astropy.io.fits.scripts import fitsheader
from .conftest import FitsTestCase
class TestFITSheader_script(FitsTestCase):
def test_help(self):
with pyt... | 248 | 8,807 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.