repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/radon_contextual_effects_minnesota.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...
345
8,662
wagtail
wagtail/actions/__init__.py
.py
import swapper from django.db import models from wagtail.actions.base import BaseAction from wagtail.actions.convert_alias import ConvertAliasPageAction from wagtail.actions.copy_for_translation import ( CopyForTranslationAction, CopyPageForTranslationAction, ) from wagtail.actions.copy_page import CopyPageAct...
84
3,256
deap
doc/code/tutorials/part_2/2_3_3_swarm.py
.py
## 2.2.6 Particle import random from deap import base from deap import creator from deap import tools creator.create("FitnessMax", base.Fitness, weights=(1.0, 1.0)) creator.create("Particle", list, fitness=creator.FitnessMax, speed=None, smin=None, smax=None, best=None) creator.create("Swarm", list, gb...
24
827
onnx
onnx/reference/ops/op_non_max_suppression.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import dataclasses import numpy as np from onnx.reference.op_run import OpRun @dataclasses.dataclass class PrepareContext: boxes_data_: np.ndarray | None = None boxes_size_: int = 0 score...
272
9,282
omegaconf
build_helpers/test_helpers.py
.py
from pathlib import Path from typing import List import pytest from build_helpers.build_helpers import find, find_version, matches @pytest.mark.parametrize( "path_rel,include_files,include_dirs,excludes,scan_exclude,expected", [ pytest.param("test_files", [], [], [], None, [], id="none"), py...
143
3,769
conda
conda/plugins/virtual_packages/osx.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Detect whether this is macOS.""" from __future__ import annotations from typing import TYPE_CHECKING from ...base.context import context from .. import hookimpl from ..types import CondaVirtualPackage if TYPE_CHECKING: from collection...
47
1,263
textual
tests/test_layout_resolve.py
.py
from __future__ import annotations from typing import NamedTuple import pytest from textual._layout_resolve import layout_resolve class Edge(NamedTuple): size: int | None = None fraction: int = 1 min_size: int = 1 def test_empty(): assert layout_resolve(10, []) == [] def test_total_zero(): ...
102
3,338
onnx
onnx/reference/ops/aionnxml/op_tree_ensemble_regressor.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.aionnxml._op_run_aionnxml import OpRunAiOnnxMl from onnx.reference.ops.aionnxml.op_tree_ensemble_helper import TreeEnsemble class TreeEnsembleRegressor(OpRun...
110
4,104
onnx
onnx/reference/ops/op_dequantize_linear.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx import TensorProto from onnx.helper import np_dtype_to_tensor_dtype, tensor_dtype_to_np_dtype from onnx.reference.op_run import OpRun from onnx.reference.ops._quant_utils im...
92
3,182
openvino
src/bindings/python/tests/test_graph/test_tensor_iterator.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov from openvino import Model, Shape from openvino.op.util import ( InvariantInputDescription, BodyOutputDescription, SliceInputDescription, MergedInpu...
173
6,352
coremltools
coremltools/converters/mil/mil/ops/tests/testing_utils.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 functools from typing import Dict, List, Optional import pytest import coremltools as ct fro...
234
8,686
clearml
clearml/backend_config/log.py
.py
import logging.config from copy import deepcopy from types import TracebackType from typing import Optional, Dict, Union, Type, Tuple, Any from pathlib2 import Path def logger(path: Optional[str] = None) -> logging.Logger: """Get a ClearML Python logging.Logger named according to the parent path or stem of the f...
47
1,543
onnxruntime
onnxruntime/test/python/transformers/test_qmoe_cuda.py
.py
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # # QMo...
3,189
131,644
pyomo
examples/gdp/simple2.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...
48
1,471
onnxruntime
onnxruntime/python/tools/transformers/bert_test_data.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # It is a tool to generate test data for a bert model. # The test data ...
642
22,805
scikit-bio
skbio/diversity/alpha/_ace.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. # --------------------------------------------...
140
4,567
beam
learning/katas/python/Core Transforms/Flatten/Flatten/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...
48
1,551
sqlmap
lib/controller/handler.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.common import Backend from lib.core.common import getSafeExString from lib.core.common import singleTimeWarnMessage from lib.core.data import conf from lib.core.data...
204
9,288
scikit-bio
skbio/util/_docstring.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. # --------------------------------------------...
288
8,568
wandb
tests/system_tests/test_artifacts/test_wandb_artifacts.py
.py
from __future__ import annotations import filecmp import os import shutil from collections.abc import Callable, Generator, Mapping from concurrent.futures import ThreadPoolExecutor from contextlib import nullcontext from datetime import datetime, timedelta, timezone from pathlib import Path, PurePosixPath, PureWindows...
1,440
48,706
beam
sdks/python/apache_beam/runners/worker/sideinputs.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...
215
7,634
probability
tensorflow_probability/python/monte_carlo/expectation_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...
204
7,955
mlflow
tests/test_skinny_client_autolog_without_scipy.py
.py
import os import pytest @pytest.mark.skipif( "MLFLOW_SKINNY" not in os.environ, reason="This test is only valid for the skinny client" ) def test_autolog_without_scipy(): import mlflow with pytest.raises(ImportError, match="scipy"): import scipy # noqa: F401 assert not mlflow.models.utils....
19
389
mlflow
mlflow/store/workspace/__init__.py
.py
"""Public workspace store facade and re-exports.""" from mlflow.entities.workspace import Workspace from mlflow.store.workspace.abstract_store import AbstractStore from mlflow.store.workspace.rest_store import RestWorkspaceStore __all__ = [ "Workspace", "AbstractStore", "RestWorkspaceStore", ]
12
309
biopython
Bio/Phylo/BaseTree.py
.py
# Copyright (C) 2009 by Eric Talevich (eric.talevich@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. """Base classes f...
1,235
44,935
astropy
astropy/io/ascii/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """An extensible ASCII table reader and writer.""" from astropy import config as _config from . import connect from .basic import ( Basic, BasicData, BasicHeader, CommentedHeader, Csv, NoHeader, Rdb, Tab, ) from .cds impor...
87
1,953
coremltools
coremltools/proto/NamedParameters_pb2.py
.py
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: NamedParameters.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pb2 from google.protobuf import message as _mess...
394
14,471
openvino
tests/layer_tests/tensorflow_tests/test_tf_NestedWhile.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from common.tf_layer_test_class import CommonTFLayerTest class TestNestedWhile(CommonTFLayerTest): def create_simple_while(self): import tensorflow as tf g = tf.Graph() with g.as_default(): ...
82
3,493
wandb
wandb/sdk/lib/ipython.py
.py
from __future__ import annotations import logging import sys import warnings from typing import Literal import wandb PythonType = Literal["python", "ipython", "jupyter"] logger = logging.getLogger(__name__) def toggle_button(what="run"): """Returns the HTML for a button used to reveal the element following it...
144
4,260
sphinx
tests/test_util/test_util.py
.py
"""Tests util functions.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest import sphinx.util from sphinx._cli.util.errors import strip_escape_sequences from sphinx.deprecation import RemovedInSphinx10Warning from sphinx.util._files import DownloadFiles, FilenameUniqDict from sphi...
70
2,292
pyomo
pyomo/core/tests/unit/uninstantiated_model_quadratic.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...
22
796
saleor
saleor/core/tests/test_auth_backend_default_header.py
.py
import jwt import pytest from freezegun import freeze_time from jwt import ExpiredSignatureError, InvalidSignatureError, InvalidTokenError from ...permission.enums import get_permissions_from_names from ...permission.models import Permission from ...site import PasswordLoginMode from ..auth_backend import JSONWebToken...
325
11,568
probability
tensorflow_probability/python/internal/docstring_util.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...
48
1,588
onnxruntime
orttraining/orttraining/test/python/orttraining_ortmodule_tests.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import logging import os import sys from _test_commons import run_subprocess logging.basicConfig(format="%(asctime)s %(name)s [%(levelname)s] - %(message)s", level=logging.DEBUG) log =...
220
7,217
attrs
src/attrs/__init__.py
.py
# SPDX-License-Identifier: MIT from attr import ( NOTHING, Attribute, AttrsInstance, Converter, Factory, NothingType, _make_getattr, assoc, cmp_using, define, evolve, field, fields, fields_dict, frozen, has, make_class, mutable, resolve_types,...
77
1,238
onnx
onnx/backend/test/case/model/sequence.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import typing import numpy as np import onnx from onnx import TensorProto from onnx.backend.test.case.base import Base from onnx.backend.test.case.model import expect def SequenceEmptyImpl() -> list...
457
16,039
sqlmap
thirdparty/chardet/euctwfreq.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights R...
388
31,621
probability
tensorflow_probability/python/distributions/gumbel_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...
327
11,628
saleor
saleor/graphql/order/tests/queries/test_order_payment_event.py
.py
from prices import Money from .....order import events as order_events from ....tests.utils import get_graphql_content ORDERS_PAYMENTS_EVENTS_QUERY = """ query OrdersQuery { orders(first: 1) { edges { node { events { type ...
108
3,408
saleor
saleor/app/tests/test_app_commands.py
.py
from unittest.mock import ANY, Mock, call, patch import graphene import pytest from django.core.management import CommandError, call_command from django.forms import ValidationError from django.utils import timezone from requests_hardened import HTTPSession from ... import schema_version from ...core import JobStatus...
429
12,853
readthedocs.org
readthedocs/organizations/managers.py
.py
"""Organizations managers.""" from django.db import models from readthedocs.core.utils.extend import SettingsOverrideObject from .constants import ADMIN_ACCESS from .constants import READ_ONLY_ACCESS class TeamManagerBase(models.Manager): """Manager to control team's access.""" def teams_for_user(self, us...
71
1,816
sphinx
sphinx/project.py
.py
"""Utility function and classes for Sphinx projects.""" from __future__ import annotations import contextlib import os from pathlib import Path from typing import TYPE_CHECKING from sphinx.locale import __ from sphinx.util import logging from sphinx.util._pathlib import _StrPath from sphinx.util.matching import get_...
129
4,539
probability
spinoffs/inference_gym/inference_gym/tools/__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...
14
599
pyfilesystem2
tests/test_base.py
.py
"""Test (abstract) base FS class.""" from __future__ import unicode_literals import unittest from fs import errors from fs.base import FS class DummyFS(FS): def getinfo(self, path, namespaces=None): pass def listdir(self, path): pass def makedir(self, path, permissions=None, recreate=...
66
1,532
mlflow
tests/tracking/test_log_image.py
.py
import json import os import posixpath import numpy as np import pytest import mlflow from mlflow.utils.file_utils import local_file_uri_to_path from mlflow.utils.time import get_current_time_millis @pytest.mark.parametrize("subdir", [None, ".", "dir", "dir1/dir2", "dir/.."]) def test_log_image_numpy(subdir): i...
367
13,042
sqlmap
lib/request/interactsh.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import base64 import json import time from lib.core.common import randomStr from lib.core.convert import getBytes from lib.core.convert import getText from lib.core.data import c...
176
7,466
saleor
saleor/graphql/shipping/bulk_mutations/shipping_zone_bulk_delete.py
.py
import graphene from django.conf import settings from ....permission.enums import ShippingPermissions from ....shipping import models from ....webhook.event_types import WebhookEventAsyncType from ....webhook.utils import get_webhooks_for_event from ...core import ResolveInfo from ...core.mutations import ModelBulkDel...
43
1,616
probability
tensorflow_probability/python/bijectors/ldj_ratio.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...
225
8,021
scikit-bio
skbio/util/_exception.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
22
660
pyomo
pyomo/core/tests/examples/test_kernel_examples.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...
96
3,346
astropy
astropy/coordinates/tests/test_erfa_astrom.py
.py
import numpy as np import pytest import astropy.units as u from astropy.coordinates import CIRS, GCRS, AltAz, EarthLocation, SkyCoord from astropy.coordinates.erfa_astrom import ( ErfaAstrom, ErfaAstromInterpolator, erfa_astrom, ) from astropy.time import Time from astropy.utils.exceptions import AstropyWa...
125
4,075
openvino
tests/layer_tests/tensorflow_tests/test_tf_LookupTableSize.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import platform import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest from common.utils.tf_utils import mix_array_with_value, run_in_jenkins rng = np.random.default_rng() cla...
73
3,565
saleor
saleor/graphql/giftcard/tests/queries/test_gift_card_tags_filtering.py
.py
import pytest from ....tests.utils import get_graphql_content QUERY_GIFT_CARD_TAGS = """ query giftCardTags($filter: GiftCardTagFilterInput){ giftCardTags(first: 10, filter: $filter) { edges { node { id name } ...
53
1,273
mlflow
mlflow/genai/scorers/base.py
.py
import functools import importlib import inspect import json import logging from contextvars import ContextVar from dataclasses import asdict, dataclass, fields from enum import Enum from typing import Any, Callable, ClassVar, Literal, TypeAlias, TypeVar, overload from pydantic import BaseModel, PrivateAttr import ml...
1,747
74,547
saleor
saleor/core/storages.py
.py
from django.conf import settings from storages.backends.azure_storage import AzureStorage as AzureBaseStorage from storages.backends.gcloud import GoogleCloudStorage from storages.backends.s3boto3 import S3Boto3Storage class S3MediaStorage(S3Boto3Storage): def __init__(self, *args, **kwargs): self.bucket_...
54
1,874
textual
src/textual/_keyboard_protocol.py
.py
from typing import Final # https://sw.kovidgoyal.net/kitty/keyboard-protocol/#functional-key-definitions FUNCTIONAL_KEYS: Final = { "27u": "escape", "13u": "enter", "9u": "tab", "127u": "backspace", "2~": "insert", "3~": "delete", "1D": "left", "1C": "right", "1A": "up", "1B": "...
144
3,199
hydra
hydra/core/singleton.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from copy import deepcopy from typing import Any, Dict from omegaconf.basecontainer import BaseContainer class Singleton(type): _instances: Dict[type, "Singleton"] = {} def __call__(cls, *args: Any, **kwargs: Any) -> Any: if cls ...
40
1,324
hydra
plugins/hydra_ray_launcher/setup.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # type: ignore from pathlib import Path from read_version import read_version from setuptools import find_namespace_packages, setup setup( name="hydra-ray-launcher", version=read_version("hydra_plugins/hydra_ray_launcher", "__init__.py"), ...
37
1,219
sqlmap
lib/parse/payloads.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os import re from xml.etree import ElementTree as et from lib.core.common import getSafeExString from lib.core.compat import xrange from lib.core.data import conf from li...
124
3,639
openvino
docs/articles_en/assets/snippets/ov_hetero.py
.py
import openvino as ov import openvino as properties from utils import get_model def main(): model = get_model() core = ov.Core() #! [set_manual_affinities] for op in model.get_ops(): rt_info = op.get_rt_info() rt_info["affinity"] = "CPU" #! [set_manual_affinities] if "GPU" not...
68
2,151
metrics
src/torchmetrics/text/wip.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...
140
5,380
saleor
saleor/tests/e2e/orders/test_order_in_channel_with_transaction_flow_as_mark_as_paid_strategy.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils import prepare_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_paid, order_lines_cre...
133
4,120
pyro
pyro/contrib/epidemiology/__init__.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from pyro.distributions.coalescent import bio_phylo_to_times from .compartmental import CompartmentalModel from .distributions import beta_binomial_dist, binomial_dist, infection_dist __all__ = [ "CompartmentalModel", "beta_b...
16
406
sqlmap
tests/test_union_engine.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission The UNION-based column-count detection engine (lib/techniques/union/test.py). _findUnionCharCount discovers how many columns a UNION injection needs. Its fastest path is the ORDER BY...
189
7,994
openvino
tools/commit_slider/utils/templates/common.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from abc import ABC from utils.subscription import SubscriptionManager from utils.break_validator import BmValidationError from utils.helpers import getClassByMethod from enum import Enum from utils.cfg_manager import CfgManager class C...
82
3,155
onnx
onnx/backend/test/case/node/resize.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.reference.ops.op_resize import _cubic_coeffs as cubic_coeffs from on...
1,715
51,672
wagtail
wagtail/admin/tests/test_menu.py
.py
from django.test import RequestFactory, TestCase from django.urls import reverse from django.utils import translation from wagtail import hooks from wagtail.admin.menu import ( AdminOnlyMenuItem, DismissibleMenuItem, DismissibleSubmenuMenuItem, Menu, MenuItem, SubmenuMenuItem, admin_menu, )...
425
15,098
mlflow
tests/genai/evaluate/test_job.py
.py
import os from unittest import mock import pytest from mlflow.entities.run_status import RunStatus from mlflow.genai.evaluation.job import invoke_genai_evaluate_job def _serialized_scorer(name: str = "scorer") -> str: return f'{{"name": "{name}"}}' def test_invoke_genai_evaluate_job_has_metadata(): """Wit...
205
9,040
scikit-bio
skbio/metadata/_interval.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. # --------------------------------------------...
1,056
35,687
gunicorn
tests/test_asgi_compliance.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ ASGI 3.0 specification compliance tests. Tests that gunicorn's ASGI implementation conforms to the ASGI 3.0 spec: https://asgi.readthedocs.io/en/latest/specs/main.html """ from unittest import mock import py...
1,108
38,712
onnxruntime
onnxruntime/test/python/helper.py
.py
import os import sys def get_name(name): if os.path.exists(name): return name rel = os.path.join("testdata", name) if os.path.exists(rel): return rel this = os.path.dirname(__file__) data = os.path.join(this, "..", "testdata") res = os.path.join(data, name) if os.path.exist...
28
707
textual
src/textual/design.py
.py
from __future__ import annotations from typing import Iterable import rich.repr from rich.console import group from rich.padding import Padding from rich.table import Table from rich.text import Text from textual.color import TRANSPARENT, WHITE, Color NUMBER_OF_SHADES = 3 # Where no content exists DEFAULT_DARK_BAC...
560
22,000
onnx
onnx/reference/ops/op_gather.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 Gather(OpRun): def _run(self, x, indices, axis=None): if not x.flags["C_CONTIGUOUS"]: x = np.ascontiguousarray(...
24
705
saleor
saleor/graphql/meta/tests/queries/test_app.py
.py
import graphene from ....tests.utils import assert_no_permission, get_graphql_content from .utils import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE QUERY_APP_PRIVATE_META = """ query appMeta($id: ID!){ app(id: $id){ privateMetadata{ key value ...
160
4,334
voila
tests/app/execute_test.py
.py
# test basics of voila running a notebook import asyncio import json import re from unittest import mock import tornado.web async def test_hello_world(http_server_client, base_url): response = await http_server_client.fetch(base_url) assert response.code == 200 html_text = response.body.decode("utf-8") ...
63
2,144
openvino
tests/layer_tests/onnx_tests/test_lrn.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 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 from unit_tests.utils....
142
5,451
mlflow
mlflow/litellm/__init__.py
.py
import logging from typing import Callable from mlflow.telemetry.events import AutologgingEvent from mlflow.telemetry.track import _record_event from mlflow.utils.autologging_utils import autologging_integration, safe_patch FLAVOR_NAME = "litellm" _logger = logging.getLogger(__name__) def autolog( log_traces: ...
124
4,747
lemur
lemur/plugins/lemur_aws/cloudfront.py
.py
""" .. module: lemur.plugins.lemur_aws.cloudfront :synopsis: Helper code for discovering CloudFront endpoints .. moduleauthor:: <lemur@netflix.com> """ from flask import current_app from sentry_sdk import capture_exception from lemur.exceptions import InvalidDistribution from lemur.extensions import metrics from...
173
5,873
biopython
Bio/PDB/SCADIO.py
.py
# Copyright 2019-21 by Robert T. Miller. 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. """SCADIO: write Ope...
907
35,847
saleor
saleor/graphql/core/utils/reordering.py
.py
from collections import OrderedDict from dataclasses import dataclass from django.db import transaction from django.db.models import F, QuerySet from django.utils.functional import cached_property __all__ = ["perform_reordering"] @dataclass(frozen=True) class FinalSortOrder: """Describe a final sort order value...
188
6,007
coremltools
mlmodel/docs/conf.py
.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
61
2,093
pyomo
pyomo/dae/plugins/colloc.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...
723
27,266
saleor
saleor/account/events.py
.py
from ..app.models import App from ..order.models import Order from . import CustomerEvents from .models import CustomerEvent, User def customer_account_created_event(*, user: User) -> CustomerEvent | None: return CustomerEvent.objects.create(user=user, type=CustomerEvents.ACCOUNT_CREATED) def customer_account_a...
114
3,393
saleor
saleor/checkout/tests/webhooks/test_list_shipping_methods.py
.py
from unittest import mock from ....webhook.response_schemas.utils.annotations import logger as annotations_logger from ...webhooks.list_shipping_methods import ( _parse_list_shipping_methods_response, list_shipping_methods_for_checkout, ) @mock.patch("saleor.webhook.transport.synchronous.transport.send_webho...
145
3,749
black
profiling/list_big.py
.py
config = some.Structure( value=set([u'some_rather_long_text_value', u'some_rather_long_text_value', u'some_rather_long_text_value', u'some_rather_long_text_value', u'some_rather_long_text_value', u'some_rather_long_text_value', u'some_rather_long_text_value', ...
4,001
159,994
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/Notebook with many hash signs.py
.py
# --- # jupyter: # jupytext: # cell_markers: '{{{,}}}' # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # ################################################################## # This is a notebook that contains many hash signs. # Hopefully its python representation is no...
31
915
beam
sdks/python/apache_beam/internal/test_data/module_1_local_variable_removed.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...
27
992
readthedocs.org
readthedocs/integrations/admin.py
.py
"""Integration admin models.""" from django import urls from django.contrib import admin from django.utils.html import format_html from django.utils.safestring import mark_safe from pygments.formatters import HtmlFormatter from .models import HttpExchange from .models import Integration def pretty_json_field(field,...
120
3,326
saleor
saleor/tests/e2e/vouchers/utils/voucher_delete.py
.py
from ...utils import get_graphql_content VOUCHER_DELETE_MUTATION = """ mutation VoucherDelete ($id: ID!) { voucherDelete(id: $id) { errors { message code field voucherCodes } voucher { id } } } """ def voucher_delete(staff_api_client, voucher_id): variables = { ...
35
629
wagtail
wagtail/documents/views/bulk_actions/add_to_collection.py
.py
from django import forms from django.utils.translation import gettext_lazy as _ from django.utils.translation import ngettext from wagtail.documents import get_document_model from wagtail.documents.views.bulk_actions.document_bulk_action import DocumentBulkAction from wagtail.permissions import policy_registry class...
60
2,266
django-cms
cms/tests/test_templates.py
.py
import os.path from importlib.machinery import SourceFileLoader from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.template import TemplateDoesNotExist, loader from django.test.utils import override_settings from django.utils.encoding import force_str from django.utils...
143
6,047
astropy
astropy/convolution/tests/test_pickle.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy import convolution as conv from astropy.tests.helper import check_pickling_recovery, pickle_protocol # noqa: F401 @pytest.mark.parametrize( "original", [ conv.CustomKernel(array=np.random.r...
25
852
pyro
pyro/contrib/gp/kernels/coregionalize.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions import constraints from torch.nn import Parameter from pyro.contrib.gp.kernels.kernel import Kernel from pyro.nn.module import PyroParam class Coregionalize(Kernel): r""" A kernel fo...
95
3,699
beam
sdks/python/apache_beam/runners/interactive/display/pipeline_graph.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...
285
11,337
onnxruntime
onnxruntime/test/python/transformers/test_onnx_attention/__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. # --------------------------------------------------------------------------
6
313
python-prompt-toolkit
src/prompt_toolkit/shortcuts/progress_bar/formatters.py
.py
""" Formatter classes for the progress bar. Each progress bar consists of a list of these formatters. """ from __future__ import annotations import datetime import time from abc import ABCMeta, abstractmethod from typing import TYPE_CHECKING from prompt_toolkit.formatted_text import ( HTML, AnyFormattedText,...
432
11,739
wagtail
wagtail/admin/views/reports/aging_pages.py
.py
import django_filters import swapper from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django.db.models import OuterRef, Subquery from django.utils.translation import gettext_lazy as _ from wagtail.admin.filters import ContentTypeFilter, WagtailFilterSet from wagtai...
118
4,514
coveragepy
tests/test_report_core.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """Tests for helpers in report.py""" from __future__ import annotations from typing import IO from collections.abc import Iterable import pytest from coverage...
70
2,309
openvino
tests/layer_tests/pytorch_tests/test_convnd.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from openvino.frontend import FrontEndManager from openvino.frontend.pytorch.ts_decoder import TorchScriptPythonDecoder from pytorch_layer_test_class import PytorchLayerTest class TestConv2D(PytorchLayerTest): def _pr...
221
10,386
returns
returns/interfaces/altable.py
.py
from abc import abstractmethod from collections.abc import Callable, Sequence from typing import ClassVar, Generic, Never, TypeVar, final from returns.functions import compose, identity from returns.primitives.asserts import assert_equal from returns.primitives.hkt import KindN from returns.primitives.laws import ( ...
85
2,347