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
wagtail
wagtail/embeds/finders/base.py
.py
class EmbedFinder: def accept(self, url): return False def find_embed(self, url, max_width=None, max_height=None): raise NotImplementedError
7
166
flit
flit/init.py
.py
from datetime import date import json import os from pathlib import Path import re import sys import tomli_w def get_data_dir(): """Get the directory path for flit user data files. """ home = os.path.realpath(os.path.expanduser('~')) if sys.platform == 'darwin': d = Path(home, 'Library') e...
249
8,785
mlflow
tests/shap/test_log.py
.py
import json from pathlib import Path from unittest import mock import numpy as np import pandas as pd import pytest import shap import sklearn from numba import njit from packaging.version import Version from sklearn.datasets import load_diabetes import mlflow import mlflow.pyfunc.scoring_server as pyfunc_scoring_ser...
515
18,036
saleor
saleor/discount/utils/promotion.py
.py
import datetime from collections import defaultdict from collections.abc import Callable, Iterable, Iterator from dataclasses import asdict from decimal import Decimal from itertools import chain from typing import TYPE_CHECKING, NamedTuple, Union, cast from uuid import UUID import graphene from django.conf import set...
972
33,810
onnx
onnx/backend/test/case/node/scatternd.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 def scatter_nd_impl( data: np.ndarray, indices: np.ndarray, updates: np....
272
10,458
lemur
lemur/plugins/lemur_digicert/plugin.py
.py
""" .. module: lemur.plugins.lemur_digicert.plugin :platform: Unix :synopsis: This module is responsible for communicating with the DigiCert ' Advanced API. :license: Apache, see LICENSE for more details. DigiCert CertCentral (v2 API) Documentation https://www.digicert.com/services/v2/documenta...
742
26,836
hypercorn
tests/protocol/test_h11.py
.py
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
416
15,088
onnx
onnx/reference/ops/op_tan.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 import OpRunUnaryNum class Tan(OpRunUnaryNum): def _run(self, x): return (np.tan(x),)
14
265
structlog
src/structlog/_generic.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. """ Generic bound logger that can wrap anything. """ from __future__ import annotations fro...
55
1,636
saleor
saleor/graphql/menu/bulk_mutations/__init__.py
.py
from .menu_bulk_delete import MenuBulkDelete from .menu_item_bulk_delete import MenuItemBulkDelete __all__ = [ "MenuBulkDelete", "MenuItemBulkDelete", ]
8
162
onnxruntime
orttraining/orttraining/python/training/ortmodule/_mem_efficient_grad_mgmt.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from __future__ import annotations import ctypes import torch from onn...
184
6,981
wandb
wandb/sdk/launch/_launch.py
.py
from __future__ import annotations import asyncio import logging import os import sys from typing import Any import wandb from wandb.analytics import TelemetryRecorder from wandb.apis.internal import Api from . import loader from ._project_spec import LaunchProject from .agent import LaunchAgent from .agent.agent im...
339
11,941
cvxpy
cvxpy/reductions/dqcp2dcp/sets.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 ...
194
5,295
coveragepy
coverage/multiproc.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 """Monkey-patching to add multiprocessing support for coverage.py""" from __future__ import annotations import multiprocessing import multiprocessing.process im...
121
4,175
clearml
clearml/config/defs.py
.py
import tempfile from pathlib2 import Path from ..backend_config import EnvEntry from ..backend_config.converters import base64_to_text, or_ SESSION_CACHE_FILE = ".session.json" DEFAULT_CACHE_DIR = str(Path(tempfile.gettempdir()) / "clearml_cache") TASK_ID_ENV_VAR = EnvEntry("CLEARML_TASK_ID", "TRAINS_TASK_ID") DOCK...
61
3,238
textual
src/textual/drivers/headless_driver.py
.py
from __future__ import annotations import asyncio from textual import events from textual.driver import Driver from textual.geometry import Size class HeadlessDriver(Driver): """A do-nothing driver for testing.""" @property def is_headless(self) -> bool: """Is the driver running in 'headless' m...
67
1,888
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse from openvino import Model # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.moc_frontend.preprocessing import apply_preprocessing def moc_emit_ir(ngraph_function: Model, argv: argparse.Namespac...
33
1,424
mlflow
tests/data/test_dataset_source.py
.py
import json import pandas as pd import pytest import mlflow.data from mlflow.exceptions import MlflowException from tests.resources.data.dataset_source import SampleDatasetSource def test_load(tmp_path): assert SampleDatasetSource("test:" + str(tmp_path)).load() == str(tmp_path) def test_conversion_to_json_a...
74
2,483
saleor
saleor/graphql/order/tests/integration/test_order.py
.py
import graphene import pytest from ....account.tests.mutations.permission_group.test_permission_group_update import ( PERMISSION_GROUP_UPDATE_MUTATION, ) from ....tests.utils import assert_no_permission, get_graphql_content from ..mutations.test_fulfillment_cancel import CANCEL_FULFILLMENT_MUTATION from ..mutation...
79
2,689
beam
sdks/python/apache_beam/internal/test_data/module_1_local_variable_added.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...
29
1,093
mlflow
mlflow/data/spark_dataset.py
.py
import json import logging from functools import cached_property from typing import TYPE_CHECKING, Any from packaging.version import Version from mlflow.data.dataset import Dataset from mlflow.data.dataset_source import DatasetSource from mlflow.data.delta_dataset_source import DeltaDatasetSource from mlflow.data.dig...
405
16,592
wandb
wandb/sdk/artifacts/_generated/fetch_organization.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 class FetchOrganization(GQLResult): organization: FetchOrganizationOrganization | None cla...
32
751
pdm
src/pdm/cli/commands/sync.py
.py
import argparse from pdm.cli.commands.base import BaseCommand from pdm.cli.filters import GroupSelection from pdm.cli.hooks import HookManager from pdm.cli.options import ( clean_group, dry_run_option, groups_group, install_group, lockfile_option, skip_option, venv_option, ) from pdm.projec...
57
1,557
conda
conda/cli/main_run.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI implementation for `conda run`. Runs the provided command within the specified environment. """ import os import sys from argparse import REMAINDER, ArgumentParser, Namespace, _SubParsersAction from logging import getLogger def config...
161
4,909
pyomo
examples/pyomobook/python-ch/class.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...
35
1,011
saleor
saleor/core/languages.py
.py
"""List of all languages supported in Saleor. Generated with Babel: from babel import Locale from babel.localedata import locale_identifiers EXCLUDE = [ "ar_001", "en_US_POSIX", "en_001", "en_150", "eo_001", "es_419", "ia_001", "prg_001", "vo_001", "yi_001", ] languages = [] ...
809
27,891
saleor
saleor/graphql/order/mutations/order_update.py
.py
from typing import cast from uuid import UUID import graphene from django.core.exceptions import ValidationError from ....account.models import User from ....checkout import AddressType from ....core.tracing import traced_atomic_transaction from ....core.utils.update_mutation_manager import InstanceTracker from ....o...
296
10,959
cvxpy
cvxpy/tests/nlp_tests/test_sum.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 ...
105
3,685
openvino
tools/ovc/unit_tests/ovc/convert/meta_data_test_actual.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import tempfile import unittest from pathlib import Path from openvino import get_version as get_rt_version from openvino import serialize, convert_model from openvino.tools.mo.utils.ir_reader.restore_graph import restore_grap...
87
3,625
scikit-bio
skbio/io/format/sample_metadata.py
.py
"""Sample Metadata object ported over from qiime2. =============================================== .. currentmodule:: skbio.io.format.sample_metadata This implements the Sample_Metadata format which is identical to the Metadata format implemented in qiime2. (see: https://docs.qiime2.org/2024.2/tutorials/metadata/) ...
368
14,021
saleor
saleor/product/models.py
.py
import datetime from collections.abc import Iterable from decimal import Decimal from typing import Optional import graphene from django.conf import settings from django.contrib.postgres.indexes import BTreeIndex, GinIndex from django.contrib.postgres.search import SearchVectorField from django.core.validators import ...
729
23,823
metrics
src/torchmetrics/functional/classification/accuracy.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...
439
20,039
jupytext
tests/data/notebooks/outputs/ipynb_to_script/Line_breaks_in_LateX_305.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # This cell uses no particular cell marker # # $$ # \begin{align} # \dot{x} & = \sigma(y-x)\\ # \dot{y} & = \rho x - y - xz \\ # \dot{z} & = -\beta z + xy # \end{align} # $$ # This cell uses no particular ce...
41
750
wandb
wandb/plot/viz.py
.py
from __future__ import annotations from dataclasses import dataclass from typing import Any from wandb.data_types import Table from wandb.errors import Error @dataclass class VisualizeSpec: name: str key: str = "" @property def config_value(self) -> dict[str, Any]: return { "id"...
42
943
probability
spinoffs/inference_gym/inference_gym/internal/data_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...
127
4,946
biopython
Bio/Phylo/Newick.py
.py
# Copyright (C) 2009 by Eric Talevich (eric.talevich@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. """Classes corres...
42
1,298
biopython
Bio/pairwise2.py
.py
# Copyright 2002 by Jeffrey Chang. # Copyright 2016, 2019, 2020 by Markus Piotrowski. # 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 ...
1,442
53,157
textual
tests/snapshot_tests/snapshot_apps/offsets.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label, Static class Box(Static): DEFAULT_CSS = """ Box { border: solid white; background: darkblue; width: 16; height: auto; } """ def compose(self) -> ComposeResult: yield Label...
40
645
python-prompt-toolkit
examples/prompts/auto-completion/fuzzy-word-completer.py
.py
#!/usr/bin/env python """ Autocompletion example. Press [Tab] to complete the current word. - The first Tab press fills in the common part of all completions and shows all the completions. (In the menu) - Any following tab press cycles through all the possible completions. """ from prompt_toolkit.completion impor...
61
1,193
gunicorn
examples/timeout.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import sys import time def app(environ, start_response): """Application which pauses 35 seconds before responding. the worker will timeout in default case.""" data = b'Hello, World!\n' status = '2...
23
598
openvino
src/frontends/tensorflow/tests/test_models/models_pbtxt/forward_edge_model2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: const2 = tf.constant(2.0, dtype=tf.float32) x = tf.placeholder(dtype=tf.float32, shape=[2, 3], name='x') relu = tf.nn.relu(x) mul = ...
20
585
pyomo
pyomo/contrib/viewer/qt.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
167
5,764
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_where.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # where paddle model generator # import numpy as np from save_model import saveModel import sys def where(name, test_x, test_y, test_cond): import paddle paddle.enable_static() main_program = paddle.static.Program() s...
73
2,450
saleor
saleor/plugins/user_email/tests/test_tasks.py
.py
from unittest import mock from ....account.notifications import get_default_user_payload from ....giftcard import GiftCardEvents from ....giftcard.models import GiftCardEvent from ....graphql.core.utils import to_global_id_or_none from ....invoice import InvoiceEvents from ....invoice.models import Invoice, InvoiceEve...
1,311
42,921
wandb
tests/system_tests/test_api/test_public_api_run_summary.py
.py
import pytest import wandb def test_delete_summary_metric_w_no_lazyload(user): with wandb.init(project="test") as run: run_id = run.id metric = "test_val" for i in range(10): run.log({metric: i}) run = wandb.Api().run(f"test/{run_id}") del run.summary[metric] run....
20
471
pyomo
examples/pyomobook/scripts-ch/attributes.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...
34
1,124
pyfilesystem2
fs/_repr.py
.py
"""Tools to generate __repr__ strings. """ from __future__ import unicode_literals import typing if typing.TYPE_CHECKING: from typing import Text, Tuple def make_repr(class_name, *args, **kwargs): # type: (Text, *object, **Tuple[object, object]) -> Text """Generate a repr string. Positional argume...
42
1,211
astropy
astropy/coordinates/sky_coordinate_parsers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import re from collections.abc import Sequence import numpy as np from astropy import units as u from astropy.units import IrreducibleUnit, Unit from .baseframe import ( BaseCoordinateFrame, _get_diff_cls, _get_repr_cls, frame_transform...
636
26,448
openvino
tests/layer_tests/pytorch_tests/test_softmax.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import torch.nn.functional as F from pytorch_layer_test_class import PytorchLayerTest class TestSoftmax(PytorchLayerTest): def _prepare_input(self, second_input_dtype=None): if second_input_dtype...
93
3,203
probability
tensorflow_probability/python/experimental/tangent_spaces/spaces_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...
342
12,097
beam
sdks/python/apache_beam/io/sources_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...
125
3,979
kombu
t/unit/test_pools.py
.py
from __future__ import annotations from unittest.mock import Mock import pytest from kombu import Connection, Producer, pools from kombu.connection import ConnectionPool, PooledConnection from kombu.utils.collections import eqhash class test_ProducerPool: Pool = pools.ProducerPool class MyPool(pools.Produ...
259
7,813
beam
sdks/python/apache_beam/yaml/yaml_mapping.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,009
36,194
openvino
tests/e2e_tests/common/config.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Fields for logger """ import os import re from .core import get_bool, get_list, get_path class StrippingLists: DEFAULT_SENSITIVE_KEYS_TO_BE_MASKED = [ r"(?!zabbix_operator_initial_).*pass(word)?", r".*client_id", r".*...
118
5,608
voila
tests/template_prefixes/loader_test.py
.py
"""Tests loading template of jinja2 templates""" import os from jinja2 import Environment, FileSystemLoader from voila.paths import collect_paths HERE = os.path.dirname(__file__) ROOT_DIRS = [os.path.join(HERE, "user"), os.path.join(HERE, "system")] def test_loader_default_nbconvert(): paths = collect_paths(...
59
2,417
pyomo
pyomo/contrib/appsi/utils/__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
659
cvxpy
cvxpy/reductions/dqcp2dcp/tighten.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 ...
35
1,154
lemur
lemur/domains/views.py
.py
""" .. module: lemur.domains.views :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 flask import Blueprint from flask_restful import reqparse, Api from lemur.domains i...
286
7,825
scikit-bio
skbio/io/format/newick.py
.py
r"""Newick format (:mod:`skbio.io.format.newick`) ============================================= .. currentmodule:: skbio.io.format.newick Newick format (``newick``) stores spanning-trees with weighted edges and node names in a minimal file format [1]_. This is useful for representing phylogenetic trees and taxonomies...
491
20,416
astropy
astropy/coordinates/tests/accuracy/test_altaz_icrs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Accuracy tests for AltAz to ICRS coordinate transformations. We use "known good" examples computed with other coordinate libraries. """ import numpy as np import pytest from astropy import units as u from astropy.coordinates import Angle, EarthLocati...
214
8,701
textual
tests/test_demo.py
.py
from textual.demo.demo_app import DemoApp async def test_demo(): """Test the demo runs.""" # Test he demo can at least run. # This exists mainly to catch screw-ups that might effect only certain Python versions. app = DemoApp() async with app.run_test() as pilot: await pilot.pause(0.1)
11
317
confluent-kafka-python
tests/schema_registry/test_azure_aead.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...
142
5,166
onnxruntime
onnxruntime/python/tools/transformers/onnx_model_clip.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger from fusion_attention_clip import Fusion...
43
1,352
python-prompt-toolkit
examples/prompts/html-input.py
.py
#!/usr/bin/env python """ Simple example of a syntax-highlighted HTML input line. (This requires Pygments to be installed.) """ from pygments.lexers.html import HtmlLexer from prompt_toolkit import prompt from prompt_toolkit.lexers import PygmentsLexer def main(): text = prompt("Enter HTML: ", lexer=PygmentsLex...
20
406
onnxruntime
onnxruntime/test/testdata/add_mul_add.py
.py
from onnx import TensorProto, checker, helper, save # (A + B) * B + A graph_proto = helper.make_graph( nodes=[ helper.make_node( "Add", inputs=["A", "B"], outputs=["add_output"], name="add_0", ), helper.make_node( "Mul", ...
38
963
coremltools
coremltools/test/optimize/torch/test_utils/test_optimizer_utils.py
.py
# Copyright (c) 2025, 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 pytest import torch.nn as nn import coremltools.optimize.torch from coremltools.optimize.torc...
99
3,673
textual
src/textual/widgets/_directory_tree.py
.py
from __future__ import annotations import asyncio from asyncio import Queue from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Callable, ClassVar, Iterable, Iterator from rich.style import Style from rich.text import Text, TextType from textual import work from textual.await...
586
20,281
omegaconf
subprojects/omegaconf-pydevd/pydevd_plugins/__init__.py
.py
try: __import__("pkg_resources").declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__)
7
160
pyomo
pyomo/contrib/alternative_solutions/tests/test_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...
67
2,288
metrics
examples/audio/text_to_speech.py
.py
""" Perceptual Evaluation of Text-to-Speech with PESQ ================================================== Consider a use case where we want to find the highest-quality speaker signal based on an example target voice. Using a text-to-speech model, we generate speech for five different synthetic speakers, each with uniqu...
136
7,231
mlflow
mlflow/genai/judges/instructions_judge/constants.py
.py
""" Constants for the InstructionsJudge module. This module contains constant values used by the InstructionsJudge class, including the augmented prompt template for trace-based evaluation. """ # Common base prompt for all judge evaluations JUDGE_BASE_PROMPT = """You are an expert judge tasked with evaluating the per...
68
3,384
voila
voila/handler.py
.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
311
12,571
coremltools
coremltools/converters/mil/mil/ops/tests/iOS18/test_compression.py
.py
# Copyright (c) 2024, 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 math import re from typing import List, Tuple import numpy as np import pyte...
1,973
77,988
hypercorn
src/hypercorn/__init__.py
.py
from __future__ import annotations from .config import Config __all__ = ("Config",)
6
86
conda
tests/cli/test_compare.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations from typing import TYPE_CHECKING from conda.auxlib.ish import dals if TYPE_CHECKING: from pathlib import Path from conda.testing.fixtures import CondaCLIFixture, TmpEnvFixture def test_compare_suc...
59
1,474
loguru
tests/exceptions/source/backtrace/nested_chained_catch_up.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=False, backtrace=False, diagnose=False) logger.add(sys.stderr, format="", colorize=False, backtrace=True, diagnose=False) def foo(): bar() @logger.catch(ValueError) def bar(): 1 / 0 @logger.catch def main(): ...
28
418
beam
sdks/python/apache_beam/examples/ml_transform/ml_transform_basic.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...
176
7,190
hypercorn
compliance/autobahn/server.py
.py
async def app(scope, receive, send): while True: event = await receive() if event['type'] == 'websocket.disconnect': break elif event['type'] == 'websocket.connect': await send({'type': 'websocket.accept'}) elif event['type'] == 'websocket.receive': ...
19
716
mlflow
mlflow/tracing/processor/otel.py
.py
import logging from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from opentelemetry.sdk.trace.export import BatchSpanProcessor, SpanExporter from mlflow.entities.span import create_mlflow_span from mlflow.entities.trace_info import TraceInfo, TraceLocation, TraceState from mlflow.environment_variab...
106
4,649
probability
tensorflow_probability/python/optimizer/variational_sgd.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...
258
10,811
saleor
saleor/tests/e2e/transactions/utils/transaction_initialize.py
.py
from unittest import mock from .....giftcard.const import GIFT_CARD_PAYMENT_GATEWAY_ID from .....payment.interface import TransactionSessionResult from ...utils import get_graphql_content TRANSACTION_INITIALIZE_MUTATION = """ mutation TransactionInitialize( $action: TransactionFlowStrategyEnum, $amount: PositiveD...
140
3,165
metrics
src/torchmetrics/functional/shape/__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...
17
688
biopython
Scripts/Performance/biosql_performance_read.py
.py
#!/usr/bin/env python # Copyright 2002 Brad Chapman. 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. """Test timing of getting records from a BioSQL database.""" import time ...
59
1,536
onnxruntime
onnxruntime/python/tools/quantization/tensor_quant_overrides.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from __fut...
521
20,784
kafka
tests/kafkatest/tests/tools/log_compaction_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 ...
74
3,184
pyomo
pyomo/solvers/tests/models/SOS2_simple.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...
123
4,445
pymc
tests/variational/test_opvi.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...
300
9,531
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_separableconv1d.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasSeparableConv1D(CommonTF2LayerTest): def create_keras_separableconv1d_net(self, input_names, input_shapes, input_type,...
125
7,511
wandb
tests/unit_tests/test_artifacts/test_saved_model.py
.py
import os import cloudpickle import pytest import torch import wandb from pytest_mock import MockerFixture from wandb._strutils import b64encode_ascii from wandb.apis.public.service_api import ServiceApi from wandb.sdk.artifacts._generated import ArtifactFragment from wandb.sdk.artifacts.artifact import Artifact from ...
237
6,453
pymc
pymc/math.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...
552
11,905
openvino
tests/layer_tests/common/layer_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import subprocess import sys from common.utils.multiprocessing_utils import multiprocessing_run from openvino import Core, get_version as ie2_get_version # Not all layer tests use openvino_tokenizers try: # noinspect...
92
3,325
sphinx
sphinx/builders/latex/__init__.py
.py
"""LaTeX builder.""" from __future__ import annotations import os import os.path from pathlib import Path from typing import TYPE_CHECKING import sphinx.builders.latex.nodes # NoQA: F401 # Workaround: import this before writer to avoid ImportError from sphinx import addnodes, highlighting, package_dir from sphinx....
646
25,563
qutip
qutip/core/local_matmul.py
.py
from .qobj import Qobj from .data.local_matmul import target_mode_matmul, target_mode_matmul_super __all__ = ["local_matmul"] def local_matmul( operator: Qobj, state: Qobj, modes: int | list[int], dual: bool = False ) -> Qobj: """ Applies an operator to specific modes of a quantum state or o...
188
6,372
mlflow
tests/resources/mlflow-test-plugin/mlflow_test_plugin/default_experiment_provider.py
.py
from mlflow.tracking.default_experiment.abstract_context import DefaultExperimentProvider class PluginDefaultExperimentProvider(DefaultExperimentProvider): """DefaultExperimentProvider provided through plugin system""" def in_context(self): return False def get_experiment_id(self): retur...
12
340
openvino
tests/e2e_tests/common/comparator/ocr.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Optical character recognition output comparator. Compares reference and IE model results for top-N paths. Basic result example: list of paths with probabilities """ import logging as log import sys from .threshold_utils import get_...
84
3,719
wagtail
wagtail/admin/views/bulk_action/registry.py
.py
from wagtail import hooks from wagtail.admin.views.bulk_action import BulkAction class BulkActionRegistry: def __init__(self): self.actions = {} # {app_name: {model_name: {action_name: action_class]}} self.has_scanned_for_bulk_actions = False def _scan_for_bulk_actions(self): if not ...
41
1,640
astropy
astropy/io/fits/tests/test_division.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import numpy as np from astropy.io import fits from .conftest import FitsTestCase class TestDivisionFunctions(FitsTestCase): """Test code units that rely on correct integer division.""" def test_rec_from_string(self): with fits.open(se...
40
1,115
django-cms
cms/tests/test_navextender.py
.py
from django.contrib.sites.models import Site from django.template import Template from cms.models import Page, PageContent from cms.test_utils.fixtures.navextenders import NavextendersFixture from cms.test_utils.testcases import CMSTestCase from cms.test_utils.util.menu_extender import TestMenu from menus.menu_pool im...
97
3,511
saleor
saleor/plugins/tests/gateways/dummy.py
.py
"""Fake payment gateway driving the legacy, plugin-based `Payment` flow in tests. It is not part of the shipped plugin set (`settings.BUILTIN_PLUGINS`) and has to be enabled explicitly through `settings.PLUGINS`. The gateway succeeds by default. Two hooks make it fail on demand: - monkeypatching `dummy_success` to r...
236
7,327
pyomo
pyomo/common/plugin_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...
346
12,074