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
mlflow
mlflow/genai/optimize/optimizers/__init__.py
.py
from mlflow.genai.optimize.optimizers.base import BasePromptOptimizer from mlflow.genai.optimize.optimizers.gepa_optimizer import GepaPromptOptimizer from mlflow.genai.optimize.optimizers.metaprompt_optimizer import MetaPromptOptimizer __all__ = ["BasePromptOptimizer", "GepaPromptOptimizer", "MetaPromptOptimizer"]
6
317
saleor
saleor/tests/e2e/checkout/discounts/test_checkout_calculate_correct_discount_for_sale_and_voucher.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 ...utils import assign...
1,856
74,507
pymc
tests/stats/test_convergence.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...
101
3,223
pyomo
pyomo/contrib/mindtpy/tests/nonconvex1.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...
65
2,446
beam
sdks/python/apache_beam/examples/sinks/test_periodicimpulse.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...
69
2,423
beam
sdks/python/apache_beam/io/gcp/bigquery_change_history.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
1,351
50,977
openvino
tests/layer_tests/tensorflow_tests/test_tf_Reverse.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 TestReverse(CommonTFLayerTest): def create_reverse_net(self, shape, dims): import tensorflow as tf tf.compat.v1.reset_default_graph() ...
33
1,184
pyomo
pyomo/opt/tests/solver/__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
580
probability
tensorflow_probability/python/experimental/parallel_filter/parallel_kalman_filter_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...
400
17,456
cvxpy
cvxpy/reductions/complex2real/canonicalizers/variable_canon.py
.py
""" Copyright 2013 Steven Diamond, 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 agr...
46
1,720
cvxpy
cvxpy/settings.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...
256
6,793
pyomo
pyomo/contrib/iis/iis.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...
155
4,611
hatch
src/hatch/env/system.py
.py
import os from hatch.env.plugin.interface import EnvironmentInterface from hatch.utils.env import PythonInfo class SystemEnvironment(EnvironmentInterface): PLUGIN_NAME = "system" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.python_info = PythonInfo(self.platfo...
51
1,663
hydra
hydra/_internal/core_plugins/file_config_source.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os from typing import List, Optional from omegaconf import OmegaConf from hydra.core.object_type import ObjectType from hydra.plugins.config_source import ConfigLoadError, ConfigResult, ConfigSource class FileConfigSource(ConfigSource): ...
64
2,317
coremltools
coremltools/converters/sklearn/_one_hot_encoder.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools import proto from ... import SPECIFICATION_VERSION from ..._deps import _HAS_SKLEARN, ...
264
9,864
mlflow
examples/catboost/train.py
.py
# Based on the official regression example: # https://catboost.ai/docs/concepts/python-usages-examples.html#regression import numpy as np from catboost import CatBoostRegressor import mlflow from mlflow.models import infer_signature # Initialize data train_data = np.array([[1, 4, 5, 6], [4, 5, 6, 7], [30, 40, 50, 60...
39
1,057
sqlmap
plugins/dbms/monetdb/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ try: import pymonetdb except: pass import logging from lib.core.common import getSafeExString from lib.core.data import conf from lib.core.data import logger from lib.co...
60
1,893
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_partial_concat.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # partial_concat paddle model generator # import numpy as np from save_model import saveModel import paddle import sys def partial_concat(name: str, x, y, start_index=0, length=-1): paddle.enable_static() with paddle.static.p...
67
2,068
probability
tensorflow_probability/python/internal/trainable_state_util_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...
367
14,041
textual
src/textual/_opacity.py
.py
from typing import Iterable, cast from rich.segment import Segment from rich.style import Style from textual.color import Color def _apply_opacity( segments: Iterable[Segment], base_background: Color, opacity: float, ) -> Iterable[Segment]: """Takes an iterable of foreground Segments and blends them...
43
1,527
onnxruntime
onnxruntime/test/testdata/dynamic_quantize_matmul_test.py
.py
import onnx from onnx import TensorProto, helper def GenerateModel(model_name, sign, b_zp=True, bias=False): # noqa: N802 nodes = [ # DynamicQuantizeMatMul subgraph helper.make_node( "DynamicQuantizeLinear", ["A"], ["a_quantized", "a_scale", "a_zp"], "Dyna...
69
2,317
saleor
saleor/webhook/tests/test_webhook_protocols.py
.py
import datetime from unittest import mock from unittest.mock import ANY, MagicMock, patch import boto3 import jwt import pytest from django.core.serializers import serialize from google.cloud.pubsub_v1 import PublisherClient from requests_hardened import HTTPSession from ...core import EventDeliveryStatus from ...cor...
550
17,723
saleor
saleor/core/error_codes.py
.py
from enum import Enum class ShopErrorCode(Enum): ALREADY_EXISTS = "already_exists" CANNOT_FETCH_TAX_RATES = "cannot_fetch_tax_rates" GRAPHQL_ERROR = "graphql_error" INVALID = "invalid" NOT_FOUND = "not_found" REQUIRED = "required" UNIQUE = "unique" PASSWORD_AUTH_RESTRICTION = "password...
39
918
wagtail
wagtail/admin/site_summary.py
.py
import swapper from django.forms import Media from wagtail import hooks from wagtail.admin.auth import user_has_any_page_permission from wagtail.admin.navigation import get_site_for_user from wagtail.admin.ui.components import Component from wagtail.models import Site Page = swapper.load_model("wagtailcore", "Page") ...
82
2,569
onnx
onnx/reference/ops/experimental/__init__.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations __all__ = ["load_op"] from onnx.reference.ops.experimental._op_list import load_op
9
202
pyomo
pyomo/tpl/__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...
17
850
beam
sdks/python/apache_beam/io/gcp/spanner_wrapper.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...
77
2,547
beam
learning/tour-of-beam/learning-content/io/big-query-io/read-query/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...
71
2,640
wandb
wandb/apis/public/runhistory/downloads.py
.py
from __future__ import annotations import asyncio import pathlib import time from dataclasses import dataclass from wandb.apis.public.service_api import ServiceApi from wandb.proto import wandb_api_pb2 as apb from wandb.sdk.lib import asyncio_compat from wandb.sdk.lib.printer import new_printer from wandb.sdk.lib.pro...
139
4,906
onnx
onnx/reference/ops/op_hamming_window.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op_common_window import _CommonWindow class HammingWindow(_CommonWindow): r"""Returns :math:`\\omega_n = \\alpha - \\beta \\cos \\left( \\frac{\\pi n}{N...
24
791
luigi
luigi/configuration/__init__.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...
27
836
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_voucher_is_still_active_when_payment_fails.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...
161
4,778
pyro
tests/contrib/mue/test_models.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from torch.optim import Adam import pyro from pyro.contrib.mue.dataloaders import BiosequenceDataset from pyro.contrib.mue.models import FactorMuE, ProfileHMM from pyro.optim import MultiS...
108
3,213
confluent-kafka-python
tests/integration/admin/test_list_offsets.py
.py
# -*- coding: utf-8 -*- # Copyright 2023 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...
87
3,175
cvxpy
cvxpy/reductions/solvers/conic_solvers/pdcs_conif.py
.py
""" Copyright 2026, 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...
250
9,586
openvino
tests/layer_tests/pytorch_tests/test_quantize.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch import torch.ao.quantization.fx._decomposed from pytorch_layer_test_class import PytorchLayerTest class aten_quantize_per_tensor_aten_dequantize(torch.nn.Module): def ...
223
9,273
readthedocs.org
readthedocs/organizations/filters.py
.py
"""Filters used in the organization dashboard views.""" import structlog from django.db.models import F from django.utils.translation import gettext_lazy as _ from django_filters import ChoiceFilter from django_filters import OrderingFilter from readthedocs.core.filters import FilteredModelChoiceFilter from readthedo...
243
8,276
gunicorn
gunicorn/asgi/protocol.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ ASGI protocol handler for gunicorn. Implements asyncio.Protocol to handle HTTP/1.x and HTTP/2 connections and dispatch to ASGI applications. """ import asyncio import errno import ipaddress import time from ...
1,791
70,068
openvino
tests/layer_tests/pytorch_tests/test_linear.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestMatMul(PytorchLayerTest): def _prepare_input(self, m1_shape=(2, 2), m2_shape=(2, 2), bias_shape=None): if bias_shape is None: return...
78
2,922
onnxruntime
orttraining/orttraining/python/training/ortmodule/torch_cpp_extensions/cpu/torch_interop_utils/__init__.py
.py
def clear_all_grad_fns(): from onnxruntime.training.ortmodule.torch_cpp_extensions import torch_interop_utils # noqa: PLC0415 torch_interop_utils.clear_all_grad_fns() import atexit # noqa: E402 # Clear all gradient functions, to avoid a deadlock issue. # Check the called function for more detailed comment...
12
359
wandb
wandb/apis/__init__.py
.py
"""api.""" from __future__ import annotations from collections.abc import Callable import wandb from wandb import env, util def _disable_ssl() -> Callable[[], None]: import requests from urllib3.exceptions import InsecureRequestWarning # Because third party libraries may also use requests, we monkey p...
51
1,391
mkdocs
mkdocs/tests/theme_tests.py
.py
import os import unittest from unittest import mock import mkdocs from mkdocs.localization import parse_locale from mkdocs.tests.base import tempdir from mkdocs.theme import Theme abs_path = os.path.abspath(os.path.dirname(__file__)) mkdocs_dir = os.path.abspath(os.path.dirname(mkdocs.__file__)) mkdocs_templates_dir ...
126
4,252
beam
sdks/python/apache_beam/examples/fastavro_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...
184
5,851
pyomo
pyomo/contrib/alternative_solutions/shifted_lp.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...
228
9,107
black
src/black/lines.py
.py
import itertools import math from collections.abc import Callable, Iterator, Sequence from dataclasses import dataclass, field from typing import NamedTuple, Optional, TypeVar, Union, cast from black.brackets import COMMA_PRIORITY, DOT_PRIORITY, BracketTracker from black.mode import Mode, Preview from black.nodes impo...
1,736
68,888
mlflow
tests/models/test_dependencies_schema.py
.py
from unittest import mock from mlflow.models import dependencies_schemas from mlflow.models.dependencies_schemas import ( DependenciesSchemas, DependenciesSchemasType, RetrieverSchema, _get_dependencies_schemas, _get_retriever_schema, set_retriever_schema, ) def test_retriever_creation(): ...
287
9,199
sqlmap
plugins/dbms/cratedb/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 getPasswordHashes(self):...
23
631
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_stack.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # stack paddle model generator # import numpy as np from save_model import saveModel import sys def stack(axis, input1, input2, input3): import paddle paddle.enable_static() with paddle.static.program_guard(paddle.static...
85
2,949
wagtail
wagtail/images/tests/test_rich_text.py
.py
from django.test import TestCase from django.urls import reverse_lazy from wagtail.fields import RichTextField from wagtail.images.rich_text import ImageEmbedHandler as FrontendImageEmbedHandler from wagtail.images.rich_text.editor_html import ( ImageEmbedHandler as EditorHtmlImageEmbedHandler, ) from wagtail.rich...
157
5,462
black
tests/data/cases/line_ranges_fmt_off_decorator.py
.py
# flags: --line-ranges=12-12 --line-ranges=21-21 # NOTE: If you need to modify this file, pay special attention to the --line-ranges= # flag above as it's formatting specifically these lines. # Regression test for an edge case involving decorators and fmt: off/on. class MyClass: # fmt: off @decorator ( ) ...
48
998
coveragepy
coverage/regions.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """Find functions and classes in Python code.""" from __future__ import annotations import ast from typing import cast from dataclasses import dataclass from c...
128
4,503
pyomo
pyomo/devel/initialization/global_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...
55
2,325
saleor
saleor/graphql/discount/tests/mutations/test_promotion_rule_create.py
.py
from decimal import Decimal from unittest.mock import ANY, patch import graphene from django.test import override_settings from .....discount import PromotionEvents from .....discount.error_codes import PromotionRuleCreateErrorCode from .....discount.models import PromotionEvent from .....product.models import Produc...
1,934
61,484
metrics
src/torchmetrics/functional/pairwise/__init__.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...
27
1,173
wagtail
wagtail/url_routing.py
.py
class RouteResult: """ An object to be returned from Page.route, which encapsulates all the information necessary to serve an HTTP response. Analogous to django.urls.resolvers.ResolverMatch, except that it identifies a Page instance that we will call serve(*args, **kwargs) on, rather than a view...
17
578
sphinx
tests/roots/test-ext-autodoc/target/name_conflict/__init__.py
.py
from .foo import bar class foo: """docstring of target.name_conflict::foo.""" pass
8
94
readthedocs.org
readthedocs/doc_builder/tests/test_director.py
.py
import os from unittest import mock from django.test import TestCase, override_settings from django_dynamic_fixture import get from readthedocs.builds.models import Build, Version from readthedocs.config.tests.test_config import get_build_config from readthedocs.doc_builder.director import BuildDirector from readthed...
148
6,019
wandb
wandb/sdk/mailbox/mailbox_handle.py
.py
from __future__ import annotations import abc from collections.abc import Callable from typing import Generic from typing_extensions import TypeVar, override from wandb.sdk.lib import asyncio_manager _T = TypeVar("_T") _S = TypeVar("_S") class HandleAbandonedError(Exception): """The handle has no response and...
129
4,054
sphinx
tests/test_ext_autodoc/test_ext_autodoc_importer.py
.py
from __future__ import annotations import sys from pathlib import Path from sphinx.ext.autodoc._dynamic._importer import _import_module def test_import_native_module_stubs(rootdir: Path) -> None: fish_licence_root = rootdir / 'test-ext-apidoc-duplicates' sys_path = list(sys.path) sys.path.insert(0, str...
23
698
wandb
tests/unit_tests/test_cli_leet.py
.py
from __future__ import annotations import pathlib import pytest from wandb.cli import cli, leet from wandb.errors import WandbCoreNotAvailableError @pytest.fixture def core_calls(monkeypatch) -> list[list[str]]: """Stub out wandb-core and record the arguments it would be invoked with.""" calls: list[list[st...
102
3,273
astropy
astropy/utils/masked/function_helpers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Helpers for letting numpy functions interact with Masked arrays. The module supplies helper routines for numpy functions that propagate masks appropriately, for use in the ``__array_function__`` implementation of `~astropy.utils.masked.MaskedNDArray`. ...
1,458
46,052
hatch
backend/src/hatchling/builders/app.py
.py
from __future__ import annotations from typing import Any from hatchling.builders.binary import BinaryBuilder class AppBuilder(BinaryBuilder): PLUGIN_NAME = "app" def build_bootstrap( self, directory: str, **build_data: Any, ) -> str: self.app.display_warning( ...
21
530
loguru
tests/test_ansimarkup_basic.py
.py
import pytest from colorama import Back, Fore, Style from .conftest import parse @pytest.mark.parametrize( ("text", "expected"), [ ("<bold>1</bold>", Style.BRIGHT + "1" + Style.RESET_ALL), ("<dim>1</dim>", Style.DIM + "1" + Style.RESET_ALL), ("<normal>1</normal>", Style.NORMAL + "1" +...
240
6,924
onnxruntime
orttraining/orttraining/test/python/orttraining_test_ortmodule_bert_classifier.py
.py
import argparse import datetime import logging import os import random import time import zipfile import numpy as np import pandas as pd import torch import wget from sklearn.model_selection import train_test_split from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from transforme...
470
18,581
onnx
onnx/reference/ops/op_conv.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 _conv_implementation( X, W, B, auto_pad, dilations, group, kernel_shape, pads, strides ): if dilations is None: dilations...
317
13,111
black
tests/data/cases/python37.py
.py
def f(): return (i * 2 async for i in arange(42)) def g(): return ( something_long * something_long async for something_long in async_generator(with_an_argument) ) async def func(): await ... if test: out_batched = [ i async for i in aitertools._as...
62
1,173
onnxruntime
onnxruntime/python/tools/quantization/execution_providers/qnn/__init__.py
.py
from .preprocess import qnn_preprocess_model # noqa: F401 from .quant_config import get_qnn_qdq_config # noqa: F401
3
118
mlflow
mlflow/tracking/context/databricks_cluster_context.py
.py
from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils import databricks_utils from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_CLUSTER_ID class DatabricksClusterRunContext(RunContextProvider): def in_context(self): return databricks_utils.is_in_cluster() def ...
16
520
jupyterlab
docs/source/_ext/spelling_filters.py
.py
#!/usr/bin/env python3 # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Custom filters for ``sphinxcontrib.spelling``.""" from __future__ import annotations import re from enchant.tokenize import Filter # Ignore identifier-like words common in docs code snippe...
40
1,016
probability
tensorflow_probability/python/distributions/inflated_test.py
.py
# Copyright 2022 The TensorFlow Probability Authors. All Rights Reserved. # # 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 require...
142
5,654
marshmallow
performance/benchmark.py
.py
"""Simple benchmark for marshmallow serialization of a moderately complex object. Uses the `timeit` module to benchmark serializing an object through marshmallow. """ # ruff: noqa: A002, T201 import argparse import cProfile import datetime import gc import timeit from marshmallow import Schema, ValidationError, fiel...
153
3,859
django-cms
cms/tests/test_api.py
.py
import sys from unittest.mock import patch from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.core.exceptions import FieldError from django.db import connect...
476
22,486
python-prompt-toolkit
src/prompt_toolkit/filters/base.py
.py
from __future__ import annotations from abc import ABCMeta, abstractmethod from collections.abc import Callable, Iterable __all__ = ["Filter", "Never", "Always", "Condition", "FilterOrBool"] class Filter(metaclass=ABCMeta): """ Base class for any filter to activate/deactivate a feature, depending on a c...
261
6,851
wandb
tests/unit_tests/test_lib/test_filenames.py
.py
from pathlib import Path import pytest from wandb.sdk.lib.filenames import exclude_wandb_fn, filtered_dir def test_filtered_dir_one_parameter(tmp_path: Path): with open(tmp_path / "foo.txt", "w") as f: f.write("test") filtered_dir(tmp_path, lambda path: True, lambda path: False) def test_filtered_d...
40
1,310
wandb
wandb/sdk/artifacts/_generated/fragments.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from typing import Literal from pydantic import Field from wandb._pydantic import GQLId, GQLResult, Typename from .enums import ArtifactState class ArtifactAliasFragment(GQLResult): typename__: Typena...
320
9,033
onnx
onnx/reference/ops/op_log_softmax.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops.op_softmax import Softmax class LogSoftmax(Softmax): def _run(self, X): Y = Softmax._run(self, X)[0] np.log(Y, out=Y) return (Y,)...
16
321
beam
sdks/python/apache_beam/runners/interactive/non_interactive_runner_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...
295
10,518
ipython
IPython/core/guarded_eval.py
.py
from copy import copy from inspect import get_annotations, isclass, signature, Signature, getmodule from typing import ( Annotated, AnyStr, Literal, NamedTuple, NewType, Protocol, TypeGuard, Union, get_args, get_origin, is_typeddict, ) from collections.abc import Callable, Se...
1,663
57,855
pyomo
pyomo/contrib/piecewise/tests/test_nonlinear_to_pwl.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...
790
29,998
mlflow
dev/clint/src/clint/rules/forbidden_trace_ui_in_notebook.py
.py
from clint.rules.base import Rule class ForbiddenTraceUIInNotebook(Rule): def _message(self) -> str: return ( "Found the MLflow Trace UI iframe in the notebook. " "The trace UI in cell outputs will not render correctly in previews or the website. " "Please run `mlflow.t...
12
422
biopython
Doc/examples/fasta_dictionary.py
.py
# Copyright 2000 Brad Chapman. All rights reserved. # Revisions copyright 2007 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. """Example using Bio.SeqIO to load ...
64
2,093
probability
tensorflow_probability/python/optimizer/nelder_mead_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...
386
14,111
lemur
lemur/plugins/base/__init__.py
.py
""" .. module: lemur.plugins.base :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from lemur.plugins.base.manager import PluginManager from lemur.plugins.base.v1 import * ...
16
414
ipython
IPython/extensions/autoreload.py
.py
"""IPython extension to reload modules before executing user code. ``autoreload`` reloads modules automatically before entering the execution of code typed at the IPython prompt. This makes for example the following workflow possible: .. sourcecode:: ipython In [1]: %load_ext autoreload In [2]: %autoreload 2...
916
32,208
biopython
Bio/motifs/xms.py
.py
# Copyright 2015 by Gert Hulselmans. 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. """Parse XMS motif files...
107
3,942
metrics
tests/unittests/segmentation/inputs.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
56
2,168
jupytext
tests/data/notebooks/outputs/ipynb_to_percent/The flavors of raw cells.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [raw] raw_mimetype="text/latex" # $1+1$ # %% [raw] raw_mimetype="text/restructuredtext" # :math:`1+1` # %% [raw] raw_mimetype="text/html" # <b>Bold text<b> # %% [raw] raw_mimetype="text/markdown" # **...
26
409
sqlmap
plugins/dbms/mckoi/connector.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.exception import SqlmapUnsupportedFeatureException from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): def co...
16
502
mlflow
mlflow/store/db/db_types.py
.py
""" Set of SQLAlchemy database schemas supported in MLflow for tracking server backends. """ POSTGRES = "postgresql" MYSQL = "mysql" SQLITE = "sqlite" MSSQL = "mssql" DATABASE_ENGINES = [POSTGRES, MYSQL, SQLITE, MSSQL]
11
221
probability
spinoffs/autobnn/autobnn/util_test.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...
78
2,495
openvino
tests/layer_tests/pytorch_tests/test_empty.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestEmptyNumeric(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(10, 10, 10),) def crea...
214
9,044
confluent-kafka-python
tests/schema_registry/_sync/test_avro_serdes.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...
3,285
101,212
metrics
src/torchmetrics/functional/audio/__init__.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...
78
2,744
wagtail
wagtail/documents/tests/test_api_v3/base.py
.py
from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase from wagtail.api.v3.tests.base import TestV3Base from wagtail.documents import get_document_model from wagtail.test.utils import WagtailTestUtils from wagtail.test.utils.wagtail_factories import CollectionFactory Document =...
24
821
metrics
src/torchmetrics/functional/regression/mae.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...
82
2,855
wandb
tests/system_tests/test_artifacts/test_misc.py
.py
from __future__ import annotations import re import time import uuid from operator import attrgetter from pathlib import Path import numpy as np import wandb from pytest import fail, raises from wandb import Api from wandb.apis import public def assert_eq_runs( run_a: wandb.Run | public.Run, run_b: wandb.Run | ...
155
5,399
astropy
astropy/visualization/stretch.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Classes that deal with stretching, i.e. mapping a range of [0:1] values onto another set of [0:1] values with a transformation. """ import numpy as np from .transform import BaseTransform, CompositeTransform __all__ = [ "AsinhStretch", "Bas...
992
29,206
kombu
kombu/utils/amq_manager.py
.py
"""AMQP Management API utilities.""" from __future__ import annotations def get_manager(client, hostname=None, port=None, userid=None, password=None): """Get pyrabbit manager.""" import pyrabbit opt = client.transport_options.get def get(name, val, default): return (val if v...
23
716
astropy
astropy/stats/tests/test_bayesian_blocks.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_allclose from astropy.stats import RegularEvents, bayesian_blocks def test_single_change_point(): rng = np.random.default_rng(0) x = np.concatenate([rng.random(100), 1 + rng.rand...
206
6,316
clearml
clearml/binding/environ_bind.py
.py
import os from functools import partial from multiprocessing import pool from time import sleep from typing import Callable, TYPE_CHECKING, Any if TYPE_CHECKING: from .. import Task from ..config import TASK_LOG_ENVIRONMENT, running_remotely, config from ..utilities.process.mp import BackgroundMonitor class Envi...
314
11,707