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
onnx
onnx/backend/test/case/node/melweightmatrix.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 MelWeightMatrix(Base): @staticmethod def export() -> None: ...
91
3,700
pyomo
pyomo/contrib/appsi/utils/get_objective.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...
22
873
attrs
docs/conf.py
.py
# SPDX-License-Identifier: MIT import os from importlib import metadata from pathlib import Path # Set canonical URL from the Read the Docs Domain html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") # Tell Jinja2 templates the build is running on Read the Docs if os.environ.get("READTHEDOCS", "") == "Tr...
201
5,981
confluent-kafka-python
tests/integration/schema_registry/data/proto/SInt64Value_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: tests/integration/schema_registry/data/proto/SInt64Value.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.pro...
30
1,245
saleor
saleor/order/tests/test_fetch.py
.py
from decimal import Decimal import pytest from ...product.models import ProductVariantChannelListing from ..fetch import EditableOrderLineInfo, fetch_draft_order_lines_info @pytest.mark.django_db @pytest.mark.count_queries(autouse=False) def test_fetch_draft_order_lines_info( draft_order_and_promotions, django_...
156
5,477
readthedocs.org
readthedocs/config/tests/test_utils.py
.py
from .utils import apply_fs def test_apply_fs_with_empty_contents(tmpdir): # Doesn't do anything if second parameter is empty. apply_fs(tmpdir, {}) assert tmpdir.listdir() == [] def test_apply_fs_create_empty_file(tmpdir): # Create empty file. apply_fs(tmpdir, {"file": ""}) assert len(tmpdir...
27
756
django-cms
cms/tests/test_migrations.py
.py
import importlib from io import StringIO from django.apps import apps from django.core.management import call_command from django.db import IntegrityError, connection, migrations, models, transaction from django.db.migrations.state import ProjectState from django.test import TestCase, TransactionTestCase, override_set...
177
7,500
openvino
src/bindings/python/src/openvino/opset6/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np """Factory functions for all openvino ops.""" from typing import Optional, Union from functools import partial, singledispatch from openvino import Node, Type, PartialShape, Output, Shape fro...
223
7,775
probability
tensorflow_probability/python/bijectors/softfloor.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...
253
10,756
metrics
src/torchmetrics/functional/nominal/theils_u.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...
196
7,107
hypercorn
src/hypercorn/protocol/ws_stream.py
.py
from __future__ import annotations from collections.abc import Awaitable, Callable, Iterable from enum import auto, Enum from io import BytesIO, StringIO from time import time from urllib.parse import unquote from wsproto.connection import Connection, ConnectionState, ConnectionType from wsproto.events import ( B...
386
15,174
wandb
wandb/apis/public/query_generator.py
.py
from __future__ import annotations class QueryGenerator: """QueryGenerator is a helper object to write filters for runs.""" INDIVIDUAL_OP_TO_MONGO = { "!=": "$ne", ">": "$gt", ">=": "$gte", "<": "$lt", "<=": "$lte", "IN": "$in", "NIN": "$nin", "...
177
6,507
cvxpy
cvxpy/reductions/dgp2dcp/util.py
.py
""" Copyright 2024 the 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, softw...
25
851
pyomo
examples/performance/jump/opf_66200bus.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...
350
9,659
onnx
onnx/reference/ops/op_mul.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunBinaryNumpy class Mul(OpRunBinaryNumpy): def __init__(self, onnx_node, run_params): OpRunBinaryNumpy.__init__(self, np.multiply, ...
14
343
qutip
doc/guide/scripts/correlation_ex4.py
.py
import numpy as np import matplotlib.pyplot as plt import qutip N = 25 taus = np.linspace(0, 25.0, 200) a = qutip.destroy(N) H = 2 * np.pi * a.dag() * a kappa = 0.25 n_th = 2.0 # bath temperature in terms of excitation number c_ops = [np.sqrt(kappa * (1 + n_th)) * a, np.sqrt(kappa * n_th) * a.dag()] states = [ ...
39
1,102
gunicorn
tests/requests/invalid/017.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.config import Config from gunicorn.http.errors import LimitRequestHeaders cfg = Config() request = LimitRequestHeaders
10
240
sphinx
sphinx/builders/manpage.py
.py
"""Manual pages builder.""" from __future__ import annotations from typing import TYPE_CHECKING from sphinx import addnodes from sphinx._cli.util.colour import darkgreen from sphinx.builders import Builder from sphinx.locale import __ from sphinx.util import logging from sphinx.util.display import progress_message f...
140
4,500
textual
tests/snapshot_tests/snapshot_apps/data_table_column_cursor.py
.py
import csv import io from textual.app import App, ComposeResult from textual.widgets import DataTable CSV = """lane,swimmer,country,time 4,Joseph Schooling,Singapore,50.39 2,Michael Phelps,United States,51.14 5,Chad le Clos,South Africa,51.14 6,László Cseh,Hungary,51.14 3,Li Zhuhao,China,51.26 8,Mehdy Metella,France,...
37
883
beam
sdks/python/apache_beam/ml/gcp/cloud_dlp.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...
227
8,376
saleor
saleor/checkout/tests/fixtures/checkout_with_transaction.py
.py
from decimal import Decimal import pytest from ....payment.models import TransactionItem @pytest.fixture def checkout_with_item_and_transaction_item(checkout_with_item): TransactionItem.objects.create( name="Credit card", psp_reference="PSP ref", available_actions=["refund"], cur...
19
447
textual
docs/examples/guide/command_palette/command02.py
.py
from __future__ import annotations from functools import partial from pathlib import Path from textual.app import App, ComposeResult from textual.command import Hit, Hits, Provider from textual.containers import VerticalScroll from textual.widgets import Static class PythonFileCommands(Provider): """A command p...
69
2,101
probability
tensorflow_probability/python/distributions/dirichlet.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...
572
22,056
onnx
onnx/reference/ops/op_prelu.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class PRelu(OpRun): def _run(self, x, slope): try: return (np.where(x > 0, x, x * slope).astype(x.dtype),) ex...
35
1,170
onnxruntime
onnxruntime/test/testdata/transform/recompute/recompute_test_graph_generator.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """This file is used to generate test data for MemoryOptimizer tests in onnxruntime/test/optimizer/memory_optimizer_test.cc. Be noticed, after run this script, manually rename recompute_XXXX_execution_model_training.onnx to ...
89
2,683
textual
docs/examples/guide/styles/box_sizing01.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...
38
1,193
saleor
saleor/graphql/payment/mutations/payment/payment_void.py
.py
import graphene from django.core.exceptions import ValidationError from .....payment import PaymentError, gateway from .....payment.error_codes import PaymentErrorCode from .....payment.utils import mark_checkout_search_index_dirty from .....permission.enums import OrderPermissions from ....core import ResolveInfo fro...
50
1,944
coremltools
coremltools/optimize/torch/quantization/quantization_config.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import logging as _logging from collections import OrderedDict as _OrderedDict from enum import Enum ...
455
20,046
clearml
clearml/backend_api/services/v2_9/auth.py
.py
""" auth service This service provides authentication management and authorization validation for the entire system. """ from typing import List, Optional, Any from datetime import datetime import six from dateutil.parser import parse as parse_datetime from ....backend_api.session import ( NonStrictDataModel, ...
577
17,597
mlflow
tests/resources/mlflow-test-plugin/mlflow_test_plugin/file_store.py
.py
import urllib.parse from mlflow.store.tracking.file_store import FileStore class PluginFileStore(FileStore): """FileStore provided through entrypoints system""" def __init__(self, store_uri=None, artifact_uri=None): path = urllib.parse.urlparse(store_uri).path if store_uri else None self.is_...
13
379
openvino
src/frontends/onnx/tests/tests_python/test_ops_binary.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import onnx import pytest from onnx.helper import make_graph, make_model, make_tensor_value_info from tests.tests_python.utils import run_model def import_and_compute(op_type, input_data_left...
135
5,437
astropy
astropy/uncertainty/core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Distribution class and associated machinery. """ import builtins import numpy as np from numpy.lib._function_base_impl import _parse_gufunc_signature from numpy.lib._stride_tricks_impl import DummyArray from numpy.lib.array_utils import normalize_ax...
671
27,660
saleor
saleor/site/patch_sites.py
.py
"""A hack to allow safe clearing of the cache in django.contrib.sites. Since django.contrib.sites may not be thread-safe when there are multiple instances of the application server, we're patching it with a thread-safe structure and methods that use it underneath. """ import threading from django.contrib.sites.model...
84
3,175
textual
src/textual/getters.py
.py
""" Descriptors to define properties on your widget, screen, or App. """ from __future__ import annotations from inspect import isclass from typing import TYPE_CHECKING, Callable, Generic, TypeVar, overload from textual._context import NoActiveAppError, active_app from textual.css.query import NoMatches, QueryType,...
226
6,864
sphinx
tests/test_util/typing_test_data.py
.py
from inspect import Signature from numbers import Integral from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, TypeVar, Union def f0(x: int, y: Integral) -> None: pass def f1(x: list[int]) -> List[int]: pass T = TypeVar('T') T_co = TypeVar('T_co', covariant=True) T_contra = TypeVar('T_...
134
2,085
onnx
onnx/reference/ops/op_trilu.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class Trilu(OpRun): def _run(self, x, k=None, upper=None): k = 0 if k is None else k.item() if upper: return ...
17
385
cvxpy
cvxpy/reductions/solvers/nlp_solvers/knitro_nlpif.py
.py
""" Copyright 2025, the 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, s...
414
15,050
mlflow
mlflow/tracking/request_header/abstract_request_header_provider.py
.py
from abc import ABCMeta, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class RequestHeaderProvider: """ Abstract base class for specifying custom request headers to add to outgoing requests (e.g. request headers specifying the environment from which mlflow is runn...
37
1,061
textual
tests/snapshot_tests/snapshot_apps/markup.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label class ContentApp(App): def compose(self) -> ComposeResult: yield Label("[bold]Bold[/] [italic]Italic[/] [u]Underline[/] [s]Strike[/s]") yield Label( "[$primary]Primary[/] [$secondary]Secondary[/] [$warning...
25
877
sqlmap
plugins/dbms/clickhouse/fingerprint.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.common import Backend from lib.core.common import Format from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.e...
92
2,612
pyomo
pyomo/core/tests/unit/test_block_model.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...
167
4,703
probability
tensorflow_probability/python/math/psd_kernels/exponentiated_quadratic_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...
162
6,110
biopython
Bio/motifs/mast.py
.py
# Copyright 2008 by Bartek Wilczynski. # Adapted from Bio.MEME.Parser by Jason A. Hackney. 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. """Module for the support of Motif Alig...
140
4,915
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_SegmentSum.py
.py
import platform import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [4], 'segment_ids': [0, 0, 1, 1]}, {'shape': [4], 'segment_ids': [0, 1, 2, 2]}, {'shape': [4], 'segment_ids': [0, 1, 2, 3]}, {'shape': [4], 'segment_ids': [0, 0, ...
49
1,919
mkdocs-material
material/extensions/__init__.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...
20
1,125
wandb
wandb/analytics/__init__.py
.py
__all__ = ( "get_sentry", "TelemetryContext", "TelemetryRecorder", ) from .opentelemetry import TelemetryContext, TelemetryRecorder from .sentry import get_sentry
9
176
onnxruntime
orttraining/orttraining/python/training/utils/hooks/_zero_offload_subscriber.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import ctypes import inspect import warnings from collections import Ord...
653
28,667
probability
tensorflow_probability/python/layers/variable_input_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...
113
4,658
beam
sdks/python/apache_beam/yaml/yaml_combine_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...
193
5,893
mlflow
tests/pyfunc/test_dependencies_functions.py
.py
from pathlib import Path from unittest import mock import pytest import sklearn from sklearn.linear_model import LinearRegression import mlflow.utils.requirements_utils from mlflow.exceptions import MlflowException from mlflow.pyfunc import get_model_dependencies from mlflow.utils import PYTHON_VERSION def test_get...
140
4,313
saleor
saleor/graphql/product/tests/mutations/test_product_variant_bulk_update.py
.py
from unittest import mock from unittest.mock import patch import graphene import pytest from django.test import override_settings from .....discount.models import PromotionRule from .....discount.utils.promotion import get_active_catalogue_promotion_rules from .....graphql.core.enums import ErrorPolicyEnum from ........
1,504
50,461
saleor
saleor/graphql/product/tests/mutations/test_product_delete.py
.py
from functools import partial from unittest.mock import ANY, patch import graphene import pytest from django.utils.functional import SimpleLazyObject from prices import Money, TaxedMoney from .....attribute.models import AttributeValue from .....attribute.utils import associate_attribute_values_to_instance from ........
511
16,811
hatch
tests/backend/builders/hooks/test_custom.py
.py
import re import pytest from hatchling.builders.hooks.custom import CustomBuildHook from hatchling.utils.constants import DEFAULT_BUILD_SCRIPT def test_no_path(isolation): config = {"path": ""} with pytest.raises(ValueError, match="Option `path` for build hook `custom` must not be empty if defined"): ...
104
2,886
luigi
test/cmdline_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
377
14,445
gunicorn
benchmarks/dirty_benchmark.py
.py
#!/usr/bin/env python3 # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Dirty Pool Benchmark Runner Stress tests and benchmarks the dirty arbiter pool to find bottlenecks and optimization opportunities. Test Modes: - Isolated: Direct client -> arbiter -> wo...
1,062
34,775
pyomo
pyomo/contrib/pynumero/interfaces/tests/test_nlp_projections.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...
622
23,325
metrics
src/torchmetrics/image/fid.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...
496
22,297
readthedocs.org
readthedocs/core/utils/admin.py
.py
import json from django.utils.safestring import mark_safe from pygments import highlight from pygments.formatters import HtmlFormatter from pygments.lexers import JsonLexer def pretty_json_field(instance, field): """ Display a pretty version of a JSON field in the admin. Thanks to PyDanny: https://www.p...
29
813
saleor
saleor/tests/e2e/webhooks/utils.py
.py
from ..utils import get_graphql_content WEBHOOK_CREATE_MUTATION = """ mutation WebhookCreate($input: WebhookCreateInput!) { webhookCreate(input: $input) { errors { field code message } webhook { id name isActive targetUrl syncEvents{ eventType ...
51
866
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_dot.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.tf2_layer_test_class import CommonTF2LayerTest rng = np.random.default_rng(233534) class TestKerasDot(CommonTF2LayerTest): def _prepare_input(self, inputs_info):...
58
2,586
saleor
saleor/graphql/product/mutations/collection/collection_remove_products.py
.py
import graphene from .....discount.utils.promotion import mark_active_catalogue_promotion_rules_as_dirty from .....permission.enums import ProductPermissions from .....product import models from ....core import ResolveInfo from ....core.context import ChannelContext from ....core.doc_category import DOC_CATEGORY_PRODU...
63
2,362
hatch
src/hatch/env/lockers/pip.py
.py
from __future__ import annotations import tempfile from typing import TYPE_CHECKING from hatch.env.lockers.interface import LockerInterface from hatch.env.utils import add_verbosity_flag from hatch.utils.fs import Path if TYPE_CHECKING: from hatch.env.plugin.interface import EnvironmentInterface class PipLocke...
115
3,806
bazel
src/test/py/bazel/launcher_test.py
.py
# pylint: disable=g-bad-file-header # Copyright 2017 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 ...
987
34,092
wagtail
wagtail/images/signal_handlers.py
.py
from django.conf import settings from django.db import transaction from django.db.models.signals import post_delete, post_save from wagtail.images import get_image_model from wagtail.tasks import delete_file_from_storage_task from .tasks import set_image_focal_point_task def post_delete_file_cleanup(instance, **kwa...
42
1,474
openvino
tests/model_hub_tests/pytorch/test_easyocr.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch from openvino import PartialShape from torch_utils import TestTorchConvertModel, skip_npu_precommit # To make tests reproducible we seed the random generator torch.manual_seed(0) NPU_PRECOMMI...
58
2,180
pymc
tests/test_initial_point.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...
314
11,820
astropy
astropy/modeling/mappings.py
.py
""" Special models useful for complex compound models where control is needed over which outputs from a source model are mapped to which inputs of a target model. """ # pylint: disable=invalid-name from astropy.units import Quantity from .core import FittableModel, Model __all__ = ["Identity", "Mapping", "UnitsMappi...
328
10,841
sphinx
sphinx/ext/apidoc/_shared.py
.py
from __future__ import annotations import dataclasses from typing import TYPE_CHECKING from sphinx.locale import __ from sphinx.util import logging if TYPE_CHECKING: from collections.abc import Sequence, Set from pathlib import Path from typing import Final, Self from sphinx.config import Config LO...
100
2,908
pyomo
pyomo/core/plugins/transform/__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...
26
874
saleor
saleor/graphql/page/tests/mutations/test_page_bulk_delete.py
.py
import graphene import pytest from .....attribute.models import AttributeValue from .....attribute.utils import associate_attribute_values_to_instance from .....page.models import Page from .....product.search import update_products_search_vector from ....tests.utils import get_graphql_content PAGE_BULK_DELETE_MUTATI...
277
8,283
onnxruntime
tools/python/resolve_absl_deps_dynamic.py
.py
#!/usr/bin/env python3 """Resolve and topologically sort Abseil library dependencies.""" from __future__ import annotations import argparse import io import os import re import sys import tempfile import zipfile from typing import TYPE_CHECKING import requests if TYPE_CHECKING: from collections.abc import Seque...
247
8,709
python-prompt-toolkit
src/prompt_toolkit/layout/__init__.py
.py
""" Command line layout definitions ------------------------------- The layout of a command line interface is defined by a Container instance. There are two main groups of classes here. Containers and controls: - A container can contain other containers or controls, it can have multiple children and it decides abou...
148
3,603
pyomo
pyomo/gdp/tests/test_partition_disjuncts.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...
2,114
88,868
astropy
astropy/coordinates/tests/test_geodetic_representations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test geodetic representations""" from copy import deepcopy import pytest from astropy import units as u from astropy.coordinates.representation import ( DUPLICATE_REPRESENTATIONS, REPRESENTATION_CLASSES, BaseBodycentricRepresentation, ...
243
10,163
mlflow
mlflow/tracking/request_auth/abstract_request_auth_provider.py
.py
from abc import ABC, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class RequestAuthProvider(ABC): """ Abstract base class for specifying custom request auth to add to outgoing requests When a request is sent, MLflow will iterate through all registered RequestAut...
35
1,041
astropy
astropy/nddata/bitmask.py
.py
""" A module that provides functions for manipulating bit masks and data quality (DQ) arrays. """ import numbers import warnings import numpy as np __all__ = [ "BitFlagNameMap", "InvalidBitFlag", "bitfield_to_boolean_mask", "extend_bit_flag_map", "interpret_bit_flags", ] _ENABLE_BITFLAG_CACHIN...
711
27,392
pyomo
examples/pyomo/concrete/sp.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...
35
1,055
loguru
tests/test_activation.py
.py
import pytest from loguru import logger @pytest.mark.parametrize( ("name", "should_log"), [ ("", False), ("tests", False), ("test", True), ("testsx", True), ("tests.", True), ("tests.test_activation", False), ("tests.test_activation.", True), ("...
154
3,693
cvxpy
cvxpy/reductions/eliminate_zero_sized.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 ...
150
5,613
clearml
clearml/binding/frameworks/__init__.py
.py
import os import shutil import sys import threading from enum import Enum from random import randint from tempfile import mkstemp from typing import TYPE_CHECKING, Callable, Dict, Optional, Union, Any from pathlib2 import Path from ...backend_interface.model import Model from ...config import running_remotely from .....
557
22,501
kombu
t/unit/asynchronous/aws/test_aws.py
.py
from __future__ import annotations from unittest.mock import Mock from kombu.asynchronous.aws import connect_sqs from .case import AWSCase class test_connect_sqs(AWSCase): def test_connection(self): x = connect_sqs('AAKI', 'ASAK', http_client=Mock()) assert x assert x.sqs_connection
16
318
pyomo
pyomo/contrib/simplification/tests/test_simplification.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...
122
4,186
conda
tests/_preview/env_setup/cli/test_main_install.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Integration tests for conda/_preview/env_setup/cli/main_install.py. These tests verify that: - When the env-setup preview is NOT enabled, `conda install` runs via the standard path. - When the env-setup preview IS enabled, `conda install` is...
53
1,770
scikit-bio
skbio/stats/_misc.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. # --------------------------------------------...
28
888
probability
tensorflow_probability/python/bijectors/scale_matvec_tril_test.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...
68
2,662
beam
sdks/python/apache_beam/io/source_test_utils.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...
740
26,148
wagtail
wagtail/admin/tests/test_icon_sprite.py
.py
from django.test import SimpleTestCase from wagtail.admin.icons import get_icon_sprite_hash, get_icon_sprite_url, get_icons from wagtail.test.utils.wagtail_tests import WagtailTestUtils class TestIconSpriteView(WagtailTestUtils, SimpleTestCase): def test_content_type(self): response = self.client.get(get...
42
1,539
sphinx
tests/roots/test-ext-math-compat/conf.py
.py
from docutils import nodes from docutils.parsers.rst import Directive extensions = ['sphinx.ext.mathjax'] def my_math_role(role, rawtext, text, lineno, inliner, options={}, content=[]): # NoQA: B006 text = 'E = mc^2' return [nodes.math(text, text)], [] class MyMathDirective(Directive): def run(self): ...
21
502
black
tests/data/cases/pyi_overload_groups.py
.py
# flags: --preview --pyi # # Test cases for blank line handling around overload groups in .pyi files: # - No blank lines between consecutive same-name decorated functions (overloads) # - No blank lines between overloads even when a function has a docstring # - Blank line enforced after an overload group before an unrel...
946
23,105
wandb
tests/unit_tests/test_public_api/test_registries_ordered_versions.py
.py
from __future__ import annotations import json import logging from collections.abc import Iterable from typing import TYPE_CHECKING import pytest from wandb._strutils import b64encode_ascii from wandb.apis.public.registries import _utils from wandb.apis.public.registries._utils import ( _project_id_from_gql_id, ...
272
8,546
biopython
Bio/CAPS/__init__.py
.py
# Copyright 2005 by Jonathan Taylor. # 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. """Cleaved amplified polymorphic sequence (CAPS) markers. A CAPS marker is a location a Dif...
131
4,111
probability
tensorflow_probability/python/distributions/binomial.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...
592
22,687
sphinx
sphinx/transforms/post_transforms/images.py
.py
"""Docutils transforms used by Sphinx.""" from __future__ import annotations import os import re from hashlib import sha1 from math import ceil from pathlib import Path from typing import TYPE_CHECKING from docutils import nodes from sphinx.locale import __ from sphinx.transforms import SphinxTransform from sphinx....
303
10,845
coremltools
coremltools/converters/mil/frontend/torch/converter.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import math from collections import OrderedDict from enum import Enum from typing import Dict, List, ...
1,473
68,316
pyro
pyro/infer/mcmc/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from pyro.infer.mcmc.adaptation import ArrowheadMassMatrix, BlockMassMatrix from pyro.infer.mcmc.api import MCMC, StreamingMCMC from pyro.infer.mcmc.hmc import HMC from pyro.infer.mcmc.nuts import NUTS from pyro.infer.mcmc.rwkernel...
19
490
pyomo
pyomo/contrib/mcpp/plugins.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
837
beam
sdks/python/apache_beam/yaml/yaml_udf_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...
486
15,688
pyro
tests/contrib/oed/test_linear_models_eig.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 import pyro.optim as optim from pyro.contrib.oed.eig import ( donsker_varadhan_eig, laplace_eig, lfire_eig, marginal_eig, marginal_likeli...
314
9,466
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/normNuc_canon.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
41
1,367
saleor
saleor/graphql/account/tests/benchmark/test_customer_bulk_update.py
.py
import graphene import pytest from .....account.models import User from ....tests.utils import get_graphql_content from ..bulk_mutations.test_customer_bulk_update import ( CUSTOMER_BULK_UPDATE_ATTRIBUTES_MUTATION, ) @pytest.mark.django_db @pytest.mark.count_queries(autouse=False) def test_customer_bulk_update_wi...
82
2,981