repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
saleor
saleor/graphql/api.py
.py
from functools import partial, wraps import graphql from django.urls import reverse from django.utils.functional import SimpleLazyObject from graphql import ( GraphQLCachedBackend, GraphQLCoreBackend, GraphQLInterfaceType, GraphQLObjectType, GraphQLScalarType, GraphQLSchema, execute, pa...
260
8,119
pyomo
pyomo/contrib/viewer/tests/test_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...
250
8,443
beam
sdks/python/apache_beam/ml/inference/xgboost_inference.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...
367
13,890
mlflow
mlflow/tracing/export/mlflow_v3.py
.py
import logging import os import threading from collections import defaultdict from contextlib import nullcontext from typing import Sequence from opentelemetry.sdk.trace import ReadableSpan from opentelemetry.sdk.trace.export import SpanExporter from mlflow.entities.model_registry import PromptVersion from mlflow.ent...
425
19,908
jupytext
tests/external/cli/test_isort.py
.py
import pytest from jupytext import reads, writes from jupytext.cli import pipe_notebook from jupytext.compare import compare @pytest.mark.requires_isort def test_pipe_into_isort(): text_org = """# %% import numpy as np np.array([1,2,3]) # %% import pandas as pd pd.Series([1,2,3]) # %% # This is a comment on th...
42
786
clearml
examples/datasets/dataset_creation.py
.py
# Download CIFAR dataset and create a dataset with ClearML's Dataset class from clearml import StorageManager, Dataset manager = StorageManager() dataset_path = manager.get_local_copy(remote_url="https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz") dataset = Dataset.create(dataset_name="cifar_dataset", dataset_...
18
544
beam
sdks/python/apache_beam/transforms/enrichment_handlers/bigtable_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...
42
1,627
probability
tensorflow_probability/python/sts/internal/util_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...
379
16,006
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_rnn.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 TestKerasRNN(CommonTF2LayerTest): def create_keras_rnn_net(self, input_names, input_shapes, cell, ...
100
4,455
saleor
saleor/graphql/order/filters.py
.py
from collections.abc import Mapping from uuid import UUID import django_filters import graphene from django.core.exceptions import ValidationError from django.core.validators import validate_email from django.db.models import Exists, OuterRef, Q, QuerySet, Value from django.utils import timezone from graphql.error imp...
1,248
41,688
mlflow
mlflow/server/otel_api.py
.py
""" OpenTelemetry REST API endpoints for MLflow FastAPI server. This module implements the OpenTelemetry Protocol (OTLP) REST API for ingesting spans according to the OTel specification: https://opentelemetry.io/docs/specs/otlp/#otlphttp Note: This is a minimal implementation that serves as a placeholder for the OTel...
260
10,910
onnxruntime
onnxruntime/python/tools/transformers/models/t5/convert_to_onnx.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import ...
319
10,192
cvxpy
cvxpy/tests/nlp_tests/derivative_checker.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 ...
274
10,240
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_GatherND.py
.py
import numpy as np import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [5, 1], 'indices_shape': [1, 1], 'batch_dims': 0}, {'shape': [5, 5], 'indices_shape': [2, 1], 'batch_dims': 0}, {'shape': [5, 5], 'indices_shape': [2, 2], 'batch_d...
51
2,001
bazel
scripts/packages/debian/generate_changelog.py
.py
#!/usr/bin/env python3 # pylint: disable=g-bad-file-header # Copyright 2015 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.or...
45
1,603
probability
tensorflow_probability/python/bijectors/reshape.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...
436
17,134
slimit
src/slimit/tests/test_cmd.py
.py
############################################################################### # # Copyright (c) 2011 Ruslan Spivak # # 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, inc...
119
3,941
wandb
wandb/integration/diffusers/resolvers/__init__.py
.py
from .multimodal import ( SUPPORTED_MULTIMODAL_PIPELINES, DiffusersMultiModalPipelineResolver, ) __all__ = [ "SUPPORTED_MULTIMODAL_PIPELINES", "DiffusersMultiModalPipelineResolver", ]
10
201
openvino
src/bindings/python/tests/test_runtime/test_type.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np from openvino import Type @pytest.mark.parametrize(("dtype_string", "dtype", "ovtype"), [ ("float16", np.float16, Type.f16), ("float32", np.float32, Type.f32), ("flo...
136
5,257
mlflow
mlflow/tensorflow/callback.py
.py
from tensorflow import keras from tensorflow.keras.callbacks import Callback from mlflow import log_metrics, log_params, log_text from mlflow.utils.autologging_utils import ExceptionSafeClass from mlflow.utils.checkpoint_utils import MlflowModelCheckpointCallbackBase class MlflowCallback(keras.callbacks.Callback, me...
230
9,000
beam
sdks/python/apache_beam/io/gcp/bigquery_change_history_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...
639
23,036
wandb
tests/system_tests/test_functional/metaflow/flow_foreach.py
.py
"""Test Metaflow Flow integration""" import os import pathlib import pandas as pd import wandb from metaflow import FlowSpec, Parameter, step from sklearn.ensemble import ( # noqa: F401 GradientBoostingClassifier, RandomForestClassifier, ) from sklearn.metrics import accuracy_score from sklearn.model_selecti...
82
2,282
lemur
lemur/certificates/views.py
.py
""" .. module: lemur.certificates.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> """ import base64 from flask import Blueprint, make_response, jsonify, g, current_app fro...
1,972
72,562
mlflow
mlflow/store/db_migrations/versions/f5a4f2784254_increase_run_tag_value_limit.py
.py
"""increase run tag value limit to 8000 Create Date: 2024-09-18 08:53:51.552934 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "f5a4f2784254" down_revision = "4465047574b1" branch_labels = None depends_on = None def upgrade(): # Use batch mode so that we...
35
970
beam
sdks/python/apache_beam/yaml/test_utils/datadog_test_utils.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...
132
4,186
mlflow
tests/genai/scorers/deepeval/test_registry.py
.py
from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.genai.scorers.deepeval.registry import get_metric_class, is_deterministic_metric def test_get_metric_class_returns_valid_class(): metric_class = get_metric_class("AnswerRelevancy") assert metric_class.__name__ ...
44
1,484
probability
tensorflow_probability/python/internal/special_math.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...
326
11,376
mlflow
mlflow/gateway/constants.py
.py
from enum import Enum MLFLOW_GATEWAY_CALLER_HEADER = "X-MLflow-Gateway-Caller" MLFLOW_GATEWAY_AUTH_HEADER = "X-MLflow-Authorization" MLFLOW_GATEWAY_DURATION_HEADER = "X-MLflow-Gateway-Duration-Ms" MLFLOW_GATEWAY_OVERHEAD_HEADER = "X-MLflow-Gateway-Overhead-Duration-Ms" class GatewayCaller(str, Enum): """Known ca...
51
2,182
textual
src/textual/widgets/_option_list.py
.py
from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING, ClassVar, Iterable, Sequence, cast import rich.repr from rich.segment import Segment from textual import _widget_navigation, events from textual._loop import loop_last from textual.binding import Binding, Bi...
1,040
34,230
wagtail
wagtail/images/blocks.py
.py
from django import forms from django.core.exceptions import ValidationError from django.template.loader import render_to_string from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ from wagtail.admin.compare import BlockComparison, StructBlockComparison from wagtai...
296
10,212
mlflow
tests/telemetry/test_utils.py
.py
from pathlib import Path from unittest.mock import Mock, patch import pytest import mlflow.telemetry.utils from mlflow.telemetry.constant import ( CONFIG_STAGING_URL, CONFIG_URL, FALLBACK_UI_CONFIG, UI_CONFIG_STAGING_URL, UI_CONFIG_URL, ) from mlflow.telemetry.schemas import Environment from mlflo...
161
5,409
saleor
saleor/graphql/account/tests/mutations/staff/test_address_delete.py
.py
from unittest.mock import patch import graphene import pytest from freezegun import freeze_time from ......webhook.event_types import WebhookEventAsyncType from .....tests.utils import assert_no_permission, get_graphql_content from ..utils import generate_address_webhook_call_args ADDRESS_DELETE_MUTATION = """ m...
109
3,625
mlflow
mlflow/store/db_migrations/versions/1b5f0d9ad7c1_add_workspace_columns_and_catalog.py
.py
"""Add workspace columns and catalog table Create Date: 2026-01-16 00:00:00.000000 """ import sqlalchemy as sa from alembic import op from sqlalchemy import inspect # revision identifiers, used by Alembic. revision = "1b5f0d9ad7c1" down_revision = "c8d9e0f1a2b3" branch_labels = None depends_on = None _NAMING_CONVE...
897
34,949
hatch
backend/src/hatchling/version/source/plugin/interface.py
.py
from __future__ import annotations from abc import ABC, abstractmethod class VersionSourceInterface(ABC): # no cov """ Example usage: ```python tab="plugin.py" from hatchling.version.source.plugin.interface import VersionSourceInterface class SpecialVersionSource(VersionSourceInterface): ...
70
1,852
biopython
Tests/test_PDB_PDBMLParser.py
.py
""" Tests for the PDBML parser in the PDB package. These tests rely on the principle that the structure returned by the PDBML parser should be the same as the structure returned by the mmCIF parser for any PDB structure. """ import unittest import warnings from Bio.PDB import MMCIFParser from Bio.PDB import PDBMLPar...
46
1,628
saleor
saleor/graphql/payment/mutations/transaction/transaction_request_action.py
.py
from decimal import Decimal from typing import TYPE_CHECKING, Any, Optional, cast import graphene from django.core.exceptions import ValidationError from .....app.models import App from .....core.prices import quantize_price from .....giftcard.const import GIFT_CARD_PAYMENT_GATEWAY_ID from .....giftcard.gateway impor...
309
11,279
beam
sdks/python/apache_beam/ml/rag/embeddings/vertex_ai_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...
236
8,022
mlflow
mlflow/genai/judges/prompts/correctness.py
.py
from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the is_correct assessment. CORRECTNESS_FEEDBACK_NAME = "correctness" CORRECTNESS_PROMPT_INSTRUCTIONS = """\ Consider the following question, claim and document. You must determine whether the claim is \ supported by the document in the c...
70
2,729
confluent-kafka-python
src/confluent_kafka/admin/_group.py
.py
# Copyright 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 required by applicable law or agreed to in writing, s...
181
5,924
coveragepy
tests/test_files.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 """Tests for files.py""" from __future__ import annotations import itertools import os import os.path import re from typing import Any from collections.abc imp...
805
30,694
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/SequenceType.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SequenceType(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(fla...
59
1,771
scikit-bio
skbio/io/format/tests/test_ordination.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. # --------------------------------------------...
318
15,071
readthedocs.org
readthedocs/notifications/apps.py
.py
"""Django app configuration for the notifications app.""" from django.apps import AppConfig class NotificationsAppConfig(AppConfig): name = "readthedocs.notifications" verbose_name = "Notifications" def ready(self): import readthedocs.notifications.signals # noqa
12
289
pdm
src/pdm/cli/completions/__init__.py
.py
from __future__ import annotations import argparse import contextlib import io import re from pathlib import Path from typing import TYPE_CHECKING, Any from argcomplete.completers import DirectoriesCompleter, FilesCompleter from packaging.requirements import InvalidRequirement, Requirement from pdm.compat import tom...
197
7,109
jupyterlab
jupyterlab/serverextension.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from jupyter_server.serverapp import ServerApp from jupyter_server.utils import url_path_join from tornado.web import RedirectHandler def load_jupyter_server_extension(serverapp: ServerApp): from .labapp import L...
73
2,592
readthedocs.org
readthedocs/doc_builder/python_environments.py
.py
"""An abstraction over virtualenv and Conda environments.""" import copy import os import structlog import yaml from readthedocs.config import PIP from readthedocs.config import SETUPTOOLS from readthedocs.config import ParseError from readthedocs.config import parse as parse_yaml from readthedocs.config.models impo...
464
16,006
coremltools
coremltools/converters/sklearn/_tree_ensemble.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from ..._deps import _HAS_SKLEARN from ...models._feature_management import process_or_validate_features...
273
7,998
conda
conda/utils.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Utility functions.""" from __future__ import annotations import logging import re import sys from functools import cache, wraps from os import environ from os.path import abspath, basename, dirname, isfile, join from pathlib import Path fro...
392
14,290
confluent-kafka-python
src/confluent_kafka/_types.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2025 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...
40
1,741
luigi
luigi/contrib/mssqldb.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...
156
5,295
lemur
lemur/notifications/service.py
.py
""" .. module: lemur.notifications.service :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 current_app from lemur import database from lemur.constants i...
200
5,679
django-cms
cms/test_utils/project/app_without_cms_app_class/apps.py
.py
from django.apps import AppConfig class WithoutCMSAppClassConfig(AppConfig): name = 'cms.test_utils.project.app_without_cms_app_class' label = 'app_without_cms_app_class'
7
181
wagtail
wagtail/images/tests/test_site_summary.py
.py
from django.contrib.auth.models import Group, Permission from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.urls import reverse from wagtail.images.tests.utils import Image from wagtail.images.wagtail_hooks import ImagesSummaryItem from wagtail.models import Collect...
137
4,889
wagtail
wagtail/snippets/wagtail_hooks.py
.py
from django.urls import include, path, reverse from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ from wagtail import hooks from wagtail.admin.menu import MenuItem from wagtail.snippets.bulk_actions.delete import DeleteBulkAction from wagtail.snippets.permissions...
47
1,315
luigi
test/task_progress_percentage_test.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...
39
1,166
openvino
tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import re import numpy as np from collections import defaultdict from pathlib import Path from importlib.util import find_spec from openvino import Tensor, PartialShape, Type from openvino.utils.types import get_dty...
504
23,482
saleor
saleor/checkout/tests/test_tasks.py
.py
import datetime import logging from decimal import Decimal from unittest import mock from uuid import UUID import graphene import pytest from django.utils import timezone from freezegun import freeze_time from ...channel.models import Channel from ...order import OrderEvents from ...order.models import Order from ......
1,648
53,892
cvxpy
cvxpy/atoms/atom.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
577
20,438
pyomo
examples/gdp/disease_model.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,736
32,870
coremltools
coremltools/converters/__init__.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause # expose directories as imports from . import libsvm, lightgbm, sklearn, xgboost from ._converters_entry...
19
489
metrics
src/torchmetrics/functional/regression/kl_divergence.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...
116
4,392
tablib
src/tablib/formats/_latex.py
.py
"""Tablib - LaTeX table export support. Generates a LaTeX booktabs-style table from the dataset. """ __lazy_modules__ = {"re"} import re class LATEXFormat: title = 'latex' extensions = ('tex',) TABLE_TEMPLATE = """\ %% Note: add \\usepackage{booktabs} to your preamble %% \\begin{table}[!htbp] \\c...
136
4,176
saleor
saleor/order/tests/test_order_actions_create_fulfillments_for_returned_products.py
.py
from decimal import Decimal from unittest.mock import ANY, patch from prices import Money, TaxedMoney from ...page.models import Page, PageType from ...payment.interface import RefundData from ...plugins.manager import get_plugins_manager from ...warehouse.models import Allocation, Stock from .. import FulfillmentLin...
862
34,069
hatch
src/hatch/cli/fmt/__init__.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import click if TYPE_CHECKING: from hatch.cli.application import Application @click.command(short_help="Format and lint source code", context_settings={"ignore_unknown_options": True}) @click.argument("args", nargs=-1) @click.option("--check",...
84
3,091
saleor
saleor/tests/e2e/product/utils/collection.py
.py
from ...utils import get_graphql_content CATEGORY_COLLECTION_MUTATION = """ mutation CollectionCreate($input: CollectionCreateInput!) { collectionCreate(input: $input) { errors { field code message } collection { id name slug } } } """ def create_collection( ...
45
849
readthedocs.org
readthedocs/core/utils/spam.py
.py
""" Spam fighting utilities. This is a proxy for the spam fighting utilities that are in the readthedocsext.spamfighting private module. """ from django.conf import settings from readthedocs.core.permissions import AdminPermission def get_spam_score(project): if "readthedocsext.spamfighting" in settings.INSTAL...
68
1,720
metrics
docs/source/conf.py
.py
# # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or ...
469
17,199
openvino
src/bindings/python/tests/test_graph/test_ops_fused.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset8 as ov from openvino import Type def test_elu_operator_with_scalar_and_array(): data_value = ov.parameter((2, 2), name="data_value", dtype=np.float32) ...
330
11,583
pyomo
pyomo/contrib/appsi/tests/test_interval.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...
78
2,870
probability
tensorflow_probability/python/bijectors/transpose_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...
263
10,362
luigi
test/contrib/azureblob_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2018 Microsoft Corporation # # 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 applicab...
183
6,413
onnxruntime
onnxruntime/python/tools/transformers/onnx_model_t5.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging import numpy as np from fusion_attention import Attentio...
986
37,071
saleor
saleor/graphql/discount/mutations/promotion/validators.py
.py
from typing import TYPE_CHECKING from django.conf import settings from django.core.exceptions import ValidationError from graphene.utils.str_converters import to_camel_case from .....discount import PromotionType, RewardType, RewardValueType from .....discount.models import PromotionRule from ....core.validators impo...
567
19,101
gunicorn
tests/docker/per_app_allocation/test_per_app_e2e.py
.py
#!/usr/bin/env python # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Docker-based end-to-end tests for per-app worker allocation. These tests verify: 1. Apps with worker limits are only loaded on limited workers 2. Requests are routed to workers that have ...
394
13,964
textual
tests/select/test_remove.py
.py
from textual.app import App, ComposeResult from textual.widgets import Header, Select LINES = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me.""".splitlines() async def test_select_remove(): ...
26
824
mlflow
mlflow/protos/databricks_exception_with_details_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: databricks_exception_with_details.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer ...
72
4,041
saleor
saleor/graphql/warehouse/tests/mutations/test_warehouse_create.py
.py
import json from unittest.mock import patch import graphene import pytest from django.utils.functional import SimpleLazyObject from .....account.i18n_valid_address_extension import VALID_ADDRESS_EXTENSION_MAP from .....account.models import Address from .....core.utils.json_serializer import CustomJsonEncoder from .....
429
12,936
saleor
saleor/graphql/error.py
.py
from django.core.exceptions import ValidationError from graphql.error import GraphQLError from pydantic import ValidationError as PydanticValidationError def pydantic_to_validation_error( exc: PydanticValidationError, default_error_code: str = "invalid" ) -> ValidationError: """Convert Pydantic ValidationErro...
68
2,569
beam
sdks/python/apache_beam/runners/interactive/testing/test_cache_manager.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,404
beam
sdks/python/apache_beam/testing/test_stream_service_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...
189
6,267
readthedocs.org
readthedocs/core/templatetags/core_tags.py
.py
"""Template tags for core app.""" import json from django import template from django.core.serializers.json import DjangoJSONEncoder from django.utils.safestring import mark_safe from readthedocs import __version__ from readthedocs.core.forms import RichSelect from readthedocs.core.resolver import Resolver from read...
112
2,833
hypercorn
src/hypercorn/events.py
.py
from __future__ import annotations from abc import ABC from dataclasses import dataclass class Event(ABC): pass @dataclass(frozen=True) class RawData(Event): data: bytes address: tuple[str, int] | None = None @dataclass(frozen=True) class Closed(Event): pass @dataclass(frozen=True) class Update...
25
345
onnxruntime
orttraining/orttraining/python/training/ortmodule/_runtime_inspector.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import json import tempfile from enum import IntEnum from logging import...
398
15,702
saleor
saleor/tests/e2e/apps/utils/app_create.py
.py
from ...utils import get_graphql_content APP_CREATE_MUTATION = """ mutation AppCreate($input: AppInput!) { appCreate(input: $input) { errors { field code message } authToken app { id isActive identifier } } } """ def add_app( staff_api_client, inpu...
37
636
scikit-bio
skbio/io/descriptors.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. # --------------------------------------------...
173
5,567
onnx
onnx/parser.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import onnx import onnx.onnx_cpp2py_export.parser as C # noqa: N812 class ParseError(Exception): pass def parse_model(model_text: str) -> onnx.ModelProto: """Parse a string to build a Model...
74
1,892
biopython
Tests/run_tests.py
.py
#!/usr/bin/env python # 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. """Run a set of PyUnit-based regression tests. This will find all modules whose name is "test_*.py" in the test directory, and ru...
347
12,057
kombu
kombu/messaging.py
.py
"""Sending and receiving messages.""" from __future__ import annotations from itertools import count from typing import TYPE_CHECKING from .common import maybe_declare from .compression import compress from .connection import PooledConnection, is_connection, maybe_channel from .entity import Exchange, Queue, maybe_d...
679
25,129
beam
sdks/python/apache_beam/io/localfilesystem_test.py
.py
# -*- coding: utf-8 -*- # # 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 "L...
470
15,911
gunicorn
tests/docker/asgi_framework_compat/frameworks/fastapi_app/app.py
.py
""" FastAPI ASGI Application for Compatibility Testing Implements the contract endpoints for ASGI 3.0 compliance testing. """ import asyncio import json import sys import traceback from contextlib import asynccontextmanager from typing import Any from fastapi import FastAPI, Request, WebSocket, WebSocketDisconnect f...
264
7,908
readthedocs.org
readthedocs/projects/tests/test_docker_environment.py
.py
import django_dynamic_fixture as fixture import pytest from readthedocs.api.v2.client import setup_api from readthedocs.builds.models import Build from readthedocs.doc_builder.environments import DockerBuildEnvironment from readthedocs.projects.models import Project @pytest.mark.django_db class TestDockerBuildEnviro...
40
1,193
pyomo
pyomo/contrib/viewer/ui_data.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,988
mlflow
examples/hyperparam/search_random.py
.py
""" Example of hyperparameter search in MLflow using simple random search. The run method will evaluate random combinations of parameters in a new MLflow run. The runs are evaluated based on validation set loss. Test set score is calculated to verify the results. Several runs can be run in parallel. """ from concur...
117
4,582
kafka
tests/kafkatest/tests/core/group_mode_transactions_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 ...
322
16,256
mlflow
tests/optuna/test_storage.py
.py
import gc import random import threading import time from datetime import datetime from time import sleep from typing import Any from unittest.mock import MagicMock, call, patch import numpy as np import pytest from optuna.distributions import CategoricalDistribution, FloatDistribution from optuna.storages import Base...
727
28,494
onnxruntime
orttraining/orttraining/test/python/orttraining_test_layer_norm_transform.py
.py
import onnx def find_node(graph_proto, op_type): nodes = [] map_input_node = {} for node in graph_proto.node: if node.op_type == op_type: map_input_node[node.input[0]] = node if op_type == "Div" or op_type == "Mul": map_input_node[node.input[1]] = node ...
183
5,623
saleor
saleor/menu/tests/fixtures/menu_item_translation.py
.py
import pytest from ...models import MenuItemTranslation @pytest.fixture def menu_item_translation_fr(menu_item): return MenuItemTranslation.objects.create( language_code="fr", menu_item=menu_item, name="French manu item name" )
11
247
mlflow
mlflow/gateway/providers/cohere.py
.py
import json import time import warnings from typing import Any, AsyncGenerator, AsyncIterable from mlflow.gateway.config import CohereConfig, EndpointConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider, ProviderAdapter from mlflow.gateway.providers.uti...
465
16,252
astropy
astropy/table/tests/conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ All of the pytest fixtures used by astropy.table are defined here. `conftest.py` is a "special" module name for pytest that is always imported, but is not looked in for tests, and it is the recommended place to put fixtures that are shared between mod...
271
7,719
probability
tensorflow_probability/python/experimental/marginalize/marginalizable_test.py
.py
# Copyright 2019 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...
366
13,886