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/webhook/sorters.py
.py
from ..core.doc_category import DOC_CATEGORY_WEBHOOKS from ..core.types import BaseEnum, SortInputObjectType class EventDeliverySortField(BaseEnum): CREATED_AT = ["created_at"] class Meta: doc_category = DOC_CATEGORY_WEBHOOKS @property def description(self): if self.name in EventDeli...
45
1,400
onnxruntime
csharp/testdata/test_input_BFLOAT16.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import onnx from onnx import TensorProto, helper from onnx.helper import make_opsetid input_info = helper.make_tensor_value_info("input", TensorProto.BFLOAT16, [1, 5]) output_info = helper.make_tensor_value_info("output", Te...
23
950
mlflow
tests/transformers/test_flavor_configs.py
.py
from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.transformers import _build_pipeline_from_model_input from mlflow.transformers.flavor_config import ( build_flavor_config, update_flavor_conf_to_persist_pretrained_model, ) from mlflow.transformers.torch_utils imp...
187
7,225
textual
tests/text_area/test_escape_binding.py
.py
from textual.app import App, ComposeResult from textual.screen import ModalScreen from textual.widgets import Button, TextArea class TextAreaDialog(ModalScreen): BINDINGS = [("escape", "dismiss")] def compose(self) -> ComposeResult: yield TextArea( tab_behavior="focus", # the default ...
56
1,880
jupyterlab
jupyterlab/tests/test_announcements.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import hashlib import json from unittest.mock import patch from . import fake_client_factory FAKE_ATOM_FEED = b"""<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https...
232
14,346
metrics
tests/unittests/classification/test_ranking.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...
149
6,220
returns
tests/test_pipeline/test_managed/test_managed_ioresult.py
.py
import pytest from returns.io import IOFailure, IOResult, IOSuccess from returns.pipeline import managed from returns.result import Failure, Result, Success _acquire_success = IOSuccess('acquire success') _acquire_failure = IOFailure('acquire failure') def _use_success(inner_value: str) -> IOResult[str, str]: r...
129
3,322
pyomo
pyomo/contrib/cp/repn/docplex_writer.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,425
50,217
luigi
test/lock_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...
165
5,676
beam
sdks/python/apache_beam/examples/complete/game/leader_board_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...
74
2,711
cvxpy
cvxpy/reductions/solvers/qp_solvers/daqp_qpif.py
.py
from ctypes import c_double, c_int import numpy as np import cvxpy.interface as intf import cvxpy.settings as s from cvxpy.reductions.solution import Solution, failure_solution from cvxpy.reductions.solvers import utilities from cvxpy.reductions.solvers.qp_solvers.qp_solver import QpSolver from cvxpy.utilities.citati...
204
7,212
readthedocs.org
readthedocs/search/tests/test_utils.py
.py
import time from unittest import mock import pytest from django.urls import reverse from readthedocs.builds.constants import LATEST, STABLE from readthedocs.projects.models import Project from readthedocs.projects.tasks.search import index_project from readthedocs.search import utils from readthedocs.search.documents...
95
3,512
probability
tensorflow_probability/python/experimental/sequential/extended_kalman_filter.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...
349
14,875
mlflow
mlflow/pyfunc/loaders/chat_model.py
.py
import inspect import logging from typing import Any, Generator from mlflow.exceptions import MlflowException from mlflow.models.utils import _convert_llm_ndarray_to_list from mlflow.protos.databricks_pb2 import INTERNAL_ERROR from mlflow.pyfunc.model import ( _load_context_model_and_signature, ) from mlflow.types...
126
5,130
onnxruntime
orttraining/tools/scripts/gpt2_model_transform.py
.py
### Be noted: this script is developed against the model exported from Megatron GPT2 Pretraining script. import sys import numpy as np import onnx from onnx import numpy_helper if len(sys.argv) < 2: print("Please give model path...") exit(1) input_model_name = sys.argv[1] output_model_name = input_model_nam...
341
10,809
saleor
saleor/graphql/webhook/subscription_types.py
.py
from typing import TYPE_CHECKING import graphene from django.conf import settings from graphene import AbstractType, Union from prices import Money from promise import Promise from rx import Observable from ... import __version__ from ...account.models import User from ...attribute.models import AttributeTranslation,...
3,375
112,090
probability
tensorflow_probability/python/math/ode/dormand_prince.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...
697
27,727
saleor
saleor/graphql/shipping/tests/queries/test_shipping_zones_filtering.py
.py
import graphene import pytest from ....tests.utils import get_graphql_content QUERY_SHIPPING_ZONES_WITH_FILTER = """ query ShippingZones($filter: ShippingZoneFilterInput) { shippingZones(filter: $filter, first: 100) { edges { node { id na...
105
3,020
django-cms
cms/test_utils/project/fakemlng/models.py
.py
from functools import cached_property from django.db import models from cms.models.fields import PlaceholderRelationField from cms.utils.placeholder import get_placeholder_from_slot class MainModel(models.Model): pass class Translations(models.Model): master = models.ForeignKey(MainModel, on_delete=models...
24
639
voila
voila/execute.py
.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
155
5,278
gunicorn
examples/frameworks/django/testing/testing/wsgi.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ WSGI config for testing project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application`...
39
1,465
tqdm
tqdm/notebook.py
.py
""" IPython/Jupyter Notebook progress bar decorator for iterators. Includes a default `range` iterator printing to `stderr`. Usage: >>> from tqdm.notebook import trange, tqdm >>> for i in trange(10): ... ... """ # import compatibility functions and utilities import re import sys from html import escape from weakre...
318
10,888
saleor
saleor/tests/e2e/orders/utils/order_create_from_checkout.py
.py
from saleor.graphql.tests.utils import get_graphql_content ORDER_CREATE_FROM_CHECKOUT_MUTATION = """ mutation orderCreateFromCheckout($id: ID!) { orderCreateFromCheckout(id: $id) { errors { message field code } order { id created status paymentStatus ...
86
1,738
pymc
tests/dims/utils.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...
72
2,781
textual
docs/examples/guide/reactivity/world_clock03.py
.py
from datetime import datetime from pytz import timezone from textual.app import App, ComposeResult from textual.reactive import reactive from textual.widget import Widget from textual.widgets import Digits, Label class WorldClock(Widget): clock_time: reactive[datetime] = reactive(datetime.now) def __init_...
50
1,377
coremltools
deps/pybind11/tests/test_local_bindings.py
.py
from __future__ import annotations import pytest import env # noqa: F401 from pybind11_tests import local_bindings as m def test_load_external(): """Load a `py::module_local` type that's only registered in an external module""" import pybind11_cross_module_tests as cm assert m.load_external1(cm.Extern...
260
8,090
pyomo
pyomo/contrib/pynumero/examples/feasibility.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...
118
4,160
wagtail
wagtail/test/testapp/apps.py
.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class WagtailTestsAppConfig(AppConfig): default_auto_field = "django.db.models.AutoField" name = "wagtail.test.testapp" label = "tests" verbose_name = _("Wagtail tests") def ready(self): from wagtail....
17
468
jupytext
tests/data/notebooks/outputs/ipynb_to_percent/Notebook_with_R_magic.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 2 # language: python # name: python2 # --- # %% [markdown] # # A notebook with R cells # # This notebook shows the use of R cells to generate plots # %% # %load_ext rpy2.ipython # %% language="R" # suppressMessages(require(tidyverse)) # %% language...
28
680
httpie
extras/packaging/linux/build.py
.py
import stat import subprocess from pathlib import Path from typing import Iterator, Tuple BUILD_DIR = Path(__file__).parent HTTPIE_DIR = BUILD_DIR.parent.parent.parent EXTRAS_DIR = HTTPIE_DIR / 'extras' MAN_PAGES_DIR = EXTRAS_DIR / 'man' SCRIPT_DIR = BUILD_DIR / Path('scripts') HOOKS_DIR = SCRIPT_DIR / 'hooks' DIS...
110
2,767
luigi
test/mypy_test.py
.py
import sys import tempfile import unittest from mypy import api def _run_mypy(test_code: str): with tempfile.NamedTemporaryFile(suffix=".py") as test_file: test_file.write(test_code.encode("utf-8")) test_file.flush() return api.run( [ "--no-incremental", ...
231
7,089
sqlmap
plugins/dbms/derby/__init__.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 DBMS from lib.core.settings import DERBY_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.derby.enumeration import Enumeration fro...
31
906
sqlmap
thirdparty/pydes/pyDes.py
.py
############################################################################# # Documentation # ############################################################################# # Author: Todd Whiteman # Date: 16th March, 2009 # Version: 2.0.1 # License: Public Domain - free to do as you wish # Homepage...
853
27,465
wagtail
wagtail/admin/views/pages/search.py
.py
from typing import Any import swapper from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.db.models.query import QuerySet from django.http import Http404 from django.utils.functional import classproperty from django.utils.translation import gettext_lazy as _ from wa...
157
5,261
gunicorn
examples/dirty_example/test_dirty_app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. #!/usr/bin/env python """ Test script to demonstrate Dirty App functionality directly. This tests the dirty app without running the full gunicorn server. Run with: python examples/dirty_example/test_dirty_app...
165
4,030
pyomo
pyomo/dae/plugins/finitedifference.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...
338
13,276
mlflow
mlflow/evaluation/fluent.py
.py
""" THE 'mlflow.evaluation` MODULE IS LEGACY AND WILL BE REMOVED SOON. PLEASE DO NOT USE THESE CLASSES IN NEW CODE. INSTEAD, USE `mlflow/entities/assessment.py` FOR ASSESSMENT CLASSES. """ import uuid from mlflow.evaluation.evaluation import Evaluation, EvaluationEntity from mlflow.evaluation.utils import evaluations...
48
1,818
pymc
tests/backends/test_ndarray.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...
162
4,166
onnxruntime
orttraining/orttraining/python/training/onnxblock/checkpoint_utils.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import onnx from onnxruntime.capi._pybind_state import get_model_after_loading_checkpoint as _load_checkpoint_to_model from onnxruntime.capi._pybind_state import save_checkpoint as _save_checkpoint def save_chec...
43
1,733
openvino
samples/python/model_creation_sample/data.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy digits = numpy.array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
421
37,387
mlflow
tests/entities/model_registry/test_model_version.py
.py
import uuid from mlflow.entities.model_registry.model_version import ModelVersion from mlflow.entities.model_registry.model_version_status import ModelVersionStatus from mlflow.entities.model_registry.model_version_tag import ModelVersionTag from mlflow.entities.model_registry.registered_model import RegisteredModel f...
215
6,293
saleor
saleor/attribute/lock_objects.py
.py
from django.db.models import QuerySet from .models.base import Attribute, AttributeValue def attribute_value_qs_select_for_update() -> QuerySet[AttributeValue]: # Matching lock order (sort_order, pk) of `perform_reordering` to avoid deadlocks. # TODO: switch to a stable pk-only ordering together with the reo...
24
833
saleor
saleor/graphql/payment/tests/mutations/test_transaction_process.py
.py
import datetime from decimal import Decimal from unittest import mock import graphene import pytest from django.test import override_settings from django.utils import timezone from freezegun import freeze_time from .....channel import TransactionFlowStrategy from .....checkout import CheckoutAuthorizeStatus, Checkout...
2,994
98,083
mlflow
mlflow/genai/scorers/online/entities.py
.py
""" Online scorer entities and configuration. This module contains entities for online scorer configuration used by the store layer and online scoring infrastructure. """ from dataclasses import dataclass @dataclass class OnlineScoringConfig: """ Internal entity representing the online configuration for a s...
65
1,864
pyomo
pyomo/opt/tests/base/test_factory.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...
128
4,313
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_price_remove_product_from_exclude.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import WebhookEventAsyncType from .....webhook.payloads import generate...
182
5,754
mlflow
mlflow/agent/agents.py
.py
"""Registry of coding agent CLIs supported by ``mlflow agent setup``. To support a new agent, append an :class:`AgentTool` entry to :data:`AGENTS`. That is the only place per-agent variation lives. """ from __future__ import annotations import shutil from dataclasses import dataclass from typing import Literal Agen...
62
1,618
mlflow
mlflow/store/db_migrations/versions/451aebb31d03_add_metric_step.py
.py
"""add metric step Create Date: 2019-04-22 15:29:24.921354 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "451aebb31d03" down_revision = None branch_labels = None depends_on = None def upgrade(): op.add_column("metrics", sa.Column("step", sa.BigInteger()...
34
1,166
mlflow
mlflow/tracing/fluent.py
.py
from __future__ import annotations import contextlib import functools import importlib import inspect import json import logging import os import warnings from concurrent.futures import ThreadPoolExecutor from contextvars import ContextVar from typing import TYPE_CHECKING, Any, Callable, Generator, Literal, ParamSpec,...
1,975
77,248
probability
tensorflow_probability/python/internal/test_combinations.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...
339
12,488
mlflow
mlflow/gateway/providers/vertex_ai.py
.py
""" Vertex AI provider for MLflow AI Gateway. Extends the Gemini provider to use Vertex AI endpoints with Google Cloud authentication (Application Default Credentials or service account JSON). Three model types are supported: - **Google models** (gemini-*, medlm-*, text-embedding-*, etc.): Gemini API format with :...
317
12,708
biopython
Bio/PDB/binary_cif.py
.py
""" A module to interact with BinaryCIF-formatted files. """ import gzip from collections import deque from typing import Optional import numpy as np try: import msgpack except ImportError: from Bio import MissingPythonDependencyError raise MissingPythonDependencyError( "Install msgpack to use B...
306
10,229
probability
tensorflow_probability/python/distributions/uniform_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...
371
13,327
qutip
qutip/core/data/linalg.py
.py
import scipy.linalg import scipy.sparse from .dense import Dense from .csr import CSR __all__ = ['inv', 'inv_csr', 'inv_dense'] def inv_dense(data, /): """Compute the inverse of a matrix""" if not isinstance(data, Dense): raise TypeError("expected data in Dense format but got " ...
59
1,658
wandb
wandb/integration/metaflow/data_pytorch.py
.py
"""Support for PyTorch datatypes. May raise MissingDependencyError on import. """ from __future__ import annotations from typing_extensions import Any, TypeIs import wandb from . import errors try: import torch import torch.nn as nn except ImportError as e: warning = ( "`torch` (PyTorch) not i...
76
1,712
mlflow
mlflow/store/jobs/sqlalchemy_workspace_store.py
.py
""" Workspace-aware variant of the jobs SQLAlchemy store. """ from __future__ import annotations import logging from mlflow.store.jobs.sqlalchemy_store import SqlAlchemyJobStore from mlflow.store.tracking.dbmodels.models import SqlJob from mlflow.store.workspace_aware_mixin import WorkspaceAwareMixin _logger = logg...
38
1,024
wagtail
wagtail/api/v3/routers/pages.py
.py
from typing import Literal, Optional, TypeAlias, cast import swapper from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.db.models import Model, Q from django.http import Http404, HttpRequest from django.shortcuts i...
703
23,535
textual
docs/examples/styles/text_opacity.py
.py
from textual.app import App from textual.widgets import Label class TextOpacityApp(App): CSS_PATH = "text_opacity.tcss" def compose(self): yield Label("text-opacity: 0%", id="zero-opacity") yield Label("text-opacity: 25%", id="quarter-opacity") yield Label("text-opacity: 50%", id="hal...
19
532
qutip
qutip/tests/core/test_metrics.py
.py
import platform import numpy as np import pytest from qutip import ( Qobj, tensor, fock_dm, basis, destroy, qdiags, sigmax, sigmay, sigmaz, qeye, rand_ket, rand_super_bcsz, rand_dm, rand_unitary, to_super, to_choi, kraus_to_choi, to_chi, to_kraus, ) from qutip.core.dimensions import Space from qutip.c...
570
21,299
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_relu.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 TestKerasRelu(CommonTF2LayerTest): def create_keras_relu_net(self, input_names, input_shapes, input_type, ir_version): "...
54
2,462
conda
tests/test_deferred_deprecations.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Cold-path tests for canonicalized deprecation shims in ``conda.auxlib.logz`` and ``conda.common.serialize``. Each case asserts that importing a module does NOT transitively import the heavy dependency that its deprecated symbols reference. R...
87
2,699
beam
learning/tour-of-beam/learning-content/core-transforms/side-inputs/python-example/task.py
.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); y...
84
2,570
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_greater_equal.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # greater_equal paddle model generator # import numpy as np from save_model import saveModel import paddle import sys def greater_equal(name : str, x, y, data_type, cast_to_fp32=False): paddle.enable_static() with paddle.sta...
67
2,052
pyomo
pyomo/contrib/pynumero/examples/callback/reactor_design.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,625
onnxruntime
orttraining/orttraining/test/python/orttraining_test_ortvalue.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # pylint: disable=W0212,C0114,C0116 import copy import sys import unittest import _test_helpers import numpy as np import torch from numpy.testing import assert_almost_equal from torch._C import _from_...
397
16,517
pymc
pymc/logprob/linalg.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...
103
3,340
cvxpy
cvxpy/utilities/solver_context.py
.py
""" Copyright 2025 CVXPY 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 law or agreed to in writing, softwa...
29
1,090
pyomo
pyomo/contrib/pynumero/interfaces/tests/test_nlp.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...
909
36,332
pyomo
pyomo/contrib/preprocessing/tests/test_var_aggregator.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...
248
9,543
saleor
saleor/graphql/meta/tests/queries/test_account.py
.py
import graphene from ....tests.utils import assert_no_permission, get_graphql_content from .utils import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE QUERY_USER_PUBLIC_META = """ query userMeta($id: ID!){ user(id: $id){ metadata{ key value } ...
258
7,395
openvino
src/frontends/tensorflow/tests/test_models/gen_scripts/generate_dynamic_type_model.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # dynamic type is below FW node for unsupported operation # import os import sys import tensorflow as tf def main(): tf.compat.v1.reset_default_graph() # Create the graph and model with tf.compat.v1.Session() as sess: ...
39
1,057
onnxruntime
onnxruntime/test/testdata/topk_and_multiple_graph_outputs.py
.py
import onnx from onnx import TensorProto, helper def create_model_with_topk_graph_output(model_path): # ====================== # ---- Inputs ---- # ====================== input_tensor = helper.make_tensor_value_info("input", TensorProto.FLOAT, ["N"]) # ====================== # ---- Initialize...
79
2,399
clearml
examples/frameworks/kerastuner/keras_tuner_cifar_legacy.py
.py
"""Keras Tuner CIFAR10 example for the TensorFlow blog post.""" import keras_tuner as kt import tensorflow as tf import tensorflow_datasets as tfds from clearml.external.kerastuner import ClearmlTunerLogger from clearml import Task physical_devices = tf.config.list_physical_devices('GPU') if physical_devices: tf...
78
2,643
openvino
src/frontends/tensorflow/tests/test_models/gen_scripts/split_in_function.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import tensorflow.compat.v1 as tf import numpy as np def main(): tf.compat.v1.reset_default_graph() @tf.function def second_func(x): x1, x2, x3 = tf.split(x, 3) return x1 + x2 + x3 ...
31
691
openvino
tests/layer_tests/tensorflow_tests/test_tf_TensorScatterUpdate.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import platform import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest rng = np.random.default_rng(872173) class TestTensorScatterUpdate(CommonTFLayerTest): def _prepare_i...
88
3,784
textual
tests/test_validation.py
.py
from __future__ import annotations import pytest from textual.validation import ( URL, Failure, Function, Integer, Length, Number, Regex, ValidationResult, Validator, ) VALIDATOR = Function(lambda value: True) def test_ValidationResult_merge_successes(): results = [Validatio...
235
8,907
beam
sdks/python/apache_beam/dataframe/expressions_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
125
4,866
onnxruntime
onnxruntime/test/testdata/transform/computation_reduction/gather/gather_roberta_e2e.py
.py
import onnx from onnx import OperatorSetIdProto, TensorProto, helper # inputs and outputs hidden = 1024 head = 16 inputs = [ helper.make_tensor_value_info("input", TensorProto.FLOAT, ["batch_size", "sequence_length", hidden]), helper.make_tensor_value_info("attention_mask", TensorProto.INT64, ["batch_size", "s...
212
10,567
gunicorn
tests/requests/invalid/limit_header_default_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.config import Config from gunicorn.http.errors import LimitRequestHeaders cfg = Config() # Setting limit_request_field_size=0 should use default max (8190) cfg.set('limit_request_field_size', 0) requ...
12
346
pyro
pyro/contrib/examples/polyphonic_data_loader.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ Data loader logic with two main responsibilities: (i) download raw data and process; this logic is initiated upon import (ii) helper functions for dealing with mini-batches, sequence packing, etc. Data are taken from Boulang...
181
6,924
mlflow
mlflow/models/container/__init__.py
.py
""" Initialize the environment and start model serving in a Docker container. To be executed only during the model deployment. """ import logging import multiprocessing import os import shlex import shutil import signal import sys from pathlib import Path from subprocess import Popen, check_call import mlflow from ...
256
9,006
onnx
onnx/reference/ops/op_reduce_l2.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunReduceNumpy class ReduceL2_1(OpRunReduceNumpy): def _run(self, data, axes=None, keepdims=None): axes = tuple(axes) if axes is not...
35
1,164
scikit-bio
skbio/table/__init__.py
.py
r"""Data Table (:mod:`skbio.table`) ================================== .. currentmodule:: skbio.table Tabular data are among the most common data structures in bioinformatics and many other fields. scikit-bio provides a powerful table class for biological data (:class:`Table`), a flexible system that accepts multiple...
256
9,524
saleor
saleor/product/tests/fixtures/product_type.py
.py
import pytest from ....attribute import AttributeType from ....attribute.models import Attribute from ... import ProductTypeKind from ...models import ProductType @pytest.fixture def product_type_generator( attribute_generator, attribute_value_generator, default_tax_class ): def create_product_type( ...
190
5,870
metrics
src/torchmetrics/nominal/tschuprows.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,337
openvino
src/bindings/python/src/openvino/helpers/packing.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # flake8: noqa import numpy as np from typing import Union from openvino import Type, Shape def pack_data(array: np.ndarray, type: Type) -> np.ndarray: """Represent array values as u1, u2, u3, u4, u6 or i4 openvino element type an...
255
9,718
wandb
wandb/integration/kfp/_kfp_v2_patch.py
.py
"""KFP v2 monkey-patch functions for `kfp.dsl.component_factory`. These replace three functions in the `component_factory` module so that `@wandb_log`-decorated components automatically include W&B logging at container runtime. Module-level state (`_orig_create`, `_orig_get_cmd`, `_wandb_logging_extras`) is set by `kf...
115
3,658
saleor
saleor/graphql/order/tests/queries/shared_query_fragments.py
.py
ORDER_FRAGMENT_WITH_WEBHOOK_RELATED_FIELDS = """ fragment price on Money { amount } fragment taxPrice on TaxedMoney { gross { ...price } } fragment order on Order { shippingMethods { id } errors { field orderLines code } canFinalize deliveryMethod { ... on ShippingMethod { ...
122
1,582
openvino
tests/layer_tests/tensorflow_tests/test_tf_SegmentSum.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 class TestSegmentSum(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'data...
112
5,328
deap
examples/eda/pbil.py
.py
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
86
2,789
wandb
tests/fixtures/wandb_backend_spy/spy.py
.py
from __future__ import annotations import contextlib import dataclasses import gzip import json import threading from collections.abc import Generator from typing import Any import fastapi from typing_extensions import NamedTuple from . import gql_match class WandbBackendSpy: """A spy that intercepts interacti...
600
18,932
wagtail
wagtail/admin/tests/pages/test_bulk_actions/test_bulk_action.py
.py
import swapper from django.test import TestCase from django.urls import reverse from wagtail.test.utils import WagtailTestUtils page_app, page_model = swapper.split( swapper.get_model_name("wagtailcore", "Page").lower() ) class TestBulkActionDispatcher(WagtailTestUtils, TestCase): def setUp(self): #...
40
1,018
mlflow
mlflow/tracing/utils/timeout.py
.py
import atexit import logging import threading import time from collections import OrderedDict from cachetools import Cache, TTLCache from mlflow.entities.span_event import SpanEvent from mlflow.entities.span_status import SpanStatusCode from mlflow.environment_variables import ( MLFLOW_TRACE_BUFFER_MAX_SIZE, ...
251
8,779
pyro
pyro/contrib/epidemiology/compartmental.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import functools import logging import operator import re import warnings from abc import ABC, abstractmethod from collections import OrderedDict from contextlib import ExitStack, contextmanager from functools import reduce from timeit...
1,250
49,835
saleor
saleor/graphql/order/mutations/fulfillment_update_tracking.py
.py
from typing import cast import graphene from ....account.models import User from ....order.actions import fulfillment_tracking_updated from ....order.notifications import send_fulfillment_update from ....permission.enums import OrderPermissions from ....webhook.event_types import WebhookEventAsyncType from ...app.dat...
82
2,870
hydra
hydra/_internal/grammar/utils.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import inspect import re from typing import Any, Union from omegaconf._utils import is_dict_annotation, is_list_annotation # All characters that must be escaped (must match the ESC grammar lexer token). _ESC = "\\()[]{}:=, \t" # Regular expressio...
62
2,133
sphinx
sphinx/ext/autodoc/type_comment.py
.py
"""Update annotations info of living objects using type_comments.""" from __future__ import annotations from typing import TYPE_CHECKING from sphinx.ext.autodoc._dynamic._type_comments import ( _update_annotations_using_type_comments, not_suppressed, # NoQA: F401 signature_from_ast, # NoQA: F401 ) if ...
27
679
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_staff_user_can_use_voucher_for_staff_only.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
149
4,429
probability
tensorflow_probability/python/internal/loop_util.py
.py
# Copyright 2021 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
254
11,066
wagtail
wagtail/documents/tests/__init__.py
.py
from django.test.signals import setting_changed from wagtail.documents import get_document_model, get_permission_policy from wagtail.permissions import register_permission_policy def update_permission_policy(signal, sender, setting, **kwargs): """ Register the permission policy when the `WAGTAILDOCS_DOCUMENT...
19
675