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
saleor
saleor/graphql/product/bulk_mutations/product_type_bulk_delete.py
.py
import graphene from django.conf import settings from django.core.exceptions import ValidationError from django.db.models import Q from django.db.models.expressions import Exists, OuterRef from ....attribute import AttributeInputType from ....attribute import models as attribute_models from ....core.tracing import tra...
81
3,196
saleor
saleor/graphql/meta/tests/mutations/test_warehouse.py
.py
import graphene from . import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE from .test_delete_metadata import ( execute_clear_public_metadata_for_item, item_without_public_metadata, ) from .test_delete_private_metadata import ( execute_clear_private_metadata_for_item, item_without_private_metada...
92
2,802
saleor
saleor/attribute/models/base.py
.py
from typing import TYPE_CHECKING, TypeVar, Union from django.contrib.postgres.indexes import BTreeIndex, GinIndex from django.db import models, transaction from django.db.models import Case, Exists, F, OrderBy, OuterRef, Q, Value, When from ...account.models import CustomerType from ...core.db.fields import Sanitized...
583
21,778
onnx
onnx/reference/ops/op_sequence_length.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 SequenceLength(OpRun): def _run(self, input_sequence): if not isinstance(input_sequence, list): raise TypeError...
18
477
gunicorn
tests/requests/valid/002.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "GET", "uri": uri("/test"), "version": (1, 1), "headers": [ ("USER-AGENT", "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1"), ...
16
402
jupytext
src/jupytext/languages.py
.py
"""Determine notebook or cell language""" import re # Jupyter magic commands that are also languages _JUPYTER_LANGUAGES = [ "R", "bash", "sh", "python", "python2", "python3", "coconut", "javascript", "js", "perl", "html", "latex", "markdown", "pypy", "ruby",...
228
8,149
biopython
Bio/SwissProt/__init__.py
.py
# Copyright 2007 by Michiel de Hoon. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Code to work with the sprotXX.dat file from SwissProt. https://web.expasy.org/docs/userma...
850
32,910
coveragepy
coverage/data.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 """Coverage data for coverage.py. This file had the 4.x JSON data support, which is now gone. This file still has storage-agnostic helpers, and is kept to avoid...
269
9,524
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/map_side_inputs_iter.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");...
65
1,928
onnxruntime
onnxruntime/python/tools/transformers/models/gpt2/parity_check_helper.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # This s...
147
5,694
biopython
Tests/test_Blast_Record.py
.py
# 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. """Test for Blast records.""" import unittest from Bio.Blast.NCBIXML import HSP class TestHsp(unittest.TestCase): def test_str(self): #...
39
1,063
probability
tensorflow_probability/python/mcmc/sample_halton_sequence_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...
253
10,567
pyomo
pyomo/contrib/parmest/examples/rooney_biegler/likelihood_ratio_example.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
65
2,103
saleor
saleor/plugins/sendgrid/tests/test_plugin.py
.py
import json from dataclasses import asdict from unittest.mock import MagicMock, patch import pytest from django.core.exceptions import ValidationError from ....account.notifications import get_user_custom_payload from ....core.notify import AdminNotifyEvent, UserNotifyEvent from ....webhook.payloads import generate_p...
186
6,149
mlflow
tests/langchain/test_langchain_tracer.py
.py
import random import time import uuid from concurrent.futures import ThreadPoolExecutor from typing import Any from unittest.mock import MagicMock import pydantic import pytest from langchain_community.document_loaders import TextLoader from langchain_community.embeddings import FakeEmbeddings from langchain_community...
843
29,085
pyro
pyro/distributions/extended.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import math from pyro.distributions import constraints from .conjugate import BetaBinomial from .torch import Binomial class ExtendedBinomial(Binomial): """ EXPERIMENTAL :class:`~pyro.distributions.Binomial` distribution ex...
64
1,885
omegaconf
omegaconf/base.py
.py
import copy import sys from abc import ABC, abstractmethod from collections import defaultdict from dataclasses import dataclass, field from enum import Enum from typing import ( Any, Dict, Iterator, List, NoReturn, Optional, Set, Tuple, Type, Union, ) from ._utils import ( ...
1,275
45,294
kafka
tests/kafkatest/tests/client/share_consumer_test.py
.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
331
15,972
saleor
saleor/graphql/app/types.py
.py
import base64 import datetime import graphene from graphql import GraphQLError from ...app import models from ...app.types import ( DEFAULT_APP_TARGET, DeprecatedAppExtensionHttpMethod, ) from ...core.exceptions import PermissionDenied from ...core.jwt import JWT_THIRDPARTY_ACCESS_TYPE from ...core.utils impo...
861
29,523
qutip
qutip/tests/core/test_tensor.py
.py
import numpy as np from numpy.testing import assert_equal, assert_ import pytest import functools import itertools import qutip from qutip import ( Qobj, identity, sigmax, to_super, to_choi, rand_super_bcsz, basis, tensor_contract, tensor_swap, num, QobjEvo, destroy, tensor, expand_operator, enr_fock ) d...
279
10,738
wandb
wandb/integration/tensorboard/monkeypatch.py
.py
"""monkeypatch: patch code to add tensorboard hooks.""" from __future__ import annotations import os import re import socket from typing import Any import wandb import wandb.util TENSORBOARD_C_MODULE = "tensorflow.python.ops.gen_summary_ops" TENSORBOARD_X_MODULE = "tensorboardX.writer" TENSORFLOW_PY_MODULE = "tenso...
189
6,906
beam
sdks/python/apache_beam/runners/job/utils.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...
40
1,331
astropy
astropy/coordinates/angles/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains utility functions for working with angles. These are both used internally in ``astropy.coordinates.angles``, and of possible use externally. """ __all__ = [ "angular_separation", "golden_spiral_grid", "offset_by", ...
231
7,679
openvino
tools/ovc/unit_tests/moc_tf_fe/utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import numpy as np from openvino import Core from openvino.tools.ovc.convert import convert_model def basic_check(input_model, argv_input, input_data, expected_dtype, expected_value, \ only_conversion=False, input_model...
37
1,277
python-prompt-toolkit
src/prompt_toolkit/layout/dimension.py
.py
""" Layout dimensions are used to give the minimum, maximum and preferred dimensions for containers and controls. """ from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING __all__ = [ "Dimension", "D", "sum_layout_dimensions", "max_layout_dimensions"...
212
6,804
pyomo
examples/pyomobook/pyomo-components-ch/param_declaration.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...
28
940
probability
tensorflow_probability/python/bijectors/square_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...
57
2,110
beam
sdks/python/apache_beam/ml/anomaly/univariate/mad_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...
52
1,630
cvxpy
cvxpy/atoms/tr_inv.py
.py
""" Copyright 2022, 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, soft...
125
3,866
beam
sdks/python/apache_beam/runners/runner_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...
86
3,123
astropy
astropy/cosmology/_src/io/builtin/row.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """|Cosmology| <-> |Row| I/O, using |Cosmology.to_format| and |Cosmology.from_format|. A `~astropy.cosmology.Cosmology` as a `~astropy.table.Row` will have the cosmology's name and parameters as columns. >>> from astropy.cosmology import Planck18 ...
284
12,086
mlflow
examples/sklearn_elasticnet_wine/train.py
.py
# The data set used in this example is from http://archive.ics.uci.edu/ml/datasets/Wine+Quality # P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis. # Modeling wine preferences by data mining from physicochemical properties. In Decision Support Systems, Elsevier, 47(4):547-553, 2009. import logging import sys i...
93
3,286
tablib
src/tablib/formats/_yaml.py
.py
""" Tablib - YAML Support. """ __lazy_modules__ = {"yaml"} import yaml import tablib class YAMLFormat: title = 'yaml' extensions = ('yaml', 'yml') @classmethod def export_set(cls, dataset): """Returns YAML representation of Dataset.""" return yaml.safe_dump( dataset._pa...
66
1,649
kafka
tests/kafkatest/tests/streams/streams_broker_bounce_test.py
.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
293
12,798
sqlmap
plugins/dbms/spanner/__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 SPANNER_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.spanner.enumeration import Enumeration...
31
919
onnxruntime
onnxruntime/test/python/transformers/rotary_flash.py
.py
# Copyright (c) 2023, Tri Dao. import torch import triton import triton.language as tl from einops import rearrange, repeat ##### TRITON KERNEL FOR ROTARY ##### # @triton.autotune( # configs=[ # triton.Config({"block_m": 2}), # triton.Config({"block_m": 4}), # triton.Config({"block_m": ...
689
27,375
pymc
tests/backends/test_zarr.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...
554
21,038
conda
conda/cli/main_env_update.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI implementation for `conda-env update`. Updates the conda environments with the specified packages. """ import os from argparse import ( ArgumentParser, Namespace, _SubParsersAction, ) from ..notices import notices def con...
174
5,397
wagtail
wagtail/tests/test_rich_text.py
.py
from unittest.mock import patch from django.forms.models import modelform_factory from django.test import TestCase, override_settings from django.utils import translation from wagtail.fields import RichTextField from wagtail.models import Locale, Site from wagtail.rich_text import ( RichText, RichTextMaxLengt...
453
18,326
scikit-bio
skbio/util/tests/test_random.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. # --------------------------------------------...
97
3,289
python-dotenv
src/dotenv/main.py
.py
import io import logging import os import pathlib import stat import sys import tempfile from collections import OrderedDict from contextlib import contextmanager from typing import IO, Dict, Iterable, Iterator, Mapping, Optional, Tuple, Union from .parser import Binding, parse_stream from .variables import parse_vari...
483
14,866
mlflow
dev/flavors/src/flavors/_cli.py
.py
from __future__ import annotations import argparse import asyncio from flavors import _matrix, _update def main() -> None: parser = argparse.ArgumentParser( prog="flavors", description="CLI for cooking mlflow/ml-package-versions.yml.", ) subparsers = parser.add_subparsers(dest="command",...
40
1,092
wandb
tests/unit_tests/test_weave_integration.py
.py
from unittest import mock import pytest import wandb.integration.weave from wandb.sdk import wandb_setup @pytest.fixture def mock_singleton(monkeypatch): m = mock.Mock() monkeypatch.setattr(wandb_setup, "singleton", lambda: m) return m def test_active_run_path__returns_path(mock_singleton): mock_si...
61
1,392
pynacl
tests/test_hash.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...
107
3,330
textual
tests/select/test_prompt.py
.py
from rich.text import Text from textual.app import App from textual.widgets import Select, Static from textual.widgets._select import SelectCurrent, SelectOverlay async def test_reactive_prompt_change(): """Regression test for https://github.com/Textualize/textual/issues/2983""" class SelectApp(App): ...
55
1,962
pyomo
pyomo/contrib/solver/__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...
45
1,437
saleor
saleor/graphql/csv/tests/queries/test_export_file.py
.py
import graphene from .....core import JobStatus from .....csv import ExportEvents from ....tests.utils import get_graphql_content, get_graphql_content_from_response EXPORT_FILE_QUERY = """ query($id: ID!){ exportFile(id: $id){ id status createdAt updatedAt ...
320
9,059
beam
sdks/python/apache_beam/examples/inference/runinference_metrics/config.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,261
scikit-bio
skbio/stats/ordination/tests/test_principal_coordinate_analysis.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. # --------------------------------------------...
536
23,065
mlflow
tests/spark/autologging/datasource/test_autologging_behavior_without_spark_session.py
.py
import mlflow def test_enabling_autologging_does_not_throw_when_spark_hasnt_been_started(): from pyspark.sql import SparkSession assert SparkSession.getActiveSession() is None mlflow.spark.autolog(disable=True)
10
227
mlflow
tests/resources/mlflow-test-plugin/mlflow_test_plugin/fake_deployment_plugin.py
.py
import os from mlflow.deployments import BaseDeploymentClient, PredictionsResponse f_deployment_name = "fake_deployment_name" f_endpoint_name = "fake_endpoint_name" class PluginDeploymentClient(BaseDeploymentClient): def create_deployment(self, name, model_uri, flavor=None, config=None, endpoint=None): ...
64
2,115
clearml
clearml/backend_api/session/jsonmodels/__init__.py
.py
# coding: utf-8 __author__ = "Szczepan Cieślik" __email__ = "szczepan.cieslik@gmail.com" __version__ = "2.4" from . import models from . import fields from . import errors __all__ = ["models", "fields", "errors"]
12
217
mlflow
mlflow/tracing/processor/base_mlflow.py
.py
import json import logging import threading import weakref from typing import Any from opentelemetry.context import Context from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from opentelemetry.sdk.trace import Span as OTelSpan from opentelemetry.sdk.trace.export import ( BatchSpanProcessor, ...
393
17,862
wagtail
wagtail/tests/streamfield_migrations/test_bad_data.py
.py
import datetime from django.test import TestCase from django.utils import timezone from wagtail.blocks import StreamValue from wagtail.blocks.migrations import migrate_operation from wagtail.blocks.migrations.operations import ( RenameStreamChildrenOperation, RenameStructChildrenOperation, ) from wagtail.bloc...
266
9,435
gunicorn
gunicorn/asgi/lifespan.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ ASGI lifespan protocol manager. Manages startup and shutdown events for ASGI applications, enabling frameworks like FastAPI to run initialization and cleanup code. """ import asyncio class LifespanManager: ...
179
6,275
cvxpy
cvxpy/reductions/solvers/openmp_conflict.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 ...
71
2,812
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineglobally_function.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");...
66
2,219
mlflow
tests/tracing/utils/test_truncation.py
.py
import json from unittest.mock import patch import pytest from mlflow.entities.trace_data import TraceData from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow.entities.trace_state import TraceState from mlflow.tracing.utils.truncation import _get_trunc...
233
7,103
wagtail
wagtail/admin/tests/pages/test_create_page.py
.py
import datetime import unittest from unittest import mock import swapper from django.contrib.auth.models import Group, Permission from django.http import HttpRequest, HttpResponse, JsonResponse from django.test import TestCase from django.test.utils import override_settings from django.urls import reverse from django....
3,252
117,358
black
src/blib2to3/pytree.py
.py
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """ Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. """ # mypy:...
1,074
37,184
mlflow
mlflow/langchain/_compat.py
.py
def import_base_retriever(): try: from langchain.schema import BaseRetriever return BaseRetriever except ImportError: from langchain_core.retrievers import BaseRetriever return BaseRetriever def import_document(): try: from langchain.schema import Document ...
223
5,073
wagtail
wagtail/snippets/tests/test_history_view.py
.py
import datetime from django.contrib.admin.utils import quote from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.test.utils import override_settings from django.urls import reverse from django.utils.timezone import make_aware from wagtail.log_actions import LogConte...
301
12,537
beam
sdks/python/apache_beam/ml/anomaly/transforms.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...
655
24,688
onnxruntime
orttraining/orttraining/test/python/orttraining_test_ort_apis_onnxblock.py
.py
import copy import io import os import random import tempfile import numpy as np import onnx import pytest import torch import onnxruntime import onnxruntime.training.onnxblock as onnxblock from onnxruntime.capi import _pybind_state as C from onnxruntime.training import artifacts # PyTorch Module definitions def g...
1,247
46,331
openvino
tests/layer_tests/onnx_tests/test_dequantize_linear.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...
224
10,097
onnxruntime
onnxruntime/python/tools/transformers/models/sam2/sam2_utils.py
.py
# ------------------------------------------------------------------------- # Copyright (R) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging import os import sys from collections.abc import Mapping ...
148
5,520
pyomo
pyomo/contrib/mindtpy/MindtPy.py
.py
# -*- coding: utf-8 -*- # ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and E...
131
4,317
probability
tensorflow_probability/examples/statistical_rethinking/rethinking/__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...
17
835
onnxruntime
onnxruntime/test/testdata/transform/fusion/create_conv_with_padding_relu.py
.py
import onnx from onnx import TensorProto, helper # copied and adapted from here: # https://github.com/onnx/onnx/blob/c940fa3fea84948e46603cab2f86467291443beb/docs/Operators.md?plain=1#L3494-L3502 graph = helper.make_graph( [ # nodes # Convolution with padding helper.make_node("Conv", ["x", "W"], ...
25
833
saleor
saleor/graphql/order/mutations/fulfillment_refund_products.py
.py
from typing import Any import graphene from ....order import FulfillmentStatus from ....order import models as order_models from ....order.actions import create_refund_fulfillment from ....payment import PaymentError from ....permission.enums import OrderPermissions from ...app.dataloaders import get_app_promise from...
168
5,852
hydra
tests/test_apps/app_with_split_cfg/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra @hydra.main(config_name="config") def my_app(_: DictConfig) -> None: pass if __name__ == "__main__": my_app()
14
240
conda
conda/auxlib/entity.py
.py
""" This module provides serializable, validatable, type-enforcing domain objects and data transfer objects. It has many of the same motivations as the python `Marshmallow <http://marshmallow.readthedocs.org/en/latest/why.html>`_ package. It is most similar to `Schematics <http://schematics.readthedocs.io/>`_. =======...
983
33,626
astropy
astropy/utils/introspection.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Functions related to Python runtime introspection.""" import inspect import os import sys from importlib import import_module, metadata from importlib.metadata import packages_distributions from importlib.util import find_spec from operator import ge, ...
407
14,223
saleor
saleor/graphql/account/mutations/account/account_delete.py
.py
from typing import cast import graphene from django.core.exceptions import ValidationError from .....account import models from .....account.error_codes import AccountErrorCode from .....attribute.utils import delete_user_unique_attribute_values from .....core.tokens import ( account_delete_token_generator, l...
106
3,724
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_exceed_voucher_usage_limit.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
200
6,298
saleor
saleor/graphql/giftcard/bulk_mutations/gift_card_bulk_create.py
.py
from collections.abc import Iterable import graphene from django.core.exceptions import ValidationError from django.db import transaction from ....core.tracing import traced_atomic_transaction from ....core.utils.promo_code import generate_promo_code from ....core.utils.validators import is_date_in_future from ....gi...
180
6,621
mlflow
tests/spark/autologging/ml/test_pyspark_ml_autologging.py
.py
import importlib import json import math import pathlib from typing import Any, NamedTuple from unittest import mock import numpy as np import pandas as pd import pyspark import pytest import yaml from packaging.version import Version from pyspark.ml import Pipeline from pyspark.ml.classification import ( LinearSV...
1,351
52,120
onnxruntime
onnxruntime/python/tools/transformers/fusion_mha_dit.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger import numpy as np from fusion_base impor...
534
24,130
readthedocs.org
readthedocs/oauth/validators.py
.py
"""Validators for the OAuth app.""" import re from django.core.validators import URLValidator from django.utils.deconstruct import deconstructible # Pattern for ``git@github.com:user/repo`` SSH format used by GitHub, GitLab, and Bitbucket _RE_GIT_USER_SSH = re.compile(r"^[\w.+-]+@[^:]+:[^/][^:]*$") @deconstructib...
48
1,319
beam
sdks/python/apache_beam/testing/benchmarks/chicago_taxi/trainer/task.py
.py
# Copyright 2019 Google LLC. 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
183
5,362
mlflow
mlflow/dspy/__init__.py
.py
from mlflow.dspy.autolog import autolog from mlflow.version import IS_TRACING_SDK_ONLY __all__ = ["autolog"] # Import model logging APIs only if mlflow skinny or full package is installed, # i.e., skip if only mlflow-tracing package is installed. if not IS_TRACING_SDK_ONLY: from mlflow.dspy.load import _load_pyfu...
18
503
mlflow
dev/clint/tests/rules/test_no_rst.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.no_rst import NoRst def test_no_rst(index: SymbolIndex) -> None: code = """ def bad(y: int) -> str: ''' :param y: The parameter :returns: ...
32
711
onnxruntime
onnxruntime/test/testdata/test_shape_data_propagation_gather_squeeze_range.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # Lock fixture for the Shape -> Gather(1-D index) -> Squeeze -> Range chain. # # The Gather index is the 1-D constant [-1] (rank 1), so the Gather output is a # rank-1, single-element int64 value (the last dimension of X, 200...
60
2,821
jupytext
tests/functional/simple_notebooks/test_read_simple_groovy.py
.py
import jupytext from jupytext.compare import compare def test_read_simple_file( script="""// --- // title: Simple file // --- // Here we have some text // And below we have some code println("Hello World") """, ): nb = jupytext.reads(script, "groovy") assert len(nb.cells) == 3 assert nb.cells[0].cel...
27
713
returns
tests/test_contrib/test_hypothesis/test_laws/test_custom_type_applicative.py
.py
from collections.abc import Callable from typing import TypeVar from returns.contrib.hypothesis.laws import check_all_laws from returns.interfaces import applicative from returns.primitives.container import BaseContainer from returns.primitives.hkt import Kind1, SupportsKind1 _ValueType = TypeVar('_ValueType') _NewVa...
45
1,220
metrics
src/torchmetrics/functional/detection/iou.py
.py
# Copyright The PyTorch 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 i...
129
4,833
wandb
tests/system_tests/test_system_metrics/test_system_monitor.py
.py
import time import wandb def test_run_system_metrics(wandb_backend_spy): with wandb.init( settings=wandb.Settings( x_file_stream_transmit_interval=1, x_stats_sampling_interval=0.1, x_stats_buffer_size=100, ) ) as run: # Wait for the first metrics to...
50
1,750
metrics
src/torchmetrics/text/wil.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...
139
5,359
pyomo
pyomo/neos/tests/test_neos.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...
429
13,333
mlflow
tests/utils/test_credentials.py
.py
from unittest import mock from unittest.mock import patch import pytest from mlflow import get_tracking_uri from mlflow.environment_variables import MLFLOW_TRACKING_PASSWORD, MLFLOW_TRACKING_USERNAME from mlflow.exceptions import MlflowException from mlflow.utils.credentials import login, read_mlflow_creds def test...
151
4,918
mlflow
tests/smolagents/test_smolagents_autolog.py
.py
from types import SimpleNamespace from unittest.mock import patch import pytest import smolagents from packaging.version import Version import mlflow from mlflow.entities.span import SpanType from mlflow.tracing.constant import SpanAttributeKey from tests.tracing.helper import get_traces _DUMMY_INPUT = "Explain qua...
257
8,801
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/pnorm_canon.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
145
4,655
saleor
saleor/warehouse/tests/test_channel_stock_availability.py
.py
from .. import WarehouseClickAndCollectOption from ..channel_stock_availability import ( trigger_back_in_stock_in_channel_events_for_stocks, trigger_out_of_stock_in_channel_events_for_stocks, ) from ..interface import VariantChannelStockInfo from ..models import Allocation, Stock, Warehouse OUT_IN_CHANNEL = ( ...
1,051
37,462
onnxruntime
onnxruntime/test/testdata/icm-31000000518483.py
.py
from onnx import TensorProto, helper, save_model # Add node with a subgraph that has no inputs or outputs. # Graph::BuildConnections should remove and the list of subgraphs in Graph::Resolve should be updated. # Other details here don't matter. Copied from ort_github_issue_10305.py if_body = helper.make_graph( [ ...
54
1,613
astropy
astropy/cosmology/_src/tests/parameter/conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Configure the tests for :mod:`astropy._src.cosmology.parameter`.""" from astropy.cosmology._src.tests.helper import clean_registry # noqa: F401 from astropy.tests.helper import pickle_protocol # noqa: F401
7
277
ipython
IPython/terminal/shortcuts/auto_suggest.py
.py
import re import asyncio import tokenize from io import StringIO from typing import ClassVar, Any from collections.abc import Callable, Generator import warnings import prompt_toolkit from prompt_toolkit.buffer import Buffer from prompt_toolkit.key_binding import KeyPressEvent from prompt_toolkit.key_binding.bindings ...
663
23,945
astropy
astropy/wcs/tests/helper.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.io import fits class SimModelTAB: def __init__( self, nx=150, ny=200, crpix=[1, 1], crval=[1, 1], cdelt=[1, 1], pc={"PC1_1": 1, "PC2_2": 1}, ): # set...
117
3,787
readthedocs.org
readthedocs/invitations/models.py
.py
"""Invitation models.""" import structlog from django.conf import settings from django.contrib.auth.models import User from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.urls import reverse from django.uti...
244
7,257
astropy
astropy/cosmology/_src/io/builtin/latex.py
.py
r"""|Cosmology| <-> LaTeX I/O, using |Cosmology.read| and |Cosmology.write|. We assume the following setup: >>> from pathlib import Path >>> from tempfile import TemporaryDirectory >>> temp_dir = TemporaryDirectory() Writing a cosmology to a LaTeX file will produce a table with the cosmology's type, name...
215
7,357
cvxpy
cvxpy/tests/test_suppfunc.py
.py
""" Copyright 2019, the cvxpy 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 law or agreed to in writing, ...
257
9,984