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 |
|---|---|---|---|---|---|
luigi | doc/conf.py | .py | # -*- coding: utf-8 -*-
#
# Luigi documentation build configuration file, created by
# sphinx-quickstart on Sat Feb 8 00:56:43 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | 319 | 10,317 |
mlflow | mlflow/tracing/export/inference_table.py | .py | import logging
from typing import Any, Sequence
from cachetools import TTLCache
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.sdk.trace.export import SpanExporter
from mlflow.entities.model_registry import PromptVersion
from mlflow.entities.trace import Trace
from mlflow.environment_variables im... | 163 | 6,957 |
sphinx | sphinx/search/_stopwords/hu.py | .py | # automatically generated by utils/generate-snowball.py
# from https://github.com/snowballstem/snowball-website/raw/efb4ae4d65769fb1652acbe608c0c817e746c730/algorithms/hungarian/stop.txt
from __future__ import annotations
HUNGARIAN_STOPWORDS = frozenset({
'a',
'abban',
'ahhoz',
'ahogy',
'ahol',
... | 206 | 2,869 |
beam | learning/tour-of-beam/learning-content/io/text-io/text-io-gcs-write/python-example/task.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); y... | 42 | 1,339 |
readthedocs.org | readthedocs/search/documents.py | .py | import structlog
from django.conf import settings
from django_elasticsearch_dsl import Document
from django_elasticsearch_dsl import Index
from django_elasticsearch_dsl import fields
from elasticsearch import Elasticsearch
from readthedocs.projects.models import HTMLFile
from readthedocs.projects.models import Project... | 138 | 4,439 |
beam | sdks/python/apache_beam/transforms/create_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... | 169 | 6,864 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_reshape.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from onnx.helper import make_graph, make_model, make_node, make_tensor_value_info
from tests.runtime import get_runtime
from tests.tests_python.utils import (
all_... | 453 | 17,276 |
beam | sdks/python/apache_beam/runners/interactive/display/pcoll_visualization_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... | 208 | 8,687 |
wandb | tests/system_tests/test_functional/lightning/strategy_ddp_spawn.py | .py | from base import BoringModel, RandomDataset # type: ignore
from lightning import Trainer
from lightning.pytorch.loggers import WandbLogger
from torch.utils.data import DataLoader
def main():
# Set up data
num_samples = 1000
train = DataLoader(RandomDataset(32, num_samples), batch_size=32)
val = DataL... | 38 | 1,004 |
saleor | saleor/graphql/checkout/filters.py | .py | from uuid import UUID
import django_filters
from django.core.exceptions import ValidationError
from django.db.models import Exists, OuterRef, Q
from ...account.models import User
from ...checkout.models import Checkout
from ...core.search import prefix_search
from ...payment.models import Payment
from ..channel.filte... | 170 | 5,289 |
textual | examples/theme_sandbox.py | .py | from __future__ import annotations
from functools import partial
from typing import Any
from textual._on import on
from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.containers import Container, Grid, Horizontal, VerticalScroll
from textual.widgets import (
Button,
Col... | 495 | 13,619 |
onnxruntime | onnxruntime/python/tools/transformers/models/whisper/benchmark_all.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ... | 527 | 18,842 |
astropy | docs/wcs/examples/from_file.py | .py | # Load the WCS information from a fits header, and use it
# to convert pixel coordinates to world coordinates.
import sys
import numpy as np
from astropy import wcs
from astropy.io import fits
def load_wcs_from_file(filename):
# Load the FITS hdulist using astropy.io.fits
hdulist = fits.open(filename)
... | 59 | 1,875 |
metrics | src/torchmetrics/text/eed.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... | 167 | 6,381 |
onnxruntime | onnxruntime/test/python/contrib_ops/aten_op_tests.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import io
import unittest
import numpy as np
import onnx
import torch
from onnx import TensorProto, helper
from ort_torch_ext import init_aten_op_executor
from torch.onnx import export
import onnxruntime as ort
class Ort... | 132 | 5,664 |
mlflow | mlflow/projects/env_type.py | .py | DOCKER = "docker_env"
PYTHON = "python_env"
CONDA = "conda_env"
ALL = [DOCKER, PYTHON, CONDA]
| 5 | 94 |
pyro | tests/distributions/test_improper_uniform.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from torch.distributions import constraints, transform_to
import pyro.distributions as dist
from tests.common import assert_equal
@pytest.mark.parametrize(
"constraint",
[
constraints.real,... | 33 | 966 |
mlflow | tests/langchain/test_chat_agent_langchain.py | .py | import mlflow
def test_langchain_chat_agent_save_as_code():
# (role, content)
expected_messages = [
("assistant", "1"),
("assistant", "2"),
("assistant", "3"),
]
with mlflow.start_run():
model_info = mlflow.pyfunc.log_model(
name="agent",
python... | 30 | 1,131 |
scikit-bio | skbio/stats/ordination/_principal_coordinate_analysis.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.
# --------------------------------------------... | 719 | 28,953 |
hydra | tests/test_apps/structured_with_none_list/my_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from dataclasses import dataclass
from typing import List, Optional
from omegaconf import DictConfig
import hydra
from hydra.core.config_store import ConfigStore
@dataclass
class Config:
list: Optional[List[int]] = None
cs = ConfigStore.in... | 27 | 492 |
eve | eve/io/mongo/__init__.py | .py | # -*- coding: utf-8 -*-
"""
eve.io.mongo
~~~~~~~~~~~~
This package implements the MongoDB data layer.
:copyright: (c) 2017 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
# flake8: noqa
from eve.io.mongo.mongo import Mongo, MongoJSONEncoder, ensure_mongo_indexes
from eve.io.m... | 17 | 403 |
coremltools | coremltools/converters/mil/backend/mil/passes/fuse_pow2_sqrt.py | .py | # Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import numpy as np
from coremltools.converters.mil.mil import Builder as mb
from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
fr... | 103 | 3,036 |
onnxruntime | tools/ci_build/test_compile_triton.py | .py | import importlib.util
import subprocess
import sys
import tempfile
import types
import unittest
import unittest.mock
from pathlib import Path
MODULE_PATH = Path(__file__).with_name("compile_triton.py")
def load_compile_triton_module():
fake_triton = types.SimpleNamespace()
with unittest.mock.patch.dict(sys.m... | 112 | 4,347 |
hypercorn | tests/conftest.py | .py | from __future__ import annotations
import pytest
from _pytest.monkeypatch import MonkeyPatch
import hypercorn.config
from hypercorn.typing import ConnectionState, HTTPScope
@pytest.fixture(autouse=True)
def _time(monkeypatch: MonkeyPatch) -> None:
monkeypatch.setattr(hypercorn.config, "time", lambda: 5000)
@p... | 37 | 917 |
onnxruntime | onnxruntime/test/autoep/tools/print_onnx_metadata.py | .py | #!/usr/bin/env python3
import argparse
import json
from pathlib import Path
from typing import Any
import onnx
def model_metadata_to_dict(model: onnx.ModelProto) -> dict[str, Any]:
custom_metadata = {entry.key: entry.value for entry in model.metadata_props}
graph = model.graph
info = {
"ir_vers... | 56 | 1,640 |
pyomo | pyomo/contrib/pynumero/interfaces/ampl_nlp.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 879 | 33,689 |
colorama | colorama/tests/utils.py | .py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from contextlib import contextmanager
from io import StringIO
import sys
import os
class StreamTTY(StringIO):
def isatty(self):
return True
class StreamNonTTY(StringIO):
def isatty(self):
return False
@contextmanager
... | 50 | 1,079 |
conda | conda/common/constants.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common constants."""
from ..auxlib import NULL
# Use this NULL object when needing to distinguish a value from None
# For example, when parsing json, you may need to determine if a json key was given and set
# to null, or the key didn't e... | 15 | 589 |
mlflow | mlflow/data/__init__.py | .py | import sys
from contextlib import suppress
from mlflow.data import dataset_registry
from mlflow.data import sources as mlflow_data_sources
from mlflow.data.dataset import Dataset
from mlflow.data.dataset_source import DatasetSource
from mlflow.data.dataset_source_registry import (
get_dataset_source_from_json,
... | 78 | 2,559 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_TopKV2.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import platform
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
rng = np.random.default_rng(235436)
class TestTopKV2(CommonTFLayerTest):
def _prepare_input(self, in... | 64 | 3,278 |
beam | sdks/python/apache_beam/examples/dataframe/wordcount_test.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 "L... | 73 | 2,472 |
wandb | wandb/sandbox/__init__.py | .py | from __future__ import annotations
try:
import cwsandbox
except ImportError as exc:
raise ImportError(
"cwsandbox is not installed. Please install it with: pip install wandb[sandbox]"
) from exc
from cwsandbox import * # noqa: F403
from cwsandbox import __all__ as cwsandbox_all
# wandb specific ... | 23 | 572 |
wagtail | wagtail/admin/tests/pages/test_bulk_actions/test_bulk_unpublish.py | .py | from unittest import mock
import swapper
from django.contrib.auth.models import Permission
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from wagtail.admin.views.pages.bulk_actions.page_bulk_act... | 317 | 12,087 |
rq | tests/test_repeat.py | .py | from datetime import timedelta
from rq import Queue, Worker
from rq.job import Job
from rq.registry import ScheduledJobRegistry
from rq.repeat import Repeat
from rq.utils import now
from tests import RQTestCase
from tests.fixtures import div_by_zero, say_hello
class TestRepeat(RQTestCase):
"""Tests for the Repea... | 225 | 8,328 |
saleor | saleor/graphql/menu/mutations/menu_create.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....menu import models
from ....menu.error_codes import MenuErrorCode
from ....permission.enums import MenuPermissions
from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.context import ChannelCon... | 119 | 4,435 |
hydra | hydra/main.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import functools
import pickle
import warnings
from pathlib import Path
from typing import Any, Callable, List, Optional
from omegaconf import DictConfig, open_dict, read_write
from . import version
from ._internal.utils import _run_hy... | 84 | 3,292 |
saleor | saleor/graphql/channel/tests/benchmark/test_channel.py | .py | import pytest
from ....tests.utils import get_graphql_content
CHANNELS_QUERY = """
query {
channels {
name
slug
currencyCode
warehouses {
id
}
defaultCountry {
code
country
}... | 37 | 776 |
pyro | pyro/infer/importance.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import warnings
from typing import List, Union
import torch
import pyro
import pyro.poutine as poutine
from pyro.ops.stats import fit_generalized_pareto
from .abstract_infer import TracePosterior
from .enum import ge... | 255 | 9,786 |
sphinx | doc/development/tutorials/examples/helloworld.py | .py | from __future__ import annotations
from docutils import nodes
from sphinx.application import Sphinx
from sphinx.util.docutils import SphinxDirective, SphinxRole
from sphinx.util.typing import ExtensionMetadata
class HelloRole(SphinxRole):
"""A role to say hello!"""
def run(self) -> tuple[list[nodes.Node], ... | 37 | 937 |
tomli | tests/test_data.py | .py | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.
import json
from pathlib import Path
import unittest
from . import burntsushi, tomllib
DATA_DIR = Path(__file__).parent / "data"
VALID_FILES = tuple((DATA_DIR / "valid").glob("**/*.toml"))
... | 48 | 1,689 |
wandb | wandb/apis/public/registries/_utils.py | .py | from __future__ import annotations
import logging
from collections.abc import Collection
from enum import Enum
from functools import lru_cache
from typing import TYPE_CHECKING, Any, TypeVar, overload
from wandb._strutils import b64decode_ascii, ensureprefix, repr_join
from wandb.proto import wandb_internal_pb2 as pb
... | 235 | 7,903 |
probability | tensorflow_probability/python/math/ode/util.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... | 308 | 10,569 |
onnxruntime | orttraining/orttraining/python/training/ortmodule/_custom_autograd_function.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from onnxruntime.capi._pybind_state import is_torch_interop_default_on
f... | 92 | 3,860 |
loguru | tests/test_standard_handler.py | .py | import sys
from logging import FileHandler, Filter, Formatter, Handler, NullHandler, StreamHandler
import pytest
from loguru import logger
class RejectAllFilter(Filter):
def filter(self, record):
return False
def test_stream_handler(capsys):
logger.add(StreamHandler(sys.stderr), format="{level} {m... | 251 | 6,884 |
wandb | tests/system_tests/test_core/test_mp_full.py | .py | """multiproc full tests."""
import importlib
import sys
import time
import pytest
import wandb
from wandb.errors import UsageError
def train(run, add_val):
time.sleep(1)
run.log(dict(mystep=1, val=2 + add_val))
run.log(dict(mystep=2, val=8 + add_val))
run.log(dict(mystep=3, val=3 + add_val))
run... | 57 | 1,514 |
wandb | wandb/sdk/data_types/helper_types/bounding_boxes_2d.py | .py | from __future__ import annotations
import numbers
from typing import TYPE_CHECKING
import wandb
from wandb import util
from wandb.util import has_num
from ..base_types.json_metadata import JSONMetadata
if TYPE_CHECKING: # pragma: no cover
from wandb.sdk.artifacts.artifact import Artifact
from ...wandb_run... | 330 | 13,765 |
mlflow | tests/store/artifact/test_databricks_logged_model_artifact_repo.py | .py | from pathlib import Path
from unittest import mock
import pytest
from databricks.sdk.service.files import DirectoryEntry
from mlflow.entities.file_info import FileInfo
from mlflow.exceptions import MlflowException
from mlflow.store.artifact.databricks_logged_model_artifact_repo import (
DatabricksLoggedModelArtif... | 274 | 10,948 |
openvino | tests/e2e_tests/common/ref_collector/score_pytorch.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import os
import sys
from utils.path_utils import resolve_dir_path
from e2e_tests.common.ref_collector.provider import ClassProvider
class PytorchBaseRunner:
log.basicConfig(format="[ %(levelname)s ] %(messag... | 368 | 16,342 |
coremltools | coremltools/converters/sklearn/_gradient_boosting_regressor.py | .py | # Copyright (c) 2017, 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 packaging.version import Version
from ..._deps import _HAS_SKLEARN, _SKLEARN_VERSION
from ...model... | 75 | 2,234 |
beam | sdks/python/apache_beam/io/filesystems_test.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 "L... | 247 | 8,308 |
saleor | saleor/graphql/product/utils.py | .py | from collections import defaultdict
from collections.abc import Iterable
from dataclasses import dataclass
from typing import TYPE_CHECKING, NamedTuple
from uuid import UUID
import graphene
import requests
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import Databas... | 266 | 8,225 |
cvxpy | cvxpy/transforms/__init__.py | .py | """
Copyright 2013 Steven Diamond
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... | 24 | 996 |
pyro | tests/test_primitives.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from typing import Optional
import pytest
import torch
import pyro
import pyro.distributions as dist
from pyro import poutine
pytestmark = pytest.mark.stage("unit")
def test_sample_ok():
x = pyro.sample("x", dist.Normal(0, 1))... | 64 | 1,459 |
mlflow | tests/entities/test_trace_info.py | .py | from unittest import mock
import pytest
from google.protobuf.timestamp_pb2 import Timestamp
from mlflow.entities import (
AssessmentError,
AssessmentSource,
Expectation,
Feedback,
)
from mlflow.entities.trace_info import TraceInfo
from mlflow.entities.trace_location import TraceLocation
from mlflow.en... | 367 | 13,152 |
pyomo | pyomo/solvers/tests/piecewise_linear/problems/piecewise_multi_vararray.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... | 72 | 2,333 |
beam | sdks/python/apache_beam/runners/dataflow/dataflow_job_service_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... | 86 | 3,284 |
probability | spinoffs/inference_gym/conftest.py | .py | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 47 | 1,531 |
textual | src/textual/filter.py | .py | """Filter classes.
!!! note
Filters are used internally, and not recommended for use by Textual app developers.
Filters are used internally to process terminal output after it has been rendered.
Currently this is used internally to convert the application to monochrome, when the NO_COLOR env var is set.
In the ... | 289 | 7,880 |
astropy | astropy/timeseries/periodograms/lombscargle/implementations/scipy_impl.py | .py | import numpy as np
from astropy.utils.compat.optional_deps import HAS_SCIPY
def lombscargle_scipy(t, y, frequency, normalization="standard", center_data=True):
"""Lomb-Scargle Periodogram.
This is a wrapper of ``scipy.signal.lombscargle`` for computation of the
Lomb-Scargle periodogram. This is a relati... | 73 | 2,440 |
slimit | src/slimit/__init__.py | .py | ###############################################################################
#
# Copyright (c) 2011 Ruslan Spivak
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, inc... | 28 | 1,362 |
onnxruntime | objectivec/test/testdata/single_add_gen.py | .py | import onnx
from onnx import TensorProto, helper
graph = helper.make_graph(
[ # nodes
helper.make_node("Add", ["A", "B"], ["C"], "Add"),
],
"SingleAdd", # name
[ # inputs
helper.make_tensor_value_info("A", TensorProto.FLOAT, [1]),
helper.make_tensor_value_info("B", TensorProt... | 20 | 552 |
hatch | backend/src/hatchling/builders/plugin/interface.py | .py | from __future__ import annotations
import os
import re
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Generic, cast
from hatchling.builders.config import BuilderConfig, BuilderConfigBound, env_var_enabled
from hatchling.builders.constants import EXCLUDED_DIRECTORIES, EXCLUDED_FILES, BuildE... | 444 | 16,217 |
mlflow | mlflow/store/db_migrations/versions/1bd49d398cd23_add_secrets_tables.py | .py | """add secrets tables
Create Date: 2025-11-20 12:22:19.451124
"""
import time
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "1bd49d398cd23"
down_revision = "bf29a5ff90ea"
branch_labels = None
depends_on = None
# Trigger SQL for each database dialect to enforce... | 304 | 10,819 |
metrics | tests/unittests/regression/test_pearson.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... | 318 | 13,741 |
wagtail | wagtail/contrib/settings/tests/generic/test_admin.py | .py | from django.contrib.auth.models import Group, Permission
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from django.urls import reverse
from django.utils.text import capfirst
from wagtail import hooks
from wagtail.admin.admin_url_finder import AdminURLFinder
from wagtail.admin.panel... | 549 | 22,350 |
onnxruntime | onnxruntime/python/tools/transformers/models/__init__.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
| 5 | 248 |
wandb | tests/system_tests/test_sweep/test_wandb_sweep.py | .py | """Sweep tests."""
import json
import sys
from typing import Any
import pytest
import wandb
import wandb.apis
from wandb.cli import cli
# Sweep configs used for testing
SWEEP_CONFIG_GRID: dict[str, Any] = {
"name": "mock-sweep-grid",
"method": "grid",
"parameters": {"param1": {"values": [1, 2, 3]}},
}
SW... | 302 | 9,491 |
beam | sdks/python/apache_beam/transforms/async_dofn.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... | 558 | 21,546 |
onnxruntime | tools/ci_build/run_gh_action.py | .py | import os
import platform
import shutil
import sys
import tempfile
import zipfile
from pathlib import Path
import requests
SCRIPT_DIR = Path(__file__).resolve().parent
REPO_DIR = (SCRIPT_DIR / ".." / "..").resolve()
sys.path.insert(0, str(REPO_DIR / "tools" / "python"))
from util import run # noqa: E402
# Hash st... | 163 | 6,146 |
jupytext | tests/external/jupyter_fs/test_jupyter_fs.py | .py | import logging
import sys
import pytest
from jupyter_server.utils import ensure_async
from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook
import jupytext
from jupytext.compare import compare_cells, notebook_model
pytestmark = pytest.mark.skipif(sys.version_info >= (3, 12), reason="https://g... | 111 | 4,119 |
conda | tests/core/test_prefix_data.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import json
import shutil
import sys
from contextlib import nullcontext
from dataclasses import dataclass
from datetime import datetime, timezone
from pathlib import Path
from typing import TYPE_CHECKING
imp... | 1,219 | 40,933 |
sphinx | tests/test_domains/test_domain_py_pyobject.py | .py | """Tests the Python Domain"""
from __future__ import annotations
import pytest
from docutils import nodes
from sphinx import addnodes
from sphinx.addnodes import (
desc,
desc_addname,
desc_annotation,
desc_content,
desc_name,
desc_parameterlist,
desc_sig_keyword,
desc_sig_punctuation,... | 1,159 | 36,388 |
openvino | src/frontends/tensorflow/docs/check_supported_ops.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import re
import sys
not_supported_ops_with_translators = ["WriteFile"]
def run_in_ci():
if "CI" in os.environ and os.environ["CI"].lower() == "true":
return True
if "TF_BUILD" in os.environ and len(os.envir... | 81 | 2,698 |
mlflow | tests/server/auth/db/test_cli.py | .py | import sqlite3
from pathlib import Path
from urllib.parse import quote
from alembic.command import downgrade as alembic_downgrade
from click.testing import CliRunner
from mlflow.server.auth.db import cli
from mlflow.server.auth.db.utils import _get_alembic_config
def test_upgrade(tmp_path: Path) -> None:
runner... | 757 | 29,908 |
textual | docs/examples/guide/actions/actions02.py | .py | from textual import events
from textual.app import App
class ActionsApp(App):
def action_set_background(self, color: str) -> None:
self.screen.styles.background = color
async def on_key(self, event: events.Key) -> None:
if event.key == "r":
await self.run_action("set_background('r... | 17 | 393 |
mlflow | mlflow/store/db_migrations/versions/6f8d9c3b2a1e_add_experiment_fk_cascades.py | .py | """Add ON DELETE CASCADE to `trace_info.experiment_id`.
Fixes https://github.com/mlflow/mlflow/issues/18781.
Create Date: 2026-07-09 21:16:54.445000
"""
from alembic import op
from mlflow.store.tracking.dbmodels.models import SqlExperiment, SqlTraceInfo
# revision identifiers, used by Alembic.
revision = "6f8d9c3... | 57 | 1,535 |
beam | sdks/python/apache_beam/examples/flink/flink_streaming_impulse.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... | 98 | 2,944 |
metrics | tests/unittests/image/test_d_lambda.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... | 152 | 5,987 |
hydra | noxfile.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import functools
import importlib.util
import os
import platform
import subprocess
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Iterator, List, Optional, Tuple, Union
import nox
from nox impor... | 750 | 23,956 |
kafka | tests/kafkatest/tests/core/fetch_from_follower_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 use ... | 139 | 6,973 |
kombu | t/unit/utils/test_objects.py | .py | from __future__ import annotations
from unittest import mock
from kombu.utils.objects import cached_property
class test_cached_property:
def test_deleting(self):
class X:
xx = False
@cached_property
def foo(self):
return 42
@foo.deleter... | 86 | 2,091 |
astropy | astropy/nddata/_testing.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing utilities. Not part of the public API!"""
from astropy.wcs import WCS
from astropy.wcs.wcsapi import BaseHighLevelWCS
def assert_wcs_seem_equal(wcs1, wcs2):
"""Just checks a few attributes to make sure wcs instances seem to be
equal.
... | 73 | 1,851 |
returns | returns/pointfree/modify_env.py | .py | from collections.abc import Callable
from typing import TypeVar
from returns.interfaces.specific.reader import ReaderLike2, ReaderLike3
from returns.primitives.hkt import Kind2, Kind3, Kinded, kinded
_FirstType = TypeVar('_FirstType')
_SecondType = TypeVar('_SecondType')
_ThirdType = TypeVar('_ThirdType')
_UpdatedTyp... | 104 | 3,027 |
textual | docs/examples/app/widgets04.py | .py | from textual.app import App
from textual.widgets import Button, Welcome
class WelcomeApp(App):
async def on_key(self) -> None:
await self.mount(Welcome())
self.query_one(Button).label = "YES!"
if __name__ == "__main__":
app = WelcomeApp()
app.run()
| 14 | 281 |
mlflow | tests/tensorflow/test_tensorflow2_autolog.py | .py | # pep8: disable=E501
import functools
import json
import os
import pickle
import sys
from pathlib import Path
from unittest.mock import patch
import numpy as np
import pytest
import tensorflow as tf
import yaml
from packaging.version import Version
from tensorflow.keras import layers
import mlflow
from mlflow import... | 1,456 | 52,429 |
mlflow | mlflow/store/db_migrations/versions/bf29a5ff90ea_add_jobs_table.py | .py | """add jobs table
Create Date: 2025-09-11 17:39:31.569736
"""
import time
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "bf29a5ff90ea"
down_revision = "3da73c924c2f"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"jobs",
... | 53 | 1,469 |
onnxruntime | orttraining/orttraining/python/training/ortmodule/experimental/json_config/__init__.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# __init__.py
# JSON global constants goes here
JSON_PATH_ENVIRONMENT_KEY = "ORTMODULE_JSON_CONFIG_PATH"
from ._load_config_from_json import load_from_json # noqa: E402, F401
| 9 | 272 |
mlflow | tests/dev/test_check_function_signatures.py | .py | import ast
from dev.check_function_signatures import check_signature_compatibility
def test_no_changes():
old_code = "def func(a, b=1): pass"
new_code = "def func(a, b=1): pass"
old_tree = ast.parse(old_code)
new_tree = ast.parse(new_code)
errors = check_signature_compatibility(old_tree.body[0],... | 231 | 7,443 |
qutip | qutip/core/gates.py | .py | # Required for Sphinx to follow autodoc_type_aliases
from __future__ import annotations
from itertools import product
from functools import partial, reduce
from operator import mul
import numpy as np
from . import Qobj, qeye, sigmax, fock_dm, qdiags, qeye_like
from .dimensions import Dimensions
from .. import setting... | 844 | 21,705 |
readthedocs.org | readthedocs/api/v3/filters.py | .py | import django_filters.rest_framework as filters
from readthedocs.builds.constants import BUILD_FINAL_STATES
from readthedocs.builds.models import Build
from readthedocs.builds.models import Version
from readthedocs.notifications.models import Notification
from readthedocs.oauth.models import RemoteOrganization
from re... | 96 | 2,677 |
flit | flit/__init__.py | .py | """A simple packaging tool for simple packages."""
import argparse
import logging
import os
import pathlib
import shutil
import subprocess
import sys
from typing import Optional
from flit_core import common
from .config import ConfigError
from .log import enable_colourful_output
__version__ = '4.0.2'
log = logging.g... | 213 | 8,438 |
pymc | pymc/data.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... | 362 | 12,140 |
wagtail | wagtail/tests/test_permissions.py | .py | from unittest import mock
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from wagtail.models import Collection, Locale, Site, Task, Workflow
from wagtail.permission_policies import ModelPermissionPolicy
from wagtail.permission_policies.collections import CollectionManagementP... | 203 | 9,141 |
structlog | tests/test_base.py | .py | # SPDX-License-Identifier: MIT OR Apache-2.0
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the MIT License. See the LICENSE file in the root of this
# repository for complete details.
import pytest
from structlog import get_context
from structlog._base import BoundLoggerBase
... | 244 | 7,276 |
saleor | saleor/graphql/warehouse/resolvers.py | .py | from ...warehouse import models
from ..core.context import get_database_connection_name
def resolve_stock(info, id):
return (
models.Stock.objects.using(get_database_connection_name(info.context))
.filter(id=id)
.first()
)
def resolve_stocks(info):
return models.Stock.objects.usi... | 21 | 511 |
beam | sdks/python/apache_beam/testing/load_tests/load_test_metrics_utils.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... | 672 | 21,985 |
openvino | tests/layer_tests/onnx_tests/test_dropout.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model
class TestDropout(OnnxRuntimeLayerTest):
def create_net(self, shape, ratio, ir_version, opset=None):
"""
... | 177 | 5,574 |
saleor | saleor/tests/e2e/shipping_zone/utils/__init__.py | .py | from .shipping_method import create_shipping_method
from .shipping_method_channel_listing import create_shipping_method_channel_listing
from .shipping_price_update import update_shipping_price
from .shipping_zone import create_shipping_zone
__all__ = [
"create_shipping_method",
"create_shipping_method_channel_... | 12 | 389 |
saleor | saleor/graphql/translations/fields.py | .py | import graphene
from ..core.enums import LanguageCodeEnum
from .descriptions import TranslationDescriptions
from .resolvers import resolve_translation
class TranslationField(graphene.Field):
def __init__(self, model, type_name, resolver=resolve_translation):
super().__init__(
model,
... | 22 | 699 |
saleor | saleor/graphql/discount/tests/mutations/test_voucher_update.py | .py | import json
from unittest.mock import call, patch
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....core.utils.json_serializer import CustomJsonEncoder
from .....discount import DiscountValueType
from .....discount.error_codes import DiscountErrorCode
fro... | 556 | 16,896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.