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
metrics
tests/unittests/image/test_image_gradients.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...
93
3,267
saleor
saleor/graphql/translations/mutations/attribute_value_translate.py
.py
import graphene from django.core.exceptions import ValidationError from ....attribute import AttributeInputType, AttributeType from ....attribute import models as attribute_models from ....core.editorjs import editorjs_to_text from ....core.utils.text import safe_truncate from ....permission.enums import SitePermissio...
74
3,185
gunicorn
examples/frameworks/tornadoapp.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # # Run with: # # $ gunicorn -k tornado tornadoapp:app # import asyncio import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): async def get(self): # Your asynchrono...
34
644
pyomo
pyomo/contrib/appsi/writers/nl_writer.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...
276
10,288
mlflow
mlflow/evaluation/evaluation_tag.py
.py
""" THE 'mlflow.evaluation` MODULE IS LEGACY AND WILL BE REMOVED SOON. PLEASE DO NOT USE THESE CLASSES IN NEW CODE. INSTEAD, USE `mlflow/entities/assessment.py` FOR ASSESSMENT CLASSES. """ from mlflow.entities._mlflow_object import _MlflowObject from mlflow.utils.annotations import deprecated @deprecated(since="3.0....
62
1,682
sqlmap
thirdparty/magic/magic.py
.py
""" magic is a wrapper around the libmagic file identification library. Usage: >>> import magic >>> magic.from_file("testdata/test.pdf") 'PDF document, version 1.2' >>> magic.from_file("testdata/test.pdf", mime=True) 'application/pdf' >>> magic.from_buffer(open("testdata/test.pdf").read(1024)) 'PDF document, version ...
226
6,723
qutip
qutip/solver/sesolve.py
.py
""" This module provides solvers for the unitary Schrodinger equation. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['sesolve', 'SESolver'] from numpy.typing import ArrayLike from time import time from typing import Any, Callable from .. import Qobj, QobjEvo f...
239
8,749
openvino
src/frontends/tensorflow/tests/test_models/models_pbtxt/injected_body_and_if.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf from tensorflow.python.framework import function tf.reset_default_graph() @function.Defun(tf.int32) def aux_func(x): return x ** 2 @function.Defun(tf.int32, tf.int32) def then_branch_func(x, y):...
36
941
beam
sdks/python/apache_beam/runners/interactive/recording_manager.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...
981
34,480
probability
tensorflow_probability/python/distributions/inverse_gamma.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...
305
11,173
sphinx
tests/roots/test-ext-autodoc/target/typed_vars.py
.py
#: attr1 attr1: str = '' #: attr2 attr2: str #: attr3 attr3 = '' # type: str class _Descriptor: def __init__(self, name): self.__doc__ = f'This is {name}' def __get__(self): # NoQA: PLE0302 pass class Class: attr1: int = 0 attr2: int attr3 = 0 # type: int descr4: int = _...
38
606
flit
flit/sdist_rules.py
.py
"""Generate sdist include/exclude rules for Flit To use: cd into a folder with pyproject.toml set up for Flit, inside a git repository. Produce any files that should be excluded (e.g. build docs). Run 'python -m flit.sdist_rules'. It aims to include all files that are tracked in git, with as few patterns as feasible. ...
121
3,979
onnx
onnx/reference/ops/op_size.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class Size(OpRun): def _run(self, data): return (np.array(data.size, dtype=np.int64),)
14
278
coremltools
coremltools/test/optimize/test_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 import itertools import numpy as np import pytest from coremltools.converters.mil.mil import types fro...
248
9,683
pyomo
pyomo/repn/plugins/nl_writer.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
2,009
82,296
sqlmap
plugins/dbms/snowflake/filesystem.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): d...
19
676
django-cms
cms/cms_menus.py
.py
import re from collections import defaultdict from collections.abc import Generator, Iterable from django.utils.functional import SimpleLazyObject from cms import constants from cms.apphook_pool import apphook_pool from cms.models import Page, PageContent, PagePermission, PageUrl from cms.toolbar.utils import get_obj...
527
22,460
probability
tensorflow_probability/python/distributions/markov_chain.py
.py
# Copyright 2021 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
776
33,599
conda
conda/core/index.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tools for fetching the current index.""" from __future__ import annotations from collections import UserDict from logging import getLogger from typing import TYPE_CHECKING from ..base.context import context from ..common.iterators import u...
645
24,617
black
tests/data/cases/line_ranges_diff_edge_case.py
.py
# flags: --line-ranges=10-11 # NOTE: If you need to modify this file, pay special attention to the --line-ranges= # flag above as it's formatting specifically these lines. # Reproducible example for https://github.com/psf/black/issues/4033. # This can be fixed in the future if we use a better diffing algorithm, or mak...
29
954
pyomo
pyomo/core/tests/unit/test_template_expr.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...
771
27,804
loguru
tests/exceptions/source/backtrace/enqueue.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, enqueue=True, format="", colorize=False, backtrace=True, diagnose=False) try: 1 / 0 except ZeroDivisionError: logger.exception("Error")
12
223
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_conv_3d.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 TestKerasConv3D(CommonTF2LayerTest): def create_keras_conv3d_net(self, conv_params, input_names, input_shapes, input_type, ...
68
3,438
pyomo
pyomo/contrib/sensitivity_toolbox/tests/__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...
13
595
mlflow
tests/server/jobs/test_scorer_invocation.py
.py
import json import os import signal import subprocess import sys import threading import time from http.server import BaseHTTPRequestHandler, HTTPServer from typing import Any, Literal import pytest import requests import mlflow from mlflow.genai.judges import make_judge from mlflow.tracing.assessment import log_expe...
563
21,464
beam
sdks/python/apache_beam/io/gcp/dicomio.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...
31
1,095
mlflow
tests/llama_index/sample_code/basic_vector_store.py
.py
from llama_index.core import Document, VectorStoreIndex import mlflow index = VectorStoreIndex.from_documents(documents=[Document.example()]) mlflow.models.set_model(index)
8
176
cvxpy
cvxpy/atoms/elementwise/logic.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
321
8,634
sqlmap
tamper/between.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.enums import PRIORITY __priority__ = PRIORITY.HIGHEST def dependencies(): pass def tamper(payload, **kwargs): """ Replaces the greater-than...
62
2,061
pyomo
pyomo/repn/tests/ampl/small2_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...
27
1,053
probability
tensorflow_probability/python/bijectors/scale_matvec_linear_operator.py
.py
# Copyright 2019 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
265
10,110
readthedocs.org
readthedocs/search/tests/test_views.py
.py
import re import pytest from django.contrib.auth.models import User from django.test import override_settings from django.urls import reverse from django_dynamic_fixture import get from readthedocs.builds.constants import LATEST from readthedocs.builds.models import Version from readthedocs.projects.models import Pro...
382
14,042
saleor
saleor/graphql/discount/mutations/promotion/promotion_rule_create.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from .....discount import events, models from .....permission.enums import DiscountPermissions from .....product.utils.product import mark_products_in_channels_as_dirty from .....webhook.event_types import WebhookEv...
115
4,328
wagtail
wagtail/images/views/bulk_actions/delete.py
.py
from django.utils.translation import gettext_lazy as _ from django.utils.translation import ngettext from wagtail.admin.views.bulk_action.mixins import ReferenceIndexMixin from wagtail.images.views.bulk_actions.image_bulk_action import ImageBulkAction class DeleteBulkAction(ReferenceIndexMixin, ImageBulkAction): ...
38
1,377
openvino
tests/layer_tests/tensorflow_tests/test_tf_Inv.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 TestInv(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'x:0' in inputs_info ...
85
3,281
mlflow
tests/genai/test_agent_tester.py
.py
from unittest import mock import pydantic import pytest from mlflow.genai.agent_tester import ( _DEFAULT_NUM_TEST_CASES, _DEFAULT_TESTING_GUIDANCE, AgentTestResult, _AgentDescription, _describe_agent_from_response, _describe_agent_from_traces, _generate_test_cases, _get_agent_response_...
566
18,875
coremltools
deps/pybind11/tests/test_union.py
.py
from __future__ import annotations from pybind11_tests import union_ as m def test_union(): instance = m.TestUnion() instance.as_uint = 10 assert instance.as_int == 10
11
184
saleor
saleor/graphql/page/tests/benchmark/test_page_type.py
.py
import graphene import pytest from .....page.models import PageType from ....tests.utils import get_graphql_content @pytest.mark.django_db @pytest.mark.count_queries(autouse=False) def test_query_page_type( page_type, staff_api_client, author_page_attribute, permission_manage_pages, permission_ma...
204
6,251
pyro
pyro/poutine/scale_messenger.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from typing import TYPE_CHECKING, Union import torch from pyro.poutine.messenger import Messenger from pyro.poutine.util import is_validation_enabled if TYPE_CHECKING: from pyro.poutine.runtime import Message class ScaleMe...
54
1,975
pynacl
src/nacl/pwhash/argon2i.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # 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...
133
4,405
onnxruntime
onnxruntime/python/tools/transformers/huggingface_models.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # Maps ...
75
3,931
mlflow
tests/tracing/fixtures/flask_tracing_server.py
.py
"""Flask server for distributed tracing tests.""" import sys import requests from flask import Flask, jsonify, request import mlflow from mlflow.tracing.distributed import ( get_tracing_context_headers_for_http_request, set_tracing_context_from_http_request_headers, ) REQUEST_TIMEOUT = 20 app = Flask(__nam...
81
2,476
wandb
wandb/proto/v5/wandb_telemetry_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: wandb/proto/wandb_telemetry.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool fro...
41
12,040
mkdocs-material
material/extensions/emoji.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
98
3,612
probability
spinoffs/autobnn/autobnn/bnn_tree_test.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...
123
4,312
onnxruntime
onnxruntime/python/tools/quantization/operators/lstm.py
.py
import numpy import onnx from onnx import onnx_pb as onnx_proto from ..quant_utils import QuantType, attribute_to_kwarg, ms_domain # noqa: F401 from .base_operator import QuantOperatorBase """ Quantize LSTM """ class LSTMQuant(QuantOperatorBase): def __init__(self, onnx_quantizer, onnx_node): super...
122
5,117
dirty-equals
tests/test_docs.py
.py
import platform import sys from pathlib import Path import pytest from pytest_examples import CodeExample, EvalExample, find_examples root_dir = Path(__file__).parent.parent examples = find_examples( root_dir / 'dirty_equals', root_dir / 'docs', ) @pytest.mark.skipif(platform.python_implementation() == 'Py...
42
1,507
mlflow
mlflow/store/db_migrations/versions/cc1f77228345_change_param_value_length_to_500.py
.py
"""change param value length to 500 Create Date: 2022-08-04 22:40:56.960003 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "cc1f77228345" down_revision = "0c779009ac13" branch_labels = None depends_on = None def upgrade(): """ Enlarge the maximum par...
33
636
eve
tests/test_version.py
.py
# -*- coding: utf-8 -*- API_VERSION = "v1" DOMAIN = {"contacts": {}}
5
70
openvino
tests/e2e_tests/common/ref_collector/score_tf_lite.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from e2e_tests.common.ref_collector.provider import ClassProvider class ScoreTensorFLowLite(ClassProvider): __action_name__ = "score_tf_lite" def __init__(self, config): self.model = config["model"] self.inputs...
34
1,207
hydra
tests/test_apps/app_can_fail/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra @hydra.main() def my_app(cfg: DictConfig) -> None: val = 1 / cfg.divisor print(f"val={val}") if __name__ == "__main__": my_app()
15
263
saleor
saleor/graphql/account/mutations/permission_group/permission_group_update.py
.py
from collections import defaultdict from typing import cast import graphene from django.core.exceptions import ValidationError from .....account import models from .....account.error_codes import PermissionGroupErrorCode from .....account.models import User from .....channel.models import Channel from .....core.traci...
325
12,542
conda
tests/env/specs/test_explicit.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import pytest from conda.env.specs.explicit import ExplicitSpec from conda.exceptions import CondaValueError, PluginError from conda.models.environment import Environment from .. import support_file def test_no_environment_file(): spec =...
34
967
textual
tests/test_style_importance.py
.py
from textual.app import App, ComposeResult from textual.color import Color from textual.containers import Container from textual.css.scalar import ScalarOffset class StyleApp(App[None]): CSS = """ Container { border: round green !important; outline: round green !important; align: right...
103
3,501
pyomo
pyomo/contrib/sensitivity_toolbox/__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...
13
589
saleor
saleor/graphql/checkout/tests/benchmark/test_checkouts.py
.py
import pytest from ....tests.utils import get_graphql_content MULTIPLE_CHECKOUT_DETAILS_QUERY = """ query multipleCheckouts { checkouts(first: 100){ edges { node { id channel { id slug } } } } } """ @pytest.mark.django_db @pytest.mark.count_queries...
43
832
probability
tensorflow_probability/python/distributions/sinh_arcsinh.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...
221
9,570
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_value_delete.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....attribute.tests.model_helpers import ( get_product_attribute_values, get_product_attributes, ) from .....attribute.utils import associate_attribu...
455
13,903
lemur
lemur/certificates/hooks.py
.py
""" Debugging hooks for dumping imported or generated CSR and certificate details to stdout via OpenSSL. .. module: lemur.certificates.hooks :platform: Unix :copyright: (c) 2018 by Marti Raudsepp, see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Marti Raudsepp <marti@...
48
1,383
pyomo
pyomo/solvers/mockmip.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...
59
2,176
black
tests/data/cases/preview_long_strings__east_asian_width.py
.py
# flags: --unstable # The following strings do not have not-so-many chars, but are long enough # when these are rendered in a monospace font (if the renderer respects # Unicode East Asian Width properties). hangul = '코드포인트 수는 적으나 실제 터미널이나 에디터에서 렌더링될 땐 너무 길어서 줄바꿈이 필요한 문자열' hanzi = '中文測試:代碼點數量少,但在真正的終端模擬器或編輯器中呈現時太長,因此需要換...
58
3,183
saleor
saleor/webhook/tests/circuit_breaker/test_breaker_board.py
.py
from unittest.mock import MagicMock import pytest from django.core.exceptions import ImproperlyConfigured from promise import Promise from ....graphql.app.enums import CircuitBreakerState from ....webhook.event_types import WebhookEventSyncType from .utils import create_breaker_board def test_breaker_board_failure_...
266
8,344
onnx
onnx/reference/ops/op_exp.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 Exp(OpRunUnaryNum): def _run(self, x): return (np.exp(x).astype(x.dtype),)
14
281
bazel
src/test/py/bazel/bzlmod/bzlmod_credentials_test.py
.py
# pylint: disable=g-backslash-continuation # Copyright 2023 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICEN...
167
5,291
saleor
saleor/tests/storages.py
.py
from django.conf import settings from django.core.files.storage import FileSystemStorage class PrivateFileSystemStorage(FileSystemStorage): @property def base_location(self): return settings.PRIVATE_MEDIA_ROOT
9
228
mlflow
tests/genai/discovery/test_extraction.py
.py
from unittest import mock import pytest import mlflow from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceType from mlflow.genai.discovery.entities import _ConversationAnalysis from mlflow.genai.discovery.extraction import ( collect_session_rationales, extract_assessment_rationale,...
264
8,681
sqlmap
plugins/dbms/cratedb/__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 CRATEDB_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.cratedb.enumeration import Enumeration...
31
919
mlflow
mlflow/genai/scorers/ragas/scorers/agentic_metrics.py
.py
from __future__ import annotations from typing import ClassVar from mlflow.genai.judges.builtin import _MODEL_API_DOC from mlflow.genai.scorers.ragas import RagasScorer from mlflow.utils.docstring_utils import format_docstring @format_docstring(_MODEL_API_DOC) class TopicAdherence(RagasScorer): """ Evaluate...
196
6,168
hydra
examples/plugins/example_searchpath_plugin/setup.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # type: ignore from setuptools import find_namespace_packages, setup, find_packages with open("README.md") as fh: LONG_DESC = fh.read() setup( name="hydra-example-searchpath-plugin", version="1.0.0", author="Omry Yad...
41
1,796
saleor
saleor/graphql/order/tests/mutations/test_draft_order_bulk_delete.py
.py
import graphene from django.conf import settings from .....discount.models import VoucherCode from .....order import OrderStatus from .....order import models as order_models from .....order.error_codes import OrderErrorCode from ....tests.utils import assert_no_permission, get_graphql_content DRAFT_ORDER_BULK_DELETE...
394
11,849
mlflow
tests/gateway/providers/test_provider_utils.py
.py
from unittest import mock import pytest from mlflow.gateway.providers.utils import ( SUPPORTED_ACCEPT_ENCODING, _aiohttp_post, proxy_root_url, rename_payload_keys, ) from tests.gateway.tools import MockAsyncResponse, mock_http_client def test_rename_payload_keys(): payload = {"old_key1": "value...
123
4,567
bazel
src/create_embedded_tools.py
.py
# pylint: disable=g-direct-third-party-import # pylint: disable=g-bad-file-header # Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
152
5,936
mlflow
dev/clint/tests/rules/test_example_syntax_error.py
.py
from pathlib import Path import pytest from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules.example_syntax_error import ExampleSyntaxError def test_example_syntax_error(index: SymbolIndex) -> None: code = ''' def bad(): """ ...
47
1,253
astropy
astropy/io/ascii/tests/test_cds.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests some methods related to ``CDS`` format reader/writer. Requires `pyyaml <https://pyyaml.org/>`_ to be installed. """ from io import StringIO import numpy as np import pytest from numpy.testing import assert_allclose from astropy im...
559
28,006
cvxpy
cvxpy/tests/nlp_tests/test_scalar_and_matrix_problems.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
308
12,079
lemur
lemur/certificates/models.py
.py
""" .. module: lemur.certificates.models :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 datetime import timedelta import arrow from cryptography import x509 from flask...
517
16,581
pyomo
pyomo/core/kernel/parameter.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...
153
4,474
ipython
tests/fake_ext_dir/daft_extension.py
.py
# -*- coding: utf-8 -*- """ Useless IPython extension to test installing and loading extensions. """ some_vars = {"arq": 185} def load_ipython_extension(ip): # set up simplified quantity input ip.push(some_vars) def unload_ipython_extension(ip): ip.drop_by_id(some_vars)
15
287
django-cms
cms/tests/test_placeholder_app_admin.py
.py
from unittest.mock import patch from django.forms.models import model_to_dict from cms.api import add_plugin from cms.models import CMSPlugin, Placeholder, UserSettings from cms.test_utils.project.placeholderapp.models import Example1 from cms.test_utils.testcases import CMSTestCase from cms.test_utils.util.context_m...
888
36,980
beam
sdks/python/apache_beam/testing/benchmarks/inference/pytorch_image_classification_benchmarks.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...
73
2,773
readthedocs.org
readthedocs/notifications/templatetags/notifications_filters.py
.py
from django import template register = template.Library() @register.filter def to_class_name(value): """Output the name of the class for the given object.""" return value.__class__.__name__
11
202
ipython
tests/test_magics_packaging.py
.py
"""Tests for IPython.core.magics.packaging (%pip, %conda, %mamba, %micromamba, %uv). No package manager is ever executed. ``ip.system`` is replaced by a recorder so only the constructed command lines are asserted. """ import shlex import sys from pathlib import Path import pytest from IPython.testing.decorators imp...
192
7,044
gunicorn
tests/dirty/test_streaming_integration.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Integration tests for dirty streaming functionality. These tests verify the full streaming pipeline: client -> arbiter -> worker -> generator -> chunks -> client """ import asyncio import os import struct impo...
478
15,944
onnxruntime
orttraining/orttraining/python/training/optim/_megatron_modifier.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # # Copyright 2020 The Microsoft DeepSpeed Team # Copyright (c) 2020, NVIDIA CORPORATION. # Some functions in this file are adapted from following sou...
87
4,085
openvino
tests/model_hub_tests/models_hub_common/test_performance_model.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys import traceback import time from enum import Enum import pytest from openvino.utils.types import openvino_to_numpy_types_map import models_hub_common.utils as utils import models_hub_common.constants as const import numpy ...
217
9,584
astropy
astropy/modeling/tests/example_models.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Here are all the test parameters and values for the each `~astropy.modeling.FittableModel` defined. There is a dictionary for 1D and a dictionary for 2D models. Explanation of keywords of the dictionaries: "parameters" : list or dict Model parame...
472
13,552
probability
tensorflow_probability/python/distributions/inflated.py
.py
# Copyright 2022 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...
351
14,726
conda
tests/data/pkg_cache/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import json import sys from conda.core.package_cache_data import PackageCacheRecord if sys.version_info < (3, 12): from importlib_resources import files else: from importlib.resources import files def load_data_file(filename): wi...
24
579
coremltools
coremltools/converters/mil/mil/ops/defs/complex_dialect_ops.py
.py
# Copyright (c) 2022, 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 """ This file contains the dialect ops for handling complex numbers. For example, torch.fft.fft acce...
859
30,651
textual
tests/css/test_programmatic_style_changes.py
.py
import pytest from textual.app import App from textual.containers import Grid from textual.widgets import Label @pytest.mark.parametrize( "style, value", [ ("grid_size_rows", 3), ("grid_size_columns", 3), ("grid_gutter_vertical", 4), ("grid_gutter_horizontal", 4), ("gr...
95
2,610
beam
sdks/python/apache_beam/runners/interactive/user_pipeline_tracker.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...
173
6,404
saleor
saleor/graphql/core/types/converter.py
.py
"""Form fields converter subset from graphene_django for use in Saleor.""" from functools import singledispatch import graphene from django import forms from django.core.exceptions import ImproperlyConfigured from ..filters import ( EnumFilter, EnumWhereFilter, GlobalIDFormField, GlobalIDMultipleChoi...
88
2,618
hatch
src/hatch/cli/check/types.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import click if TYPE_CHECKING: from hatch.cli.application import Application @click.command(short_help="Type check source code", context_settings={"ignore_unknown_options": True}) @click.argument("args", nargs=-1) @click.option("--summarize", ...
52
1,500
pyomo
pyomo/repn/plugins/baron_writer.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...
835
32,255
saleor
saleor/graphql/checkout/tests/mutations/test_checkout_lines_delete.py
.py
from unittest import mock from unittest.mock import ANY, patch import graphene import pytest from django.test import override_settings from .....checkout.actions import call_checkout_info_event from .....checkout.error_codes import CheckoutErrorCode from .....checkout.fetch import fetch_checkout_info, fetch_checkout_...
432
15,067
lemur
lemur/plugins/bases/source.py
.py
""" .. module: lemur.plugins.bases.source :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 lemur.plugins.base import Plugin class SourcePlugin(Plugin): type = "sou...
56
1,517
wandb
wandb/sdk/artifacts/_generated/delete_artifact_collection_tags.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from wandb._pydantic import GQLResult class DeleteArtifactCollectionTags(GQLResult): result: DeleteArtifactCollectionTagsResult | None class DeleteArtifactCollectionTagsResult(GQLResult): success: ...
18
372
mlflow
mlflow/groq/_groq_autolog.py
.py
import logging from typing import Any import mlflow from mlflow.entities import SpanType from mlflow.tracing.constant import SpanAttributeKey, TokenUsageKey from mlflow.tracing.utils import set_span_chat_tools from mlflow.utils.autologging_utils.config import AutoLoggingConfig _logger = logging.getLogger(__name__) ...
70
2,448
sphinx
tests/roots/test-domain-cpp-intersphinx/conf.py
.py
exclude_patterns = ['_build'] extensions = [ 'sphinx.ext.intersphinx', ]
5
77
httpie
tests/utils/matching/test_matching.py
.py
""" Here we test our output parsing and matching implementation, not HTTPie itself. """ from httpie.models import ELAPSED_TIME_LABEL from httpie.output.writer import MESSAGE_SEPARATOR from ...utils import CRLF from . import assert_output_does_not_match, assert_output_matches, Expect def test_assert_output_matches_he...
215
5,827