repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
mlflow
mlflow/tracking/context/jupyter_notebook_context.py
.py
import json import os from collections.abc import Generator from functools import lru_cache from pathlib import Path from typing import Any from urllib.request import urlopen from mlflow.entities import SourceType from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils.databricks_util...
224
6,324
readthedocs.org
readthedocs/builds/apps.py
.py
"""Django configuration for readthedocs.builds application.""" import structlog from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ log = structlog.get_logger(__name__) class Config(AppConfig): name = "readthedocs.builds" label = "builds" verbose_name = _("Builds") ...
19
450
pyomo
examples/pyomo/sos/basic_sos2_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...
86
2,894
sqlmap
plugins/dbms/cache/takeover.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): def osCmd(s...
29
966
textual
docs/examples/widgets/list_view.py
.py
from textual.app import App, ComposeResult from textual.widgets import Footer, Label, ListItem, ListView class ListViewExample(App): CSS_PATH = "list_view.tcss" def compose(self) -> ComposeResult: yield ListView( ListItem(Label("One")), ListItem(Label("Two")), List...
20
446
textual
src/textual/demo/home.py
.py
from __future__ import annotations import asyncio from importlib.metadata import version try: import httpx HTTPX_AVAILABLE = True except ImportError: HTTPX_AVAILABLE = False from textual import work from textual.app import ComposeResult from textual.containers import Horizontal, Vertical, VerticalScroll...
269
8,588
scikit-bio
skbio/io/format/fasta.py
.py
r"""FASTA/QUAL format (:mod:`skbio.io.format.fasta`) ================================================ .. currentmodule:: skbio.io.format.fasta The FASTA file format (``fasta``) stores biological (i.e., nucleotide or protein) sequences in a simple plain text format that is both human-readable and easy to parse. The fi...
1,086
38,059
sqlmap
lib/parse/cmdline.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from __future__ import print_function import os import re import shlex import sys try: from optparse import OptionError as ArgumentError from optparse import OptionGroup...
1,239
56,089
readthedocs.org
readthedocs/analytics/proxied_api.py
.py
"""Analytics views that are served from the same domain as the docs.""" from functools import lru_cache from urllib.parse import urlparse import structlog from django.http import JsonResponse from django.shortcuts import get_object_or_404 from rest_framework import status as status_codes from rest_framework.response ...
152
5,359
saleor
saleor/graphql/account/mutations/account/account_address_create.py
.py
from typing import cast import graphene from .....account import models, search, utils from .....account.utils import ( remove_the_oldest_user_address_if_address_limit_is_reached, ) from .....core.tracing import traced_atomic_transaction from .....permission.auth_filters import AuthorizationFilters from .....webh...
110
4,319
kafka
release/test_docker_trigger_interactive.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...
105
3,579
saleor
saleor/graphql/tests/test_tracing.py
.py
import datetime import hashlib import json from unittest.mock import MagicMock, patch import graphene import pytest from django.test import override_settings from opentelemetry.semconv._incubating.attributes import graphql_attributes from opentelemetry.trace import StatusCode from requests_hardened import HTTPSession ...
725
18,215
mlflow
mlflow/store/entities/paged_list.py
.py
from typing import TypeVar T = TypeVar("T") class PagedList(list[T]): """ Wrapper class around the base Python `List` type. Contains an additional `token` string attribute that can be passed to the pagination API that returned this list to fetch additional elements, if any are available """ ...
19
473
black
tests/data/cases/torture.py
.py
importA;() << 0 ** 101234234242352525425252352352525234890264906820496920680926538059059209922523523525 # assert sort_by_dependency( { "1": {"2", "3"}, "2": {"2a", "2b"}, "3": {"3a", "3b"}, "2a": set(), "2b": set(), "3a": set(), "3b": set() } ) == ["2a", "2b", "2", "3a", "3b", "3", "1"] import...
92
2,279
mlflow
mlflow/autogen/chat.py
.py
import logging from typing import TYPE_CHECKING, Union from opentelemetry.sdk.trace import Span from mlflow.tracing.utils import set_span_chat_tools from mlflow.types.chat import ChatTool if TYPE_CHECKING: from autogen_core.tools import BaseTool, ToolSchema _logger = logging.getLogger(__name__) def log_tools(...
38
1,054
pyfilesystem2
tests/test_info.py
.py
from __future__ import unicode_literals import unittest from datetime import datetime from fs.enums import ResourceType from fs.info import Info from fs.permissions import Permissions from fs.time import datetime_to_epoch try: from datetime import timezone except ImportError: from fs._tzcompat import timezon...
133
4,581
sqlmap
tests/test_sqlalchemy.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission The SQLAlchemy '-d' connector wrapper (lib/utils/sqlalchemy.py). The absolute SQLite path must map to 'sqlite:///' + abspath: an extra slash yields the db '//path' (tolerated only on ...
70
2,084
flit
flit_core/flit_core/__init__.py
.py
"""Flit's core machinery for building packages. This package provides a standard PEP 517 API to build packages using Flit. All the convenient development features live in the main 'flit' package. """ __version__ = '4.0.2'
8
224
pyomo
pyomo/core/base/indexed_component_slice.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...
946
41,755
omegaconf
omegaconf/resolvers/oc/__init__.py
.py
import os import string import warnings from typing import Any, Optional from omegaconf import Container, Node from omegaconf._utils import _DEFAULT_MARKER_, _get_value from omegaconf.basecontainer import BaseContainer from omegaconf.errors import ConfigKeyError from omegaconf.grammar_parser import parse from omegacon...
114
3,548
readthedocs.org
readthedocs/api/v2/views/task_views.py
.py
"""Endpoints relating to task/job status, etc.""" import structlog from django.core.cache import cache from django.urls import reverse from rest_framework import decorators from rest_framework import permissions from rest_framework.renderers import JSONRenderer from rest_framework.response import Response from readth...
55
1,681
metrics
src/torchmetrics/regression/kl_divergence.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...
173
6,672
probability
tensorflow_probability/python/sts/fitting_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...
378
14,856
openvino
tests/layer_tests/pytorch_tests/test_hann_window.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestHannWindow(PytorchLayerTest): def _prepare_input(self, window_size, out=False, out_dtype="float32"): import numpy as np if not out: ...
84
3,110
pyomo
examples/dae/PDE_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...
103
2,897
clearml
clearml/automation/hpbandster/bandster.py
.py
import sys from logging import getLogger from time import sleep, time from typing import Optional, Sequence, Any from ..optimization import Objective, SearchStrategy from ..parameters import ( DiscreteParameterRange, UniformParameterRange, RandomSeed, UniformIntegerParameterRange, Parameter, ) from...
458
20,815
hatch
tests/workspaces/test_config.py
.py
import pytest @pytest.mark.requires_internet class TestWorkspaceConfiguration: def test_workspace_members_editable_install(self, temp_dir, hatch): """Test that workspace members are installed as editable packages.""" workspace_root = temp_dir / "workspace" workspace_root.mkdir() w...
831
23,346
metrics
src/torchmetrics/functional/image/arniqa.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...
280
12,220
cvxpy
cvxpy/tests/test_matrix_utilities.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
62
2,340
jupytext
tests/functional/simple_notebooks/test_read_simple_rust.py
.py
from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook import jupytext from jupytext.compare import compare, compare_notebooks def test_read_magics(text="// :vars\n"): nb = jupytext.reads(text, "rs") compare_notebooks(nb, new_notebook(cells=[new_code_cell(":vars")])) compare(jupyte...
88
2,011
eve
eve/methods/put.py
.py
# -*- coding: utf-8 -*- """ eve.methods.put ~~~~~~~~~~~~~~~ This module implements the PUT method. :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from cerberus.validator import DocumentError from flask import abort from flask import current_app as app fr...
251
10,057
beam
sdks/python/apache_beam/coders/proto2_coder_test_messages_pb2.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...
66
4,169
black
tests/data/cases/pep_654_style.py
.py
# flags: --minimum-version=3.11 try: raise OSError("blah") except * ExceptionGroup as e: pass try: async with trio.open_nursery() as nursery: # Make two concurrent calls to child() nursery.start_soon(child) nursery.start_soon(child) except *ValueError: pass try: ...
113
2,065
wagtail
wagtail/images/shortcuts.py
.py
from wagtail.images.models import SourceImageIOError def get_rendition_or_not_found(image, specs): """ Tries to get / create the rendition for the image or renders a not-found image if it does not exist. :param image: AbstractImage :param specs: str or Filter :return: Rendition """ try: ...
43
1,532
textual
docs/examples/guide/styles/outline01.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static TEXT = """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. And when it has gone past, I will turn the inner eye to see i...
28
773
omegaconf
tests/test_struct.py
.py
import re from typing import Any, Dict from pytest import mark, raises from omegaconf import OmegaConf from omegaconf.errors import ConfigKeyError def test_struct_default() -> None: c = OmegaConf.create() assert OmegaConf.is_struct(c) is None def test_struct_set_on_dict() -> None: c = OmegaConf.create...
72
1,960
probability
spinoffs/inference_gym/inference_gym/targets/probit_regression.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...
175
6,080
saleor
saleor/csv/utils/export.py
.py
import datetime import uuid from tempfile import NamedTemporaryFile from typing import IO, TYPE_CHECKING, Any import petl as etl from django.conf import settings from django.utils import timezone from ...core.db.connection import allow_writer from ...core.utils.batches import queryset_in_batches from ...discount.mode...
279
8,380
gunicorn
examples/frameworks/pyramidapp.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from pyramid.config import Configurator from pyramid.response import Response def hello_world(request): return Response('Hello world!') def goodbye_world(request): return Response('Goodbye world!') confi...
18
444
beam
sdks/python/apache_beam/typehints/typehints_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...
2,018
74,753
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_expand_v2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # expand_v2 paddle model generator # import numpy as np from save_model import saveModel import paddle import sys data_type = 'float32' def expand_v2(name: str, x, shape: list): paddle.enable_static() with paddle.static.pro...
168
5,980
pyomo
pyomo/contrib/mpc/examples/cstr/tests/test_mpc.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...
126
3,618
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/radon_contextual_effects_indiana_halfnormal.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...
363
9,186
mlflow
mlflow/gateway/uc_function_utils.py
.py
# TODO: Move this in mlflow/gateway/utils/uc_functions.py import json import re from dataclasses import dataclass from io import StringIO from typing import TYPE_CHECKING, Any, Literal if TYPE_CHECKING: from databricks.sdk import WorkspaceClient from databricks.sdk.service.catalog import FunctionInfo, Functio...
347
12,558
onnxruntime
onnxruntime/test/python/quantization/test_op_where.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 un...
155
5,939
wagtail
wagtail/contrib/forms/tests/utils.py
.py
from wagtail.test.testapp.models import ( FormField, FormFieldWithCustomSubmission, FormPage, FormPageWithCustomSubmission, FormPageWithRedirect, RedirectFormField, ) from wagtail.test.utils import Page def make_form_page(**kwargs): kwargs.setdefault("title", "Contact us") kwargs.setde...
225
6,047
saleor
saleor/account/tests/test_account_command.py
.py
import os from unittest import mock from django.core.management import call_command from ..models import Group, User def test_createsuperuser_command(db): # given # when call_command("createsuperuser", email="testAdmin@example.com", interactive=False) # then assert User.objects.count() == 1 ...
54
1,422
wandb
tests/unit_tests/test_sender.py
.py
from unittest.mock import MagicMock import yaml from wandb.sdk.internal.sender import SendManager from wandb.sdk.internal.settings_static import SettingsStatic def test_config_save_preserve_order(tmp_path, test_settings): config_file = tmp_path / "config.yaml" settings = test_settings({"x_files_dir": str(tmp...
25
738
astropy
astropy/io/ascii/fastbasic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import re from astropy.table import Table from astropy.utils.misc import _set_locale from . import core, cparser class FastBasic(metaclass=core.MetaBaseReader): """ This class is intended to handle the same format addressed by the ...
427
16,272
textual
tests/text_area/test_code_editor.py
.py
import inspect from textual.widgets import TextArea def test_code_editor_parameters_kept_up_to_date(): """Meta test to ensure the `TextArea.code_editor` convenience constructor is kept up to date with changes to the `TextArea.__init__` parameters. """ text_area_params = inspect.signature(TextArea.__i...
19
734
clearml
clearml/storage/size.py
.py
import re import math from enum import Enum from typing import Union, Tuple, Dict, Set FORMATTING_BASES = { "binary": 1024, "decimal": 1000, } BINARY_SCALE: Tuple[str] = ("B", "KiB", "MiB", "GiB", "TiB", "PiB") DECIMAL_SCALE: Tuple[str] = ("B", "KB", "MB", "GB", "TB", "PB") def format_size( size_in_bytes...
182
5,908
textual
docs/examples/widgets/vertical_rules.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import Label, Rule class VerticalRulesApp(App): CSS_PATH = "vertical_rules.tcss" def compose(self) -> ComposeResult: with Horizontal(): yield Label("solid") yield Rule(ori...
28
917
astropy
astropy/cosmology/_src/scipy_compat.py
.py
"""Scipy compatibility.""" __all__ = ("ellipkinc", "hyp2f1", "quad") from typing import Any, Never from astropy.utils.compat.optional_deps import HAS_SCIPY if HAS_SCIPY: from scipy.integrate import quad from scipy.special import ellipkinc, hyp2f1 else: def quad(*args: Any, **kwargs: Any) -> Never: ...
23
635
saleor
saleor/graphql/metrics.py
.py
import time from collections.abc import Iterator from contextlib import AbstractContextManager, contextmanager from django.conf import settings from opentelemetry.semconv._incubating.attributes import graphql_attributes from opentelemetry.semconv.attributes import error_attributes from opentelemetry.util.types import ...
212
6,127
lemur
lemur/common/redis.py
.py
""" Helper Class for Redis """ import redis import sys from flask import current_app from sentry_sdk import capture_exception from lemur.factory import create_app if current_app: flask_app = current_app else: flask_app = create_app() class RedisHandler: def __init__(self, host=flask_app.config.get('RED...
54
1,532
clearml
clearml/backend_interface/setupuploadmixin.py
.py
from abc import abstractproperty from typing import Optional import warnings from ..backend_config.bucket_config import ( S3BucketConfig, AzureContainerConfig, GSBucketConfig, ) from ..storage.helper import StorageHelper class SetupUploadMixin: log = abstractproperty() storage_uri = abstractprope...
171
7,366
metrics
src/torchmetrics/functional/video/__init__.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...
22
829
wandb
wandb/integration/sagemaker/files.py
.py
SM_PARAM_CONFIG = "/opt/ml/input/config/hyperparameters.json" SM_SECRETS = "secrets.env"
3
89
flit
flit_core/flit_core/sdist.py
.py
from collections import defaultdict from copy import copy from glob import glob from gzip import GzipFile import io import logging import os import os.path as osp from pathlib import Path from posixpath import join as pjoin import tarfile from . import common log = logging.getLogger(__name__) def clean_tarinfo(ti, ...
197
7,044
wandb
wandb/integration/huggingface/huggingface.py
.py
import logging from wandb.sdk.integration_utils.auto_logging import AutologAPI from .resolver import HuggingFacePipelineRequestResponseResolver logger = logging.getLogger(__name__) resolver = HuggingFacePipelineRequestResponseResolver() autolog = AutologAPI( name="transformers", symbols=("Pipeline.__call__...
19
443
mkdocs-material
material/extensions/preview.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # 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, including without limitation the # rights to use, c...
224
8,285
biopython
Tests/test_SearchIO_infernal_text.py
.py
# Copyright 2024 by Samuel Prince. All rights reserved. # # 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 as part of this # package. """Tests for SearchIO Inf...
1,056
45,668
mlflow
examples/pip_requirements/pip_requirements.py
.py
""" This example demonstrates how to specify pip requirements using `pip_requirements` and `extra_pip_requirements` when logging a model via `mlflow.*.log_model`. """ import tempfile import sklearn import xgboost as xgb from sklearn.datasets import load_iris import mlflow from mlflow.artifacts import download_artifa...
113
4,177
pyomo
pyomo/core/kernel/expression.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...
282
8,039
gunicorn
examples/alt_spec.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # # An example of how to pass information from the command line to # a WSGI app. Only applies to the native WSGI workers used by # Gunicorn sync (default) workers. # # $ gunicorn 'alt_spec:load(arg)' # # Single q...
28
822
qutip
qutip/solver/integrator/verner9efficient.py
.py
""" Provide a cython implimentation verner 'most-efficient' order 9 runge-Kutta method. See https://www.sfu.ca/~jverner/ """ # Verner 9 Efficient # https://www.sfu.ca/~jverner/ __all__ = ["vern9_coeff"] import numpy as np order = 9 rk_step = 16 rk_extra_step = 26 denseout_order = 9 bh = np.zeros(rk_step, dtype=np.flo...
707
24,555
metrics
src/torchmetrics/regression/mae.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...
145
5,307
gunicorn
tests/dirty/test_multi_app_routing.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for routing requests to multiple dirty apps. This module verifies that when multiple dirty apps are configured, messages are correctly routed to the appropriate app based on app_path. """ import asyncio ...
630
20,930
coveragepy
igor.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """Helper for building, testing, and linting coverage.py. To get portability, all these operations are written in Python here instead of in shell scripts, batch ...
529
17,057
black
tests/data/cases/starred_for_target.py
.py
# flags: --minimum-version=3.10 for x in *a, *b: print(x) for x in a, b, *c: print(x) for x in *a, b, c: print(x) for x in *a, b, *c: print(x) async for x in *a, *b: print(x) async for x in *a, b, *c: print(x) async for x in a, b, *c: print(x) async for x in ( *loooooooooooooooooo...
29
412
astropy
astropy/cosmology/_src/tests/test_units.py
.py
"""Testing :mod:`astropy.cosmology.units`.""" import pytest import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import Planck13, default_cosmology from astropy.tests.helper import assert_quantity_allclose from astropy.utils.compat.optional_deps import HAS_SCIPY #####################...
373
14,589
onnxruntime
tools/python/util/reduced_build_config_parser.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from __future__ import annotations import os # Check if the flatbuffers module is available. If not we cannot handle type reduction information in the config. try: import flatbuffers # noqa: F401 have_flatbuffers =...
204
9,958
mlflow
mlflow/agno/autolog_v1.py
.py
""" Autologging logic for Agno V1 using MLflow's tracing API. """ import logging from typing import Any import mlflow from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.tracing.constant import SpanAttributeKey, TokenUsageKey from mlflow.tracing.utils import construct_full_input...
194
6,385
metrics
tests/unittests/clustering/test_rand_score.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
73
2,585
clearml
clearml/utilities/parallel.py
.py
import os from collections import deque from concurrent.futures import ThreadPoolExecutor from copy import deepcopy from tempfile import mkstemp from threading import Thread from time import sleep from typing import Callable, Optional, Union, Generator, List, Type, Dict, Any from zipfile import ZipFile, ZIP_DEFLATED f...
508
19,974
onnx
onnx/reference/ops/aionnxml/__init__.py
.py
# SPDX-License-Identifier: Apache-2.0 from __future__ import annotations __all__ = ["load_op"] from onnx.reference.ops.aionnxml._op_list import load_op
7
154
metrics
src/torchmetrics/segmentation/generalized_dice.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...
192
8,423
metrics
tests/unittests/audio/test_sa_sdr.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...
150
6,034
textual
tests/option_list/test_option_list_disabled.py
.py
"""Unit tests for testing an option list's disabled facility.""" from __future__ import annotations import pytest from textual.app import App, ComposeResult from textual.widgets import OptionList from textual.widgets.option_list import Option, OptionDoesNotExist class OptionListApp(App[None]): """Test option l...
111
4,555
mlflow
tests/utils/test_docstring_utils.py
.py
import warnings from mlflow.utils.docstring_utils import ( ParamDocs, _indent, docstring_version_compatibility_warning, format_docstring, ) def test_indent_empty(): a = "" b = " " * 4 assert _indent(a, b) == a def test_indent_single_line(): a = "x" b = " " * 4 assert _indent...
174
3,661
ipython
tests/test_ultratb.py
.py
# encoding: utf-8 """Tests for IPython.core.ultratb""" import functools import io import os.path import platform import re import sys import traceback from textwrap import dedent import pytest from tempfile import TemporaryDirectory from IPython.core.ultratb import VerboseTB, FormattedTB from IPython.testing import ...
528
13,490
astropy
astropy/io/registry/base.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import contextlib import re import sys import warnings from operator import itemgetter import numpy as np __all__ = ["IORegistryError"] class IORegistryError(Exception): """Custom error for registry clashes.""" # --------------------------------...
481
18,263
hypercorn
src/hypercorn/asyncio/__init__.py
.py
from __future__ import annotations import warnings from collections.abc import Awaitable, Callable from typing import Literal from .run import worker_serve from ..config import Config from ..typing import Framework from ..utils import wrap_app async def serve( app: Framework, config: Config, *, shut...
48
1,455
sphinx
sphinx/ext/autodoc/_legacy_class_based/_documenters.py
.py
from __future__ import annotations import functools import operator import re import sys from inspect import Parameter, Signature from typing import TYPE_CHECKING, NewType, TypeVar from docutils.statemachine import StringList from sphinx.errors import PycodeError from sphinx.ext.autodoc._dynamic._mock import ismock,...
2,929
112,530
saleor
saleor/graphql/core/tests/garbage_collection/test_promise.py
.py
import gc import json import pytest from django.core.serializers.json import DjangoJSONEncoder from ....api import backend, schema from ....tests.utils import get_graphql_content from ....views import GraphQLView from .utils import ( clean_up_after_garbage_collection_test, disable_gc_for_garbage_collection_te...
68
2,453
metrics
src/torchmetrics/detection/__init__.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...
33
1,398
pyro
tests/infer/test_svgd.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro import pyro.distributions as dist from pyro.infer import SVGD, IMQSteinKernel, RBFSteinKernel from pyro.infer.autoguide.utils import _product from pyro.optim import Adam from tests.common imp...
150
5,251
readthedocs.org
readthedocs/api/v2/views/integrations.py
.py
"""Endpoints integrating with Github, Bitbucket, and other webhooks.""" import hashlib import hmac import json from functools import namedtuple from textwrap import dedent import structlog from django.http import Http404 from django.shortcuts import get_object_or_404 from django.utils.crypto import constant_time_comp...
947
35,152
astropy
astropy/visualization/wcsaxes/ticks.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import defaultdict import numpy as np from matplotlib import rcParams from matplotlib.lines import Line2D, Path from matplotlib.transforms import Affine2D class Ticks(Line2D): """ Ticks are derived from Line2D, and note that ti...
207
6,582
saleor
saleor/graphql/meta/tests/test_meta_queries.py
.py
import graphene from django.http import HttpResponse from ....core.models import ModelWithMetadata from ....order.models import Order from ....payment.models import Payment from ....payment.utils import payment_owned_by_user from ....permission.models import Permission from ...tests.fixtures import ApiClient from ...t...
3,977
114,990
beam
sdks/python/apache_beam/runners/dataflow/dataflow_runner_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...
758
31,797
onnx
onnx/backend/test/case/node/lpnormalization.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class LpNormalization(Base): @staticmethod def export_l2normalizatio...
81
3,152
bazel
src/test/py/bazel/options_test.py
.py
# Copyright 2022 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
321
8,443
pyomo
examples/gdp/strip_packing/strip_packing_concrete.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...
91
3,292
sphinx
tests/roots/test-ext-inheritance_diagram/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = ['sphinx.ext.inheritance_diagram', 'sphinx.ext.intersphinx']
7
158
astropy
astropy/table/_dataframes.py
.py
""" DataFrame conversion utilities for Astropy Tables. This module provides utility functions for converting between Astropy Tables and various DataFrame formats (pandas, polars, pyarrow, etc) via the narwhals library. """ from __future__ import annotations import math import warnings from collections.abc import Map...
549
19,158
mlflow
mlflow/server/jobs/_job_runner.py
.py
""" This module is used for launching the job runner process. The job runner will: * enqueue all unfinished huey tasks when MLflow server is down last time. * Watch the `_MLFLOW_HUEY_STORAGE_PATH` path, if new files (named like `XXX.mlflow-huey-store`) are created, it means a new Huey queue is created, then the jo...
44
1,578
qutip
qutip/tests/solver/cy/test_nm_mcsolve.py
.py
import numbers import pickle import numpy as np import pytest from qutip import coefficient from qutip.core.coefficient import ConstantCoefficient from qutip.solver.cy.nm_mcsolve import ( RateShiftCoefficient, SqrtRealCoefficient, ) def assert_functions_equal(f, g, tlist, rtol=1e-12, atol=1e-12): """ Assert...
162
4,827
cvxpy
cvxpy/atoms/quad_form.py
.py
""" Copyright 2013 Steven Diamond, 2017 Robin Verschueren 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...
319
10,925
sqlmap
tests/test_api.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Unit tests for the sqlmap REST API (lib/utils/api.py). Two complementary angles: 1. Pure helpers / objects called directly (is_admin, validate_task_options, the Database and T...
622
24,162