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
wandb
wandb/sdk/lib/filenames.py
.py
from __future__ import annotations import os from collections.abc import Callable, Generator WANDB_DIRS = ("wandb", ".wandb") CONFIG_FNAME = "config.yaml" OUTPUT_FNAME = "output.log" DIFF_FNAME = "diff.patch" SUMMARY_FNAME = "wandb-summary.json" METADATA_FNAME = "wandb-metadata.json" REQUIREMENTS_FNAME = "requiremen...
65
1,938
probability
tensorflow_probability/python/bijectors/scale_test.py
.py
# Copyright 2019 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
152
5,908
mlflow
tests/server/test_workspace_middleware.py
.py
from __future__ import annotations import pytest import werkzeug from fastapi import FastAPI from fastapi.testclient import TestClient from flask import Flask from mlflow.entities import Workspace from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException from mlfl...
238
8,060
pdm
tests/resolver/test_uv_resolver.py
.py
from textwrap import dedent import pytest from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement pytestmark = [pytest.mark.network, pytest.mark.uv] def resolve(environment, requirements, target=None): from pdm.resolver.uv import UvResolver reqs = [] for req in req...
167
5,893
django-cms
cms/management/commands/subcommands/base.py
.py
import os from collections import OrderedDict from django.core.management.base import BaseCommand, CommandParser from django.core.management.color import color_style, no_style def add_builtin_arguments(parser): parser.add_argument( '--noinput', action='store_false', dest='interactive', ...
106
4,050
astropy
astropy/constants/astropyconst80.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants for Astropy v8.0. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ import warnings from astropy.utils import find_current_module from . import codata2022, iau2015 from . impo...
71
2,028
pdm
install-pdm.py
.py
from __future__ import annotations import argparse import dataclasses import io import json import os import platform import shutil import site import subprocess import sys import urllib.request from collections.abc import Sequence from pathlib import Path from tempfile import TemporaryDirectory if sys.version_info <...
464
14,850
mlflow
tests/pydantic_ai/test_pydanticai_mcp_tracing.py
.py
import importlib.metadata from unittest.mock import patch import pytest from packaging.version import Version if Version(importlib.metadata.version("pydantic_ai")).major >= 2: pytest.skip("Pydantic AI 1.x MCP tracing tests", allow_module_level=True) from pydantic_ai.mcp import MCPServerStdio import mlflow from ...
122
3,400
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/ParameterOptimizerState.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class ParameterOptimizerState(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.enc...
92
3,127
astropy
astropy/table/tests/test_jsviewer.py
.py
import textwrap from os.path import abspath, dirname, join import pytest from astropy import extern from astropy.coordinates import SkyCoord from astropy.table.table import Table from astropy.time import Time from astropy.utils.compat.optional_deps import ( HAS_BLEACH, HAS_IPYDATAGRID, HAS_IPYTHON, HA...
255
7,515
confluent-kafka-python
tests/test_log.py
.py
#!/usr/bin/env python import logging from io import StringIO import confluent_kafka import confluent_kafka.admin import confluent_kafka.avro from tests.common import TestConsumer from tests.common.schema_registry import TestAvroConsumer class CountingFilter(logging.Filter): def __init__(self, name): sel...
185
5,375
mlflow
mlflow/projects/backend/__init__.py
.py
""" This module defines developer APIs for defining pluggable execution backends for MLflow projects. See `MLflow Plugins <../../plugins.html>`_ for more information. """ from mlflow.projects.backend.abstract_backend import AbstractBackend __all__ = ["AbstractBackend"]
9
272
saleor
saleor/graphql/product/tests/mutations/test_product_variant_bulk_create.py
.py
import datetime import json from unittest.mock import ANY, patch from uuid import uuid4 import graphene from django.conf import settings from freezegun import freeze_time from .....attribute import AttributeInputType from .....discount.utils.promotion import get_active_catalogue_promotion_rules from .....product.erro...
2,785
96,106
openvino
tests/layer_tests/tensorflow_tests/test_tf_Size.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 TestSize(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'input:0' in inputs_info ...
84
3,263
hydra
tests/instantiate/test_instantiate.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import copy import inspect import os import pickle import re from dataclasses import InitVar, dataclass, field from functools import partial from textwrap import dedent from typing import Any, Callable, Dict, List, Optional, Tuple, cast import attr...
3,722
110,992
mlflow
mlflow/tracing/constant.py
.py
from enum import Enum # NB: These keys are placeholders and subject to change class TraceMetadataKey: INPUTS = "mlflow.traceInputs" OUTPUTS = "mlflow.traceOutputs" SOURCE_RUN = "mlflow.sourceRun" MODEL_ID = "mlflow.modelId" # Trace size statistics including total size, number of spans, and max spa...
397
14,432
pyfilesystem2
fs/permissions.py
.py
"""Abstract permissions container. """ from __future__ import print_function, unicode_literals import typing from typing import Iterable import six from ._typing import Text if typing.TYPE_CHECKING: from typing import Iterator, List, Optional, Tuple, Type, Union def make_mode(init): # type: (Union[int, I...
318
9,817
django-cms
cms/operations/__init__.py
.py
# Placeholder operations ADD_PLUGIN = 'add_plugin' CHANGE_PLUGIN = 'change_plugin' DELETE_PLUGIN = 'delete_plugin' MOVE_PLUGIN = 'move_plugin' CUT_PLUGIN = 'cut_plugin' PASTE_PLUGIN = 'paste_plugin' PASTE_PLACEHOLDER = 'paste_placeholder' ADD_PLUGINS_FROM_PLACEHOLDER = 'add_plugins_from_placeholder' CLEAR_PLACEHOLDER =...
34
1,069
bazel
third_party/py/abseil/absl/logging/__init__.py
.py
# Copyright 2017 The Abseil Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
1,241
41,407
openvino
tests/layer_tests/pytorch_tests/test_quantized_linear.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch import numpy as np from pytorch_layer_test_class import PytorchLayerTest class TestQuantizedLinear(PytorchLayerTest): def _prepare_input(self, input_shape=(2, 2)): return (np.rou...
94
4,557
pyomo
pyomo/contrib/iis/tests/test_iis.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...
137
4,672
mlflow
mlflow/gateway/providers/ai21labs.py
.py
import time from mlflow.gateway.config import AI21LabsConfig, EndpointConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider from mlflow.gateway.providers.utils import rename_payload_keys, send_request from mlflow.gateway.schemas import completions clas...
93
3,351
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/sum_canon.py
.py
""" Copyright 2024 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, so...
55
1,921
confluent-kafka-python
tests/test_producer_batch_processor.py
.py
#!/usr/bin/env python3 """ Unit tests for the BatchProcessor class (_batch_processor.py) This module tests the BatchProcessor class to ensure proper message batching, topic grouping, and future management. """ import asyncio import concurrent.futures import os import sys import unittest from unittest.mock import Mock...
460
17,861
gunicorn
tests/requests/invalid/020.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.config import Config from gunicorn.http.errors import InvalidHeaderName cfg = Config() request = InvalidHeaderName
10
236
conda
conda/cli/find_commands.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Utilities for finding executables and `conda-*` commands.""" import os import re import sys import sysconfig from functools import cache from os.path import basename, expanduser, isfile, join from ..common.compat import on_win from ..deprec...
89
2,725
saleor
saleor/tests/e2e/orders/discounts/test_order_products_on_percentage_sale.py
.py
import pytest from .....product.tasks import recalculate_discounted_price_for_products_task from ... import DEFAULT_ADDRESS from ...product.utils.preparing_product import prepare_product from ...sales.utils import create_sale, create_sale_channel_listing, sale_catalogues_add from ...shop.utils.preparing_shop import pr...
156
4,793
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/flatmap_lambda.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");...
57
1,687
sqlmap
plugins/dbms/virtuoso/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):...
57
1,540
openvino
tests/e2e_tests/common/postprocessors/common.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Common postprocessors.""" import numpy as np from e2e_tests.common.preprocessors.preprocessors import SliceData, Normalize, CustomPreproc, RemoveLayersFromInputData, \ RenameInputs, Squeeze from .provider import ClassProvider c...
230
6,367
astropy
astropy/samp/errors.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Defines custom errors and exceptions used in `astropy.samp`. """ import xmlrpc.client as xmlrpc from astropy.utils.exceptions import AstropyUserWarning __all__ = ["SAMPClientError", "SAMPHubError", "SAMPProxyError", "SAMPWarning"] class SAMPWarnin...
41
738
wagtail
wagtail/images/urls.py
.py
from django.urls import re_path from wagtail.images.views.serve import serve urlpatterns = [ re_path(r"^([^/]*)/(\d*)/([^/]*)/[^/]*$", serve, name="wagtailimages_serve"), ]
8
179
sphinx
sphinx/ext/autodoc/_renderer.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from sphinx.ext.autodoc._property_types import ( _AssignStatementProperties, _ClassDefProperties, _FunctionDefProperties, _TypeStatementProperties, ) from sphinx.ext.autodoc._sentinels import SUPPRESS from sphinx.locale import _ if T...
177
6,066
tomli
tests/burntsushi.py
.py
# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Taneli Hukkinen # Licensed to PSF under a Contributor Agreement. """Utilities for tests that are in the "burntsushi" format.""" import datetime from typing import Any def convert(obj): if isinstance(obj, str): return {"type": "string", "value...
104
3,172
metrics
tests/unittests/regression/test_concordance.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...
144
5,713
sqlmap
tests/test_datatypes.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Core data structures: AttribDict, OrderedSet, LRUDict, BigArray. """ import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from _testut...
97
2,686
coremltools
coremltools/version.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 __version__ = "9.1.dev1" # VERSION_STRING
8
260
rq
rq/exceptions.py
.py
class NoSuchJobError(Exception): pass class NoSuchGroupError(Exception): pass class DeserializationError(Exception): pass class InvalidJobDependency(Exception): pass class DuplicateJobError(Exception): pass class InvalidJobOperationError(Exception): pass class InvalidJobOperation(Exc...
59
915
returns
returns/contrib/mypy/_features/curry.py
.py
from collections.abc import Iterator from itertools import groupby, product from operator import itemgetter from typing import cast, final from mypy.nodes import ARG_STAR, ARG_STAR2 from mypy.plugin import FunctionContext from mypy.types import ( AnyType, CallableType, FunctionLike, Overloaded, Typ...
205
6,688
probability
tensorflow_probability/python/bijectors/soft_clip_test.py
.py
# Copyright 2019 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
125
4,827
coveragepy
coverage/pytracer.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 """Raw data collector for coverage.py.""" from __future__ import annotations import atexit import dis import itertools import sys import threading from collecti...
368
15,274
probability
tensorflow_probability/python/distributions/exp_gamma_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...
691
27,098
beam
sdks/python/apache_beam/examples/cookbook/filters_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...
127
4,412
openvino
tests/model_hub_tests/pytorch/test_gfpgan.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import subprocess import sys import tempfile import pytest import torch import torchvision from packaging import version from torch_utils import TestTorchConvertModel from openvino import convert_model import numpy as np # T...
85
3,035
beam
sdks/python/apache_beam/examples/cookbook/mergecontacts_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...
178
5,899
coremltools
coremltools/optimize/torch/quantization/modules/observers.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause # Implementation for reset_min_max_vals, _save_to_state_dict and _load_from_state_dict # has been ada...
262
10,349
jupytext
src/jupytext/cli.py
.py
"""`jupytext` as a command line tool""" import argparse import glob import json import os import re import shlex import subprocess import sys import warnings from copy import copy from tempfile import NamedTemporaryFile from typing import Optional from nbformat.sign import NotebookNotary from .combine import combine...
1,397
51,518
openvino
src/frontends/onnx/tests/tests_python/test_frontend_onnx_editor.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import numpy as np import onnx import pytest from onnx.helper import make_graph, make_model, make_tensor_value_info from openvino.frontend import FrontEndManager, GeneralFailure from openvino import Di...
1,934
72,020
conda
tests/cli/test_main_search.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import re from typing import TYPE_CHECKING import pytest import requests from conda.base.context import context, reset_context from conda.cli.main_search import _pretty_record_format, pretty_record from cond...
503
14,107
metrics
src/torchmetrics/wrappers/feature_share.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...
136
6,593
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vscode_folding_markers/text_outputs_and_images.py
.py
# --- # jupyter: # jupytext: # cell_markers: region,endregion # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # This notebook contains outputs of many different types: text, HTML, plots and errors. # # Text outputs # # Using `print`, `sys.stdout` and `sys.stderr` i...
64
1,186
wagtail
wagtail/api/v3/schemas/params.py
.py
from datetime import datetime from typing import Annotated, ClassVar, Literal, Optional from django.conf import settings from django.db import models from django.db.models import Q, QuerySet from django.http import HttpRequest, QueryDict from django.shortcuts import get_object_or_404 from ninja import FilterSchema, Ni...
290
10,970
mlflow
dev/clint/tests/rules/test_mock_patch_dict_environ.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules.mock_patch_dict_environ import MockPatchDictEnviron def test_mock_patch_dict_environ_with_string_literal(index: SymbolIndex) -> None: code = """ import...
137
4,144
onnxruntime
onnxruntime/python/tools/quantization/operators/gavgpool.py
.py
import onnx from ..quant_utils import TENSOR_NAME_QUANT_SUFFIX, QuantizedValue, QuantizedValueType, attribute_to_kwarg, ms_domain from .base_operator import QuantOperatorBase class QGlobalAveragePool(QuantOperatorBase): def __init__(self, onnx_quantizer, onnx_node): super().__init__(onnx_quantizer, onnx_...
63
2,383
biopython
BioSQL/__init__.py
.py
# Copyright 2002 by Andrew Dalke. All rights reserved. # Revisions 2007-2008 by Peter Cock. # # 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 ...
19
617
mlflow
mlflow/diffusers/wrapper.py
.py
import io import logging import threading from types import MappingProxyType from typing import Any import pandas as pd from mlflow.diffusers import _detect_device from mlflow.exceptions import MlflowException _logger = logging.getLogger(__name__) class _DiffusersAdapterWrapper: def __init__( self, ...
152
5,659
saleor
saleor/tests/e2e/product/utils/product.py
.py
from ...utils import get_graphql_content PRODUCT_CREATE_MUTATION = """ mutation createProduct($input: ProductCreateInput!) { productCreate(input: $input) { errors { field code message attributes } product { id name productType { id } category ...
98
1,928
readthedocs.org
readthedocs/projects/views/private.py
.py
"""Project views for authenticated users.""" from functools import lru_cache import structlog from django.conf import settings from django.contrib import messages from django.contrib.messages.views import SuccessMessageMixin from django.db.models import Count from django.db.models import Q from django.http import Htt...
1,351
47,145
sqlmap
extra/kerberos/der.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ # Minimal, dependency-free ASN.1 DER codec covering exactly the constructs Kerberos (RFC 4120) uses: # INTEGER, OCTET STRING, GeneralString, GeneralizedTime, BIT STRING, SEQUENCE ...
143
4,832
sqlmap
tamper/htmlencode.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import re from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOWEST def dependencies(): pass def tamper(payload, **kwargs): """ HTML encode (using code po...
32
851
python-prompt-toolkit
src/prompt_toolkit/output/plain_text.py
.py
from __future__ import annotations from typing import TextIO from prompt_toolkit.cursor_shapes import CursorShape from prompt_toolkit.data_structures import Size from prompt_toolkit.styles import Attrs from .base import Output from .color_depth import ColorDepth from .flush_stdout import flush_stdout __all__ = ["Pl...
144
3,296
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re from enum import Enum import numpy as np from openvino._pyopenvino import Place, PartialShape # pylint: disable=no-name-in-module,import-error from openvino.frontend import InputModel # pylint: disable=no-name-in-module,impo...
448
18,316
black
src/black/output.py
.py
"""Nice output for Black. The double calls are for patching purposes in tests. """ import json import os import re import tempfile from typing import Any from click import echo, style from mypy_extensions import mypyc_attr @mypyc_attr(patchable=True) def _out(message: str | None = None, nl: bool = True, **styles: ...
136
4,204
hydra
tests/test_apps/app_with_cfg_decorated/decorators/inner_decorator.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from functools import wraps from typing import Callable, TypeVar from omegaconf import DictConfig R = TypeVar("R") def inner_decorator(func: Callable[[DictConfig], R]) -> Callable[[DictConfig], R]: @wraps(func) def wrapper(conf: DictCon...
18
434
saleor
saleor/core/rlimit.py
.py
import resource from django.core.exceptions import ImproperlyConfigured RLIMIT_TYPE = resource.RLIMIT_DATA def is_soft_limit_set_without_hard_limit(soft_limit_in_MB, hard_limit_in_MB): return soft_limit_in_MB is not None and hard_limit_in_MB is None def is_hard_limit_set_without_soft_limit(soft_limit_in_MB, h...
61
2,451
biopython
Tests/test_PDB_NACCESS.py
.py
# Copyright 2009-2011 by Eric Talevich. All rights reserved. # Revisions copyright 2009-2013 by Peter Cock. All rights reserved. # Revisions copyright 2013 Lenna X. Peterson. All rights reserved. # Revisions copyright 2013 Gokcen Eraslan. All rights reserved. # Revisions copyright 2020 Joao Rodrigues. All rights rese...
73
2,417
gunicorn
examples/frameworks/django/testing/testing/apps/someapp/tests.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ This file demonstrates two different styles of tests (one doctest and one unittest). These will both pass when you run "manage.py test". Replace these with more appropriate tests for your application. """ fro...
27
615
sqlmap
tamper/if2case.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'doc/COPYING' for copying permission """ from lib.core.compat import xrange from lib.core.enums import PRIORITY from lib.core.settings import REPLACEMENT_MARKER __priority__ = PRIORITY.HIGHEST def dependencies(): ...
107
3,442
saleor
saleor/graphql/invoice/tests/test_invoice_update.py
.py
import graphene from ....core import JobStatus from ....graphql.tests.utils import assert_no_permission, get_graphql_content from ....invoice.error_codes import InvoiceErrorCode from ....invoice.models import Invoice INVOICE_UPDATE_MUTATION = """ mutation invoiceUpdate($id: ID!, $input: UpdateInvoiceInput!) { ...
201
6,544
wandb
wandb/sdk/interface/interface_shared.py
.py
from __future__ import annotations import abc import logging from typing import Any, cast from typing_extensions import override from wandb.proto import wandb_internal_pb2 as pb from wandb.proto import wandb_telemetry_pb2 as tpb from wandb.sdk.mailbox import MailboxHandle from wandb.util import json_dumps_safer, jso...
499
17,895
coremltools
coremltools/converters/mil/mil/ops/tests/iOS18/__init__.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import coremltools as ct from coremltools.converters.mil.testing_reqs import backends_internal, clean...
10
399
python-prompt-toolkit
examples/prompts/enforce-tty-input-output.py
.py
#!/usr/bin/env python """ This will display a prompt that will always use the terminal for input and output, even if sys.stdin/stdout are connected to pipes. For testing, run as: cat /dev/null | python ./enforce-tty-input-output.py > /dev/null """ from prompt_toolkit.application import create_app_session_from_tty...
15
418
pyomo
pyomo/opt/problem/ampl.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...
65
2,207
hatch
tests/utils/test_platform.py
.py
import os import stat import pytest from hatch.utils.fs import Path from hatch.utils.platform import Platform from hatch.utils.structures import EnvVars @pytest.mark.requires_windows class TestWindows: def test_tag(self): assert Platform().windows is True def test_default_shell(self): asser...
123
4,187
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_maxpool3D.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasMaxPool3D(CommonTF2LayerTest): def create_keras_maxpool3D_net(self, input_names, input_shapes, input_type, pool_size, ...
72
3,869
openvino
tests/layer_tests/tensorflow_tests/test_tf_StringToHashBucketFast.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 run_in_jenkins rng = np.random.default_rng() class TestStringToHashBucketFast(CommonTF...
53
2,437
coremltools
coremltools/optimize/torch/_logging.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import logging import os def init_root_logger(): logger = get_root_logger() logger.propagat...
52
1,472
sphinx
tests/roots/test-root/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) from docutils import nodes from docutils.parsers.rst import Directive from sphinx import addnodes extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.extlinks', ] jsmath_path = '...
170
4,456
biopython
Tests/test_prosite.py
.py
# Copyright 1999 by Cayte Lindner. 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. """Tests for Bio.ExPASy.Prosite module.""" import os import unittest from Bio.ExPASy import ...
3,498
251,003
black
tests/data/cases/pep_572_do_not_remove_parens.py
.py
# flags: --fast # Most of the following examples are really dumb, some of them aren't even accepted by Python, # we're fixing them only so fuzzers (which follow the grammar which actually allows these # examples matter of fact!) don't yell at us :p del (a := [1]) try: pass except (a := 1) as (b := why_does_this_e...
27
514
openvino
src/bindings/python/src/openvino/utils/input_validation.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Helper functions for validating user input.""" import logging from typing import Any, Optional from collections.abc import Callable, Iterable import numpy as np from openvino.exceptions import UserInputError...
135
4,803
dirty-equals
dirty_equals/_strings.py
.py
import re from re import Pattern from typing import Any, Literal, Optional, TypeVar, Union from ._base import DirtyEquals from ._utils import Omit, plain_repr T = TypeVar('T', str, bytes) __all__ = 'IsStr', 'IsBytes', 'IsAnyStr' class IsAnyStr(DirtyEquals[T]): """ Comparison of `str` or `bytes` objects. ...
161
5,103
pyomo
pyomo/contrib/mpc/interfaces/model_interface.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...
420
16,334
cvxpy
cvxpy/reductions/complex2real/canonicalizers/matrix_canon.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 agreed...
238
8,555
metrics
src/torchmetrics/functional/text/bert.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...
591
26,746
clearml
clearml/cli/debug/__main__.py
.py
import argparse import sys from argparse import ArgumentParser from pprint import pprint from clearml import Task from clearml.backend_api.session import Session from clearml.config import ConfigWrapper from clearml.utilities.pyhocon import HOCONConverter from clearml.utilities.pyhocon.exceptions import ConfigMissingE...
127
3,742
pyomo
examples/pyomobook/gdp-ch/scont.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...
53
1,597
onnxruntime
tools/android_custom_build/build_custom_android_package.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import os import pathlib import shlex import shutil import subprocess import sys SCRIPT_DIR = pathlib.Path(__file__).parent.resolve() def is_windows(): return sys.platform.startsw...
182
6,376
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/pardo_dofn_params.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");...
82
2,799
sphinx
tests/test_writers/test_api_translator.py
.py
"""Test the Sphinx API for translator.""" from __future__ import annotations import sys from typing import TYPE_CHECKING import pytest from sphinx.testing.util import SphinxTestApp if TYPE_CHECKING: from collections.abc import Iterator from pathlib import Path from sphinx.testing.util import SphinxTes...
104
3,706
coremltools
deps/protobuf/python/google/protobuf/internal/testing_refleaks.py
.py
# 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 are # met: # # * Redi...
126
4,529
beam
sdks/python/apache_beam/metrics/monitoring_infos_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 ...
171
7,049
pyro
pyro/infer/trace_mean_field_elbo.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import warnings import weakref import torch from torch.distributions import kl_divergence import pyro.ops.jit from pyro.distributions.util import scale_and_mask from pyro.infer.trace_elbo import Trace_ELBO from pyro.infer.util im...
209
8,302
saleor
saleor/tests/e2e/orders/test_order_cancel_fulfillment.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils import prepare_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_paid, order_fulfill, ...
166
4,491
saleor
saleor/core/management/commands/generate_json_schemas.py
.py
import json import os import shutil from typing import cast from django.core.management.base import BaseCommand from pydantic import BaseModel from ....webhook.response_schemas import COMBINED_SCHEMAS_TO_EXPORT, SCHEMAS_TO_EXPORT SCHEMA_OUTPUT_DIR = "saleor/json_schemas" class Command(BaseCommand): help = "Gen...
79
2,701
beam
learning/katas/python/Core Transforms/Map/Map/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...
36
1,257
biopython
Tests/test_SeqIO_SeqXML.py
.py
# Copyright 2010 by Thomas Schmitt. 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. """Tests for SeqIO SeqXML module.""" import unittest from io import BytesIO from Bio import ...
257
10,375
coremltools
coremltools/converters/mil/frontend/tensorflow/test/test_composite_ops.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 from coremltools.converters.mil.frontend.tensorfl...
70
2,413
hatch
backend/src/hatchling/builders/hooks/plugin/interface.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, Any, Generic, cast from hatchling.builders.config import BuilderConfigBound if TYPE_CHECKING: from hatchling.bridge.app import Application from hatchling.metadata.core import ProjectMetadata class BuildHookInterface(Generic[BuilderConfigB...
149
4,250
django-cms
cms/test_utils/project/pluginapp/plugins/meta/models.py
.py
from cms.models.pluginmodel import CMSPlugin class TestPluginModel(CMSPlugin): pass class TestPluginModel2(CMSPlugin): class Meta: db_table = 'meta_testpluginmodel2' app_label = 'meta' class TestPluginModel3(CMSPlugin): class Meta: app_label = 'one_thing' class TestPluginMode...
28
504