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
onnxruntime
onnxruntime/python/tools/transformers/models/sam2/image_encoder.py
.py
# ------------------------------------------------------------------------- # Copyright (R) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging import warnings import torch from sam2.modeling.sam2_bas...
237
9,552
mlflow
mlflow/protos/review_queues_pb2.py
.py
import google.protobuf from packaging.version import Version if Version(google.protobuf.__version__).major >= 5: # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: review_queues.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" from goog...
501
39,402
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_HardSwish.py
.py
import pytest import tensorflow as tf import numpy as np from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [1]}, {'shape': [2, 3]}, {'shape': [1, 1, 1, 1]}, {'shape': [1, 3, 4, 3]}, {'shape': [3, 15, 14, 3]}, ] class TestTFLiteHardSwishLayerTest(TFLiteLayerTest...
41
1,428
jupytext
src/jupytext/formats.py
.py
""" In this file the various text notebooks formats are defined. Please contribute new formats here! """ import os import re import warnings import nbformat import yaml from .cell_reader import ( DoublePercentScriptCellReader, HydrogenCellReader, LightScriptCellReader, MarkdownCellReader, RMarkdo...
829
30,958
pyomo
examples/pyomobook/python-ch/ctob.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...
28
936
pyomo
pyomo/common/collections/__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...
18
835
httpie
httpie/cli/options.py
.py
import argparse import textwrap import typing from dataclasses import dataclass, field from enum import Enum, auto from typing import Any, Optional, Dict, List, Tuple, Type, TypeVar from httpie.cli.argparser import HTTPieArgumentParser from httpie.cli.utils import Manual, LazyChoices class Qualifiers(Enum): OPTI...
250
7,732
structlog
tests/test_stdlib.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. from __future__ import annotations import json import logging import logging.config import o...
1,694
50,739
saleor
saleor/graphql/account/mutations/authentication/external_refresh.py
.py
import graphene from ....core import ResolveInfo from ....core.doc_category import DOC_CATEGORY_AUTH from ....core.fields import JSONString from ....core.mutations import BaseMutation from ....core.types import AccountError from ....plugins.dataloaders import get_plugin_manager_promise from ...types import User from ....
60
2,233
mlflow
mlflow/semantic_kernel/__init__.py
.py
from semantic_kernel.kernel import Kernel from semantic_kernel.utils.telemetry.model_diagnostics import decorators from mlflow.semantic_kernel.autolog import setup_semantic_kernel_tracing from mlflow.semantic_kernel.tracing_utils import ( patched_kernel_entry_point, semantic_kernel_diagnostics_wrapper, ) from ...
64
2,305
hydra
plugins/hydra_submitit_launcher/hydra_plugins/hydra_submitit_launcher/config.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from dataclasses import dataclass, field from typing import Any, Dict, List, Optional from hydra.core.config_store import ConfigStore @dataclass class BaseQueueConf: """Configuration shared by all executors""" submitit_folder: str = "${h...
104
3,461
mlflow
mlflow/assistant/providers/ollama.py
.py
"""Ollama preset of the OpenAI-compatible assistant provider.""" from typing import ClassVar import requests from mlflow.assistant.providers.openai_compatible import OpenAICompatibleProvider class OllamaProvider(OpenAICompatibleProvider): """OpenAI-compatible provider for a locally running Ollama server.""" ...
39
1,563
wagtail
wagtail/contrib/frontend_cache/backends/__init__.py
.py
from .base import * # noqa from .azure import * # noqa from .http import * # noqa from .cloudflare import * # noqa from .cloudfront import * # noqa
6
153
django-cms
cms/test_utils/util/menu_extender.py
.py
from cms.menu_bases import CMSAttachMenu from menus.base import NavigationNode from menus.menu_pool import menu_pool class TestMenu(CMSAttachMenu): name = "test menu" def get_nodes(self, request): nodes = [] n = NavigationNode('sample root page', "/", 1) n2 = NavigationNode('sample se...
23
644
sphinx
tests/roots/test-need-escaped/conf.py
.py
project = 'need <b>"escaped"</b> project' smartquotes = False
3
62
tqdm
tqdm/contrib/utils_worker.py
.py
""" IO/concurrency helpers for `tqdm.contrib`. """ from collections import deque from concurrent.futures import ThreadPoolExecutor from ..auto import tqdm as tqdm_auto __author__ = {"github.com/": ["casperdcl"]} __all__ = ['MonoWorker'] class MonoWorker: """ Supports one running task and one waiting task. ...
39
1,199
astropy
astropy/table/tests/test_column_mixins.py
.py
from dataclasses import dataclass from typing import Generic, TypeVar import numpy as np import pytest from numpy.typing import NDArray from astropy.table._column_mixins import _ColumnGetitemShim, _MaskedColumnGetitemShim class MinimalColumn(_ColumnGetitemShim, np.ndarray): """Minimal concrete class derived fro...
149
4,711
conda
conda/gateways/shards/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ Interface to sharded repodata code. """ from __future__ import annotations from conda._private.shards.subset import RepodataSubset, build_repodata_subset from .typing import BuildRepodataSubset # Define a minimal high-level API for shard...
23
718
textual
tests/snapshot_tests/snapshot_apps/multi_keys.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import Footer class MApp(App): BINDINGS = [Binding("o,ctrl+o", "options", "Options")] def compose(self) -> ComposeResult: yield Footer() if __name__ == "__main__": MApp().run()
12
299
biopython
Tests/test_SVDSuperimposer.py
.py
# Copyright 2017 by Maximilian Greil. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for SVDSuperimposer module.""" import unittest try: from numpy import around...
131
4,294
pyomo
doc/OnlineDocs/src/scripting/block_iter_example.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...
50
1,492
textual
src/textual/demo/demo_app.py
.py
from __future__ import annotations from textual.app import App from textual.binding import Binding from textual.demo.game import GameScreen from textual.demo.home import HomeScreen from textual.demo.projects import ProjectsScreen from textual.demo.widgets import WidgetsScreen class DemoApp(App): """The demo app ...
106
2,965
jupytext
tests/data/notebooks/outputs/ipynb_to_percent/Line_breaks_in_LateX_305.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [markdown] # 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} # $$ # %% [markdown] #...
43
784
cvxpy
cvxpy/logic.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 ...
23
887
saleor
saleor/tests/e2e/checkout/test_guest_checkout_should_be_associated_with_user_account.py
.py
import pytest from ..account.utils import create_customer, get_user from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( checkout_complete, checkout_create, checkout_delivery_me...
123
3,432
mlflow
mlflow/genai/optimize/__init__.py
.py
from mlflow.exceptions import MlflowException from mlflow.genai.optimize.optimize import optimize_prompts from mlflow.genai.optimize.optimizers import ( BasePromptOptimizer, GepaPromptOptimizer, MetaPromptOptimizer, ) from mlflow.genai.optimize.types import ( LLMParams, OptimizerConfig, PromptOp...
106
3,532
metrics
src/torchmetrics/audio/nisqa.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...
156
6,027
onnx
onnx/backend/test/case/node/tfidfvectorizer.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import Any import numpy as np import onnx from onnx import NodeProto from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class TfIdfVectorizerHelp...
265
8,868
qutip
qutip/tests/test_wigner.py
.py
import pytest import numpy as np from scipy.integrate import trapezoid import itertools from scipy.special import laguerre from numpy.random import rand from numpy.testing import assert_equal, assert_almost_equal, assert_allclose import qutip from qutip.core.states import coherent, fock, ket, bell_state from qutip.wig...
793
28,952
pymc
tests/variational/test_minibatch_rv.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...
160
5,897
pyro
tests/contrib/timeseries/test_lgssm.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pyro.contrib.timeseries import GenericLGSSM, GenericLGSSMWithGPNoiseModel from tests.common import assert_equal @pytest.mark.parametrize("model_class", ["lgssm", "lgssmgp"]) @pytest.mark.parametri...
99
3,905
biopython
Tests/test_KGML_nographics.py
.py
# Copyright 2013 by Leighton Pritchard. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for general functionality of the KGML parser and pathway model.""" # Builtins i...
132
4,783
saleor
saleor/graphql/order/mutations/draft_order_delete.py
.py
import graphene from django.core.exceptions import ValidationError from ....core.tracing import traced_atomic_transaction from ....discount.models import VoucherCode from ....discount.utils.voucher import ( get_customer_email_for_voucher_usage, release_voucher_code_usage, ) from ....order import OrderStatus, m...
101
3,662
gunicorn
tests/docker/dirty_ttin_ttou/app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Test app with multiple dirty tasks for TTIN/TTOU testing.""" import json import time from gunicorn.dirty import DirtyApp, get_dirty_client # Unlimited workers - runs on all dirty workers class UnlimitedTask(...
76
2,353
python-prompt-toolkit
src/prompt_toolkit/__init__.py
.py
""" prompt_toolkit ============== Author: Jonathan Slenders Description: prompt_toolkit is a Library for building powerful interactive command lines in Python. It can be a replacement for GNU Readline, but it can be much more than that. See the examples directory to learn about the usage. ...
88
2,088
pyomo
pyomo/core/base/numvalue.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...
14
629
mlflow
mlflow/store/db_migrations/versions/bda7b8c39065_increase_model_version_tag_value_limit.py
.py
"""increase_model_version_tag_value_limit Create Date: 2025-06-23 11:05:41.676297 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "bda7b8c39065" down_revision = "6953534de441" branch_labels = None depends_on = None def upgrade(): # Use batch mode for SQLi...
37
972
openvino
tests/layer_tests/pytorch_tests/test_isinf.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 @pytest.mark.parametrize('input_tensor', (np.array([float("inf"), float("nan"), -float("inf"), 0.0, 1.0, -1.0...
33
997
coremltools
deps/pybind11/docs/benchmark.py
.py
from __future__ import annotations import datetime as dt import os import random nfns = 4 # Functions per class nargs = 4 # Arguments per function def generate_dummy_code_pybind11(nclasses=10): decl = "" bindings = "" for cl in range(nclasses): decl += f"class cl{cl:03};\n" decl += "\n" ...
90
2,889
onnxruntime
tools/ci_build/github/apple/package_assembly_utils.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import json import os import pathlib import re import shutil _script_dir = pathlib.Path(__file__).parent.resolve(strict=True) repo_root = _script_dir.parents[3] _template_variable_pattern = re.compile(r"@(\w+)@") # match ...
152
5,554
saleor
saleor/tests/e2e/checkout/discounts/sales/test_checkout_custom_price_and_percentage_sale.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....checkout.utils import checkout_lines_update from ....product.utils.preparing_product import prepare_product from ....sales.utils import ( create_sale, create_sale_channel_listing, sale_catalogues_add, ) fr...
150
5,120
wagtail
wagtail/admin/tests/test_html_ruleset.py
.py
from django.test import TestCase from wagtail.admin.rich_text.converters.html_ruleset import HTMLRuleset class TestHTMLRuleset(TestCase): def test_html_ruleset(self): ruleset = HTMLRuleset( { "p": "paragraph", "a[href]": "link", "a[linktype=page...
48
1,743
pyomo
examples/mpec/munson1.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...
32
1,068
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/jupyter_again.py
.py
# --- # jupyter: # jupytext: # cell_markers: '{{{,}}}' # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- c = ''' title: "Quick test" output: ioslides_presentation: widescreen: true smaller: true editor_options: chunk_output_type console ''' import yaml ...
25
360
pyro
pyro/contrib/minipyro.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ Mini Pyro --------- This file contains a minimal implementation of the Pyro Probabilistic Programming Language. The API (method signatures, etc.) match that of the full implementation as closely as possible. This file is indep...
407
15,592
attrs
tests/test_slots.py
.py
# SPDX-License-Identifier: MIT """ Unit tests for slots-related functionality. """ import functools import pickle import weakref from unittest import mock import pytest import attr import attrs from attr._compat import PY_3_14_PLUS, PYPY # Pympler doesn't work on PyPy. try: from pympler.asizeof import asize...
1,217
27,231
astropy
astropy/stats/tests/test_ks_2samp.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._stats import ks_2samp def test_identical_array(): a = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float64) assert_allclose(ks_2samp(a, a), 0.0, atol=1e-15...
46
1,572
mlflow
mlflow/assistant/providers/codex.py
.py
import asyncio import json import logging import os import shutil import subprocess import tempfile from pathlib import Path from typing import Any, AsyncGenerator, Callable, Literal from mlflow.assistant.custom_view import ( STRINGIFIED_CUSTOM_VIEW_RESPONSE_SCHEMA, STRINGIFIED_CUSTOM_VIEW_STRUCTURED_OUTPUT_IN...
382
14,206
clearml
examples/advanced/execute_remotely_example.py
.py
""" ClearML - Example of remote_execution with Pytorch mnist training The task.remote_execution option is used when it's needed to run part of the code locally and then move it for full execution remotely. When running locally, the task.remote_execution() will complete the currently running task and enqueue it to a ch...
247
7,283
pyro
pyro/distributions/transforms/planar.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Transform, constraints from pyro.nn import DenseNN from ..conditional import Conditiona...
266
8,878
hatch
src/hatch/cli/__init__.py
.py
from __future__ import annotations import os from typing import cast import click from hatch._version import __version__ from hatch.cli.application import Application from hatch.cli.build import build from hatch.cli.check import check from hatch.cli.clean import clean from hatch.cli.config import config from hatch.c...
253
7,723
cvxpy
cvxpy/reductions/solvers/conic_solvers/cvxopt_conif.py
.py
""" Copyright 2013 Steven Diamond, 2017 Robin Verschueren 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...
383
13,943
saleor
saleor/graphql/discount/tests/mutations/test_sale_channel_listing_update.py
.py
import graphene from .....discount import RewardValueType from .....discount.error_codes import DiscountErrorCode from .....product.models import ProductChannelListing from ....tests.utils import assert_negative_positive_decimal_value, get_graphql_content from ...utils import get_products_for_rule SALE_CHANNEL_LISTIN...
735
22,792
mlflow
tests/spark/autologging/datasource/test_spark_datasource_autologging_missing_jar.py
.py
import pytest import mlflow.spark from mlflow.exceptions import MlflowException from tests.spark.autologging.utils import _get_or_create_spark_session def test_enabling_autologging_throws_for_missing_jar(): with _get_or_create_spark_session(jars=""): with pytest.raises(MlflowException, match="ensure you...
13
394
probability
tensorflow_probability/python/distributions/internal/correlation_matrix_volumes_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...
154
6,643
saleor
saleor/graphql/app/mutations/app_token_verify.py
.py
import graphene from django.contrib.auth.hashers import check_password from django.db.models import Exists, OuterRef, Q from ....app import models from ...core.doc_category import DOC_CATEGORY_APPS from ...core.mutations import BaseMutation from ...core.types import AppError class AppTokenVerify(BaseMutation): v...
37
1,278
saleor
saleor/graphql/translations/mutations/attribute_translate.py
.py
import graphene from ....attribute import models as attribute_models from ....permission.enums import SitePermissions from ...attribute.types import Attribute from ...core.context import ChannelContext from ...core.enums import LanguageCodeEnum from ...core.types import TranslationError from .utils import BaseTranslat...
39
1,391
readthedocs.org
readthedocs/search/tests/test_xss.py
.py
import pytest from readthedocs.search.faceted_search import PageSearch @pytest.mark.django_db @pytest.mark.search class TestXSS: def test_facted_page_xss(self, all_projects): query = '"XSS"' page_search = PageSearch(query=query, projects={"docs": "latest"}) results = page_search.execute()...
30
883
onnx
onnx/backend/test/case/node/and_.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class And(Base): @staticmethod def export() -> None: node = ...
77
2,504
metrics
src/torchmetrics/functional/classification/stat_scores.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...
908
41,365
pyomo
pyomo/contrib/mindtpy/algorithm_base_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...
3,471
153,049
wandb
wandb/automations/_run_state_filters.py
.py
from __future__ import annotations from collections.abc import Iterable from typing import TYPE_CHECKING, Annotated, Any from pydantic import BeforeValidator, field_validator from wandb._filters import BaseOp, FilterExpr from wandb._iterutils import always_list from wandb._pydantic import GQLBase from wandb.automati...
82
2,981
confluent-kafka-python
src/confluent_kafka/_oauthbearer/aws/aws_autowire.py
.py
# Copyright 2026 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
95
4,141
mlflow
mlflow/tracing/utils/truncation.py
.py
import json from functools import lru_cache from typing import Any from mlflow.entities.trace_data import TraceData from mlflow.entities.trace_info import TraceInfo from mlflow.tracing.constant import ( TRACE_REQUEST_RESPONSE_PREVIEW_MAX_LENGTH_DBX, TRACE_REQUEST_RESPONSE_PREVIEW_MAX_LENGTH_OSS, ) from mlflow....
130
4,524
pymc
scripts/run_mypy.py
.py
#!/usr/bin/env python """ Invoke mypy and compare the reults with files in /pymc. Excludes tests and a list of files that are known to fail. Exit code 0 indicates that there are no unexpected results. Usage ----- python scripts/run_mypy.py [--verbose] """ import argparse import importlib import io import os import ...
172
5,569
onnxruntime
onnxruntime/test/python/transformers/profile_disable_sync.py
.py
#!/usr/bin/env python3 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ Profiling helper to verify that the CUDA EP ...
206
8,394
sphinx
tests/roots/test-ext-autodoc/target/overload3.py
.py
import typing from typing import TYPE_CHECKING, overload import typing_extensions from typing_extensions import overload as over_ext # noqa: UP035 @overload def test(x: int) -> int: ... @typing.overload def test(x: list[int]) -> list[int]: ... @over_ext def test(x: str) -> str: ... @typing_extensions.overload def t...
19
399
beam
sdks/python/apache_beam/transforms/combiners.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,171
37,464
probability
tensorflow_probability/python/math/psd_kernels/polynomial.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...
398
16,154
pdm
src/pdm/project/toml_file.py
.py
from __future__ import annotations from copy import deepcopy from pathlib import Path from typing import Any, cast import tomlkit from pdm import termui from pdm.compat import tomllib class TOMLFile: def __init__(self, path: str | Path, *, parse: bool = True, ui: termui.UI) -> None: from tomlkit.toml_f...
76
2,330
wagtail
wagtail/admin/views/pages/choose_parent.py
.py
import swapper from django.contrib.admin.utils import quote from django.contrib.contenttypes.models import ContentType from django.shortcuts import redirect from django.urls import reverse from django.utils.functional import cached_property from django.utils.text import capfirst from django.utils.translation import get...
167
6,071
colorama
colorama/tests/ansi_test.py
.py
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import sys from unittest import TestCase, main from ..ansi import Back, Fore, Style from ..ansitowin32 import AnsiToWin32 stdout_orig = sys.stdout stderr_orig = sys.stderr class AnsiTest(TestCase): def setUp(self): # sanity chec...
77
2,839
mlflow
tests/tracing/test_attachments.py
.py
import pytest from mlflow.tracing.attachments import Attachment def test_attachment_init(): att = Attachment(content_type="image/png", content_bytes=b"fakepng") assert att.id is not None assert att.content_type == "image/png" assert att.content_bytes == b"fakepng" def test_attachment_ids_are_unique...
117
3,799
mlflow
tests/llama_index/test_llama_index_evaluate.py
.py
import pandas as pd import pytest import mlflow from mlflow.metrics import latency from mlflow.tracing.constant import TraceMetadataKey from tests.openai.test_openai_evaluate import purge_traces from tests.tracing.helper import get_traces, reset_autolog_state # noqa: F401 _EVAL_DATA = pd.DataFrame({ "inputs": [...
113
3,552
textual
docs/examples/widgets/markdown.py
.py
from textual.app import App, ComposeResult from textual.widgets import Markdown EXAMPLE_MARKDOWN = """\ ## Markdown - Typography *emphasis*, **strong**, `inline code` etc. - Headers - Lists - Syntax highlighted code blocks - Tables and more ## Quotes > I must not fear. > > Fear is the mind-killer. > > F...
62
1,688
eve
eve/methods/patch.py
.py
# -*- coding: utf-8 -*- """ eve.methods.patch ~~~~~~~~~~~~~~~~~ This module implements the PATCH method. :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from copy import deepcopy from cerberus.validator import DocumentError from flask import abort from f...
289
10,530
mlflow
mlflow/genai/discovery/extraction.py
.py
from __future__ import annotations import logging from collections import defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed from mlflow.entities.span import Span, SpanType from mlflow.entities.span_status import SpanStatusCode from mlflow.entities.trace import Trace from mlflow.environment_v...
303
11,627
python-dotenv
tests/test_utils.py
.py
from dotenv import get_cli_string as c def test_to_cli_string(): assert c() == "dotenv" assert c(path="/etc/.env") == "dotenv -f /etc/.env" assert c(path="/etc/.env", action="list") == "dotenv -f /etc/.env list" assert c(action="list") == "dotenv list" assert c(action="get", key="DEBUG") == "doten...
20
747
saleor
saleor/core/utils/metadata_manager.py
.py
from dataclasses import dataclass from enum import Enum from typing import Any from ...graphql.meta.inputs import MetadataInput from ..models import ModelWithMetadata class MetadataType(Enum): PUBLIC = "PUBLIC" PRIVATE = "PRIVATE" class MetadataEmptyKeyError(Exception): pass @dataclass class Metadata...
86
2,146
mlflow
dev/gen_rest_api.py
.py
# /// script # dependencies = ["texttable"] # /// """Generate RST documentation from protobuf JSON definitions.""" from __future__ import annotations import json import logging import re from enum import Enum from pathlib import Path from textwrap import dedent from typing import Any from texttable import Texttable ...
864
30,277
openvino
tests/layer_tests/tensorflow_tests/test_tf_FakeQuantWithMinMaxVars.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest OPS = { 'tf.raw_ops.FakeQuantWithMinMaxVarsPerChannel': tf.raw_ops.FakeQuantWithMinMaxVarsPerChannel...
72
3,583
pyro
tests/poutine/test_mapdata.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import logging import pytest import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from tests.common import requires_cuda logger = logging.getLogger(__name__) def test_nested_iplate(): m...
186
5,407
kombu
t/mocks.py
.py
from __future__ import annotations import time from itertools import count from typing import TYPE_CHECKING from unittest.mock import Mock from kombu.transport import base from kombu.utils import json if TYPE_CHECKING: from types import TracebackType class _ContextMock(Mock): """Dummy class implementing __...
218
6,008
wandb
wandb/integration/keras/__init__.py
.py
"""Tools for integrating `wandb` with [`Keras`](https://keras.io/).""" __all__ = ( "WandbMetricsLogger", "WandbModelCheckpoint", "WandbEvalCallback", ) from .callbacks import WandbEvalCallback, WandbMetricsLogger, WandbModelCheckpoint
10
249
hatch
src/hatch/plugin/specs.py
.py
from hatchling.plugin.specs import hookspec @hookspec def hatch_register_environment(): """Register new classes that adhere to the environment interface.""" @hookspec def hatch_register_environment_collector(): """Register new classes that adhere to the environment collector interface.""" @hookspec def ha...
32
775
eve
tests/test_io/media.py
.py
import base64 from io import BytesIO from unittest import TestCase from bson import ObjectId from eve import ETAG, ISSUES, STATUS, STATUS_ERR, STATUS_OK from eve.io.media import MediaStorage from eve.io.mongo import GridFSMediaStorage from tests import MONGO_DBNAME, TestBase class TestMediaStorage(TestCase): de...
506
19,486
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_bool2.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: x = tf.placeholder(tf.float32, [3], 'in1') y = tf.placeholder(tf.float32, [3], 'in2') cond = tf.placeholder(tf.bool, [], 'cond') tf.wh...
17
463
onnx
onnx/reference/ops/op_cum_prod.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 class CumProd(OpRun): def _run(self, x, axis, exclusive=None, reverse=None): axis = np.asarray(axis) if axis.ndim != 0: ...
32
1,087
readthedocs.org
readthedocs/projects/constants.py
.py
""" Project constants. Default values and other various configuration for projects, including available theme names and repository types. """ import os import re from django.utils.translation import gettext_lazy as _ SPHINX = "sphinx" MKDOCS = "mkdocs" SPHINX_HTMLDIR = "sphinx_htmldir" SPHINX_SINGLEHTML = "sphinx_...
457
13,125
biopython
Bio/Align/clustal.py
.py
# Copyright 2006-2016 by Peter Cock. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.Align support fo...
251
9,298
saleor
saleor/graphql/meta/mutations/update_metadata.py
.py
from typing import cast import graphene from ....core import models from ...core import ResolveInfo from ...core.types import MetadataError, NonNullList from ..inputs import MetadataInput, MetadataInputDescription from ..permissions import PUBLIC_META_PERMISSION_MAP from .base import BaseMetadataMutation from .utils ...
47
1,611
saleor
saleor/account/i18n_rules_override.py
.py
import i18naddress original_load_validation_data = i18naddress.load_validation_data COUNTRIES_RULES_OVERRIDE = { "JP": { # Library `google-i18n-address` use `AddressValidationMetadata` form Google to provide required fields. # During address normalization, unexpected or unnecessary fields are rem...
29
1,115
jupyterlab
clean.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import os import subprocess here = os.path.abspath(os.path.dirname(__file__)) # Workaround for https://github.com/git-for-windows/git/issues/607 if os.name == "nt": for root, dnames, _ in os.walk(here): ...
44
1,331
coremltools
deps/protobuf/python/google/protobuf/internal/api_implementation.py
.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
113
4,562
beam
sdks/python/apache_beam/utils/subprocess_server.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...
675
23,483
wagtail
wagtail/admin/filters.py
.py
import django_filters from django import forms from django.conf import settings from django.db import models from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ from django_filters.widgets import SuffixedMultiWidget from wagtail.admin.models import popular_tags_fo...
304
10,820
metrics
tests/unittests/classification/test_exact_match.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...
299
12,133
scikit-bio
skbio/alignment/_path.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. # --------------------------------------------...
1,360
47,617
saleor
saleor/graphql/csv/dataloaders.py
.py
from collections import defaultdict from ...csv.models import ExportEvent from ..core.dataloaders import DataLoader class EventsByExportFileIdLoader(DataLoader[int, list[ExportEvent]]): context_key = "events_by_export_file_id" def batch_load(self, keys): events = ExportEvent.objects.using(self.datab...
21
711
returns
returns/pipeline.py
.py
from typing import Any from returns._internal.pipeline.flow import flow as flow from returns._internal.pipeline.managed import managed as managed from returns._internal.pipeline.pipe import pipe as pipe from returns.interfaces.unwrappable import Unwrappable from returns.primitives.exceptions import UnwrapFailedError ...
39
1,207