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
scikit-bio
skbio/stats/distance/tests/test_anosim.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. # --------------------------------------------...
134
5,641
sqlmap
thirdparty/colorama/initialise.py
.py
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import atexit import contextlib import sys from .ansitowin32 import AnsiToWin32 def _wipe_internal_state_for_tests(): global orig_stdout, orig_stderr orig_stdout = None orig_stderr = None global wrapped_stdout, wrapped_stderr...
122
3,325
mlflow
mlflow/gateway/schemas/chat.py
.py
""" This module defines the schemas for the MLflow AI Gateway's chat endpoint. The schemas must be compatible with OpenAI's Chat Completion API. https://platform.openai.com/docs/api-reference/chat NB: These Pydantic models just alias the models defined in mlflow.types.chat to avoid code duplication, but with the ...
137
4,232
kafka
tests/kafkatest/tests/core/transactions_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 ...
264
13,727
openvino
tests/layer_tests/tensorflow_tests/test_tf_Rsqrt.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.tf_layer_test_class import CommonTFLayerTest rng = np.random.default_rng(123813) class TestRsqrt(CommonTFLayerTest): def _prepare_input(self, inputs_dict): for input in inputs_...
102
3,552
openvino
tests/layer_tests/onnx_tests/test_softmax.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136") from common.layer_test_class import check_ir_version from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model fro...
175
7,510
qutip
qutip/tests/piqs/test_piqs.py
.py
""" Tests for Permutational Invariant Quantum solver (PIQS). """ import math import numpy as np from numpy.testing import ( assert_raises, assert_array_equal, assert_array_almost_equal, assert_almost_equal, assert_equal, ) from scipy.sparse import block_diag, coo_matrix from qutip import Qobj, entro...
1,575
52,275
mlflow
tests/gateway/providers/test_mlflow.py
.py
from unittest import mock import pydantic import pytest from aiohttp import ClientTimeout from fastapi.encoders import jsonable_encoder from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS from mlflow.gateway.config import EndpointConfig, MlflowModelServingConfig from mlflow.gateway.constants...
320
11,303
coremltools
coremltools/models/compute_plan.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 dataclasses import dataclass as _dataclass from typing import Any as _Any from typing import Di...
449
13,106
deap
examples/ga/onemax_multidemic.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 ...
100
3,148
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_softmax.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 TestKerasSoftmax(CommonTF2LayerTest): def create_keras_softmax_net(self, input_names, input_shapes, input_type, ir_version): ...
54
2,507
mlflow
mlflow/openai/api_request_parallel_processor.py
.py
# Based ons: https://github.com/openai/openai-cookbook/blob/6df6ceff470eeba26a56de131254e775292eac22/examples/api_request_parallel_processor.py # Several changes were made to make it work with MLflow. """ API REQUEST PARALLEL PROCESSOR Using the OpenAI API to process lots of text quickly takes some care. If you trick...
132
4,392
python-prompt-toolkit
src/prompt_toolkit/shortcuts/prompt.py
.py
""" Line editing functionality. --------------------------- This provides a UI for a line input, similar to GNU Readline, libedit and linenoise. Either call the `prompt` function for every line input. Or create an instance of the :class:`.PromptSession` class and call the `prompt` method from that class. In the secon...
1,548
61,006
mlflow
tests/examples/test_examples.py
.py
import os import re import shutil import sys import uuid from pathlib import Path import pytest import mlflow from mlflow import cli from mlflow.utils import process from mlflow.utils.virtualenv import _get_mlflow_virtualenv_root from tests.helper_functions import clear_hub_cache, flaky, start_mock_openai_server fro...
184
7,271
probability
tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_permutation.py
.py
# Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`. # DO NOT MODIFY DIRECTLY. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
308
12,832
ipython
conftest.py
.py
"""pytest configuration shared by the test modules and the doctests.""" import pytest @pytest.fixture(autouse=True) def stop_script_magics_event_loop(): """Shut the ``%%script`` background event loop down after every test. ``ScriptMagics`` starts an asyncio loop in a daemon thread the first time a scrip...
29
1,117
probability
tensorflow_probability/python/debugging/benchmarking/__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...
39
1,928
wandb
tests/unit_tests/test_iterutils.py
.py
from itertools import repeat, tee from hypothesis import example, given from hypothesis.strategies import integers, iterables, sampled_from from pytest import raises from wandb._iterutils import one @given(iterable=iterables(integers(), min_size=1, max_size=1)) def test_one_on_single_item_iterable(iterable): """...
32
1,198
pyomo
pyomo/repn/tests/mps/__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...
12
575
pymc
tests/dims/test_model.py
.py
# Copyright 2025 - 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...
316
12,299
pyomo
pyomo/contrib/parmest/parmest.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...
3,795
144,978
probability
tensorflow_probability/python/sts/components/regression.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...
543
24,083
kafka
tests/kafkatest/services/log_compaction_tester.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 ...
96
4,484
rq
tests/test_spawn_worker.py
.py
import os import signal import time from datetime import timezone from multiprocessing import Process from redis import Redis from rq import Queue from rq.connections import get_connection_kwargs from rq.job import Job from rq.registry import FailedJobRegistry, FinishedJobRegistry from rq.results import Result from r...
179
6,590
onnxruntime
orttraining/orttraining/test/python/orttraining_test_ortmodule_experimental_json_config.py
.py
import os import torch from onnxruntime.capi import _pybind_state as C from onnxruntime.training import ortmodule from onnxruntime.training.ortmodule.experimental.json_config import load_from_json class Net(torch.nn.Module): def __init__(self, input_size=784, hidden_size=500, num_classes=10): super().__...
134
5,368
pyro
pyro/distributions/torch.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import re import textwrap import torch from pyro.distributions.torch_distribution import TorchDistributionMixin from pyro.distributions.util import broadcast_shape, sum_rightmost from pyro.ops.special import log_binom...
438
15,231
mlflow
tests/db/test_workspace_migration.py
.py
import os import re from contextlib import contextmanager import pytest import sqlalchemy as sa from alembic import command from mlflow.store.db.utils import _get_alembic_config from mlflow.store.tracking.dbmodels.initial_models import Base as InitialBase _LEGACY_REGISTERED_MODEL_TAGS = sa.table( "registered_mod...
1,228
36,303
probability
setup.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...
116
3,938
black
tests/data/cases/docstring_no_extra_empty_line_before_eof.py
.py
# Make sure when the file ends with class's docstring, # It doesn't add extra blank lines. class ClassWithDocstring: """A docstring."""
5
140
probability
tensorflow_probability/python/__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...
164
5,879
saleor
saleor/graphql/channel/mutations/channel_reorder_warehouses.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from ....channel.error_codes import ChannelErrorCode from ....core.tracing import traced_atomic_transaction from ....permission.enums import ChannelPermissions from ...core import ResolveInfo from ...core.doc_catego...
97
3,478
mlflow
mlflow/utils/mime_type_utils.py
.py
import os import pathlib from mimetypes import guess_type from mlflow.version import IS_TRACING_SDK_ONLY # TODO: Create a module to define constants to avoid circular imports # and move MLMODEL_FILE_NAME and MLPROJECT_FILE_NAME in the module. def get_text_extensions(): exts = [ "txt", "log", ...
59
1,409
saleor
saleor/app/tests/test_utils.py
.py
from ...app.utils import get_active_tax_apps from ...core.tests.test_taxes import app_factory, tax_app_factory # noqa: F401 from ...webhook.event_types import WebhookEventSyncType def test_get_active_tax_apps(app_factory, tax_app_factory): # noqa: F811 # given app = app_factory( name="app1", ...
55
1,316
sphinx
sphinx/search/_stopwords/nl.py
.py
# automatically generated by utils/generate-snowball.py # from https://github.com/snowballstem/snowball-website/raw/efb4ae4d65769fb1652acbe608c0c817e746c730/algorithms/dutch/stop.txt from __future__ import annotations DUTCH_STOPWORDS = frozenset({ 'aan', 'al', 'alles', 'als', 'altijd', 'andere...
109
1,413
pyomo
pyomo/contrib/interior_point/interior_point.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...
760
27,656
astropy
astropy/samp/tests/test_hub_script.py
.py
import logging import platform import sys import pytest from astropy.samp import conf from astropy.samp.hub_script import hub_script def setup_module(module): conf.use_internet = False def setup_function(function): function.sys_argv_orig = sys.argv sys.argv = ["samp_hub"] def teardown_function(funct...
36
891
onnxruntime
onnxruntime/python/tools/transformers/models/whisper/whisper_encoder_decoder_init.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 ...
373
16,461
mlflow
tests/utils/test_uri.py
.py
import os import pathlib import posixpath import pytest from mlflow.exceptions import MlflowException from mlflow.store.db.db_types import DATABASE_ENGINES from mlflow.utils.os import is_windows from mlflow.utils.uri import ( add_databricks_profile_info_to_artifact_uri, append_to_uri_path, append_to_uri_q...
1,034
39,732
saleor
saleor/tests/e2e/promotions/utils/promotion_rule_update.py
.py
from ...utils import get_graphql_content PROMOTION_RULE_UPDATE_MUTATION = """ mutation promotionRuleCreate($id: ID!, $input: PromotionRuleUpdateInput!) { promotionRuleUpdate(id: $id, input: $input) { errors { field message code } promotionRule { id name description ...
61
1,132
kafka
tests/kafkatest/tests/client/share_consumer_dlq_tiered_storage_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 ...
225
12,571
saleor
saleor/graphql/order/tests/mutations/test_order_grant_refund_utils.py
.py
import graphene import pytest from django.core.exceptions import ValidationError from .....order.error_codes import OrderGrantRefundCreateLineErrorCode from .....page.models import Page, PageType from ....core.utils import to_global_id_or_none from ...enums import OrderGrantRefundCreateErrorCode from ...mutations.orde...
295
8,845
python-prompt-toolkit
src/prompt_toolkit/validation.py
.py
""" Input validation for a `Buffer`. (Validators will be called before accepting input.) """ from __future__ import annotations from abc import ABCMeta, abstractmethod from collections.abc import Callable from prompt_toolkit.eventloop import run_in_executor_with_context from .document import Document from .filters ...
193
5,816
probability
tensorflow_probability/python/experimental/timeseries/metrics.py
.py
# Copyright 2023 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...
134
4,266
openvino
tests/layer_tests/tensorflow_tests/test_tf_GatherNd.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestGatherNd(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'params:0' in inputs_inf...
64
2,866
returns
tests/test_result/test_result_bind.py
.py
from returns.result import Failure, Result, Success def test_bind(): """Ensures that bind works.""" def factory(inner_value: int) -> Result[int, str]: if inner_value > 0: return Success(inner_value * 2) return Failure(str(inner_value)) input_value = 5 bound: Result[int, s...
77
2,189
clearml
clearml/router/endpoint_telemetry.py
.py
import copy import time import uuid from threading import Thread from typing import Optional, Dict, Union, List from ..task import Task from ..utilities.resource_monitor import ResourceMonitor class EndpointTelemetry: BACKEND_STAT_MAP = { "cpu_usage_*": "cpu_usage", "cpu_temperature_*": "cpu_temp...
241
9,972
beam
sdks/python/apache_beam/coders/avro_record.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...
35
1,164
sphinx
tests/roots/test-ext-autodoc/target/partialmethod.py
.py
from functools import partialmethod class Cell: """An example for partialmethod. refs: https://docs.python.org/3/library/functools.html#functools.partialmethod """ def set_state(self, state): """Update state of cell to *state*.""" #: Make a cell alive. set_alive = partialmethod(set_...
18
421
jupytext
tests/data/notebooks/outputs/ipynb_to_hydrogen/nteract_with_parameter.py
.py
# --- # jupyter: # kernel_info: # name: python3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% inputHidden=false outputHidden=false tags=["parameters"] param = 4 # %% inputHidden=false outputHidden=false import pandas as pd # %% inputHidden=false outputHidden...
25
524
mlflow
tests/genai/evaluate/test_rate_limiter.py
.py
import pytest from mlflow.genai.evaluation.harness import ( AUTO_INITIAL_RPS, _make_rate_limiter, _parse_rate_limit, ) from mlflow.genai.evaluation.rate_limiter import ( NoOpRateLimiter, RPSRateLimiter, call_with_retry, eval_retry_context, is_rate_limit_error, ) from mlflow.genai.judges...
409
11,356
pyro
pyro/contrib/gp/likelihoods/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from pyro.contrib.gp.likelihoods.binary import Binary from pyro.contrib.gp.likelihoods.gaussian import Gaussian from pyro.contrib.gp.likelihoods.likelihood import Likelihood from pyro.contrib.gp.likelihoods.multi_class import Multi...
30
847
pyfilesystem2
fs/lrucache.py
.py
"""Least Recently Used cache mapping. """ from __future__ import absolute_import, unicode_literals import typing from collections import OrderedDict _K = typing.TypeVar("_K") _V = typing.TypeVar("_V") class LRUCache(OrderedDict, typing.Generic[_K, _V]): """A dictionary-like container that stores a given maxim...
44
1,303
saleor
saleor/graphql/discount/enums.py
.py
from typing import Final import graphene from ...discount import ( DiscountType, DiscountValueType, PromotionEvents, PromotionType, RewardType, RewardValueType, VoucherType, error_codes, ) from ..core.doc_category import DOC_CATEGORY_DISCOUNTS from ..core.enums import to_enum from ..co...
99
2,810
probability
tensorflow_probability/python/experimental/stats/__init__.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...
31
1,327
mlflow
mlflow/utils/gorilla.py
.py
# __ __ __ # .-----.-----.----|__| | .---.-. # | _ | _ | _| | | | _ | # |___ |_____|__| |__|__|__|___._| # |_____| # """ NOTE: The contents of this file have been inlined from the gorilla package's source code https://github.com/christophercrouzet/gorilla/blob/v0.3.0/gorilla.p...
798
24,049
pyomo
examples/pyomo/piecewise/indexed_points.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,301
biopython
Bio/Align/fasta.py
.py
# Copyright 2022 by Michiel de Hoon. 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.Align support fo...
87
3,141
mlflow
mlflow/store/db/workspace_migration.py
.py
import sqlalchemy as sa from mlflow.store.db.workspace_utils import ( MODEL_CHILD_TABLES, OTHER_WORKSPACE_CHILD_TABLES, format_truncated_list, get_workspace_table, ) from mlflow.store.workspace.sqlalchemy_store import _WORKSPACE_ROOT_MODELS from mlflow.utils.workspace_utils import DEFAULT_WORKSPACE_NAM...
139
4,909
mlflow
mlflow/entities/model_registry/registered_model_search.py
.py
from mlflow.entities.model_registry import RegisteredModel class RegisteredModelSearch(RegisteredModel): def __init__(self, *args, **kwargs): kwargs["tags"] = [] kwargs["aliases"] = [] super().__init__(*args, **kwargs) def tags(self): raise Exception( "UC Registere...
26
889
saleor
saleor/graphql/payment/tests/mutations/test_transaction_request_action.py
.py
from decimal import Decimal from unittest.mock import patch import graphene import pytest from .....checkout import CheckoutAuthorizeStatus from .....checkout.payment_utils import update_checkout_payment_statuses from .....giftcard import GiftCardEvents from .....giftcard.const import GIFT_CARD_PAYMENT_GATEWAY_ID fro...
1,659
50,759
wagtail
wagtail/test/testapp/rich_text.py
.py
from django.forms import Media, widgets from django.utils.safestring import mark_safe class CustomRichTextArea(widgets.Textarea): def render(self, name, value, attrs=None, renderer=None): # mock rendering for individual custom widget return mark_safe( '<template data-controller="custo...
34
1,033
sphinx
sphinx/util/typing.py
.py
"""The composite types for Sphinx.""" from __future__ import annotations import dataclasses import sys import types import typing from collections.abc import Callable, Sequence from typing import TYPE_CHECKING, TypeAliasType from docutils import nodes from docutils.parsers.rst.states import Inliner from sphinx.util...
641
26,013
readthedocs.org
readthedocs/api/v3/routers.py
.py
from rest_framework.routers import APIRootView from rest_framework.routers import DefaultRouter from rest_framework_extensions.routers import NestedRouterMixin class DocsAPIRootView(APIRootView): # Overridden only to add documentation for BrowsableAPIRenderer. # noqa """ Each request requires an `Aut...
24
725
jupytext
tests/functional/simple_notebooks/test_read_incomplete_rmd.py
.py
import jupytext def test_incomplete_header( rmd="""--- title: Incomplete header ```{python} 1+1 ``` """, ): nb = jupytext.reads(rmd, "Rmd") assert len(nb.cells) == 2 assert nb.cells[0].cell_type == "markdown" assert nb.cells[0].source == "---\ntitle: Incomplete header" assert nb.cells[1].cell...
89
1,798
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/flatmap_simple.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
57
1,633
astropy
astropy/utils/codegen.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Utilities for generating new Python code at runtime.""" import inspect import keyword import os import re import textwrap from .introspection import find_current_module __all__ = ["make_function_with_signature"] _ARGNAME_RE = re.compile(r"^[A-Za-z]...
133
4,039
biopython
Bio/PDB/SASA.py
.py
# Copyright (C) 2020, Joao Rodrigues (j.p.g.l.m.rodrigues@gmail.com) # # 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. """Calculati...
252
8,505
hydra
plugins/hydra_ray_launcher/examples/simple/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import time import hydra from omegaconf import DictConfig log = logging.getLogger(__name__) @hydra.main(config_name="config", config_path=".") def my_app(cfg: DictConfig) -> None: log.info(f"Executing task {cfg.task}") tim...
19
373
coremltools
coremltools/converters/mil/mil/ops/defs/iOS15/reduction.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import Operation, precondition, types from cor...
550
14,838
mlflow
examples/spark_udf/structs_and_arrays.py
.py
from pyspark.sql import SparkSession from pyspark.sql import types as T import mlflow class MyModel(mlflow.pyfunc.PythonModel): def predict(self, context, model_input): return [str(" | ".join(map(str, row))) for _, row in model_input.iterrows()] def main(): with SparkSession.builder.getOrCreate() a...
68
1,868
metrics
src/torchmetrics/classification/hamming.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...
530
24,081
sphinx
sphinx/search/_stopwords/it.py
.py
# automatically generated by utils/generate-snowball.py # from https://github.com/snowballstem/snowball-website/raw/efb4ae4d65769fb1652acbe608c0c817e746c730/algorithms/italian/stop.txt from __future__ import annotations ITALIAN_STOPWORDS = frozenset({ 'a', 'abbia', 'abbiamo', 'abbiano', 'abbiate',...
287
3,864
astropy
astropy/cosmology/_src/io/builtin/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Read/Write/Interchange methods for `astropy.cosmology`. **NOT public API**. """ # Import to register with the I/O machinery from . import cosmology, ecsv, html, latex, mapping, model, mrt, row, table, yaml
9
275
beam
sdks/python/apache_beam/examples/cookbook/datastore_wordcount.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...
268
9,706
astropy
astropy/io/fits/tests/test_nonstandard.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import numpy as np from astropy.io import fits from .conftest import FitsTestCase class TestNonstandardHdus(FitsTestCase): def test_create_fitshdu(self): """ A round trip test of creating a FitsHDU, adding a FITS file to it, ...
70
2,325
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_reshape.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 TestKerasReshape(CommonTF2LayerTest): def create_keras_reshape_net(self, input_names, input_shapes, input_type, target_shape, ...
40
1,714
pyomo
pyomo/core/kernel/piecewise_library/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...
181
5,452
flit
flit/vcs/git.py
.py
import os from subprocess import check_output name = 'git' def list_tracked_files(directory): outb = check_output(['git', 'ls-files', '--recurse-submodules', '-z'], cwd=str(directory)) return [os.fsdecode(l) for l in outb.strip(b'\0').split(b'\0') if l] def list_untracked_deleted_file...
16
574
ipython
IPython/core/autocall.py
.py
""" Autocall capabilities for IPython.core. Authors: * Brian Granger * Fernando Perez * Thomas Kluyver Notes ----- """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The ful...
71
1,941
mlflow
mlflow/gemini/autolog.py
.py
import inspect import logging from typing import Any import mlflow import mlflow.gemini from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.gemini.chat import ( convert_gemini_func_to_mlflow_chat_tool, ) from mlflow.tracing.constant import SpanAttributeKey, TokenUsageKey from...
328
11,809
sqlmap
plugins/dbms/oracle/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 hashDBRetrieve from lib.core.common import hashDBWrite from lib.core....
148
4,462
mlflow
mlflow/utils/import_hooks/__init__.py
.py
""" NOTE: The contents of this file have been inlined from the wrapt package's source code https://github.com/GrahamDumpleton/wrapt/blob/1.12.1/src/wrapt/importer.py. Some modifications, have been made in order to: - avoid duplicate registration of import hooks - inline functions from dependent wrapt submodules...
358
13,321
clearml
examples/reporting/scalar_reporting.py
.py
# ClearML - Example of manual graphs and statistics reporting # from clearml import Task, Logger def report_scalars(logger): # type: (Logger) -> () """ reporting scalars to scalars section :param logger: The task.logger to use for sending the scalars """ # report two scalar series on the same ...
51
1,696
onnxruntime
onnxruntime/python/tools/transformers/io_binding_helper.py
.py
import copy import logging from collections import OrderedDict from collections.abc import Mapping from typing import Any import numpy import torch from onnx import TensorProto from onnxruntime import InferenceSession, RunOptions # Type alias ShapeDict = Mapping[str, tuple | list[int]] logger = logging.getLogger(__...
539
21,307
django-cms
cms/test_utils/fixtures/templatetags.py
.py
from cms.api import create_page, create_page_content class TwoPagesFixture: def create_fixtures(self): defaults = { 'template': 'nav_playground.html', 'in_navigation': True, } with self.settings(CMS_PERMISSION=False): first = create_page('first', languag...
15
546
pymc
pymc/logprob/scan.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...
503
21,278
openvino
tests/layer_tests/onnx_tests/test_conv_transpose.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model class TestConvTranspose(OnnxRuntimeLayerTest): def _prepare_input(self, inputs_dict): for input in inputs_dict....
232
10,563
openvino
tests/layer_tests/tensorflow_tests/conftest.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import inspect import logging as log from pathlib import Path import pytest from common.layer_test_class import get_params from common.utils.common_utils import copy_files_by_pattern def pytest_generate_tests(metafunc): test_gen_at...
17
551
cvxpy
cvxpy/atoms/quad_over_lin.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...
175
5,645
django-cms
cms/wizards/wizard_pool.py
.py
from django.apps import apps from django.utils.translation import gettext as _ from cms.utils.compat.warnings import RemovedInDjangoCMS60Warning from cms.wizards.wizard_base import Wizard, entry_choices, get_entries, get_entry # noqa: F401 class AlreadyRegisteredException(Exception): pass class WizardPool: ...
94
3,087
black
tests/data/cases/line_ranges_imports.py
.py
# flags: --line-ranges=8-8 # NOTE: If you need to modify this file, pay special attention to the --line-ranges= # flag above as it's formatting specifically these lines. # This test ensures no empty lines are added around import lines. # It caused an issue before https://github.com/psf/black/pull/3610 is merged. impor...
10
346
mlflow
mlflow/store/tracking/mcp_server_registry/rest_mixin.py
.py
"""REST implementation of MCPServerRegistryMixin.""" from __future__ import annotations from dataclasses import asdict from typing import Any from urllib.parse import quote from mlflow.entities.mcp_access_endpoint import MCPAccessEndpoint from mlflow.entities.mcp_server import MCPRemoteTransportType, MCPServer, MCPS...
380
15,393
mlflow
mlflow/tracing/utils/once.py
.py
# Customized from https://github.com/open-telemetry/opentelemetry-python/blob/754fc36a408dd45e86d4a0f820f84e692f14b4c1/opentelemetry-api/src/opentelemetry/util/_once.py from threading import Lock from typing import Callable class Once: """Execute a function exactly once and block all callers until the function re...
26
800
saleor
saleor/plugins/user_email/tasks.py
.py
from ...account import events as account_events from ...celeryconf import app from ...core.db.connection import allow_writer from ...giftcard import events as gift_card_events from ...graphql.core.utils import from_global_id_or_none from ...invoice import events as invoice_events from ...order import events as order_ev...
302
9,716
readthedocs.org
readthedocs/audit/filters.py
.py
"""Filters used in our views.""" from django_filters import CharFilter from django_filters import ChoiceFilter from django_filters import DateFromToRangeFilter from django_filters import FilterSet from readthedocs.audit.models import AuditLog class UserSecurityLogFilter(FilterSet): """Filter for user security l...
61
2,351
omegaconf
tests/conftest.py
.py
import copy from typing import Any from pytest import fixture from omegaconf import OmegaConf from omegaconf.basecontainer import BaseContainer @fixture(scope="function") def restore_resolvers() -> Any: """ A fixture to restore singletons state after this the function. This is useful for functions that ...
36
962
hydra
examples/tutorials/structured_configs/2_static_complex/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from dataclasses import dataclass, field import hydra from hydra.core.config_store import ConfigStore @dataclass class MySQLConfig: host: str = "localhost" port: int = 3306 @dataclass class UserInterface: title: str = "My app" w...
38
767
readthedocs.org
readthedocs/search/api/v3/views.py
.py
from functools import cached_property import structlog from django.utils import timezone from django.utils.translation import gettext as _ from rest_framework.exceptions import ValidationError from rest_framework.generics import GenericAPIView from rest_framework.permissions import AllowAny from rest_framework.throttl...
179
5,806
mlflow
tests/tracking/_tracking_service/test_tracking_service_client.py
.py
from unittest import mock import pytest from mlflow.entities import Metric, Param, Run, RunInfo, RunTag from mlflow.exceptions import MlflowException from mlflow.tracking._tracking_service.client import TrackingServiceClient @pytest.fixture def mock_store(): with mock.patch("mlflow.tracking._tracking_service.ut...
157
5,705
scikit-bio
skbio/io/format/tests/test_emptyfile.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. # --------------------------------------------...
37
1,097