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
mlflow
mlflow/claude_code/hooks.py
.py
"""Legacy compatibility helpers for the retired Python Claude hook runtime.""" import json import sys from mlflow.claude_code.tracing import get_hook_response def stop_hook_handler() -> None: """No-op shim for repositories still wired to the old Python hook.""" print(json.dumps(get_hook_response())) # noqa...
17
531
confluent-kafka-python
examples/asyncio_example.py
.py
#!/usr/bin/env python # # Copyright 2019 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...
229
8,819
gunicorn
examples/http2_gevent/gunicorn_conf.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Gunicorn configuration for HTTP/2 with gevent worker. This configuration demonstrates: - HTTP/2 protocol support with ALPN - Gevent async worker for high concurrency - SSL/TLS configuration - HTTP/2 specific t...
85
2,683
bazel
src/test/py/bazel/bazel_external_repository_test.py
.py
# pylint: disable=g-bad-file-header # Copyright 2017 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.org/licenses/LICENSE-2.0 ...
795
25,661
beam
sdks/python/apache_beam/coders/__init__.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...
20
918
bazel
examples/py_native/fibonacci/fib.py
.py
"""An example binary to test the imports attribute of native Python rules.""" def Fib(n): if n == 0 or n == 1: return 1 else: return Fib(n-1) + Fib(n-2)
9
167
pyomo
pyomo/solvers/tests/checks/test_no_solution_behavior.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...
140
4,287
saleor
saleor/product/utils/__init__.py
.py
import datetime from collections.abc import Iterable from typing import TYPE_CHECKING from uuid import UUID from ...core.taxes import TaxedMoney, zero_taxed_money from ...core.tracing import traced_atomic_transaction from ...core.utils.events import call_event from ...discount.utils.promotion import mark_active_catalo...
86
3,351
openvino
tests/samples_tests/smoke_tests/test_hello_nv12_input_classification.py
.py
""" Copyright (C) 2018-2026 Intel 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 applicable law or agreed to in w...
61
2,306
coremltools
coremltools/test/optimize/torch/test_utils/test_torch_utils.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import pytest import torch as _torch from coremltools.optimize.torch._utils.torch_utils import ( ...
55
1,718
mlflow
examples/docker/train.py
.py
# The data set used in this example is from http://archive.ics.uci.edu/ml/datasets/Wine+Quality # P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis. # Modeling wine preferences by data mining from physicochemical properties. In Decision Support Systems, Elsevier, 47(4):547-553, 2009. import argparse import os i...
71
2,316
saleor
saleor/tests/e2e/taxes/utils/tax_class_update.py
.py
from ...utils import get_graphql_content TAX_CLASS_UPDATE_MUTATION = """ mutation taxClassUpdate($id:ID!, $input:TaxClassUpdateInput!){ taxClassUpdate(id:$id, input:$input) { errors { field message } taxClass { id countries { country { code ...
41
885
ipython
tests/test_error.py
.py
"""Tests for IPython.core.error exception hierarchy.""" import pytest from IPython.core.error import ( IPythonCoreError, InputRejected, StdinNotImplementedError, TryNext, UsageError, ) def test_ipython_core_error_is_exception(): assert issubclass(IPythonCoreError, Exception) def test_try_n...
77
1,931
luigi
luigi/contrib/hdfs/target.py
.py
# # 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 or agreed to in writing...
215
7,196
funcy
funcy/decorators.py
.py
from contextlib import ContextDecorator, contextmanager # reexport these for backwards compat import functools from inspect import unwrap # reexport this for backwards compat import inspect from . colls import omit __all__ = ['decorator', 'wraps', 'unwrap', 'ContextDecorator', 'contextmanager'] def decorator(deco...
185
6,288
probability
tensorflow_probability/python/internal/nest_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...
602
22,402
pyro
tests/ops/test_arrowhead.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pyro.ops.arrowhead import ( SymmArrowhead, sqrt, triu_gram, triu_inverse, triu_matvecmul, ) from tests.common import assert_close @pytest.mark.parametrize("head_size", [0, 2, 5]) d...
59
1,733
textual
tests/text_area/test_edit_via_api.py
.py
"""Tests editing the document using the API (replace etc.) The tests in this module directly call the edit APIs on the TextArea rather than going via bindings. Note that more extensive testing for editing is done at the Document level. """ import pytest from textual.app import App, ComposeResult from textual.widget...
572
18,163
pyomo
pyomo/contrib/cspline_external/test/test_external_function.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
167
7,941
pdm
src/pdm/cli/commands/base.py
.py
from __future__ import annotations import argparse from argparse import _SubParsersAction from collections.abc import Sequence from typing import Any, TypeVar from typing_extensions import Self from pdm.cli.options import Option, global_option, project_option, verbose_option from pdm.project import Project C = Type...
67
2,354
wandb
wandb/automations/actions.py
.py
"""Actions that are triggered by W&B Automations.""" from __future__ import annotations from typing import Annotated, Any, Literal, get_args from pydantic import BeforeValidator, Field from typing_extensions import Self, TypeVar from wandb._pydantic import GQLBase, GQLId, default_if_none from wandb._strutils import...
232
8,030
saleor
saleor/graphql/account/i18n.py
.py
from django.core.exceptions import ValidationError from ...account.forms import get_address_form from ...account.models import Address from ...account.validators import validate_possible_number from ...core.exceptions import PermissionDenied from ...permission.auth_filters import AuthorizationFilters from ...permissio...
223
7,878
biopython
Bio/Pathway/Rep/MultiGraph.py
.py
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved. # Revisions copyright 2018 by Maximilian Greil. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should...
197
6,779
rq
rq/cli/helpers.py
.py
import importlib import os import sys import time from ast import literal_eval from datetime import datetime, timedelta from enum import Enum from functools import partial, update_wrapper from json import JSONDecodeError, loads from shutil import get_terminal_size from typing import cast import click from redis import...
428
14,930
mlflow
mlflow/genai/review_queues/__init__.py
.py
"""Review queues for expert trace-review workflows. A ``ReviewQueue`` is a named bundle of attached items, a set of questions (label schemas), and a set of assigned users, scoped to an experiment. Two flavors of the same entity: - a **user queue** (``name`` = a user, exactly that one user, all of the experiment's s...
284
9,462
cvxpy
cvxpy/tests/nlp_tests/__init__.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 ...
17
563
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vscode_folding_markers/sample_rise_notebook_66.py
.py
# --- # jupyter: # jupytext: # cell_markers: region,endregion # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # region [markdown] slideshow={"slide_type": "slide"} # A markdown cell # endregion # region slideshow={"slide_type": ""} 1+1 # endregion # region [markdow...
22
412
probability
tensorflow_probability/python/math/psd_kernels/gamma_exponential_test.py
.py
# Copyright 2023 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...
198
7,394
textual
tests/snapshot_tests/snapshot_apps/text_log_blank_write.py
.py
from textual.app import App, ComposeResult from textual.widgets import RichLog class RichLogApp(App): def compose(self) -> ComposeResult: yield RichLog() def on_mount(self) -> None: tl = self.query_one(RichLog) tl.write("Hello") tl.write("") tl.write("World") if __na...
19
377
onnx
onnx/backend/test/case/node/selu.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Selu(Base): @staticmethod def export() -> None: node =...
50
1,536
scikit-bio
skbio/stats/distance/_base.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. # --------------------------------------------...
2,592
88,257
saleor
saleor/patch_local.py
.py
import asyncio import contextlib from asgiref.local import Local, _CVar @contextlib.contextmanager def _Local_lock_storage(self): # Thread safe access to storage if self._thread_critical: is_async = True try: # this is a test for are we in a async or sync # thread - wi...
54
1,935
metrics
tests/unittests/image/test_lpips.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...
157
6,408
biopython
Bio/KEGG/Gene/__init__.py
.py
# Copyright 2017 by Kozo Nishida. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Code to work with the ...
143
4,288
pdm
src/pdm/cli/commands/update.py
.py
from __future__ import annotations import argparse from collections import defaultdict from typing import TYPE_CHECKING from pdm.cli.commands.base import BaseCommand from pdm.cli.filters import GroupSelection from pdm.cli.hooks import HookManager from pdm.cli.options import ( frozen_lockfile_option, groups_gr...
212
8,550
probability
tensorflow_probability/python/experimental/bayesopt/acquisition/upper_confidence_bound.py
.py
# Copyright 2023 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
9,201
clearml
clearml/backend_interface/task/repo/util.py
.py
import os from subprocess import check_output from typing import List, Optional from furl import furl def get_command_output(command: List[str], path: Optional[str] = None, strip: bool = True) -> str: """ Run a command and return its output :raises CalledProcessError: when command execution fails :ra...
37
1,264
astropy
astropy/units/physical.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Defines the physical types that correspond to different units. The classes and functions defined here are also available in (and should be used through) the `astropy.units` namespace. """ import numbers from collections.abc import Iterator from typin...
612
22,188
saleor
saleor/channel/tests/test_utils.py
.py
import warnings import pytest from ..exceptions import ChannelNotDefined, NoDefaultChannel from ..utils import DEPRECATION_WARNING_MESSAGE, get_default_channel def test_get_default_channel_without_channels(): with pytest.raises(NoDefaultChannel): get_default_channel() def test_get_default_channel_with...
25
699
hydra
hydra/core/hydra_config.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Any, Optional from omegaconf import DictConfig, OmegaConf from hydra.conf import HydraConf from hydra.core.singleton import Singleton class HydraConfig(metaclass=Singleton): def __init__(self) -> None: self.cfg: Op...
42
1,561
lemur
build_backend.py
.py
""" Custom build backend for Lemur that handles static asset building. This replaces the custom commands from the old setup.py. """ import os import subprocess import logging from setuptools import build_meta as _orig from setuptools.build_meta import * def build_wheel(wheel_directory, config_settings=None, metadata_...
55
1,855
django-cms
cms/tests/test_placeholder_checks.py
.py
from unittest.mock import Mock, call, patch from django.forms.models import model_to_dict from cms.api import create_page from cms.models import Placeholder, UserSettings, fields from cms.models.fields import PlaceholderRelationField from cms.test_utils.testcases import CMSTestCase class ChecksTestCase(CMSTestCase)...
317
12,274
openvino
src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/conformance_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging from sys import stdout from os import environ from . import constants def get_logger(app_name: str): logging.basicConfig() logger = logging.getLogger(app_name) logger.setLevel(logging.INFO) return logger...
41
1,120
saleor
saleor/graphql/discount/mutations/promotion/promotion_bulk_delete.py
.py
import graphene from django.conf import settings from django.db.models import Exists, OuterRef, QuerySet from .....discount import models from .....permission.enums import DiscountPermissions from .....product.utils.product import ( get_channel_to_products_map_from_rules, mark_products_in_channels_as_dirty, ) ...
68
2,641
loguru
tests/exceptions/source/modern/decorate_async_generator.py
.py
from loguru import logger import asyncio import sys logger.remove() # We're truly only testing whether the tests succeed, we do not care about the formatting. # These should be regular Pytest test cases, but that is not possible because the syntax is not valid in Python 3.5. logger.add(lambda m: None, format="", diag...
112
2,694
astropy
astropy/coordinates/tests/test_distance.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This includes tests for the Distance class and related calculations """ import numpy as np import pytest from numpy import testing as npt from astropy import units as u from astropy.coordinates import CartesianRepresentation, Distance, Latitude, Long...
333
10,660
beam
learning/katas/python/Core Transforms/Combine/Combine PerKey/tests/test_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"); you may not...
40
1,354
conda
conda/plugins/subcommands/plugins/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Implementation for `conda plugins` subcommand.""" from __future__ import annotations from functools import partial from typing import TYPE_CHECKING from ... import hookimpl from ...types import CondaSubcommand from . import list if TYPE_C...
43
969
django-cms
cms/admin/__init__.py
.py
import cms.admin.pageadmin # noqa: F401 import cms.admin.permissionadmin # noqa: F401 import cms.admin.placeholderadmin # noqa: F401 import cms.admin.settingsadmin # noqa: F401 import cms.admin.useradmin # noqa: F401 # Piggyback off admin.autodiscover() to discover cms plugins from cms import plugin_pool plugin_...
11
356
textual
examples/color_command.py
.py
from dataclasses import dataclass from functools import partial from textual import on from textual._color_constants import COLOR_NAME_TO_RGB from textual.app import App, ComposeResult from textual.command import Hit, Hits, Provider from textual.message import Message from textual.widgets import Header, Static @data...
68
1,695
pyomo
scripts/admin/bwom.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...
133
4,775
saleor
saleor/graphql/core/types/upload.py
.py
import graphene class Upload(graphene.types.Scalar): class Meta: description = ( "Variables of this type must be set to null in mutations. They will be " "replaced with a filename from a following multipart part containing " "a binary file. " "See: https://g...
24
587
pyomo
pyomo/contrib/pynumero/linalg/ma27_interface.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...
139
4,935
saleor
saleor/graphql/order/tests/queries/test_order_amounts.py
.py
from decimal import Decimal import pytest from saleor.core.prices import quantize_price from ....core.utils import to_global_id_or_none from ....tests.utils import assert_no_permission, get_graphql_content ORDERS_QUERY_WITH_AMOUNT_FIELDS = """ query OrdersQuery { orders(first: 1) { edges { n...
1,235
37,989
pyomo
pyomo/contrib/interior_point/linalg/tests/test_realloc.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...
89
3,333
beam
sdks/python/apache_beam/utils/shared.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...
290
11,511
lemur
lemur/tests/test_redis.py
.py
import fakeredis import time import sys def test_write_and_read_from_redis(): function = f"{__name__}.{sys._getframe().f_code.co_name}" red = fakeredis.FakeStrictRedis() key = f"{function}.last_success" value = int(time.time()) assert red.set(key, value) is True assert (int(red.get(key)) == v...
14
334
hatch
tests/helpers/templates/new/projects_urls_empty.py
.py
from hatch.template import File from hatch.utils.fs import Path from ..licenses import MIT def get_files(**kwargs): return [ File( Path("LICENSE.txt"), MIT.replace("<year>", f"{kwargs['year']}-present", 1).replace( "<copyright holders>", f"{kwargs['author']} <{kwar...
130
3,444
hydra
tests/test_apps/app_with_runtime_config_error/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra def foo(cfg: DictConfig) -> None: cfg.foo = "bar" # does not exist in the config @hydra.main(config_path=".", config_name="config") def my_app(cfg: DictConfig) -> None: foo(cfg) if __name...
18
351
pyomo
pyomo/contrib/observer/model_observer.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,292
51,201
python-prompt-toolkit
examples/prompts/auto-suggestion.py
.py
#!/usr/bin/env python """ Simple example of a CLI that demonstrates fish-style auto suggestion. When you type some input, it will match the input against the history. If One entry of the history starts with the given input, then it will show the remaining part as a suggestion. Pressing the right arrow will insert this...
50
1,452
clearml
examples/hyperdatasets/vector_search.py
.py
""" Search HyperDataset entries using vector similarity. The script embeds either free-form text or an input file (typically an image) and executes a vector search against a HyperDataset version that already stores embeddings under the specified metadata field. Examples:: # Text query (matching qa_entries_create...
268
8,968
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/DimensionValue.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 DimensionValue(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(f...
81
2,494
sphinx
tests/roots/test-ext-autodoc/target/need_mocks.py
.py
import missing_module import missing_package1.missing_module1 import sphinx.missing_module4 from missing_module import missing_name from missing_package2 import missing_module2 from missing_package3.missing_module3 import missing_name # NoQA: F811 from sphinx.missing_module4 import missing_name2 @missing_name(int) d...
43
944
onnxruntime
onnxruntime/test/python/quantization/test_op_maxpool.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. # ---------------------------------------------------------------...
328
13,819
onnxruntime
onnxruntime/python/tools/transformers/convert_to_packing_mode.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import argparse import logging import os from constants import ( A...
386
16,419
mlflow
examples/lightgbm/lightgbm_sklearn/utils.py
.py
from mlflow.tracking import MlflowClient def yield_artifacts(run_id, path=None): """Yield all artifacts in the specified run""" client = MlflowClient() for item in client.list_artifacts(run_id, path): if item.is_dir: yield from yield_artifacts(run_id, item.path) else: ...
27
863
wagtail
setup.py
.py
import subprocess from setuptools import setup from setuptools.command.sdist import sdist as base_sdist class sdist(base_sdist): def compile_assets(self): try: subprocess.check_call(["npm", "run", "build"]) # noqa: S603, S607 - no untrusted input. Starting process from partial path is fine. ...
24
624
ipython
IPython/utils/_process_common.py
.py
"""Common utilities for the various process_* implementations. This file is only meant to be imported by the platform-specific implementations of subprocess utilities, and it contains tools that are common to all of them. """ #----------------------------------------------------------------------------- # Copyright ...
282
9,445
sqlmap
lib/request/connect.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import binascii import calendar import email.utils import inspect import io import logging import os import random import re import socket import string import struct import sys i...
1,843
96,979
openvino
src/bindings/python/src/openvino/passes/manager.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # type: ignore from openvino._pyopenvino.passes import Manager as ManagerBase from openvino._pyopenvino.passes import PassBase class Manager(ManagerBase): """Manager that additionally holds transformations ob...
27
870
gunicorn
examples/dirty_example/dirty_app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Example Dirty Application - Simulates ML Model Loading and Inference This demonstrates how to create a DirtyApp that: 1. Loads "models" at startup (init) 2. Handles requests from HTTP workers (__call__) 3. Cle...
269
8,695
clearml
clearml/storage/helper.py
.py
from __future__ import with_statement import errno import getpass import itertools import json import logging import mimetypes import os import platform import shutil import sys import threading from uuid import uuid4 from _socket import gethostname from abc import ABC, abstractmethod from collections import namedtupl...
4,805
182,728
mlflow
mlflow/pyspark/ml/__init__.py
.py
import importlib.resources import json import logging import os import traceback import weakref from collections import OrderedDict, defaultdict from itertools import zip_longest from typing import Any, NamedTuple from urllib.parse import urlparse import numpy as np import mlflow from mlflow.data.code_dataset_source ...
1,263
55,595
lemur
lemur/plugins/bases/membership.py
.py
""" .. module: lemur.plugins.bases.membership :platform: Unix :copyright: (c) 2021 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Sayali Charhate <scharhate@netflix.com> """ from lemur.plugins.base import Plugin class MembershipPlugin(Plugin): ...
29
814
wagtail
wagtail/templatetags/wagtail_cache.py
.py
from django import template from django.template import Variable from django.template.exceptions import TemplateSyntaxError from django.templatetags.cache import CacheNode as DjangoCacheNode from wagtail.models import PAGE_TEMPLATE_VAR, Site register = template.Library() class WagtailCacheNode(DjangoCacheNode): ...
99
3,230
gunicorn
tests/test_dirty_worker.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for dirty worker module.""" import asyncio import os import signal import tempfile import pytest from gunicorn.config import Config from gunicorn.dirty.worker import DirtyWorker from gunicorn.dirty.proto...
1,100
33,802
ipython
IPython/utils/decorators.py
.py
"""Decorators that don't go anywhere else. This module contains misc. decorators that don't really go with another module in :mod:`IPython.utils`. Before putting something here please see if it should go into another topical module in :mod:`IPython.utils`. """ #--------------------------------------------------------...
87
3,005
metrics
src/torchmetrics/functional/multimodal/clip_iqa.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...
351
15,942
mlflow
mlflow/utils/_capture_modules.py
.py
""" This script should be executed in a fresh python interpreter process using `subprocess`. """ import argparse import builtins import functools import importlib import json import os import sys import mlflow from mlflow.models.model import MLMODEL_FILE_NAME, Model from mlflow.pyfunc import MAIN from mlflow.utils._s...
260
10,270
openvino
tests/layer_tests/tensorflow_tests/test_tf_DepthToSpace.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 TestDepthToSpace(CommonTFLayerTest): def create_depth_to_space_net(self, input_shape, block_size, data_format): tf.compat....
34
1,375
confluent-kafka-python
src/confluent_kafka/schema_registry/_sync/schema_registry_client.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 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...
1,710
68,902
sqlmap
tests/test_hashdb.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Session storage layer (lib/utils/hashdb.py) - the on-disk SQLite cache that makes --flush-session / resume work. Exercised against a REAL temporary SQLite file (no network, no DBMS):...
154
5,728
wagtail
wagtail/users/utils.py
.py
from urllib.parse import parse_qs, urlparse, urlunparse from django.conf import settings from django.contrib.auth import get_user_model from django.utils.http import urlencode from django.utils.translation import gettext_lazy as _ from wagtail.compat import AUTH_USER_APP_LABEL, AUTH_USER_MODEL_NAME from wagtail.coreu...
127
3,646
astropy
astropy/timeseries/periodograms/lombscargle/implementations/fastchi2_impl.py
.py
from itertools import chain import numpy as np from .utils import trig_sum def lombscargle_fastchi2( t, y, dy, f0, df, Nf, normalization="standard", fit_mean=True, center_data=True, nterms=1, use_fft=True, trig_sum_kwds=None, *, algorithm="lra", ): """Lomb...
161
5,528
voila
tests/app/no_strip_sources_test.py
.py
import os import pytest BASE_DIR = os.path.dirname(__file__) @pytest.fixture def voila_args_extra(): return ["--VoilaConfiguration.strip_sources=False", "--VoilaExecutor.timeout=240"] async def test_no_strip_sources(http_server_client, base_url): response = await http_server_client.fetch(base_url) ass...
19
503
onnxruntime
orttraining/orttraining/python/training/ort_triton/kernel/_mm.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import math import os from types import ModuleType import torch from ....
484
16,310
onnxruntime
docs/python/examples/plot_load_and_predict.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """ .. _l-example-simple-usage: Load and predict with ONNX Runtime and a very simple model ========================================================== This example demonstrates how to load a model and compute the output for ...
56
1,662
wandb
tests/unit_tests/test_wandb_run.py
.py
import copy import platform import numpy as np import pytest import wandb from wandb.apis import public from wandb.sdk import wandb_run REFERENCE_ATTRIBUTES = set( [ "alert", "config", "config_static", "define_metric", "dir", "disabled", "display", "...
363
9,514
django-cms
cms/test_utils/project/pluginapp/plugins/manytomany_rel/cms_plugins.py
.py
from django.contrib import admin from django.utils.translation import gettext as _ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.test_utils.project.pluginapp.plugins.manytomany_rel.models import ( Article, ArticlePluginModel, PluginModelWithFKFromModel, Plug...
71
2,135
mlflow
mlflow/tracking/context/default_context.py
.py
import getpass import sys from mlflow.entities import SourceType from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils.credentials import read_mlflow_creds from mlflow.utils.mlflow_tags import ( MLFLOW_SOURCE_NAME, MLFLOW_SOURCE_TYPE, MLFLOW_USER, ) _DEFAULT_USER = "unk...
52
1,135
django-cms
cms/utils/compat/response.py
.py
def get_response_headers(response): """ Django 3.2+ comes with changes to the response headers and the _headers is not present in the newer versions. So this method checks if it's present in the response or not, else returns the newer attribute headers from the response. """ if hasattr(response,...
12
461
mlflow
mlflow/agno/utils.py
.py
import importlib import logging import pkgutil from agno.models.base import Model from agno.storage.base import Storage _logger = logging.getLogger(__name__) def discover_storage_backends(): # 1. Import all storage modules import agno.storage as pkg for _, modname, _ in pkgutil.iter_modules(pkg.__path_...
52
1,455
saleor
saleor/graphql/account/mutations/customer_type/customer_type_delete.py
.py
import graphene from django.core.exceptions import ValidationError from .....account import models from .....account.lock_objects import customer_type_qs_select_for_update from .....account.utils import get_default_customer_type from .....core.tracing import traced_atomic_transaction from .....permission.enums import ...
88
3,563
pdm
tests/fixtures/projects/test-plugin/setup.py
.py
from setuptools import setup setup( name="test-plugin", version="0.0.1", py_modules=["hello"], entry_points={"pdm.plugin": ["hello = hello:main"]}, )
10
168
onnxruntime
tools/ci_build/upload_python_package_to_azure_storage.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from __future__ import annotations import argparse import logging import os import subprocess import warnings log = logging.getLogger("Build") def parse_nightly_and_local_version_from_whl_name(blob_n...
91
2,915
ipython
tests/test_ipython_directive.py
.py
"""Tests for IPython.sphinxext.ipython_directive.""" import io import os import tempfile import pytest sphinx = pytest.importorskip("sphinx") from sphinx.application import Sphinx from IPython.sphinxext.ipython_directive import IPythonDirective def _build_sphinx(rst_content, builder="html", tags=None): """Buil...
139
3,155
readthedocs.org
readthedocs/projects/signals.py
.py
"""Project signals.""" from dataclasses import asdict import django.dispatch import structlog from django.db.models.signals import post_save from django.dispatch import receiver from readthedocs.integrations.models import GitHubAppIntegrationProviderData from readthedocs.integrations.models import Integration from r...
48
1,489
astropy
astropy/modeling/tests/test_mappings.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal from astropy import units as u from astropy.modeling.fitting import ( DogBoxLSQFitter, LevMarLSQFitter, LMLSQFitter, ...
206
5,905
pyomo
pyomo/contrib/fbbt/tests/test_fbbt.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,391
45,653