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
conda
conda/deprecations.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tools to aid in deprecating code.""" from __future__ import annotations import sys import warnings from argparse import SUPPRESS, Action from dataclasses import dataclass, field from functools import wraps from types import ModuleType from ...
531
19,273
clearml
clearml/utilities/lowlevel/distributed.py
.py
import os from logging import getLogger from time import sleep, time from typing import Optional from pathlib2 import Path def get_torch_local_rank() -> Optional[int]: """ return the local rank of the process, notice local rank 0 does not mean global rank 0 return None if no torch distributed is running ...
98
3,060
textual
tests/command_palette/test_discover.py
.py
from textual.app import App from textual.command import CommandPalette, DiscoveryHit, Hit, Hits, Provider from textual.widgets import OptionList class SimpleSource(Provider): async def discover(self) -> Hits: def goes_nowhere_does_nothing() -> None: pass yield DiscoveryHit("XD-1", go...
35
1,052
openvino
tools/commit_slider/utils/templates/broken_compilation.py
.py
from utils.templates.common import CommonTemplate class BrokenCompilationTemplate(CommonTemplate): def getName(): return 'broken_comp' def getBilletFileName(): return 'broken_compilation.json' def printResult(commitPath, outLogger, getCommitInfo): print("\n*****************<Co...
52
2,272
confluent-kafka-python
tests/schema_registry/test_json_codec.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # 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 requi...
132
4,738
astropy
astropy/io/fits/hdu/compressed/_quantization.py
.py
""" This file contains the code for Quantizing / Dequantizing floats. """ import numpy as np from astropy.io.fits.hdu.base import BITPIX2DTYPE from astropy.io.fits.hdu.compressed._compression import ( quantize_double_c, quantize_float_c, unquantize_double_c, unquantize_float_c, ) __all__ = ["Quantize...
143
3,988
jupytext
tests/functional/others/test_cells.py
.py
import pytest from nbformat.v4.nbbase import new_markdown_cell from jupytext.cell_reader import ( LightScriptCellReader, RMarkdownCellReader, paragraph_is_fully_commented, uncomment, ) from jupytext.cell_to_text import RMarkdownCellExporter @pytest.mark.parametrize( "lines", [ "# text...
190
4,383
wagtail
wagtail/admin/tests/benches.py
.py
from django.test import TestCase from django.urls import reverse from django.utils import timezone from wagtail.models import Site from wagtail.test.benchmark import Benchmark from wagtail.test.testapp.models import SingleEventPage, StreamPage from wagtail.test.utils import Page, WagtailTestUtils class BenchPageExpl...
97
3,023
beam
learning/katas/python/Common Transforms/Aggregation/Count/task.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"); y...
36
1,217
onnx
onnx/version_converter.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 """onnx version converter This enables users to convert their models between different opsets within the default domain ("" or "ai.onnx"). """ from __future__ import annotations import onnx import onnx.onnx_cpp2py_export.version_convert...
44
1,267
onnxruntime
onnxruntime/test/python/quantization/test_quantize_static_resnet.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 ...
139
6,225
wandb
tests/unit_tests/test_launch/test_runner/test_kubernetes_integration.py
.py
"""Integration tests for KubernetesRunner. These tests exercise runner.run() end-to-end with mocked Kubernetes APIs, verifying that the correct volume configuration is applied to the submitted job manifest based on the presence/absence of PVC env vars and base image settings. """ import platform from unittest.mock im...
168
5,547
deap
examples/gp/adf_symbreg.py
.py
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
184
6,220
saleor
saleor/tax/models.py
.py
from django.conf import settings from django.db import models from django_countries.fields import CountryField from ..channel.models import Channel from ..core.models import ModelWithMetadata from . import TaxCalculationStrategy class TaxClass(ModelWithMetadata): name = models.CharField(max_length=255) clas...
91
3,130
openvino
src/frontends/tensorflow_lite/tests/test_models/gen_scripts/generate_bad_header.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys path_to_model_dir = os.path.join(sys.argv[1], "bad_header") if not os.path.exists(path_to_model_dir): os.makedirs(path_to_model_dir, exist_ok=True) # Correct FOURCC is 'TFL3', it should be in first 4 bytes or #...
35
1,126
onnxruntime
orttraining/orttraining/python/training/ort_triton/_op_config.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ This file controls the Ops supported by Triton codegen. The Triton fu...
68
3,300
sphinx
sphinx/addnodes.py
.py
"""Document tree nodes that Sphinx defines on top of those in Docutils.""" from __future__ import annotations from typing import TYPE_CHECKING from docutils import nodes from docutils.nodes import document # NoQA: F401 if TYPE_CHECKING: from collections.abc import Sequence from typing import Any from ...
625
18,539
slimit
src/slimit/scope.py
.py
############################################################################### # # Copyright (c) 2011 Ruslan Spivak # # 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, inc...
184
5,626
mlflow
tests/entities/test_experiment.py
.py
from mlflow.entities import Experiment, ExperimentTag, LifecycleStage from mlflow.entities.trace_location import UnityCatalog from mlflow.utils.mlflow_tags import ( MLFLOW_EXPERIMENT_DATABRICKS_TRACE_ANNOTATIONS_TABLE, MLFLOW_EXPERIMENT_DATABRICKS_TRACE_DESTINATION_PATH, MLFLOW_EXPERIMENT_DATABRICKS_TRACE_L...
199
6,406
metrics
tests/unittests/text/test_ter.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...
179
6,359
astropy
astropy/timeseries/periodograms/lombscargle_multiband/core.py
.py
"""Main Lomb-Scargle Multiband Implementation""" import numpy as np from astropy import units as u from astropy.time import Time, TimeDelta from astropy.timeseries.binned import BinnedTimeSeries from astropy.timeseries.periodograms.lombscargle import LombScargle from astropy.timeseries.sampled import TimeSeries from...
706
26,317
openvino
docs/articles_en/assets/snippets/ov_patterns.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # ! [ov:imports] import pytest from openvino import PartialShape from openvino import opset13 as ops from openvino.passes import Matcher, WrapType, Or, AnyInput, Optional # ! [ov:imports] from openvino.passes import ( consumers_cou...
218
8,410
saleor
saleor/webhook/response_schemas/utils/validators.py
.py
def lower_values( values: str | list[str] | None, ) -> str | list[str] | None: """Lowercase all values in a string or a list.""" match values: case str(): return values.lower() case list(): return [value.lower() for value in values] case _: return ...
12
327
sqlmap
plugins/dbms/extremedb/takeover.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.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): def osCmd(s...
29
982
qutip
qutip/tests/core/data/test_dense.py
.py
import numpy as np import pytest from qutip.core import data from qutip.core.data import dense, csr from . import conftest # Set up some fixtures for automatic parametrisation. @pytest.fixture(params=[ pytest.param((1, 5), id='ket'), pytest.param((5, 1), id='bra'), pytest.param((5, 5), id='square'), ...
327
13,437
pyro
pyro/contrib/gp/kernels/static.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions import constraints from pyro.contrib.gp.kernels.kernel import Kernel from pyro.nn.module import PyroParam class Constant(Kernel): r""" Implementation of Constant kernel: :ma...
56
1,536
pyomo
pyomo/contrib/doe/utils.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...
291
9,666
conda
tests/shell/test_shell.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import os from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING import pytest from conda.common.compat import on_linux, on_mac, on_win from .. import TEST_RECIPES_CHANN...
179
5,689
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import logging as log from openvino.preprocess import PrePostProcessor # pylint: disable=no-name-in-module,import-error # pylint: disable=no-name-in-module,import-error from openvino import Model, Layout, PartialShape f...
221
10,253
mlflow
mlflow/genai/label_schemas/label_schemas.py
.py
import warnings from abc import ABC, abstractmethod from dataclasses import dataclass from typing import TYPE_CHECKING, TypeVar from mlflow.exceptions import MlflowException from mlflow.genai.utils.enum_utils import StrEnum from mlflow.protos import label_schemas_pb2 as _ls_pb from mlflow.protos.databricks_pb2 import ...
465
17,937
pyomo
pyomo/tpl/ply/__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...
29
1,127
lemur
lemur/users/views.py
.py
""" .. module: lemur.users.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import g, Blueprint from flask_restful import reqparse, Api from lemur.auth.permi...
431
11,761
astropy
astropy/stats/funcs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains simple statistical algorithms that are straightforwardly implemented as a single python function (or family of functions). This module should generally not be used directly. Everything in `__all__` is imported into `astropy.stats...
1,688
62,177
pyomo
pyomo/network/util.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...
77
2,501
astropy
astropy/utils/compat/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The content of this module is solely for internal use of ``astropy`` and subject to changes without deprecations. Do not use it in external packages or code. """ # Importing this module will also install monkey-patches defined in it from .numpycompat...
20
565
clearml
clearml/router/proxy.py
.py
from typing import Callable, Dict, Optional, Any from fastapi import Request, Response from .fastapi_proxy import FastAPIProxy from .route import Route class HttpProxy: DEFAULT_PORT = 9000 def __init__( self, port: Optional[int] = None, workers: Optional[int] = None, default_...
64
1,924
onnxruntime
onnxruntime/test/python/quantization/test_tensor_quant_overrides_option.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
1,272
58,991
beam
sdks/python/apache_beam/examples/ml-orchestration/kfp/pipeline.py
.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
133
4,519
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/dedup_op_and_var_names.py
.py
# Copyright (c) 2023, 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 collections import itertools from coremltools.converters.mil.mil import Function from coremlt...
95
3,833
wagtail
wagtail/admin/tests/pages/test_parent_page_chooser_view.py
.py
from unittest import mock from django.contrib.auth.models import Group, Permission from django.test import TestCase, override_settings from django.urls import reverse from wagtail.models import GroupPagePermission, Locale from wagtail.test.testapp.models import BusinessIndex, EventIndex, EventPage, SimplePage from wa...
287
10,948
django-cms
cms/test_utils/project/placeholderapp_urls.py
.py
from django.conf import settings from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.urls import include, re_path from django.views.i18n import JavaScriptCatalog from django.views.static import serve from cms.test_utils.project.placeholderapp.views import detail_view from cms.u...
27
974
mlflow
tests/utils/test_arguments_utils.py
.py
import functools import pytest from mlflow.utils.arguments_utils import _get_arg_names def no_args(): pass def positional(a, b): return a, b def keyword(a=0, b=0): return a, b def positional_and_keyword(a, b=0): return a, b def keyword_only(*, a, b=0): return a, b def var_positional(*a...
61
1,062
probability
tensorflow_probability/python/distributions/multinomial_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...
488
19,436
readthedocs.org
readthedocs/domains/validators.py
.py
from django.conf import settings from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ from readthedocs.subscriptions.constants import TYPE_CNAME from readthedocs.subscriptions.products import get_feature def check_domains_limit(project, error_class=ValidationError...
26
964
pyomo
pyomo/common/tests/test_dependencies.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...
540
19,519
clearml
clearml/automation/controller.py
.py
import atexit import functools import itertools import inspect import json import os import re import warnings from copy import copy, deepcopy from datetime import datetime from logging import getLogger from multiprocessing import Process, Queue from multiprocessing.pool import ThreadPool from threading import Thread,...
5,635
272,645
textual
docs/examples/styles/link_background.py
.py
from textual.app import App from textual.widgets import Label class LinkBackgroundApp(App): CSS_PATH = "link_background.tcss" def compose(self): yield Label( "Visit the [link='https://textualize.io']Textualize[/link] website.", id="lbl1", # (1)! ) yield Label(...
30
762
onnxruntime
tools/ci_build/cuda_plugin_parity_report.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """ CUDA EP Plugin Registration Parity Report Compares kernel registrations between the bundled CUDA EP and the plugin CUDA EP by statically parsing source files or interrogating the kernel registry at...
738
29,155
probability
tensorflow_probability/python/sts/components/local_level_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...
163
6,238
luigi
test/contrib/redshift_test.py
.py
# 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 or agreed to in writing, ...
605
24,293
scikit-bio
skbio/alignment/_indexing.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. # --------------------------------------------...
241
8,750
textual
tests/snapshot_tests/snapshot_apps/welcome_widget.py
.py
from textual.app import App, ComposeResult from textual.widgets import Welcome class WelcomeApp(App[None]): def compose(self) -> ComposeResult: yield Welcome() if __name__ == "__main__": WelcomeApp().run()
11
225
beam
sdks/python/apache_beam/transforms/fully_qualified_named_transform_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...
202
8,228
probability
tensorflow_probability/python/math/linalg.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,549
63,074
wandb
wandb/sdk/lib/service/service_token.py
.py
from __future__ import annotations import abc import asyncio import os import re from typing_extensions import final, override from wandb import env from wandb.sdk.lib import asyncio_manager from wandb.sdk.lib.service import ipc_support from .service_client import ServiceClient _CURRENT_VERSION = "3" # Token form...
187
5,271
pyomo
pyomo/common/tests/test_formatting.py
.py
# -*- coding: utf-8 -*- # ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and En...
265
8,171
kafka
tests/kafkatest/tests/core/network_degrade_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 ...
147
7,034
mlflow
tests/genai/utils/test_prompt_cache.py
.py
import threading import time import pytest from mlflow.prompt.registry_utils import PromptCache, PromptCacheKey @pytest.fixture(autouse=True) def reset_cache(): """Reset the prompt cache before and after each test.""" PromptCache._reset_instance() yield PromptCache._reset_instance() def test_singl...
204
5,798
wandb
tests/system_tests/test_sweep/mock_scripts/parent_script_with_term_timeout.py
.py
import os import queue import signal import sys import threading import time from wandb.wandb_agent import Agent child_script = sys.argv[1] term_timeout = int(sys.argv[2]) class _StubApi: def sweep(self, sweep_id, spec): return None def register_agent(self, host, sweep_id=None): return {"id...
65
1,390
onnxruntime
orttraining/orttraining/python/training/__init__.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # isort: skip_file from onnxruntime.capi._pybind_state import ( Propa...
32
832
django-cms
cms/test_utils/project/customuserapp/admin.py
.py
from django.contrib import admin from django.contrib.auth import get_user_model from django.contrib.auth.admin import UserAdmin as OriginalUserAdmin from django.contrib.auth.models import User as OriginalUser if getattr(OriginalUser._meta, 'swapped', False): class UserAdmin(OriginalUserAdmin): list_display...
19
836
pyomo
doc/OnlineDocs/src/scripting/Z_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...
18
664
cvxpy
cvxpy/tests/test_shape.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...
95
3,231
luigi
luigi/contrib/hdfs/config.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...
120
4,005
conda
conda/testing/notices/helpers.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Collection of helper functions used in conda.notices tests.""" from __future__ import annotations import datetime import os import uuid from itertools import chain, repeat from pathlib import Path from typing import TYPE_CHECKING from ...c...
139
3,959
eve
examples/security/settings_security.py
.py
# -*- coding: utf-8 -*- SETTINGS = { "DEBUG": True, "MONGO_HOST": "localhost", "MONGO_PORT": 27017, "MONGO_DBNAME": "test_db", "DOMAIN": { "accounts": { "username": {"type": "string", "minlength": 5, "maxlength": 20}, "password": {"type": "string", "minlength": 5, "m...
18
584
pyomo
examples/pyomo/sos/DepotSiting.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...
55
1,993
gunicorn
tests/requests/valid/030.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() request = { "method": "GET", "uri": uri("/stuff/here?foo=bar"), "version": (1, 1), "headers": [ ('TRANSFER-ENCODING', 'identity'), ...
19
384
clearml
clearml/backend_interface/task/repo/__init__.py
.py
from .scriptinfo import ScriptInfo from .freeze import pip_freeze __all__ = ["ScriptInfo", "pip_freeze"]
5
106
astropy
astropy/modeling/tests/test_utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import re from inspect import Parameter import numpy as np import pytest from astropy.modeling.utils import ( _SpecialOperatorsDict, _validate_domain_window, get_inputs_and_params, poly_map_domain, quant...
163
5,521
beam
sdks/python/apache_beam/dataframe/schemas.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...
213
7,856
pdm
src/pdm/signals.py
.py
""" The signal definition for PDM. Example: ```python from pdm.signals import post_init, post_install def on_post_init(project): project.core.ui.echo("Project initialized") # Connect to the signal post_init.connect(on_post_init) # Or use as a decorator @post_install.connect def...
134
4,012
onnx
onnx/reference/ops/op_abs.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 OpRunUnaryNum class Abs(OpRunUnaryNum): def _run(self, x): return (np.absolute(x),)
14
270
pyomo
pyomo/contrib/pyros/pyros.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...
516
18,623
kafka
tests/kafkatest/utils/util.py
.py
# 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 # distributed under the Li...
181
8,159
pyomo
pyomo/contrib/parmest/examples/reaction_kinetics/simple_reaction_parmest_example.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...
174
5,480
coremltools
coremltools/optimize/torch/_utils/joint_compression_utils.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 def is_pruner_prepared(optimizer): """ Check if any layer to be compressed with `optimizer` h...
46
1,689
pyomo
examples/pyomobook/python-ch/example.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
13
622
beam
sdks/python/apache_beam/transforms/stats.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...
994
36,077
openvino
tests/e2e_tests/common/postprocessors/classification.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Classification postprocessor.""" from .provider import ClassProvider import numpy as np from collections import OrderedDict class ParseClassification(ClassProvider): """Classification parser.""" __action_name__ = "parse_clas...
38
1,578
coremltools
coremltools/test/optimize/torch/pruning/test_base_pruner.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 from collections import OrderedDict import pytest import torch.nn as nn from coremltools.optimize.t...
49
1,694
onnxruntime
tools/python/wgsl_template/test/test_loader.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Unit tests for the PASS0 loader. Uses temporary directories with inline fixtures. """ from __future__ import annotations import sys import tempfile import unittest from pathlib import Path # Make the wgsl_template packa...
216
7,903
loguru
tests/test_exceptions_formatting.py
.py
import os import platform import re import subprocess import sys import traceback from unittest.mock import MagicMock import pytest from loguru import logger def normalize(exception): """Normalize exception output for reproducible test cases.""" if os.name == "nt": exception = re.sub( r'...
326
10,591
sphinx
tests/roots/test-add_source_parser/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = ['source_parser']
7
115
probability
tensorflow_probability/python/sts/decomposition.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...
325
14,122
luigi
test/notifications_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...
864
33,147
biopython
Tests/test_Entrez_online.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 online Entrez access. This file include tests for accessing the online Entre...
270
9,875
kombu
t/unit/utils/test_functional.py
.py
from __future__ import annotations import pickle from itertools import count from unittest.mock import Mock import pytest from kombu.utils import functional as utils from kombu.utils.functional import (ChannelPromise, LRUCache, accepts_argument, fxrange, fxrangemax, lazy, maybe_ev...
335
9,231
pyomo
pyomo/contrib/incidence_analysis/scc_solver.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
171
6,868
astropy
astropy/coordinates/tests/test_transformations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy import units as u from astropy.coordinates import ( AffineTransform, DynamicMatrixTransform, FunctionTransform, FunctionTransformWithFiniteDifference, StaticMatrixTransform, TransformG...
697
21,467
astropy
astropy/cosmology/_src/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__: tuple[str, ...] = () # nothing is publicly scoped import functools from collections.abc import Callable from numbers import Number from typing import Any, Final, ParamSpec, Protocol, TypeAlias, TypeVar, overload import numpy as np from numpy.t...
140
4,335
wagtail
wagtail/documents/admin_urls.py
.py
from django.urls import path from wagtail.documents.views import documents, multiple app_name = "wagtaildocs" urlpatterns = [ path("", documents.IndexView.as_view(), name="index"), path( "results/", documents.IndexView.as_view(results_only=True), name="index_results", ), path("...
37
1,302
django-cms
cms/test_utils/project/pluginapp/plugins/multiwrap/forms.py
.py
from django import forms from cms.models import CMSPlugin class MultiWrapForm(forms.ModelForm): NUM_WRAPS = ( (0, "0"), (1, "1"), (2, "2"), (3, "3"), (4, "4"), (5, "5"), (6, "6"), (7, "7"), (8, "8"), (9, "9"), (10, "10"), ...
30
591
saleor
saleor/graphql/warehouse/tests/queries/test_stocks_filtering.py
.py
from .....warehouse.models import Stock from ....tests.utils import get_graphql_content QUERY_STOCKS_WITH_FILTERS = """ query stocks($filter: StockFilterInput!) { stocks(first: 100, filter: $filter) { totalCount edges { node { id }...
105
3,199
sqlmap
plugins/dbms/firebird/fingerprint.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import re from lib.core.common import Backend from lib.core.common import Format from lib.core.common import randomRange from lib.core.common import randomStr from lib.core.compa...
158
4,989
pyomo
examples/pyomo/amplbook2/steel3.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...
53
1,375
returns
tests/test_maybe/test_nothing_singleton.py
.py
from returns.maybe import _Nothing # noqa: PLC2701 def test_nothing_singleton(): """Ensures `_Nothing` is a singleton.""" assert _Nothing() is _Nothing()
7
165
probability
tensorflow_probability/python/bijectors/joint_map.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...
140
5,396
jupytext
tests/functional/others/test_remove_encoding.py
.py
import pytest from jupyter_server.utils import ensure_async @pytest.mark.asyncio async def test_remove_encoding_907(tmp_path, python_notebook, cm): # Pair all notebooks to py:percent files (tmp_path / "jupytext.toml").write_text('formats="ipynb,py:percent"') # Create a contents manager cm.root_dir = ...
46
1,522
biopython
Tests/test_PAML_tools.py
.py
# Copyright (C) 2011 by Brandon Invergo (b.invergo@gmail.com) # 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 PAML tools module.""" import os import sys import unittest from Bio import ...
141
4,898