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
coremltools
coremltools/test/__init__.py
.py
# Copyright (c) 2020, 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
5
218
clearml
clearml/automation/hpbandster/__init__.py
.py
from .bandster import OptimizerBOHB __all__ = ["OptimizerBOHB"]
4
65
biopython
Bio/motifs/thresholds.py
.py
# Copyright 2008 by Norbert Dojer. All rights reserved. # Adapted by Bartek Wilczynski. # 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. """Approximate calculation of appropriate thresholds for motif ...
110
4,530
hatch
src/hatch/project/constants.py
.py
BUILD_BACKEND = "hatchling.build" DEFAULT_BUILD_DIRECTORY = "dist" DEFAULT_BUILD_SCRIPT = "hatch_build.py" DEFAULT_CONFIG_FILE = "hatch.toml" class BuildEnvVars: REQUESTED_TARGETS = "HATCH_BUILD_REQUESTED_TARGETS" LOCATION = "HATCH_BUILD_LOCATION" HOOKS_ONLY = "HATCH_BUILD_HOOKS_ONLY" NO_HOOKS = "HATC...
16
524
mlflow
mlflow/gateway/providers/sap_ai_core.py
.py
"""SAP AI Core Orchestration v2 provider for MLflow Gateway. URI scheme: ``sap-ai-core:/<model-name>`` The model name is embedded in the Orchestration v2 request body under ``config.modules.prompt_templating.model.name``. Auth is not handled here — requests are routed through an HTTP egress gateway (``http://`` sche...
173
6,334
openvino
tests/layer_tests/tensorflow_tests/test_tf_Slice.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 TestSlice(CommonTFLayerTest): def create_slice_net(self, input_shape, input_type, begin_value, size_value): tf.compat.v1.r...
36
1,451
lemur
lemur/sources/models.py
.py
""" .. module: lemur.sources.models :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sqlalchemy.orm import relationship from sqlalchemy import Column, Integer, String, Te...
34
1,025
pyomo
pyomo/contrib/mindtpy/tests/feasibility_pump2.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...
58
1,866
mlflow
tests/entities/test_run_data.py
.py
from mlflow.entities import RunData def _check_metrics(metric_objs, metrics_dict, expected_metrics): assert {m.key for m in metric_objs} == {m.key for m in expected_metrics} assert {m.value for m in metric_objs} == {m.value for m in expected_metrics} assert {m.timestamp for m in metric_objs} == {m.timesta...
40
1,414
ipython
tests/test_text.py
.py
# encoding: utf-8 """Tests for IPython.utils.text""" # ----------------------------------------------------------------------------- # Copyright (C) 2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software...
152
4,314
wandb
tests/system_tests/test_functional/conftest.py
.py
import pathlib import runpy from typing import Any from unittest import mock import pytest @pytest.fixture def execute_script(): # Define a helper function that will take in the script path and command-line arguments def helper(train_script_path: pathlib.Path, *args: Any) -> None: # sys_argv simulate...
27
1,113
openvino
docs/articles_en/assets/snippets/ov_auto.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # #! [py_ov_property_import_header] import openvino as ov import openvino.properties as properties import openvino.properties.device as device import openvino.properties.hint as hints import openvino.properties.streams as streams import ...
195
5,441
metrics
tests/unittests/image/test_kid.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...
223
8,450
pyomo
pyomo/contrib/parmest/utils/scenario_tree.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...
125
4,709
saleor
saleor/discount/utils/checkout.py
.py
import datetime from typing import TYPE_CHECKING from django.conf import settings from django.db import transaction from ...checkout.base_calculations import ( base_checkout_delivery_price, base_checkout_subtotal, ) from ...checkout.models import Checkout from ...core.db.connection import allow_writer from .....
329
11,737
pyomo
examples/pyomobook/dae-ch/run_path_constraint_tester.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...
33
1,002
textual
docs/examples/themes/todo_app.py
.py
from itertools import cycle from textual.app import App, ComposeResult from textual.binding import Binding from textual.containers import Horizontal, Vertical from textual.widgets import Footer, Header, Input, Label, SelectionList class TodoList(App[None]): CSS = """ Screen { align: center middle; hatch:...
97
2,176
saleor
saleor/graphql/payment/tests/queries/test_transactions_sorting.py
.py
from datetime import timedelta import pytest from django.utils import timezone from .....payment.models import TransactionItem from ....tests.utils import get_graphql_content from ...sorters import TransactionSortField TRANSACTIONS_SORT_QUERY = """ query Transactions($sortBy: TransactionSortingInput){ tr...
157
4,745
mlflow
mlflow/genai/scorers/ragas/scorers/__init__.py
.py
from __future__ import annotations from typing import ClassVar from mlflow.genai.judges.builtin import _MODEL_API_DOC from mlflow.genai.scorers.ragas import RagasScorer from mlflow.genai.scorers.ragas.scorers.agentic_metrics import ( AgentGoalAccuracyWithoutReference, AgentGoalAccuracyWithReference, ToolC...
322
9,441
mlflow
tests/db/conftest.py
.py
import pytest from mlflow.environment_variables import MLFLOW_TRACKING_URI @pytest.fixture(autouse=True) def use_sqlite_if_tracking_uri_env_var_is_not_set(tmp_path, monkeypatch): if not MLFLOW_TRACKING_URI.defined: sqlite_file = tmp_path / "mlruns.sqlite" monkeypatch.setenv(MLFLOW_TRACKING_URI.na...
11
352
readthedocs.org
readthedocs/builds/tasks.py
.py
import json import requests import structlog from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.cache import cache from django.urls import reverse from django.utils import timezone from django.utils.translation import gettext_lazy as _ from oauthlib.oauth2.rfc6...
794
29,179
metrics
tests/unittests/utilities/test_utilities.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...
267
10,504
saleor
saleor/tests/e2e/orders/test_order_void_once_voided_payment.py
.py
import pytest from ..checkout.utils import ( checkout_complete, checkout_create, checkout_delivery_method_update, raw_checkout_dummy_payment_create, ) from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_pe...
126
3,310
saleor
saleor/graphql/tax/enums.py
.py
from typing import Final import graphene from ...tax import ( TaxableObjectDiscountType, ) from ...tax import ( TaxCalculationStrategy as InternalTaxCalculationStrategy, ) from ..core.doc_category import DOC_CATEGORY_TAXES from ..core.enums import to_enum def description(enum): if enum == InternalTaxCal...
36
1,018
saleor
saleor/graphql/discount/mutations/promotion/promotion_delete.py
.py
import graphene from django.db import transaction from .....discount import models from .....graphql.core.mutations import ModelDeleteMutation from .....permission.enums import DiscountPermissions from .....product.utils.product import ( get_channel_to_products_map_from_rules, mark_products_in_channels_as_dirt...
63
2,250
textual
tests/snapshot_tests/snapshot_apps/directory_tree_reload.py
.py
from pathlib import Path from textual.app import App, ComposeResult from textual.widgets import DirectoryTree class DirectoryTreeReloadApp(App[None]): BINDINGS = [ ("r", "reload"), ("e", "expand"), ("d", "delete"), ] async def setup(self, path_root: Path) -> None: self.pa...
59
1,603
hydra
tests/test_apps/simple_app/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig, OmegaConf import hydra @hydra.main() def my_app(cfg: DictConfig) -> None: print(OmegaConf.to_yaml(cfg, resolve=True)) if __name__ == "__main__": my_app()
14
272
beam
sdks/python/apache_beam/runners/dataflow/dataflow_exercise_metrics_pipeline_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...
57
2,045
wagtail
wagtail/contrib/search_promotions/tests.py
.py
import json from datetime import date, datetime, timedelta from io import BytesIO, StringIO from django.contrib.auth.models import Permission from django.core import management from django.db.models import F from django.test import TestCase from django.urls import reverse from django.utils import timezone from openpyx...
1,792
69,615
hydra
tests/standalone_apps/namespace_pkg_config_source_test/namespace_test/test_namespace.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from pytest import mark, param from hydra import initialize from hydra._internal.core_plugins.importlib_resources_config_source import ( ImportlibResourcesConfigSource, ) from hydra.core.global_hydra import GlobalHydra from hydra.test_utils.con...
38
1,317
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineperkey_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");...
65
1,877
mlflow
tests/tracing/export/test_mlflow_v3_exporter.py
.py
import json import os import threading import time from concurrent.futures import ThreadPoolExecutor from unittest import mock import pytest from google.protobuf.json_format import ParseDict import mlflow from mlflow.entities import LiveSpan from mlflow.entities.model_registry import PromptVersion from mlflow.entitie...
1,137
45,342
beam
learning/katas/python/Core Transforms/Map/ParDo OneToMany/task.py
.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); y...
46
1,432
python-prompt-toolkit
examples/prompts/auto-completion/autocompletion-like-readline.py
.py
#!/usr/bin/env python """ Autocompletion example that displays the autocompletions like readline does by binding a custom handler to the Tab key. """ from prompt_toolkit.completion import WordCompleter from prompt_toolkit.shortcuts import CompleteStyle, prompt animal_completer = WordCompleter( [ "alligato...
60
1,121
pyomo
pyomo/solvers/plugins/solvers/cuopt_direct.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...
443
18,287
onnx
onnx/backend/test/case/node/if_.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 def compute_if_outputs(x, cond): if cond: return [] return x...
211
6,475
saleor
saleor/graphql/product/mutations/channels.py
.py
import datetime from collections import defaultdict from typing import TYPE_CHECKING import graphene from django.core.exceptions import ValidationError from django.db.utils import IntegrityError from ....core.tracing import traced_atomic_transaction from ....core.utils.date_time import convert_to_utc_date_time from ....
684
27,299
confluent-kafka-python
tests/test_serializer_error.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from confluent_kafka.avro.serializer import SerializerError class SerializerErrorTest(unittest.TestCase): def test_message(self): try: raise SerializerError("message") except SerializerError as e: assert e.mess...
15
337
luigi
test/range_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
1,657
63,740
onnx
onnx/reference/ops/op_random_uniform_like.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.helper import np_dtype_to_tensor_dtype from onnx.reference.ops._op_common_random import _CommonRandom class RandomUniformLike(_CommonRandom): def _run(self, x, dtype=None, high=None, low=...
20
630
mlflow
tests/pydantic_ai/test_pydanticai_fluent_tracing.py
.py
import importlib.metadata from contextlib import asynccontextmanager from unittest.mock import patch import pytest from packaging.version import Version PYDANTIC_AI_VERSION = Version(importlib.metadata.version("pydantic_ai")) if PYDANTIC_AI_VERSION.major >= 2: pytest.skip("Pydantic AI 1.x fluent tracing tests", a...
461
16,129
onnx
onnx/reference/ops/_op_common_indices.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np def _get_indices(i, shape): res = np.empty((len(shape),), dtype=np.int64) k = len(shape) - 1 while k > 0: m = i % shape[k] res[k] = m i -= m ...
38
746
jupyterlab
examples/app/main.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json import os from jupyterlab_server import LabServerApp HERE = os.path.dirname(__file__) # Turn off the Jupyter configuration system so configuration files on disk do # not affect this app. This helps this ...
46
1,478
pdm
src/pdm/cli/commands/search.py
.py
from __future__ import annotations import argparse import textwrap from pdm import termui from pdm._types import SearchResults from pdm.cli.commands.base import BaseCommand from pdm.cli.options import verbose_option from pdm.models.working_set import WorkingSet from pdm.project import Project from pdm.utils import no...
58
1,974
conda
tests/cli/test_all_commands.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ This testing module is for tests which test multiple commands under the same circumstance. """ from __future__ import annotations import re import warnings from argparse import ArgumentParser from typing import TYPE_CHECKING import pytest...
127
3,785
astropy
astropy/units/format/ogip_lextab.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/units # # You can then commit the changes...
21
1,685
conda
conda/testing/gateways/fixtures.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Collection of pytest fixtures used in conda.gateways tests.""" import os import socket from pathlib import Path from shutil import which import pytest from xprocess import ProcessStarter from ...common.serialize import json MINIO_EXE = wh...
132
4,383
saleor
saleor/csv/utils/products_data.py
.py
from collections import defaultdict from dataclasses import dataclass from typing import TYPE_CHECKING from urllib.parse import urljoin import graphene from django.conf import settings from django.db.models import Case, CharField, Exists, OuterRef, When from django.db.models import Value as V from django.db.models.fun...
585
19,162
pdm
src/pdm/formats/pipfile.py
.py
from __future__ import annotations import functools import operator import os from typing import TYPE_CHECKING, Any from packaging.markers import default_environment from pdm.compat import tomllib from pdm.formats.base import make_array from pdm.models.markers import Marker, get_marker from pdm.models.requirements i...
78
2,710
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/OpIdKernelTypeStrArgsEntry.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 OpIdKernelTypeStrArgsEntry(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers....
92
3,296
mlflow
mlflow/tracing/utils/environment.py
.py
import logging import os from functools import lru_cache from mlflow.tracking.context.git_context import GitRunContext from mlflow.tracking.context.registry import resolve_tags from mlflow.utils.databricks_utils import is_in_databricks_notebook from mlflow.utils.git_utils import get_git_branch, get_git_commit, get_git...
56
1,974
mlflow
tests/utils/test_name_utils.py
.py
from mlflow.utils.name_utils import _generate_random_name, _generate_unique_integer_id def test_random_name_generation(): # Validate exhausted loop truncation name = _generate_random_name(max_length=8) assert len(name) == 8 # Validate default behavior while calling 1000 times that names end in intege...
21
775
astropy
astropy/coordinates/jparser.py
.py
""" Module for parsing astronomical object names to extract embedded coordinates eg: '2MASS J06495091-0737408'. """ import re import numpy as np import astropy.units as u from astropy.coordinates import SkyCoord RA_REGEX = r"()([0-2]\d)([0-5]\d)([0-5]\d)\.?(\d{0,3})" DEC_REGEX = r"([+-])(\d{1,2})([0-5]\d)([0-5]\d)\...
68
1,865
wandb
tests/unit_tests/test_artifacts/conftest.py
.py
import os from pathlib import Path import pytest from pytest_mock import MockerFixture from wandb import env from wandb.sdk.artifacts.artifact_file_cache import ( ArtifactFileCache, get_artifact_file_cache, ) @pytest.fixture def artifact_file_cache(mocker: MockerFixture, tmp_path: Path) -> ArtifactFileCache:...
19
596
wandb
wandb/sdk/lib/interrupt.py
.py
"""Utility to send an interrupt (Ctrl+C) signal to the main thread. This is necessary because Windows and POSIX use different models for Ctrl+C interrupts. """ import platform import signal import threading def interrupt_main(): """Interrupt the main Python thread with a SIGINT signal. In POSIX, signal.pth...
38
1,353
mlflow
tests/models/test_artifacts.py
.py
import json import pathlib import pickle import numpy as np import pandas as pd import pytest from matplotlib.figure import Figure from mlflow.exceptions import MlflowException from mlflow.models.evaluation.artifacts import ( CsvEvaluationArtifact, ImageEvaluationArtifact, JsonEvaluationArtifact, Nump...
132
4,935
textual
docs/examples/widgets/horizontal_rules.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Label, Rule class HorizontalRulesApp(App): CSS_PATH = "horizontal_rules.tcss" def compose(self) -> ComposeResult: with Vertical(): yield Label("solid (default)") yiel...
28
787
astropy
astropy/stats/tests/test_sigma_clipping.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal from astropy import units as u from astropy.coordinates import Angle from astropy.stats import mad_std from astropy.stats.sigma_clipping import ( ...
741
24,889
astropy
astropy/utils/tests/test_progress_bar_func.py
.py
import time import numpy as np from astropy.utils.misc import NumpyRNGContext def func(i): """An identity function that jitters its execution time by a pseudo-random amount. FIXME: This function should be defined in test_console.py, but Astropy's test runner interacts strangely with Python's `multi...
20
585
confluent-kafka-python
tests/integration/schema_registry/data/proto/NestedTestProto_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: tests/integration/schema_registry/data/proto/NestedTestProto.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google...
53
3,933
readthedocs.org
readthedocs/oauth/services/base.py
.py
"""OAuth utility functions.""" import re from functools import cached_property from typing import Iterator import structlog from allauth.socialaccount.models import SocialAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider from django.conf import settings from django.urls import reverse...
337
11,814
openvino
tests/layer_tests/tensorflow_tests/test_tf_StridedSlice.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from common.tf_layer_test_class import CommonTFLayerTest class TestStridedSlice(CommonTFLayerTest): def create_strided_slice_net(self, input_shape, begin_value, end_value, strides_value, begin_mask, end_mask, ...
233
15,393
probability
tensorflow_probability/python/experimental/fastgp/__init__.py
.py
# Copyright 2024 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...
59
2,808
mlflow
tests/entities/test_job_status.py
.py
import pytest from mlflow.entities._job_status import JobStatus from mlflow.protos.jobs_pb2 import JobStatus as ProtoJobStatus @pytest.mark.parametrize( ("status", "expected_proto"), [ (JobStatus.PENDING, ProtoJobStatus.JOB_STATUS_PENDING), (JobStatus.RUNNING, ProtoJobStatus.JOB_STATUS_IN_PRO...
20
697
sqlmap
tests/test_identifiers_output.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Identifier quoting per DBMS dialect, CSV value escaping, and dump value replacement markers. """ import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.absp...
90
3,648
wandb
tests/unit_tests/test_wandb_log.py
.py
import pytest import wandb # ---------------------------------- # wandb.log # ---------------------------------- def test_nice_log_error(): with pytest.raises(wandb.Error): wandb.log({"no": "init"}) def test_nice_log_error_config(): with pytest.raises( wandb.Error, match=r"You must call wan...
49
1,214
textual
docs/examples/how-to/center07.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static QUOTE = "Could not find you in Seattle and no terminal is in operation at your classified address." class CenterApp(App): """How to center things.""" CSS = """ Screen { align: center middle; } #hello { ...
32
635
wagtail
wagtail/images/views/bulk_actions/__init__.py
.py
from .add_tags import AddTagsBulkAction from .add_to_collection import AddToCollectionBulkAction from .delete import DeleteBulkAction __all__ = ["AddToCollectionBulkAction", "AddTagsBulkAction", "DeleteBulkAction"]
6
216
pyro
tests/contrib/mue/test_dataloaders.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pyro.contrib.mue.dataloaders import BiosequenceDataset, alphabets, write @pytest.mark.parametrize("source_type", ["list", "fasta"]) @pytest.mark.parametrize("alphabet", ["amino-acid", "dna", "ATC"]) @...
117
3,607
coremltools
deps/pybind11/pybind11/__main__.py
.py
# pylint: disable=missing-function-docstring from __future__ import annotations import argparse import sys import sysconfig from ._version import __version__ from .commands import get_cmake_dir, get_include, get_pkgconfig_dir def print_includes() -> None: dirs = [ sysconfig.get_path("include"), ...
64
1,579
mlflow
mlflow/genai/judges/optimizers/memalign/optimizer.py
.py
import copy import logging from collections.abc import Iterable from dataclasses import asdict from typing import TYPE_CHECKING, Any import mlflow from mlflow.entities.assessment import Assessment from mlflow.entities.trace import Trace from mlflow.exceptions import MlflowException from mlflow.genai.judges.base import...
817
34,333
saleor
saleor/graphql/core/types/tests/test_money.py
.py
from decimal import Decimal from prices import Money from ..money import Money as MoneyObject def test_money_object_usd(): money = Money(Decimal("12.950000"), "USD") resolve_info = None assert MoneyObject.resolve_amount(money, resolve_info) == Decimal("12.95") assert MoneyObject.resolve_fractional_...
24
752
wagtail
wagtail/tests/permission_policies/test_permission_policies.py
.py
from django.contrib.auth.models import AnonymousUser, Group, Permission from django.contrib.contenttypes.models import ContentType from django.test import TestCase from wagtail.images.models import Image from wagtail.images.tests.utils import get_test_image_file from wagtail.permission_policies import ( Authentica...
1,440
53,517
coremltools
coremltools/proto/Imputer_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: Imputer.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from goog...
42
2,227
coremltools
coremltools/models/_compiled_model.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 from os.path import expanduser as _expanduser from typing import Optional as _Optional from typing impor...
250
8,748
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/Node.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 Node(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(flatbuffers...
318
10,401
scikit-bio
skbio/alignment/tests/test_score.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. # --------------------------------------------...
288
10,659
saleor
saleor/tests/e2e/orders/test_order_staff_can_create_order_with_the_same_variant_in_multiple_lines_and_overwrite_prices.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, order_lines_c...
118
3,745
luigi
test/task_running_resources_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
134
4,478
astropy
astropy/io/votable/setup_package.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from os.path import join import numpy as np from setuptools import Extension def get_extensions(build_type="release"): VO_DIR = "astropy/io/votable/src" return [ Extension( "astropy.io.votable.tablewriter", [jo...
25
586
pyomo
pyomo/contrib/pynumero/linalg/ma57_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...
154
5,379
probability
tensorflow_probability/python/math/ode/ode_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...
743
27,792
mlflow
tests/store/model_registry/test_read_write_routing.py
.py
import shutil from pathlib import Path import pytest import sqlalchemy import sqlalchemy.orm from mlflow.store.db.utils import _get_routing_session_maker from mlflow.store.model_registry.sqlalchemy_store import SqlAlchemyStore @pytest.fixture def write_db_uri(tmp_path: Path) -> str: return f"sqlite:///{tmp_path...
158
5,299
hatch
backend/src/hatchling/version/source/plugin/hooks.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from hatchling.plugin import hookimpl from hatchling.version.source.code import CodeSource from hatchling.version.source.env import EnvSource from hatchling.version.source.regex import RegexSource if TYPE_CHECKING: from hatchling.version.source....
17
502
httpie
httpie/sessions.py
.py
""" Persistent, JSON-serialized sessions. """ import os import re from http.cookies import SimpleCookie from http.cookiejar import Cookie from pathlib import Path from typing import Any, Dict, List, Optional, Union from requests.auth import AuthBase from requests.cookies import RequestsCookieJar, remove_cookie_by_na...
323
9,705
kafka
tests/kafkatest/services/verifiable_client.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 ...
338
14,236
wandb
wandb/sdk/data_types/audio.py
.py
from __future__ import annotations import hashlib import os import pathlib from typing import TYPE_CHECKING from wandb import util from wandb.sdk.lib import filesystem, runid from . import _dtypes from ._private import MEDIA_TMP from .base_types.media import BatchableMedia if TYPE_CHECKING: import numpy as np ...
206
6,335
black
tests/data/cases/tuple_with_stmt.py
.py
# don't remove the brackets here, it changes the meaning of the code. # even though the code will always trigger a runtime error with (name_5, name_4), name_5: pass with c, (a, b): pass with c, (a, b), d: pass with c, (a, b, e, f, g), d: pass def test_tuple_as_contextmanager(): from contextl...
31
555
pymc
pymc/step_methods/hmc/hmc.py
.py
# Copyright 2024 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
237
9,275
metrics
src/torchmetrics/clustering/normalized_mutual_info_score.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...
128
5,282
bazel
src/test/py/bazel/testdata/runfiles_test/bar/bar.py
.py
# Copyright 2018 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...
22
834
onnx
onnx/backend/test/case/node/div.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 Div(Base): @staticmethod def export() -> None: node = ...
79
2,847
pyfilesystem2
fs/opener/parse.py
.py
"""Function to parse FS URLs in to their constituent parts. """ from __future__ import absolute_import, print_function, unicode_literals import typing import collections import re import six from six.moves.urllib.parse import parse_qs, unquote from .errors import ParseError if typing.TYPE_CHECKING: from typing...
96
2,322
jupytext
tests/functional/simple_notebooks/test_read_simple_percent.py
.py
import os import pytest from jupyter_server.utils import ensure_async from nbformat.v4.nbbase import ( new_code_cell, new_markdown_cell, new_notebook, new_raw_cell, ) import jupytext from jupytext.compare import compare, compare_notebooks, notebook_model def test_read_simple_file( script="""# --...
609
12,956
pyro
pyro/poutine/lift_messenger.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import warnings from typing import TYPE_CHECKING, Callable, Dict, Set, Union from typing_extensions import Self from pyro import params from pyro.distributions.distribution import Distribution from pyro.poutine.messenger import M...
135
5,224
structlog
tests/test_tracebacks.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. from __future__ import annotations import asyncio import inspect import json import sys fro...
1,192
33,192
ipython
IPython/utils/PyColorize.py
.py
import keyword import os import sys import token import tokenize import warnings from io import StringIO from typing import TYPE_CHECKING, Any, TypeAlias import pygments from pygments.style import Style from pygments.token import Token, _TokenType from functools import cache from typing import TypedDict if TYPE_CHEC...
600
18,495
onnxruntime
onnxruntime/test/testdata/custom_mul.py
.py
import onnx def create_custom_mul_model(): # === Inputs === x = onnx.helper.make_tensor_value_info("X", onnx.TensorProto.FLOAT, [3, 2]) w = onnx.helper.make_tensor_value_info("W", onnx.TensorProto.FLOAT, [3, 2]) # === Output === y = onnx.helper.make_tensor_value_info("Y", onnx.TensorProto.FLOAT, ...
46
1,274
mlflow
mlflow/__init__.py
.py
""" The ``mlflow`` module provides a high-level "fluent" API for starting and managing MLflow runs. For example: .. code:: python import mlflow mlflow.start_run() mlflow.log_param("my", "param") mlflow.log_metric("score", 100) mlflow.end_run() You can also use the context manager syntax like thi...
451
14,048
wagtail
wagtail/admin/panels/inline_panel.py
.py
import functools import json from django import forms from django.forms.formsets import DELETION_FIELD_NAME, ORDERING_FIELD_NAME from django.utils.functional import cached_property from django.utils.text import capfirst from wagtail.admin import compare from wagtail.admin.telepath import register as register_telepath...
209
7,602