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
pyomo
pyomo/contrib/preprocessing/tests/test_int_to_binary.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...
73
2,898
structlog
tests/test_utils.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. import multiprocessing import sys import pytest from structlog._utils import get_processnam...
72
2,170
mlflow
tests/test_cli.py
.py
import os import shutil import subprocess import sys import tempfile import time from pathlib import Path from unittest import mock from urllib.parse import unquote, urlparse from urllib.request import url2pathname import click import numpy as np import pytest import requests from botocore.stub import Stubber from cli...
1,893
67,287
pdm
tests/cli/test_search.py
.py
"""Tests for the search command utilities""" from pdm.cli.commands.search import print_results def test_print_results_empty_hits(mocker): """Test print_results with empty hits returns early""" ui = mocker.Mock() working_set = mocker.Mock() # Should return early without calling echo print_results...
104
2,942
probability
tensorflow_probability/python/distributions/sample.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...
622
24,893
mlflow
tests/tracing/test_otel_loading.py
.py
import uuid from pathlib import Path from unittest import mock import pytest from opentelemetry import trace as otel_trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.resources import Resource as OTelSDKResource from opentelemetry.sdk.trace import TracerPro...
701
26,404
wagtail
wagtail/documents/tests/test_api_v3/test_custom_document_model.py
.py
from unittest.mock import patch from django.contrib.auth.models import Group, Permission from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase, override_settings from ninja import Schema from wagtail.actions import CreateAction from wagtail.api import APIField from wagtail.api...
157
6,201
mlflow
tests/utils/test_databricks_sql_warehouse.py
.py
import time from datetime import timedelta from unittest import mock import pytest from databricks.sdk.service.sql import State from mlflow.environment_variables import ( MLFLOW_SQL_WAREHOUSE_AUTO_START, MLFLOW_SQL_WAREHOUSE_AUTO_START_TIMEOUT_SECONDS, ) from mlflow.exceptions import MlflowException from mlfl...
130
4,784
returns
returns/pointfree/bind_result.py
.py
from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, TypeVar from returns.interfaces.specific.result import ResultLikeN from returns.primitives.hkt import Kinded, KindN, kinded if TYPE_CHECKING: from returns.result import Result # noqa: WPS433 _FirstType = T...
60
1,783
clearml
clearml/binding/frameworks/xgboost_bind.py
.py
import sys from typing import Callable, Union, IO, Optional, Dict, List, TYPE_CHECKING, Any from pathlib2 import Path from ..frameworks import _patched_call, WeightsFileHandler, _Empty from ..frameworks.base_bind import PatchBaseModelIO from ..import_bind import PostImportHookPatching if TYPE_CHECKING: from ... ...
217
7,449
onnx
onnx/reference/ops/op_thresholded_relu.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class ThresholdedRelu(OpRunUnaryNum): def _run(self, x, alpha=None): alpha = alpha or self.alpha return (np.wher...
15
357
onnxruntime
orttraining/orttraining/python/training/ortmodule/_zero_stage3_compatibility.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from contextlib import contextmanager import torch from onnx import Mo...
443
18,423
deap
examples/gp/ant/buildAntSimFast.py
.py
from distutils.core import setup, Extension module1 = Extension('AntC', sources = ['AntSimulatorFast.cpp']) setup (name = 'AntC', version = '1.0', description = 'Fast version of the Ant Simulator (aims to replace the AntSimulator class)', ext_modules = [module1])
10
308
black
profiling/mix_big.py
.py
config = some.Structure( globalMap = { 103310322020340: [100000031211103,101042000320420,100100001202021,112320301100420,110101024402203,112001202000203,112101112010031,102130400200010,100401014300441,103000401422033], 110040120003212: [114413100031332,102101001412002,100210000032130,214000110100040...
1,003
184,224
gunicorn
tests/requests/invalid/011.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 request = LimitRequestHeaders cfg = Config() cfg.set('limit_request_fields', 2)
11
275
pyomo
pyomo/contrib/fbbt/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...
434
17,496
openvino
src/frontends/onnx/tests/tests_python/test_frontend_extension.py
.py
# -*- coding: utf-8 -*- noqa: E999 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import os from openvino.frontend import FrontEndManager TENSORFLOW_FRONTEND_NAME = "tf" PADDLE_FRONTEND_NAME = "paddle" imported_frontends = [] try: from pybind_mock_frontend impor...
105
3,521
mlflow
dev/clint/src/clint/rules/forbidden_top_level_import.py
.py
from clint.rules.base import Rule class ForbiddenTopLevelImport(Rule): def __init__(self, module: str) -> None: self.module = module def _message(self) -> str: return ( f"Importing module `{self.module}` at the top level is not allowed " "in this file. Use lazy import ...
13
340
onnxruntime
orttraining/orttraining/python/training/optim/_ds_code_store.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # # Copyright 2020 The Microsoft DeepSpeed Team # # !!!IMPORTANT: This file is a copy of the original one in DeepSpeed repo at given version, # It is ...
78
3,793
saleor
saleor/graphql/attribute/mutations/__init__.py
.py
from .attribute_bulk_create import AttributeBulkCreate from .attribute_bulk_update import AttributeBulkUpdate from .attribute_create import AttributeCreate from .attribute_delete import AttributeDelete from .attribute_reorder_values import AttributeReorderValues from .attribute_update import AttributeUpdate from .attri...
28
927
cvxpy
cvxpy/tests/solver_test_helpers.py
.py
""" Copyright 2019, the 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, ...
1,725
62,367
onnx
onnx/backend/test/case/node/bitwisexor.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 from onnx.numpy_helper import create_random_int class BitwiseXor(Base): ...
56
1,672
readthedocs.org
readthedocs/organizations/views/private.py
.py
"""Views that require login.""" # pylint: disable=too-many-ancestors from django.conf import settings from django.contrib import messages from django.http import HttpResponseBadRequest from django.shortcuts import redirect from django.urls import reverse from django.urls import reverse_lazy from django.utils import ti...
325
11,828
probability
tensorflow_probability/python/experimental/nn/initializers/__init__.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
31
1,343
pyomo
pyomo/contrib/ampl_function_demo/plugins.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...
16
780
mkdocs
mkdocs/__main__.py
.py
#!/usr/bin/env python from __future__ import annotations import logging import os import shutil import sys import textwrap import traceback import warnings import click from mkdocs import __version__, config, utils if sys.platform.startswith("win"): try: import colorama except ImportError: ...
371
12,347
mlflow
tests/tracking/context/test_git_context.py
.py
from unittest import mock import git import pytest from mlflow.tracking.context.git_context import GitRunContext from mlflow.utils.mlflow_tags import ( MLFLOW_GIT_BRANCH, MLFLOW_GIT_COMMIT, MLFLOW_GIT_REPO_URL, ) MOCK_SCRIPT_NAME = "/path/to/script.py" MOCK_COMMIT_HASH = "commit-hash" MOCK_BRANCH_NAME = ...
79
2,382
mlflow
tests/utils/test_env_pack.py
.py
import subprocess import sys import tarfile import venv from pathlib import Path from unittest import mock import pytest import yaml from mlflow.exceptions import MlflowException from mlflow.utils import env_pack from mlflow.utils.databricks_utils import DatabricksRuntimeVersion from mlflow.utils.env_pack import EnvP...
424
15,584
hydra
plugins/hydra_joblib_launcher/hydra_plugins/hydra_joblib_launcher/_core.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import sys from pathlib import Path from typing import Any, Dict, List, Sequence, Tuple, cast from hydra.core.hydra_config import HydraConfig from hydra.core.singleton import Singleton from hydra.core.utils import ( JobReturn, ...
239
8,087
clearml
clearml/backend_api/services/v2_20/auth.py
.py
""" auth service This service provides authentication management and authorization validation for the entire system. """ from typing import List, Optional, Any import six from datetime import datetime from dateutil.parser import parse as parse_datetime from clearml.backend_api.session import ( Request, Respons...
777
23,965
onnx
tests/python/reference_evaluator_model_test.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 # mypy: ignore-errors from __future__ import annotations import numpy as np import onnx import onnx.helper as oh import onnx.numpy_helper as onh import onnx.reference as orf def create_model(): """The following model is equivalent ...
125
3,825
saleor
saleor/graphql/order/bulk_mutations/order_bulk_create.py
.py
import copy import datetime from collections import defaultdict from dataclasses import dataclass from dataclasses import field as dataclass_field from dataclasses import fields as dataclass_fields from decimal import Decimal from typing import Any from uuid import UUID import graphene from django.core.exceptions impo...
2,520
97,044
onnxruntime
onnxruntime/test/python/transformers/test_profiler.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------...
48
1,609
deap
doc/code/benchmarks/schaffer.py
.py
from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.pyplot as plt try: import numpy as np except: exit() from deap import benchmarks def schaffer_arg0(sol): return benchmarks.schaffer(sol)[0] fig = plt.figure() ax = Axes3D(fig, azim = -29, elev = 60) # ax = Axes3D(fig) X ...
28
636
beam
learning/tour-of-beam/learning-content/introduction/introduction-concepts/creating-collections/from-memory/python-example/from_memory.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...
52
1,716
kombu
t/unit/transport/test_memory.py
.py
from __future__ import annotations import socket import pytest from kombu import Connection, Consumer, Exchange, Producer, Queue class test_MemoryTransport: def setup_method(self): self.c = Connection(transport='memory') self.e = Exchange('test_transport_memory') self.q = Queue('test_t...
185
5,650
ipython
IPython/terminal/embed.py
.py
""" An embedded IPython shell. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import sys import warnings from IPython.core import ultratb, compilerop from IPython.core import magic_arguments from IPython.core.magic import Magics, magics_class, line_magic from...
495
18,917
saleor
saleor/graphql/order/tests/mutations/test_order_bulk_cancel.py
.py
from unittest.mock import ANY, call, patch import graphene from .....order.actions import WEBHOOK_EVENTS_FOR_ORDER_CANCELED, cancel_order from .....order.models import OrderLine from .....product.models import ProductVariant from .....webhook.utils import get_webhooks_for_multiple_events from ....tests.utils import a...
218
6,566
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/filter_function.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 "License");...
73
2,170
astropy
astropy/wcs/wcsapi/wrappers/sliced_wcs.py
.py
import numbers from collections import defaultdict import numpy as np from astropy.utils.decorators import lazyproperty from .base import BaseWCSWrapper __all__ = ["SlicedLowLevelWCS", "sanitize_slices"] def sanitize_slices(slices, ndim): """ Given a slice as input sanitise it to an easier to parse format...
337
11,924
textual
docs/examples/widgets/text_area_selection.py
.py
from textual.app import App, ComposeResult from textual.widgets import TextArea from textual.widgets.text_area import Selection TEXT = """\ def hello(name): print("hello" + name) def goodbye(name): print("goodbye" + name) """ class TextAreaSelection(App): def compose(self) -> ComposeResult: text...
24
541
beam
sdks/python/apache_beam/io/watch.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...
902
35,584
openvino
src/bindings/python/tests/test_graph/test_ops_reshape.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset8 as ov import numpy as np import pytest from openvino import Type from openvino.utils.types import get_element_type @pytest.mark.parametrize("op_name", ["ABC", "concat", "123456"]) def tes...
221
7,898
beam
sdks/python/apache_beam/pvalue.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...
700
23,869
saleor
saleor/core/utils/promo_code.py
.py
import secrets from django.core.exceptions import ValidationError from ...discount.models import VoucherCode from ...giftcard.error_codes import GiftCardErrorCode from ...giftcard.models import GiftCard class InvalidPromoCode(ValidationError): def __init__(self, message=None, **kwargs): if message is No...
45
1,310
openvino
tests/layer_tests/tensorflow_tests/test_tf_ZerosLike.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestZerosLike(CommonTFLayerTest): def create_zeros_like_net(self, x_shape): tf.compat.v1.reset_default_graph() # C...
34
1,098
mkdocs
mkdocs/tests/utils/templates_tests.py
.py
import unittest from textwrap import dedent import yaml from mkdocs.tests.base import load_config from mkdocs.utils import templates class UtilsTemplatesTests(unittest.TestCase): def test_script_tag(self): cfg_yaml = dedent( ''' extra_javascript: - some_plain_javasc...
50
1,801
pyro
tests/infer/test_csis.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import torch.nn as nn import pyro import pyro.distributions as dist import pyro.infer import pyro.optim from tests.common import assert_equal, assert_not_equal def model(observations={"y1": 0, "y2": 0}...
70
2,468
hatch
backend/src/hatchling/builders/binary.py
.py
from __future__ import annotations import os import sys from typing import TYPE_CHECKING, Any from hatchling.builders.config import BuilderConfig from hatchling.builders.plugin.interface import BuilderInterface if TYPE_CHECKING: from collections.abc import Callable class BinaryBuilderConfig(BuilderConfig): ...
203
7,639
wagtail
wagtail/actions/edit_page.py
.py
from wagtail.actions.edit import EditAction class EditPageAction(EditAction): """ Save changes to an existing page, creating a revision and logging a ``wagtail.edit`` action, the same as the admin's own edit view. See :class:`~wagtail.actions.edit.EditAction` for the parameters. """ def user...
16
486
pyomo
pyomo/core/tests/unit/test_numeric_expr_zerofilter.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...
5,819
239,354
mlflow
tests/langgraph/conftest.py
.py
import importlib import openai import pytest from tests.helper_functions import start_mock_openai_server from tests.tracing.helper import reset_autolog_state # noqa: F401 @pytest.fixture(autouse=True) def set_envs(monkeypatch, mock_openai): monkeypatch.setenv("OPENAI_API_KEY", "test") monkeypatch.setenv("O...
28
722
wandb
wandb/sdk/lib/redirect.py
.py
from __future__ import annotations try: import fcntl import pty import termios import tty except ImportError: # windows pty = tty = termios = fcntl = None # type: ignore import itertools import logging import os import queue import re import signal import struct import sys import threading impor...
872
27,330
astropy
astropy/nddata/decorators.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings from copy import deepcopy from functools import wraps from inspect import signature from itertools import islice from astropy.utils.exceptions import AstropyUserWarning from .nddata import NDData __all__ = ["support_nddata"] # All su...
288
11,689
sphinx
tests/test_errors.py
.py
from __future__ import annotations from sphinx.errors import ExtensionError def test_extension_error_repr() -> None: exc = ExtensionError('foo') assert repr(exc) == "ExtensionError('foo')" def test_extension_error_with_orig_exc_repr() -> None: exc = ExtensionError('foo', Exception('bar')) assert re...
14
373
openvino
tests/layer_tests/tensorflow_tests/test_tf_ReduceLogicalOps.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.tf_layer_test_class import CommonTFLayerTest # Testing Logical operations (Initial Implementation) # Documentation: https://www.tensorflow.org/api_docs/python/tf/raw_ops/All # ...
69
2,538
pyro
pyro/infer/resampler.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from typing import Callable, Dict, Optional import torch import pyro import pyro.poutine as poutine from pyro.poutine.trace_struct import Trace from pyro.poutine.util import site_is_subsample class Resampler: """Resampler for i...
134
5,720
saleor
saleor/graphql/product/resolvers.py
.py
from django.db.models import Exists, OuterRef, Sum from ...attribute import models as attribute_models from ...channel.models import Channel from ...order import OrderStatus from ...order.models import Order from ...permission.enums import ProductPermissions from ...permission.utils import has_one_of_permissions from ...
361
11,486
astropy
astropy/cosmology/_src/funcs/comparison.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Comparison functions for `astropy.cosmology.Cosmology`. This module is **NOT** public API. To use these functions, import them from the top-level namespace -- :mod:`astropy.cosmology`. This module will be moved. """ import functools import inspect fro...
366
13,386
wagtail
wagtail/admin/views/bulk_action/dispatcher.py
.py
from django.apps import apps from django.http import Http404 from wagtail.admin.views.bulk_action.registry import bulk_action_registry as registry def index(request, app_label, model_name, action): try: model = apps.get_model(app_label, model_name) except LookupError as e: raise Http404 from ...
16
516
openvino
tests/e2e_tests/common/preprocessors/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from . import preprocessors from . import transformers from .provider import StepProvider
7
173
wandb
tests/unit_tests/test_import_wandb.py
.py
import sys def test_path_is_unchanged(): # Ideally we would compare directly to the user's starting path, # but that seems to be mutilated with tox. So, we check for known # leaks. import wandb # noqa: F401 for item in sys.path: assert "wandb/vendor" not in item
12
295
saleor
saleor/graphql/product/tests/queries/test_product_variant_query.py
.py
import graphene from django.contrib.sites.models import Site from measurement.measures import Weight from .....attribute.utils import associate_attribute_values_to_instance from .....core.units import WeightUnits from .....warehouse import WarehouseClickAndCollectOption from ....core.enums import WeightUnitsEnum from ...
973
29,420
pyomo
pyomo/repn/tests/test_plugins.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...
49
1,761
saleor
saleor/checkout/delivery_context.py
.py
from dataclasses import dataclass from decimal import Decimal from typing import TYPE_CHECKING, Any, Optional, Union from uuid import UUID from django.conf import settings from django.db import transaction from django.db.models import Q from django.utils import timezone from prices import Money from promise import Pro...
812
29,411
probability
tensorflow_probability/python/layers/internal/__init__.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...
15
678
saleor
saleor/graphql/tax/tests/queries/test_tax_country_configurations.py
.py
from saleor.tax.models import TaxClassCountryRate from ....tests.utils import assert_no_permission, get_graphql_content from ..fragments import TAX_COUNTRY_CONFIGURATION_FRAGMENT QUERY = ( """ query TaxCountryConfigurations { taxCountryConfigurations { ...TaxCountryConfiguration } ...
47
1,254
textual
tests/snapshot_tests/snapshot_apps/command_palette_discovery.py
.py
from textual.app import App from textual.command import DiscoveryHit, Hit, Hits, Provider class TestSource(Provider): def goes_nowhere_does_nothing(self) -> None: pass async def discover(self) -> Hits: for n in range(10): command = f"This is a test of this code {n}" yi...
39
991
sphinx
tests/roots/test-ext-autodoc/target/functions.py
.py
from functools import partial def func(): pass async def coroutinefunc(): pass async def asyncgenerator(): # NoQA: RUF029 yield partial_func = partial(func) partial_coroutinefunc = partial(coroutinefunc) builtin_func = print partial_builtin_func = partial(print) def slice_arg_func(arg: 'float64[...
25
352
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineglobally_combinefn.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 "License");...
89
2,848
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_reduce_max.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # reduce_max paddle model generator # import numpy as np import sys from save_model import saveModel def reduce_max(name : str, x, axis=None, keepdim=False): import paddle paddle.enable_static() with paddle.static.progr...
47
1,475
astropy
astropy/timeseries/periodograms/lombscargle_multiband/implementations/mle.py
.py
import numpy as np __all__ = ["construct_regularization", "design_matrix", "periodic_fit"] def design_matrix(t, bands, frequency, dy=None, nterms_base=1, nterms_band=1): t = np.asarray(t) omega = np.asarray(2 * np.pi * frequency) unique_bands = np.unique(bands) # Construct X - design matrix of the s...
177
5,178
luigi
test/helpers.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...
235
7,540
openvino
tools/commit_slider/utils/e2e_preparator.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from os import walk, path from utils.helpers import CfgError from pathlib import Path # WA to keep CI job working until we add requirements try: import yaml except: import subprocess # nosec B404 import sys p = subproce...
56
1,681
gunicorn
scripts/update_thanks.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. #!/usr/bin/env python # Usage: git log --format="%an <%ae>" | python update_thanks.py # You will get a result.txt file, you can work with the file (update, remove, ...) # # Install # ======= # pip install validate_...
45
1,186
pdm
src/pdm/models/markers.py
.py
from __future__ import annotations import operator from dataclasses import dataclass, replace from functools import lru_cache, reduce from typing import TYPE_CHECKING, Any, cast, overload from dep_logic.markers import ( BaseMarker, InvalidMarker, MarkerExpression, MarkerUnion, MultiMarker, fro...
218
8,563
pyomo
pyomo/contrib/preprocessing/tests/test_constraint_tightener.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
123
5,039
beam
sdks/python/apache_beam/io/external/xlang_jdbcio_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...
461
16,234
openvino
src/bindings/python/src/openvino/opset8/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.opset1.ops import absolute from openvino.opset1.ops import absolute as abs from openvino.opset1.ops import acos from openvino.opset4.ops import acosh from openvino.opset8.ops import adaptive_avg_pool...
170
7,169
beam
sdks/python/apache_beam/portability/common_urns.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...
97
4,347
readthedocs.org
readthedocs/api/v3/mixins.py
.py
from django.contrib.auth.models import User from django.shortcuts import get_object_or_404 from rest_framework import status from rest_framework.response import Response from readthedocs.builds.models import Build from readthedocs.builds.models import Version from readthedocs.core.history import safe_update_change_rea...
245
8,122
onnxruntime
plugin-ep-cuda/python/build_wheel.py
.py
#!/usr/bin/env python3 """Build a wheel for the onnxruntime-ep-cuda12 or onnxruntime-ep-cuda13 package.""" import argparse import platform import re import shutil import subprocess import sys import tempfile from pathlib import Path SCRIPT_DIR = Path(__file__).parent MIN_ONNXRUNTIME_VERSION_FILE = SCRIPT_DIR.parent /...
160
5,769
beam
sdks/python/apache_beam/ml/rag/chunking/langchain.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...
119
4,469
textual
tests/snapshot_tests/snapshot_apps/command_palette_key.py
.py
from textual.app import App, ComposeResult from textual.widgets import Footer class NewPaletteBindingApp(App): COMMAND_PALETTE_BINDING = "ctrl+backslash" COMMAND_PALETTE_DISPLAY = "ctrl+\\" def compose(self) -> ComposeResult: yield Footer() if __name__ == "__main__": app = NewPaletteBinding...
16
340
saleor
saleor/tests/e2e/product/utils/product_variant_bulk_create.py
.py
from ...utils import get_graphql_content PRODUCT_VARIANT_BULK_CREATE_MUTATION = """ mutation ProductVariantBulkCreate($id: ID!, $input: [ProductVariantBulkCreateInput!]!) { productVariantBulkCreate(product: $id, variants: $input) { errors { field code index channels message } ...
65
1,260
probability
tensorflow_probability/python/internal/distribute_test_lib.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 or ...
134
4,355
beam
sdks/python/apache_beam/testing/benchmarks/nexmark/queries/query0.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...
45
1,488
probability
tensorflow_probability/python/math/bessel_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
592
23,320
coremltools
coremltools/converters/mil/backend/mil/helper.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools import proto from coremltools.converters.mil.mil import types ...
325
12,984
mlflow
tests/keras/test_autolog.py
.py
import json import math import re import keras import numpy as np import pytest import mlflow from mlflow.models import Model from mlflow.tracking.fluent import flush_async_logging from mlflow.types import Schema, TensorSpec from mlflow.utils.autologging_utils import AUTOLOGGING_INTEGRATIONS @pytest.fixture(autouse...
228
7,642
mlflow
tests/pydantic_ai/test_utils.py
.py
from mlflow.pydantic_ai.utils import parse_usage from mlflow.tracing.constant import TokenUsageKey class _FakeRunUsageWithCache: input_tokens = 1500 output_tokens = 50 total_tokens = 1550 cache_read_tokens = 1200 cache_write_tokens = 300 class _FakeRunUsageNoCache: input_tokens = 1500 ou...
70
1,909
sqlmap
plugins/dbms/access/syntax.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.convert import getOrds from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): @staticmethod def escape(expression, quote=Tr...
23
669
kafka
tests/kafkatest/services/kafka/consumer_group.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 ...
43
1,805
dirty-equals
tests/mypy_checks.py
.py
""" This module is run with mypy to check types can be used correctly externally. """ import sys sys.path.append('.') from dirty_equals import HasName, HasRepr, IsStr assert 123 == HasName('int') assert 123 == HasRepr('123') assert 123 == HasName(IsStr(regex='i..')) assert 123 == HasRepr(IsStr(regex=r'\d{3}')) # t...
18
436
wandb
tests/unit_tests/test_wb_logging.py
.py
import contextlib import logging import pathlib from collections.abc import Generator from wandb.sdk.lib import wb_logging wb_logging.configure_wandb_logger() @contextlib.contextmanager def _wandb_file_handler( run_id: str, path: pathlib.Path, ) -> Generator[None]: handler = wb_logging.add_file_handler(...
58
1,970
wandb
tests/system_tests/test_launch/test_wandb_controller.py
.py
import pytest import sweeps import wandb SWEEP_CONFIGURATION = { "method": "random", "name": "sweep", "metric": {"goal": "maximize", "name": "val_acc"}, "parameters": { "batch_size": {"values": [16, 32, 64]}, "epochs": {"values": [5, 10, 15]}, "lr": {"distribution": "uniform", "...
86
2,317
conda
tests/plugins/test_manager.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import logging import re import sys from dataclasses import dataclass from typing import TYPE_CHECKING import pluggy import pytest from packaging.version import Version from conda import plugins from conda....
413
13,936
mlflow
mlflow/projects/databricks.py
.py
import hashlib import json import logging import os import posixpath import re import tempfile import textwrap import time import uuid from pathlib import Path from shlex import quote from mlflow import tracking from mlflow.entities import RunStatus from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID, MLFLOW...
612
24,796
wagtail
wagtail/admin/tests/test_site_summary.py
.py
from django.contrib.auth.models import Group from django.test import TestCase from django.urls import reverse from wagtail.admin.site_summary import PagesSummaryItem from wagtail.models import GroupPagePermission, Site from wagtail.test.testapp.models import SimplePage from wagtail.test.utils import Page, WagtailTestU...
87
3,450
probability
spinoffs/inference_gym/inference_gym/targets/item_response_theory_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
148
5,381