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 | pyomo/gdp/transformed_disjunct.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... | 31 | 1,287 |
pyro | tests/contrib/epidemiology/test_models.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import logging
import math
import pytest
import torch
import pyro
import pyro.distributions as dist
from pyro.contrib.epidemiology.models import (
HeterogeneousRegionalSIRModel,
HeterogeneousSIRModel,
OverdispersedSEIRMod... | 683 | 22,313 |
beam | sdks/python/apache_beam/dataframe/pandas_docs_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... | 156 | 4,581 |
wagtail | wagtail/documents/rich_text/__init__.py | .py | from django.utils.html import escape
from wagtail.documents import get_document_model
from wagtail.rich_text import LinkHandler
# Front-end conversion
class DocumentLinkHandler(LinkHandler):
identifier = "document"
@staticmethod
def get_model():
return get_document_model()
@classmethod
... | 31 | 854 |
mlflow | mlflow/bedrock/stream.py | .py | import json
import logging
from typing import Any
from botocore.eventstream import EventStream
from mlflow.bedrock.utils import (
capture_exception,
parse_complete_token_usage_from_response,
parse_partial_token_usage_from_response,
)
from mlflow.entities.span import LiveSpan
from mlflow.entities.span_even... | 217 | 7,875 |
probability | tensorflow_probability/python/bijectors/real_nvp_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... | 367 | 12,228 |
metrics | tests/unittests/classification/test_auroc.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... | 435 | 18,459 |
saleor | saleor/graphql/core/types/order_or_checkout.py | .py | import graphene
from ....checkout.models import Checkout
from ....order.models import Order
from ...checkout import types as checkout_types
from ...order import types as order_types
from ..context import SyncWebhookControlContext
# The file hasn't been attached to the __init__ file as it generates the circular
# grap... | 37 | 1,135 |
funcy | tests/test_objects.py | .py | import sys
import pytest
from funcy.objects import *
from funcy import suppress
### @cached_property
def test_cached_property():
calls = [0]
class A(object):
@cached_property
def prop(self):
calls[0] += 1
return 7
a = A()
assert a.prop == 7
assert a.prop ... | 157 | 2,799 |
wagtail | wagtail/documents/widgets.py | .py | from wagtail.documents.views.chooser import viewset as chooser_viewset
AdminDocumentChooser = chooser_viewset.widget_class
| 4 | 124 |
pynacl | src/nacl/__init__.py | .py | # Copyright 2013 Donald Stufft and individual contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 26 | 781 |
textual | docs/examples/guide/screens/modal03.py | .py | from textual.app import App, ComposeResult
from textual.containers import Grid
from textual.screen import ModalScreen
from textual.widgets import Button, Footer, Header, Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit... | 58 | 1,666 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/combinevalues_side_inputs_dict.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");... | 74 | 2,202 |
textual | src/textual/widgets/data_table.py | .py | from textual.widgets._data_table import (
CellDoesNotExist,
CellKey,
CellType,
Column,
ColumnDoesNotExist,
ColumnKey,
CursorType,
DuplicateKey,
Row,
RowDoesNotExist,
RowKey,
StringKey,
)
__all__ = [
"CellDoesNotExist",
"CellKey",
"CellType",
"Column",
... | 30 | 465 |
saleor | saleor/graphql/core/doc_category.py | .py | DOC_CATEGORY_APPS = "Apps"
DOC_CATEGORY_ATTRIBUTES = "Attributes"
DOC_CATEGORY_AUTH = "Authentication"
DOC_CATEGORY_CHANNELS = "Channels"
DOC_CATEGORY_CHECKOUT = "Checkout"
DOC_CATEGORY_DISCOUNTS = "Discounts"
DOC_CATEGORY_GIFT_CARDS = "Gift cards"
DOC_CATEGORY_MENU = "Menu"
DOC_CATEGORY_MISC = "Miscellaneous"
DOC_CATE... | 103 | 4,730 |
probability | tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_adjoint.py | .py | # Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved.
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`.
# DO NOT MODIFY DIRECTLY.
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | 275 | 9,797 |
mlflow | examples/gateway/cohere/example.py | .py | from mlflow.deployments import get_deploy_client
def main():
client = get_deploy_client("http://localhost:7000")
print(f"Cohere endpoints: {client.list_endpoints()}\n")
print(f"Cohere completions endpoint info: {client.get_endpoint(endpoint='completions')}\n")
# Completions request
response_comp... | 30 | 905 |
qutip | qutip/tests/solver/test_stochastic_system.py | .py | import numpy as np
from qutip import (
qeye, num, destroy, create, QobjEvo, Qobj,
basis, rand_herm, fock_dm, liouvillian, operator_to_vector
)
from qutip.solver.sode.ssystem import *
from qutip.solver.sode.ssystem import SimpleStochasticSystem, StochasticClosedSystem
import qutip.core.data as _data
import pytes... | 180 | 5,657 |
beam | sdks/python/apache_beam/runners/interactive/testing/mock_ipython.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... | 68 | 2,254 |
probability | tensorflow_probability/python/experimental/mcmc/run.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... | 265 | 11,659 |
probability | tensorflow_probability/python/math/psd_kernels/spectral_mixture_test.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... | 126 | 4,836 |
clearml | examples/hyperdatasets/legacy/data-ingestion/pytorch_dataset_example_with_masks.py | .py | import numpy as np
import torch.utils.data
from allegroai import DataView, FrameGroup, Task
from PIL import Image
from torch.utils.data import DataLoader
class ExampleDataset(torch.utils.data.Dataset):
def __init__(self, dv):
# automatically adjust dataset to balance all queries
self.frames = dv.t... | 56 | 1,600 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_strided_slice.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# strided_slice paddle model generator
#
import numpy as np
from save_model import saveModel
import sys
def strided_slice(name: str, input_data, attrs: dict):
import paddle
paddle.enable_static()
with paddle.static.prog... | 156 | 5,525 |
astropy | astropy/_dev/scm_version.py | .py | # Try to use setuptools_scm to get the current version; this is only used
# in development installations from the git repository.
from pathlib import Path
try:
from setuptools_scm import get_version
version = get_version(root=Path(__file__).parents[2])
except Exception:
raise ImportError("setuptools_scm b... | 11 | 345 |
hydra | plugins/hydra_ax_sweeper/example/banana.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
from typing import Any
import hydra
from omegaconf import DictConfig
log = logging.getLogger(__name__)
@hydra.main(config_path="conf", config_name="config")
def banana(cfg: DictConfig) -> Any:
x = cfg.banana.x
y = cfg.bana... | 24 | 498 |
openvino | tests/layer_tests/pytorch_tests/test_rope_pattern.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Test Rotary Position Embedding (RoPE) pattern with complex tensors.
"""
import pytest
import torch
from pytorch_layer_test_class import PytorchLayerTest
class TestRoPEPattern(PytorchLayerTest):
"""Test RoPE pattern: complex bu... | 120 | 4,385 |
openvino | tests/layer_tests/jax_tests/test_slice.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
class TestSlice(JaxLayerTest):
def _prepare_input(self):
inp = jnp.array(np.random.rand(*self.... | 82 | 2,810 |
wandb | wandb/sdk/artifacts/_generated/add_artifact_collection_tags.py | .py | # Generated by ariadne-codegen
# Source: tools/graphql_codegen/artifacts/
from __future__ import annotations
from wandb._pydantic import GQLResult
from .fragments import TagFragment
class AddArtifactCollectionTags(GQLResult):
result: AddArtifactCollectionTagsResult | None
class AddArtifactCollectionTagsResul... | 21 | 454 |
beam | sdks/python/apache_beam/io/parquetio_it_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 189 | 6,225 |
sqlmap | plugins/dbms/mssqlserver/filesystem.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import codecs
import ntpath
import os
from lib.core.common import checkFile
from lib.core.common import getLimitRange
from lib.core.common import isNumPosStrValue
from lib.core.c... | 428 | 17,330 |
conda | conda/plugins/prefix_data_loaders/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from . import pypi
plugins = [pypi]
| 6 | 112 |
confluent-kafka-python | tests/integration/share_consumer/test_share_consumer_callbacks.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 requi... | 329 | 12,817 |
textual | tests/command_palette/test_worker_interference.py | .py | """Tests for https://github.com/Textualize/textual/issues/3615"""
from asyncio import sleep
from textual import work
from textual.app import App
from textual.command import Hit, Hits, Provider
class SimpleSource(Provider):
async def search(self, query: str) -> Hits:
def goes_nowhere_does_nothing() -> No... | 51 | 1,480 |
onnxruntime | onnxruntime/test/python/transformers/test_cuda_plugin_ep.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import json
import os
import tempfile
import unittest
from contextlib import contextmanager
import numpy as np
import torch
import torch.nn.functional as F
from cuda_plugin_ep_helper import CUDA_PLUGIN_EP_NAME, ensure_cuda_p... | 3,105 | 132,936 |
hatch | tests/backend/builders/utils.py | .py | from hatchling.builders.plugin.interface import BuilderInterface
class MockBuilder(BuilderInterface): # no cov
def get_version_api(self):
return {}
| 7 | 163 |
astropy | astropy/io/registry/core.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import sys
from typing import TypeVar, overload
from .base import IORegistryError, _UnifiedIORegistryBase
__all__ = ["UnifiedIORegistry", "UnifiedInputRegistry", "UnifiedOutputRegistry"]
PATH_TYPES = (str, os.PathLike) # TODO! include bytes... | 432 | 14,633 |
textual | docs/examples/styles/text_wrap.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear."""
class WrapApp(App):
CSS_PATH = "text_wrap.tcss"
def compose(self) -> ComposeResult:
yield... | 18 | 452 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_BatchToSpace.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
class TestBatchToSpace(CommonTFLayerTest):
def create_batch_to_space_net(self, in_shape, crops_value, block_shape_value):
import tensorflow as tf
... | 62 | 2,732 |
openvino | tests/e2e_tests/common/ir_provider/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from . import model_optimizer_runner, pregenerated | 4 | 133 |
coremltools | coremltools/test/lightgbm_tests/test_boosted_trees_classifier.py | .py | # Copyright (c) 2026, 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 unittest
import numpy as np
from coremltools._deps import _HAS_LIGHTGBM, _HAS_SKLEARN, MSG_LIGH... | 355 | 12,913 |
lemur | lemur/plugins/lemur_aws/acm.py | .py | """
.. module: lemur.plugins.lemur_aws.acm
:platform: Unix
:synopsis: Contains helper functions for interactive with AWS ACM Apis.
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Pinmarva <pinmarva@gmail.com>
"""
import botocor... | 182 | 5,297 |
wagtail | wagtail/admin/views/chooser.py | .py | import re
from collections import defaultdict
from urllib.parse import parse_qs, quote, urlencode, urlsplit
import swapper
from django.conf import settings
from django.core.paginator import InvalidPage, Paginator
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.template.respon... | 840 | 30,947 |
django-cms | cms/admin/settingsadmin.py | .py | import copy
import json
from functools import update_wrapper
from urllib.parse import urlparse
from django.contrib import admin
from django.db import transaction
from django.http import (
HttpResponse,
HttpResponseBadRequest,
HttpResponseRedirect,
)
from django.http.request import QueryDict
from django.url... | 157 | 6,139 |
wandb | tests/system_tests/test_core/test_mode_disabled_full.py | .py | """disabled mode test."""
import os
from unittest import mock
import pytest
import wandb
def test_disabled_noop(user):
"""Make sure that all objects are dummy objects in noop case."""
with wandb.init(mode="disabled") as run:
run.log(dict(this=2))
def test_disabled_dir():
tmp_dir = "/tmp/dir"
... | 129 | 3,514 |
textual | tests/document/test_wrapped_document.py | .py | import pytest
from textual.document._document import Document
from textual.document._wrapped_document import WrappedDocument
from textual.geometry import Offset
SIMPLE_TEXT = "123 4567\n12345\n123456789\n"
def test_wrap():
document = Document(SIMPLE_TEXT)
wrapped_document = WrappedDocument(document, width=4... | 205 | 5,879 |
saleor | saleor/graphql/webhook/types.py | .py | import graphene
from ...core import models as core_models
from ...webhook import models
from ...webhook.deprecated_event_types import WebhookEventType
from ...webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ..core import ResolveInfo
from ..core.connection import (
CountableConnection,
... | 258 | 9,427 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_Sub.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
class TestSub(CommonTFLayerTest):
def create_sub_placeholder_const_net(self, x_shape, y_shape, ir_version):
import tensorflow as tf
... | 269 | 11,563 |
astropy | astropy/io/fits/connect.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import re
import warnings
from copy import deepcopy
from itertools import pairwise
import numpy as np
from astropy import units as u
from astropy.io import registry as io_registry
from astropy.table import Column, MaskedColumn, Table, meta, s... | 528 | 19,802 |
saleor | saleor/tests/e2e/checkout/discounts/sales/test_checkout_product_on_fixed_sale.py | .py | import pytest
from ......product.tasks import recalculate_discounted_price_for_products_task
from ....product.utils.preparing_product import prepare_products
from ....sales.utils import (
create_sale,
create_sale_channel_listing,
sale_catalogues_add,
)
from ....shop.utils import prepare_default_shop
from .... | 402 | 15,217 |
hydra | tools/configen/configen/utils.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from enum import Enum
from typing import Any, Dict, Iterable, List, Optional, Set
from omegaconf._utils import (
_resolve_optional,
get_dict_key_value_types,
get_list_element_type,
is_dict_annotation,
is_list_annotation,
is_... | 63 | 1,832 |
onnx | onnx/backend/test/case/node/splittosequence.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class SplitToSequence(Base):
@staticmethod
def export_with_split_1()... | 81 | 2,129 |
gunicorn | tests/docker/asgi/app.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Simple ASGI test application for HTTP protocol testing."""
async def app(scope, receive, send):
"""Simple ASGI application that echoes request info."""
if scope["type"] == "lifespan":
while Tru... | 50 | 1,481 |
saleor | saleor/tests/e2e/orders/discounts/test_order_voucher_specific_product_cheapest_product.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 ...shop.utils.preparing_shop import prepare_shop
from ...taxes.utils import update_country_tax_rates
from ...utils import assig... | 277 | 9,840 |
pyro | pyro/distributions/grouped_normal_normal.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import math
import torch
from torch.distributions.utils import broadcast_all
from pyro.distributions import Normal, constraints
from pyro.distributions.torch_distribution import TorchDistribution
LOG_ROOT_TWO_PI = 0.5 * math.log(2.0... | 162 | 6,572 |
pyro | pyro/distributions/conditional.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
import torch
import torch.nn
from .torch import TransformedDistribution
from .torch_transform import ComposeTransformModule
class ConditionalDistribution(ABC):
@abstractmethod
def con... | 151 | 4,895 |
textual | tests/selection_list/test_selection_messages.py | .py | """Unit tests aimed at testing the selection list messages.
Note that these tests only cover a subset of the public API of this widget.
The bulk of the API is inherited from OptionList, and as such there are
comprehensive tests for that. These tests simply cover the parts of the API
that have been modified by the chil... | 228 | 8,131 |
httpie | tests/utils/matching/parsing.py | .py | import re
from typing import Iterable
from httpie.output.writer import MESSAGE_SEPARATOR
from .tokens import Expect
from ...utils import CRLF
SEPARATOR_RE = re.compile(f'^{MESSAGE_SEPARATOR}')
KEY_VALUE_RE = re.compile(r'[\n]*((.*?):(.+)[\n]?)+[\n]*')
def make_headers_re(message_type: Expect):
assert message_t... | 99 | 2,596 |
beam | sdks/python/apache_beam/runners/interactive/testing/mock_env.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... | 91 | 3,651 |
openvino | src/bindings/python/src/openvino/utils/broadcasting.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging
from typing import Optional
from openvino import AxisSet
from openvino.utils.types import (
TensorShape,
)
log = logging.getLogger(__name__)
def get_broadcast_axes(
output_shape: TensorS... | 42 | 1,290 |
saleor | saleor/graphql/checkout/tests/test_checkout_discount_expiration.py | .py | from datetime import timedelta
from unittest import mock
import graphene
import pytest
from django.utils import timezone
from freezegun import freeze_time
from ....discount.utils.checkout import (
create_or_update_discount_objects_from_promotion_for_checkout,
)
from ...tests.utils import get_graphql_content
QUER... | 659 | 23,984 |
beam | sdks/python/apache_beam/transforms/external_transform_provider.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... | 295 | 11,373 |
kombu | t/unit/asynchronous/aws/case.py | .py | from __future__ import annotations
import pytest
import t.skip
pytest.importorskip('boto3')
pytest.importorskip('pycurl')
@t.skip.if_pypy
@pytest.mark.usefixtures('hub')
class AWSCase:
pass
| 15 | 199 |
conda | tests/env/test_create.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import json
import subprocess
from pathlib import Path
from typing import TYPE_CHECKING
from uuid import uuid4
import pytest
from conda.base.context import context, reset_context
from conda.common.compat imp... | 520 | 15,673 |
onnxruntime | onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/Tensor.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 Tensor(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffe... | 204 | 6,599 |
beam | sdks/python/apache_beam/examples/complete/estimate_pi_it_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 55 | 2,019 |
mlflow | tests/server/assistant/test_session.py | .py | import shutil
import uuid
import pytest
from mlflow.assistant.types import Message
from mlflow.server.assistant.session import Session, SessionManager
def test_session_add_message():
session = Session()
session.add_message("user", "Hello")
assert len(session.messages) == 1
assert session.messages[0... | 196 | 5,965 |
lemur | lemur/plugins/lemur_entrust/__init__.py | .py | """Set the version information."""
try:
from importlib.metadata import version
VERSION = version(__name__)
except Exception as e:
VERSION = "unknown"
| 7 | 162 |
saleor | saleor/graphql/core/types/money.py | .py | import graphene
from babel.numbers import get_currency_precision
from ....core.prices import quantize_price
from ...core.doc_category import DOC_CATEGORY_TAXES
from ...core.types import BaseObjectType
class Money(graphene.ObjectType):
currency = graphene.String(description="Currency code.", required=True)
am... | 104 | 3,631 |
openvino | tests/layer_tests/pytorch_tests/test_select.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from pytorch_layer_test_class import PytorchLayerTest
@pytest.mark.parametrize('input_dim', list(range(-3, 4)))
@pytest.mark.parametrize('input_index', list(range(-3, 4)))
class TestSelect(PytorchLayerTest):... | 66 | 2,231 |
mlflow | tests/server/conftest.py | .py | import pytest
from fastapi import FastAPI
from flask import Flask
from starlette.testclient import TestClient
from werkzeug.test import Client
from mlflow.server.fastapi_security import init_fastapi_security
@pytest.fixture
def test_app():
"""Minimal Flask app for unit testing."""
app = Flask(__name__)
... | 67 | 1,615 |
pyro | examples/contrib/oed/gp_bayes_opt.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
import torch.autograd as autograd
import torch.optim as optim
from torch.distributions import transform_to
import pyro.contrib.gp as gp
import pyro.optim
from pyro.infer import TraceEnum_ELBO
class GPBayesOptimizer(... | 142 | 5,456 |
attrs | tests/test_3rd_party.py | .py | # SPDX-License-Identifier: MIT
"""
Tests for compatibility against other Python modules.
"""
import pytest
from hypothesis import given
from .strategies import simple_classes
cloudpickle = pytest.importorskip("cloudpickle")
class TestCloudpickleCompat:
"""
Tests for compatibility with ``cloudpickle``.
... | 32 | 694 |
pdm | tests/cli/conftest.py | .py | from __future__ import annotations
import shutil
import textwrap
from dataclasses import dataclass
from pathlib import Path
from typing import Any
from unittest.mock import MagicMock
import httpx
import pytest
from pytest_mock import MockerFixture
from pdm.cli.commands.publish.package import PackageFile
from pdm.cli... | 125 | 3,753 |
hypercorn | tests/assets/config_ssl.py | .py | from __future__ import annotations
access_log_format = "bob"
bind = ["127.0.0.1:5555"]
certfile = "tests/assets/cert.pem"
ciphers = "ECDHE+AESGCM"
h11_max_incomplete_size = 4
keyfile = "tests/assets/key.pem"
| 9 | 209 |
sqlmap | thirdparty/wininetpton/win_inet_pton.py | .py | # This software released into the public domain. Anyone is free to copy,
# modify, publish, use, compile, sell, or distribute this software,
# either in source code form or as a compiled binary, for any purpose,
# commercial or non-commercial, and by any means.
import socket
import os
import sys
def inject_into_sock... | 128 | 4,044 |
openvino | tools/benchmark_tool/openvino/tools/benchmark/main.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import platform
from datetime import datetime
from openvino import Dimension, properties
from openvino.tools.benchmark.benchmark import Benchmark
from openvino.tools.benchmark.parameters import parse_args
from open... | 778 | 42,226 |
onnxruntime | tools/python/example_operator_perf_test.py | .py | """
Example python code for creating a model with a single operator and performance testing it with various
input combinations.
"""
import time
import timeit
import numpy as np
import onnx
# if you copy this script elsewhere you may need to add the tools\python dir to the sys.path for this
# import to work.
# e.g. s... | 150 | 5,439 |
textual | tests/test_spatial_map.py | .py | import pytest
from textual._spatial_map import SpatialMap
from textual.geometry import Offset, Region
@pytest.mark.parametrize(
"region,grid",
[
(
Region(0, 0, 10, 10),
[
(0, 0),
],
),
(
Region(10, 10, 10, 10),
... | 65 | 1,632 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/combinevalues_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 "License");... | 127 | 4,145 |
probability | tensorflow_probability/python/experimental/linalg/linear_operator_row_block.py | .py | # Copyright 2023 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... | 76 | 2,689 |
mlflow | mlflow/protos/databricks_uc_registry_messages_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_uc_registry_messages.proto
# Protobuf Python Version: 5.26.0
"""Generated protocol buffer co... | 1,250 | 113,775 |
wandb | tests/system_tests/test_sweep/train_with_import_readline.py | .py | import wandb
# For use with test_wandb_agent_full.py::test_agent_subprocess_with_import_readline
def main() -> None:
with wandb.init() as run:
print("Importing readline...")
# `import readline` causes deadlock if parent launches subprocess using progress_group=0
# without a pty
im... | 35 | 932 |
gunicorn | tests/test_dirty_app.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for dirty app module."""
import pytest
from gunicorn.dirty.app import (
DirtyApp,
load_dirty_app,
load_dirty_apps,
parse_dirty_app_spec,
)
from gunicorn.dirty.errors import DirtyAppError,... | 348 | 12,463 |
mlflow | dev/clint/tests/rules/test_nested_mock_patch.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.nested_mock_patch import NestedMockPatch
def test_nested_mock_patch_unittest_mock(index: SymbolIndex) -> None:
code = """
import unittest.mock
def tes... | 203 | 6,175 |
wagtail | wagtail/api/v3/schemas/generators/write.py | .py | from collections.abc import Iterable
from types import UnionType
from typing import Any, Callable, Literal, Union, cast, get_args, get_origin
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db.models import Field, ForeignKey, Model
from django.db.models.fields.reverse_related imp... | 427 | 19,159 |
mlflow | dev/clint/src/clint/rules/pytest_mark_repeat.py | .py | import ast
from clint.resolver import Resolver
from clint.rules.base import Rule
class PytestMarkRepeat(Rule):
def _message(self) -> str:
return (
"@pytest.mark.repeat decorator should not be committed. "
"This decorator is meant for local testing only to check for flaky tests."
... | 23 | 709 |
onnxruntime | onnxruntime/python/tools/transformers/fusion_constant_fold.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... | 145 | 5,870 |
saleor | saleor/graphql/core/tracing.py | .py | from functools import wraps
from graphene import ResolveInfo
from ...core.telemetry import saleor_attributes, tracer
def traced_resolver(func):
@wraps(func)
def wrapper(*args, **kwargs):
info = next(arg for arg in args if isinstance(arg, ResolveInfo))
operation = f"{info.parent_type.name}.{i... | 22 | 753 |
textual | docs/examples/widgets/sparkline.py | .py | import random
from statistics import mean
from textual.app import App, ComposeResult
from textual.widgets import Sparkline
random.seed(73)
data = [random.expovariate(1 / 3) for _ in range(1000)]
class SparklineSummaryFunctionApp(App[None]):
CSS_PATH = "sparkline.tcss"
def compose(self) -> ComposeResult:
... | 23 | 578 |
coremltools | coremltools/proto/ArrayFeatureExtractor_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: ArrayFeatureExtractor.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _mes... | 36 | 1,430 |
gunicorn | examples/embedding_service/__init__.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# Embedding service package
| 6 | 134 |
beam | sdks/python/apache_beam/io/filesystems.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... | 412 | 12,836 |
saleor | saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_voucher_with_min_item_quantity.py | .py | import pytest
from ....product.utils.preparing_product import prepare_product
from ....shop.utils import prepare_default_shop
from ....utils import assign_permissions
from ....vouchers.utils import (
create_voucher,
create_voucher_channel_listing,
get_voucher,
)
from ...utils import (
checkout_add_prom... | 199 | 6,097 |
saleor | saleor/graphql/menu/mutations/menu_item_move.py | .py | from dataclasses import dataclass
import graphene
from django.core.exceptions import ValidationError
from ....core.tracing import traced_atomic_transaction
from ....menu import models
from ....menu.error_codes import MenuErrorCode
from ....permission.enums import MenuPermissions
from ....webhook.event_types import We... | 202 | 7,338 |
saleor | saleor/graphql/app/tests/mutations/test_app_delete.py | .py | import json
from unittest import mock
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....app.error_codes import AppErrorCode
from .....app.models import App
from .....core.utils.json_serializer import CustomJsonEncoder
from .....webhook.event_types import ... | 238 | 6,910 |
scikit-bio | skbio/tests/test_base.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.
# --------------------------------------------... | 56 | 1,553 |
wagtail | wagtail/tests/test_audit_log.py | .py | import datetime
import json
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.core.serializers.json import DjangoJSONEncoder
from django.test import TestCase
from djan... | 658 | 25,991 |
beam | sdks/python/apache_beam/runners/portability/job_server.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... | 184 | 6,271 |
saleor | saleor/checkout/tests/fixtures/checkout_with_payment.py | .py | import pytest
from ....payment import ChargeStatus, TransactionKind
from ....payment.models import Payment
from ....plugins.manager import get_plugins_manager
from ... import calculations
from ...fetch import fetch_checkout_info, fetch_checkout_lines
from ..utils import add_variant_to_checkout
@pytest.fixture
def ch... | 133 | 3,958 |
beam | learning/katas/python/IO/TextIO/ReadFromText/tests/test_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"); you may not... | 47 | 1,472 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.