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
conda
conda/common/terminal.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ Utility functions for terminal output. """ import os import sys def is_tty() -> bool: """Return True if stdout is connected to a TTY.""" return hasattr(sys.stdout, "isatty") and sys.stdout.isatty() def term_dumb() -> bool: "...
67
1,819
sqlmap
thirdparty/chardet/charsetprober.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
146
5,110
conda
tests/common/_os/test_windows.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from conda.common._os.windows import is_admin_on_windows from conda.common.compat import on_win def test_is_admin_on_windows(): result = is_admin_on_windows() if on_win: assert result is False or result is True else: ...
13
345
saleor
saleor/app/manifest_validations.py
.py
import logging from collections import defaultdict from collections.abc import Iterable from django.core.exceptions import ValidationError from django.db.models import Value from django.db.models.functions import Concat from pydantic import ValidationError as PydanticValidationError from semantic_version import NpmSpe...
379
13,504
onnxruntime
orttraining/orttraining/test/python/_test_helpers.py
.py
import copy import os import torch from numpy.testing import assert_allclose from onnxruntime.training.ortmodule import ORTModule from onnxruntime.training.ortmodule._graph_execution_manager_factory import GraphExecutionManagerFactory # noqa: F401 def is_all_or_nothing_fallback_enabled(model, policy=None): fro...
337
11,412
wandb
wandb/apis/public/registries/registry.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, Any, Literal from pydantic import PositiveInt from typing_extensions import Self, assert_never import wandb from wandb._analytics import tracked from wandb._strutils import nameof from wandb.apis.public.teams import Team from wandb.apis.public.user...
718
25,482
wandb
tests/unit_tests/test_error_util.py
.py
import pytest from wandb.errors import Error from wandb.errors.util import ProtobufErrorHandler from wandb.proto import wandb_internal_pb2 as pb @pytest.mark.parametrize( "error, expected", [ (pb.ErrorInfo(), type(None)), (pb.ErrorInfo(code=-2), Error), ], ) def test_protobuf_error_handler...
22
584
textual
src/textual/_arrange.py
.py
from __future__ import annotations from collections import defaultdict from fractions import Fraction from operator import attrgetter from typing import TYPE_CHECKING, Iterable, Mapping, Sequence from textual._partition import partition from textual.geometry import NULL_OFFSET, NULL_SPACING, Region, Size, Spacing fro...
254
9,045
openvino
tests/layer_tests/pytorch_tests/test_isnan.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('input_tensor', (np.array([1, float('nan'), 2]),)) class TestIsNan(PytorchLayerTest): def _prepare_input...
31
880
openvino
src/frontends/tensorflow/tests/test_models/gen_scripts/generate_2in_2out.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import numpy as np import tensorflow as tf tf.compat.v1.reset_default_graph() # Create the graph and model with tf.compat.v1.Session() as sess: input1 = tf.compat.v1.placeholder(tf.float32, [1, 3, 3, 1], 'inpu...
39
1,322
pdm
tests/fixtures/projects/test-setuptools/setup.py
.py
from setuptools import setup from mymodule import __version__ with open("AUTHORS") as f: authors = f.read().strip() kwargs = { "name": "mymodule", "version": __version__, "author": authors, } if 1 + 1 >= 2: kwargs.update(license="MIT") if __name__ == "__main__": setup(**kwargs)
19
308
astropy
astropy/visualization/mpl_normalize.py
.py
""" Normalization class for Matplotlib that can be used to produce colorbars. """ import inspect import numpy as np from numpy import ma from astropy.utils.compat.optional_deps import HAS_MATPLOTLIB from astropy.utils.decorators import future_keyword_only from .interval import ( AsymmetricPercentileInterval, ...
738
23,969
mlflow
tests/genai/review_queues/test_review_queues_sdk.py
.py
from unittest.mock import patch import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.review_queues import ( ReviewItemType, ReviewQueue, ReviewQueueItem, ReviewQueueType, ReviewStatus, add_items_to_review_queue, create_review_queue, delete_review_...
213
7,591
pyomo
pyomo/contrib/incidence_analysis/tests/test_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...
1,928
77,039
sphinx
sphinx/writers/latex.py
.py
"""Custom docutils writer for LaTeX. Much of this code is adapted from Dave Kuhlman's "docpy" writer from his docutils sandbox. """ from __future__ import annotations import re from collections import defaultdict from pathlib import Path from typing import TYPE_CHECKING, cast from docutils import nodes, writers fro...
2,576
99,756
saleor
saleor/webhook/observability/payload_schema.py
.py
import datetime from enum import Enum from json.encoder import ESCAPE_ASCII, ESCAPE_DCT from typing import TypedDict class JsonTruncText: def __init__(self, text="", truncated=False, added_bytes=0): self.text = text self.truncated = truncated self._added_bytes = max(0, added_bytes) de...
152
3,628
mlflow
mlflow/projects/utils.py
.py
import logging import os import pathlib import re import shutil import tempfile import urllib.parse import zipfile from io import BytesIO from mlflow import tracking from mlflow.entities import Param, SourceType from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID, MLFLOW_RUN_ID, MLFLOW_TRACKING_URI from mlfl...
351
12,649
sphinx
sphinx/_cli/util/colour.py
.py
"""Format coloured console output.""" from __future__ import annotations import sys from os import environ as _environ TYPE_CHECKING = False if TYPE_CHECKING: from collections.abc import Callable if sys.platform == 'win32': import colorama colorama.just_fix_windows_console() del colorama _COLOURI...
128
3,666
openvino
src/bindings/python/tests/test_graph/test_pad.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ov from openvino import Type @pytest.mark.parametrize("pad_mode", [ "constant", "edge", "reflect", "symmetric", ]) def test_pad_mode(pad_mode): ...
41
1,282
textual
docs/examples/widgets/data_table_fixed.py
.py
from textual.app import App, ComposeResult from textual.widgets import DataTable class TableApp(App): CSS = "DataTable {height: 1fr}" def compose(self) -> ComposeResult: yield DataTable() def on_mount(self) -> None: table = self.query_one(DataTable) table.focus() table.ad...
26
645
onnxruntime
orttraining/orttraining/python/training/ort_triton/_sympy_utils.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import re from typing import Any import sympy def extract_shape_from_...
33
1,022
confluent-kafka-python
tests/ducktape/test_consumer.py
.py
""" Ducktape test for Confluent Kafka Python Consumer Assumes Kafka is already running on localhost:9092 """ import asyncio import json import time import uuid import pytest from ducktape.mark import matrix from ducktape.tests.test import Test from confluent_kafka import Producer from confluent_kafka.schema_registry...
659
28,557
hatch
tests/cli/config/test_find.py
.py
def test(hatch, config_file, helpers): result = hatch("config", "find") assert result.exit_code == 0, result.output assert result.output == helpers.dedent( f""" {config_file.path} """ )
10
227
openvino
tests/samples_tests/smoke_tests/common/specific_samples_parsers.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
61
3,207
sphinx
tests/roots/test-ext-autodoc/target/properties.py
.py
import sys TYPE_CHECKING = False if sys.version_info[:2] < (3, 14) or TYPE_CHECKING: TypeCheckingOnlyName = int class Foo: """docstring""" @property def prop1(self) -> int: """docstring""" @classmethod @property def prop2(cls) -> int: """docstring""" @property d...
34
633
mlflow
mlflow/store/db_migrations/versions/0584bdc529eb_add_cascading_deletion_to_datasets_from_experiments.py
.py
"""add cascading deletion to datasets from experiments Create Date: 2024-11-11 15:27:53.189685 """ import sqlalchemy as sa from alembic import op from mlflow.exceptions import MlflowException from mlflow.store.tracking.dbmodels.models import SqlDataset, SqlExperiment # revision identifiers, used by Alembic. revisi...
87
2,785
onnxruntime
onnxruntime/python/tools/transformers/shape_optimizer.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # This tool is not used directly in bert optimization. It could assist ...
401
15,068
metrics
src/torchmetrics/regression/crps.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...
134
5,096
openvino
src/bindings/python/src/openvino/frontend/pytorch/patch_model.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # mypy: ignore-errors import functools import logging import threading import torch from openvino.frontend.pytorch import ModuleExtension log = logging.getLogger(__name__) def has_been_patched(module, name, or...
628
28,273
probability
tensorflow_probability/python/distributions/half_cauchy_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...
537
21,906
probability
tensorflow_probability/python/experimental/tangent_spaces/simplex_test.py
.py
# Copyright 2023 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
289
8,955
mlflow
tests/store/artifact/test_runs_artifact_repo.py
.py
from unittest import mock from unittest.mock import Mock import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.store.artifact.runs_artifact_repo import RunsArtifactRepository from mlflow.store.artifact.s3_artifact_repo import S3ArtifactRepository from mlflow.store.entities.paged_list i...
169
6,852
openvino
tests/layer_tests/onnx_tests/conftest.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import inspect from common.layer_test_class import get_params def pytest_generate_tests(metafunc): test_gen_attrs_names = list(inspect.signature(get_params).parameters) params = get_params() metafunc.parametrize(test_gen_a...
13
358
hatch
src/hatch/env/internal/test.py
.py
from __future__ import annotations from typing import Any def get_default_config() -> dict[str, Any]: return { "installer": "uv", "dependencies": [ "coverage-enable-subprocess==1.0", "coverage[toml]~=7.11", "pytest~=9.0", "pytest-mock~=3.12", ...
26
794
openvino
src/bindings/python/src/openvino/frontend/paddle/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Package: openvino Low level wrappers for the FrontEnd C++ API. """ # flake8: noqa try: from openvino.frontend.paddle.py_paddle_frontend import ConversionExtensionPaddle as ConversionExtension from openvino.frontend.paddle.p...
16
530
beam
sdks/python/apache_beam/examples/ml-orchestration/tfx/coco_captions_local.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 ...
142
4,801
readthedocs.org
readthedocs/embed/apps.py
.py
"""Embed app config.""" from django.apps import AppConfig class EmbedConfig(AppConfig): name = "readthedocs.embed" verbose_name = "Embedded API"
9
156
mamba
micromamba/tests/test_package.py
.py
import filecmp import platform import shutil import subprocess import tarfile import zipfile from pathlib import Path import pytest import zstandard from conda_package_handling import api as cph from . import helpers @pytest.fixture def cph_test_file(): return Path(__file__).parent / "data" / "cph_test_data-0.0...
196
6,113
mlflow
tests/langgraph/sample_code/langgraph_chat_agent.py
.py
import json import os from typing import Any, Generator, Sequence from langchain_core.language_models import LanguageModelLike from langchain_core.messages import AIMessage, ToolCall from langchain_core.outputs import ChatGeneration, ChatResult from langchain_core.runnables import RunnableConfig, RunnableLambda from l...
152
4,670
pyomo
examples/kernel/mosek/power1.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...
70
2,222
pyomo
pyomo/contrib/pynumero/interfaces/tests/test_utils.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
89
3,528
pyomo
pyomo/common/tee.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...
980
39,695
sphinx
tests/roots/test-changes/conf.py
.py
project = 'Sphinx ChangesBuilder tests' copyright = '2007' version = '0.6' release = '0.6alpha1'
5
97
coremltools
coremltools/models/_deprecation.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import functools import warnings def deprecated(obj=None, suffix="", version="", obj_prefix=""): ""...
36
1,149
pyomo
pyomo/core/tests/unit/test_disable_methods.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...
240
6,974
confluent-kafka-python
tools/unasync.py
.py
#!/usr/bin/env python import argparse import difflib import os import re import subprocess import sys import tempfile # List of directories to convert from async to sync # Each tuple contains the async directory and its sync counterpart # If you add a new _async directory and want the _sync directory to be # generate...
313
12,263
mlflow
mlflow/utils/oss_registry_utils.py
.py
import urllib.parse from mlflow.environment_variables import MLFLOW_UC_OSS_TOKEN from mlflow.exceptions import MlflowException from mlflow.utils.databricks_utils import get_databricks_host_creds from mlflow.utils.rest_utils import MlflowHostCreds from mlflow.utils.uri import ( _DATABRICKS_UNITY_CATALOG_SCHEME, ) ...
30
936
astropy
astropy/table/column.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import warnings import weakref from copy import deepcopy import numpy as np from numpy import ma from astropy.units import Quantity, StructuredUnit, Unit from astropy.utils.compat import NUMPY_LT_2_5 from astropy.utils.console import co...
1,899
69,294
django-cms
cms/test_utils/project/pluginapp/plugins/multicolumn/cms_plugins.py
.py
from cms.api import add_plugin from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from .forms import MultiColumnForm from .models import MultiColumns class MultiColumnPlugin(CMSPluginBase): model = MultiColumns module = "Multi Columns" name = "Multi Columns" render_temp...
42
1,188
onnxruntime
orttraining/orttraining/python/training/ortmodule/_pythonop_helper.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from __future__ import annotations import inspect import onnx import t...
241
9,396
astropy
astropy/nddata/tests/test_nddata_base.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # Tests of NDDataBase from astropy.nddata.nddata_base import NDDataBase class MinimalSubclass(NDDataBase): def __init__(self): super().__init__() @property def data(self): return None @property def mask(self): ...
85
1,562
openvino
tests/layer_tests/onnx_tests/test_lstm.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 TestLSTM(OnnxRuntimeLayerTest): skip_framework = True def create_lstm(self, direction: str, cell_type: str,...
167
5,862
mlflow
mlflow/utils/autologging_utils/metrics_queue.py
.py
import concurrent.futures from threading import RLock from mlflow.entities import Metric from mlflow.tracking.client import MlflowClient _metrics_queue_lock = RLock() _metrics_queue = [] _thread_pool = concurrent.futures.ThreadPoolExecutor( max_workers=1, thread_name_prefix="MlflowMetricsQueue" ) _MAX_METRIC_QUE...
74
2,739
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/count_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 "License");...
85
2,478
django-cms
cms/test_utils/project/templates/inner_dir/custom_templates_2/__init__.py
.py
from django.utils.translation import gettext_lazy as _ TEMPLATES = { 'right_col_two.html': _('Two columns'), 'right_col_three.html': _('Three columns'), }
7
164
textual
docs/examples/app/suspend_process.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import Label class SuspendKeysApp(App[None]): BINDINGS = [Binding("ctrl+z", "suspend_process")] def compose(self) -> ComposeResult: yield Label("Press Ctrl+Z to suspend!") if __name__ == "__main__":...
16
348
wandb
wandb/plot/confusion_matrix.py
.py
from __future__ import annotations from collections.abc import Sequence from typing import TYPE_CHECKING, TypeVar import wandb from wandb import util from wandb.plot.custom_chart import plot_table if TYPE_CHECKING: from wandb.plot.custom_chart import CustomChart T = TypeVar("T") def confusion_matrix( prob...
187
6,366
mlflow
mlflow/entities/assessment_source.py
.py
import warnings from dataclasses import asdict, dataclass from typing import Any from mlflow.entities._mlflow_object import _MlflowObject from mlflow.exceptions import MlflowException from mlflow.protos.assessments_pb2 import AssessmentSource as ProtoAssessmentSource from mlflow.protos.databricks_pb2 import INVALID_PA...
195
6,770
textual
tests/snapshot_tests/snapshot_apps/tab_rename.py
.py
from textual.app import App, ComposeResult from textual.widgets import TabbedContent, TabPane class TabRenameApp(App[None]): def compose(self) -> ComposeResult: with TabbedContent(): yield TabPane("!", id="test") for n in range(5): yield TabPane(str(n) * (n+1)) ...
17
506
saleor
saleor/warehouse/models.py
.py
import itertools import uuid from collections import defaultdict from collections.abc import Iterable from typing import TYPE_CHECKING, TypedDict, TypeVar, cast from django.contrib.postgres.indexes import BTreeIndex from django.db import models from django.db.models import Exists, F, OuterRef, Prefetch, Q, Sum from dj...
690
25,509
onnx
onnx/reference/ops/_quant_utils.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np def reshape_input( value: np.ndarray, shape: tuple[int, ...], axis: int, block_size: int | None = None, ) -> np.ndarray: """Reshape/Replicate scale/zero-point to ...
57
1,907
openvino
tests/e2e_tests/pipelines/pipeline_templates/ir_gen_templates.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from pathlib import Path def common_ir_generation(mo_out, precision, **kwargs): return ("get_ir", {"get_ovc_model": {"mo_out": mo_out, "precision": precision, ...
17
526
coremltools
deps/pybind11/tests/test_exceptions.py
.py
from __future__ import annotations import sys import pytest import env import pybind11_cross_module_tests as cm import pybind11_tests from pybind11_tests import exceptions as m def test_std_exception(msg): with pytest.raises(RuntimeError) as excinfo: m.throw_std_exception() assert msg(excinfo.value...
435
14,573
hatch
backend/src/hatchling/plugin/specs.py
.py
import pluggy hookspec = pluggy.HookspecMarker("hatch") @hookspec def hatch_register_version_source() -> None: """Register new classes that adhere to the version source interface.""" @hookspec def hatch_register_builder() -> None: """Register new classes that adhere to the builder interface.""" @hookspec...
24
565
black
tests/data/cases/pyi_decorated_class_blank_line.py
.py
# flags: --preview --pyi # # Test case for https://github.com/psf/black/issues/4256 # Blank line should be enforced between a function and a decorated class in stubs. def foo(): ... @decorator class Bar: ... def baz(): ... @decorator class Qux: ... class Already: ... @decorator class After: ... @decorator class F...
116
1,621
astropy
astropy/stats/circstats.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains simple functions for dealing with circular statistics, for instance, mean, variance, standard deviation, correlation coefficient, and so on. This module also cover tests of uniformity, e.g., the Rayleigh and V tests. The Maximum L...
615
22,174
onnx
onnx/reference/ops/op_reduce_log_sum.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunReduceNumpy class ReduceLogSum_1(OpRunReduceNumpy): def _run(self, data, axes=None, keepdims=True): tax = tuple(axes) if axes is ...
35
1,093
metrics
src/torchmetrics/regression/r2.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...
188
7,741
mlflow
tests/entities/test_dataset_input.py
.py
from mlflow.entities import Dataset, DatasetInput, InputTag def _check(dataset_input, tags, dataset): assert isinstance(dataset_input, DatasetInput) assert dataset_input.tags == tags assert dataset_input.dataset == dataset def test_creation_and_hydration(): key = "my_key" value = "my_value" ...
33
1,010
mlflow
mlflow/gateway/providers/utils.py
.py
import re import time from contextlib import asynccontextmanager from contextvars import ContextVar from typing import Any, AsyncGenerator from urllib.parse import urlparse, urlunparse from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS from mlflow.gateway.constants import MLFLOW_GATEWAY_AUTH...
245
10,066
wagtail
wagtail/snippets/tests/test_api_v3/test_listing.py
.py
from django.contrib.auth.models import Permission from django.core.management import call_command from django.test import TestCase, TransactionTestCase, override_settings, tag from django.urls import reverse from wagtail.api.v3.tests.base import TestV3Base from wagtail.models import Locale from wagtail.test.testapp.mo...
496
18,532
clearml
clearml/binding/frameworks/megengine_bind.py
.py
import sys from typing import Callable, Union, IO, Any from pathlib2 import Path from ..frameworks import _patched_call, WeightsFileHandler, _Empty from ..frameworks.base_bind import PatchBaseModelIO from ..import_bind import PostImportHookPatching from ...model import Framework class PatchMegEngineModelIO(PatchBas...
177
5,838
sphinx
sphinx/builders/html/__init__.py
.py
"""Several HTML builders.""" from __future__ import annotations import contextlib import html import os import os.path import posixpath import re import shutil import sys from pathlib import Path from types import NoneType from typing import TYPE_CHECKING from urllib.parse import quote import docutils.parsers.rst im...
1,556
61,901
sphinx
tests/test_search.py
.py
"""Test the search index builder.""" from __future__ import annotations import json from io import BytesIO from typing import TYPE_CHECKING import pytest from docutils import frontend, utils from docutils.parsers import rst from sphinx.search import IndexBuilder from tests.utils import TESTS_ROOT if TYPE_CHECKING...
517
17,968
beam
sdks/python/apache_beam/transforms/core.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...
4,360
163,731
astropy
astropy/coordinates/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for celestial coordinates of astronomical objects. It also contains a framework for conversions between coordinate systems. """ from .angles import * from .attributes import * from .baseframe import * fr...
28
763
wagtail
wagtail/utils/sendfile_streaming_backend.py
.py
# Sendfile "streaming" backend # This is based on sendfiles builtin "simple" backend but uses a StreamingHttpResponse import os import stat from email.utils import mktime_tz, parsedate_tz from django.http import FileResponse, HttpResponseNotModified from django.utils.http import http_date def sendfile(request, file...
51
1,389
wagtail
wagtail/blocks/static_block.py
.py
from django import forms from django.utils.functional import cached_property from django.utils.safestring import SafeString from django.utils.translation import gettext as _ from wagtail.admin.staticfiles import versioned_static from wagtail.admin.telepath import Adapter, register from .base import Block __all__ = [...
78
1,974
python-prompt-toolkit
src/prompt_toolkit/layout/utils.py
.py
from __future__ import annotations from collections.abc import Iterable from typing import TYPE_CHECKING, TypeVar, cast, overload from prompt_toolkit.formatted_text.base import OneStyleAndTextTuple if TYPE_CHECKING: from typing_extensions import SupportsIndex __all__ = [ "explode_text_fragments", ] _T = Ty...
82
2,392
saleor
saleor/graphql/product/mutations/product/product_update.py
.py
import graphene from django.core.exceptions import ValidationError from .....attribute import models as attribute_models from .....core.tracing import traced_atomic_transaction from .....discount.utils.promotion import mark_active_catalogue_promotion_rules_as_dirty from .....permission.enums import ProductPermissions ...
157
6,395
mlflow
tests/store/tracking/sqlalchemy_store/test_sqlalchemy_store_mcp_server_registry.py
.py
from unittest import mock import pytest from mlflow.entities.mcp_server import MCPRemoteTransportType, MCPStatus, MCPTool from mlflow.entities.mcp_server_version import ConnectOptionSettings from mlflow.exceptions import MlflowException from mlflow.store.tracking.mcp_server_registry.abstract_mixin import NOT_SET pyt...
2,639
103,657
conda
conda/cli/main_install.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI implementation for `conda install`. Installs the specified packages into an existing environment. """ from __future__ import annotations import sys from typing import TYPE_CHECKING from ..notices import notices if TYPE_CHECKING: ...
162
5,650
wandb
wandb/integration/tensorflow/estimator_hook.py
.py
import tensorflow as tf import wandb from wandb.sdk.lib import telemetry if hasattr(tf.estimator, "SessionRunHook"): # In tf 1.14 and beyond, SessionRunHook is in the estimator package. SessionRunHook = tf.estimator.SessionRunHook SessionRunArgs = tf.estimator.SessionRunArgs else: # In older versions ...
55
1,756
onnx
onnx/backend/test/case/node/hardswish.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 hardswish(x: np.ndarray) -> np.ndarray: alfa = float(1 / 6) beta...
31
734
mlflow
tests/store/tracking/sqlalchemy_store/test_sqlalchemy_store_label_schemas.py
.py
import time import pytest from mlflow.exceptions import MlflowException from mlflow.genai.label_schemas.label_schemas import ( InputCategorical, InputNumeric, InputPassFail, InputText, LabelSchemaType, ) from mlflow.genai.label_schemas.validation import ( DEFAULT_LABEL_SCHEMA_INSTRUCTION, ...
460
16,746
astropy
astropy/time/tests/test_update_leap_seconds.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timedelta from pathlib import Path import erfa import pytest import astropy.time.core from astropy.time import Time, update_leap_seconds from astropy.utils import iers from ...
103
4,037
astropy
astropy/utils/data.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Functions for accessing, downloading, and caching data files.""" import atexit import contextlib import errno import fnmatch import ftplib import functools import hashlib import io import os import re import shutil import sys import urllib.error impor...
2,459
89,313
loguru
tests/exceptions/source/modern/grouped_with_cause_and_context.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", diagnose=True, backtrace=True, colorize=False) def a(): 1 / 0 @logger.catch def main(): try: try: a() except Exception as err: raise ValueError("ContextError") from err except...
44
937
wagtail
wagtail/admin/views/pages/lock.py
.py
import swapper from django.core.exceptions import PermissionDenied from django.urls import reverse from django.utils.translation import gettext as _ from wagtail.admin.views.generic import lock Page = swapper.load_model("wagtailcore", "Page") class PageOperationViewMixin: model = Page pk_url_kwarg = "page_i...
41
1,242
textual
docs/examples/guide/reactivity/computed01.py
.py
from textual.app import App, ComposeResult from textual.color import Color from textual.containers import Horizontal from textual.reactive import reactive from textual.widgets import Input, Static class ComputedApp(App): CSS_PATH = "computed01.tcss" red = reactive(0) green = reactive(0) blue = reacti...
48
1,407
probability
tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_diag.py
.py
# Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`. # DO NOT MODIFY DIRECTLY. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
425
16,631
jupyterlab
jupyterlab/tests/test_registry.py
.py
"""Test yarn registry replacement""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import logging import subprocess from os.path import join as pjoin from unittest.mock import patch from jupyterlab import commands from .test_jupyterlab import AppHandlerTest c...
113
4,323
biopython
Bio/SeqIO/AbiIO.py
.py
# Copyright 2011 by Wibowo Arindrarto (w.arindrarto@gmail.com) # Revisions copyright 2011-2016 by Peter Cock. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included...
606
26,249
pynacl
src/nacl/bindings/crypto_scalarmult.py
.py
# Copyright 2013-2018 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 applicabl...
240
8,243
pyomo
pyomo/contrib/parmest/examples/reactor_design/bootstrap_example.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...
55
1,779
scikit-bio
skbio/util/_decorator.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. # --------------------------------------------...
311
8,913
saleor
saleor/graphql/translations/descriptions.py
.py
class TranslationDescriptions: LANGUAGE_CODE = "A language code to return the translation for {type_name}." DESCRIPTION = "Returns translated {type_name} fields for the given language code."
4
199
onnx
onnx/reference/ops/op_qlinear_matmul.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class QLinearMatMul(OpRun): def _run( self, a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point ): ...
30
894
saleor
saleor/graphql/webhook/schema.py
.py
import graphene from ...permission.auth_filters import AuthorizationFilters from ...permission.enums import AppPermission from ..app.dataloaders import app_promise_callback from ..core import ResolveInfo from ..core.doc_category import DOC_CATEGORY_WEBHOOKS from ..core.fields import BaseField, JSONString, PermissionsF...
78
2,778
black
tests/data/cases/raw_docstring.py
.py
# flags: --skip-string-normalization class C: r"""Raw""" def f(): r"""Raw""" class SingleQuotes: r'''Raw''' class UpperCaseR: R"""Raw""" # output class C: r"""Raw""" def f(): r"""Raw""" class SingleQuotes: r'''Raw''' class UpperCaseR: R"""Raw"""
33
292