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
confluent-kafka-python
src/confluent_kafka/schema_registry/protobuf.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020-2022 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 ...
21
744
probability
tensorflow_probability/python/experimental/sts_gibbs/gibbs_sampler_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...
1,149
49,162
scikit-bio
skbio/alignment/tests/test_utils.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
410
15,911
coremltools
deps/pybind11/docs/conf.py
.py
#!/usr/bin/env python3 # # pybind11 documentation build configuration file, created by # sphinx-quickstart on Sun Oct 11 19:23:48 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
370
11,609
saleor
saleor/graphql/order/tests/test_filters.py
.py
from unittest.mock import ANY, patch import pytest from ....order.models import Order from ..filters import ( _filter_by_customer_full_name, _filter_customer_by_email_first_or_last_name, filter_customer, ) @pytest.fixture def similar_customers_with_orders(order, customer_user, customer_user2, channel_US...
200
6,186
onnxruntime
orttraining/orttraining/test/python/orttraining_test_ortmodule_torch_lightning_basic.py
.py
import argparse from multiprocessing import cpu_count import pytorch_lightning as pl import torch import torch.nn.functional as F from torch import nn from torch.utils.data import DataLoader from torchvision import transforms from torchvision.datasets import MNIST import onnxruntime from onnxruntime.training.ortmodul...
102
3,519
textual
src/textual/widgets/_tab_pane.py
.py
from textual.widgets._tabbed_content import TabPane __all__ = ["TabPane"]
4
75
saleor
saleor/graphql/account/bulk_mutations/customer_bulk_update.py
.py
from collections import defaultdict from copy import deepcopy import graphene from django.core.exceptions import ValidationError from django.db.models import Q from graphene.utils.str_converters import to_camel_case from ....account import models from ....account.events import CustomerEvents from ....account.search i...
817
31,264
mlflow
mlflow/genai/simulators/distillation.py
.py
from __future__ import annotations import logging from concurrent.futures import ThreadPoolExecutor, as_completed from typing import TYPE_CHECKING import pydantic from mlflow.environment_variables import MLFLOW_GENAI_EVAL_MAX_WORKERS from mlflow.genai.simulators.prompts import DISTILL_GOAL_AND_PERSONA_PROMPT from ml...
170
5,874
saleor
saleor/graphql/giftcard/mutations/utils.py
.py
from django.core.exceptions import ValidationError from ....giftcard import models from ....giftcard.error_codes import GiftCardErrorCode from ....giftcard.utils import is_gift_card_expired def clean_gift_card(gift_card: models.GiftCard) -> models.GiftCard: if is_gift_card_expired(gift_card): raise Valid...
19
589
loguru
tests/exceptions/source/others/exception_formatting_function.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=True, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=True, colorize=False) logger.add(sys.std...
18
432
probability
tensorflow_probability/python/experimental/nn/losses/__init__.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...
31
1,329
onnxruntime
onnxruntime/core/providers/vsinpu/patches/test_scripts/compare_topn.py
.py
import sys def read_values(filename): with open(filename) as file: values = [(float(line.strip()), i + 1) for i, line in enumerate(file)] return values def top_n(values, N): return sorted(values, key=lambda x: x[0], reverse=True)[:N] def compare_files(cpu_file, npu_file, N): cpu_values = r...
35
835
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_delete.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....attribute.tests.model_helpers import ( get_product_attributes, ) from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.even...
431
12,797
coveragepy
coverage/misc.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 """Miscellaneous stuff for coverage.py.""" from __future__ import annotations import contextlib import datetime import errno import functools import hashlib imp...
383
11,624
black
tests/data/cases/line_ranges_indentation.py
.py
# flags: --line-ranges=5-5 # NOTE: If you need to modify this file, pay special attention to the --line-ranges= # flag above as it's formatting specifically these lines. if cond1: print("first") if cond2: print("second") else: print("else") if another_cond: print("will not be changed") # output # fla...
28
633
textual
src/textual/types.py
.py
""" Export some objects that are used by Textual and that help document other features. """ from textual._animator import Animatable, EasingFunction from textual._context import NoActiveAppError from textual._path import CSSPathError, CSSPathType from textual._types import ( AnimationLevel, CallbackType, I...
53
1,381
clearml
examples/hyperdatasets/dataview_pytorch_dataloader.py
.py
import argparse import os from typing import Dict, Any, Iterable import torch # ClearML utilities for resolving datasets and creating dataview iterators from clearml.hyperdatasets import ( HyperDatasetManagement, DataView, ) class HyperDatasetIterable(torch.utils.data.IterableDataset): """PyTorch Iterab...
111
4,386
astropy
astropy/convolution/setup_package.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import sys from numpy import get_include as get_numpy_include from setuptools import Extension C_CONVOLVE_PKGDIR = os.path.relpath(os.path.dirname(__file__)) extra_compile_args = ["-UNDEBUG"] if not sys.platform.startswith("win"): extra_c...
30
858
biopython
Tests/test_SeqIO_SnapGene.py
.py
# Copyright 2019 Damien Goutte-Gattat. 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. """Tests for the SeqI...
373
14,194
wandb
tests/system_tests/test_core/test_time_resolution.py
.py
import time import wandb def test_log(wandb_backend_spy): """Make sure log is generating history with subsecond resolution.""" before = time.time() with wandb.init() as run: for i in range(10): run.log(dict(k=i)) time.sleep(0.000010) # 10 us after = time.time() w...
32
966
scikit-optimize
skopt/tests/test_utils.py
.py
import pytest import tempfile from numpy.testing import assert_array_equal from numpy.testing import assert_equal from numpy.testing import assert_raises import numpy as np from skopt import gp_minimize, forest_minimize from skopt import load from skopt import dump from skopt import expected_minimum, expected_minimum...
308
10,314
wagtail
wagtail/admin/views/pages/listing.py
.py
import swapper from django.conf import settings from django.contrib.auth import get_user_model from django.db.models import F from django.forms import CheckboxSelectMultiple, RadioSelect from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils.functional import cached_p...
539
18,667
onnxruntime
orttraining/orttraining/python/training/ortmodule/_execution_agent.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import onnxruntime from onnxruntime.capi import _pybind_state as C from...
175
7,714
metrics
tests/unittests/clustering/test_fowlkes_mallows_index.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...
57
2,108
conda
tests/fixtures_package_server.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ Flask-based conda repository server for testing. Provides pytest fixtures for running a local HTTP server that serves conda repository data for testing purposes. Change contents to simulate an updating repository. Must be imported by conf...
156
4,149
mlflow
tests/utils/test_crypto.py
.py
import json import os import pytest from mlflow.exceptions import MlflowException from mlflow.utils.crypto import ( AES_256_KEY_LENGTH, GCM_NONCE_LENGTH, KEKManager, _create_aad, _decrypt_secret, _encrypt_secret, _encrypt_with_aes_gcm, _generate_dek, _mask_secret_value, _mask_s...
624
18,858
saleor
saleor/warehouse/tests/test_stock_management.py
.py
from unittest import mock import pytest from django.db.models import Sum from django.db.models.functions import Coalesce from ...channel import AllocationStrategy from ...core.exceptions import InsufficientStock from ...order.fetch import OrderLineInfo from ...order.models import OrderLine from ...warehouse.models im...
1,713
54,189
biopython
Bio/PDB/alphafold_db.py
.py
"""A module for interacting with the AlphaFold Protein Structure Database. See the `database website <https://alphafold.com/>`_ and the `API docs <https://alphafold.com/api-docs/>`_. """ import json import os from os import PathLike from collections.abc import Iterator from typing import Optional from typing import U...
117
3,991
wandb
tests/system_tests/test_functional/console_capture/uncapturing.py
.py
"""Exits with code 0 if callbacks can be unregistered.""" from __future__ import annotations import io import sys from wandb.sdk.lib import console_capture received_by_hooks = io.StringIO() def _stdout_hook1(data: str | bytes, written: int, /): received_by_hooks.write("[hook1]" + str(data[:written])) def _s...
42
1,088
astropy
astropy/table/operations.py
.py
"""High-level table operations. - join() - setdiff() - hstack() - vstack() - dstack() """ # Licensed under a 3-clause BSD style license - see LICENSE.rst import collections import itertools import warnings from collections import Counter, OrderedDict from collections.abc import Sequence from copy import deepcopy imp...
1,882
68,753
rq
tests/test_commands.py
.py
import time from multiprocessing import Process from unittest import mock from redis import Redis from redis.exceptions import ResponseError from rq import Queue, Worker from rq.command import ( send_command, send_kill_horse_command, send_shutdown_command, send_stop_execution_command, send_stop_jo...
170
6,315
conda
conda/_private/extract.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Lean package extraction helpers for subprocess workers.""" from __future__ import annotations import os # This module is imported in each spawned extraction worker. Keep imports here # limited to the standard library; importing conda runti...
25
764
returns
returns/pointfree/bind_context_future_result.py
.py
from collections.abc import Callable from typing import TYPE_CHECKING, TypeVar from returns.interfaces.specific.reader_future_result import ( ReaderFutureResultLikeN, ) from returns.primitives.hkt import Kinded, KindN, kinded if TYPE_CHECKING: from returns.context import ReaderFutureResult # noqa: WPS433 _F...
88
2,473
mlflow
mlflow/utils/server_cli_utils.py
.py
""" Utilities for MLflow cli server config validation and resolving. NOTE: these functions are intended to be used as utilities for the cli click-based interface. Do not use for any other purpose as the potential Exceptions being raised will be misleading for users. """ import click from mlflow.environment_variables ...
95
3,591
wagtail
wagtail/test/testapp/models.py
.py
import datetime import hashlib import os import random import string import uuid import swapper from django import forms from django.conf import settings from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.core.excepti...
2,936
81,543
luigi
luigi/contrib/sparkey.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...
62
1,970
confluent-kafka-python
tests/integration/admin/test_incremental_alter_configs.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...
198
5,980
openvino
tests/layer_tests/pytorch_tests/test_size.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestSize(PytorchLayerTest): def _prepare_input(self, input_shape, complex_type): if complex_type: input_shape += [2] return (sel...
44
1,541
textual
tests/snapshot_tests/snapshot_apps/blur_on_disabled.py
.py
from textual.app import App, ComposeResult from textual.widgets import Input class BlurApp(App): BINDINGS = [("f3", "disable")] def compose(self) -> ComposeResult: yield Input() def on_ready(self) -> None: self.query_one(Input).focus() def action_disable(self) -> None: self....
21
416
beam
sdks/python/apache_beam/testing/benchmarks/inference/mltransform_image_embedding_benchmark.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...
129
4,964
saleor
saleor/graphql/webhook/resolvers.py
.py
from django.db.models import Exists, OuterRef, Q from ...app.models import App from ...core.exceptions import PermissionDenied from ...permission.enums import AppPermission from ...webhook import models, payloads from ...webhook.deprecated_event_types import WebhookEventType from ...webhook.event_types import WebhookE...
56
2,087
pyomo
pyomo/contrib/piecewise/piecewise_linear_function.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...
624
25,993
mkdocs-material
material/plugins/typeset/plugin.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
124
4,955
luigi
examples/ftp_experiment_outputs.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...
104
3,239
openvino
src/bindings/python/tests/test_graph/test_normalization.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino import Type import openvino.opset13 as ov def test_lrn(): input_image_shape = (2, 3, 2, 1) input_image = np.arange(int(np.prod(input_image_shape))).reshape(input_image_s...
102
3,568
sqlmap
plugins/dbms/hana/takeover.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.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): def osCmd(s...
29
978
saleor
saleor/graphql/core/inputs.py
.py
import graphene class ReorderInput(graphene.InputObjectType): id = graphene.ID(required=True, description="The ID of the item to move.") sort_order = graphene.Int( description=( "The new relative sorting position of the item (from -inf to +inf). " "1 moves the item one position...
13
432
saleor
saleor/tests/e2e/sales/utils/__init__.py
.py
from .sale_catalogues_add import sale_catalogues_add from .sale_channel_listing import ( create_sale_channel_listing, raw_create_sale_channel_listing, ) from .sale_create import create_sale __all__ = [ "create_sale", "create_sale_channel_listing", "sale_catalogues_add", "raw_create_sale_channel...
14
333
pyro
tests/infer/reparam/test_conjugate.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.infer import Predictive, Trace_ELBO from pyro.infer.autoguide import AutoDiagonalNormal from pyro.infer.mcmc.api import ...
253
9,154
mlflow
tests/pyfunc/custom_model/mod1/mod4.py
.py
# The 2 importing commands are for testing these imported library # code files won't be captured by `infer_code_paths=True` import scipy import sklearn sk_version = sklearn.__version__ scipy_version = scipy.__version__
8
220
wandb
tests/system_tests/test_core/test_metric_full.py
.py
import math import pytest import wandb @pytest.mark.parametrize("summary_type", [None, "copy"]) def test_default_summary_type_is_last(wandb_backend_spy, summary_type): with wandb.init() as run: run.define_metric("*", summary=summary_type) run.log(dict(mystep=1, val=2)) run.log(dict(mystep...
436
13,666
mlflow
mlflow/utils/async_logging/run_artifact.py
.py
import threading from typing import TYPE_CHECKING, Union if TYPE_CHECKING: import PIL class RunArtifact: def __init__( self, filename: str, artifact_path: str, artifact: Union["PIL.Image.Image"], completion_event: threading.Event, ) -> None: """Initializes ...
39
1,074
black
tests/data/cases/type_comment_syntax_error.py
.py
def foo( # type: Foo x): pass # output def foo( # type: Foo x, ): pass
12
93
saleor
saleor/graphql/order/tests/mutations/test_order_cancel.py
.py
from unittest.mock import ANY, call, patch import graphene from django.test import override_settings from .....core.models import EventDelivery from .....giftcard import GiftCardEvents from .....giftcard.events import gift_cards_bought_event from .....order import OrderStatus from .....order.actions import cancel_ord...
255
8,696
pyro
tests/infer/test_smcfilter.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.infer import SMCFilter from pyro.infer.smcfilter import _systematic_sample from tests.common import assert_close @...
273
8,196
saleor
saleor/plugins/sendgrid/tests/conftest.py
.py
import pytest from ....plugins.sendgrid.plugin import DeprecatedSendgridEmailPlugin from ...manager import get_plugins_manager @pytest.fixture def sendgrid_email_plugin(settings, channel_USD): def fun( active=True, sender_name=None, sender_address=None, account_confirmation_templa...
111
4,577
coremltools
deps/pybind11/tests/env.py
.py
from __future__ import annotations import platform import sys import sysconfig import pytest LINUX = sys.platform.startswith("linux") MACOS = sys.platform.startswith("darwin") WIN = sys.platform.startswith("win32") or sys.platform.startswith("cygwin") CPYTHON = platform.python_implementation() == "CPython" PYPY = p...
32
1,047
conda
conda/plugins/types.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ Definition of specific return types for use when defining a conda plugin hook. Each type corresponds to the plugin hook for which it is used. """ from __future__ import annotations import enum import os from abc import ABC, abstractmetho...
990
33,752
clearml
clearml/backend_api/services/v2_9/tasks.py
.py
""" tasks service Provides a management API for tasks in the system. """ from typing import List, Optional, Any import enum from datetime import datetime import six from dateutil.parser import parse as parse_datetime from ....backend_api.session import ( BatchRequest, NonStrictDataModel, Request, Respo...
9,210
324,298
pymc
tests/dims/distributions/test_vector.py
.py
# Copyright 2025 - 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...
131
4,952
cvxpy
cvxpy/tests/test_KKT.py
.py
import numpy as np import cvxpy as cp from cvxpy.tests import solver_test_helpers as STH from cvxpy.tests.base_test import BaseTest from cvxpy.tests.test_cone2cone import TestPowND class TestKKT_LPs(BaseTest): def test_lp_1(self, places=4): # typical LP sth = STH.lp_1() sth.solve(solver=...
382
13,688
readthedocs.org
readthedocs/oauth/utils.py
.py
"""Support code for OAuth, including webhook support.""" import structlog from readthedocs.integrations.models import Integration from readthedocs.oauth.clients import get_oauth2_client from readthedocs.oauth.services import BitbucketService from readthedocs.oauth.services import GitHubService from readthedocs.oauth....
36
1,097
sqlmap
tamper/escapequotes.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.enums import PRIORITY __priority__ = PRIORITY.NORMAL def dependencies(): pass def tamper(payload, **kwargs): """ Slash escape single and double quotes...
29
530
scikit-bio
skbio/diversity/alpha/_lladser.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
622
18,293
scikit-bio
skbio/embedding/_protein.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
191
5,448
wandb
wandb/sdk/data_types/_dtypes.py
.py
from __future__ import annotations import datetime import math import typing as t from wandb.util import ( _is_artifact_string, _is_artifact_version_weave_dict, get_module, is_numpy_array, ) np = get_module("numpy") # intentionally not required if t.TYPE_CHECKING: from wandb.sdk.artifacts.artif...
900
29,246
openvino
tests/layer_tests/jax_tests/test_erfc.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import jax import numpy as np import pytest from jax import numpy as jnp from jax_layer_test_class import JaxLayerTest rng = np.random.default_rng(109734) class TestErfc(JaxLayerTest): def _prepare_input(self): # erf are ...
39
1,127
tqdm
examples/async_coroutines.py
.py
"""Asynchronous examples using `asyncio`, `async` and `await`.""" import asyncio from tqdm.asyncio import tqdm, trange def count(start=0, step=1): i = start while True: new_start = yield i if new_start is None: i += step else: i = new_start async def main(): ...
37
944
mlflow
tests/gateway/test_guardrails.py
.py
import json import uuid from typing import Any from unittest import mock import pytest import mlflow from mlflow.entities import SpanType from mlflow.entities.assessment import Feedback from mlflow.entities.gateway_guardrail import GuardrailAction, GuardrailStage from mlflow.gateway.guardrails import GuardrailViolati...
673
24,352
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from collections.abc import Callable from openvino import PartialShape # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.error import Error from openvino.tools.ovc.utils import refer_to_faq_msg def update_layou...
74
3,250
deap
deap/tools/init.py
.py
def initRepeat(container, func, n): """Call the function *func* *n* times and return the results in a container type `container` :param container: The type to put in the data from func. :param func: The function that will be called n times to fill the container. :param n: The numbe...
90
3,283
wandb
wandb/plot/utils.py
.py
from collections.abc import Iterable, Sequence import wandb from wandb import util def test_missing(**kwargs): np = util.get_module("numpy", required="Logging plots requires numpy") pd = util.get_module("pandas", required="Logging dataframes requires pandas") scipy = util.get_module("scipy", required="Lo...
183
6,688
mlflow
tests/langchain/agent_executor/chain.py
.py
from operator import itemgetter from typing import Any from langchain.agents import AgentExecutor, tool from langchain.agents.output_parsers.tools import ToolsAgentOutputParser from langchain.callbacks.manager import CallbackManagerForLLMRun from langchain.chat_models.base import SimpleChatModel from langchain.prompts...
71
1,825
textual
src/textual/renderables/gradient.py
.py
from __future__ import annotations from math import cos, pi, sin from typing import Sequence from rich.console import Console, ConsoleOptions, RenderResult from rich.segment import Segment from rich.style import Style from textual.color import Color, Gradient class VerticalGradient: """Draw a vertical gradient...
171
4,631
pyomo
examples/pyomobook/abstract-ch/buildactions.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...
64
1,752
astropy
astropy/visualization/tests/test_lupton_rgb.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for RGB Images """ import sys import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal from astropy.convolution import Gaussian2DKernel, convolve from astropy.utils.compat.optional_deps import HAS_MATPLOTLIB fr...
352
12,780
metrics
src/torchmetrics/functional/text/rouge.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...
514
20,727
onnxruntime
onnxruntime/test/python/transformers/test_parity_decoder_attention.py
.py
# -------------------------------------------------------------------------- # Copyright 2020 The HuggingFace Inc. 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/l...
590
20,946
openvino
tests/layer_tests/tensorflow_tests/test_tf_IsFinite.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 mix_array_with_value class TestIsFinite(CommonTFLayerTest): def _prepare_input(self...
47
1,719
biopython
Bio/SeqUtils/__init__.py
.py
#!/usr/bin/env python # Copyright 2002 by Thomas Sicheritz-Ponten and Cecilia Alsmark. # Copyright 2003 Yair Benita. # Revisions copyright 2014 by Markus Piotrowski. # Revisions copyright 2014-2016 by Peter Cock. # All rights reserved. # This file is part of the Biopython distribution and governed by your # choice of t...
733
25,604
onnxruntime
tools/python/util/qnn_helpers.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os def parse_qnn_version_from_sdk_yaml(qnn_home): sdk_file = os.path.join(qnn_home, "sdk.yaml") with open(sdk_file) as f: for line in f: if line.strip().startswith("...
16
478
pyomo
pyomo/contrib/piecewise/transform/outer_representation_gdp.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
5,828
onnxruntime
onnxruntime/python/tools/quantization/operators/attention.py
.py
import onnx from onnx import onnx_pb as onnx_proto # noqa: F401 from ..quant_utils import attribute_to_kwarg, ms_domain from .base_operator import QuantOperatorBase """ Quantize Attention """ class AttentionQuant(QuantOperatorBase): def __init__(self, onnx_quantizer, onnx_node): super().__init__(on...
74
2,564
clearml
clearml/backend_api/session/response.py
.py
from typing import Any import requests from . import jsonmodels from .apimodel import ApiModel from .datamodel import NonStrictDataModelMixin class FloatOrStringField(jsonmodels.fields.BaseField): """String field.""" types = ( float, str, ) class Response(ApiModel, NonStrictDataModelM...
76
2,188
textual
src/textual/widgets/_checkbox.py
.py
"""Provides a check box widget.""" from __future__ import annotations from textual.widgets._toggle_button import ToggleButton class Checkbox(ToggleButton): """A check box widget that represents a boolean value.""" class Changed(ToggleButton.Changed): """Posted when the value of the checkbox changes...
27
803
lemur
lemur/tests/test_plugins.py
.py
from lemur.plugins.views import * # noqa from .vectors import ( VALID_ADMIN_HEADER_TOKEN, ) def test_plugins_list_get(client, app): response = client.get(api.url_for(PluginsList), headers=VALID_ADMIN_HEADER_TOKEN) assert response.status_code == 200 data = response.get_json() # Perform some as...
21
495
beam
sdks/python/apache_beam/ml/inference/pytorch_inference_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...
252
11,531
onnxruntime
tools/ci_build/github/windows/post_code_coverage_to_dashboard.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # command line arguments # --report_url=<string> # --report_file=<string, local file path, TXT/JSON file> # --commit_hash=<string, full git commit hash> import argparse import datetime import json imp...
116
3,952
pdm
src/pdm/resolver/graph.py
.py
from __future__ import annotations from collections.abc import Iterable, Iterator from collections.abc import Set as AbstractSet from typing import TYPE_CHECKING, TypeVar, overload from pdm.models.markers import Marker, get_marker if TYPE_CHECKING: from resolvelib.resolvers import Criterion, Result from pdm...
143
4,765
mlflow
mlflow/webhooks/constants.py
.py
# MLflow webhook headers WEBHOOK_SIGNATURE_HEADER = "X-MLflow-Signature" WEBHOOK_TIMESTAMP_HEADER = "X-MLflow-Timestamp" WEBHOOK_DELIVERY_ID_HEADER = "X-MLflow-Delivery-Id" # Webhook signature version WEBHOOK_SIGNATURE_VERSION = "v1"
8
235
wandb
tests/unit_tests/test_docker.py
.py
import platform from unittest import mock import pytest from wandb.docker import is_buildx_installed, should_add_load_argument @pytest.fixture def mock_shell(): with mock.patch("wandb.docker.shell") as mock_shell: mock_shell.return_value = None yield mock_shell @pytest.mark.skipif( platform...
32
884
astropy
astropy/time/time_helper/__init__.py
.py
""" Helper functions for Time. """ from . import function_helpers
6
67
readthedocs.org
readthedocs/projects/urls/public.py
.py
"""Project URLS for public users.""" from django.urls import path from django.urls import re_path from django.views.generic.base import RedirectView from readthedocs.builds import views as build_views from readthedocs.constants import pattern_opts from readthedocs.projects.views import public from readthedocs.project...
85
2,808
metrics
tests/unittests/bases/test_metric.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...
696
23,419
wandb
wandb/sdk/lib/wbauth/wbnetrc.py
.py
from __future__ import annotations import netrc import os import pathlib import platform import shlex from urllib.parse import urlsplit from wandb.errors import term from .auth import AuthApiKey, AuthWithSource from .host_url import HostUrl class WriteNetrcError(Exception): """Could not write to the netrc file...
212
5,994
coremltools
coremltools/converters/mil/mil/passes/tests/test_optimize_linear_passes.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 copy import itertools import numpy as np import pytest from coremltools.converters.mil.mil i...
325
11,192
deap
setup.py
.py
#!/usr/bin/env python # read the contents of README file from os import path import codecs import deap try: from setuptools import setup, find_packages modules = find_packages(exclude=['examples']) except ImportError: from distutils.core import setup modules = ['deap', 'deap.benchmarks', 'deap.tests'...
44
1,597
pyomo
pyomo/core/tests/unit/kernel/test_block.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...
2,586
89,752
sphinx
sphinx/util/inventory.py
.py
"""Inventory utility functions for Sphinx.""" from __future__ import annotations import posixpath import re import warnings import zlib from typing import TYPE_CHECKING from sphinx.deprecation import RemovedInSphinx10Warning from sphinx.locale import __ from sphinx.util import logging BUFSIZE = 16 * 1024 logger = l...
333
12,533