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
scikit-bio
skbio/metadata/io.py
.py
"""Contains io functionality for the Metadata module.""" # ---------------------------------------------------------------------------- # Copyright (c) 2016-2023, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this sof...
541
22,250
kafka
tests/kafkatest/tests/connect/connect_distributed_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 ...
1,001
52,470
sphinx
sphinx/util/docutils.py
.py
"""Utility functions for docutils.""" from __future__ import annotations import os import re import warnings from contextlib import contextmanager, nullcontext from copy import copy from pathlib import Path from typing import TYPE_CHECKING import docutils import docutils.frontend import docutils.writers from docutil...
952
31,825
probability
tensorflow_probability/python/sts/components/sum_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...
473
20,046
textual
tests/snapshot_tests/snapshot_apps/option_list_long.py
.py
from textual.app import App, ComposeResult from textual.widgets import OptionList from textual.widgets.option_list import Option class LongOptionListApp(App[None]): def compose(self) -> ComposeResult: yield OptionList(*[Option(f"This is option #{n}") for n in range(100)]) if __name__ == "__main__": ...
13
346
openvino
tests/e2e_tests/common/openvino_resources.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # pylint: disable=import-error,logging-fstring-interpolation,fixme """ The module implements OpenVINOResources class which provide interface for getting paths to various OpenVINO resources (tools, samples, etc) according to product ins...
212
7,668
kombu
examples/simple_eventlet_receive.py
.py
""" Example that sends a single message and exits using the simple interface. You can use `simple_receive.py` (or `complete_receive.py`) to receive the message sent. """ from __future__ import annotations import eventlet from kombu import Connection eventlet.monkey_patch() def wait_many(timeout=1): #: Cre...
44
1,225
sphinx
tests/test_directives/test_directive_code.py
.py
"""Test the code-block directive.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING import pygments import pytest from docutils import nodes from sphinx.config import Config from sphinx.directives.code import LiteralIncludeReader from sphinx.testing.util import etree_pa...
634
22,968
openvino
src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # mypy: ignore-errors from typing import Optional, Any from openvino import Core def _get_device(options) -> Optional[Any]: core = Core() device = "CPU" if options is not None and "device" in optio...
89
2,520
openvino
tests/layer_tests/jax_tests/test_sqrt.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import jax import numpy as np import pytest from jax import numpy as jnp from jax_layer_test_class import JaxLayerTest rng = np.random.default_rng(34455) class TestSqrt(JaxLayerTest): def _prepare_input(self): if np.issub...
44
1,420
gunicorn
gunicorn/errors.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # We don't need to call super() in __init__ methods of our # BaseException and Exception classes because we also define # our own __str__ methods so there is no need to pass 'message' # to the base class to get a m...
29
897
saleor
saleor/graphql/product/mutations/product_type/__init__.py
.py
from .product_type_create import ProductTypeCreate from .product_type_delete import ProductTypeDelete from .product_type_update import ProductTypeUpdate __all__ = ["ProductTypeCreate", "ProductTypeDelete", "ProductTypeUpdate"]
6
228
astropy
astropy/units/format/unicode_format.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "Unicode" unit format. """ from typing import ClassVar from astropy.units.core import NamedUnit from astropy.units.typing import UnitPower from . import console class Unicode(console.Console): """ Output-only format to display...
72
2,010
confluent-kafka-python
tests/test_AIOConsumer.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import asyncio import concurrent.futures from unittest.mock import Mock, patch import pytest from confluent_kafka import KafkaError, KafkaException, TopicPartition from confluent_kafka.aio._AIOConsumer import AIOConsumer class TestAIOConsumer: """Unit tests for AIOC...
174
6,896
hatch
tests/cli/new/test_new.py
.py
import pytest from hatch.config.constants import ConfigEnvVars def remove_trailing_spaces(text): return "".join(f"{line.rstrip()}\n" for line in text.splitlines(True)) class TestErrors: def test_path_is_file(self, hatch, temp_dir): with temp_dir.as_cwd(): path = temp_dir / "foo" ...
638
17,491
astropy
astropy/coordinates/representation/__init__.py
.py
""" In this module, we define the coordinate representation classes, which are used to represent low-level cartesian, spherical, cylindrical, and other coordinates. """ from .base import BaseDifferential, BaseRepresentation, BaseRepresentationOrDifferential from .cartesian import CartesianDifferential, CartesianRepres...
67
2,025
readthedocs.org
readthedocs/builds/storage.py
.py
from django.contrib.staticfiles.storage import StaticFilesStorage as BaseStaticFilesStorage from readthedocs.storage.filesystem import RTDFileSystemStorage class BuildMediaFileSystemStorage(RTDFileSystemStorage): # Root path of the nginx internal redirect # that will serve files from this storage. intern...
16
551
mlflow
mlflow/store/artifact/r2_artifact_repo.py
.py
from urllib.parse import urlparse from mlflow.store.artifact.optimized_s3_artifact_repo import OptimizedS3ArtifactRepository from mlflow.store.artifact.s3_artifact_repo import _get_s3_client class R2ArtifactRepository(OptimizedS3ArtifactRepository): """Stores artifacts on Cloudflare R2.""" def __init__( ...
74
2,836
beam
sdks/python/apache_beam/io/gcp/bigquery_write_it_test.py
.py
#!/usr/bin/env python # -*- 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,...
677
22,786
mlflow
tests/utils/test_environment.py
.py
import importlib.metadata import os from unittest import mock import pytest import yaml from mlflow.exceptions import MlflowException from mlflow.utils.environment import ( _contains_mlflow_requirement, _deduplicate_requirements, _get_pip_deps, _get_pip_requirement_specifier, _is_mlflow_requiremen...
497
20,777
clearml
examples/frameworks/pytorch/pytorch_model_update.py
.py
from pathlib import Path import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision.datasets as datasets import torchvision.transforms as transforms from ignite.contrib.handlers import TensorboardLogger from ignite.engine import Eve...
251
8,036
sphinx
sphinx/__main__.py
.py
"""The Sphinx documentation toolchain.""" from __future__ import annotations import sys from sphinx.cmd.build import main raise SystemExit(main(sys.argv[1:]))
10
163
hatch
src/hatch/cli/check/code.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import click if TYPE_CHECKING: from hatch.cli.application import Application @click.command(short_help="Perform static analysis", context_settings={"ignore_unknown_options": True}) @click.argument("args", nargs=-1) @click.option("--fix", is_fl...
75
2,789
tablib
tests/test_tablib_dbfpy_packages_fields.py
.py
#!/usr/bin/env python """Tests for tablib._vendor.dbfpy.""" import unittest from tablib._vendor.dbfpy import fields class DbfFieldDefTestCompareCase(unittest.TestCase): """dbfpy.fields.DbfFieldDef comparison test cases, via child classes.""" def setUp(self) -> None: self.length = 10 self.a ...
43
1,206
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Shape.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from functools import partial import numpy as np import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest from common.utils.tflite_utils import parametrize_tests test_params = [ {'shape': [1...
52
1,802
conda
tests/conftest.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import logging import shutil from pathlib import Path from typing import TYPE_CHECKING import pytest import conda from conda import plugins from conda.base.constants import APP_NAME from conda.base.context ...
336
10,160
scikit-bio
skbio/sequence/tests/test_nucleotide_sequences.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. # --------------------------------------------...
519
21,247
sphinx
tests/roots/test-html_style/conf.py
.py
html_style = 'default.css' html_static_path = ['_static']
3
58
mlflow
examples/open_webui/mlflow_filter_pipeline.py
.py
# ruff: noqa """ title: MLflow Filter Pipeline author: open-webui date: 2026-04-20 version: 0.0.1 license: MIT description: A filter pipeline that uses MLflow for tracing multi-turn chat sessions. requirements: mlflow>=2.14.0 """ from typing import List, Optional import os import re import uuid from utils.pipelines.m...
162
6,093
saleor
saleor/discount/utils/manual_discount.py
.py
from decimal import ROUND_HALF_UP, Decimal from functools import partial from typing import TypeVar from prices import Money, TaxedMoney, fixed_discount, percentage_discount from ...core.prices import quantize_price from ...core.taxes import zero_money from .. import DiscountValueType from ..models import OrderDiscou...
56
1,872
beam
playground/infrastructure/test_logger.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 ...
25
1,051
openvino
cmake/developer_package/check_python_requirements.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re import os from importlib.metadata import PackageNotFoundError, version as _installed_version from packaging.requirements import Requirement def check_python_requirements(requirements_path: str) -> None: """ Checks if...
83
3,410
probability
spinoffs/inference_gym/inference_gym/internal/data.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...
758
31,444
probability
tensorflow_probability/python/internal/structural_tuple.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...
172
6,064
pyomo
pyomo/contrib/solver/tests/unit/test_results.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...
255
9,418
scikit-optimize
benchmarks/bench_ml.py
.py
""" This code implements benchmark for the black box optimization algorithms, applied to a task of optimizing parameters of ML algorithms for the task of supervised learning. The code implements benchmark on 4 datasets where parameters for 6 classes of supervised models are tuned to optimize performance on datasets. S...
435
15,648
bazel
third_party/py/abseil/absl/command_name.py
.py
# Copyright 2017 The Abseil Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
64
2,262
probability
tensorflow_probability/python/bijectors/gumbel_cdf.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...
139
4,946
loguru
tests/test_type_hinting.py
.py
import sys import pytest try: mypy_api = None # type: Optional[ModuleType] import mypy.api as mypy_api # noqa: F811 except ImportError: pass @pytest.mark.skipif(mypy_api is None, reason="Requires mypy to be installed.") def test_mypy_import(): # Check stub file is valid and can be imported by Mypy...
19
568
qutip
qutip/solver/stochastic.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ["smesolve", "SMESolver", "ssesolve", "SSESolver"] import numpy as np from numpy.typing import ArrayLike from numpy.random import SeedSequence from typing import Any, Callable, Literal, overload from functools import par...
1,136
41,390
wandb
wandb/sdk/launch/builder/kaniko_builder.py
.py
from __future__ import annotations import asyncio import base64 import copy import json import logging import os import shutil import tarfile import tempfile import time import traceback from typing import Any import wandb from wandb.sdk.launch.agent.job_status_tracker import JobAndRunStatusTracker from wandb.sdk.lau...
597
23,926
saleor
saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py
.py
from decimal import Decimal from unittest.mock import patch import graphene import pytest from graphene import Node from .....checkout import calculations from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from .....checkout.models import Checkout, CheckoutDelivery from .....checkout.utils impo...
1,834
50,609
probability
tensorflow_probability/python/optimizer/bfgs_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...
651
25,447
openvino
tests/layer_tests/pytorch_tests/test_index.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np import torch from pytorch_layer_test_class import PytorchLayerTest class TestIndex(PytorchLayerTest): def _prepare_input(self, input_shape, idx=None): x = self.random.randn(*input_shape) ...
184
6,972
wandb
tests/system_tests/test_functional/metaflow/flow_decostep.py
.py
"""Test Metaflow Flow integration""" import os import pathlib import pandas as pd import wandb from metaflow import FlowSpec, Parameter, step from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from wandb.integration.metaf...
60
1,686
luigi
test/priority_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...
57
1,591
beam
sdks/python/apache_beam/io/gcp/bigquery_write_perf_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...
108
3,920
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_reduce_min.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # reduce_min paddle model generator # import numpy as np import sys from save_model import saveModel def reduce_min(name : str, x, axis=None, keepdim=False): import paddle paddle.enable_static() with paddle.static.progr...
47
1,475
saleor
saleor/graphql/product/enums.py
.py
from typing import Final import graphene from ...product import ProductMediaTypes, ProductTypeKind from ..core.doc_category import DOC_CATEGORY_PRODUCTS from ..core.enums import to_enum from ..core.types import BaseEnum ProductTypeKindEnum: Final[graphene.Enum] = to_enum(ProductTypeKind) ProductTypeKindEnum.doc_cate...
65
1,470
openvino
src/bindings/python/src/openvino/opset2/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for all openvino ops.""" from typing import Optional, Union import numpy as np from functools import partial import warnings from openvino import Node, Shape from openvino.op import Constant...
217
7,648
onnxruntime
orttraining/orttraining/python/training/ortmodule/graph_optimizer_registry.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from collections.abc import Callable from onnx.onnx_ml_pb2 import Graph...
48
1,982
rq
rq/serializers.py
.py
from __future__ import annotations import json import pickle from collections.abc import Callable from functools import partial from typing import Any, ClassVar, Protocol, cast, runtime_checkable from .utils import import_attribute @runtime_checkable class Serializer(Protocol): def dumps(self, obj: Any, /) -> b...
68
2,040
pyro
pyro/contrib/tracking/measurements.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from abc import ABCMeta, abstractmethod import torch from pyro.distributions.util import eye_like class Measurement(object, metaclass=ABCMeta): """ Gaussian measurement interface. :param mean: mean of measurement d...
154
4,544
mlflow
tests/store/tracking/sqlalchemy_store/test_sqlalchemy_store_query_trace_metrics.py
.py
import json import uuid from dataclasses import asdict from datetime import datetime, timezone import numpy as np import pytest from opentelemetry import trace as trace_api from mlflow.entities import ( Assessment, AssessmentSource, AssessmentSourceType, Expectation, Feedback, trace_location, ...
5,071
172,617
onnxruntime
onnxruntime/test/python/transformers/model_loader.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 ...
70
2,593
textual
tests/snapshot_tests/snapshot_apps/visibility.py
.py
from textual.app import App from textual.containers import VerticalScroll from textual.widgets import Static class Visibility(App): """Check that visibility: hidden also makes children invisible;""" CSS = """ Screen { layout: horizontal; } VerticalScroll { width: 1fr; ...
48
961
wagtail
wagtail/api/v3/apps.py
.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class WagtailAPIV3AppConfig(AppConfig): name = "wagtail.api.v3" label = "wagtailapi_v3" verbose_name = _("Wagtail API v3") def ready(self): from wagtail.api.rich_text import APIRichText APIRichTe...
14
339
beam
infra/enforcement/account_keys.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 ...
598
27,609
ipython
tests/test_ptutils.py
.py
"""Tests for IPython.terminal.ptutils.""" import os import sys import pytest from IPython.testing.decorators import skip_win32 from unittest.mock import Mock, patch from prompt_toolkit.document import Document from IPython.core.completer import provisionalcompleter from IPython.terminal.ptutils import ( IPytho...
263
8,865
luigi
luigi/contrib/redis_store.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...
99
3,014
lemur
lemur/authorities/service.py
.py
""" .. module: lemur.authorities.service :platform: Unix :synopsis: This module contains all of the services level functions used to administer authorities in Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glis...
278
8,386
mlflow
mlflow/utils/data_utils.py
.py
import urllib.parse from typing import Any def parse_s3_uri(uri): """Parse an S3 URI, returning (bucket, path)""" parsed = urllib.parse.urlparse(uri) if parsed.scheme != "s3": raise Exception(f"Not an S3 URI: {uri}") path = parsed.path path = path.removeprefix("/") return parsed.netloc...
27
609
pdm
src/pdm/cli/commands/run.py
.py
from __future__ import annotations import argparse import contextlib import os import re import shlex import signal import subprocess import sys from collections.abc import Mapping, Sequence from functools import partial from pathlib import Path from typing import TYPE_CHECKING, NamedTuple, cast from rich import prin...
574
23,400
luigi
test/wrap_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...
102
2,874
saleor
saleor/graphql/meta/mutations/base.py
.py
import graphene from django.core.exceptions import ValidationError from graphql.error.base import GraphQLError from ....attribute import models as attribute_models from ....checkout import models as checkout_models from ....core import models from ....core.db.connection import allow_writer from ....core.error_codes im...
283
10,331
ipython
IPython/sphinxext/custom_doctests.py
.py
""" Handlers for IPythonDirective's @doctest pseudo-decorator. The Sphinx extension that provides support for embedded IPython code provides a pseudo-decorator @doctest, which treats the input/output block as a doctest, raising a RuntimeError during doc generation if the actual output (after running the input) does no...
156
4,631
mlflow
mlflow/genai/judges/adapters/utils.py
.py
"""Shared utilities for judge adapters.""" from __future__ import annotations import time from typing import TYPE_CHECKING, Any import requests if TYPE_CHECKING: from mlflow.genai.judges.adapters.base_adapter import BaseJudgeAdapter from mlflow.types.llm import ChatMessage from mlflow.environment_variables...
180
5,908
attrs
src/attr/_next_gen.py
.py
# SPDX-License-Identifier: MIT """ These are keyword-only APIs that call `attr.s` and `attr.ib` with different default values. """ from functools import partial from . import setters from ._funcs import asdict as _asdict from ._funcs import astuple as _astuple from ._make import ( _DEFAULT_ON_SETATTR, NOTHIN...
679
26,392
textual
src/textual/widgets/_digits.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, cast from rich.align import Align, AlignMethod if TYPE_CHECKING: from textual.app import RenderResult from textual.geometry import Size from textual.renderables.digits import Digits as DigitsRenderable from textual.selection import Selection f...
113
3,478
tablib
src/tablib/formats/_html.py
.py
""" Tablib - HTML export support. """ __lazy_modules__ = {"xml", "xml.etree"} from html.parser import HTMLParser from xml.etree import ElementTree as ET class HTMLFormat: BOOK_ENDINGS = 'h3' title = 'html' extensions = ('html', ) @classmethod def export_set(cls, dataset): """HTML repre...
120
3,708
metrics
tests/unittests/classification/test_precision_recall.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...
787
32,722
saleor
saleor/tests/e2e/checkout/test_checkout_complete_store_address_in_customer_addresses_after_updating_the_address.py
.py
import pytest from .. import ADDRESS_DE, DEFAULT_ADDRESS from ..account.utils import get_own_data from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assert_address_data, assign_permissions from .utils import ( checkout_comp...
141
4,641
gunicorn
examples/dirty_example/gunicorn_conf.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Gunicorn configuration for Dirty Workers Example Run with: cd examples/dirty_example gunicorn wsgi_app:app -c gunicorn_conf.py """ # Basic settings # Use 0.0.0.0 for Docker, override with GUNICORN_BIN...
63
1,449
pyomo
pyomo/contrib/piecewise/tests/test_incremental.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...
206
8,711
rq
rq/worker_registration.py
.py
from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from redis import Redis from redis.client import Pipeline from .queue import Queue from .worker import BaseWorker from rq.utils import split_list from .utils import as_text WORKERS_BY_QUEUE_KEY = 'rq:workers:%s' ...
108
3,145
mlflow
mlflow/tracking/_tracking_service/utils.py
.py
import importlib import logging import os from collections import OrderedDict from contextlib import contextmanager from functools import lru_cache, partial from pathlib import Path from typing import Generator from urllib.parse import unquote from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES, MLFLOW_T...
350
12,309
wandb
wandb/_analytics.py
.py
from __future__ import annotations from collections.abc import Callable from contextvars import ContextVar from dataclasses import dataclass, field from functools import wraps from typing import Final, TypeVar from uuid import UUID, uuid4 from typing_extensions import ParamSpec from wandb._strutils import nameof P ...
67
2,013
astropy
astropy/nddata/nddata_withmixins.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements a class based on NDData with all Mixins. """ from .mixins.ndarithmetic import NDArithmeticMixin from .mixins.ndio import NDIOMixin from .mixins.ndslicing import NDSlicingMixin from .nddata import NDData __all__ = ["NDDataRef"]...
70
2,209
beam
sdks/python/apache_beam/tools/runtime_type_check_microbenchmark.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 ...
126
4,522
hydra
tests/standalone_apps/discovery_test_plugin/tests/test_discovery.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os from pathlib import Path from hydra.core.plugins import Plugins from hydra.plugins.plugin import Plugin def test_number_of_imports(tmpdir: Path) -> None: os.environ["TMP_FILE"] = str(tmpdir / "import.log") # Tests that this plug...
28
939
mlflow
tests/genai/evaluate/test_session_utils.py
.py
from unittest.mock import Mock, patch import pytest import mlflow from mlflow.entities import TraceData, TraceInfo, TraceLocation, TraceState from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceType from mlflow.entities.trace import Trace fro...
564
19,171
jupytext
src/jupytext/sync_contentsmanager.py
.py
""" This file is automatically generated by tests/functional/contents_manager/test_async_and_sync_contents_manager_are_in_sync.py Do not edit this file manually. """ """ This module exposes the TextFileContentsManager that allows to open text files as notebooks """ import inspect import itertools import os try: ...
771
30,767
saleor
saleor/graphql/product/bulk_mutations/product_bulk_delete.py
.py
from collections import defaultdict import graphene from django.conf import settings from django.core.exceptions import ValidationError from django.db import transaction from django.db.models.expressions import Exists, OuterRef from ....attribute import AttributeInputType from ....attribute import models as attribute...
138
5,268
omegaconf
omegaconf/basecontainer.py
.py
import copy import sys from abc import ABC, abstractmethod from enum import Enum from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Tuple, Union import yaml from ._utils import ( _DEFAULT_MARKER_, ValueKind, _ensure_container, _find_eq, _get_value, _is_interpolation, _i...
1,227
47,142
saleor
saleor/plugins/manager.py
.py
from collections import defaultdict from collections.abc import Callable, Iterable from decimal import Decimal from typing import TYPE_CHECKING, Any, Optional, Union from django.conf import settings from django.http import HttpResponse, HttpResponseNotFound from django.utils.module_loading import import_string from pr...
2,877
109,949
pdm
tests/fixtures/projects/demo-failure-no-dep/setup.py
.py
from setuptools import setup if True: raise RuntimeError("This mimics the build error on unmatched platform") setup( name="demo", version="0.0.1", description="test demo", py_modules=["demo"], python_requires=">=3.3", )
13
246
pyomo
pyomo/solvers/tests/models/LP_unbounded.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...
71
2,328
coremltools
coremltools/test/neural_network/test_quantization.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 """ Module containing unit tests for verifying various quantizations. """ import itertools import unitt...
681
23,412
openvino
tests/e2e_tests/common/plugins/common/conftest.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Basic high-level plugin file for pytest. See [Writing plugins](https://docs.pytest.org/en/latest/writing_plugins.html) for more information. This plugin adds the following command-line options: * `--modules` - Paths to modules to ...
612
21,318
confluent-kafka-python
src/confluent_kafka/schema_registry/confluent/meta_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: confluent/meta.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 symbol_database as _s...
40
2,510
luigi
luigi/contrib/hadoop.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,036
37,108
coremltools
coremltools/converters/mil/mil/ops/defs/iOS15/linear.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 import numpy as np from coremltools.converters.mil.mil import ( DefaultInputs, InputSpec, ...
360
13,351
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/exp_canon.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...
34
1,204
scikit-bio
skbio/sequence/tests/test_distance.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. # --------------------------------------------...
1,091
37,000
pyomo
pyomo/contrib/preprocessing/plugins/init_vars.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...
84
3,274
cvxpy
cvxpy/atoms/elementwise/pos.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...
26
762
textual
docs/examples/widgets/select_from_values_widget.py
.py
from textual import on from textual.app import App, ComposeResult from textual.widgets import Header, Select LINES = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me.""".splitlines() class Select...
27
652
wagtail
wagtail/contrib/settings/forms.py
.py
from django import forms from django.contrib.auth import get_permission_codename from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.template.loader import render_to_string from django.urls import reverse from django.utils.text import capfirst from dj...
126
4,392
ipython
IPython/external/qt_for_kernel.py
.py
"""Import Qt in a manner suitable for an IPython kernel. This is the import used for the `gui=qt` or `matplotlib=qt` initialization. Import Priority: if Qt has been imported anywhere else: use that if matplotlib has been imported and doesn't support v2 (<= 1.0.1): use PyQt4 @v1 Next, ask QT_API env variable...
125
3,442
onnxruntime
onnxruntime/test/python/transformers/test_onnx_attention/test_tensorscatter_attention.py
.py
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """ Te...
2,191
102,859