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
probability
tensorflow_probability/python/distributions/internal/__init__.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...
16
679
pyomo
pyomo/contrib/solver/solvers/knitro/solution.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...
94
2,959
sqlmap
lib/techniques/graphql/inject.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import json import re import time from collections import namedtuple from collections import OrderedDict from lib.core.common import beep from lib.core.common import randomStr f...
1,825
83,736
kafka
tests/kafkatest/services/monitor/http.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 ...
230
9,315
saleor
saleor/graphql/shipping/mutations/base.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from django.db.models import Exists, OuterRef from django.db.utils import IntegrityError from ....channel import models as channel_models from ....core.tracing import traced_atomic_transaction from ....shipping impo...
450
17,561
astropy
astropy/io/fits/hdu/compressed/_tiled_compression.py
.py
""" This module contains low level helper functions for compressing and decompressing buffer for the Tiled Table Compression algorithms as specified in the FITS 4 standard. """ import sys import warnings from math import prod import numpy as np from astropy.io.fits.hdu.base import BITPIX2DTYPE from astropy.utils.exc...
742
27,247
sqlmap
thirdparty/chardet/mbcharsetprober.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
92
3,413
astropy
astropy/coordinates/builtin_frames/galactic_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix from astropy.coordinates.transformations import DynamicMatrixTransform from .fk4 import FK4NoETerms from .f...
44
1,697
wagtail
wagtail/admin/views/generic/chooser.py
.py
import re import urllib.parse from django.conf import settings from django.contrib.admin.utils import quote, unquote from django.core.exceptions import ( ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied, ) from django.core.paginator import InvalidPage from django.db.models import Model from djang...
599
18,771
sphinx
tests/test_util/test_util_docutils_sphinx_directive.py
.py
from __future__ import annotations from types import SimpleNamespace from docutils import nodes from docutils.parsers.rst.languages import en as english from docutils.parsers.rst.states import ( Inliner, RSTState, RSTStateMachine, state_classes, ) from docutils.statemachine import StringList from docu...
151
4,976
mlflow
mlflow/entities/span.py
.py
import ast import base64 import json import logging from functools import cached_property from typing import Any, Union from opentelemetry.proto.resource.v1.resource_pb2 import Resource as OTelProtoResource from opentelemetry.proto.trace.v1.trace_pb2 import Span as OTelProtoSpan from opentelemetry.proto.trace.v1.trace...
1,499
60,678
wandb
wandb/apis/_generated/get_sweep.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/api/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import SweepFragment class GetSweep(GQLResult): project: GetSweepProject | None class GetSweepProject(GQLResult): sweep: SweepFragment | None GetS...
21
373
qutip
qutip/tests/test_ipynbtools.py
.py
import pytest pytest.importorskip("IPython") from qutip.ipynbtools import version_table @pytest.mark.parametrize('verbose', [False, True]) def test_version_table(verbose): html_data = version_table(verbose=verbose).data assert "<th>Software</th>" in html_data assert "<th>Version</th>" in html_data ass...
26
906
pdm
src/pdm/models/python.py
.py
from __future__ import annotations import os from functools import cached_property from pathlib import Path from typing import TYPE_CHECKING from packaging.version import InvalidVersion, Version from pdm.models.venv import VirtualEnv if TYPE_CHECKING: from findpython import PythonVersion class PythonInfo: ...
97
2,386
onnxruntime
tools/python/create_reduced_build_config.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import pathlib import sys import typing import onnx from util.file_utils import files_from_file_or_dir, path_match_suffix_ignore_case def _get_suffix_match_predicate(suffix: str): ...
158
6,058
wagtail
wagtail/api/v3/tests/test_schema_discovery.py
.py
import swapper from django.test import TestCase from django.urls import reverse from wagtail.api.v3.tests.base import TestV3Base from wagtail.test.utils import WagtailTestUtils PAGE_READ_SCHEMA_FIELDS = {"id", "title", "meta"} PAGE_READ_META_SCHEMA_FIELDS = { "type", "detail_url", "html_url", "slug", ...
106
4,055
pyomo
pyomo/core/tests/unit/kernel/test_kernel.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...
250
8,819
mlflow
tests/store/artifact/test_optimized_s3_artifact_repo.py
.py
import os import posixpath from datetime import datetime, timezone from unittest import mock from unittest.mock import ANY import pytest import requests from mlflow.protos.service_pb2 import FileInfo from mlflow.store.artifact.optimized_s3_artifact_repo import OptimizedS3ArtifactRepository from mlflow.store.artifact....
328
11,790
pyomo
examples/doc/samples/__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...
11
571
coveragepy
tests/test_venv.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 """Tests about understanding how third-party code is installed.""" from __future__ import annotations import os import os.path import shutil from pathlib impor...
407
14,421
onnx
onnx/reference/ops/op_reverse_sequence.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class ReverseSequence(OpRun): def _run(self, data, sequence_lens, batch_axis=None, time_axis=None): index = [slice(0, s) for s in data.shape] ...
21
705
wandb
tests/system_tests/test_artifacts/test_link_artifacts.py
.py
from __future__ import annotations import wandb from pytest import raises def test_get_artifact_collection_from_linked_artifact(linked_artifact): collection = linked_artifact.collection assert linked_artifact.entity == collection.entity assert linked_artifact.project == collection.project assert link...
178
6,734
coremltools
coremltools/test/sklearn_tests/test_standard_scalar.py
.py
# Copyright (c) 2017, 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 unittest import numpy as np from ..utils import load_boston from coremltools._deps import _HAS_...
65
1,955
clearml
examples/hyperdatasets/create_qa_entries.py
.py
""" Create a HyperDataset populated with raw Q&A pairs. The script demonstrates how to build Q&A entries, optionally enrich them with vector embeddings generated by a small local model, and upload them to a HyperDataset version. Example usage: python examples/hyperdatasets/create_qa_entries.py \ --projec...
348
11,979
probability
tensorflow_probability/python/sts/anomaly_detection/anomaly_detection_test.py
.py
# Copyright 2021 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...
187
8,205
sphinx
sphinx/ext/apidoc/_generate.py
.py
from __future__ import annotations import glob import os import os.path from importlib.machinery import EXTENSION_SUFFIXES from pathlib import Path from typing import TYPE_CHECKING from sphinx import package_dir from sphinx.ext.apidoc._shared import LOGGER from sphinx.locale import __ from sphinx.util.osutil import F...
354
11,856
ipython
tests/test_prefilter.py
.py
"""Tests for input manipulation machinery.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import pytest from IPython.core.prefilter import AutocallChecker # ----------------------------------...
155
4,852
attrs
tests/test_pattern_matching.py
.py
# SPDX-License-Identifier: MIT import pytest import attr class TestPatternMatching: """ Pattern matching syntax test cases. """ @pytest.mark.parametrize("dec", [attr.s, attr.define, attr.frozen]) def test_simple_match_case(self, dec): """ Simple match case statement works as exp...
101
2,245
hydra
plugins/hydra_ax_sweeper/setup.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # type: ignore from pathlib import Path from read_version import read_version from setuptools import find_namespace_packages, setup setup( name="hydra-ax-sweeper", version=read_version("hydra_plugins/hydra_ax_sweeper", "__init__.py"), ...
36
1,265
wandb
wandb/sdk/launch/sweeps/__init__.py
.py
import logging from collections.abc import Callable from typing import Any log = logging.getLogger(__name__) class SchedulerError(Exception): """Raised when a known error occurs with wandb sweep scheduler.""" class SweepNotFoundError(Exception): """Raised when a sweep is not found, typically because it was...
45
1,092
beam
sdks/python/apache_beam/coders/typecoders_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...
165
6,530
pyomo
pyomo/contrib/incidence_analysis/common/dulmage_mendelsohn.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...
97
3,737
astropy
astropy/cosmology/_src/tests/flrw/test_w0cdm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.w0cdm`.""" import numpy as np import pytest import astropy.units as u from astropy.cosmology import FlatwCDM, wCDM from astropy.cosmology._src.parameter import Parameter from astropy.cosmology._src.tests.test_core impo...
212
7,776
gunicorn
gunicorn/systemd.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import os import socket SD_LISTEN_FDS_START = 3 def listen_fds(unset_environment=True): """ Get the number of sockets inherited from systemd socket activation. :param unset_environment: clear system...
78
2,547
onnxruntime
orttraining/orttraining/python/training/ort_triton/_cache.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # from torch/_inductor/codecache.py import base64 import functools impor...
81
2,472
beam
sdks/python/apache_beam/ml/anomaly/detectors/pyod_adapter_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...
162
6,096
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Reduce.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest from common.utils.tflite_utils import additional_test_params from common.utils.tflite_utils import parametrize_tests test_ops = [ {'op_name': 'MEAN', 'op_func': 'tf.math.reduce_mean'}, {'op_name': 'REDUCE_ALL', 'o...
47
1,993
biopython
Tests/test_pairwise_alignment_map.py
.py
# 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 mapping pairwise alignments.""" import os import random import unittest try: import numpy as np except ImportError: from Bio im...
999
42,062
hatch
src/hatch/index/core.py
.py
from __future__ import annotations from functools import cached_property from typing import TYPE_CHECKING import hyperlink from hatch._version import __version__ if TYPE_CHECKING: import httpx2 from hatch.utils.fs import Path class IndexURLs: def __init__(self, repo: str): self.repo = hyperli...
106
3,326
confluent-kafka-python
tests/schema_registry/_async/test_json_serdes.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2024 Confluent Inc. # # 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 requi...
1,867
66,005
pyro
tests/contrib/oed/test_xexpx.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pyro.contrib.oed.eig import xexpx @pytest.mark.parametrize( "argument,output", [ (torch.tensor([float("-inf")]), torch.tensor([0.0])), (torch.tensor([0.0]), torch.tensor([0...
20
470
mlflow
examples/gateway/plugin/my-llm/my_llm/config.py
.py
import os from pydantic import field_validator from mlflow.gateway.base_models import ConfigModel class MyLLMConfig(ConfigModel): my_llm_api_key: str @field_validator("my_llm_api_key", mode="before") def validate_my_llm_api_key(cls, value): if value.startswith("$"): # This resolves ...
21
610
coveragepy
tests/test_misc.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 """Tests of miscellaneous stuff.""" from __future__ import annotations import sys from typing import Any from unittest import mock import pytest from coverage...
209
6,989
returns
returns/pointfree/bind_context_ioresult.py
.py
from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, TypeVar from returns.interfaces.specific.reader_ioresult import ReaderIOResultLikeN from returns.primitives.hkt import Kinded, KindN, kinded if TYPE_CHECKING: from returns.context import ReaderIOResult # no...
79
2,348
sqlmap
plugins/dbms/mckoi/__init__.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.enums import DBMS from lib.core.settings import MCKOI_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.mckoi.enumeration import Enumeration from...
30
898
onnxruntime
onnxruntime/test/python/contrib_ops/onnx_test_torch_embedding.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # # Test reference implementation and model for ONNX Runtime conrtib op torch_embedding import unittest import numpy as np import onnx from onnx_contrib_ops_helper import expect def torch_embedding_reference_implementation...
99
3,300
qutip
qutip/core/dimensions.py
.py
""" Internal use module for manipulating dims specifications. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations from collections.abc import Sequence import numpy as np import numbers from operator import getitem from functools import partial from typing import Any, Literal fro...
1,147
37,158
wagtail
wagtail/snippets/tests/test_snippet_models.py
.py
from django.core import checks from django.test import TestCase from django.urls import reverse from wagtail.admin.forms import WagtailAdminModelForm from wagtail.admin.panels import FieldPanel, get_edit_handler from wagtail.snippets.models import SNIPPET_MODELS, register_snippet from wagtail.test.snippets.forms impor...
113
4,172
mlflow
mlflow/entities/presigned_download.py
.py
from __future__ import annotations from dataclasses import dataclass from typing import Any @dataclass class PresignedDownloadUrlResponse: """ Response containing a presigned URL for downloading an artifact directly from cloud storage. """ url: str headers: dict[str, str] file_size: int ...
34
830
pyro
pyro/optim/lr_scheduler.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from typing import Any, Dict, Iterable, List, Optional, Union, ValuesView from torch import Tensor from pyro.optim.optim import PyroOptim class PyroLRScheduler(PyroOptim): """ A wrapper for :class:`~torch.optim.lr_sched...
64
2,351
gunicorn
tests/test_http2_request.py
.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for HTTP/2 request and body classes.""" import pytest from gunicorn.http2.request import HTTP2Request, HTTP2Body from gunicorn.http2.stream import HTTP2Stream class MockConnection...
722
22,911
pyomo
pyomo/contrib/piecewise/tests/models.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
2,400
saleor
saleor/tests/e2e/checkout/test_checkout_add_gift_card_before_email.py
.py
import pytest from ..gift_cards.utils import create_gift_card from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( checkout_add_promo_code, checkout_complete, checkout_create, ...
121
4,137
pyomo
pyomo/contrib/alternative_solutions/tests/test_solnpool.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...
209
8,800
mlflow
mlflow/store/db_migrations/versions/0c779009ac13_add_deleted_time_field_to_runs_table.py
.py
"""add deleted_time field to runs table Create Date: 2022-07-27 14:13:36.162861 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "0c779009ac13" down_revision = "bd07f7e963c5" branch_labels = None depends_on = None def upgrade(): op.add_column("runs", sa.Co...
23
414
probability
spinoffs/inference_gym/inference_gym/targets/eight_schools_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...
59
2,116
sqlmap
lib/utils/hash.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from __future__ import print_function try: from crypt import crypt except: # removed ImportError because of https://github.com/sqlmapproject/sqlmap/issues/3171 from thir...
1,795
71,948
wandb
tests/unit_tests/test_term.py
.py
from __future__ import annotations import pytest import wandb from wandb import util from wandb.errors import term def test_no_dynamic_text_if_silent(emulated_terminal): # Set up as if stderr is a terminal. _ = emulated_terminal wandb.termsetup(wandb.Settings(silent=True), None) with term.dynamic_t...
168
4,811
onnxruntime
onnxruntime/test/python/transformers/test_rotary_embedding_fusion.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import os import sys import unittest import numpy as np import onnx from onnx impo...
447
16,532
rq
rq/decorators.py
.py
from __future__ import annotations from collections.abc import Callable, Sequence from functools import wraps from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from redis import Redis from .job import Retry from .defaults import DEFAULT_RESULT_TTL from .job import Callback from .queue import Queue fro...
134
5,357
confluent-kafka-python
tests/oauthbearer/aws/test_jwt_extractor.py
.py
# Copyright 2026 Confluent Inc. # # 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...
239
9,116
beam
sdks/python/apache_beam/examples/inference/tensorrt_object_detection.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...
257
7,297
coveragepy
tests/modules/ambiguous/pkg1/ambiguous.py
.py
amb = 1 amb = 2
3
16
wandb
tools/perf/scripts/bench_run_log.py
.py
from __future__ import annotations import argparse import json import logging import multiprocessing as mp import random import string import time from datetime import datetime from typing import Literal import numpy as np import wandb from .setup_helper import setup_package_logger logger = logging.getLogger(__name...
734
24,301
mlflow
mlflow/genai/judges/tools/get_traces_in_session.py
.py
""" Get traces in session tool for MLflow GenAI judges. This module provides a tool for retrieving traces from the same session to enable multi-turn evaluation capabilities. """ from mlflow.entities.trace import Trace from mlflow.exceptions import MlflowException from mlflow.genai.judges.tools.base import JudgeTool f...
111
4,378
astropy
astropy/timeseries/sampled.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import numpy as np from astropy import units as u from astropy.table import QTable, Table, groups from astropy.time import Time, TimeDelta from astropy.timeseries.core import BaseTimeSeries, autocheck_required_columns from astr...
435
16,664
coremltools
coremltools/converters/xgboost/_tree.py
.py
# Copyright (c) 2017, 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 coremltools as ct from coremltools import __version__ as ct_version from ._tree_ensemble import ...
91
2,691
pyomo
pyomo/common/tests/test_deprecated.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...
786
29,176
returns
returns/context/requires_context.py
.py
from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, Any, ClassVar, TypeAlias, TypeVar, final from returns.functions import identity from returns.future import FutureResult from returns.interfaces.specific import reader from returns.io import IOResult from returns....
450
14,892
kafka
tests/kafkatest/tests/core/throttling_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 ...
176
8,837
pyomo
pyomo/contrib/viewer/model_browser.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...
629
22,543
sphinx
tests/roots/test-ext-napoleon-paramtype/pkg/bar.py
.py
class Bar: """The bar.""" def list(self) -> None: """A list method.""" @staticmethod def int() -> float: """An int method.""" return 1.0
11
179
openvino
docs/scripts/remove_xml.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import shutil def remove_xml_dir(path): """ Remove doxygen xml folder """ if os.path.exists(path): shutil.rmtree(path, ignore_errors=True) def main(): import argparse parser = argparse.Argumen...
25
469
kafka
tests/kafkatest/tests/core/transactions_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 ...
256
13,702
coremltools
coremltools/converters/mil/frontend/tensorflow2/ssa_passes/__init__.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 from . import remove_vacuous_cond
7
253
astropy
astropy/io/fits/tests/test_diff.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.io import fits from astropy.io.fits.column import Column from astropy.io.fits.diff import ( FITSDiff, HDUDiff, HeaderDiff, ImageDataDiff, TableDataDiff, ) from astropy.io.fits.hdu import HD...
955
36,036
wagtail
wagtail/actions/unpublish_page.py
.py
import logging from wagtail.actions.unpublish import UnpublishAction, UnpublishPermissionError from wagtail.signals import page_unpublished logger = logging.getLogger("wagtail") class UnpublishPagePermissionError(UnpublishPermissionError): """ Raised when the page unpublish cannot be performed due to insuff...
72
2,131
mlflow
mlflow/server/prometheus_exporter.py
.py
from flask import request from prometheus_flask_exporter.multiprocess import GunicornInternalPrometheusMetrics from mlflow.version import VERSION def activate_prometheus_exporter(app): def mlflow_version(_: request): return VERSION return GunicornInternalPrometheusMetrics( app, expor...
18
458
returns
tests/test_io/test_ioresult_container/test_ioresult_functions/test_impure_safe.py
.py
import pytest from returns.io import IOSuccess, impure_safe @impure_safe def _function(number: int) -> float: return number / number @impure_safe(exceptions=(ZeroDivisionError,)) def _function_two(number: int | str) -> float: assert isinstance(number, int) return number / number @impure_safe((ZeroDiv...
56
1,437
mlflow
tests/models/test_cli.py
.py
import json import os import re import shutil import subprocess import sys import warnings from dataclasses import dataclass from io import BytesIO, StringIO from pathlib import Path from unittest import mock import numpy as np import pandas as pd import pytest import sklearn import sklearn.datasets import sklearn.lin...
1,045
35,512
onnx
onnx/backend/test/case/node/relu.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 Relu(Base): @staticmethod def export() -> None: node =...
25
582
probability
tensorflow_probability/python/distributions/plackett_luce_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...
176
7,837
ipython
IPython/testing/plugin/ipdoctest.py
.py
"""Nose Plugin that supports IPython doctests. Limitations: - When generating examples for use as doctests, make sure that you have pretty-printing OFF. This can be done either by setting the ``PlainTextFormatter.pprint`` option in your configuration file to False, or by interactively disabling it with %Ppri...
300
11,861
onnx
onnx/reference/ops/op_constant_of_shape.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 ConstantOfShape(OpRun): def _run(self, data, value: np.array | None = None): if self.value is None: value = np....
30
951
mlflow
tests/models/test_utils.py
.py
import os import random from typing import Any, NamedTuple from unittest import mock import numpy as np import pandas as pd import pytest import sklearn.linear_model as logreg_module from sklearn import datasets import mlflow from mlflow import MlflowClient from mlflow.entities.model_registry import ModelVersion from...
658
23,191
pymc
tests/sampling/test_jax.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...
505
16,036
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_timedistributed.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasTimeDistributed(CommonTF2LayerTest): def create_keras_timedistributed_net(self, input_names, input_shapes, input_type,...
43
1,792
wandb
wandb/sdk/artifacts/_generated/update_artifact.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import ArtifactFragment class UpdateArtifact(GQLResult): result: UpdateArtifactResult | None class UpdateArtifactResult(GQLResult): artifact: ...
21
407
saleor
saleor/attribute/__init__.py
.py
class AttributeInputType: """The type that we expect to render the attribute's values as.""" DROPDOWN = "dropdown" MULTISELECT = "multiselect" FILE = "file" REFERENCE = "reference" SINGLE_REFERENCE = "single-reference" NUMERIC = "numeric" RICH_TEXT = "rich-text" PLAIN_TEXT = "plain-...
130
3,439
astropy
astropy/stats/tests/test_fast_sigma_clip.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for the _sigma_clip_fast C extension in astropy.stats. Note: The underlying C implementation assumes input data arrays are sorted. """ import warnings import numpy as np import pytest from astropy.stats._fast_sigma_clip import _sigma_clip_fas...
120
4,493
wagtail
wagtail/admin/panels/signal_handlers.py
.py
from django.apps import apps from django.core.signals import setting_changed from django.dispatch import receiver from wagtail.models import AbstractPage from .model_utils import get_edit_handler @receiver(setting_changed) def reset_edit_handler_cache(**kwargs): """ Clear page edit handler cache when global...
20
621
jupytext
src/jupytext/paired_paths.py
.py
"""List all the paths associated to a given notebook""" import os from .config import find_jupytext_configuration_file from .formats import ( NOTEBOOK_EXTENSIONS, long_form_multiple_formats, long_form_one_format, short_form_multiple_formats, short_form_one_format, ) class InconsistentPath(ValueE...
333
11,566
luigi
luigi/retcodes.py
.py
# -*- coding: utf-8 -*- # # Copyright 2015-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...
112
4,347
textual
tests/snapshot_tests/snapshot_apps/nested_auto_heights.py
.py
#!/usr/bin/env python3 from __future__ import annotations from textual.app import App, ComposeResult from textual.containers import VerticalScroll from textual.widgets import Static class NestedAutoApp(App[None]): CSS = """ Screen { background: red; } #my-static-container { border: ...
65
1,362
cvxpy
cvxpy/tests/ram_limited.py
.py
""" Copyright 2020, 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, ...
69
1,963
astropy
astropy/io/fits/hdu/nonstandard.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import gzip import io from astropy.io.fits.file import _File from astropy.io.fits.header import Header, _pad_length from astropy.io.fits.util import fileobj_name from astropy.utils import lazyproperty from .base import NonstandardExtHDU from .hdulist imp...
129
4,189
onnxruntime
onnxruntime/python/tools/quantization/__init__.py
.py
from .calibrate import ( # noqa: F401 CalibraterBase, CalibrationDataReader, CalibrationMethod, MinMaxCalibrater, TensorData, TensorsData, create_calibrator, load_tensors_data, save_tensors_data, ) from .cuda_quantizer import CudaQuantizer # noqa: F401 from .qdq_quantizer import QD...
25
763
textual
docs/examples/styles/grid_gutter.py
.py
from textual.app import App from textual.containers import Grid from textual.widgets import Label class MyApp(App): CSS_PATH = "grid_gutter.tcss" def compose(self): yield Grid( Label("1"), Label("2"), Label("3"), Label("4"), Label("5"), ...
25
459
sqlmap
plugins/dbms/virtuoso/filesystem.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): d...
19
674
onnxruntime
onnxruntime/test/testdata/transform/constant_float16_topk.py
.py
import onnx # input tensor X = onnx.helper.make_tensor_value_info("X", onnx.TensorProto.FLOAT16, [3, 4]) # output tensors Values = onnx.helper.make_tensor_value_info("Values", onnx.TensorProto.FLOAT16, [3, 2]) Indices = onnx.helper.make_tensor_value_info("Indices", onnx.TensorProto.INT64, [3, 2]) # constant for k k_...
19
696