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
black
tests/data/cases/single_line_format_skip_with_multiple_comments.py
.py
foo = 123 # fmt: skip # noqa: E501 # pylint bar = ( 123 , ( 1 + 5 ) # pylint # fmt:skip ) baz = "a" + "b" # pylint; fmt: skip; noqa: E501 skip_will_not_work = "a" + "b" # pylint fmt:skip skip_will_not_work2 = "a" + "b" # some text; fmt:skip happens to be part of it...
20
646
ipython
tests/test_dir2.py
.py
from IPython.utils.dir2 import dir2 import pytest class Base(object): x = 1 z = 23 def test_base(): res = dir2(Base()) assert "x" in res assert "z" in res assert "y" not in res assert "__class__" in res assert res.count("x") == 1 assert res.count("__class__") == 1 def test_Sub...
67
1,446
readthedocs.org
readthedocs/rtd_tests/tests/test_profile_views.py
.py
import itertools from unittest import mock from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.urls import reverse from django_dynamic_fixture import get from rest_framework.authtoken.models import Token from readthedocs.audit.mo...
425
15,044
sphinx
sphinx/extension.py
.py
"""Utilities for Sphinx extensions.""" from __future__ import annotations from typing import TYPE_CHECKING from packaging.version import InvalidVersion, Version from sphinx.errors import VersionRequirementError from sphinx.locale import __ from sphinx.util import logging if TYPE_CHECKING: from typing import An...
95
3,192
textual
src/textual/_sleep.py
.py
from __future__ import annotations from asyncio import Future, get_running_loop from threading import Event, Thread from time import perf_counter, sleep class Sleeper(Thread): def __init__( self, ) -> None: self._exit = False self._sleep_time = 0.0 self._event = Event() ...
61
1,620
biopython
Bio/PDB/Model.py
.py
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk) # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Model class, used in Structure objects.""" from typing import TYPE_CHECKING from Bio....
81
2,358
beam
sdks/python/apache_beam/examples/ml-orchestration/kfp/components/preprocessing/src/preprocess.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 ...
209
7,182
pyomo
doc/OnlineDocs/src/data/table5.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...
19
725
qutip
qutip/tests/test_fileio.py
.py
import pytest import numpy as np import uuid import qutip from pathlib import Path # qsave _always_ appends a suffix to the file name at the time of writing, but # in case this changes in the future, to ensure that we never leak a temporary # file into the user's folders, we simply apply these tests in a temporary # d...
63
2,337
pyfilesystem2
fs/opener/appfs.py
.py
# coding: utf-8 """``AppFS`` opener definition. """ from __future__ import absolute_import, print_function, unicode_literals import typing from .base import Opener from .errors import OpenerError from .registry import registry if typing.TYPE_CHECKING: from typing import Text, Union from ..appfs import _App...
73
2,059
onnxruntime
onnxruntime/python/tools/transformers/models/longformer/convert_to_onnx.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # This ...
414
14,794
openvino
src/frontends/tensorflow/tests/test_models/gen_scripts/generate_unsupported_relu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # unsupported relu tensorflow model generator # import numpy as np import os import sys import tensorflow as tf def main(): tf.compat.v1.reset_default_graph() # Create the graph and model with tf.compat.v1.Session() as ...
39
1,010
openvino
tests/time_tests/test_runner/utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Utility module.""" import numpy as np # Define a range to cut outliers which are < Q1 − IQR_CUTOFF * IQR, and > Q3 + IQR_CUTOFF * IQR # https://en.wikipedia.org/wiki/Interquartile_range IQR_CUTOFF = 1.5 def calculate_iqr(stats: li...
30
1,007
onnxruntime
onnxruntime/core/providers/coreml/mlprogram_test_scripts/gridsample_test.py
.py
import coremltools as ct import numpy as np from coremltools.converters.mil import Builder as mb target = ct.target.iOS15 x_shape = (2, 2, 3, 2) grid_shape = (2, 3, 2, 2) @mb.program(input_specs=[mb.TensorSpec(shape=x_shape), mb.TensorSpec(shape=grid_shape)], opset_version=target) def prog(x, grid): sampling = ...
115
2,850
beam
sdks/python/apache_beam/transforms/display_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...
268
9,207
beam
sdks/python/apache_beam/testing/benchmarks/nexmark/monitor.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
2,225
textual
docs/examples/guide/layout/horizontal_layout_overflow.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static class HorizontalLayoutExample(App): CSS_PATH = "horizontal_layout_overflow.tcss" def compose(self) -> ComposeResult: yield Static("One", classes="box") yield Static("Two", classes="box") yield Static("Three"...
17
416
probability
tensorflow_probability/python/experimental/bijectors/distribution_bijectors.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...
263
11,039
pyomo
pyomo/solvers/tests/checks/test_MOSEKPersistent.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...
188
6,470
sphinx
tests/roots/test-ext-autosectionlabel-prefix-document/conf.py
.py
extensions = ['sphinx.ext.autosectionlabel'] autosectionlabel_prefix_document = True
3
85
saleor
saleor/graphql/product/tests/queries/products_filtrations/test_over_references_categories.py
.py
import pytest from ......attribute import AttributeEntityType, AttributeInputType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from .....core.utils import to_global_id_or_none from .....tests.utils import get_graphq...
298
9,619
beam
sdks/python/apache_beam/examples/ml_transform/ml_transform_it_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...
109
3,997
conda
conda/plugins/environment_exporters/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Built-in conda environment exporter plugins.""" from . import environment_yml, explicit, requirements_txt plugins = [environment_yml, explicit, requirements_txt] """The list of environment exporter plugins for easier registration with plugg...
9
326
clearml
examples/frameworks/pytorch/tensorboard_toy_pytorch.py
.py
import os from tempfile import gettempdir import numpy as np from PIL import Image from torch.utils.tensorboard import SummaryWriter from clearml import Task # Connecting ClearML with the current process, # from here on everything is logged automatically task = Task.init(project_name='examples', task_name='PyTorch ...
33
1,281
openvino
tests/e2e_tests/common/plugins/reshape_tests/conftest.py
.py
import inspect import itertools import logging as log import os import sys import traceback from contextlib import contextmanager from copy import copy, deepcopy from types import SimpleNamespace import pytest import yaml import e2e_tests.common.plugins.common.base_conftest as base from e2e_tests.test_utils.reshape_t...
217
10,797
scikit-bio
skbio/sequence/_alphabet.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. # --------------------------------------------...
283
8,775
mlflow
mlflow/models/display_utils.py
.py
import html from pathlib import Path from mlflow.models.model import ModelInfo from mlflow.models.signature import ModelSignature from mlflow.types import schema from mlflow.utils import databricks_utils def _is_input_string(inputs: schema.Schema) -> bool: return ( not inputs.has_input_names() an...
159
5,346
voila
tests/app/preheat_configuration_test.py
.py
import asyncio import os import time import pytest BASE_DIR = os.path.dirname(__file__) NOTEBOOK_EXECUTION_TIME = 3 NUMBER_PREHEATED_KERNEL = 2 TIME_THRESHOLD = 1 @pytest.fixture def voila_config_file_paths_arg(): path = os.path.join(BASE_DIR, "..", "configs", "preheat") return "--VoilaTest.config_file_path...
60
1,664
pymc
pymc/variational/updates.py
.py
# Copyright 2024 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
1,084
37,935
black
tests/data/cases/import_spacing.py
.py
"""The asyncio package, tracking PEP 3156.""" # flake8: noqa from logging import ( WARNING ) from logging import ( ERROR, ) import sys # This relies on each of the submodules having an __all__ variable. from .base_events import * from .coroutines import * from .events import * # comment here from .futures ...
119
2,542
sphinx
sphinx/registry.py
.py
"""Sphinx component registry.""" from __future__ import annotations import traceback from importlib import import_module from importlib.metadata import entry_points from types import MethodType from typing import TYPE_CHECKING from sphinx.domains import ObjType from sphinx.domains.std import GenericObject, Target fr...
628
24,305
clearml
clearml/utilities/matching.py
.py
from fnmatch import fnmatch from typing import Union from pathlib2 import Path def matches_any_wildcard(path: str, wildcards: Union[str, list], recursive: bool = True) -> bool: """ Checks if given pattern matches any supplied wildcard :param path: path to check :param wildcards: wildcards to check a...
45
1,582
pyomo
pyomo/repn/tests/test_parameterized_quadratic.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,519
60,079
probability
tensorflow_probability/python/distributions/onehot_categorical_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...
353
14,708
biopython
Bio/Emboss/PrimerSearch.py
.py
# Copyright 2008 Michiel de Hoon. 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. """Code to interact with t...
81
2,521
saleor
saleor/core/management/commands/clean_editorjs_fields.py
.py
import difflib import json import traceback from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand, CommandError from django.db import models from ....attribute.models import AttributeValue, AttributeValueTranslation from ....discount.models import ( Promotion, ...
243
8,249
biopython
Bio/AlignIO/ClustalIO.py
.py
# Copyright 2006-2016 by Peter Cock. 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. """Bio.AlignIO support ...
314
12,152
probability
tensorflow_probability/python/mcmc/diagnostic_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...
723
27,802
pyomo
pyomo/core/tests/unit/test_logical_to_linear.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...
982
34,797
coveragepy
doc/conf.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 """Sphinx configuration.""" # coverage.py documentation build configuration file, created by # sphinx-quickstart on Wed May 13 22:18:33 2009. # # This file is ex...
261
8,551
probability
spinoffs/inference_gym/inference_gym/tools/get_ground_truth.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...
173
6,196
eve
eve/io/base.py
.py
# -*- coding: utf-8 -*- """ eve.io.base ~~~~~~~~~~~ Standard interface implemented by Eve data layers. :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ import datetime from copy import copy import simplejson as json from flask import abort, request from e...
540
21,576
mlflow
tests/statsmodels/model_fixtures.py
.py
from typing import Any, NamedTuple import numpy as np import pandas as pd import statsmodels.api as sm from scipy.linalg import toeplitz from statsmodels.tsa.arima.model import ARIMA from statsmodels.tsa.arima_process import arma_generate_sample from mlflow.models import ModelSignature from mlflow.types.schema import...
238
7,568
mlflow
docs/api_reference/theme/mlflow/__init__.py
.py
"""Sphinx ReadTheDocs theme. From https://github.com/ryan-roemer/sphinx-bootstrap-theme. """ import os VERSION = (0, 1, 9) __version__ = ".".join(str(v) for v in VERSION) __version_full__ = __version__ def get_html_theme_path(): """Return list of HTML theme paths.""" return os.path.abspath(os.path.dirnam...
18
350
textual
src/textual/pad.py
.py
from typing import cast from rich.align import Align, AlignMethod from rich.console import ( Console, ConsoleOptions, JustifyMethod, RenderableType, RenderResult, ) from rich.measure import Measurement from rich.segment import Segment, Segments from rich.style import Style class HorizontalPad: ...
80
2,306
saleor
saleor/graphql/payment/types.py
.py
from typing import Any from uuid import UUID import graphene from django.db.models import Q from graphene import relay from promise import Promise from ...core.exceptions import PermissionDenied from ...graphql.core.descriptions import ( ADDED_IN_322, ADDED_IN_323, DEPRECATED_LEGACY_PAYMENTS, DEPRECAT...
941
31,027
beam
sdks/python/apache_beam/utils/histogram_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...
175
6,261
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_assign.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import numpy as np import paddle from save_model import exportModel ''' assign w/ output ''' @paddle.jit.to_static def test_assign_output(array): result1 = paddle.zeros(shape=[3, 2], dtype='float32') paddl...
36
938
omegaconf
tests/interpolation/test_resolver_annotation_validation.py
.py
import inspect from collections.abc import Sequence from dataclasses import dataclass from functools import partial from typing import Annotated, Any, Literal, Optional, Protocol, TypedDict, TypeVar from pytest import mark, raises, warns from omegaconf import DictConfig, ListConfig, OmegaConf, TupleConfig from omegac...
523
16,386
saleor
saleor/attribute/models/product_variant.py
.py
from django.db import models from ...core.models import SortableModel from ...product.models import ProductType, ProductVariant from .base import AssociatedAttributeManager, AttributeValue, BaseAssignedAttribute class AssignedVariantAttributeValue(SortableModel): value = models.ForeignKey( "AttributeValu...
79
2,420
probability
tensorflow_probability/python/optimizer/linesearch/hager_zhang_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...
366
14,171
saleor
saleor/product/lock_objects.py
.py
from django.db.models import QuerySet from .models import Product def product_qs_select_for_update() -> QuerySet[Product]: return Product.objects.order_by("pk").select_for_update(of=(["self"]))
8
201
beam
sdks/python/apache_beam/ml/inference/base.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,184
89,453
voila
tests/utils_test.py
.py
from typing import Dict, List, Set from voila.utils import filter_extension federated_extensions = [{"name": "foo"}, {"name": "bar"}, {"name": "foo-bar"}] def list_to_set(inp: List[Dict]) -> Set: return set([x["name"] for x in inp]) def test_filter_extension(): extensions = filter_extension(federated_exte...
24
703
pyomo
pyomo/core/tests/unit/test_componentuid.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,268
47,130
conda
tests/data/build-index4-json.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import json from os.path import abspath, dirname, join from pprint import pprint from conda.core.subdir_data import SubdirData DATA_DIR = abspath(join(dirname(__file__), "repodata")) def save_data_source(url, name): raw_repodata_str = Su...
884
23,511
hatch
src/hatch/__main__.py
.py
if __name__ == "__main__": from hatch.cli import main main()
5
70
openvino
tools/ovc/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tempfile import unittest import numpy as np from unit_tests.moc_tf_fe.utils import basic_check class TestBasicConversion(unittest.TestCase): def prepare_checkpoint_v1(self): # quite old TensorFlow version can produ...
42
2,266
saleor
saleor/graphql/plugins/schema.py
.py
import graphene from ...permission.enums import PluginsPermissions from ..core import ResolveInfo from ..core.connection import create_connection_slice from ..core.context import get_database_connection_name from ..core.fields import ConnectionField, PermissionsField from ..core.tracing import traced_resolver from .da...
58
1,986
pyomo
pyomo/core/kernel/dict_container.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...
150
5,509
saleor
saleor/plugins/tests/fixtures/__init__.py
.py
from .gateway import * # noqa: F403 from .plugin_configuration import * # noqa: F403 from .plugin_manager import * # noqa: F403
4
131
probability
tensorflow_probability/python/mcmc/metropolis_hastings.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...
303
11,248
loguru
tests/test_add_option_format.py
.py
import pytest from loguru import logger @pytest.mark.parametrize( ("message", "format", "expected"), [ ("a", "Message: {message}", "Message: a\n"), ("b", "Nope", "Nope\n"), ("c", "{level} {message} {level}", "DEBUG c DEBUG\n"), ("d", "{message} {level} {level.no} {level.name}"...
88
2,685
python-prompt-toolkit
examples/prompts/accept-default.py
.py
#!/usr/bin/env python """ Example of `accept_default`, a way to automatically accept the input that the user typed without allowing him/her to edit it. This should display the prompt with all the formatting like usual, but not allow any editing. """ from prompt_toolkit import HTML, prompt if __name__ == "__main__": ...
18
466
black
src/black/__init__.py
.py
import io import json import platform import re import sys import tokenize import traceback from collections.abc import ( Collection, Generator, MutableMapping, Sequence, ) from contextlib import nullcontext from dataclasses import replace from datetime import datetime, timezone from enum import Enum fr...
1,723
56,269
wandb
tests/system_tests/test_registries/test_link_registry.py
.py
from __future__ import annotations from typing import Literal import wandb from pytest import FixtureRequest, MonkeyPatch, fixture, mark, param, skip from typing_extensions import assert_never from wandb import Api, Artifact from wandb.apis.public.registries.registry import Registry @fixture( params=[ [...
170
5,025
mlflow
mlflow/utils/autologging_utils/client.py
.py
""" Defines an MlflowAutologgingQueueingClient developer API that provides batching, queueing, and asynchronous execution capabilities for a subset of MLflow Tracking logging operations used most frequently by autologging operations. TODO(dbczumar): Migrate request batching, queueing, and async execution support from ...
437
16,877
saleor
saleor/tests/e2e/orders/utils/draft_order_update.py
.py
from saleor.graphql.tests.utils import get_graphql_content DRAFT_ORDER_UPDATE_MUTATION = """ mutation DraftOrderUpdate($input: DraftOrderInput!, $id: ID!) { draftOrderUpdate(input: $input, id: $id) { errors { message field code } order { id lines { id undisco...
175
3,073
wandb
tests/unit_tests/test_launch/test_builder/test_build.py
.py
import hashlib import json import re from unittest.mock import MagicMock import pytest from wandb.sdk.artifacts.artifact import Artifact from wandb.sdk.launch._project_spec import EntryPoint, LaunchProject from wandb.sdk.launch.builder import build from wandb.sdk.launch.builder.abstract import registry_from_uri from w...
342
11,954
qutip
qutip/solver/heom/bofin_baths.py
.py
""" This module provides utilities for describing baths when using the HEOM (hierarchy equations of motion) to model system-bath interactions. See the ``qutip.nonmarkov.bofin_solvers`` module for the associated solver. The implementation is derived from the BoFiN library (see https://github.com/tehruhn/bofin) which wa...
803
29,136
wagtail
wagtail/contrib/redirects/tmp_storages.py
.py
""" Copyright (c) Bojan Mihelac and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this lis...
112
3,739
textual
tests/snapshot_tests/snapshot_apps/data_table_tabs.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import TabbedContent, DataTable class Dashboard(App): """Dashboard""" BINDINGS = [ ("d", "toggle_dark", "Toggle dark mode"), Binding("ctrl+q", "app.quit", "Quit", show=True), ] TITLE = ...
36
908
wagtail
wagtail/tests/test_blocks.py
.py
import base64 import collections import copy import json import unittest import unittest.mock from decimal import Decimal # non-standard import name for gettext_lazy, to prevent strings from being picked up for translation from django import forms from django.core.exceptions import ValidationError from django.core.ser...
7,380
263,823
django-cms
cms/tests/test_apphook_reload_language_variants.py
.py
""" Tests for apphook URL reloading when creating language variants. This tests the fix for issue #8357 where creating new language variants for pages with apphooks causes NoReverseMatch exceptions. The fix works by ensuring that when a new PageContent (language variant) is created for a page with an apphook, the set...
227
8,570
pyomo
pyomo/contrib/pynumero/sparse/block_vector.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,669
59,512
clearml
clearml/backend_api/session/defs.py
.py
from typing import Optional from ...backend_config import EnvEntry from ...backend_config.converters import safe_text_to_bool ENV_HOST = EnvEntry("CLEARML_API_HOST", "TRAINS_API_HOST") ENV_WEB_HOST = EnvEntry("CLEARML_WEB_HOST", "TRAINS_WEB_HOST") ENV_FILES_HOST = EnvEntry("CLEARML_FILES_HOST", "TRAINS_FILES_HOST") E...
69
2,807
scikit-bio
skbio/table/tests/test_augment.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. # --------------------------------------------...
873
37,200
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_tanh.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # tanh paddle model generator # import numpy as np from save_model import saveModel import paddle import sys data_type = 'float32' def tanh(name:str, x): paddle.enable_static() with paddle.static.program_guard(paddle.static....
41
1,037
sqlmap
thirdparty/colorama/ansi.py
.py
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. ''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' OSC = '\033]' BEL = '\a' def code_to_chars(code): return CSI + str(code) + 'm' def set_t...
103
2,522
clearml
clearml/cli/hpo/__main__.py
.py
import argparse import json import sys from argparse import ArgumentParser, RawTextHelpFormatter from typing import List, Union import clearml.backend_api.session from clearml import Task from clearml.automation import ( DiscreteParameterRange, UniformIntegerParameterRange, UniformParameterRange, LogUn...
365
13,638
beam
sdks/python/apache_beam/runners/portability/sdk_container_builder.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...
374
15,004
onnx
onnx/utils.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import os import tarfile from collections import deque from typing import TYPE_CHECKING import onnx.checker import onnx.helper import onnx.shape_inference if TYPE_CHECKING: from onnx.onnx_pb impor...
325
12,743
metrics
tests/unittests/classification/test_f_beta.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...
768
30,654
rq
rq/cron_scheduler_registry.py
.py
from __future__ import annotations import time from typing import TYPE_CHECKING from redis import Redis from redis.client import Pipeline from .exceptions import DuplicateSchedulerError, SchedulerNotFound if TYPE_CHECKING: from .cron import CronScheduler def get_registry_key() -> str: """Get the Redis key...
97
3,366
clearml
examples/pipeline/decorated_pipeline_step_decorators.py
.py
from clearml import PipelineDecorator def our_decorator(func): def function_wrapper(*args, **kwargs): return func(*args, **kwargs) + 1 return function_wrapper @PipelineDecorator.component() @our_decorator def step(): return 1 @PipelineDecorator.pipeline(name="test_decorated", project="test_dec...
25
468
beam
sdks/python/apache_beam/runners/portability/flink_uber_jar_job_server.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...
254
9,078
pyomo
pyomo/contrib/pynumero/examples/external_grey_box/react_example/reactor_model_outputs.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...
129
4,377
mlflow
tests/cli/test_ai_commands.py
.py
from unittest import mock from click.testing import CliRunner from mlflow.cli import cli def test_list_commands_cli(): mock_commands = [ { "key": "genai/analyze_experiment", "namespace": "genai", "description": "Analyzes an MLflow experiment", }, { ...
204
6,609
saleor
saleor/graphql/translations/tests/mutations/test_product_variant_bulk_translate.py
.py
from unittest.mock import patch import graphene import pytest from ....core.enums import LanguageCodeEnum, TranslationErrorCode from ....tests.utils import get_graphql_content from ...mutations import ProductVariantBulkTranslate PRODUCT_VARIANT_BULK_TRANSLATE_MUTATION = """ mutation ProductVariantBulkTranslate( ...
404
12,948
wandb
wandb/cli/clean.py
.py
"""Implements `wandb clean`.""" from __future__ import annotations import dataclasses import pathlib import re import shutil from datetime import datetime import click from wandb.errors import term from wandb.sdk import wandb_setup # Patched in tests. _DATETIME_NOW = datetime.now @click.command() @click.pass_con...
228
6,722
biopython
Bio/KEGG/REST.py
.py
# Copyright 2014 by Kevin Wu. # Revisions copyright 2014 by Peter Cock. # 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 thi...
331
11,302
saleor
saleor/app/tasks.py
.py
import logging from django.conf import settings from django.core.exceptions import ValidationError from django.db.models import Exists, OuterRef, Q from django.utils import timezone from requests import HTTPError, RequestException from .. import celeryconf from ..core import JobStatus from ..core.db.connection import...
124
4,539
probability
spinoffs/inference_gym/inference_gym/tools/stan/logistic_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...
131
4,071
onnxruntime
onnxruntime/python/tools/transformers/models/sam2/convert_to_onnx.py
.py
# ------------------------------------------------------------------------- # Copyright (R) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import argparse import os import pathlib import sys import torch from i...
271
10,399
saleor
saleor/graphql/translations/mutations/promotion_rule_translate.py
.py
import graphene from ....discount import models as discount_models from ....permission.enums import SitePermissions from ...core import ResolveInfo from ...core.descriptions import RICH_CONTENT from ...core.enums import LanguageCodeEnum from ...core.scalars import JSON from ...core.types import TranslationError from ....
62
2,402
openvino
samples/python/benchmark/sync_benchmark/sync_benchmark.py
.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import statistics import sys from time import perf_counter import numpy as np import openvino as ov from openvino.utils.types import get_dtype def fill_tensor_random...
82
3,108
pyomo
pyomo/core/tests/unit/test_pickle.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...
365
13,364
pyomo
pyomo/contrib/doe/grey_box_utilities.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...
830
34,596
saleor
saleor/graphql/account/tests/queries/test_user_assigned_attributes.py
.py
import graphene from .....attribute.models import AssignedUserAttributeValue from ....tests.utils import assert_no_permission, get_graphql_content USER_ASSIGNED_ATTRIBUTES_QUERY = """ query User($id: ID!) { user(id: $id) { assignedAttributes { attribute { sl...
499
16,547
saleor
saleor/tests/e2e/vouchers/test_export_voucher_codes.py
.py
import uuid import pytest from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( create_voucher, create_voucher_channel_listing, export_voucher_codes, raw_export_voucher_codes, ) def create_vouchers_with_multiple_codes(e2e_staff_api_c...
371
9,732