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
astropy
astropy/cosmology/_src/traits/curvature.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Global Curvature. This is private API. See `~astropy.cosmology.traits` for public API. """ __all__ = ("CurvatureComponent",) import abc import numpy as np from numpy.typing import ArrayLike, NDArray from astropy.cosmology._src.utils import aszarr ...
91
2,448
sqlmap
plugins/dbms/maxdb/__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 MAXDB_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.maxdb.enumeration import Enumeration from...
30
902
pyomo
pyomo/contrib/incidence_analysis/tests/test_incidence.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...
261
10,028
onnxruntime
onnxruntime/python/tools/transformers/past_helper.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 ...
150
6,806
mlflow
mlflow/projects/_project_spec.py
.py
"""Internal utilities for parsing MLproject YAML files.""" import os import yaml from mlflow.exceptions import ExecutionException, MlflowException from mlflow.projects import env_type from mlflow.tracking import artifact_utils from mlflow.utils import data_utils from mlflow.utils.environment import _PYTHON_ENV_FILE_...
374
15,108
pyomo
pyomo/repn/tests/baron/small14a_testCase.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...
36
1,134
gunicorn
tests/docker/asgi_framework_compat/frameworks/django_app/routing.py
.py
""" WebSocket routing for Django Channels. """ from django.urls import path from consumers import ( EchoConsumer, EchoBinaryConsumer, ScopeConsumer, SubprotocolConsumer, CloseConsumer, ) websocket_urlpatterns = [ path("ws/echo", EchoConsumer.as_asgi()), path("ws/echo-binary", EchoBinaryCon...
21
493
pyfilesystem2
fs/mountfs.py
.py
"""Manage other filesystems as a folder hierarchy. """ from __future__ import absolute_import, print_function, unicode_literals import typing from six import text_type from . import errors from .base import FS from .memoryfs import MemoryFS from .mode import validate_open_mode, validate_openbin_mode from .path impo...
324
9,492
probability
tensorflow_probability/python/math/linalg_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...
1,485
53,685
wagtail
wagtail/admin/api/serializers.py
.py
from collections import OrderedDict import swapper from rest_framework.fields import Field, ReadOnlyField from wagtail.api.v2.serializers import PageSerializer, get_serializer_class from wagtail.api.v2.utils import get_full_url Page = swapper.load_model("wagtailcore", "Page") def get_model_listing_url(context, mod...
195
4,981
saleor
saleor/site/error_codes.py
.py
from enum import Enum class SiteErrorCode(Enum): FORBIDDEN_CHARACTER = "forbidden_character" GRAPHQL_ERROR = "graphql_error" class GiftCardSettingsErrorCode(Enum): INVALID = "invalid" REQUIRED = "required" GRAPHQL_ERROR = "graphql_error" class RefundSettingsErrorCode(Enum): INVALID = "inva...
26
540
astropy
astropy/units/tests/test_structured.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test Structured units and quantities. """ import copy import numpy as np import numpy.lib.recfunctions as rfn import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.tests.helper import check_pickling_r...
769
30,756
mlflow
mlflow/store/db_migrations/versions/b7e4c1a90f23_add_review_queue_tables.py
.py
"""add review_queue tables Revision ID: b7e4c1a90f23 Revises: 89d3d66ed43f Create Date: 2026-06-05 10:00:00.000000 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "b7e4c1a90f23" down_revision = "89d3d66ed43f" branch_labels = None depends_on = None def upgrad...
152
5,320
structlog
src/structlog/twisted.py
.py
# SPDX-License-Identifier: MIT OR Apache-2.0 # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the MIT License. See the LICENSE file in the root of this # repository for complete details. """ Processors and tools specific to the `Twisted <https://twisted.org/>`_ networking engine....
333
10,135
openvino
tests/utils/install_pkg.py
.py
#!/usr/bin/env python3 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Common utilities for OpenVINO install package. """ import errno import os from pathlib import Path import subprocess import sys def get_openvino_environment(install_prefix: Path): """ Get OpenVINO enviro...
37
1,097
openvino
tests/time_tests/test_runner/test_timetest.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Main entry-point to run timetests tests. Default run: $ pytest test_timetest.py Options[*]: --test_conf Path to test config --exe Path to timetest binary to execute --niter Number of times to run executable [*...
95
3,577
openvino
tests/layer_tests/pytorch_tests/test_split_amax.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestSplitAmax(PytorchLayerTest): """Test case for split_with_sizes followed by amax operation. This test reproduces the issue where Sequen...
184
6,378
mlflow
mlflow/models/evaluation/lift_curve.py
.py
import matplotlib.pyplot as plt import numpy as np def _cumulative_gain_curve(y_true, y_score, pos_label=None): """ This method is copied from scikit-plot package. See https://github.com/reiinakano/scikit-plot/blob/2dd3e6a76df77edcbd724c4db25575f70abb57cb/scikitplot/helpers.py#L157 This function gene...
179
6,165
cvxpy
setup/build_meta.py
.py
# See https://setuptools.pypa.io/en/latest/build_meta.html#dynamic-build-dependencies-and-other-build-meta-tweaks from setuptools.build_meta import * # noqa: F403
3
164
openvino
tests/layer_tests/pytorch_tests/test_cross.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest # torch.cross without the dim argument is...
138
5,320
hatch
src/hatch/template/files_default.py
.py
from hatch.template import File from hatch.utils.fs import Path class PackageRoot(File): def __init__( self, template_config: dict, plugin_config: dict, # noqa: ARG002 ): super().__init__(Path(template_config["package_name"], "__init__.py"), "") class MetadataFile(File): ...
185
5,947
clearml
examples/pipeline/step3_train_model.py
.py
import joblib import matplotlib.pyplot as plt import numpy as np from sklearn.linear_model import LogisticRegression from clearml import Task # Connecting ClearML with the current process, # from here on everything is logged automatically task = Task.init(project_name="examples", task_name="Pipeline step 3 train mod...
59
1,638
pyfilesystem2
tests/test_error_tools.py
.py
from __future__ import unicode_literals import errno import unittest import fs.errors from fs.error_tools import convert_os_errors class TestErrorTools(unittest.TestCase): def test_convert_enoent(self): exception = OSError(errno.ENOENT, "resource not found") with self.assertRaises(fs.errors.Reso...
26
924
openvino
tests/layer_tests/pytorch_tests/test_permute.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestPermute(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224, 224),) def create_model(self, order, complex_type...
95
3,369
mlflow
mlflow/store/db_migrations/versions/3500859a5d39_add_model_aliases_table.py
.py
"""Add Model Aliases table Create Date: 2023-03-09 15:33:54.951736 """ import sqlalchemy as sa from alembic import op from mlflow.store.model_registry.dbmodels.models import SqlRegisteredModelAlias # revision identifiers, used by Alembic. revision = "3500859a5d39" down_revision = "97727af70f4d" branch_labels = Non...
49
1,329
coveragepy
tests/test_filereporter.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 for FileReporters""" from __future__ import annotations import sys from coverage.plugin import FileReporter from coverage.python import PythonFileRepo...
105
4,069
wandb
tests/unit_tests/test_launch/test_registry/test_acr.py
.py
from unittest.mock import MagicMock import pytest from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.registry.azure_container_registry import ( AzureContainerRegistry, ResourceNotFoundError, ) @pytest.fixture def mock_default_azure_credential(monkeypatch): mock = MagicMock() monkey...
108
3,715
astropy
astropy/nddata/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The `astropy.nddata` subpackage provides the `~astropy.nddata.NDData` class and related tools to manage n-dimensional array-based data (e.g. CCD images, IFU Data, grid-based simulation data, ...). This is more than just `numpy.ndarray` objects, becaus...
51
1,551
bazel
third_party/py/abseil/absl/testing/parameterized.py
.py
# Copyright 2017 The Abseil 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 ...
707
27,120
probability
spinoffs/autobnn/autobnn/estimators.py
.py
# Copyright 2024 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...
306
9,780
mlflow
docs/api_reference/conftest.py
.py
import os import pytest import mlflow @pytest.fixture(autouse=True) def tracking_uri_mock(tmp_path, monkeypatch): tracking_uri = "sqlite:///{}".format(tmp_path / "mlruns.sqlite") mlflow.set_tracking_uri(tracking_uri) monkeypatch.setenv("MLFLOW_TRACKING_URI", tracking_uri) yield mlflow.set_tracki...
29
676
metrics
src/torchmetrics/functional/shape/procrustes.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...
67
2,728
qutip
qutip/tests/solver/test_mesolve.py
.py
import numpy as np from types import FunctionType import qutip from qutip.solver.mesolve import mesolve, MESolver from qutip.solver.krylovsolve import krylovsolve from qutip.solver.solver_base import Solver import pickle import pytest # Deactivate warning for test without cython from qutip.core.coefficient import WAR...
977
37,228
mlflow
tests/server/test_review_queue_handlers.py
.py
import json from types import SimpleNamespace from unittest import mock import pytest from mlflow.genai.review_queues import ( ReviewItemType, ReviewQueue, ReviewQueueItem, ReviewQueueType, ReviewStatus, ) from mlflow.protos.review_queues_pb2 import ( COMPLETE, CUSTOM, PENDING, REV...
454
17,607
readthedocs.org
readthedocs/core/tests/test_homepage.py
.py
import django_dynamic_fixture as fixture from django.urls import reverse from django.contrib.auth.models import User from django.test import TestCase, override_settings class HomepageTest(TestCase): def test_homepage_auth(self): user = fixture.get( User, username="user", )...
49
1,501
sphinx
sphinx/events.py
.py
"""Sphinx core events. Gracefully adapted from the TextPress system by Armin. """ from __future__ import annotations from collections import defaultdict from operator import attrgetter from typing import TYPE_CHECKING, NamedTuple, overload from sphinx.deprecation import _deprecation_warning from sphinx.errors impor...
486
13,890
saleor
saleor/tests/e2e/orders/utils/fragments.py
.py
ORDER_LINE_FRAGMENT = """ fragment OrderLine on OrderLine { id variant { id } productName productSku variantName translatedVariantName translatedProductName productVariantId isShippingRequired isGift quantity quantityFulfilled unitPrice { gross { ...
77
1,141
coremltools
deps/pybind11/tests/test_sequences_and_iterators.py
.py
from __future__ import annotations import pytest from pytest import approx # noqa: PT013 from pybind11_tests import ConstructorStats from pybind11_tests import sequences_and_iterators as m def test_slice_constructors(): assert m.make_forward_slice_size_t() == slice(0, -1, 1) assert m.make_reversed_slice_ob...
268
8,695
flit
flit/validate.py
.py
"""Validate various pieces of packaging data""" import errno import io import logging import os from pathlib import Path import re import requests import sys from .vendorized.readme.rst import render log = logging.getLogger(__name__) CUSTOM_CLASSIFIERS = frozenset({ # https://github.com/pypa/warehouse/pull/5440...
294
9,762
pyomo
pyomo/core/base/component.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,032
39,117
textual
docs/examples/guide/compound/byte01.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.containers import Container from textual.widget import Widget from textual.widgets import Input, Label, Switch class BitSwitch(Widget): """A Switch with a numeric label above it.""" DEFAULT_CSS = """ BitSwitch { ...
82
1,675
pdm
src/pdm/pep582/sitecustomize.py
.py
import os import site import sys from pathlib import Path def get_pypackages_path(): def find_pypackage(path, version): if not path.exists(): return None packages_name = f"__pypackages__/{version}/lib" files = list(path.glob(packages_name)) if files: return...
144
4,373
metrics
src/torchmetrics/functional/classification/__init__.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
260
8,295
mlflow
tests/entities/model_registry/test_registered_model.py
.py
from mlflow.entities.model_registry import RegisteredModelAlias from mlflow.entities.model_registry.model_version import ModelVersion from mlflow.entities.model_registry.registered_model import RegisteredModel from mlflow.entities.model_registry.registered_model_tag import RegisteredModelTag from mlflow.utils.workspace...
213
6,891
readthedocs.org
readthedocs/vcs_support/backends/__init__.py
.py
"""Listing of all the VCS backends.""" from . import git backend_cls = { "git": git.Backend, }
9
102
metrics
src/torchmetrics/functional/audio/srmr.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...
362
14,170
pyomo
doc/OnlineDocs/src/data/import4.tab.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
737
saleor
saleor/graphql/payment/tests/queries/test_transactions_where.py
.py
from datetime import timedelta import graphene import pytest from django.utils import timezone from .....payment import TransactionEventType from .....payment.models import TransactionEvent, TransactionItem from ....tests.utils import get_graphql_content TRANSACTIONS_QUERY = """ query Transactions($where: Transa...
1,128
34,294
tqdm
tests/tests_perf.py
.py
import sys from contextlib import contextmanager from functools import wraps from time import sleep, time # Use relative/cpu timer to have reliable timings when there is a sudden load try: from time import process_time except ImportError: from time import clock process_time = clock from tqdm import tqdm, ...
316
9,308
textual
tests/snapshot_tests/snapshot_apps/multiple_css/multiple_css.py
.py
"""Testing multiple CSS files, including app-level CSS -- element #one The `background` rule on #one tests a 3-way specificity clash between classvar CSS and two separate CSS files. The background ends up red because classvar CSS wins. The `color` rule tests a clash between loading two external CSS files. The color en...
35
1,036
confluent-kafka-python
src/confluent_kafka/schema_registry/rules/dlq/dlq_action.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...
362
14,051
openvino
tests/layer_tests/pytorch_tests/test_hstack.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import numpy as np import numpy as np from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class aten_hstack(torch.nn.Module): def forward(self, x): return torch.hstack(self.prepa...
89
3,120
gunicorn
tests/requests/valid/031compat2.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.config import Config cfg = Config() cfg.set("permit_unconventional_http_method", True) request = { "method": "-blargh", "uri": uri("/foo"), "version": (1, 1), "headers": [], "bod...
17
330
mlflow
tests/demo/test_search_traces_flush.py
.py
from unittest import mock from mlflow import set_experiment from mlflow.demo.base import DEMO_EXPERIMENT_NAME from mlflow.demo.generators.evaluation import EvaluationDemoGenerator from mlflow.demo.generators.issues import IssuesDemoGenerator from mlflow.demo.generators.traces import TracesDemoGenerator def test_eval...
43
1,409
beam
sdks/python/apache_beam/yaml/yaml_provider.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,740
60,886
mlflow
dev/benchmarks/gateway/run.py
.py
# /// script # requires-python = ">=3.10" # dependencies = ["aiohttp>=3.13.3,<4", "psycopg2-binary>=2.9,<3", "rich>=14.3.3,<15"] # /// """MLflow AI Gateway benchmark runner. Orchestrates fake OpenAI server, MLflow server(s), optional PostgreSQL and nginx (via Docker), then runs the async benchmark client. Usage: ...
794
27,232
loguru
loguru/_locks_machinery.py
.py
import os import threading import weakref if not hasattr(os, "register_at_fork"): def create_logger_lock(): return threading.Lock() def create_handler_lock(): return threading.Lock() else: # While forking, we need to sanitize all locks to make sure the child process doesn't run into ...
51
1,307
astropy
astropy/visualization/wcsaxes/tests/test_display_world_coordinates.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib as mpl import numpy as np from matplotlib.backend_bases import KeyEvent from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.figure import Figure import astropy.units as u from astropy.coordinates import FK5, SkyCo...
165
6,580
scikit-bio
skbio/tree/_exception.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. # --------------------------------------------...
38
758
sphinx
sphinx/ext/autodoc/_legacy_class_based/_sentinels.py
.py
from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import Any class _All: """A special value for :*-members: that matches to any member.""" def __contains__(self, item: Any) -> bool: return True def append(self, item: Any) -> None: pas...
32
627
openvino
src/frontends/onnx/tests/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest # test.BACKEND_NAME is a configuration variable determining which # OV backend tests will use. It's set during pytest configuration time. # See `pytest_configure` hook in `conftest.py` for more deta...
221
15,914
onnx
onnx/reference/ops/op_concat_from_sequence.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import Any import numpy as np from onnx.reference.op_run import OpRun def _concat_from_sequence(seq: list[Any], axis: int, new_axis: int = 0) -> np.ndarray: if new_axis == 1: ...
32
887
biopython
Bio/SeqIO/IgIO.py
.py
# Copyright 2008-2015 by Peter Cock. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.SeqIO support fo...
125
4,068
coremltools
coremltools/test/sklearn_tests/test_dict_vectorizer.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 import numpy.random as rn import pandas as pd import coremltools fr...
103
3,358
mlflow
tests/store/_unity_catalog/model_registry/test_unity_catalog_rest_store_native.py
.py
import json from itertools import combinations from unittest import mock from unittest.mock import ANY import pandas as pd import pytest import yaml from requests import Response from mlflow.data.dataset import Dataset from mlflow.data.delta_dataset_source import DeltaDatasetSource from mlflow.data.pandas_dataset imp...
1,962
79,258
mlflow
mlflow/demo/registry.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from mlflow.demo.base import DemoFeature if TYPE_CHECKING: from mlflow.demo.base import BaseDemoGenerator class DemoRegistry: """Registry for demo data generators. Provides registration and lookup of BaseDemoGenerator subclasses by na...
44
1,447
beam
playground/infrastructure/checker.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 ...
116
3,849
probability
spinoffs/inference_gym/inference_gym/tools/stan/targets.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...
270
8,415
beam
sdks/python/apache_beam/dataframe/convert_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...
210
7,488
pyomo
pyomo/core/plugins/transform/relax_integrality.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...
30
1,179
pyomo
pyomo/contrib/incidence_analysis/matching.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...
83
3,380
jupyterlab
jupyterlab/handlers/__init__.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License.
3
101
pyomo
pyomo/contrib/incidence_analysis/tests/models_for_testing.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...
131
4,359
astropy
astropy/timeseries/periodograms/lombscargle/implementations/fast_impl.py
.py
import numpy as np from .utils import trig_sum def lombscargle_fast( t, y, dy, f0, df, Nf, center_data=True, fit_mean=True, normalization="standard", use_fft=True, trig_sum_kwds=None, *, algorithm="lra", ): """Fast Lomb-Scargle Periodogram. This implements...
158
5,661
confluent-kafka-python
src/confluent_kafka/admin/__init__.py
.py
# Copyright 2022 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...
1,383
63,860
textual
docs/examples/how-to/containers09.py
.py
from textual.app import App, ComposeResult from textual.containers import Middle from textual.widgets import Placeholder class Box(Placeholder): """Example widget.""" DEFAULT_CSS = """ Box { width: 16; height: 5; } """ class ContainerApp(App): """Simple app to play w...
36
673
openvino
src/tests/test_utils/functional_test_utils/layer_tests_summary/summarize.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import os import csv from pathlib import Path import defusedxml.ElementTree as ET from defusedxml import defuse_stdlib from jinja2 import Environment, FileSystemLoader from utils.conformance_utils import get_logger from...
422
20,862
saleor
saleor/app/tests/test_validators.py
.py
import pytest from django.core.exceptions import ValidationError from ... import __version__ from ...app.validators import ( AppURLValidator, ) from ..error_codes import AppErrorCode from ..manifest_validations import ( _clean_extension_url, _clean_required_saleor_version, _parse_version, ) def test_...
82
2,401
returns
tests/test_future/test_future_result/test_future_result_units.py
.py
import pytest from returns.future import Future, FutureResult from returns.io import IO, IOFailure, IOSuccess from returns.result import Failure, Success @pytest.mark.anyio async def test_inner_value(subtests): """Ensure that coroutine correct value is preserved for all units.""" containers = [ # We ...
31
1,246
clearml
clearml/utilities/gpu/gpustat.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Implementation of gpustat @author Jongwook Choi @url https://github.com/wookayin/gpustat @ copied from gpu-stat 0.6.0 """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_litera...
673
25,590
openvino
tests/e2e_tests/common/postprocessors/object_detection.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Object detection postprocessor.""" import logging as log import numpy as np from .provider import ClassProvider class ParseBeforeODParser(ClassProvider): """Prepare the pipeline output to right state before parse_object_detect...
227
9,313
pyomo
examples/pyomo/core/integrality2.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...
20
810
biopython
Tests/test_SearchIO_blast_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 blast-tab indexing.""" import unittest from search_tests_common im...
175
9,732
mlflow
dev/clint/src/clint/rules/typing_extensions.py
.py
from clint.rules.base import Rule class TypingExtensions(Rule): def __init__(self, *, full_name: str, allowlist: list[str]) -> None: self.full_name = full_name self.allowlist = allowlist def _message(self) -> str: return ( f"`{self.full_name}` is not allowed to use. Only {...
16
594
astropy
astropy/io/misc/yaml.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Functions for serializing astropy objects to YAML. It provides functions `~astropy.io.misc.yaml.dump`, `~astropy.io.misc.yaml.load`, and `~astropy.io.misc.yaml.load_all` which call the corresponding functions in `PyYaml <https://pyyaml.org>`_ but use ...
408
13,263
pyomo
pyomo/core/base/external.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...
807
29,647
coremltools
coremltools/converters/mil/frontend/torch/test/test_torch_export_quantization.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 itertools from typing import Tuple import pytest from ..utils import TorchFrontend from .tes...
231
8,496
sphinx
sphinx/environment/adapters/toctree.py
.py
"""Toctree adapter for sphinx.environment.""" from __future__ import annotations import warnings from typing import TYPE_CHECKING from docutils import nodes from docutils.nodes import Element from sphinx import addnodes from sphinx.deprecation import RemovedInSphinx11Warning from sphinx.locale import __ from sphinx...
625
20,457
wagtail
wagtail/contrib/redirects/tests/test_v3_api.py
.py
import json from django.contrib.auth.models import Permission from django.test import TestCase from django.urls import reverse from wagtail.api.v3.tests.base import TestV3Base from wagtail.contrib.redirects.models import Redirect from wagtail.models import Site from wagtail.test.utils import Page, WagtailTestUtils R...
428
16,048
hatch
tests/backend/test_build.py
.py
from hatchling.build import build_editable, build_sdist, build_wheel def test_sdist(hatch, helpers, temp_dir, config_file): config_file.model.template.plugins["default"]["src-layout"] = False config_file.save() project_name = "My.App" with temp_dir.as_cwd(): result = hatch("new", project_nam...
125
3,336
pyro
pyro/distributions/projected_normal.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import math import torch from pyro.ops.tensor_utils import safe_normalize from . import constraints from .torch_distribution import TorchDistribution class ProjectedNormal(TorchDistribution): """ Projected isotropic normal...
198
7,441
beam
sdks/python/apache_beam/yaml/yaml_enrichment_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...
79
2,826
saleor
saleor/graphql/channel/dataloaders/by_transaction.py
.py
from collections.abc import Iterable from promise import Promise from ....channel.models import Channel from ....payment.models import TransactionItem from ...core.dataloaders import DataLoader from .by_checkout import ChannelByCheckoutIDLoader from .by_order import ChannelByOrderIdLoader class ChannelByTransaction...
71
2,437
metrics
tests/unittests/detection/test_panoptic_quality.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...
228
8,999
wagtail
wagtail/actions/publish_page_revision.py
.py
import logging from wagtail.actions.publish_revision import ( PublishPermissionError, PublishRevisionAction, ) from wagtail.signals import page_published logger = logging.getLogger("wagtail") class PublishPagePermissionError(PublishPermissionError): """ Raised when the page publish cannot be perform...
64
2,078
pymc
tests/sampler_fixtures.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...
207
6,634
mlflow
tests/genai/evaluate/test_context.py
.py
import threading from unittest import mock import pytest import mlflow from mlflow.environment_variables import MLFLOW_TRACKING_USERNAME from mlflow.genai.evaluation.context import NoneContext, _set_context, eval_context, get_context @pytest.fixture(autouse=True) def reset_context(): yield _set_context(None...
77
1,834
astropy
astropy/io/fits/hdu/compressed/tests/test_fitsio.py
.py
""" This test file uses the https://github.com/esheldon/fitsio package to verify our compression and decompression routines against the implementation in cfitsio. *Note*: The fitsio library is GPL licensed, therefore it could be interpreted that so is this test file. Given that this test file isn't imported anywhere ...
485
17,269
textual
src/textual/_doc.py
.py
from __future__ import annotations import hashlib import inspect import os import shlex from pathlib import Path from typing import Awaitable, Callable, Iterable, cast from textual._import_app import import_app from textual.app import App from textual.pilot import Pilot SCREENSHOT_CACHE = ".screenshot_cache" # Thi...
192
5,708
probability
tensorflow_probability/python/experimental/mcmc/preconditioned_hmc.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...
483
20,042