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 |
|---|---|---|---|---|---|
sphinx | tests/roots/test-ext-apidoc/conf.py | .py | import sys
from pathlib import Path
sys.path.insert(0, str(Path.cwd().resolve() / 'src'))
extensions = ['sphinx.ext.apidoc']
apidoc_include_private = True
apidoc_follow_links = False
apidoc_separate_modules = True
apidoc_no_headings = False
apidoc_module_first = True
apidoc_modules = [
{
'path': 'src',
... | 23 | 541 |
black | tests/data/miscellaneous/force_py36.py | .py | # The input source must not contain any Py36-specific syntax (e.g. argument type
# annotations, trailing comma after *rest) or this test becomes invalid.
def long_function_name(argument_one, argument_two, argument_three, argument_four, argument_five, argument_six, *rest): pass
# output
# The input source must not conta... | 17 | 600 |
metrics | src/torchmetrics/functional/audio/pit.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... | 228 | 9,834 |
openvino | tests/layer_tests/pytorch_tests/test_index_fill_.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import torch
from pytorch_layer_test_class import PytorchLayerTest
class TestIndexFill(PytorchLayerTest):
def _prepare_input(self):
return (self.input_tensor,)
def create_model(self, ... | 83 | 2,627 |
mlflow | dev/pypi/src/pypi/_client.py | .py | from __future__ import annotations
import asyncio
import json
import os
from collections.abc import Iterable
from typing import Any, Literal, overload
import aiohttp
from pypi._models import Package
_DEFAULT_PYPI_URL = "https://pypi.org"
_TIMEOUT_SECONDS = 10.0
_RETRIES = 3
_BACKOFF_BASE = 0.5
# Transient HTTP sta... | 110 | 3,669 |
onnx | onnx/reference/ops/aionnxml/_op_list.py | .py | # SPDX-License-Identifier: Apache-2.0
# Operator ZipMap is not implemented. Its use should
# be discouraged. It is just a different way to output
# probabilities not consumed by any operator.
from __future__ import annotations
__all__ = [
"load_op",
"ArrayFeatureExtractor",
"Binarizer",
"DictVectorize... | 122 | 4,326 |
onnxruntime | onnxruntime/python/tools/transformers/models/llama/dist_settings.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 o... | 58 | 1,602 |
beam | sdks/python/apache_beam/transforms/resources_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... | 118 | 3,932 |
ipython | tests/test_completer.py | .py | # encoding: utf-8
"""Tests for the IPython tab-completion machinery."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import pytest
import sys
import textwrap
import types
import random
from importlib.metadata import version
from contextlib import con... | 2,922 | 89,745 |
pyomo | pyomo/core/tests/unit/test_relational_expr_dispatcher.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... | 9,197 | 334,492 |
coremltools | coremltools/converters/mil/backend/mil/passes/fuse_activation_silu.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
from coremltools.converters.mil.mil import Builder as mb
from coremltools.converters.mil.mil.passes.g... | 84 | 2,702 |
onnx | onnx/checker.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Graph utilities for checking whether an ONNX proto message is legal."""
from __future__ import annotations
__all__ = [
"check_attribute",
"check_function",
"check_graph",
"check_model",
"check_node",
"check_sp... | 172 | 5,554 |
coremltools | coremltools/optimize/torch/palettization/_fake_palettizer_tensor_hook.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 gc
from typing import Callable as _Callable
from typing import Tuple as _Tuple
import torch a... | 297 | 9,876 |
saleor | saleor/graphql/tests/test_metrics.py | .py | from unittest.mock import MagicMock, patch
import graphene
import pytest
from django.test import override_settings
from freezegun import freeze_time
from opentelemetry.semconv._incubating.attributes import graphql_attributes
from ...core.telemetry import DEFAULT_DURATION_BUCKETS, Scope, Unit, saleor_attributes
from .... | 428 | 15,507 |
loguru | tests/test_bind.py | .py | import pytest
from loguru import logger
def test_bind_after_add(writer):
logger.add(writer, format="{extra[a]} {message}")
logger_bound = logger.bind(a=0)
logger_bound.debug("A")
assert writer.read() == "0 A\n"
def test_bind_before_add(writer):
logger_bound = logger.bind(a=0)
logger.add(wr... | 87 | 2,046 |
mlflow | mlflow/server/auth/config.py | .py | import configparser
from pathlib import Path
from typing import NamedTuple
from mlflow.environment_variables import MLFLOW_AUTH_CONFIG_PATH
DEFAULT_AUTHORIZATION_FUNCTION = "mlflow.server.auth:authenticate_request_basic_auth"
class AuthConfig(NamedTuple):
default_permission: str
database_uri: str
admin_... | 57 | 2,136 |
saleor | saleor/graphql/core/tests/garbage_collection/test_gzip.py | .py | import gc
import gzip
import io
import pytest
from .utils import (
clean_up_after_garbage_collection_test,
disable_gc_for_garbage_collection_test,
)
# Group all tests that require garbage collection so that they do not run concurrently.
# This is necessary to ensure that tests don't interfere with each othe... | 41 | 1,494 |
coremltools | coremltools/converters/sklearn/_gradient_boosting_classifier.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 numpy as np
from ..._deps import _HAS_SKLEARN
from ...models import MLModel as _MLModel
from ._t... | 109 | 3,521 |
kombu | kombu/transport/qpid.py | .py | """Qpid Transport module for kombu.
`Qpid`_ transport using `qpid-python`_ as the client and `qpid-tools`_ for
broker management.
The use this transport you must install the necessary dependencies. These
dependencies are available via PyPI and can be installed using the pip
command:
.. code-block:: console
$ pi... | 1,749 | 71,681 |
pyomo | pyomo/core/kernel/heterogeneous_container.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... | 274 | 10,181 |
saleor | saleor/app/tests/fixtures/webhooks/tax_app.py | .py | import pytest
from .....app.models import App
from .....app.types import AppType
from .....graphql.core.utils import to_global_id_or_none
from .....webhook.event_types import WebhookEventSyncType
from .....webhook.models import Webhook, WebhookEvent
CALCULATE_TAXES_SUBSCRIPTION_QUERY = """
subscription CalculateTaxes... | 189 | 3,968 |
probability | discussion/robust_inverse_graphics/diffusion.py | .py | # Copyright 2024 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... | 356 | 11,358 |
pyomo | pyomo/contrib/trustregion/tests/test_util.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... | 127 | 5,757 |
mlflow | tests/store/tracking/test_abstract_store.py | .py | from abc import ABC
from unittest import mock
from unittest.mock import patch
import pytest
from mlflow.entities import Metric
from mlflow.entities.metric import MetricWithRunId
from mlflow.store.tracking.abstract_store import AbstractStore
class MockAbstractStore(AbstractStore, ABC):
"""Mock implementation of ... | 387 | 14,692 |
deap | doc/code/tutorials/part_2/2_3_1_bag.py | .py | ## 2.3.1 Bag
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", list, fitness=creator.FitnessMin)
IND_SIZE = 20
toolbox = base.Toolbox()
toolbox.register("attr_int", random.randint, -20, 20)
too... | 20 | 535 |
openvino | tools/ovc/openvino/tools/ovc/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import sys
from openvino.tools.ovc.convert import convert_model
from openvino.tools.ovc.telemetry_utils import is_optimum, init_ovc_telemetry, is_torch_compile, is_keras3
import importlib.metadata as importlib_metadata
try:
optimum... | 32 | 1,443 |
cvxpy | cvxpy/atoms/affine/bmat.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... | 56 | 1,852 |
gunicorn | tests/requests/valid/025_line.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/chunked"),
"version": (1, 1),
"headers": [
('TRANSFER-ENCODING', 'gzip,chunked')
],
"body": b"hello world"
}
| 15 | 291 |
returns | returns/contrib/mypy/_typeops/analtype.py | .py | from collections.abc import Sequence
from types import MappingProxyType
from typing import Final, Literal, overload
from mypy.checkmember import analyze_member_access
from mypy.nodes import ARG_NAMED, ARG_OPT
from mypy.types import CallableType, FunctionLike, ProperType, get_proper_type
from mypy.types import Type as ... | 133 | 3,795 |
funcy | funcy/objects.py | .py | from inspect import isclass, ismodule
from .strings import cut_prefix
__all__ = ['cached_property', 'cached_readonly', 'wrap_prop', 'monkey', 'LazyObject']
class cached_property(object):
"""
Decorator that converts a method with a single self argument into
a property cached on the instance.
"""
... | 108 | 3,155 |
textual | tests/snapshot_tests/snapshot_apps/select_rebuild.py | .py | """Test https://github.com/Textualize/textual/issues/2557"""
from textual.app import App, ComposeResult
from textual.widgets import Select, Button
class SelectRebuildApp(App[None]):
def compose(self) -> ComposeResult:
yield Select[int]((("1", 1), ("2", 2)))
yield Button("Rebuild")
def on_bu... | 22 | 594 |
openvino | tests/layer_tests/pytorch_tests/test_mul.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import torch
from pytorch_layer_test_class import PytorchLayerTest
class TestMul(PytorchLayerTest):
def _prepare_input(self):
return (self.input_array.astype(self.input_type), self.other_ar... | 319 | 12,545 |
pyro | pyro/poutine/uncondition_messenger.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from typing import TYPE_CHECKING
from pyro.poutine.messenger import Messenger
if TYPE_CHECKING:
from pyro.poutine.runtime import Message
class UnconditionMessenger(Messenger):
"""
Messenger to force the value of obs... | 35 | 982 |
metrics | tests/unittests/image/test_arniqa.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... | 175 | 7,802 |
astropy | astropy/samp/hub_script.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import argparse
import copy
import logging
import sys
import time
from astropy import __version__, log
from .hub import SAMPHubServer
__all__ = ["hub_script"]
def hub_script(timeout=0):
"""
This main function is executed by the ``samp_hub`` ... | 220 | 6,296 |
pyomo | doc/OnlineDocs/src/scripting/AbstractSuffixes.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... | 34 | 962 |
mlflow | mlflow/genai/judges/prompts/retrieval_relevance.py | .py | from mlflow.genai.prompts.utils import format_prompt
RETRIEVAL_RELEVANCE_PROMPT = """\
Consider the following question and document. You must determine whether the document provides information that is (fully or partially) relevant to the question. Do not focus on the correctness or completeness of the document. Do no... | 23 | 1,107 |
saleor | saleor/graphql/account/tests/mutations/authentication/test_external_obtain_access_tokens.py | .py | import datetime
import json
from unittest.mock import Mock, patch
from freezegun import freeze_time
from ......plugins.base_plugin import ExternalAccessTokens
from .....tests.utils import get_graphql_content
MUTATION_EXTERNAL_REFRESH = """
mutation externalObtainAccessTokens($pluginId: String!, $input: JSONStrin... | 168 | 5,913 |
textual | docs/examples/widgets/directory_tree.py | .py | from textual.app import App, ComposeResult
from textual.widgets import DirectoryTree
class DirectoryTreeApp(App):
def compose(self) -> ComposeResult:
yield DirectoryTree("./")
if __name__ == "__main__":
app = DirectoryTreeApp()
app.run()
| 13 | 262 |
onnxruntime | tools/ci_build/set_plugin_ep_build_variables.py | .py | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Set plugin EP package version variables for Azure Pipelines.
Usage:
python set_plugin_ep_build_variables.py <package_version> <version_file_rel>
Where:
package_version: 'release', 'rc', or ... | 111 | 4,102 |
readthedocs.org | readthedocs/oauth/models.py | .py | """OAuth service models."""
from functools import cached_property
import structlog
from allauth.socialaccount.models import SocialAccount
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
from django.utils.translation import gette... | 424 | 14,327 |
confluent-kafka-python | examples/share_consumer_context_manager.py | .py | #!/usr/bin/env python
#
# Copyright 2026 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 75 | 2,726 |
saleor | saleor/graphql/app/mutations/app_token_delete.py | .py | from typing import cast
import graphene
from django.core.exceptions import ValidationError
from ....app import models
from ....app.error_codes import AppErrorCode
from ....permission.enums import AppPermission
from ...account.utils import can_manage_app
from ...core import ResolveInfo
from ...core.mutations import Mo... | 47 | 1,769 |
black | scripts/diff_shades_gha_helper.py | .py | """Helper script for psf/black's diff-shades Github Actions integration.
diff-shades is a tool for analyzing what happens when you run Black on
OSS code capturing it for comparisons or other usage. It's used here to
help measure the impact of a change *before* landing it (in particular
posting a comment on completion ... | 232 | 8,034 |
lemur | lemur/plugins/lemur_slack/plugin.py | .py | """
.. module: lemur.plugins.lemur_slack.plugin
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Harm Weites <harm@weites.com>
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
import json
import arrow
from... | 145 | 4,799 |
mlflow | mlflow/pytorch/_lightning_autolog.py | .py | import functools
import logging
import os
import tempfile
import warnings
import torch
from packaging.version import Version
import mlflow.pytorch
from mlflow.exceptions import MlflowException
from mlflow.ml_package_versions import _ML_PACKAGE_VERSIONS
from mlflow.models import infer_signature
from mlflow.tracking.fl... | 710 | 29,845 |
clearml | clearml/backend_api/session/jsonmodels/builders.py | .py | """Builders to generate in memory representation of model and fields tree."""
from __future__ import absolute_import
from collections import defaultdict
from typing import Any
from . import errors
from .fields import NotSet
class Builder:
def __init__(
self,
parent: "Builder" = None,
nu... | 221 | 6,642 |
python-dotenv | tests/test_cli.py | .py | import os
from pathlib import Path
from typing import Optional
import pytest
import dotenv
from dotenv.cli import cli as dotenv_cli
from dotenv.version import __version__
from tests.test_lib import check_process, run_dotenv
@pytest.mark.parametrize(
"output_format,content,expected",
(
(None, "x='a b... | 296 | 8,135 |
sphinx | doc/development/tutorials/examples/recipe.py | .py | from collections import defaultdict
from docutils.parsers.rst import directives
from sphinx import addnodes
from sphinx.application import Sphinx
from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, Index
from sphinx.roles import XRefRole
from sphinx.util.nodes import make_refnode
from s... | 182 | 5,439 |
gunicorn | examples/http2_features/test_http2.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
#!/usr/bin/env python
"""
Test script for HTTP/2 features example.
This script tests:
- HTTP/2 connection establishment
- Stream priority access
- Response trailers
Run the server first:
docker compose up --b... | 296 | 8,843 |
onnxruntime | onnxruntime/test/python/quantization/test_op_pooling.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.
# ---------------------------------------------------------------... | 178 | 6,487 |
cvxpy | cvxpy/reductions/solvers/conic_solvers/diffcp_conif.py | .py | """
Copyright, the CVXPY authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 195 | 7,398 |
beam | sdks/python/gen_protos.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... | 537 | 18,706 |
metrics | tests/unittests/retrieval/_inputs.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... | 103 | 3,704 |
textual | docs/examples/guide/workers/weather02.py | .py | import httpx
from rich.text import Text
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Input, Static
class WeatherApp(App):
"""App to display the current weather."""
CSS_PATH = "weather.tcss"
def compose(self) -> ComposeResult:
... | 41 | 1,289 |
biopython | Bio/SVDSuperimposer/__init__.py | .py | # Copyright (C) 2002, Thomas Hamelryck (thamelry@vub.ac.be)
#
# 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.
"""Align on protein st... | 204 | 6,256 |
lemur | lemur/plugins/lemur_vault_dest/plugin.py | .py | """
.. module: lemur.plugins.lemur_vault_dest.plugin
:platform: Unix
:copyright: (c) 2019
:license: Apache, see LICENCE for more details.
Plugin for uploading certificates and private key as secret to hashi vault
that can be pulled down by end point nodes.
.. moduleauthor:: Christopher Jolley <ch... | 379 | 13,329 |
pyomo | pyomo/solvers/tests/models/LP_compiled.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... | 278 | 9,745 |
cvxpy | cvxpy/tests/test_expression_methods.py | .py | """
Copyright 2023 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, softwa... | 423 | 14,675 |
cvxpy | cvxpy/utilities/sign.py | .py | from typing import TYPE_CHECKING
if TYPE_CHECKING:
from cvxpy.expressions.expression import Expression
"""
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
ht... | 65 | 1,955 |
coremltools | coremltools/converters/mil/mil/ops/tests/iOS16/test_tensor_transformation.py | .py | # Copyright (c) 2023, 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._deps import _HAS_TORCH, MSG_TOR... | 165 | 5,721 |
black | tests/data/cases/type_param_defaults.py | .py | # flags: --minimum-version=3.13
type A[T=int] = float
type B[*P=int] = float
type C[*Ts=int] = float
type D[*Ts=*int] = float
type D[something_that_is_very_very_very_long=something_that_is_very_very_very_long] = float
type D[*something_that_is_very_very_very_long=*something_that_is_very_very_very_long] = float
type so... | 70 | 1,705 |
kombu | kombu/utils/eventio.py | .py | """Selector Utilities."""
from __future__ import annotations
import errno
import math
import select as __select__
import sys
from numbers import Integral
from . import fileno
from .compat import detect_environment
__all__ = ('poll',)
_selectf = __select__.select
_selecterr = __select__.error
xpoll = getattr(__sele... | 330 | 10,150 |
readthedocs.org | readthedocs/embed/tests/test_api.py | .py | import pytest
from django.urls import reverse
from django_dynamic_fixture import get
from rest_framework import status
from readthedocs.builds.constants import LATEST
from readthedocs.projects.constants import PUBLIC
from readthedocs.projects.models import Project
from readthedocs.subscriptions.constants import TYPE_E... | 56 | 1,661 |
pyomo | pyomo/mpec/tests/test_nlp.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... | 133 | 4,408 |
wagtail | wagtail/admin/models.py | .py | import swapper
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import Count
from django.utils import timezone
from django.utils.translation import gettext_lazy ... | 215 | 7,212 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_ReduceArithmeticOps.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import platform
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
rng = np.random.default_rng(475912)
class TestReduceArithmeticOps(CommonTFLayerTest):
def _prepare_input(self, inputs_info):... | 102 | 4,161 |
django-cms | cms/tests/test_fixture_loading.py | .py | import codecs
import tempfile
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from django.core.management import call_command
from cms.models import CMSPlugin, Page, Placeholder
from cms.test_utils.fixtures.navextenders import NavextendersFixture
from cms.test_utils.testcases ... | 47 | 1,779 |
biopython | Tests/test_Phylo_networkx.py | .py | # Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Unit tests for Bio.Phylo functions with external dependencies."""
import unittest
#... | 39 | 1,154 |
pyomo | pyomo/contrib/preprocessing/tests/test_induced_linearity.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... | 195 | 7,581 |
mlflow | mlflow/models/evaluation/evaluators/regressor.py | .py | from typing import Optional
import numpy as np
from sklearn import metrics as sk_metrics
import mlflow
from mlflow.models.evaluation.base import EvaluationMetric, EvaluationResult, _ModelType
from mlflow.models.evaluation.default_evaluator import (
BuiltInEvaluator,
_extract_output_and_other_columns,
_ext... | 97 | 3,342 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_unsqueeze.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# unsqueeze paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
data_type = 'float32'
def unsqueeze(name : str, x, axes : list):
paddle.enable_static()
with paddle.static.pro... | 44 | 1,264 |
pyomo | pyomo/common/enums.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... | 279 | 9,114 |
probability | tensorflow_probability/python/distributions/joint_distribution_coroutine_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... | 1,518 | 56,530 |
pyomo | pyomo/core/kernel/matrix_constraint.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... | 493 | 16,158 |
pyomo | pyomo/common/factory.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... | 67 | 2,244 |
mamba | micromamba/tests/test_linking.py | .py | import json
import os
import platform
import sys
from pathlib import Path
import pytest
# Need to import everything to get fixtures
from .helpers import * # noqa: F403
from . import helpers
package_to_test = "xtensor"
file_in_package_to_test = "xtensor.hpp"
class TestLinking:
current_root_prefix = os.environ[... | 324 | 13,206 |
mlflow | mlflow/entities/span_log_level.py | .py | from __future__ import annotations
from enum import IntEnum
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
class SpanLogLevel(IntEnum):
"""
Log level (severity) for an MLflow trace span.
The public tracing API accepts a :class:`SpanLogLeve... | 40 | 1,141 |
readthedocs.org | readthedocs/organizations/querysets.py | .py | """Organizations querysets."""
from datetime import timedelta
from django.conf import settings
from django.db import models
from django.db.models import Count
from django.db.models import Q
from django.utils import timezone
from djstripe.enums import InvoiceStatus
from djstripe.enums import SubscriptionStatus
from r... | 151 | 5,659 |
django-cms | cms/wizards/wizard_base.py | .py | import hashlib
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import ModelForm
from django.utils.encoding import force_str
from django.utils.functional import cached_property
from django.utils.translation import gettext as _, override as force_language
fr... | 219 | 8,551 |
hatch | src/hatch/config/constants.py | .py | class AppEnvVars:
ENV = "HATCH_ENV"
ENV_ACTIVE = "HATCH_ENV_ACTIVE"
ENV_OPTION_PREFIX = "HATCH_ENV_TYPE_"
QUIET = "HATCH_QUIET"
VERBOSE = "HATCH_VERBOSE"
INTERACTIVE = "HATCH_INTERACTIVE"
PYTHON = "HATCH_PYTHON"
# https://no-color.org
NO_COLOR = "NO_COLOR"
FORCE_COLOR = "FORCE_CO... | 42 | 1,108 |
returns | returns/interfaces/lashable.py | .py | from abc import abstractmethod
from collections.abc import Callable
from typing import Generic, Never, TypeVar
from returns.primitives.hkt import KindN
_FirstType = TypeVar('_FirstType')
_SecondType = TypeVar('_SecondType')
_ThirdType = TypeVar('_ThirdType')
_UpdatedType = TypeVar('_UpdatedType')
_LashableType = Typ... | 49 | 1,390 |
gunicorn | tests/test_asgi_websocket_protocol.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
WebSocket RFC 6455 compliance tests.
Tests that gunicorn's WebSocket implementation conforms to RFC 6455:
https://tools.ietf.org/html/rfc6455
"""
import base64
import hashlib
import struct
from unittest impor... | 1,039 | 36,469 |
onnxruntime | orttraining/orttraining/test/python/_test_commons.py | .py | import os
import subprocess
import sys
def is_windows():
return sys.platform.startswith("win")
def run_subprocess(args, cwd=None, capture=False, dll_path=None, shell=False, env={}, log=None): # noqa: B006
if log:
log.info(f"Running subprocess in '{cwd or os.getcwd()}'\n{args}")
my_env = os.envi... | 30 | 999 |
saleor | saleor/graphql/account/mutations/staff/customer_delete.py | .py | import graphene
from .....account import models
from .....attribute.utils import delete_user_unique_attribute_values
from .....core.tracing import traced_atomic_transaction
from .....giftcard.utils import deactivate_assigned_gift_cards
from .....permission.enums import AccountPermissions
from .....webhook.event_types ... | 61 | 2,362 |
mlflow | mlflow/keras/save.py | .py | """Functions for saving Keras models to MLflow."""
import importlib
import logging
import os
import shutil
import tempfile
from typing import Any
import keras
import yaml
import mlflow
from mlflow import pyfunc
from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException
from mlflow.models import (
Mod... | 366 | 13,032 |
beam | sdks/python/apache_beam/examples/dataframe/flight_delays_it_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... | 140 | 5,481 |
pyomo | examples/pyomobook/scripts-ch/sudoku/sudoku_run.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... | 63 | 1,579 |
wandb | wandb/sdk/internal/_generated/server_features_query.py | .py | # Generated by ariadne-codegen
# Source: tools/graphql_codegen/utils/
from __future__ import annotations
from pydantic import Field
from wandb._pydantic import GQLResult
class ServerFeaturesQuery(GQLResult):
server_info: ServerFeaturesQueryServerInfo | None = Field(alias="serverInfo")
class ServerFeaturesQue... | 26 | 614 |
scikit-bio | skbio/stats/evolve/_hommola.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.
# --------------------------------------------... | 275 | 11,227 |
mlflow | tests/genai/judges/utils/test_parsing_utils.py | .py | import pytest
from mlflow.genai.judges.utils.parsing_utils import (
_sanitize_justification,
_strip_markdown_code_blocks,
)
def test_strip_markdown_no_markdown_returns_unchanged():
response = '{"result": "yes", "rationale": "looks good"}'
assert _strip_markdown_code_blocks(response) == response
def... | 171 | 5,069 |
confluent-kafka-python | tests/avro/test_avro_producer.py | .py | #!/usr/bin/env python
#
# Copyright 2016 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 127 | 6,156 |
beam | learning/tour-of-beam/learning-content/core-transforms/motivating-challenge-1/python-solution/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... | 71 | 2,593 |
textual | docs/examples/widgets/text_area_example.py | .py | from textual.app import App, ComposeResult
from textual.widgets import TextArea
TEXT = """\
def hello(name):
print("hello" + name)
def goodbye(name):
print("goodbye" + name)
"""
class TextAreaExample(App):
def compose(self) -> ComposeResult:
yield TextArea.code_editor(TEXT, language="python")
... | 21 | 385 |
wandb | wandb/apis/_generated/is_project_read_only.py | .py | # Generated by ariadne-codegen
# Source: tools/graphql_codegen/api/
from __future__ import annotations
from pydantic import Field
from wandb._pydantic import GQLResult
class IsProjectReadOnly(GQLResult):
project: IsProjectReadOnlyProject | None
class IsProjectReadOnlyProject(GQLResult):
read_only: bool |... | 20 | 388 |
probability | tensorflow_probability/python/bijectors/identity_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... | 61 | 2,258 |
ipython | IPython/testing/ipunittest.py | .py | """Experimental code for cleaner support of IPython syntax with unittest.
In IPython up until 0.10, we've used very hacked up nose machinery for running
tests with IPython special syntax, and this has proved to be extremely slow.
This module provides decorators to try a different approach, stemming from a
conversation... | 188 | 6,710 |
wandb | wandb/automations/_run_metric_filters.py | .py | from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Annotated, Any, Final, Literal, TypeAlias, overload
from pydantic import (
Field,
PositiveFloat,
PositiveInt,
StrictFloat,
StrictInt,
field_validator,
)
from typing_extensions import overri... | 513 | 19,405 |
wagtail | wagtail/contrib/forms/forms.py | .py | from collections import OrderedDict
import django.forms
from django.conf import settings
from django.utils.html import conditional_escape
from django.utils.translation import gettext_lazy as _
from wagtail.admin.forms import WagtailAdminPageForm
from wagtail.compat import URLField
def _split_by_newline_or_comma(val... | 252 | 9,551 |
pyomo | doc/OnlineDocs/src/scripting/NodesIn_init.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 20 | 752 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.