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/css/test_mega_stylesheet.py | .py | from pathlib import Path
from textual.css.stylesheet import Stylesheet
def test_mega_stylesheet() -> None:
"""It should be possible to load a known-good stylesheet."""
mega_stylesheet = Stylesheet()
mega_stylesheet.read(Path(__file__).parent / "test_mega_stylesheet.tcss")
mega_stylesheet.parse()
... | 12 | 381 |
wagtail | wagtail/documents/permissions.py | .py | import warnings
from wagtail.documents import get_document_model, get_permission_policy
from wagtail.permissions import policy_registry
from wagtail.utils.deprecation import RemovedInWagtail90Warning
warnings.warn(
"wagtail.documents.permissions.permission_policy is deprecated. "
"Use wagtail.permissions.poli... | 25 | 1,011 |
jupytext | tests/data/notebooks/outputs/ipynb_to_percent/jupyter_with_raw_cell_in_body.py | .py | # ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
1+2+3
# %% [raw]
# This is a raw cell
# %% [markdown]
# This is a markdown cell
| 17 | 199 |
python-dotenv | tests/test_parser.py | .py | import io
import pytest
from dotenv.parser import Binding, Original, parse_stream
@pytest.mark.parametrize(
"test_input,expected",
[
("", []),
(
"a=b",
[
Binding(
key="a",
value="b",
original=... | 583 | 15,343 |
onnx | onnx/backend/test/case/node/adagrad.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.defs import AI_ONNX_PREVIEW_TRAINING_DOMAIN
def apply_adagrad(r, t... | 117 | 3,747 |
pyomo | pyomo/contrib/mindtpy/tests/MINLP_simple_grey_box.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... | 161 | 6,271 |
openvino | tools/benchmark_tool/openvino/tools/benchmark/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
| 4 | 83 |
scikit-bio | skbio/io/format/blast6.py | .py | r"""BLAST+6 format (:mod:`skbio.io.format.blast6`)
==============================================
.. currentmodule:: skbio.io.format.blast6
The BLAST+6 format (``blast+6``) stores the results of a BLAST [1]_ database
search. The results are stored in a simple tabular format with no column
headers. Values are separate... | 289 | 12,714 |
wagtail | wagtail/admin/tests/test_rich_text_db_html.py | .py | from django.test import SimpleTestCase
from wagtail.admin.rich_text.converters.db_html import (
DbHTMLConverter,
RichTextRemoval,
)
#: A feature set matching the ticket's default set plus entity features.
FEATURES = [
"hr",
"link",
"bold",
"italic",
"h2",
"h3",
"h4",
"ol",
... | 285 | 11,434 |
openvino | tests/layer_tests/py_frontend_tests/test_torch_decoder.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import torch
import pytest
from packaging import version
class AtenDiv(torch.nn.Module):
# aten::div can have str or NoneType constant
def __init__(self, rounding_mode):
super(AtenDiv, self).__in... | 781 | 29,543 |
pyro | pyro/infer/reparam/structured.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from contextlib import ExitStack
import pyro.distributions as dist
from pyro import poutine
from pyro.infer.autoguide.structured import AutoStructured
from pyro.poutine.plate_messenger import block_plate
from .reparam import Reparam
... | 107 | 4,312 |
saleor | saleor/graphql/meta/mutations/__init__.py | .py | from .delete_metadata import DeleteMetadata
from .delete_private_metadata import DeletePrivateMetadata
from .update_metadata import UpdateMetadata
from .update_private_metadata import UpdatePrivateMetadata
__all__ = [
"DeleteMetadata",
"DeletePrivateMetadata",
"UpdateMetadata",
"UpdatePrivateMetadata",... | 12 | 323 |
pyomo | pyomo/scripting/pyomo_command.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... | 109 | 4,280 |
biopython | Tests/test_Seq_objs.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.
"""Unittests for the Seq objects."""
import array
import unittest
import warnings
from Bio impor... | 1,841 | 86,387 |
beam | sdks/python/apache_beam/io/gcp/bigquery_io_read_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... | 74 | 2,383 |
beam | learning/tour-of-beam/learning-content/core-transforms/map/pardo-one-to-many/python-example/task.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); y... | 58 | 1,836 |
pynacl | src/nacl/bindings/crypto_kx.py | .py | # Copyright 2018 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... | 187 | 6,525 |
cvxpy | cvxpy/utilities/einsum_utilities.py | .py | """
Copied from numpy._core.einsumfunc from numpy 2.4.0. Utilities for the einsum atom.
Copyright (c) 2005-2025, NumPy Developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions ... | 646 | 21,854 |
beam | learning/tour-of-beam/learning-content/common-transforms/with-keys/python-example/task.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); y... | 52 | 1,785 |
saleor | saleor/graphql/product/tests/queries/variants_where/test_over_stock.py | .py | import datetime
import graphene
import pytest
from django.utils import timezone
from ......warehouse.models import Allocation, Reservation, Stock, Warehouse
from .....tests.utils import get_graphql_content
from .shared import PRODUCT_VARIANTS_WHERE_QUERY
@pytest.mark.parametrize(
("where", "indexes"),
[
... | 217 | 6,792 |
beam | sdks/python/apache_beam/examples/wordcount.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... | 117 | 3,674 |
pyro | tests/distributions/test_mask.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from torch import tensor
from torch.distributions import kl_divergence
from pyro.distributions.torch import Bernoulli, Normal
from pyro.distributions.util import broadcast_shape, scale_and_mask
from test... | 157 | 5,258 |
black | tests/data/cases/docstring_no_string_normalization.py | .py | # flags: --skip-string-normalization
class ALonelyClass:
'''
A multiline class docstring.
'''
def AnEquallyLonelyMethod(self):
'''
A multiline method docstring'''
pass
def one_function():
'''This is a docstring with a single line of text.'''
pass
def shockingly_the_qu... | 251 | 3,638 |
loguru | tests/test_add_option_filter.py | .py | import re
import pytest
from loguru import logger
@pytest.mark.parametrize(
"filter",
[
None,
"",
"tests",
"tests.test_add_option_filter",
(lambda r: True),
(lambda r: r["level"].name == "DEBUG"),
{},
{"": "DEBUG"},
{"tests": True},
... | 152 | 4,339 |
probability | tensorflow_probability/python/internal/backend/numpy/numpy_signal.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... | 112 | 3,420 |
openvino | tests/layer_tests/pytorch_tests/test_einsum.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from pytorch_layer_test_class import PytorchLayerTest
class TestEinsumBatchMatMul(PytorchLayerTest):
def _prepare_input(self):
return (self.random.randn(5, 2, 3), self.random.randn(5, 3, 4),)
def create_... | 92 | 2,708 |
cvxpy | cvxpy/reductions/solvers/qp_solvers/gurobi_qpif.py | .py | import numpy as np
import cvxpy.interface as intf
import cvxpy.settings as s
from cvxpy.reductions.solution import Solution, failure_solution
from cvxpy.reductions.solvers import utilities
from cvxpy.reductions.solvers.qp_solvers.qp_solver import QpSolver
from cvxpy.utilities.citations import CITATION_DICT
def const... | 252 | 8,823 |
mlflow | dev/clint/src/clint/utils.py | .py | from __future__ import annotations
import ast
import re
import subprocess
from functools import lru_cache
from pathlib import Path
@lru_cache(maxsize=1)
def get_repo_root() -> Path:
"""Find the git repository root directory with caching."""
try:
result = subprocess.check_output(["git", "rev-parse", "... | 91 | 2,796 |
tqdm | tqdm/_tqdm_pandas.py | .py | import sys
__author__ = "github.com/casperdcl"
__all__ = ['tqdm_pandas']
def tqdm_pandas(tclass, **tqdm_kwargs):
"""
Registers the given `tqdm` instance with
`pandas.core.groupby.DataFrameGroupBy.progress_apply`.
"""
from tqdm import TqdmDeprecationWarning
if isinstance(tclass, type) or (get... | 25 | 888 |
readthedocs.org | readthedocs/storage/__init__.py | .py | """
Provides lazy loaded storage instances for use throughout Read the Docs.
For static files storage, use django.contrib.staticfiles.storage.staticfiles_storage.
Some storage backends (notably S3) have a slow instantiation time
so doing those upfront improves performance.
"""
from django.core.files.storage import st... | 37 | 1,072 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_Shape.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 TestShape(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
assert 'input:0' in inputs_info
... | 104 | 4,547 |
metrics | src/torchmetrics/wrappers/abstract.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... | 43 | 1,855 |
textual | src/textual/layouts/stream.py | .py | from __future__ import annotations
from itertools import zip_longest
from typing import TYPE_CHECKING
from textual.geometry import NULL_OFFSET, Region, Size
from textual.layout import ArrangeResult, Layout, WidgetPlacement
if TYPE_CHECKING:
from textual.widget import Widget
class StreamLayout(Layout):
"""A... | 150 | 5,169 |
beam | sdks/python/apache_beam/io/filebasedsink_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 "L... | 405 | 14,584 |
hydra | tests/test_apps/custom_env_defaults/my_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import os
from omegaconf import DictConfig
import hydra
log = logging.getLogger(__name__)
@hydra.main()
def my_app(_: DictConfig) -> None:
assert os.getenv("FOO") == "bar"
if __name__ == "__main__":
my_app()
| 19 | 309 |
pyomo | pyomo/contrib/gdpopt/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... | 19 | 837 |
probability | spinoffs/inference_gym/inference_gym/internal/datasets/synthetic_plasma_spectroscopy_with_bump.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... | 557 | 9,359 |
textual | docs/examples/tutorial/stopwatch01.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Footer, Header
class StopwatchApp(App):
"""A Textual app to manage stopwatches."""
BINDINGS = [("d", "toggle_dark", "Toggle dark mode")]
def compose(self) -> ComposeResult:
"""Create child widgets for the app."""
yiel... | 25 | 624 |
kafka | tests/kafkatest/tests/core/log_dir_failure_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 ... | 185 | 10,795 |
mlflow | mlflow/tracing/otel/translation/gemini_cli.py | .py | """
Translator for Gemini CLI OTEL spans.
Gemini CLI (google-gemini/gemini-cli) emits OTLP traces using `gen_ai.operation.name`
for span kind (same key as the GenAI semantic conventions), but with its own operation
names that don't match the standard GenAI values. This translator maps those
Gemini-specific names to M... | 157 | 6,446 |
readthedocs.org | readthedocs/doc_builder/backends/sphinx.py | .py | """
Sphinx_ backend for building docs.
.. _Sphinx: http://www.sphinx-doc.org/
"""
import itertools
import os
from glob import glob
from pathlib import Path
import structlog
from readthedocs.doc_builder.python_environments import UvEnv
from readthedocs.projects.constants import OLD_LANGUAGES_CODE_MAPPING
from readth... | 468 | 16,615 |
hatch | tests/cli/config/test_set.py | .py | def test_standard(hatch, config_file, helpers):
result = hatch("config", "set", "project", "foo")
assert result.exit_code == 0, result.output
assert result.output == helpers.dedent(
"""
New setting:
project = "foo"
"""
)
config_file.load()
assert config_file.mod... | 252 | 6,516 |
conda | conda/gateways/logging.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Configure logging for conda."""
import logging
import sys
from datetime import datetime, timezone
from functools import cache
from logging import (
DEBUG,
INFO,
WARNING,
Filter,
Formatter,
StreamHandler,
getLogger... | 208 | 7,076 |
beam | sdks/python/apache_beam/testing/load_tests/dataflow_cost_benchmark.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... | 462 | 18,000 |
readthedocs.org | readthedocs/notifications/messages.py | .py | import copy
import textwrap
import structlog
from django.template import Context
from django.template import Template
from django.utils.translation import gettext_noop as _
from readthedocs.core.context_processors import readthedocs_processor
from readthedocs.doc_builder.exceptions import BuildAppError
from readthedo... | 590 | 20,275 |
cvxpy | cvxpy/reductions/cvx_attr2constr.py | .py | """
Copyright 2017 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... | 385 | 15,857 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupby_expr_aggregate.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");... | 70 | 2,263 |
loguru | tests/exceptions/source/backtrace/raising_recursion.py | .py | import sys
from loguru import logger
logger.remove()
logger.add(sys.stderr, format="", colorize=False, backtrace=True, diagnose=False)
@logger.catch
def a(n):
if n:
a(n - 1)
n / 0
def b(n):
with logger.catch():
if n:
b(n - 1)
n / 0
def c(n):
try:
if n:... | 43 | 464 |
pyomo | pyomo/contrib/pynumero/interfaces/tests/test_external_asl_function.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... | 51 | 2,095 |
gunicorn | tests/test_gthread.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for the gthread worker."""
import errno
import fcntl
import os
import selectors
import threading
import time
from collections import deque
from concurrent import futures
from unittest import mock
import ... | 1,779 | 56,503 |
astropy | astropy/utils/tests/test_codegen.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
import traceback
import pytest
from astropy.utils.codegen import make_function_with_signature
def test_make_function_with_signature_lineno():
"""
Tests that a function made with ``make_function_with_signature`` is give
the corre... | 41 | 1,321 |
textual | tests/snapshot_tests/snapshot_apps/columns_height.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Static
class HeightApp(App[None]):
CSS = """
Horizontal {
border: solid red;
height: auto;
}
Static {
border: solid green;
width: auto;
}
#fill_pa... | 38 | 719 |
astropy | astropy/visualization/tests/test_norm.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy import ma
from numpy.testing import assert_allclose, assert_array_equal, assert_equal
from astropy.utils.compat.optional_deps import HAS_PLT
from astropy.visualization.interval import ManualInterval, Percentile... | 395 | 14,127 |
openvino | tests/layer_tests/onnx_tests/test_log.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136")
from common.layer_test_class import check_ir_version
from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model
fro... | 199 | 7,097 |
saleor | saleor/graphql/page/mutations/page_delete.py | .py | import graphene
from django.db.models.expressions import Exists, OuterRef
from ....attribute import AttributeInputType
from ....attribute import models as attribute_models
from ....core.tracing import traced_atomic_transaction
from ....page import models
from ....permission.enums import PagePermissions
from ....produc... | 77 | 2,952 |
onnx | onnx/backend/test/case/node/col2im.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 Col2Im(Base):
"""Col2Im operator with N-dimension support
The... | 350 | 11,069 |
textual | src/textual/widgets/text_area.py | .py | from textual._text_area_theme import TextAreaTheme
from textual.document._document import (
Document,
DocumentBase,
EditResult,
Location,
Selection,
)
from textual.document._document_navigator import DocumentNavigator
from textual.document._edit import Edit
from textual.document._history import Edit... | 44 | 1,025 |
jupyterlab | conftest.py | .py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from _pytest.config import Config
from _pytest.config.argparsing import Parser
from _pytest.nodes impor... | 48 | 1,392 |
mlflow | tests/resources/example_project/tracking_test.py | .py | import sys
import mlflow
def call_tracking_apis():
mlflow.log_metric("some_key", 3)
def main(use_start_run):
if use_start_run:
with mlflow.start_run():
call_tracking_apis()
else:
call_tracking_apis()
if __name__ == "__main__":
main(use_start_run=int(sys.argv[1]))
| 20 | 315 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_MinMax.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
# Testing Min, Max operations (Initial Implementation)
# Documentation: https://www.tensorflow.org/api_docs/python/tf/raw_ops/Min
# ... | 64 | 2,342 |
openvino | docs/articles_en/assets/snippets/compile_model_cpu.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from snippets import get_model
def main():
model = get_model()
#! [compile_model_default]
import openvino as ov
core = ov.Core()
compiled_model = core.compile_model(model, "CPU")
#! [compile_model_default]
... | 29 | 739 |
readthedocs.org | readthedocs/core/logs.py | .py | import sys
import warnings
from io import StringIO
import structlog
from django_structlog.middlewares.request import RequestMiddleware
from structlog.dev import _pad
from structlog.dev import plain_traceback
from structlog.processors import _figure_out_exc_info
class ReadTheDocsRequestMiddleware(RequestMiddleware):
... | 228 | 7,274 |
rq | tests/test_job_dependency.py | .py | import time
from datetime import timedelta
from unittest import mock
from redis import WatchError
from rq.connections import get_connection_kwargs
from rq.job import Dependency, Job, JobStatus, cancel_job
from rq.queue import Queue
from rq.registry import (
CanceledJobRegistry,
)
from rq.serializers import JSONSe... | 591 | 28,536 |
black | tests/optional.py | .py | """
Allows configuring optional test markers in config, see pyproject.toml.
Run optional tests with `pytest --run-optional=...`.
Mark tests to run only if an optional test ISN'T selected by prepending the mark with
"no_".
You can specify a "no_" prefix straight in config, in which case you can mark tests
to run when... | 134 | 4,700 |
saleor | saleor/graphql/discount/filters.py | .py | import decimal
import django_filters
from django.db.models import Exists, OuterRef, Q, Sum
from django.utils import timezone
from ...discount import DiscountValueType
from ...discount.models import (
Promotion,
PromotionRule,
Voucher,
VoucherCode,
VoucherQueryset,
)
from ..core.doc_category import... | 248 | 7,826 |
biopython | Scripts/PDB/hsexpo.py | .py | #!/usr/bin/python
# Copyright (C) 2002, Thomas Hamelryck (thamelry@vub.ac.be)
# 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.
"""Calculates solvent exposure for a PDB file using one of 5 different m... | 149 | 3,764 |
biopython | Bio/Blast/NCBIXML.py | .py | # Copyright 1999-2000 by Jeffrey Chang. All rights reserved.
# Copyright 2000 by Bertrand Frottier. All rights reserved.
# Revisions 2005-2006 copyright Michiel de Hoon
# Revisions 2006-2009 copyright Peter Cock
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython Licens... | 1,332 | 49,592 |
pyro | tests/contrib/tracking/test_hashing.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import logging
import pytest
import torch
from pyro.contrib.tracking.hashing import LSH, ApproxSet, merge_points
from tests.common import assert_equal
logger = logging.getLogger(__name__)
@pytest.mark.parametrize("scale", [-1.... | 159 | 4,601 |
pyomo | examples/pyomobook/pyomo-components-ch/var_declaration.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... | 172 | 3,824 |
pymc | tests/step_methods/hmc/test_nuts.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... | 231 | 7,721 |
pyomo | examples/gdp/small_lit/nonconvex_HEN.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... | 139 | 4,480 |
eve | tests/methods/ratelimit.py | .py | import time
from tests import TestBase
class TestRateLimit(TestBase):
def setUp(self):
super().setUp()
try:
from redis import ConnectionError, Redis
self.app.redis = Redis()
try:
self.app.redis.flushdb()
except ConnectionError:
... | 69 | 2,271 |
cvxpy | cvxpy/reductions/solvers/qp_solvers/proxqp_qpif.py | .py | """
Copyright 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 agreed to in writing, sof... | 208 | 7,319 |
mlflow | tests/resources/example_project/greeter.py | .py | """
Example program helping verify functionality for passing parameters other than those required in
the MLproject file.
"""
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("greeting", help="Greeting to use", type=str)
parser.add_argument("name", help="Nam... | 18 | 646 |
onnxruntime | onnxruntime/python/tools/quantization/base_quantizer.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import log... | 531 | 25,765 |
clearml | clearml/utilities/version.py | .py | from __future__ import absolute_import, division, print_function
import re
from copy import deepcopy
from typing import Callable, Union, List, Optional, Tuple, Any
from attr import attrs, attrib
from math import inf
class InvalidVersion(ValueError):
"""
An invalid version was found, users should refer to PEP... | 338 | 11,229 |
hydra | plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/ray_launcher.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Any, Optional, Sequence, cast
from hydra.core.utils import JobReturn
from hydra.plugins.launcher import Launcher
from hydra.types import HydraContext, TaskFunction
from omegaconf import DictConfig
class RayLauncher(Launcher):
... | 38 | 1,147 |
rq | rq/cli/cli_cron.py | .py | import logging
import logging.config
import sys
import click
from rq.cli.cli import main
from rq.cli.helpers import (
pass_cli_config,
read_config_file,
# setup_loghandlers_from_args is not used when only --logging-level is present
)
from rq.cron import CronScheduler
@main.command()
@click.option(
'... | 54 | 1,534 |
gunicorn | tests/requests/invalid/006.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.http.errors import LimitRequestLine
request = LimitRequestLine
| 7 | 183 |
cvxpy | cvxpy/reductions/solvers/nlp_solvers/uno_nlpif.py | .py | """
Copyright 2025, the CVXPY developers
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... | 302 | 11,103 |
conda | conda/plugins/virtual_packages/archspec.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Detect archspec name."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ...auxlib import NULL
from .. import hookimpl
from ..types import CondaVirtualPackage
if TYPE_CHECKING:
from collections.abc import Iter... | 34 | 782 |
pyomo | pyomo/core/beta/list_objects.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... | 261 | 9,956 |
pyomo | pyomo/opt/base/formats.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... | 93 | 3,119 |
pyomo | pyomo/devel/initialization/bounds/bound_variables.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... | 37 | 1,582 |
mlflow | mlflow/entities/model_registry/model_version.py | .py | from mlflow.entities.logged_model_parameter import LoggedModelParameter as ModelParam
from mlflow.entities.metric import Metric
from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.entities.model_registry.model_version_deployment_job_state import (
ModelVersionDeploymen... | 254 | 9,548 |
onnxruntime | orttraining/tools/scripts/model_transform.py | .py | from __future__ import annotations
import sys
import numpy as np
import onnx
from onnx import numpy_helper
if len(sys.argv) < 2:
print("Please give model path...")
exit(1)
input_model_name = sys.argv[1]
output_model_name = input_model_name[:-5] + "_optimized.onnx"
model = onnx.load(input_model_name)
def ... | 328 | 11,556 |
wagtail | wagtail/contrib/forms/tests/test_models.py | .py | from django.core import mail
from django.core.exceptions import ValidationError
from django.test import TestCase, override_settings
from wagtail.contrib.forms.models import FormSubmission
from wagtail.contrib.forms.tests.utils import (
make_form_page,
make_form_page_with_custom_submission,
make_form_page_w... | 918 | 32,990 |
beam | sdks/python/apache_beam/internal/test_data/module_1_class_added.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... | 35 | 1,153 |
wagtail | wagtail/admin/tests/api/test_renderer_classes.py | .py | import json
from unittest.mock import patch
from django.test import TestCase
from django.urls import reverse
from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer
from wagtail.admin.api.views import PagesAdminAPIViewSet
from wagtail.test.numberformat import ignore_numberformat
from wagtail.test.util... | 78 | 3,209 |
pyomo | pyomo/contrib/viewer/pyomo_qtapp.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... | 107 | 4,534 |
pyro | pyro/ops/provenance.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from functools import partial, singledispatch
from typing import Tuple, TypeVar
import torch
from torch.utils._pytree import tree_flatten, tree_map, tree_unflatten
_Tensor = TypeVar("_Tensor", bound=torch.Tensor)
class ProvenanceTe... | 175 | 5,765 |
textual | tests/snapshot_tests/snapshot_apps/scrollbar_thumb_height.py | .py | from rich.segment import Segment
from textual.app import App, ComposeResult
from textual.widgets import Header, Footer
from textual.scroll_view import ScrollView
from textual.strip import Strip
from textual.geometry import Size
class TestScrollView(ScrollView, can_focus=True):
def __init__(self, height: int, bor... | 45 | 1,151 |
cvxpy | cvxpy/tests/test_objectives.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... | 187 | 7,082 |
pyomo | doc/OnlineDocs/src/scripting/driveconc1.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... | 33 | 1,163 |
onnxruntime | onnxruntime/test/python/quantization/test_quantize_static.py | .py | #!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------... | 176 | 7,696 |
sqlmap | tests/test_agent.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Consolidated unit coverage for lib/core/agent.py.
This file merges the agent.py tests previously spread across
test_agent.py, test_agent_dialects.py, test_core_more.py and
test_core_... | 791 | 32,139 |
python-prompt-toolkit | src/prompt_toolkit/key_binding/key_processor.py | .py | """
An :class:`~.KeyProcessor` receives callbacks for the keystrokes parsed from
the input in the :class:`~prompt_toolkit.inputstream.InputStream` instance.
The `KeyProcessor` will according to the implemented keybindings call the
correct callbacks when new key presses are feed through `feed`.
"""
from __future__ imp... | 528 | 17,582 |
confluent-kafka-python | src/confluent_kafka/schema_registry/_async/mock_schema_registry_client.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2024 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 462 | 18,167 |
sqlmap | tests/test_filesystem.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Unit coverage for the file-read/file-write/UDF-injection SQL & command builders:
- plugins/generic/filesystem.py (encoding, INSERT/UPDATE query forging,
... | 741 | 31,173 |
voila | tests/app/template_sanity_test.py | .py | # tests basic things the templates should have
import os
import pytest
BASE_DIR = os.path.dirname(__file__)
@pytest.fixture(params=["lab", "classic"])
def voila_args_extra(request):
return [f"--template={request.param}"]
async def test_lists_extension(http_server_client, base_url, voila_app):
response = a... | 19 | 487 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.