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 |
|---|---|---|---|---|---|
pyomo | doc/OnlineDocs/src/dataportal/dataportal_tab.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... | 333 | 9,923 |
probability | tensorflow_probability/python/util/__init__.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... | 34 | 1,419 |
coremltools | coremltools/converters/mil/mil/ops/tests/iOS16/test_constexpr_ops.py | .py | # Copyright (c) 2022, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import itertools
import numpy as np
import pytest
import coremltools as ct
from coremltools.convert... | 699 | 25,788 |
gunicorn | tests/requests/invalid/005.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.http.errors import InvalidHeaderName
request = InvalidHeaderName | 6 | 184 |
readthedocs.org | readthedocs/integrations/models.py | .py | """Integration models for external services."""
import json
import re
import uuid
from dataclasses import dataclass
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db ... | 466 | 15,398 |
wagtail | wagtail/admin/ui/menus/__init__.py | .py | class MenuItem:
"""
Describes a simple menu item in the Wagtail admin interface, which may be
used in different contexts, e.g. inside dropdowns or as a standalone item.
This class does not define how it should be rendered; that is up to the menu
renderer to use the description provided here.
"""... | 26 | 934 |
onnxruntime | orttraining/orttraining/python/training/ortmodule/_custom_op_symbolic_registry.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import os
from collections.abc import Callable
import torch
import torc... | 997 | 42,027 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_loop.py | .py | # ref: https://www.paddlepaddle.org.cn/tutorials/projectdetail/1998893#anchor-2
import os
import sys
import numpy as np
import paddle
from save_model import exportModel, saveModel
def loop():
paddle.enable_static()
x = np.full(shape=[1], fill_value=0, dtype='int64')
def cond(i, ten):
return te... | 301 | 8,999 |
pyomo | doc/OnlineDocs/src/data/param4.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... | 25 | 840 |
saleor | saleor/checkout/webhooks/calculate_taxes.py | .py | import logging
from typing import TYPE_CHECKING, Any, Union
import graphene
from promise import Promise
from ...app.models import App
from ...core.db.connection import allow_writer
from ...core.prices import quantize_price
from ...core.taxes import TaxData
from ...discount.utils.voucher import is_order_level_voucher
... | 189 | 6,195 |
mlflow | tests/keras/test_callback.py | .py | import math
import re
import keras
import numpy as np
import mlflow
from mlflow.keras.callback import MlflowCallback
from mlflow.tracking.fluent import flush_async_logging
def test_keras_mlflow_callback_log_every_epoch():
# Prepare data for a 2-class classification.
data = np.random.uniform(size=(20, 28, 28... | 119 | 4,027 |
pyomo | pyomo/contrib/appsi/examples/getting_started.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... | 69 | 2,357 |
saleor | saleor/tests/e2e/account/account/test_should_not_be_able_to_create_account_with_existing_email.py | .py | import pytest
from .....account.models import User
from ...shop.utils import prepare_shop
from ...utils import assign_permissions
from ..utils import account_register, raw_account_register
@pytest.mark.e2e
def test_should_not_be_able_to_create_account_with_existing_email_core_1503(
e2e_not_logged_api_client,
... | 65 | 1,861 |
readthedocs.org | readthedocs/rtd_tests/files/conf.py | .py | # -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from datetime import datetime
from recommonmark.parser import CommonMarkParser
extensions = []
templates_path = ["templates", "_templates", ".templates"]
source_suffix = [".rst", ".md"]
source_parsers = {
".md": CommonMark... | 28 | 668 |
structlog | src/structlog/typing.py | .py | # SPDX-License-Identifier: MIT OR Apache-2.0
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the MIT License. See the LICENSE file in the root of this
# repository for complete details.
"""
Type information used throughout *structlog*.
For now, they are considered provisional. ... | 332 | 8,585 |
beam | learning/katas/python/Introduction/Hello Beam/Hello Beam/__init__.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... | 19 | 788 |
kombu | kombu/utils/compat.py | .py | """Python Compatibility Utilities."""
from __future__ import annotations
import numbers
import sys
from contextlib import contextmanager
from functools import wraps
from importlib import metadata as importlib_metadata
from io import UnsupportedOperation
from kombu.exceptions import reraise
FILENO_ERRORS = (Attribut... | 154 | 3,951 |
coveragepy | coverage/__main__.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
"""Coverage.py's main entry point."""
from __future__ import annotations
import sys
from coverage.cmdline import main
sys.exit(main())
| 13 | 297 |
sqlmap | tests/test_progress.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
The textual progress bar (lib/utils/progress.py) used during multi-item
extraction. Pure rendering/clamping logic plus ETA formatting.
"""
import os
import re
import sys
import time
... | 210 | 8,511 |
pyomo | pyomo/contrib/alternative_solutions/tests/test_lp_enum.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... | 106 | 3,987 |
wandb | tests/unit_tests/test_wandb_agent/conftest.py | .py | """Fixtures and helpers for sweep agent unit tests."""
from __future__ import annotations
import contextlib
import dataclasses
import multiprocessing
import queue
from collections.abc import Callable, Iterator
from pathlib import Path
from typing import Any
from unittest import mock
import pytest
import wandb
import... | 223 | 7,239 |
mlflow | dev/pypi/tests/test_client.py | .py | from __future__ import annotations
import asyncio
import json
import threading
from collections.abc import Iterator
from contextlib import contextmanager
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from typing import Any
from unittest import mock
import pypi
import pytest
from packaging.versio... | 159 | 5,081 |
lemur | lemur/policies/service.py | .py | """
.. module: lemur.policies.service
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from lemur import database
from lemur.policies.models import RotationPolicy
def get(po... | 72 | 1,390 |
wagtail | wagtail/admin/views/account.py | .py | from collections import OrderedDict
from functools import cached_property
from django.conf import settings
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth import views as auth_views
from django.db import transaction
from django.forms import Media
from django.http import Http404
from d... | 444 | 14,321 |
pdm | src/pdm/cli/commands/add.py | .py | from __future__ import annotations
import argparse
from typing import TYPE_CHECKING
from pdm.cli.commands.base import BaseCommand
from pdm.cli.filters import GroupSelection
from pdm.cli.hooks import HookManager
from pdm.cli.options import (
dry_run_option,
frozen_lockfile_option,
install_group,
lockfi... | 203 | 7,956 |
pyomo | pyomo/contrib/viewer/pyomo_viewer.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 66 | 2,436 |
textual | tests/snapshot_tests/snapshot_apps/dock_scroll.py | .py | from textual.app import App
from textual.widgets import Header, Label, Footer
class TestApp(App):
BINDINGS = [("ctrl+q", "app.quit", "Quit")]
CSS = """
Label {
border: solid red;
}
Footer {
height: 4;
}
"""
def compose(self):
text = (
"this is ... | 29 | 531 |
wandb | tests/unit_tests/test_asyncio_compat.py | .py | from __future__ import annotations
import asyncio
from collections.abc import Coroutine
from typing import Any
import pytest
from wandb.sdk.lib import asyncio_compat
async def _fail_after_timeout(
coro: Coroutine[Any, Any, Any],
failure_message: str,
) -> None:
try:
await asyncio.wait_for(coro, ... | 324 | 8,397 |
scikit-bio | skbio/io/format/tests/test_fastq.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.
# --------------------------------------------... | 676 | 28,821 |
conda | tests/env/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from os.path import dirname, join
def support_file(filename):
return join(dirname(__file__), "support", filename)
def remote_support_file(filename, port: int):
assert port is not None
return f"http://127.0.0.1:{port}/{filename}"
| 13 | 320 |
mlflow | tests/gateway/providers/test_mistral.py | .py | import math
from unittest import mock
import pytest
from aiohttp import ClientTimeout
from fastapi.encoders import jsonable_encoder
from pydantic import ValidationError
from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS
from mlflow.gateway.config import EndpointConfig
from mlflow.gateway.ex... | 447 | 14,753 |
confluent-kafka-python | tests/integration/share_consumer_oauth/unsecured_token.py | .py | """
Token helper for OAUTHBEARER integration tests.
Produces unsigned JWTs that Apache Kafka's
OAuthBearerUnsecuredValidatorCallbackHandler (KIP-255) accepts. Used by
the share_consumer_oauth/ tests against the trivup OAUTHBEARER fixture.
Defaults use sub="admin" and scope="requiredScope" because trivup's
unsecured l... | 73 | 2,561 |
onnxruntime | onnxruntime/test/testdata/node_output_not_used.py | .py | import onnx
from onnx import TensorProto, helper
def create_model_with_node_output_not_used(model_path):
# Create graph
x = helper.make_tensor_value_info("X", TensorProto.FLOAT, [3, 2])
w = helper.make_tensor_value_info("W", TensorProto.FLOAT, [2, 3])
y = helper.make_tensor_value_info("Y", TensorProto... | 44 | 1,161 |
onnxruntime | tools/ci_build/test_build_args.py | .py | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import sys
import unittest
from pathlib import Path
from unittest import mock
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "python"))
sys.path.insert(0, str(Path(__file__).resolve().par... | 60 | 2,521 |
probability | tensorflow_probability/python/distributions/transformed_distribution.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... | 775 | 34,368 |
beam | learning/tour-of-beam/learning-content/core-transforms/combine/simple-function/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... | 62 | 1,724 |
wagtail | wagtail/admin/widgets/boolean_radio_select.py | .py | from django import forms
from django.utils.translation import gettext_lazy as _
class BooleanRadioSelect(forms.RadioSelect):
"""
A radio select widget for boolean fields. Displays as three options; "All", "Yes" and "No".
"""
input_type = "radio"
def __init__(self, attrs=None):
choices = ... | 41 | 1,021 |
coremltools | coremltools/converters/mil/frontend/torch/test/test_torch_export_conversion_api.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
from sys import version_info
import numpy as np
import pytest
from ..utils import ... | 810 | 31,797 |
kafka | tests/kafkatest/services/console_share_consumer.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 ... | 276 | 13,439 |
black | tests/test_black.py | .py | #!/usr/bin/env python3
import asyncio
import inspect
import io
import itertools
import logging
import multiprocessing
import os
import pickle
import re
import sys
import textwrap
import types
from collections.abc import Callable, Iterator, Sequence
from concurrent.futures import ThreadPoolExecutor
from contextlib impo... | 3,459 | 137,956 |
astropy | astropy/cosmology/_src/io/builtin/html.py | .py | r"""|Cosmology| <-> html I/O, using |Cosmology.read| and |Cosmology.write|.
We assume the following setup:
>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> temp_dir = TemporaryDirectory()
Writing a cosmology to a html file will produce a table with the cosmology's type,
name, ... | 372 | 12,394 |
mlflow | mlflow/protos/datasets_pb2.py | .py |
import google.protobuf
from packaging.version import Version
if Version(google.protobuf.__version__).major >= 5:
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: datasets.proto
# Protobuf Python Version: 5.26.0
"""Generated protocol buffer code."""
from google.pr... | 99 | 6,917 |
beam | sdks/python/apache_beam/examples/ml_transform/mltransform_image_embedding_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... | 106 | 3,502 |
textual | tests/test_on.py | .py | from __future__ import annotations
from dataclasses import dataclass
import pytest
from textual import on
from textual._on import OnDecoratorError
from textual.app import App, ComposeResult
from textual.events import Enter, Leave
from textual.message import Message
from textual.widget import Widget
from textual.widg... | 381 | 10,866 |
openvino | tests/e2e_tests/common/common/pipeline.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import e2e_tests.common.readers
import e2e_tests.common.preprocessors
import e2e_tests.common.preprocessors_tf_hub
import e2e_tests.common.ir_provider
import e2e_tests.common.infer
import e2e_tests.common.postprocessors
import e2e_tests.... | 65 | 2,676 |
loguru | tests/exceptions/source/diagnose/source_strings.py | .py | # fmt: off
import sys
from loguru import logger
logger.remove()
logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True)
a = b = 0
try:
a + b"prefix" + 'single' + """triple""" + 1 + b
except TypeError:
logger.exception("")
| 16 | 260 |
coremltools | deps/pybind11/tests/test_callbacks.py | .py | from __future__ import annotations
import time
from threading import Thread
import pytest
import env # noqa: F401
from pybind11_tests import callbacks as m
from pybind11_tests import detailed_error_messages_enabled
def test_callbacks():
from functools import partial
def func1():
return "func1"
... | 228 | 6,991 |
onnxruntime | tools/python/wgsl_template/code_generator/static_cpp.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Static C++ code generator.
The single :class:`StaticCodeGenerator` class implements both
``static-cpp`` (uses a string table) and ``static-cpp-literal``
(inlines string literals); the only difference is the constructor
fla... | 356 | 13,675 |
astropy | astropy/utils/exceptions.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains errors/exceptions and warnings of general use for
astropy. Exceptions that are specific to a given subpackage should *not* be
here, but rather in the particular subpackage.
"""
__all__ = [
"AstropyBackwardsIncompatibleChangeWa... | 95 | 2,502 |
scikit-bio | skbio/stats/ordination/tests/test_correspondence_analysis.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.
# --------------------------------------------... | 462 | 15,955 |
saleor | saleor/graphql/app/mutations/app_fetch_manifest.py | .py | import graphene
import requests
from django.conf import settings
from django.core.exceptions import ValidationError
from ....app.error_codes import AppErrorCode
from ....app.installation_utils import fetch_brand_data, fetch_manifest
from ....app.manifest_validations import clean_manifest_data, clean_manifest_url
from ... | 123 | 4,929 |
httpie | extras/scripts/generate_man_pages.py | .py | import os
import re
from contextlib import contextmanager
from pathlib import Path
from typing import Optional, Iterator, Iterable
# So that httpie.cli.definition can provide man-page-specific output. Must be set before importing httpie.
os.environ['HTTPIE_BUILDING_MAN_PAGES'] = '1'
import httpie
from httpie.cli.def... | 189 | 6,042 |
returns | returns/methods/cond.py | .py | from typing import TypeVar, overload
from returns.context import NoDeps
from returns.interfaces.failable import DiverseFailableN, SingleFailableN
from returns.primitives.hkt import KindN, kinded
_ValueType = TypeVar('_ValueType')
_ErrorType = TypeVar('_ErrorType')
_SingleFailableKind = TypeVar('_SingleFailableKind',... | 84 | 2,500 |
beam | sdks/python/apache_beam/runners/portability/flink_uber_jar_job_server_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... | 231 | 8,773 |
kombu | t/unit/transport/test_mongodb.py | .py | from __future__ import annotations
from datetime import datetime, timedelta, timezone
from queue import Empty
from unittest.mock import MagicMock, call, patch
import pytest
from kombu import Connection
pymongo = pytest.importorskip('pymongo')
# must import following after above validation to avoid error
# and skip... | 678 | 23,511 |
pyomo | doc/OnlineDocs/tests/test_html.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... | 158 | 6,112 |
gunicorn | tests/docker/dirty_ttin_ttou/gunicorn_conf.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Gunicorn configuration for TTIN/TTOU testing."""
bind = "0.0.0.0:8000"
workers = 2
worker_class = "gthread"
threads = 2
# Dirty arbiter config
dirty_apps = [
"app:UnlimitedTask",
"app:LimitedTask", # ... | 24 | 444 |
onnxruntime | onnxruntime/python/tools/transformers/fusion_embedlayer.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from logging import getLogger
from fusion_base import Fusion
from fusi... | 811 | 35,864 |
astropy | astropy/io/__init__.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains modules and packages for interpreting data storage
formats used by and in astropy.
"""
| 6 | 180 |
textual | docs/examples/how-to/layout.py | .py | from textual.app import App, ComposeResult
from textual.containers import HorizontalScroll, VerticalScroll
from textual.screen import Screen
from textual.widgets import Placeholder
class Header(Placeholder):
DEFAULT_CSS = """
Header {
height: 3;
dock: top;
}
"""
class Footer(Placehol... | 70 | 1,302 |
cvxpy | cvxpy/tests/test_valinvec2mixedint.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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 411 | 14,232 |
openvino | src/bindings/python/src/openvino/opset3/ops.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Factory functions for all openvino ops."""
from typing import Optional, Union
import numpy as np
from functools import partial
from openvino import Node, Shape
from openvino.op import Constant, Parameter
from... | 637 | 24,245 |
scikit-bio | skbio/tree/_compare.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.
# --------------------------------------------... | 549 | 18,092 |
openvino | tests/layer_tests/tensorflow_lite_tests/test_tfl_Cumsum.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.tflite_layer_test_class import TFLiteLayerTest
test_params = [
{'input_shape': [2], 'axis':-1, 'exclusive': False, 'reverse': False},
{'input_shape': [2, 3],... | 42 | 1,605 |
kafka | tests/kafkatest/tests/core/share_group_command_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 ... | 126 | 5,716 |
textual | tests/selection_list/test_selection_click_checkbox.py | .py | """See https://github.com/Textualize/textual/pull/2930 for the introduction of these tests."""
from textual import on
from textual.app import App, ComposeResult
from textual.geometry import Offset
from textual.widgets import SelectionList
class SelectionListApp(App[None]):
"""Test selection list application."""
... | 43 | 1,520 |
metrics | tests/unittests/regression/test_tweedie_deviance.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... | 160 | 6,154 |
mlflow | mlflow/assistant/providers/openai_compatible.py | .py | """Generic OpenAI-compatible chat-completions provider for MLflow Assistant.
Drives any server that exposes `POST /v1/chat/completions` in OpenAI SSE form:
MLflow AI Gateway, Ollama (via its `/v1` shim), vLLM, LM Studio, etc.
:class:`OpenAICompatibleProvider` owns the shared streaming/tool-loop
machinery. Concrete pr... | 779 | 36,964 |
coremltools | coremltools/test/neural_network/test_custom_neural_nets.py | .py | # Copyright (c) 2021, 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 os
import tempfile
import unittest
import numpy as np
import coremltools
import coremltools.mod... | 90 | 3,320 |
probability | tensorflow_probability/python/internal/broadcast_util.py | .py | # Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 89 | 3,600 |
astropy | astropy/table/mixins/tests/test_dask.py | .py | import numpy as np
import pytest
from numpy.testing import assert_equal
from astropy.table import Table
da = pytest.importorskip("dask.array")
class TestDaskHandler:
def setup_method(self, method):
self.t = Table()
self.t["a"] = da.arange(10)
def test_add_row(self):
self.t.add_row(s... | 71 | 2,041 |
saleor | saleor/tests/e2e/orders/utils/order_fulfill.py | .py | from ...utils import get_graphql_content
ORDER_FULFILL_MUTATION = """
mutation orderFulfill ($order: ID!, $input: OrderFulfillInput!) {
orderFulfill(order: $order, input: $input) {
order {
status
fulfillments {
id
status
created
}
id
}
fulfillments {
... | 50 | 813 |
mlflow | mlflow/protos/databricks_pb2.py | .py |
import google.protobuf
from packaging.version import Version
if Version(google.protobuf.__version__).major >= 5:
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: databricks.proto
# Protobuf Python Version: 5.26.0
"""Generated protocol buffer code."""
from google.... | 268 | 23,797 |
textual | docs/examples/styles/height_comparison.py | .py | from textual.app import App
from textual.containers import VerticalScroll
from textual.widgets import Label, Placeholder, Static
class Ruler(Static):
def compose(self):
ruler_text = "·\n·\n·\n·\n•\n" * 100
yield Label(ruler_text)
class HeightComparisonApp(App):
CSS_PATH = "height_comparison.... | 33 | 817 |
pyomo | pyomo/core/tests/unit/test_symbolic.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... | 422 | 12,591 |
coveragepy | tests/test_collector.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
"""Tests of coverage/collector.py and other collectors."""
from __future__ import annotations
import os.path
import coverage
from tests.coveragetest import Co... | 59 | 1,698 |
pyomo | pyomo/solvers/tests/mip/test_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... | 167 | 5,365 |
pyomo | pyomo/common/tests/moved.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 16 | 641 |
beam | playground/infrastructure/test_helper.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 ... | 818 | 24,032 |
probability | spinoffs/inference_gym/inference_gym/internal/ground_truth_encoding_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... | 73 | 2,310 |
beam | sdks/python/apache_beam/typehints/intrinsic_one_ops.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... | 101 | 2,479 |
cvxpy | cvxpy/tests/test_dqcp.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
... | 838 | 32,040 |
pyro | tests/infer/mcmc/test_mcmc_util.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from functools import partial
import pytest
import torch
import pyro
import pyro.distributions as dist
from pyro.infer import Predictive
from pyro.infer.autoguide import (
init_to_feasible,
init_to_generated,
init_to_... | 139 | 4,106 |
wandb | tests/unit_tests/test_launch/test_builder/test_docker.py | .py | import platform
from unittest.mock import MagicMock
import pytest
from wandb.sdk.launch._project_spec import EntryPoint
from wandb.sdk.launch.builder.docker_builder import DockerBuilder
from wandb.sdk.launch.registry.local_registry import LocalRegistry
@pytest.fixture
def mock_ecr_registry(monkeypatch):
monkeypa... | 126 | 3,664 |
django-cms | menus/templatetags/menu_tags.py | .py | from urllib.parse import unquote
from classytags.arguments import Argument, IntegerArgument, StringArgument
from classytags.core import Options
from classytags.helpers import InclusionTag
from django import template
from django.contrib.sites.models import Site
from django.urls import NoReverseMatch, reverse
from djang... | 442 | 15,996 |
saleor | saleor/tests/e2e/attributes/utils/update_attribute.py | .py | from ...utils import get_graphql_content
ATTRIBUTE_UPDATE_MUTATION = """
mutation updateAttribute(
$id: ID!, $input: AttributeUpdateInput!
) {
attributeUpdate(
id: $id,
input: $input) {
errors {
field
message
code
}
... | 59 | 1,381 |
coremltools | coremltools/converters/mil/mil/ops/defs/iOS17/image_resizing.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 numpy as np
from coremltools.converters.mil.mil import Operation, get_new_symbol, types
from ... | 347 | 14,849 |
readthedocs.org | readthedocs/sso/apps.py | .py | """Single Sign On (SSO) app."""
from django.apps import AppConfig
class SsoConfig(AppConfig):
name = "readthedocs.sso"
| 8 | 126 |
hydra | examples/configure_hydra/job_name/no_config_file_override.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from omegaconf import DictConfig
import hydra
from hydra.core.hydra_config import HydraConfig
@hydra.main()
def experiment(_cfg: DictConfig) -> None:
print(HydraConfig.get().job.name)
if __name__ == "__main__":
experiment()
| 15 | 308 |
astropy | astropy/visualization/wcsaxes/__init__.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# The following few lines skip this module when running tests if matplotlib is
# not available (and will have no impact otherwise)
try:
import pytest
pytest.importorskip("matplotlib")
del pytest
except ImportError:
pass
from astropy imp... | 50 | 1,264 |
beam | sdks/python/apache_beam/yaml/integration_tests.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 1,040 | 37,441 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_abs.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# fill_const paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
def abs(name : str, x):
paddle.enable_static()
with paddle.static.program_guard(paddle.static.Program(), paddl... | 40 | 1,250 |
openvino | tests/layer_tests/pytorch_tests/test_embedding.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from pytorch_layer_test_class import PytorchLayerTest
class TestEmbedding(PytorchLayerTest):
def _prepare_input(self, indicies_size, indicies_dtype):
return (self.random.randint(0, 9, size=indicies_size, dtyp... | 33 | 1,159 |
python-prompt-toolkit | src/prompt_toolkit/output/defaults.py | .py | from __future__ import annotations
import sys
from typing import TYPE_CHECKING, TextIO, cast
from prompt_toolkit.utils import (
get_bell_environment_variable,
get_term_environment_variable,
is_conemu_ansi,
)
from .base import DummyOutput, Output
from .color_depth import ColorDepth
from .plain_text import... | 107 | 3,689 |
beam | sdks/python/apache_beam/examples/complete/estimate_pi.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... | 124 | 4,321 |
readthedocs.org | readthedocs/search/admin.py | .py | """SearchQuery Admin classes."""
from django.contrib import admin
from .models import SearchQuery
@admin.register(SearchQuery)
class SearchQueryAdmin(admin.ModelAdmin):
raw_id_fields = ("project", "version")
list_filter = ("created",)
list_display = ("__str__", "created")
search_fields = ("project__... | 16 | 468 |
luigi | luigi/safe_extractor.py | .py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | 98 | 3,567 |
biopython | Bio/Align/nexus.py | .py | # Copyright 2006-2016 by Peter Cock. All rights reserved.
# Revisions copyright 2021 by Michiel de Hoon.
#
# 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 ... | 195 | 7,330 |
gunicorn | tests/requests/valid/rfc9110_body_framing_get_cl_zero_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9110 section 8.6: Content-Length: 0 on GET is valid.
request = {
"method": "GET",
"uri": uri("/foo"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
("CONTENT-LENGTH"... | 16 | 354 |
pyomo | examples/pyomo/suffixes/duals_script.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,927 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.