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
onnxruntime
onnxruntime/test/python/transformers/test_parity_huggingface_gpt_attention.py
.py
# -------------------------------------------------------------------------- # Copyright 2020 The HuggingFace Inc. 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/l...
540
18,893
mlflow
tests/store/artifact/test_azure_blob_artifact_repo.py
.py
import base64 import json import os import posixpath from unittest import mock import pytest from azure.core.exceptions import ResourceNotFoundError from azure.storage.blob import BlobPrefix, BlobProperties, BlobServiceClient from mlflow.entities.multipart_upload import MultipartUploadPart from mlflow.exceptions impo...
608
24,396
onnxruntime
tools/ci_build/get_docker_image.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import os import shlex import shutil import sys from pathlib import Path from logger import get_logger SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) REPO_DIR = os.path.normp...
148
5,009
pyomo
pyomo/solvers/tests/models/LP_duals_maximize.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...
123
4,492
saleor
saleor/graphql/meta/tests/queries/test_product.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_CATEGORY_PUBLIC_META = """ query categoryMeta($id: ID!){ category(id: $id){ metadata{ key value ...
1,092
32,520
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/const_elimination.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools import _logger as logger from coremltools.converters.mil.mil import Builder as mb fr...
122
4,797
pyro
tests/infer/mcmc/test_hmc.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import logging import os from collections import namedtuple import pytest import torch import pyro import pyro.distributions as dist from pyro.infer.mcmc import NUTS from pyro.infer.mcmc.api import MCMC from pyro.infer.mcmc.hmc i...
363
11,825
probability
tensorflow_probability/python/mcmc/sample_halton_sequence_lib.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...
391
17,360
coremltools
deps/protobuf/python/google/protobuf/internal/service_reflection_test.py
.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
140
5,322
deap
examples/gp/symbreg_epsilon_lexicase.py
.py
# This file is part of EAP. # # EAP 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. # # EAP is distributed in ...
93
3,343
astropy
astropy/coordinates/earth.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import json import socket import urllib.error import urllib.parse import urllib.request from typing import NamedTuple import numpy as np from astropy import constants as consts from astropy import units as u from astropy.units.quantity import QuantityIn...
887
34,705
astropy
astropy/modeling/optimizers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name """ Optimization algorithms used in `~astropy.modeling.fitting`. """ import warnings from abc import ABC, abstractmethod import numpy as np from astropy.utils.exceptions import AstropyUserWarning __all__ = ["SLSQP", "Opt...
271
7,513
ipython
tools/tests/inline_figshow.py
.py
"""Manual test for figure.show() in the inline matplotlib backend. This script should be loaded for interactive use (via %load) into a qtconsole or notebook initialized with the inline backend. Expected behavior: only *one* copy of the figure is shown. For further details: https://github.com/ipython/ipython/issues/...
24
583
wagtail
wagtail/admin/rich_text/converters/db_html.py
.py
from dataclasses import dataclass from typing import Literal from bs4 import BeautifulSoup from django.utils.functional import cached_property from django.utils.html import escape from wagtail.admin.rich_text.converters.editor_html import ( DbWhitelister, EditorHTMLConverter, ) @dataclass class RichTextRemo...
135
5,141
beam
sdks/python/apache_beam/transforms/periodicsequence_it_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
90
3,219
probability
tensorflow_probability/python/experimental/tangent_spaces/symmetric_matrix.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
5,812
mlflow
tests/genai/scorers/ragas/test_ragas_scorer.py
.py
from unittest.mock import MagicMock, patch import pytest from pydantic import BaseModel from ragas.embeddings.base import BaseRagasEmbedding import mlflow from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSourceType from mlflow.exceptions import MlflowException fr...
531
17,588
saleor
saleor/tests/e2e/orders/test_order_mark_as_paid.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_pa...
103
2,968
pyomo
doc/OnlineDocs/src/kernel/examples/transformer.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...
65
1,862
saleor
saleor/graphql/payment/enums.py
.py
from typing import Final import graphene from ...payment import ( ChargeStatus, PaymentMethodType, StorePaymentMethod, TokenizedPaymentFlow, TransactionAction, TransactionEventType, TransactionKind, ) from ...payment.interface import ( PaymentGatewayInitializeTokenizationResult, Pa...
136
4,357
mlflow
dev/clint/tests/rules/test_invalid_abstract_method.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules.invalid_abstract_method import InvalidAbstractMethod def test_invalid_abstract_method(index: SymbolIndex) -> None: code = """ import abc class Abstrac...
41
1,223
astropy
astropy/units/format/fits.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "FITS" unit format. """ from typing import Literal import numpy as np from astropy.units.core import CompositeUnit, UnitBase from astropy.units.enums import DeprecatedUnitAction from astropy.units.errors import UnitScaleError from astro...
101
3,448
onnx
tests/python/node_shape_inference_test.py
.py
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) ONNX Project Contributors from __future__ import annotations import pytest import onnx.helper import onnx.shape_inference class TestNodeInference: @pytest.mark.parametrize("op_type", ["GreaterOrEqual", "LessOrEqual"]) def test_comparison_op(self, op_typ...
25
942
bazel
tools/build_defs/pkg/archive_test.py
.py
# Copyright 2015 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/LICENSE-2.0 # # Unless required by applicable la...
224
7,042
biopython
Bio/SeqIO/InsdcIO.py
.py
# Copyright 2007-2016 by Peter Cock. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.SeqIO support fo...
1,557
58,571
sqlmap
tamper/ifnull2ifisnull.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.compat import xrange from lib.core.enums import PRIORITY __priority__ = PRIORITY.HIGHEST def dependencies(): pass def tamper(payload, **kwargs): """ R...
71
2,176
onnxruntime
onnxruntime/test/python/transformers/test_gpt2_to_onnx.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 ...
63
2,357
pyomo
pyomo/util/tests/test_slices.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...
759
28,114
biopython
Tests/test_SearchIO_hmmer2_text.py
.py
# Copyright 2012 by Kai Blin. # Revisions copyright 2012 by Wibowo Arindrarto # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for SearchIO hmmer2 text module.""" import unittest from os imp...
540
23,046
loguru
tests/exceptions/source/others/one_liner_recursion.py
.py
# fmt: off from loguru import logger import sys logger.remove() logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=True, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=True) logger...
17
520
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_bmm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from save_model import saveModel import sys def paddle_bmm(x1, x2): import paddle paddle.enable_static() node_x1 = paddle.static.data(name='x1', shape=x1.shape, dtype=x1.dtype) node_x2 = paddle.stati...
43
1,475
biopython
Bio/Phylo/NeXMLIO.py
.py
# Copyright (C) 2013 by Ben Morris (ben@bendmorris.com) # Based on Bio.Nexus, copyright 2005-2008 by Frank Kauff & Cymon J. Cox # and Bio.Phylo.Newick, copyright 2009 by Eric Talevich. # All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agre...
335
10,974
wagtail
wagtail/models/copying.py
.py
from django.contrib.contenttypes.fields import GenericRelation from django.db import models from modelcluster.fields import ParentalKey, ParentalManyToManyField from modelcluster.models import ClusterableModel def _extract_field_data(source, exclude_fields=None): """ Get dictionaries representing the model's ...
114
3,909
mlflow
tests/tracing/otel/test_otel_archival.py
.py
from __future__ import annotations import json import pytest from opentelemetry.proto.trace.v1.trace_pb2 import TracesData from opentelemetry.sdk.resources import Resource as OTelResource from opentelemetry.sdk.trace import Event as OTelEvent from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from o...
223
7,622
conda
tests/env/utils.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from conda.cli.main_env_create import configure_parser as create_configure_parser from conda.cli.main_env_update import configure_parser as update_configure_parser from conda.cli.main_export import configure_parser as export_configure_parser ...
20
562
readthedocs.org
readthedocs/core/tests/test_filesystem_utils.py
.py
from pathlib import Path from tempfile import mkdtemp import pytest from django.core.exceptions import SuspiciousFileOperation from django.test import TestCase, override_settings from readthedocs.core.utils.filesystem import ( assert_path_is_inside_docroot, safe_copytree, safe_open, safe_rmtree, ) fro...
220
7,669
metrics
examples/text/rouge.py
.py
"""ROUGE =============================== The ROUGE (Recall-Oriented Understudy for Gisting Evaluation) metric used to evaluate the quality of generated text compared to a reference text. It does so by computing the overlap between two texts, for which a subsequent precision and recall value can be computed. The ROUGE ...
67
2,641
onnxruntime
onnxruntime/core/providers/coreml/mlprogram_test_scripts/div_test.py
.py
import coremltools as ct import numpy as np from coremltools.converters.mil import Builder as mb from coremltools.models import datatypes from coremltools.models.neural_network import NeuralNetworkBuilder from coremltools.models.utils import save_spec input_dim = (1,) output_dim = (1,) def mlprogram(): target = ...
104
2,868
pdm
tests/cli/test_publish.py
.py
import base64 import os from argparse import Namespace import pytest from pdm._types import RepositoryConfig from pdm.cli.commands.publish import Command as PublishCommand from pdm.cli.commands.publish.package import PackageFile from pdm.cli.commands.publish.repository import Repository from pdm.exceptions import Pdm...
294
10,262
wagtail
wagtail/contrib/redirects/tests/test_import_admin_views.py
.py
import os from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase, override_settings from django.urls import reverse from wagtail.contrib.redirects.models import Redirect from wagtail.models import Site from wagtail.test.utils import WagtailTestUtils TEST_ROOT = os.path.abspath...
377
11,925
pyomo
pyomo/core/base/global_set.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...
195
5,042
coveragepy
tests/test_parser.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 coverage.py's code parsing.""" from __future__ import annotations import ast import re import textwrap import tokenize from unittest import mock i...
1,492
45,813
onnx
onnx/defs/__init__.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations __all__ = [ "C", "ONNX_DOMAIN", "ONNX_ML_DOMAIN", "AI_ONNX_PREVIEW_DOMAIN", "AI_ONNX_PREVIEW_TRAINING_DOMAIN", "has", "register_schema", "deregister_schema", "get_sch...
159
4,569
mlflow
tests/entities/test_span_auto_extract_attachments.py
.py
import base64 from pydantic import BaseModel from mlflow.entities.span import LiveSpan from mlflow.tracing.attachments import Attachment def _make_live_span(trace_id="tr-test123"): from opentelemetry.sdk.trace import TracerProvider tracer = TracerProvider().get_tracer("test") otel_span = tracer.start_s...
660
20,840
mlflow
tests/tracing/otel/test_vercel_ai_translator.py
.py
import json from unittest import mock import pytest from mlflow.entities.span import Span from mlflow.tracing.constant import SpanAttributeKey from mlflow.tracing.otel.translation import translate_span_when_storing @pytest.mark.parametrize( ("attributes", "expected_inputs", "expected_outputs"), [ # ...
200
8,199
openvino
tests/e2e_tests/common/pytest_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Pytest utility functions.""" # pylint:disable=import-error import pytest from multiprocessing import TimeoutError from collections import namedtuple from _pytest.mark import Mark, MarkDecorator """Mark generator to specify pytest mar...
116
3,503
confluent-kafka-python
tests/schema_registry/_async/test_avro_serdes.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2024 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
3,285
104,234
astropy
astropy/constants/tests/test_sciencestate.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import subprocess import sys from textwrap import dedent import pytest import astropy.constants as const from astropy import astronomical_constants, physical_constants def test_version_match(): pversion = physical_constants.get() refpversion = ...
51
1,749
saleor
saleor/graphql/webhook/tests/test_pagination.py
.py
import pytest from ....app.models import App from ....webhook.models import Webhook @pytest.fixture def webhooks_for_pagination(db): apps = App.objects.bulk_create( [App(name="App1", is_active=True), App(name="App2", is_active=True)] ) return Webhook.objects.bulk_create( [ We...
44
1,186
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/german_credit_numeric_logistic_regression.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...
111
3,031
saleor
saleor/checkout/lock_objects.py
.py
from django.db.models import QuerySet from .models import Checkout, CheckoutLine def checkout_qs_select_for_update() -> QuerySet[Checkout]: return Checkout.objects.order_by("pk").select_for_update(of=["self"]) def checkout_lines_qs_select_for_update() -> QuerySet[CheckoutLine]: return CheckoutLine.objects....
12
366
probability
spinoffs/inference_gym/inference_gym/targets/non_identifiable_quartic.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...
117
3,898
mlflow
dev/clint/src/clint/rules/invalid_experimental_decorator.py
.py
import ast from packaging.version import InvalidVersion, Version from clint.resolver import Resolver from clint.rules.base import Rule def _is_valid_version(version: str) -> bool: try: v = Version(version) return not (v.is_devrelease or v.is_prerelease or v.is_postrelease) except InvalidVers...
54
1,614
coremltools
coremltools/optimize/torch/base_model_optimizer.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 copy as _copy import logging as _logging from abc import ABC as _ABC from abc import abstractm...
145
5,272
black
tests/data/miscellaneous/python2_detection.py
.py
# This uses a similar construction to the decorators.py test data file FYI. print "hello, world!" ### exec "print('hello, world!')" ### def set_position((x, y), value): pass ### try: pass except Exception, err: pass ### raise RuntimeError, "I feel like crashing today :p" ### `wow_these_really_did...
90
758
ipython
tools/importtime_average.py
.py
#!/usr/bin/env python3 """Average several ``python -X importtime`` runs into a single report. ``python -X importtime`` prints, to *stderr*, one line per imported module:: import time: self [us] | cumulative | imported package import time: 146 | 146 | _io import time: 846 | 1223 ...
310
11,098
saleor
saleor/account/utils.py
.py
from dataclasses import dataclass from typing import TYPE_CHECKING from django.conf import settings from django.db.models import Exists, F, OuterRef from ..app.models import App from ..checkout import AddressType from ..core.tracing import traced_atomic_transaction from ..core.utils.events import call_event from ..pe...
207
6,830
cvxpy
cvxpy/utilities/perspective_utils.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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
61
2,293
pyomo
pyomo/core/expr/calculus/diff_with_pyomo.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...
482
13,320
mkdocs-material
material/plugins/tags/config.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...
89
3,859
mlflow
tests/pyfunc/test_pyfunc_exceptions.py
.py
import pytest import mlflow from mlflow.exceptions import MlflowException class UnpicklableModel(mlflow.pyfunc.PythonModel): def __init__(self, path): with open(path, "w+") as f: pass self.not_a_file = f def test_pyfunc_unpicklable_exception(tmp_path): model = UnpicklableModel(...
23
579
sphinx
sphinx/theming.py
.py
"""Theming support for HTML builders.""" from __future__ import annotations __all__ = ('Theme', 'HTMLThemeFactory') import configparser import contextlib import shutil import sys import tempfile import tomllib import warnings from importlib.metadata import entry_points from pathlib import Path from typing import TYP...
580
20,794
httpie
tests/test_output.py
.py
import argparse from pathlib import Path from unittest import mock import json import os import io import warnings from urllib.request import urlopen import pytest import requests import responses from httpie.cli.argtypes import ( PARSED_DEFAULT_FORMAT_OPTIONS, parse_format_options, ) from httpie.cli.definit...
632
20,742
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/map_multiple_arguments.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");...
63
1,848
sqlmap
plugins/dbms/maxdb/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
677
coremltools
coremltools/converters/mil/mil/ops/tests/iOS17/test_recurrent.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest from coremltools._deps import _HAS_TORCH, MSG_TOR...
326
8,057
wandb
wandb/apis/_generated/get_team_entity.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/api/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLId, GQLResult class GetTeamEntity(GQLResult): entity: GetTeamEntityEntity | None class GetTeamEntityEntity(GQLResult): id: GQLId name: str ...
46
1,327
saleor
saleor/order/base_calculations.py
.py
from collections.abc import Iterable from typing import TYPE_CHECKING, cast from django.conf import settings from prices import Money, TaxedMoney from ..core.prices import quantize_price from ..core.taxes import zero_money from ..discount import DiscountType, DiscountValueType from ..discount.models import OrderDisco...
366
13,737
coveragepy
tests/test_lcov.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 """Test LCOV-based summary reporting for coverage.py.""" from __future__ import annotations import math import os import textwrap import pytest import coverag...
765
22,386
mlflow
mlflow/pyspark/ml/_autolog.py
.py
import re from functools import reduce try: # For spark >= 4.0 from pyspark.errors.exceptions.base import IllegalArgumentException except ModuleNotFoundError: from pyspark.sql.utils import IllegalArgumentException from pyspark.ml.base import Transformer from pyspark.ml.functions import vector_to_array from...
97
3,068
pymc
pymc/backends/__init__.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...
219
7,073
readthedocs.org
readthedocs/api/v3/tests/test_users.py
.py
from django.contrib.contenttypes.models import ContentType from django.test import override_settings from django.urls import reverse from django.urls.exceptions import NoReverseMatch from readthedocs.notifications.models import Notification from readthedocs.subscriptions.constants import TYPE_CONCURRENT_BUILDS from re...
164
5,462
openvino
tests/layer_tests/onnx_tests/test_xor.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...
274
9,860
onnxruntime
onnxruntime/python/tools/microbench/nhwcConv.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import argparse from dataclasses import dataclass import numpy as np fr...
63
2,065
gunicorn
tests/test_early_hints.py
.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for HTTP 103 Early Hints support (RFC 8297).""" import pytest from unittest import mock from io import BytesIO # Check if h2 is available for HTTP/2 tests try: import h2.connect...
472
15,952
python-prompt-toolkit
src/prompt_toolkit/eventloop/async_generator.py
.py
""" Implementation for async generators. """ from __future__ import annotations from asyncio import get_running_loop from collections.abc import AsyncGenerator, Callable, Iterable from contextlib import asynccontextmanager from queue import Empty, Full, Queue from typing import Any, TypeVar from .utils import run_in...
127
3,960
onnxruntime
onnxruntime/python/tools/transformers/onnx_model_phi.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger import numpy as np from dynamo_onnx_help...
930
35,410
onnx
onnx/backend/test/case/node/reciprocal.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 class Reciprocal(Base): @staticmethod def export() -> None: ...
29
790
pyomo
pyomo/opt/tests/base/test_soln.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...
647
18,905
saleor
saleor/shipping/webhooks/shared.py
.py
import logging from collections import defaultdict from typing import TYPE_CHECKING, Any, Union from django.conf import settings from django.db.models import QuerySet from promise import Promise from pydantic import ValidationError from ...webhook.models import Webhook from ...webhook.response_schemas.shipping import...
184
6,953
onnxruntime
orttraining/orttraining/test/python/launch_test.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import logging import os # noqa: F401 import sys from _test_commons import run_subprocess logging.basicConfig(format="%(asctime)s %(name)s [%(levelname)s] - %(message)s", level=loggin...
40
1,255
sqlmap
tamper/xforwardedfor.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import random from lib.core.compat import xrange from lib.core.enums import PRIORITY __priority__ = PRIORITY.NORMAL def dependencies(): pass def randomIP(): octets = [...
45
1,284
saleor
saleor/plugins/webhook/tests/test_payment_gateway_initialize_tokenization.py
.py
import json from unittest import mock import graphene import pytest from ....core.models import EventDelivery from ....payment.interface import ( PaymentGatewayInitializeTokenizationRequestData, PaymentGatewayInitializeTokenizationResponseData, PaymentGatewayInitializeTokenizationResult, ) from ....settin...
254
8,131
wagtail
wagtail/admin/urls/reports.py
.py
from django.urls import path from wagtail.admin.views.reports.aging_pages import AgingPagesView from wagtail.admin.views.reports.audit_logging import LogEntriesView from wagtail.admin.views.reports.locked_pages import LockedPagesView from wagtail.admin.views.reports.page_types_usage import ( PageTypesUsageReportVi...
54
1,780
metrics
src/torchmetrics/utilities/data.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...
267
9,071
mlflow
dev/flavors/src/flavors/_update.py
.py
""" Update the maximum package versions in `mlflow/ml-package-versions.yml`. # Usage ``` flavors update flavors update --skip-yml ``` """ from __future__ import annotations import argparse import asyncio import json import os import re import urllib.error import urllib.request from dataclasses import dataclass from...
304
10,713
httpie
httpie/plugins/manager.py
.py
import sys import os import warnings from itertools import groupby from operator import attrgetter from typing import Dict, List, Type, Iterator, Iterable, Optional, ContextManager from pathlib import Path from contextlib import contextmanager, nullcontext from ..compat import importlib_metadata, find_entry_points, g...
122
4,049
beam
sdks/python/apache_beam/yaml/main_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
240
7,193
textual
docs/examples/app/widgets01.py
.py
from textual.app import App, ComposeResult from textual.widgets import Welcome class WelcomeApp(App): def compose(self) -> ComposeResult: yield Welcome() def on_button_pressed(self) -> None: self.exit() if __name__ == "__main__": app = WelcomeApp() app.run()
16
296
readthedocs.org
readthedocs/core/db.py
.py
""" Custom database routers. https://docs.djangoproject.com/en/4.0/topics/db/multi-db/#automatic-database-routing """ from collections import defaultdict class MapAppsRouter: """ Router to map Django applications to a specific database. :py:attr:`apps_to_db` is used to map an application to a database,...
33
1,011
wandb
wandb/proto/v6/wandb_api_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: wandb/proto/wandb_api.proto # Protobuf Python Version: 6.30.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_p...
167
21,566
sphinx
sphinx/directives/patches.py
.py
from __future__ import annotations import os from pathlib import Path from typing import TYPE_CHECKING, cast from docutils import nodes from docutils.nodes import make_id from docutils.parsers.rst import directives from docutils.parsers.rst.directives import images, tables from docutils.parsers.rst.directives.misc im...
241
8,260
jupytext
tests/data/notebooks/inputs/python/light_sample.py
.py
# --- # jupyter: # jupytext: # formats: ipynb,py:light # --- # # Sample notebook a = 1 b = 2 a + b
12
107
mlflow
mlflow/store/artifact/databricks_sdk_models_artifact_repo.py
.py
import logging import posixpath from mlflow.entities import FileInfo from mlflow.environment_variables import ( MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE, ) from mlflow.store.artifact.cloud_artifact_repo import CloudArtifactRepository _logger = logging.getLogger(__name__) def _get_databricks_workspace_client(registr...
125
4,598
pyomo
pyomo/contrib/cspline_external/plugins.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...
16
780
pyro
pyro/distributions/torch_transform.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch class TransformModule(torch.distributions.Transform, torch.nn.Module): """ Transforms with learnable parameters such as normalizing flows should inherit from this class rather than `Transform` so they are...
41
1,452
pyfilesystem2
tests/test_encoding.py
.py
from __future__ import unicode_literals import os import platform import shutil import six import tempfile import unittest import fs from fs.osfs import OSFS if platform.system() != "Windows": @unittest.skipIf(platform.system() == "Darwin", "Bad unicode not possible on OSX") class TestEncoding(unittest.Test...
58
2,151
mlflow
examples/flower_classifier/score_images_rest.py
.py
""" Example of scoring images with MLflow model deployed to a REST API endpoint. The MLflow model to be scored is expected to be an instance of KerasImageClassifierPyfunc (e.g. produced by running this project) and deployed with MLflow prior to invoking this script. """ import base64 import os import click import pa...
72
1,922
jupyterlab
jupyterlab/tests/test_build_api.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Test the kernels service API.""" import asyncio import json import os from tempfile import TemporaryDirectory import pytest import tornado def expected_http_error(error, expected_code, expected_message=None): ...
120
3,605
python-prompt-toolkit
src/prompt_toolkit/key_binding/emacs_state.py
.py
from __future__ import annotations from .key_processor import KeyPress __all__ = [ "EmacsState", ] class EmacsState: """ Mutable class to hold Emacs specific state. """ def __init__(self) -> None: # Simple macro recording. (Like Readline does.) # (For Emacs mode.) self.m...
37
884