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 |
|---|---|---|---|---|---|
conda | tests/test_history.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from conda.history import History
if TYPE_CHECKING:
from pytest_mock import MockerFixture
@pytest.fixture
def tmp_history(tmp_pa... | 296 | 9,745 |
metrics | src/torchmetrics/audio/snr.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... | 352 | 12,701 |
saleor | saleor/checkout/tests/webhooks/subscriptions/test_exclude_shipping.py | .py | import json
import graphene
import pytest
from .....shipping.interface import ShippingMethodData
from .....shipping.models import ShippingMethod
from .....shipping.utils import convert_to_shipping_method_data
from .....webhook.event_types import WebhookEventSyncType
from .....webhook.transport.asynchronous.transport ... | 257 | 7,146 |
probability | discussion/adaptive_malt/trial_runner_experiments.py | .py | # Copyright 2022 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... | 163 | 5,512 |
pyomo | pyomo/repn/tests/baron/__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... | 12 | 577 |
coremltools | deps/protobuf/python/google/protobuf/internal/descriptor_database_test.py | .py | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | 128 | 5,944 |
httpie | tests/test_cli_utils.py | .py | import pytest
from argparse import ArgumentParser
from unittest.mock import Mock
from httpie.cli.utils import LazyChoices
def test_lazy_choices():
mock = Mock()
getter = mock.getter
getter.return_value = ['a', 'b', 'c']
parser = ArgumentParser()
parser.register('action', 'lazy_choices', LazyChoic... | 87 | 2,322 |
sphinx | sphinx/ext/autodoc/_dynamic/_type_comments.py | .py | """Update annotations info of living objects using type_comments."""
from __future__ import annotations
import ast
import contextlib
import sys
from inspect import Parameter, Signature, getsource
from types import ModuleType
from typing import TYPE_CHECKING, cast
from weakref import WeakSet
from sphinx.errors import... | 231 | 8,408 |
saleor | saleor/core/tests/test_http_client.py | .py | import pytest
import requests_hardened
from requests import Request
from requests_hardened.ip_filter import InvalidIPAddress
from ... import user_agent_version
from ..http_client import HTTPClient, HTTPConfig
def test_user_agent_override():
# given
request = Request("GET", "http://www.example.com")
sessi... | 45 | 1,585 |
cvxpy | cvxpy/atoms/norm.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... | 97 | 3,358 |
onnxruntime | tools/python/util/file_utils.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import annotations
import os
import pathlib
import typing
def path_match_suffix_ignore_case(path: pathlib.Path | str, suffix: str) -> bool:
"""
Returns whether `path` ends in `suffix`, ignoring case.... | 48 | 1,525 |
astropy | astropy/samp/client.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import os
import select
import socket
import threading
import warnings
from urllib.parse import urlunparse
from .constants import SAMP_STATUS_OK, SAMP_STATUS_WARNING
from .errors import SAMPClientError, SAMPWarning
from .hub import SAMPHubSe... | 743 | 25,371 |
textual | tests/tree/test_tree_clearing.py | .py | from __future__ import annotations
import pytest
from textual.app import App, ComposeResult
from textual.widgets import Tree
from textual.widgets.tree import RemoveRootError
class VerseBody:
pass
class VerseStar(VerseBody):
pass
class VersePlanet(VerseBody):
pass
class VerseMoon(VerseBody):
pa... | 111 | 3,558 |
saleor | saleor/asgi/tests/test_usage_telemetry.py | .py | from datetime import timedelta
from django.utils import timezone
from ..usage_telemetry import get_usage_telemetry
def test_get_usage_telemetry(site_settings):
# given
site_settings.usage_telemetry_reported_at = None
site_settings.save(update_fields=["usage_telemetry_reported_at"])
expected_instanc... | 64 | 1,548 |
onnxruntime | onnxruntime/test/testdata/make_qdq_layout_transform_const_folding.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import numpy as np
import onnx
import onnxruntime
from onnxruntime.quantization import CalibrationDataReader, QuantFormat, QuantType, quantize_static
from onnxruntime.quantization.shape_inference import quant_pre_process
c... | 110 | 4,185 |
pyro | tests/infer/reparam/test_transform.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from pyro.distributions.transforms import AffineTransform, ExpTransform
from pyro.infer.reparam import TransformReparam
from t... | 83 | 2,709 |
beam | sdks/python/apache_beam/testing/test_stream_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... | 251 | 9,042 |
wagtail | wagtail/admin/tests/test_views_generic.py | .py | from django.contrib.admin.utils import quote
from django.test import TestCase
from django.urls import reverse
from wagtail.test.testapp.models import ModelWithStringTypePrimaryKey
from wagtail.test.utils import PageFixturesMixin, WagtailTestUtils
class TestGenericIndexView(PageFixturesMixin, WagtailTestUtils, TestCa... | 144 | 5,671 |
mlflow | tests/llama_index/conftest.py | .py | import os
import re
import shutil
import sys
import pytest
from llama_index.core import (
Document,
KnowledgeGraphIndex,
PromptTemplate,
Settings,
VectorStoreIndex,
)
from llama_index.core.callbacks import CallbackManager, LlamaDebugHandler
from llama_index.core.node_parser import SentenceSplitter
... | 120 | 3,315 |
wandb | wandb/sdk/internal/_generated/__init__.py | .py | # Generated by ariadne-codegen
__all__ = ["SERVER_FEATURES_QUERY_GQL", "ServerFeaturesQuery"]
from .operations import SERVER_FEATURES_QUERY_GQL
from .server_features_query import ServerFeaturesQuery
| 6 | 200 |
confluent-kafka-python | tests/common/__init__.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2024 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 315 | 12,136 |
lemur | lemur/api_keys/views.py | .py | """
.. module: lemur.api_keys.views
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Eric Coan <kungfury@instructure.com>
"""
from datetime import datetime
from flask import Blueprint, g
from flask_restful import ... | 626 | 17,609 |
biopython | Bio/SearchIO/HmmerIO/hmmer3_tab.py | .py | # Copyright 2012 by Wibowo Arindrarto. All rights reserved.
# 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.
"""Bio.SearchIO parser ... | 338 | 12,910 |
probability | discussion/robust_inverse_graphics/util/math_util.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... | 84 | 2,301 |
probability | tensorflow_probability/python/experimental/auto_batching/type_inference_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... | 209 | 9,670 |
readthedocs.org | readthedocs/acl/utils.py | .py | from django.contrib.auth import BACKEND_SESSION_KEY
from readthedocs.acl.constants import BACKEND_REQUEST_KEY
def get_auth_backend(request):
"""
Get the current auth_backend used on this request.
By default the full qualified name of the backend class
is stored on the request session, but our intern... | 17 | 555 |
onnxruntime | onnxruntime/test/python/transformers/test_optimizer.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.
# -------------------------------------------------------------... | 160 | 6,357 |
onnx | onnx/backend/test/case/node/ceil.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 Ceil(Base):
@staticmethod
def export() -> None:
node =... | 29 | 749 |
structlog | tests/test_frames.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.
import sys
import pytest
from structlog._frames import (
_find_first_app_frame_and_name... | 188 | 5,619 |
mlflow | tests/spark/test_spark_connect_model_export.py | .py | import json
import os
from unittest import mock
import numpy as np
import pandas as pd
import pyspark
import pytest
from packaging.version import Version
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
from pyspark.sql.types import LongType
from sklearn import datasets
import mlflow
import... | 162 | 5,719 |
onnxruntime | orttraining/orttraining/python/training/onnxblock/loss/__init__.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from onnxruntime.training.onnxblock.loss.loss import BCEWithLogitsLoss, CrossEntropyLoss, L1Loss, MSELoss
__all__ = ["BCEWithLogitsLoss", "CrossEntropyLoss", "L1Loss", "MSELoss"]
| 7 | 275 |
onnxruntime | tools/python/sparsify_initializers.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
# This script opens an existing model in onnx format and attempts to
# mo... | 185 | 7,209 |
hatch | backend/src/hatchling/builders/utils.py | .py | from __future__ import annotations
import os
import shutil
from base64 import urlsafe_b64encode
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Iterable
from zipfile import ZipInfo
def replace_file(src: str, dst: str) -> None:
try:
os.replace(src, dst)
# Happen... | 129 | 3,819 |
pyomo | pyomo/contrib/gdpopt/loa.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... | 327 | 13,284 |
pymc | pymc/model/transform/deterministic.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 222 | 8,323 |
metrics | src/torchmetrics/functional/detection/giou.py | .py | # Copyright The PyTorch 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 i... | 128 | 4,918 |
openvino | tests/layer_tests/onnx_tests/test_matmul.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model
class TestMatMul(OnnxRuntimeLayerTest):
def _prepare_input(self, inputs_dict):
for input in inputs_dict.keys()... | 197 | 7,058 |
kafka | tests/kafkatest/tests/client/consumer_rolling_upgrade_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 ... | 91 | 4,327 |
beam | sdks/python/apache_beam/runners/interactive/background_caching_job.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... | 352 | 14,375 |
rq | tests/test_registry.py | .py | import math
from datetime import timedelta
from unittest import mock
from unittest.mock import ANY
import pytest
from rq.defaults import DEFAULT_FAILURE_TTL
from rq.exceptions import AbandonedJobError, InvalidJobOperation
from rq.executions import Execution
from rq.job import Dependency, Job, JobStatus, requeue_job
f... | 955 | 40,434 |
qutip | qutip/core/subsystem_apply.py | .py | #
# This code was contributed by Ben Criger. Resemblance to
# partial_transpose is intentional, and meant to enhance legibility.
#
__all__ = ['subsystem_apply']
import itertools
import numpy as np
from . import Qobj, qeye, to_kraus, tensor
from . import data as _data
def subsystem_apply(
state: Qobj,
chan... | 218 | 7,680 |
saleor | saleor/graphql/discount/tests/mutations/test_voucher_bulk_delete.py | .py | from unittest import mock
import graphene
from .....discount.models import Voucher
from ....tests.utils import get_graphql_content
BULK_DELETE_VOUCHERS_MUTATION = """
mutation voucherBulkDelete($ids: [ID!]!) {
voucherBulkDelete(ids: $ids) {
count
}
}
"""
def test_delete_vouchers... | 67 | 1,917 |
beam | sdks/python/apache_beam/io/external/snowflake.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... | 33 | 1,207 |
onnxruntime | onnxruntime/python/tools/transformers/models/sam2/mask_decoder.py | .py | # -------------------------------------------------------------------------
# Copyright (R) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import logging
import warnings
import torch
from image_encoder import S... | 209 | 8,858 |
biopython | Bio/Graphics/GenomeDiagram/_Diagram.py | .py | # Copyright 2003-2008 by Leighton Pritchard. All rights reserved.
#
# 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.
#
# Contact: ... | 412 | 15,633 |
saleor | saleor/core/utils/update_mutation_manager.py | .py | from copy import deepcopy
from typing import Any, TypeVar
from django.db.models import Model
T = TypeVar("T", bound=Model)
class InstanceTracker:
"""Instance with modifications tracker.
It is used to determine modified fields of the instance.
"""
def __init__(
self,
instance: T | N... | 71 | 2,397 |
astropy | astropy/utils/xml/writer.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains a class that makes it simple to stream out well-formed and
nicely-indented XML.
"""
import contextlib
import textwrap
from astropy.utils.compat.optional_deps import HAS_BLEACH
from ._iterparser import escape_xml as xml_escape
from ._iterpar... | 334 | 10,211 |
pymc | scripts/publish_release_notes_to_discourse.py | .py | #!/usr/bin/env python3
import os
import re
import requests
def load_config() -> dict[str, str]:
env_config = {
"DISCOURSE_URL": os.getenv("DISCOURSE_URL"),
"DISCOURSE_API_KEY": os.getenv("DISCOURSE_API_KEY"),
"DISCOURSE_USERNAME": os.getenv("DISCOURSE_USERNAME"),
"DISCOURSE_CATEG... | 152 | 5,123 |
onnxruntime | orttraining/orttraining/python/training/ortmodule/experimental/__init__.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# __init__.py
| 4 | 108 |
scikit-bio | skbio/stats/distance/_permanova.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.
# --------------------------------------------... | 603 | 25,330 |
jupytext | tests/external/pre_commit/test_pre_commit_0_ipynb_to_py.py | .py | import pytest
from git.exc import HookExecutionError
from nbformat.v4.nbbase import new_markdown_cell, new_notebook
from pre_commit.main import main as pre_commit
from jupytext import read, write
from jupytext.cli import jupytext
from jupytext.compare import compare_cells
def test_pre_commit_hook_ipynb_to_py(tmpdir,... | 66 | 2,428 |
openvino | tests/e2e_tests/test_base.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Main entry-point to run E2E OSS tests.
Default run:
$ pytest test.py
Options[*]:
--modules Paths to tests
--env_conf Path to environment config
--test_conf Path to test config
[*] For more information see conftest.py... | 160 | 7,032 |
sphinx | tests/roots/test-ext-autodoc/target/metadata.py | .py | def foo():
""":meta metadata-only-docstring:"""
| 3 | 52 |
biopython | Tests/test_Phylo_matplotlib.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
fr... | 101 | 3,656 |
httpie | httpie/cli/definition.py | .py | from __future__ import annotations
import os
import textwrap
from argparse import FileType
from httpie import __doc__, __version__
from httpie.cli.argtypes import (KeyValueArgType, SessionNameValidator,
SSLCredentials, readable_file_arg,
response_chars... | 957 | 29,143 |
saleor | saleor/graphql/page/dataloaders.py | .py | from collections import defaultdict
from ...attribute.models import Attribute, AttributePage
from ...page.models import Page, PageType
from ..attribute.dataloaders.attributes import (
AttributesByAttributeId,
)
from ..core.dataloaders import DataLoader
PageTypeIdAndAttributeSlug = tuple[int, str]
class PageById... | 103 | 3,526 |
wandb | tests/unit_tests/test_launch/conftest.py | .py | import pytest
from wandb.apis.internal import InternalApi
@pytest.fixture
def test_api(test_settings):
return InternalApi(default_settings=test_settings(), load_settings=False)
| 8 | 183 |
mlflow | examples/pyfunc/model_as_code.py | .py | # This example demonstrates defining a model directly from code.
# This feature allows for defining model logic within a python script, module, or notebook that is stored
# directly as serialized code, as opposed to object serialization that would otherwise occur when saving
# or logging a model object.
# This script d... | 53 | 1,998 |
probability | spinoffs/fun_mc/fun_mc/backends/jax_integration_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... | 34 | 1,021 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_cond.py | .py | import os
import sys
import numpy as np
import paddle
from save_model import exportModel
'''
test: simple conditional_block pair + select_input without input to conditional_block.
'''
x = np.full(shape=[1], dtype='float32', fill_value=0.1)
y = np.full(shape=[1], dtype='float32', fill_value=0.23)
data = np.less(y,x)
... | 213 | 7,147 |
wandb | tests/unit_tests/test_step_prepare.py | .py | from __future__ import annotations
import concurrent.futures
import dataclasses
import queue
import threading
from collections.abc import Iterable, Mapping
from typing import TYPE_CHECKING
from unittest.mock import Mock, call
import pytest
from wandb.filesync.step_prepare import (
Request,
RequestFinish,
... | 351 | 10,587 |
wandb | wandb/sdk/lib/paths.py | .py | from __future__ import annotations
import os
import platform
from functools import wraps
from pathlib import PurePath, PurePosixPath
from typing import Any, TypeAlias, Union
# Path _inputs_ should generally accept any kind of path. This is named the same and
# modeled after the hint defined in the Python standard lib... | 107 | 4,535 |
onnxruntime | tools/ci_build/github/apple/test_apple_packages.py | .py | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import contextlib
import json
import os
import pathlib
import shutil
import subprocess
import sys
import tempfile
from c.assemble_c_pod_package import assemble_c_pod_package
from packag... | 275 | 10,461 |
saleor | saleor/graphql/product/tests/queries/products_filtrations/test_over_attributes_boolean.py | .py | import graphene
import pytest
from ......attribute import AttributeInputType, AttributeType
from ......attribute.models import Attribute, AttributeValue
from ......attribute.utils import associate_attribute_values_to_instance
from .....tests.utils import get_graphql_content
from .shared import PRODUCTS_FILTER_QUERY, P... | 84 | 2,733 |
saleor | saleor/tests/e2e/vouchers/utils/voucher_codes_export.py | .py | from ...utils import get_graphql_content
VOUCHER_CODES_EXPORT_MUTATION = """
mutation VoucherCreate($input: ExportVoucherCodesInput!) {
exportVoucherCodes(input: $input) {
errors {
code
field
message
}
exportFile {
status
id
}
}
}
"""
def raw_export_voucher_codes(sta... | 44 | 931 |
cvxpy | cvxpy/reductions/solvers/conic_solvers/clarabel_conif.py | .py | """
Copyright 2022, the CVXPY Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | 283 | 9,467 |
clearml | examples/hyperdatasets/create_coco_hyperdataset.py | .py | """
Download a subset of COCO and convert it into a ClearML HyperDataset.
The script fetches the COCO 2017 annotations JSON and downloads image files on
an as-needed basis (defaulting to the validation split). Each COCO record is
converted into a `DataEntryImage` with per-object bounding boxes, polygon
segmentations, ... | 376 | 13,196 |
pyfilesystem2 | fs/path.py | .py | """Useful functions for working with PyFilesystem paths.
This is broadly similar to the standard `os.path` module but works
with paths in the canonical format expected by all FS objects (that is,
separated by forward slashes and with an optional leading slash).
See :ref:`paths` for an explanation of PyFilesystem path... | 593 | 13,411 |
rq | tests/config_files/dummy_override.py | .py | REDIS_HOST = 'testhost.example.com'
REDIS_PORT = 6378
REDIS_DB = 2
REDIS_PASSWORD = '123'
| 5 | 90 |
pyomo | examples/gdp/constrained_layout/cons_layout_model.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... | 354 | 12,945 |
scikit-optimize | skopt/space/__init__.py | .py | """
Utilities to define a search space.
"""
from .space import *
| 6 | 66 |
biopython | Bio/File.py | .py | # Copyright 1999 by Jeffrey Chang. All rights reserved.
# Copyright 2009-2018 by Peter Cock. All rights reserved.
#
# 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 inc... | 627 | 24,702 |
pyomo | pyomo/neos/plugins/kestrel_plugin.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... | 281 | 11,015 |
beam | sdks/python/apache_beam/runners/worker/sdk_worker_main_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... | 301 | 11,533 |
wandb | wandb/sdk/data_types/eval_table.py | .py | from __future__ import annotations
import datetime
from collections.abc import Iterator
from typing import TYPE_CHECKING, Any
from typing_extensions import override
import wandb
import wandb.integration.weave as weave_integration
import wandb.integration.weave.media_adapters as media_adapters
from wandb.errors impor... | 487 | 18,147 |
mlflow | tests/dev/test_annotate_flaky_tests.py | .py | import ast
import json
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "dev"))
import annotate_flaky_tests
from annotate_flaky_tests import _split_nodeid, annotate_file
def _annotate(tmp_path: Path, source: str, nodeid_suffix: str, attempts: int = 3):
"""Write `s... | 199 | 7,859 |
openvino | tests/e2e_tests/pipelines/tf_hub/tf_hub_case_class.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from collections import OrderedDict
from e2e_tests.common.common.common_base_class import CommonConfig
from e2e_tests.pipelines.pipeline_templates.comparators_template import eltwise_comparators
from e2e_tests.pipelines.pipeline_templat... | 31 | 1,306 |
sqlmap | lib/request/webhooksite.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import json
from lib.core.data import conf
from lib.core.data import logger
from lib.core.convert import getBytes
from lib.core.convert import getText
from lib.core.enums import ... | 93 | 3,955 |
probability | spinoffs/inference_gym/inference_gym/targets/non_identifiable_quartic_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... | 52 | 1,909 |
textual | docs/examples/styles/border_all.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class AllBordersApp(App):
CSS_PATH = "border_all.tcss"
def compose(self):
yield Grid(
Label("ascii", id="ascii"),
Label("blank", id="blank"),
Label("dashed", id="dashe... | 33 | 925 |
saleor | saleor/graphql/core/federation/tests/test_resolvers.py | .py | from typing import Any
import graphene
import pytest
QUERY = """
query Federation ($representations: [_Any!]!) {
_entities(representations: $representations) {
... on Order { number }
}
}
"""
# NOTE: happy path for the 'id' field is in ./test_schema.py
# (test_resolve_entity_should_return_object_when_... | 71 | 1,907 |
returns | returns/contrib/mypy/_features/do_notation.py | .py | from typing import Final
from mypy.maptype import map_instance_to_supertype
from mypy.nodes import Expression, GeneratorExpr, TypeInfo
from mypy.plugin import MethodContext
from mypy.subtypes import is_subtype
from mypy.typeops import make_simplified_union
from mypy.types import (
AnyType,
CallableType,
In... | 152 | 4,321 |
metrics | docs/source/pyplots/binary_accuracy.py | .py | import matplotlib.pyplot as plt
import torch
import torchmetrics
N = 10
num_updates = 10
num_steps = 5
fig, ax = plt.subplots(1, 1, figsize=(6.8, 4.8), dpi=500)
metric = torchmetrics.Accuracy(task="binary")
for _ in range(N):
metric.update(torch.rand(10), torch.randint(2, (10,)))
metric.plot(ax=ax)
fig.show()
| 16 | 318 |
wandb | tests/unit_tests/test_wait_with_progress.py | .py | import asyncio
from typing import NoReturn
import pytest
import wandb.sdk.mailbox as mb
from wandb.proto import wandb_server_pb2 as spb
from wandb.sdk.lib import asyncio_manager
async def _loop_forever() -> NoReturn:
while True:
await asyncio.sleep(1)
@pytest.fixture(scope="module")
def asyncer():
... | 119 | 3,002 |
bazel | third_party/py/abseil/absl/__init__.py | .py | # Copyright 2017 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 14 | 584 |
wandb | wandb/apis/public/projects.py | .py | """W&B Public API for Project objects.
This module provides classes for interacting with W&B projects and their
associated data.
Example:
```python
from wandb.apis.public import Api
# Get all projects for an entity
projects = Api().projects("entity")
# Access project data
for project in projects:
print(f"Projec... | 304 | 9,665 |
textual | src/textual/widgets/_pretty.py | .py | """Provides a pretty-printing widget."""
from __future__ import annotations
from typing import Any
from rich.pretty import Pretty as PrettyRenderable
from textual.app import RenderResult
from textual.widget import Widget
class Pretty(Widget):
"""A pretty-printing widget.
Used to pretty-print any object.
... | 57 | 1,379 |
clearml | clearml/backend_config/bucket_config.py | .py | from abc import ABC, abstractmethod
import logging
import warnings
from copy import copy
from operator import itemgetter
from os import getenv
from typing import Tuple, Dict, List, Union, Optional, Any
import furl
from attr import attrib, attrs
from .converters import strtobool
def _none_to_empty_string(maybe_strin... | 514 | 18,891 |
confluent-kafka-python | src/confluent_kafka/schema_registry/rules/__init__.py | .py | # Copyright 2024 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 14 | 574 |
beam | learning/tour-of-beam/learning-content/core-transforms/partition/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... | 60 | 1,958 |
sphinx | tests/roots/test-latex-theme/conf.py | .py | latex_theme = 'custom'
latex_theme_path = ['theme']
| 3 | 52 |
onnxruntime | onnxruntime/test/python/onnxruntime_test_python_autoep.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import annotations
import os
import platform
import sys
import unittest
from collections.abc import Sequence
import numpy as np
import onnx
from autoep_helper import AutoEpTestCase
from helper import get_name... | 491 | 21,391 |
pyro | tests/infer/test_util.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from pyro.infer.importance import psis_diagnostic
from pyro.infer.util import MultiFrameTensor
from tests.common ... | 85 | 2,707 |
mlflow | mlflow/deployments/constants.py | .py | # Abridged retryable error codes for deployments clients.
# These are modified from the standard MLflow Tracking server retry codes for the MLflowClient to
# remove timeouts from the list of the retryable conditions. A long-running timeout with
# retries for the proxied providers generally indicates an issue with the u... | 12 | 607 |
pyomo | pyomo/core/tests/diet/__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... | 12 | 576 |
openvino | src/frontends/tensorflow_lite/tests/test_models/gen_scripts/generate_2in_2out.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import os
import sys
# do not print messages from TensorFlow
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session... | 53 | 1,869 |
textual | docs/examples/styles/position.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Label
class PositionApp(App):
CSS_PATH = "position.tcss"
def compose(self) -> ComposeResult:
yield Label("Absolute", id="label1")
yield Label("Relative", id="label2")
if __name__ == "__main__":
app = PositionApp()
... | 16 | 332 |
sqlmap | plugins/dbms/frontbase/enumeration.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from lib.core.data import logger
from plugins.generic.enumeration import Enumeration as GenericEnumeration
class Enumeration(GenericEnumeration):
def getBanner(self):
... | 33 | 922 |
luigi | test/factorial_test.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... | 50 | 1,447 |
saleor | saleor/graphql/giftcard/mutations/gift_card_update.py | .py | from copy import deepcopy
import graphene
from django.core.exceptions import ValidationError
from ....core.tracing import traced_atomic_transaction
from ....giftcard import events, models
from ....giftcard.error_codes import GiftCardErrorCode
from ....permission.enums import GiftcardPermissions
from ....webhook.event... | 167 | 6,210 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.