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
openvino
docs/articles_en/assets/snippets/dynamic_shape.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from snippets import get_model model = get_model() #! [static_shape] import openvino as ov core = ov.Core() model.reshape([10, 20, 30, 40]) #! [static_shape]
14
244
loguru
tests/test_interception.py
.py
import inspect import logging from loguru import logger from .conftest import make_logging_logger class InterceptHandler(logging.Handler): def emit(self, record): # Get corresponding Loguru level if it exists. try: level = logger.level(record.levelname).name except ValueError...
167
5,443
loguru
tests/exceptions/source/backtrace/nested_wrapping.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=False, backtrace=True, diagnose=False) def f(i): 1 / i @logger.catch @logger.catch() def a(x): f(x) a(0) with logger.catch(): with logger.catch(): f(0) try: try: f(0) except Ze...
34
409
mamba
micromamba/tests/test_env.py
.py
import os import re import shutil import subprocess import platform from packaging.version import Version from pathlib import Path import pytest import yaml from . import helpers __this_dir__ = Path(__file__).parent.resolve() def test_env_list(tmp_home, tmp_root_prefix, tmp_empty_env): env_json = helpers.run_...
1,031
38,469
readthedocs.org
readthedocs/redirects/exceptions.py
.py
"""Redirects related exceptions.""" class InfiniteRedirectException(Exception): """Exception raised when a redirect loops forever."""
6
140
clearml
clearml/binding/click_bind.py
.py
from typing import Optional, Tuple, Dict, Callable, TYPE_CHECKING, Any if TYPE_CHECKING: from .. import Task try: from click.core import Command, Option, Argument, Group, Context # noqa from click.types import BoolParamType # noqa except ImportError: Command = None from .frameworks import _patched_...
186
7,122
cvxpy
cvxpy/atoms/elementwise/normcdf.py
.py
""" Copyright 2025 CVXPY 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 law or agreed to in writing, softwa...
79
2,329
openvino
src/bindings/python/src/openvino/properties/streams/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # Classes from openvino._pyopenvino.properties.streams import Num # Properties import openvino._pyopenvino.properties.streams as __streams from openvino.properties._properties import __make_properties __make_prop...
12
348
wagtail
wagtail/contrib/forms/apps.py
.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class WagtailFormsAppConfig(AppConfig): name = "wagtail.contrib.forms" label = "wagtailforms" verbose_name = _("Wagtail forms") default_auto_field = "django.db.models.AutoField"
10
285
python-prompt-toolkit
src/prompt_toolkit/contrib/regular_languages/lexer.py
.py
""" `GrammarLexer` is compatible with other lexers and can be used to highlight the input using a regular grammar with annotations. """ from __future__ import annotations from collections.abc import Callable from prompt_toolkit.document import Document from prompt_toolkit.formatted_text.base import StyleAndTextTuple...
95
3,424
kafka
tests/kafkatest/tests/core/security_rolling_upgrade_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 ...
190
9,645
pymc
pymc/logprob/rewriting.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...
333
12,085
pyomo
pyomo/contrib/mindtpy/tests/MINLP2_simple.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...
116
3,962
lemur
lemur/dns_providers/models.py
.py
from sqlalchemy import Column, Integer, String, text from sqlalchemy.dialects.postgresql import JSON from sqlalchemy.orm import relationship from sqlalchemy_utils import ArrowType from lemur.database import BaseModel from lemur.plugins.base import plugins from lemur.utils import Vault class DnsProvider(BaseModel): ...
42
1,464
wagtail
wagtail/embeds/finders/oembed.py
.py
import re from datetime import timedelta import requests from django.utils import timezone from django.utils.html import format_html from wagtail.embeds.exceptions import EmbedNotFoundException from wagtail.embeds.oembed_providers import all_providers from .base import EmbedFinder class OEmbedFinder(EmbedFinder): ...
105
3,078
metrics
src/torchmetrics/functional/pairwise/minkowski.py
.py
# Copyright The PyTorch 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 i...
94
3,999
saleor
saleor/graphql/product/tests/queries/test_products_query.py
.py
import datetime from decimal import Decimal import graphene import pytest from django.utils.dateparse import parse_datetime from .....attribute.tests.model_helpers import get_product_attributes from .....core.postgres import FlatConcatSearchVector from .....product.models import ( Product, ProductChannelListi...
1,493
47,467
deap
examples/ga/kursawefct.py
.py
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
90
2,940
pyfilesystem2
tests/test_mirror.py
.py
from __future__ import unicode_literals import unittest from parameterized import parameterized_class from fs import open_fs from fs.mirror import mirror @parameterized_class(("WORKERS",), [(0,), (1,), (2,), (4,)]) class TestMirror(unittest.TestCase): def _contents(self, fs): """Extract an FS in to a si...
113
3,843
pyro
pyro/distributions/log_normal_negative_binomial.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions import constraints from torch.distributions.utils import broadcast_all, lazy_property from pyro.distributions.torch import NegativeBinomial from pyro.distributions.torch_distribution import TorchD...
154
5,720
readthedocs.org
readthedocs/projects/templatetags/projects_tags.py
.py
"""Project template tags and filters.""" from django import template from readthedocs.builds.constants import INTERNAL from readthedocs.core.permissions import AdminPermission from readthedocs.projects.version_handling import comparable_version register = template.Library() @register.filter def sort_version_aware...
35
972
saleor
saleor/tests/e2e/orders/discounts/test_promotion_applied_on_draft_order_with_specific_total.py
.py
import pytest from ... import DEFAULT_ADDRESS from ...product.utils.preparing_product import prepare_product from ...promotions.utils import create_promotion, create_promotion_rule from ...shop.utils.preparing_shop import prepare_shop from ...taxes.utils import update_country_tax_rates from ...utils import assign_perm...
246
8,385
astropy
astropy/coordinates/angles/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for celestial coordinates of astronomical objects. It also contains a framework for conversions between coordinate systems. """ from .core import * from .errors import * from .utils import *
12
308
beam
sdks/python/apache_beam/examples/inference/sklearn_japanese_housing_regression.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...
186
6,654
pyomo
pyomo/scripting/solve_config.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...
458
15,111
pyomo
pyomo/contrib/parmest/utils/create_ef.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...
340
13,775
pyomo
pyomo/util/tests/test_infeasible.py
.py
# -*- coding: utf-8 -*- # ____________________________________________________________________________________ # # 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 En...
207
8,012
probability
tensorflow_probability/python/distributions/exponentially_modified_gaussian_test.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...
264
11,000
python-prompt-toolkit
examples/gevent-get-input.py
.py
#!/usr/bin/env python """ For testing: test to make sure that everything still works when gevent monkey patches are applied. """ from gevent.monkey import patch_all from prompt_toolkit.eventloop.defaults import create_event_loop from prompt_toolkit.shortcuts import PromptSession if __name__ == "__main__": # Appl...
26
685
loguru
tests/test_add_sinks.py
.py
import asyncio import logging import os import pathlib import sys import pytest from loguru import logger message = "test message" expected = message + "\n" repetitions = pytest.mark.parametrize("rep", [0, 1, 2]) def log(sink, rep=1): logger.debug("This shouldn't be printed.") i = logger.add(sink, format=...
253
5,941
mlflow
mlflow/store/db_migrations/versions/84291f40a231_add_run_link_to_model_version.py
.py
"""add run_link to model_version Create Date: 2020-07-16 13:45:56.178092 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "84291f40a231" down_revision = "27a6a02d2cf1" branch_labels = None depends_on = None def upgrade(): op.add_column( "model_vers...
25
428
probability
tensorflow_probability/python/experimental/nn/convolutional_layers_v2.py
.py
# Copyright 2019 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...
669
27,425
biopython
Tests/test_SearchIO_hmmer3_tab_index.py
.py
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # 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. """Tests for SearchIO hmmer3-tab indexing.""" import os import unittest from search_test...
80
4,534
coremltools
deps/protobuf/conformance/conformance_python.py
.py
#!/usr/bin/env python # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are...
214
9,255
mlflow
tests/transformers/test_transformers_prompt_templating.py
.py
from unittest.mock import MagicMock import pytest import transformers import yaml from packaging.version import Version import mlflow from mlflow.exceptions import MlflowException from mlflow.models.model import MLMODEL_FILE_NAME from mlflow.transformers import _SUPPORTED_PROMPT_TEMPLATING_TASK_TYPES, _validate_promp...
241
8,463
cvxpy
cvxpy/atoms/ptp.py
.py
""" Copyright 2013 CVXPY 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 law or agreed to in writing, software d...
31
1,041
hydra
hydra/utils.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import json import logging.config import os from pathlib import Path from typing import Any, Callable import hydra._internal.instantiate._instantiate2 import hydra.types from hydra._internal.deprecation_warning import deprecation_warning from hydr...
157
4,577
saleor
saleor/checkout/checkout_cleaner.py
.py
import datetime from collections.abc import Iterable from typing import TYPE_CHECKING import graphene from django.core.exceptions import ValidationError from ..core.exceptions import GiftCardNotApplicable from ..core.taxes import TaxError from ..giftcard.models import GiftCard from ..payment import gateway from ..pay...
211
7,697
toolz
toolz/tests/test_itertoolz.py
.py
import itertools from itertools import starmap from toolz.utils import raises from functools import partial from random import Random from pickle import dumps, loads from toolz.itertoolz import (remove, groupby, merge_sorted, concat, concatv, interleave, unique, ...
589
19,626
sqlmap
lib/core/defaults.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.datatype import AttribDict _defaults = { "csvDel": ',', "timeSec": 5, "googlePage": 1, "verbose": 1, "delay": 0, "timeout": 30, "retries...
30
558
astropy
astropy/coordinates/builtin_frames/fk4.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import math import erfa import numpy as np from astropy import units as u from astropy.coordinates.attributes import TimeAttribute from astropy.coordinates.baseframe import base_doc, frame_transform_graph from astropy.coordinates.matrix_utilities import...
252
8,286
onnxruntime
onnxruntime/python/tools/quantization/matmul_nbits_quantizer.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from __fu...
1,875
79,165
astropy
astropy/io/ascii/tests/test_compressed.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_array_equal from astropy.io.ascii import read # NOTE: Python can be built without bz2 or lzma from astropy.utils.compat.optional_deps import HAS_BZ2, HAS_LZMA, HAS_UNCOMPRESSPY from astrop...
48
1,956
pyomo
pyomo/solvers/tests/models/LP_unused_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...
205
6,902
jupytext
tests/data/notebooks/outputs/ipynb_to_script/jupyter_with_raw_cell_in_body.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- 1+2+3 # + active="" # This is a raw cell # - # This is a markdown cell
16
185
astropy
astropy/units/format/console.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "Console" unit format. """ from typing import ClassVar, Literal from astropy.units.core import UnitBase from astropy.units.enums import DeprecatedUnitAction from . import base class Console(base.Base): """ Output-only format f...
65
1,869
mlflow
tests/pyfunc/sample_code/func_code.py
.py
from mlflow.models import set_model def predict(model_input): return model_input set_model(predict)
9
108
pyomo
pyomo/solvers/plugins/solvers/direct_or_persistent_solver.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...
320
13,575
astropy
astropy/table/index.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Table Indexing Implementation for Astropy Tables ================================================ This module implements indexing functionality for astropy Table objects, enabling fast lookups and range queries on table columns. The indexing system u...
1,326
46,851
mlflow
mlflow/system_metrics/system_metrics_monitor.py
.py
"""Class for monitoring system stats.""" import logging import threading from mlflow.environment_variables import ( MLFLOW_SYSTEM_METRICS_NODE_ID, MLFLOW_SYSTEM_METRICS_SAMPLES_BEFORE_LOGGING, MLFLOW_SYSTEM_METRICS_SAMPLING_INTERVAL, ) from mlflow.exceptions import MlflowException from mlflow.system_metri...
217
9,831
onnxruntime
onnxruntime/test/testdata/dmmha_inside_mha_data.py
.py
import numpy as np import onnxruntime as ort from onnxruntime import OrtValue np.random.seed(0) # Whisper decoder self attention with past_kv, present_kv, buffer sharing enabled, mask, and bias # Used in decoder-with-past's self-attention layers # For CUDA, K caches are transposed and reshaped from 4D to 5D for Dec...
196
8,921
pyomo
pyomo/mpec/tests/test_minlp.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...
140
4,736
readthedocs.org
readthedocs/aws/security_token_service.py
.py
""" Module to interact with AWS STS (Security Token Service) to assume a role and get temporary scoped credentials. This is mainly used to generate temporary credentials to interact with S3 buckets from the builders. In order to make use of STS, we need: - Create a role in IAM with a trusted entity type set to the A...
267
10,168
wagtail
wagtail/test/utils/wagtail_factories/builder.py
.py
from itertools import zip_longest from factory import SubFactory from factory.builder import StepBuilder from wagtail import blocks class StreamFieldFactoryException(Exception): pass class InvalidDeclaration(StreamFieldFactoryException): pass class DuplicateDeclaration(StreamFieldFactoryException): ...
142
6,347
pyro
examples/sparse_gamma_def.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 # This is an implementation of the sparse gamma deep exponential family model described in # Ranganath, Rajesh, Tang, Linpeng, Charlin, Laurent, and Blei, David. Deep exponential families. # # To do inference we use one of the foll...
298
12,106
beam
sdks/python/apache_beam/examples/complete/juliaset/setup.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...
126
4,761
openvino
tests/time_tests/test_runner/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: * `--test_conf` - Path to test configu...
428
13,965
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_apply_voucher_to_the_specific_product_per_order.py
.py
import pytest from ....product.utils import ( create_category, create_product, create_product_channel_listing, create_product_type, create_product_variant, create_product_variant_channel_listing, ) from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ......
310
9,242
pyomo
pyomo/scripting/plugins/__init__.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...
13
644
onnx
onnx/reference/ops/op_global_average_pool.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun def _global_average_pool(x: np.ndarray) -> np.ndarray: axis = tuple(range(2, np.ndim(x))) y = np.average(x, axis=axis) for _ in a...
22
487
django-cms
cms/test_utils/project/app_with_two_cms_config_classes/cms_config.py
.py
from cms.app_base import CMSAppConfig, CMSAppExtension class CMSConfigConfig(CMSAppConfig): pass class CMSConfigConfig2(CMSAppConfig): pass class CMSExtension(CMSAppExtension): pass
14
200
wandb
wandb/sdk/artifacts/storage_handlers/azure_handler.py
.py
"""Azure storage handler.""" from __future__ import annotations from pathlib import PurePosixPath from types import ModuleType from typing import TYPE_CHECKING from urllib.parse import ParseResult, parse_qsl, urlparse import wandb from wandb import util from wandb.sdk.artifacts.artifact_file_cache import get_artifac...
220
8,472
saleor
saleor/graphql/order/tests/test_draft_order_validate.py
.py
import datetime from unittest.mock import patch import pytest from django.core.exceptions import ValidationError from ....order.error_codes import OrderErrorCode from ....plugins.manager import get_plugins_manager from ....product.models import ProductVariant from ..utils import validate_draft_order def test_valida...
299
9,433
mlflow
mlflow/tracing/processor/inference_table.py
.py
import json import logging from opentelemetry.context import Context from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from opentelemetry.sdk.trace import Span as OTelSpan from opentelemetry.sdk.trace.export import SimpleSpanProcessor, SpanExporter from mlflow.entities.span import create_mlflow_spa...
190
8,292
saleor
saleor/core/tests/test_search.py
.py
import pytest from django.db.models import Value from ...account.models import User from ...account.search import update_user_search_vector from ...checkout.models import Checkout from ...checkout.search.indexing import update_checkouts_search_vector from ...product.models import Product, ProductChannelListing from .....
513
14,780
beam
sdks/python/apache_beam/yaml/yaml_transform_unit_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...
1,135
31,572
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Transpose.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [2, 3], 'perm': [1, 0], 'conjugate': False}, {'shape': [2, 3, 5], 'perm': [2, 0, 1], 'conjugate': True}, {'shape': [2, 3, 5, 10], 'perm': [1, 2, 3, 0], 'conjugate': False}, ] class ...
33
1,191
conda
conda/cli/common.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Common utilities for conda command line tools.""" from __future__ import annotations import re from logging import getLogger from os.path import ( exists, normcase, ) from typing import TYPE_CHECKING from ..auxlib.ish import dals f...
339
11,110
beam
sdks/python/apache_beam/metrics/metricbase.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...
170
5,180
pyomo
pyomo/contrib/cp/scheduling_expr/scheduling_logic.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,498
openvino
src/bindings/python/src/openvino/passes/graph_rewrite.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # type: ignore from openvino._pyopenvino.passes import MatcherPass from openvino._pyopenvino.passes import GraphRewrite as GraphRewriteBase from openvino._pyopenvino.passes import BackwardGraphRewrite as BackwardGr...
34
1,345
black
tests/data/cases/remove_await_parens.py
.py
import asyncio # Control example async def main(): await asyncio.sleep(1) # Remove brackets for short coroutine/task async def main(): await (asyncio.sleep(1)) async def main(): await ( asyncio.sleep(1) ) async def main(): await (asyncio.sleep(1) ) # Check comments async def main():...
196
3,538
wagtail
wagtail/models/revisions.py
.py
import logging from django.conf import settings from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.core.serializers.json import DjangoJSONEncoder from django.db impo...
493
18,056
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/pf_eigenvalue_canon.py
.py
from cvxpy.atoms.affine.binary_operators import matmul from cvxpy.expressions.variable import Variable from cvxpy.reductions.dgp2dcp.canonicalizers.mul_canon import mul_canon from cvxpy.reductions.dgp2dcp.canonicalizers.mulexpression_canon import ( mulexpression_canon, ) def pf_eigenvalue_canon(expr, args): X...
20
684
beam
sdks/python/apache_beam/runners/interactive/testing/integration/screen_diff.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...
243
9,234
readthedocs.org
readthedocs/gold/views.py
.py
"""Gold subscription views.""" import json import structlog from django.conf import settings from django.contrib import messages from django.http import HttpResponseRedirect from django.http import JsonResponse from django.shortcuts import get_object_or_404 from django.urls import reverse_lazy from django.utils.trans...
197
6,743
clearml
clearml/storage/archive.py
.py
import os import tarfile from typing import Union, Any from pathlib import Path from zipfile import ZipFile from .filepaths import is_within_directory def extract_zip_archive( archive_path: str, target: str = ".", ) -> None: """ Extracts a .zip archive file to a target location. :param str archi...
116
3,629
bazel
scripts/docs/create_release_docs.py
.py
# Lint as: python3 # pylint: disable=g-direct-third-party-import # 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.apa...
202
6,436
black
tests/data/cases/string_prefixes.py
.py
#!/usr/bin/env python3 name = "Łukasz" (f"hello {name}", F"hello {name}") (b"", B"") (u"", U"") (r"", R"") (rf"", fr"", Rf"", fR"", rF"", Fr"", RF"", FR"") (rb"", br"", Rb"", bR"", rB"", Br"", RB"", BR"") def docstring_singleline(): R"""2020 was one hell of a year. The good news is that we were able to""" def...
46
845
scikit-bio
skbio/sequence/tests/test_transition.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. # --------------------------------------------...
490
16,693
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/map_lambda.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
60
1,716
pyomo
pyomo/solvers/plugins/converter/pico.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,564
metrics
tests/unittests/regression/test_crps.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
86
3,162
openvino
tools/commit_slider/utils/helpers.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import importlib import shutil import os import sys import subprocess # nosec B404 import csv import shlex from enum import Enum import re import json import logging as log from argparse import ArgumentParser from utils.cfg_manager impo...
1,067
35,796
probability
tensorflow_probability/python/bijectors/moyal_cdf.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...
148
5,308
beam
sdks/python/apache_beam/io/gcp/pubsub_it_pipeline.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...
95
3,206
readthedocs.org
readthedocs/projects/tests/test_build_tasks.py
.py
import os import pathlib import textwrap import uuid from pathlib import Path from unittest import mock import django_dynamic_fixture as fixture from django_dynamic_fixture import get import pytest from django.conf import settings from django.test.utils import override_settings from readthedocs.allauth.providers.gith...
3,177
111,456
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_TransposeConv.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import os import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest np.random.seed(42) test_params = [ {'shape': [1, 3, 4, 1], 'ksize': [1, 1, 1, 1], 'output_shape': [1, 3,...
101
4,716
pyomo
pyomo/scripting/plugins/solve.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...
245
8,416
sqlmap
plugins/generic/takeover.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os from lib.core.common import Backend from lib.core.common import getSafeExString from lib.core.common import isDigit from lib.core.common import isStackingAvailable from...
482
18,208
pyomo
pyomo/contrib/viewer/model_select.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...
105
3,598
pyro
pyro/distributions/transforms/softplus.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from torch.distributions import constraints from torch.distributions.transforms import Transform from torch.nn.functional import softplus def softplus_inv(y): return y + y.neg().expm1().neg().log() # Backport of https://github....
63
1,665
wagtail
wagtail/images/api/v3/registry.py
.py
from wagtail.api.v3.registry import ContentTypeRegistration, registry from wagtail.images import get_image_model from .schemas import build_image_schemas def register_content_types() -> None: """Register the active image model's read/create/patch schemas.""" Image = get_image_model() read_schema, create_...
20
639
pyro
pyro/distributions/transforms/affine_coupling.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import operator from functools import partial, reduce import torch from torch.distributions.utils import _sum_rightmost from pyro.nn import ConditionalDenseNN, DenseNN from .. import constraints from ..conditional import Conditi...
396
15,805
mlflow
tests/telemetry/test_track.py
.py
import time from unittest import mock import pytest from mlflow.environment_variables import MLFLOW_DISABLE_TELEMETRY from mlflow.telemetry.client import ( TelemetryClient, _fetch_server_info, get_telemetry_client, set_telemetry_client, ) from mlflow.telemetry.events import CreateLoggedModelEvent, Eve...
384
13,242
biopython
Tests/test_SeqIO_FastaIO.py
.py
# Copyright 2009-2013 by Peter Cock. All rights reserved. # Parts copyright 1999 by Jeffrey Chang. All rights reserved. # 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. """Tests for Bio.SeqIO.FastaIO...
234
8,999
pdm
tests/models/test_setup_parsing.py
.py
import pytest from pdm.models.setup import Setup @pytest.mark.parametrize( "content, result", [ ( """[metadata] name = foo version = 0.1.0 """, Setup("foo", "0.1.0"), ), ( """[metadata] name = foo version = attr:foo.__version__ """, Setu...
116
2,556
pyro
tests/contrib/gp/test_kernels.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from collections import namedtuple import pytest import torch from pyro.contrib.gp.kernels import ( RBF, Brownian, Constant, Coregionalize, Cosine, Exponent, Exponential, Linear, Matern32, ...
153
4,744
mlflow
mlflow/utils/_capture_transformers_modules.py
.py
""" This script should be executed in a fresh python interpreter process using `subprocess`. """ import json import os import sys import mlflow from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.utils._capture_modules import ( _CaptureImporte...
76
2,584
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_While.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest class TestTFLiteWhileLayerTest(TFLiteLayerTest): inputs = ["Input"] outputs = ["While"] allowed_ops = ["AD...
31
1,000