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
saleor
saleor/core/utils/tests/test_url.py
.py
from collections import OrderedDict from urllib.parse import urlencode import pytest from django.conf import settings from ..url import get_default_storage_root_url, prepare_url, sanitize_url_for_logging def test_prepare_url(): redirect_url = "https://www.example.com" params = urlencode({"param1": "abc", "p...
54
1,764
mlflow
tests/tracing/test_trace_manager.py
.py
import json import time from threading import Thread from mlflow.entities import LiveSpan, Span from mlflow.entities.model_registry.prompt_version import PromptVersion from mlflow.entities.span_status import SpanStatusCode from mlflow.tracing.constant import TraceTagKey from mlflow.tracing.trace_manager import InMemor...
300
10,883
mlflow
examples/gateway/palm/example.py
.py
from mlflow.deployments import get_deploy_client def main(): client = get_deploy_client("http://localhost:7000") print(f"PaLM endpoints: {client.list_endpoints()}\n") print(f"PaLM completions endpoint info: {client.get_endpoint(endpoint='completions')}\n") # Completions request response_completi...
49
1,518
mlflow
mlflow/entities/gateway_guardrail.py
.py
from __future__ import annotations from dataclasses import dataclass from enum import Enum from mlflow.entities._mlflow_object import _MlflowObject from mlflow.entities.scorer import ScorerVersion from mlflow.protos.service_pb2 import GatewayGuardrail as ProtoGatewayGuardrail from mlflow.protos.service_pb2 import Gat...
134
4,591
saleor
saleor/graphql/channel/tests/mutations/test_channel_create.py
.py
import datetime import json from unittest import mock import graphene import pytest from django.conf import settings from django.utils import timezone from django.utils.functional import SimpleLazyObject from django.utils.text import slugify from freezegun import freeze_time from .....channel.error_codes import Chann...
1,593
46,561
mlflow
tests/tracing/sample_code/model_with_add_trace.py
.py
import mlflow _SAMPLE_TRACE = { "info": { "request_id": "2e72d64369624e6888324462b62dc120", "experiment_id": "0", "timestamp_ms": 1726145090860, "execution_time_ms": 162, "status": "OK", "request_metadata": { "mlflow.trace_schema.version": "2", ...
57
1,714
kafka
tests/kafkatest/tests/core/share_consume_bench_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 ...
173
10,811
readthedocs.org
readthedocs/config/find.py
.py
"""Helper functions to search files.""" import os import re def find_one(path, filename_regex): """Find the first file in ``path`` that match ``filename_regex`` regex.""" _path = os.path.abspath(path) for filename in os.listdir(_path): if re.match(filename_regex, filename): return os....
15
362
records
records.py
.py
# -*- coding: utf-8 -*- import os from sys import stdout from collections import OrderedDict from contextlib import contextmanager from inspect import isclass import tablib from docopt import docopt from sqlalchemy import create_engine, exc, inspect, text def isexception(obj): """Given an object, return a boole...
563
17,354
saleor
saleor/graphql/account/mutations/authentication/create_token.py
.py
from typing import Any import graphene from django.core.exceptions import ValidationError from .....account.error_codes import AccountErrorCode from .....account.throttling import authenticate_with_throttling from .....core.jwt import create_access_token, create_refresh_token from ....core import ResolveInfo from ......
124
4,321
wandb
tests/unit_tests/test_sandbox/test_sandbox_wrapper.py
.py
from typing import Any import cwsandbox import pytest import wandb.sandbox as wandb_sandbox import wandb.sandbox._sandbox as sandbox_module from wandb.errors import UsageError from wandb.sandbox import Secret from wandb.sandbox._secret import WANDB_SECRET_STORE _HIDDEN_EXPORT_NAMES = {"AuthHeaders", "set_auth_mode"} ...
268
8,738
saleor
saleor/graphql/menu/mutations/assign_navigation.py
.py
import graphene from ....permission.enums import MenuPermissions, SitePermissions from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.doc_category import DOC_CATEGORY_MENU from ...core.mutations import BaseMutation from ...core.types import MenuError from ...site.dataloaders import ...
49
1,818
biopython
Tests/test_Align_fasta.py
.py
# Copyright 2006-2014 by Peter Cock. All rights reserved. # Copyright 2022 by Michiel de Hoon. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for Bio.Align.fasta modul...
883
52,496
readthedocs.org
readthedocs/subscriptions/notifications.py
.py
"""Organization level notifications.""" import textwrap from django.utils.translation import gettext_noop as _ from djstripe import models as djstripe from readthedocs.notifications.constants import INFO from readthedocs.notifications.email import EmailNotification from readthedocs.notifications.messages import Mess...
96
2,965
wandb
tools/perf/scripts/run_load_tests.py
.py
from __future__ import annotations import argparse import datetime import logging import os import time from dataclasses import dataclass from typing import Literal from .setup_helper import setup_package_logger from .test_case_helper import run_perf_tests logger = logging.getLogger(__name__) @dataclass class Argu...
208
6,762
pyro
pyro/distributions/transforms/generalized_channel_permute.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions import Transform from pyro.nn import DenseNN from .. import constraints from ..conditional import ConditionalTransformModule from ..torch_transform import TransformModule from ..util import copy_...
313
11,610
astropy
astropy/extern/ply/lex.py
.py
# ----------------------------------------------------------------------------- # ply: lex.py # # Copyright (C) 2001-2018 # David M. Beazley (Dabeaz LLC) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are...
1,099
42,905
mlflow
tests/store/tracking/sqlalchemy_store/conftest.py
.py
import json import time import uuid from pathlib import Path from unittest import mock import pytest import sqlalchemy from opentelemetry import trace as trace_api from opentelemetry.sdk.resources import Resource as _OTelResource from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from mlflow.entitie...
382
12,369
mlflow
tests/store/fs2db/conftest.py
.py
import os import subprocess import sys import warnings from collections.abc import Generator from pathlib import Path import pytest from mlflow.store.fs2db import _resolve_mlruns, migrate from mlflow.tracking import MlflowClient @pytest.fixture(scope="module") def clients( tmp_path_factory: pytest.TempPathFacto...
52
1,472
tomli
benchmark/run.py
.py
from __future__ import annotations from collections.abc import Callable from pathlib import Path import timeit import pytomlpp import rtoml import toml import tomlkit import tomli def benchmark( name: str, run_count: int, func: Callable, col_width: tuple, compare_to: float | None = None, ) -> f...
60
2,103
wandb
tests/unit_tests/test_metaflow.py
.py
import platform from pathlib import Path import pytest if platform.system() == "Windows": pytest.skip("metaflow does not support native Windows", allow_module_level=True) pytest.importorskip("metaflow") import pandas as pd from metaflow import FlowSpec, step from sklearn.ensemble import GradientBoostingClassifi...
290
8,897
bazel
third_party/py/abseil/absl/flags/_helpers.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 ...
402
13,430
textual
src/textual/_compat.py
.py
from __future__ import annotations import sys from typing import Any, Generic, TypeVar, overload if sys.version_info >= (3, 12): from functools import cached_property else: # based on the code from Python 3.14: # https://github.com/python/cpython/blob/ # 5507eff19c757a908a2ff29dfe423e35595fda00/Lib/fu...
74
2,849
jupyterlab
jupyterlab/coreconfig.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json import os import os.path as osp from itertools import filterfalse from typing import TypedDict, overload HERE = os.path.dirname(os.path.abspath(__file__)) def pjoin(*args: str | os.PathLike[str]) -> str:...
197
6,241
metrics
examples/audio/signal_to_noise_ratio.py
.py
"""Signal-to-Noise Ratio =============================== Imagine developing a song recognition application. The software's goal is to recognize a song even when it's played in a noisy environment, similar to Shazam. To achieve this, you want to enhance the audio quality by reducing the noise and evaluating the improve...
115
4,587
astropy
astropy/io/votable/tests/test_dataorigin.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import astropy.io.votable import astropy.io.votable.dataorigin as dataorigin from astropy.table import Column, Table from astropy.utils.exceptions import AstropyDeprecationWarning def __generate_votable_test(): table = Table( ...
156
5,899
cvxpy
cvxpy/tests/nlp_tests/stress_tests_diff_engine/test_affine_vector_atoms.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 ...
299
11,199
metrics
src/torchmetrics/wrappers/multioutput.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...
204
9,584
cvxpy
cvxpy/reductions/solvers/conic_solvers/highs_conif.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
367
14,040
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_stackedrnncells.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.tf2_layer_test_class import CommonTF2LayerTest rng = np.random.default_rng(23423556) class TestKerasStackedRNNCells(CommonTF2LayerTest): def _prepare_input(self,...
58
2,459
beam
sdks/python/apache_beam/runners/interactive/caching/read_cache.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...
139
6,300
mlflow
mlflow/gateway/exceptions.py
.py
class AIGatewayConfigException(Exception): pass class AIGatewayException(Exception): """ A custom exception class for handling exceptions raised by the AI Gateway. This will be transformed into an HTTPException before being returned to the client. """ def __init__(self, status_code: int, deta...
15
431
wagtail
wagtail/admin/tests/test_templatetags.py
.py
import os import unittest from datetime import datetime, timedelta from datetime import timezone as dt_timezone from unittest import mock from django import forms from django.conf import settings from django.template import Context, Template, TemplateSyntaxError from django.test import SimpleTestCase, TestCase from dj...
1,260
47,956
coremltools
coremltools/test/modelpackage/test_modelpackage.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 itertools import json import os import platform import shutil import tempfile import numpy as n...
762
30,485
probability
tensorflow_probability/examples/bayesian_neural_network.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...
363
14,025
onnxruntime
onnxruntime/python/tools/quantization/operators/gemm.py
.py
import logging import numpy as np # noqa: F401 import onnx from ..quant_utils import ( TENSOR_NAME_QUANT_SUFFIX, QuantizedValue, QuantizedValueType, attribute_to_kwarg, find_by_name, # noqa: F401 get_mul_node, # noqa: F401 ms_domain, ) from .base_operator import QuantOperatorBase # noq...
173
6,054
pyomo
pyomo/core/expr/template_expr.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...
1,292
42,489
cvxpy
cvxpy/atoms/gmatmul.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 ...
154
4,983
saleor
saleor/graphql/product/tests/queries/test_product_types_query.py
.py
import pytest from .....product import ProductTypeKind from .....product.models import ProductType from ....tests.utils import get_graphql_content def test_product_types(user_api_client, product_type, channel_USD): query = """ query ($channel: String){ productTypes(first: 20) { totalCount...
235
7,065
saleor
saleor/graphql/product/sorters.py
.py
import graphene from django.db.models import ( BooleanField, Case, Count, DateTimeField, ExpressionWrapper, F, IntegerField, Min, OuterRef, Q, QuerySet, Subquery, Value, When, ) from django.db.models.functions import Coalesce from ...product.models import ( C...
376
14,631
onnxruntime
onnxruntime/python/tools/transformers/float16.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # This file is modified from https://github.com/microsoft/onnxconverter...
510
24,681
conda
tests/cli/test_helpers.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tests for conda.cli.helpers module.""" from __future__ import annotations import argparse from argparse import ArgumentParser, Namespace import pytest from conda.cli.helpers import LazyChoicesAction @pytest.fixture def simple_choices():...
372
11,044
clearml
clearml/utilities/pyhocon/converter.py
.py
import json import re import sys from . import ConfigFactory from .config_tree import ConfigQuotedString from .config_tree import ConfigSubstitution from .config_tree import ConfigTree from .config_tree import ConfigValues from .config_tree import NoneValue try: basestring except NameError: basestring = str ...
330
13,100
beam
sdks/python/apache_beam/examples/cookbook/multiple_output_pardo.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...
215
7,398
saleor
saleor/attribute/tests/model_helpers.py
.py
from django.db.models.expressions import Exists, OuterRef from ...page.models import Page from ...product.models import Product from ..models import ( AssignedPageAttributeValue, AssignedProductAttributeValue, Attribute, AttributePage, AttributeProduct, AttributeValue, ) def get_page_attribut...
63
2,093
hydra
tests/instantiate/__init__.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import collections import collections.abc from dataclasses import dataclass, field from functools import partial from typing import Any, Dict, List, NoReturn, Optional, Tuple from omegaconf import MISSING, DictConfig, ListConfig from hydra.utils i...
454
10,480
pyomo
pyomo/contrib/pynumero/algorithms/solvers/square_solver_base.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...
113
4,699
pyro
tests/distributions/test_relaxed_straight_through.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from torch.autograd import grad from torch.distributions import constraints import pyro import pyro.optim as optim from pyro.distributions import ( OneHotCategorical, RelaxedBernoulli, Relaxe...
128
3,847
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/stochastic_volatility_sp500.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...
7,620
182,503
hydra
hydra/_internal/core_plugins/zsh_completion.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging from typing import Optional from hydra.core.config_loader import ConfigLoader from hydra.plugins.completion_plugin import CompletionPlugin log = logging.getLogger(__name__) class ZshCompletion(CompletionPlugin): def __init__(s...
49
1,545
metrics
src/torchmetrics/wrappers/multitask.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...
390
18,398
openvino
src/tests/test_utils/functional_test_utils/layer_tests_summary/run_conformance.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import csv import os import urllib.request as ur from argparse import ArgumentParser from pathlib import Path from shutil import copytree, rmtree, copyfile from subprocess import Popen from urllib.parse import urlparse import defusedxml...
366
20,873
biopython
Tests/test_SeqRecord.py
.py
# Copyright 2009-2017 by Peter Cock. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """SeqFeature related tests for SeqRecord objects from Bio.SeqIO. Initially this takes match...
671
24,941
onnxruntime
onnxruntime/python/tools/transformers/fusion_group_norm.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger import numpy as np from fusion_base impor...
181
7,465
saleor
saleor/core/editorjs/cleaners.py
.py
import warnings from typing import Any, overload import nh3 from django.conf import settings from django.core.exceptions import ValidationError from urllib3.util import parse_url from ..cleaners import URL_SCHEME_CLEANERS, URLCleanerError ALLOWED_URL_SCHEMES = { # WARNING: do NOT add new schemes in directly to t...
114
3,949
probability
tensorflow_probability/python/sts/components/semilocal_linear_trend.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...
462
20,482
hatch
tests/cli/python/test_update.py
.py
def test_not_installed(hatch, helpers): result = hatch("python", "update", "3.9", "3.10") assert result.exit_code == 1, result.output assert result.output == helpers.dedent( """ Distributions not installed: 3.9, 3.10 """ ) def test_basic(hatch, helpers, temp_dir_data, path_app...
91
3,151
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_lower_version.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import paddle import numpy as np import os import sys if paddle.__version__ >= '2.6.0': from paddle.base.proto import framework_pb2 else: from paddle.fluid.proto import framework_pb2 paddle.enable_static() inp_blob = np.random...
47
1,583
lemur
lemur/plugins/lemur_aws/ec2.py
.py
""" .. module: lemur.plugins.lemur_aws.ec2 :synopsis: Module contains some often used and helpful classes that are used to deal with ELBs .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from lemur.plugins.lemur_aws.sts import sts_client @sts_client("ec2") def get_regions(**kwargs): regions = k...
24
648
beam
sdks/python/apache_beam/runners/interactive/user_pipeline_tracker_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...
256
7,665
beam
sdks/python/apache_beam/runners/interactive/background_caching_job_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...
337
13,924
onnx
onnx/reference/ops/op_dft.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun def _fft(x: np.ndarray, fft_length: int, axis: int) -> np.ndarray: """Compute the FFT return the real representation of the complex resul...
147
4,821
scikit-optimize
skopt/tests/test_forest_opt.py
.py
from functools import partial from sklearn.tree import DecisionTreeClassifier import pytest from skopt import gbrt_minimize from skopt import forest_minimize from skopt.benchmarks import bench1 from skopt.benchmarks import bench2 from skopt.benchmarks import bench3 from skopt.benchmarks import bench4 MINIMIZERS = [(...
75
2,587
black
tests/data/cases/funcdef_return_type_trailing_comma.py
.py
# flags: --minimum-version=3.10 # normal, short, function definition def foo(a, b) -> tuple[int, float]: ... # normal, short, function definition w/o return type def foo(a, b): ... # no splitting def foo(a: A, b: B) -> list[p, q]: pass # magic trailing comma in param list def foo(a, b,): ... # magic trailin...
303
5,777
mlflow
mlflow/models/model_config.py
.py
import os from typing import Any import yaml from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE __mlflow_model_config__ = None class ModelConfig: """ ModelConfig used in code to read a YAML configuration file or a dictionary. Args: de...
151
5,072
mlflow
mlflow/system_metrics/metrics/gpu_monitor.py
.py
"""Class for monitoring GPU stats.""" import logging import sys from mlflow.system_metrics.metrics.base_metrics_monitor import BaseMetricsMonitor _logger = logging.getLogger(__name__) try: import pynvml except ImportError: # If `pynvml` is not installed, a warning will be logged at monitor instantiation. ...
72
2,905
sqlmap
thirdparty/chardet/enums.py
.py
""" All of the Enums that are used throughout the chardet package. :author: Dan Blanchard (dan.blanchard@gmail.com) """ class InputState(object): """ This enum represents the different states a universal detector can be in. """ PURE_ASCII = 0 ESC_ASCII = 1 HIGH_BYTE = 2 class LanguageFilter...
77
1,661
scikit-optimize
skopt/optimizer/__init__.py
.py
from .base import base_minimize from .dummy import dummy_minimize from .forest import forest_minimize from .gbrt import gbrt_minimize from .gp import gp_minimize from .optimizer import Optimizer __all__ = [ "base_minimize", "dummy_minimize", "forest_minimize", "gbrt_minimize", "gp_minimize", "Optimizer" ]...
14
321
readthedocs.org
readthedocs/embed/v3/tests/test_basics.py
.py
import pytest from django.conf import settings from django.core.cache import cache from django.urls import reverse @pytest.mark.django_db @pytest.mark.embed_api class TestEmbedAPIv3Basics: @pytest.fixture(autouse=True) def setup_method(self, settings): settings.PUBLIC_DOMAIN = "readthedocs.io" ...
75
2,479
saleor
saleor/tests/e2e/metadata/utils/update_private_metadata.py
.py
from ...utils import get_graphql_content PRIVATE_METADATA_UPDATE_MUTATION = """ mutation UpdatePrivateMetadata( $id: ID!, $input:[MetadataInput!]!, ) { updatePrivateMetadata(id: $id, input: $input) { errors { message field } item { privateMetadata { key ...
43
830
metrics
src/torchmetrics/functional/retrieval/_deprecated.py
.py
from typing import Optional from torch import Tensor from torchmetrics.functional.retrieval.average_precision import retrieval_average_precision from torchmetrics.functional.retrieval.fall_out import retrieval_fall_out from torchmetrics.functional.retrieval.hit_rate import retrieval_hit_rate from torchmetrics.functio...
150
5,410
beam
sdks/python/apache_beam/transforms/xlang/__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 us...
28
1,162
openvino
tests/layer_tests/tensorflow_tests/test_tf_RaggedTensorToSparse.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest from common.utils.tf_utils import run_in_jenkins rng = np.random.default_rng() class TestRaggedTensorToSparse(CommonTFLa...
64
3,325
conda
tests/cli/test_main_install.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations from json import loads as json_loads from typing import TYPE_CHECKING import pytest from conda.base.context import context, reset_context from conda.common.compat import on_win from conda.core.prefix_data im...
212
7,344
coremltools
deps/protobuf/benchmarks/util/result_uploader.py
.py
from __future__ import print_function from __future__ import absolute_import import argparse import os import re import copy import uuid import calendar import time import datetime from util import big_query_utils from util import result_parser _PROJECT_ID = 'grpc-testing' _DATASET = 'protobuf_benchmark_result' _TABL...
108
3,701
openvino
src/frontends/onnx/tests/tests_python/utils/model_importer.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import onnx import onnx.backend.test import unittest import dataclasses from collections import defaultdict from collections.abc import Callable, Sequence from onnx import numpy_helper, NodePro...
180
7,215
loguru
tests/test_filesink_watch.py
.py
import os from unittest.mock import Mock import pytest from loguru import logger from .conftest import check_dir @pytest.mark.skipif(os.name == "nt", reason="Windows can't delete file in use") def test_file_deleted_before_write_without_delay(tmp_path): file = tmp_path / "test.log" logger.add(file, format="...
149
4,502
astropy
astropy/cosmology/_src/parameter/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ("all_parameters",) import functools import operator from dataclasses import Field from typing import TypeGuard from .core import Parameter def is_parameter_or_field(obj: object, /) -> TypeGuard[Parameter | Field[Parameter]]: """Return i...
34
1,062
sphinx
sphinx/builders/dummy.py
.py
"""Do syntax checks, but no writing.""" from __future__ import annotations from typing import TYPE_CHECKING from sphinx.builders import Builder from sphinx.locale import __ if TYPE_CHECKING: from docutils import nodes from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadat...
47
1,007
hatch
src/hatch/cli/env/run.py
.py
from __future__ import annotations import os from typing import TYPE_CHECKING import click from hatch.config.constants import AppEnvVars if TYPE_CHECKING: from hatch.cli.application import Application def filter_environments(environments, filter_data): selected_environments = [] for env_name, env_data...
148
5,154
astropy
astropy/utils/iers/iers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The astropy.utils.iers package provides access to the tables provided by the International Earth Rotation and Reference Systems Service, in particular allowing interpolation of published UT1-UTC values for given times. These are used in `astropy.time`...
1,348
51,373
mlflow
tests/server/auth/test_client_rbac.py
.py
from contextlib import contextmanager import pytest import requests from mlflow import MlflowException from mlflow.environment_variables import ( MLFLOW_AUTH_CONFIG_PATH, MLFLOW_FLASK_SERVER_SECRET_KEY, MLFLOW_TRACKING_PASSWORD, MLFLOW_TRACKING_USERNAME, ) from mlflow.protos.databricks_pb2 import ( ...
358
13,859
biopython
Bio/Phylo/PAML/_parse_codeml.py
.py
# Copyright (C) 2011, 2016 by Brandon Invergo (b.invergo@gmail.com) # # 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. """Methods fo...
482
21,149
qutip
qutip/core/direct_sum.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations from . import data as _data from .cy.qobjevo import QobjEvo from .dimensions import Dimensions, Field, SumSpace from .operators import qzero from .qobj import Qobj from .superoperator import operator_to_vector from .. import setti...
704
25,315
black
tests/data/cases/beginning_backslash.py
.py
\ print("hello, world") # output print("hello, world")
13
63
cvxpy
cvxpy/utilities/grad.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...
55
1,423
astropy
astropy/utils/tests/test_state.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.utils.state import ScienceState def test_ScienceState_and_Context(): """ Tests a ScienceState and spawned contexts. """ class MyState(ScienceState): _value = "A" _state = dict(foo="bar") state = {"foo":...
26
601
probability
tensorflow_probability/python/experimental/mcmc/covariance_reducer_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...
136
5,536
onnxruntime
onnxruntime/python/tools/microbench/skip_layer_norm.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import argparse from dataclasses import dataclass import numpy as np fr...
75
2,368
biopython
Bio/GenBank/__init__.py
.py
# Copyright 2000 by Jeffrey Chang, Brad Chapman. All rights reserved. # Copyright 2006-2017 by Peter Cock. All rights reserved. # # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Code to work wit...
1,207
43,718
beam
sdks/python/apache_beam/io/gcp/datastore/v1new/util.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...
140
5,320
mlflow
tests/store/workspace/test_sqlalchemy_store.py
.py
from unittest import mock import pytest import sqlalchemy as sa from sqlalchemy.exc import IntegrityError from mlflow.entities.workspace import Workspace, WorkspaceDeletionMode from mlflow.exceptions import MlflowException from mlflow.store.artifact.artifact_repo import ArtifactRepository from mlflow.store.workspace....
639
23,515
sqlmap
lib/techniques/union/test.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import itertools import logging import random import re from lib.core.agent import agent from lib.core.common import average from lib.core.common import Backend from lib.core.com...
436
20,481
eve
eve/io/media.py
.py
# -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(): """The MediaStorage class provides a standardized API for storing files, along with a ...
63
2,255
python-prompt-toolkit
src/prompt_toolkit/key_binding/digraphs.py
.py
""" Vi Digraphs. This is a list of special characters that can be inserted in Vi insert mode by pressing Control-K followed by to normal characters. Taken from Neovim and translated to Python: https://raw.githubusercontent.com/neovim/neovim/master/src/nvim/digraph.c """ from __future__ import annotations __all__ = [...
1,379
32,785
pyomo
pyomo/core/kernel/list_container.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
107
4,095
gunicorn
tests/docker/asgi_framework_compat/tests/test_lifespan_scope.py
.py
""" Lifespan Protocol Tests Tests ASGI 3.0 lifespan protocol compliance across frameworks. """ import pytest pytestmark = pytest.mark.lifespan class TestLifespanStartup: """Test lifespan startup handling.""" async def test_startup_was_called(self, http_client): """Startup handler was called.""" ...
100
3,447
ipython
IPython/core/latex_symbols.py
.py
# DO NOT EDIT THIS FILE BY HAND. # To update this file, run the script /tools/gen_latex_symbols.py using Python 3 # This file is autogenerated from the file: # https://raw.githubusercontent.com/JuliaLang/julia/master/stdlib/REPL/src/latex_symbols.jl # This original list is filtered to remove any unicode characters th...
1,305
30,108
returns
returns/pointfree/bind_context_result.py
.py
from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, TypeVar from returns.interfaces.specific.reader_result import ReaderResultLikeN from returns.primitives.hkt import Kinded, KindN, kinded if TYPE_CHECKING: from returns.context import ReaderResult # noqa: WP...
73
2,066
cvxpy
cvxpy/atoms/affine/partial_transpose.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...
96
3,573