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
tests/genai/optimize/optimizers/test_gepa_optimizer.py
.py
import json import sys from pathlib import Path from typing import Any from unittest.mock import MagicMock, Mock, patch import pytest import mlflow from mlflow.genai.optimize.optimizers.gepa_optimizer import GepaPromptOptimizer from mlflow.genai.optimize.types import EvaluationResultRecord, PromptOptimizerOutput @p...
662
23,380
pyro
tests/distributions/test_conjugate_update.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro.distributions as dist from tests.common import assert_close @pytest.mark.parametrize("sample_shape", [(), (4,), (3, 2)], ids=str) @pytest.mark.parametrize("batch_shape", [(), (4,), (3, 2)], ids...
57
2,061
django-cms
cms/tests/test_staticfiles.py
.py
import copy import json import os import re import shutil import tempfile from io import StringIO from django.conf import settings from django.core.management import call_command from django.template import Context, Template from django.test import SimpleTestCase, override_settings import cms MANIFEST_BACKEND = "dja...
119
4,601
saleor
saleor/graphql/product/tests/mutations/test_collection_update.py
.py
from unittest.mock import MagicMock, Mock, patch import graphene import pytest from django.core.files import File from .....product.error_codes import ProductErrorCode from .....product.models import Collection from .....product.tests.utils import create_image, create_zip_file_with_image_ext from .....tests.utils imp...
524
15,807
coremltools
coremltools/test/optimize/__init__.py
.py
# Copyright (c) 2023, 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
4
217
wandb
wandb/proto/wandb_telemetry_pb2.py
.py
import google.protobuf protobuf_version = google.protobuf.__version__[0] if protobuf_version == "5": from wandb.proto.v5.wandb_telemetry_pb2 import * elif protobuf_version == "6": from wandb.proto.v6.wandb_telemetry_pb2 import * elif protobuf_version == "7": from wandb.proto.v7.wandb_telemetry_pb2 import ...
11
322
pyomo
pyomo/gdp/plugins/bigm_mixin.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...
283
10,495
astropy
astropy/coordinates/transformations/affine.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Affine coordinate transformations.""" from abc import abstractmethod import numpy as np from astropy.coordinates.representation import ( CartesianDifferential, RadialDifferential, SphericalCosLatDifferential, SphericalDifferential, ...
353
14,187
astropy
astropy/coordinates/funcs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains convenience functions for coordinate-related functionality. This is generally just wrapping around the object-oriented coordinates framework, but it is useful for some users who are used to more functional interfaces. """ import...
416
14,755
sqlmap
lib/controller/action.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.controller.handler import setHandler from lib.core.common import Backend from lib.core.common import Format from lib.core.common import hashDBWrite from lib.core.data imp...
296
10,692
mlflow
tests/semantic_kernel/conftest.py
.py
import importlib import openai import pytest import pytest_asyncio from opentelemetry import trace as trace_api from opentelemetry.util._once import Once from tests.helper_functions import start_mock_openai_server from tests.tracing.helper import ( reset_autolog_state, # noqa: F401 ) @pytest.fixture(autouse=Tr...
35
863
readthedocs.org
readthedocs/builds/utils.py
.py
"""Utilities for the builds app.""" from contextlib import contextmanager from time import monotonic from django.core.cache import cache from readthedocs.builds.constants import EXTERNAL from readthedocs.builds.constants import GENERIC_EXTERNAL_VERSION_NAME from readthedocs.builds.constants import GITHUB_EXTERNAL_VE...
119
3,962
toolz
toolz/tests/test_package.py
.py
import toolz def test_has_version(): # If this test fails, then toolz probably isn't installed properly. # For local development, try `pip install -e .` from the project directory. version = toolz.__version__ assert isinstance(version, str) assert version.startswith("1.")
10
295
wandb
tests/unit_tests/test_lib/test_auth_host_url.py
.py
import pytest from wandb.sdk.lib.wbauth.host_url import HostUrl def test_validates_url(): with pytest.raises(ValueError): HostUrl("invalid") @pytest.mark.parametrize( "raw_url", ( "https://api.wandb.ai", "https://api.wandb.ai/", "https://api.wandb.ai//", ), ) def test...
46
989
readthedocs.org
readthedocs/embed/utils.py
.py
"""Embed utils.""" from urllib.parse import urlparse from pyquery import PyQuery as PQ # noqa def recurse_while_none(element): """Recursively find the leaf node with the ``href`` attribute.""" if element.text is None and element.getchildren(): return recurse_while_none(element.getchildren()[0]) ...
76
2,629
scikit-bio
skbio/diversity/__init__.py
.py
r"""Community Diversity (:mod:`skbio.diversity`) ============================================ .. currentmodule:: skbio.diversity This module provides functionality for analyzing biodiversity of communities -- groups of organisms living in the same area. It implements various metrics of **alpha** (*within*-community) ...
474
18,454
beam
sdks/python/apache_beam/ml/gcp/videointelligenceml_test_it.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...
78
2,827
biopython
Scripts/query_pubmed.py
.py
#!/usr/bin/env python # Copyright 2000 by Jeffrey Chang. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Query PubMed and print MEDLINE format results.""" import getopt imp...
90
2,452
mlflow
dev/clint/tests/rules/test_os_environ_set_in_test.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules.os_environ_set_in_test import OsEnvironSetInTest def test_os_environ_set_in_test(index: SymbolIndex) -> None: code = """ import os # Bad def test_func...
26
714
saleor
saleor/permission/tests/fixtures/permission.py
.py
import pytest from ...models import Permission @pytest.fixture def permission_manage_discounts(): return Permission.objects.get(codename="manage_discounts") @pytest.fixture def permission_manage_gift_card(): return Permission.objects.get(codename="manage_gift_card") @pytest.fixture def permission_manage_...
134
3,116
sqlmap
plugins/dbms/postgresql/__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 PGSQL_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.postgresql.enumeration import Enumeration...
37
1,303
python-prompt-toolkit
src/prompt_toolkit/selection.py
.py
""" Data structures for the selection. """ from __future__ import annotations from enum import Enum __all__ = [ "SelectionType", "PasteMode", "SelectionState", ] class SelectionType(Enum): """ Type of selection. """ #: Characters. (Visual in Vi.) CHARACTERS = "CHARACTERS" #: W...
59
1,274
textual
tests/text_area/test_messages.py
.py
from typing import List from textual import on from textual.app import App, ComposeResult from textual.events import Event from textual.message import Message from textual.widgets import TextArea class TextAreaApp(App): def __init__(self): super().__init__() self.messages = [] @on(TextArea.C...
105
3,152
biopython
Bio/Restriction/PrintFormat.py
.py
#!/usr/bin/env python # # Restriction Analysis Libraries. # Copyright (C) 2004. Frederic Sohm. # # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # r"""Print the results of restriction enzyme...
486
16,232
python-prompt-toolkit
examples/full-screen/simple-demos/vertical-align.py
.py
#!/usr/bin/env python """ Vertical align demo with VSplit. """ from prompt_toolkit.application import Application from prompt_toolkit.formatted_text import HTML from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout.containers import ( HSplit, VerticalAlign, VSplit, Window, W...
169
5,483
pyfilesystem2
fs/mirror.py
.py
"""Function for *mirroring* a filesystem. Mirroring will create a copy of a source filesystem on a destination filesystem. If there are no files on the destination, then mirroring is simply a straight copy. If there are any files or directories on the destination they may be deleted or modified to match the source. I...
159
5,363
mlflow
dev/clint/tests/rules/test_test_name_typo.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules.test_name_typo import TestNameTypo def test_test_name_typo(index: SymbolIndex) -> None: code = """import pytest # Bad - starts with 'test' but missing...
38
992
django-cms
cms/tests/test_admin.py
.py
import json from django.conf import settings from django.contrib import admin from django.contrib.admin.sites import site from django.contrib.admin.utils import flatten_fieldsets from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.contrib.sites.models import Sit...
1,428
60,360
openvino
tests/e2e_tests/common/sys_info_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # pylint: disable=logging-fstring-interpolation,fixme """ Functions for getting system information. """ import os import sys import contextlib import logging import multiprocessing import pathlib import platform import re import subpro...
435
14,818
pyomo
pyomo/gdp/plugins/bigm.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...
530
21,669
wandb
tests/system_tests/test_functional/console_capture/removes_callback_on_error.py
.py
"""Exits with code 0 if callbacks are removed after raising an exception.""" import sys from wandb.sdk.lib import console_capture num_calls = 0 def count_and_interrupt(*unused) -> None: global num_calls num_calls += 1 raise KeyboardInterrupt if __name__ == "__main__": console_capture.capture_std...
39
961
astropy
astropy/constants/config.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Configures the codata and iaudata used, possibly using user configuration. """ # Note: doing this in __init__ causes import problems with units, # as si.py and cgs.py have to import the result. import importlib import astropy phys_version = astropy....
17
549
sqlmap
tamper/appendnullbyte.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os from lib.core.common import singleTimeWarnMessage from lib.core.enums import DBMS from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOWEST def dependencies(...
38
1,002
pyro
pyro/contrib/funsor/handlers/__init__.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from pyro.poutine import ( # noqa: F401 block, condition, do, escape, infer_config, mask, reparam, scale, seed, uncondition, ) from pyro.poutine.handlers import _make_handler from .enum_messeng...
60
1,408
onnx
onnx/reference/ops/aionnxml/op_scaler.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl class Scaler(OpRunAiOnnxMl): def _run(self, x, offset=None, scale=None): dx = x - offset return ((dx * scale)....
13
338
probability
tensorflow_probability/python/experimental/auto_batching/dsl.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...
836
30,093
saleor
saleor/graphql/giftcard/bulk_mutations/__init__.py
.py
from .gift_card_bulk_activate import GiftCardBulkActivate from .gift_card_bulk_create import GiftCardBulkCreate from .gift_card_bulk_deactivate import GiftCardBulkDeactivate from .gift_card_bulk_delete import GiftCardBulkDelete __all__ = [ "GiftCardBulkActivate", "GiftCardBulkCreate", "GiftCardBulkDeactiva...
12
353
textual
docs/examples/how-to/center08.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static class CenterApp(App): """How to center things.""" CSS = """ .words { background: blue 50%; border: wide white; width: auto; } """ def compose(self) -> ComposeResult: yield Static("Ho...
24
475
owasp-mstg
src/scripts/testcase_diff.py
.py
import yaml def main(): import argparse parser = argparse.ArgumentParser(description="Diff the MASTG test cases covered.") parser.add_argument("-o", "--old", required=True) parser.add_argument("-n", "--new", required=True) args = parser.parse_args() MASVS_OLD = yaml.safe_load(open(args.old))...
46
1,328
mlflow
mlflow/genai/mcp_tool_discovery.py
.py
"""Client-side MCP tool discovery helpers.""" from __future__ import annotations import asyncio import logging import threading from typing import Any, Mapping from mlflow.entities.mcp_server import MCPRemoteTransportType, MCPTool from mlflow.environment_variables import MLFLOW_ENABLE_MCP_TOOL_DISCOVERY from mlflow....
241
8,622
mlflow
tests/simple_repository_server.py
.py
"""PEP 700-compliant Simple Repository API server for serving wheels in tests. This replaces the plain ``http.server`` approach so that uv's ``exclude-newer`` can filter packages by upload time when resolving the local dev wheel. """ from __future__ import annotations import hashlib import json import threading from...
125
4,427
textual
docs/examples/guide/layout/utility_containers_using_with.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical from textual.widgets import Static class UtilityContainersExample(App): CSS_PATH = "utility_containers.tcss" def compose(self) -> ComposeResult: with Horizontal(): with Vertical(classes="column"...
22
595
openvino
tests/layer_tests/pytorch_tests/test_norm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest # torch._VF.frobenius_norm is deprecated in PyTorch 2.9 in favour of linalg.vector_norm....
470
20,062
saleor
saleor/graphql/app/tests/mutations/test_app_activate.py
.py
import json from unittest import mock import graphene from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....app.error_codes import AppErrorCode from .....app.models import App from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import ...
256
6,593
readthedocs.org
readthedocs/core/tests/test_user_admin_actions.py
.py
from unittest.mock import patch import django_dynamic_fixture as fixture from django import urls from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.auth.models import User from django.test import TestCase class UserAdminActionsTest(TestCase): @classmethod def setUpTestData(cls)...
33
1,037
jupytext
tests/functional/simple_notebooks/test_read_simple_hydrogen.py
.py
import jupytext from jupytext.compare import compare def test_read_simple_file( script="""# --- # title: Simple file # --- # %% [markdown] # This is a markdown cell # %% [raw] # This is a raw cell # %%% sub-cell title # This is a sub-cell # %%%% sub-sub-cell title # This is a sub-sub-cell # %% And now a code...
191
3,695
beam
sdks/python/apache_beam/ml/anomaly/aggregations.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...
324
12,232
onnxruntime
plugin-ep-cuda/csharp/pack_nuget.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Build the Microsoft.ML.OnnxRuntime.EP.Cuda NuGet package. Stages native binaries from build artifacts into the runtimes/ layout expected by the .csproj and runs `dotnet pack` to produce the .nupkg / ...
371
13,927
bazel
tools/compliance/write_sbom.py
.py
# Copyright 2023 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
242
7,134
pynacl
src/nacl/public.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # 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...
418
14,643
beam
sdks/python/apache_beam/examples/inference/tensorrt_text_classification.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...
127
4,263
pyro
pyro/infer/mcmc/logger.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import json import logging import os import sys from collections import OrderedDict from tqdm import tqdm from tqdm.auto import tqdm as tqdm_nb try: get_ipython ipython_env = True except NameError: ipython_env = False...
276
9,270
hydra
tools/configen/tests/test_modules/__init__.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Tuple, Union from omegaconf import MISSING class Color(Enum): RED = 0 GREEN = 1 BLUE = 2 @dataclass class User: name: str = ...
216
5,316
textual
tests/input/test_input_terminal_cursor.py
.py
from textual.app import App, ComposeResult from textual.geometry import Offset from textual.widgets import Input class InputApp(App): # Apply padding to ensure gutter accounted for. CSS = "Input { padding: 4 8 }" def compose(self) -> ComposeResult: # We don't want to select the text on focus, as ...
31
1,053
openvino
tests/layer_tests/pytorch_tests/test_tile.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestTile(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224, 224),) def create_model(self, dims): import ...
33
911
saleor
saleor/graphql/giftcard/tests/mutations/test_gift_card_delete.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...
140
3,863
scikit-optimize
benchmarks/bench_branin.py
.py
import numpy as np import argparse from skopt.benchmarks import branin from skopt import gp_minimize from skopt import forest_minimize from skopt import gbrt_minimize from skopt import dummy_minimize def run(n_calls=200, n_runs=10, acq_optimizer="lbfgs"): bounds = [(-5.0, 10.0), (0.0, 15.0)] optimizers = [("g...
67
2,586
beam
examples/notebooks/beam-ml/rag_usecase/opensearch_enrichment.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...
135
4,750
mlflow
tests/server/test_mcp_server_api.py
.py
from __future__ import annotations from pathlib import Path from types import SimpleNamespace from typing import Any from unittest import mock from urllib.parse import quote import pytest from fastapi import FastAPI from starlette.testclient import TestClient from mlflow.entities.mcp_server import MCPTool from mlflo...
1,947
69,601
python-prompt-toolkit
src/prompt_toolkit/key_binding/__init__.py
.py
from __future__ import annotations from .key_bindings import ( ConditionalKeyBindings, DynamicKeyBindings, KeyBindings, KeyBindingsBase, merge_key_bindings, ) from .key_processor import KeyPress, KeyPressEvent __all__ = [ # key_bindings. "ConditionalKeyBindings", "DynamicKeyBindings", ...
23
447
pyomo
pyomo/contrib/fme/tests/test_fourier_motzkin_elimination.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...
955
38,439
django-cms
cms/tests/test_mail.py
.py
from django.contrib.auth import get_user_model from django.core import mail from cms.api import create_page_user from cms.test_utils.testcases import CMSTestCase from cms.utils.mail import mail_page_user_change class MailTestCase(CMSTestCase): def setUp(self): mail.outbox = [] # reset outbox def te...
18
602
onnxruntime
onnxruntime/python/tools/quantization/neural_compressor/weight_only.py
.py
# # The implementation of this file is based on: # https://github.com/intel/neural-compressor/tree/master/neural_compressor # # Copyright (c) 2023 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 ...
933
36,295
saleor
saleor/order/tests/test_fetch_order_prices_line_price_expiration.py
.py
from datetime import timedelta from decimal import Decimal import graphene import pytest from django.utils import timezone from ...core.prices import quantize_price from ...core.taxes import zero_money from ...discount import DiscountType, DiscountValueType, RewardValueType, VoucherType from ...discount.models import...
1,755
74,630
toolz
toolz/tests/test_serialization.py
.py
from toolz import * import toolz import toolz.curried import pickle from toolz.utils import raises def test_compose(): f = compose(str, sum) g = pickle.loads(pickle.dumps(f)) assert f((1, 2)) == g((1, 2)) def test_curry(): f = curry(map)(str) g = pickle.loads(pickle.dumps(f)) assert list(f((...
193
5,759
wagtail
wagtail/images/edit_handlers.py
.py
from django.template.loader import render_to_string from wagtail.admin.compare import ForeignObjectComparison class ImageFieldComparison(ForeignObjectComparison): def htmldiff(self): image_a, image_b = self.get_objects() return render_to_string( "wagtailimages/widgets/compare.html", ...
17
431
probability
tensorflow_probability/python/experimental/math/manual_special_functions.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...
382
10,779
mlflow
mlflow/projects/backend/abstract_backend.py
.py
from abc import ABCMeta, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class AbstractBackend: """ Abstract plugin class defining the interface needed to execute MLflow projects. You can define subclasses of ``AbstractBackend`` and expose them as third-party plugin...
51
2,113
wagtail
wagtail/admin/views/reports/page_types_usage.py
.py
import django_filters import swapper from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.db.models import Count, F, OuterRef, Q, Subquery from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ from wagtail.admin.fil...
159
5,637
conda
tests/cli/test_env.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import json import re from pathlib import Path from typing import TYPE_CHECKING from uuid import uuid4 import pytest from conda.base.constants import PREFIX_MAGIC_FILE from conda.base.context import context ...
762
23,911
metrics
src/torchmetrics/classification/specificity_sensitivity.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...
376
18,811
mlflow
mlflow/entities/input_tag.py
.py
from mlflow.entities._mlflow_object import _MlflowObject from mlflow.protos.service_pb2 import InputTag as ProtoInputTag class InputTag(_MlflowObject): """Input tag object associated with a dataset.""" def __init__(self, key: str, value: str) -> None: self._key = key self._value = value ...
36
928
colorama
colorama/tests/winterm_test.py
.py
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import sys from unittest import TestCase, main, skipUnless from unittest.mock import Mock, patch from ..winterm import WinColor, WinStyle, WinTerm class WinTermTest(TestCase): @patch('colorama.winterm.win32') def testInit(self, mockW...
128
3,646
clearml
clearml/backend_api/services/v2_9/organization.py
.py
""" organization service This service provides organization level operations """ from typing import List, Optional, Any import six from ....backend_api.session import Request, Response, schema_property class GetTagsRequest(Request): """ Get all the user and system tags used for the company tasks and models ...
149
5,219
beam
sdks/python/apache_beam/yaml/examples/transforms/ml/log_analysis/train.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...
90
2,496
pymc
pymc/dims/math.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...
16
685
readthedocs.org
readthedocs/proxito/views/mixins.py
.py
import mimetypes from urllib.parse import parse_qsl from urllib.parse import urlencode from urllib.parse import urlparse import structlog from django.conf import settings from django.core.exceptions import BadRequest from django.http import HttpResponse from django.http import HttpResponsePermanentRedirect from django...
410
16,101
bazel
tools/jdk/proguard_allowlister_test.py
.py
# Copyright 2015 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
73
2,767
mlflow
dev/clint/src/clint/rules/prefer_next.py
.py
import ast from clint.rules.base import Rule class PreferNext(Rule): def _message(self) -> str: return ( "Use `next(x for x in items if condition)` instead of " "`[x for x in items if condition][0]` for finding the first matching element." ) @staticmethod def chec...
37
1,159
loguru
tests/exceptions/source/ownership/assertion_from_local.py
.py
import sys import _init from somelib import assertionerror from loguru import logger def test(*, backtrace, colorize, diagnose): logger.remove() logger.add(sys.stderr, format="", colorize=colorize, backtrace=backtrace, diagnose=diagnose) try: a, b = 1, 2 assert a == b except Asserti...
25
622
metrics
src/torchmetrics/functional/detection/diou.py
.py
# Copyright The PyTorch 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 i...
128
4,914
probability
tensorflow_probability/python/math/psd_kernels/__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...
67
3,409
saleor
saleor/graphql/app/tests/mutations/test_app_token_create.py
.py
import graphene from .....app.error_codes import AppErrorCode from .....app.models import App from ....tests.utils import assert_no_permission, get_graphql_content APP_TOKEN_CREATE_MUTATION = """ mutation appTokenCreate($input: AppTokenInput!) { appTokenCreate(input: $input){ authToken appToken{ name ...
222
6,623
astropy
astropy/modeling/tests/test_compound.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name, pointless-statement import pickle import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal import astropy.units as u from astropy.modeling.core import CompoundModel, Model, ModelDefin...
1,316
40,190
sqlmap
tests/test_inference_engine.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission The blind-SQLi extraction engine (lib/techniques/blind/inference.py bisection). This is the actual algorithm that pulls data out one character at a time over a boolean/blind oracle -...
214
9,741
textual
src/textual/drivers/win32.py
.py
from __future__ import annotations import ctypes import msvcrt import sys import threading from asyncio import AbstractEventLoop, run_coroutine_threadsafe from ctypes import Structure, Union, byref, wintypes from ctypes.wintypes import BOOL, CHAR, DWORD, HANDLE, SHORT, UINT, WCHAR, WORD from typing import IO, TYPE_CHE...
305
9,697
mlflow
mlflow/h2o/__init__.py
.py
""" The ``mlflow.h2o`` module provides an API for logging and loading H2O models. This module exports H2O models with the following flavors: H20 (native) format This is the main flavor that can be loaded back into H2O. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfunc-based deployment tools and batch ...
378
12,679
wagtail
wagtail/admin/rich_text/converters/contentstate_models.py
.py
import json import random import string ALPHANUM = string.ascii_lowercase + string.digits class Block: def __init__(self, typ, depth=0, key=None): self.type = typ self.depth = depth self.text = "" self.key = key if key else "".join(random.choice(ALPHANUM) for _ in range(5)) # noq...
94
2,357
rq
tests/test_decorator.py
.py
from unittest import mock from rq.decorators import job from rq.job import Job, Retry from rq.queue import Queue from rq.webhook import Webhook from rq.worker import DEFAULT_RESULT_TTL from tests import RQTestCase class TestDecorator(RQTestCase): def setUp(self): super().setUp() @job(queue='defa...
274
9,379
cvxpy
cvxpy/tests/nlp_tests/test_Sharpe_ratio.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 ...
61
2,214
saleor
saleor/tests/e2e/orders/utils/__init__.py
.py
from .draft_order_bulk_delete import draft_order_bulk_delete from .draft_order_complete import draft_order_complete, raw_draft_order_complete from .draft_order_create import draft_order_create from .draft_order_delete import draft_order_delete from .draft_order_update import draft_order_update, raw_draft_order_update f...
57
2,042
saleor
saleor/graphql/page/tests/mutations/test_page_type_create.py
.py
import json from unittest import mock import graphene from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....page.error_codes import PageErrorCode from .....page.models import PageType from .....webhook.event_types...
354
10,099
sqlmap
plugins/dbms/sqlite/enumeration.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.data import logger from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.enumeration import Enumeration as GenericEnumeration class ...
70
2,053
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/geo_mean_canon.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...
37
1,246
luigi
luigi/scheduler.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...
1,674
65,972
wandb
tests/unit_tests/test_artifacts/test_references_s3.py
.py
from __future__ import annotations import hashlib from typing import TYPE_CHECKING import boto3 from moto import mock_aws from pytest import MonkeyPatch, fixture, mark, raises from wandb import Artifact if TYPE_CHECKING: from collections.abc import Iterator from botocore.client import BaseClient @fixture ...
288
8,414
pyro
pyro/distributions/util.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import copy import ctypes import functools import numbers import weakref from contextlib import contextmanager import torch import torch.distributions as torch_dist from torch import logsumexp from torch.distributions.utils import...
362
11,913
wagtail
wagtail/api/v3/routers/schema.py
.py
from typing import Any from django.http import Http404, HttpRequest from ninja import Router, Schema from wagtail.api.v3.auth import BearerTokenAuth from wagtail.api.v3.registry import registry from wagtail.api.v3.schemas import ContentTypeSummarySchema router = Router(tags=["schema"], auth=BearerTokenAuth()) clas...
46
1,215
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vscode_folding_markers/nteract_with_parameter.py
.py
# --- # jupyter: # jupytext: # cell_markers: region,endregion # kernel_info: # name: python3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # region inputHidden=false outputHidden=false tags=["parameters"] param = 4 # endregion # region inputHidden=false outp...
31
641
openvino
tests/layer_tests/pytorch_tests/test_unsqueeze.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestUnsqueeze(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(5, 10),) def create_model(self, inplace=Fa...
111
3,708