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/webhook/observability/sensitive_data.py
.py
"""Definitions of sensitive data for observability obfuscation methods. ALLOWED_HEADERS is a set of lowercase HTTP headers allowed for reporting. SENSITIVE_HEADERS is a set of lowercase HTTP headers to anonymize before reporting. SENSITIVE_GQL_FIELDS is a dict of sets representing fields of GraphGL types to anonymiz...
65
1,643
beam
sdks/python/apache_beam/examples/dataframe/taxiride_test.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 "L...
133
5,525
coremltools
deps/pybind11/tests/test_stl_binders.py
.py
from __future__ import annotations import pytest from pybind11_tests import stl_binders as m def test_vector_int(): v_int = m.VectorInt([0, 0]) assert len(v_int) == 2 assert bool(v_int) is True # test construction from a generator v_int1 = m.VectorInt(x for x in range(5)) assert v_int1 == m...
396
11,079
onnx
onnx/reference/ops/op_reduce_mean.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunReduceNumpy class ReduceMean_1(OpRunReduceNumpy): def _run(self, data, axes=None, keepdims=None): axes = tuple(axes) if axes is n...
36
1,283
beam
sdks/python/apache_beam/io/gcp/dicomclient.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,102
pyomo
pyomo/opt/results/problem.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...
37
1,519
clearml
clearml/backend_interface/metrics/events.py
.py
from abc import ABC, abstractmethod import time from functools import reduce from logging import getLevelName from typing import Optional, List, Dict, Union, Tuple, Any import io import attr import numpy as np import pathlib2 import six from PIL import Image from six.moves.urllib.parse import urlparse, urlunparse fro...
511
19,514
pyro
pyro/infer/mcmc/api.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ This module offers a modified interface for MCMC inference with the following objectives: - making MCMC independent of Pyro specific trace data structure, to facilitate integration with other PyTorch based libraries. - ...
796
29,289
probability
tensorflow_probability/examples/statistical_rethinking/rethinking/quap.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...
120
4,540
biopython
Tests/test_KEGG.py
.py
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved. # Revisions copyright 2007 by Michiel de Hoon. All rights reserved. # Revisions copyright 2017 by Peter Cock. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have be...
208
8,233
readthedocs.org
readthedocs/rtd_tests/tests/test_version_slug.py
.py
import re from django.test import TestCase from readthedocs.builds.models import Version from readthedocs.builds.version_slug import VERSION_SLUG_REGEX, _uniquifying_suffix from readthedocs.projects.models import Project class VersionSlugPatternTests(TestCase): pattern = re.compile("^{pattern}$".format(pattern=...
118
3,602
probability
tensorflow_probability/python/experimental/bayesopt/acquisition/probability_of_improvement_test.py
.py
# Copyright 2023 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
119
4,686
saleor
saleor/graphql/checkout/mutations/checkout_shipping_method_update.py
.py
from typing import Union import graphene from django.core.exceptions import ValidationError from ....account.models import User from ....app.models import App from ....checkout.delivery_context import ( assign_delivery_method_to_checkout, get_or_fetch_checkout_deliveries, is_shipping_required, ) from .......
200
6,801
beam
sdks/python/apache_beam/testing/analyzers/constants.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...
77
2,707
openvino
tests/layer_tests/pytorch_tests/test_group_norm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestGroupNorm(PytorchLayerTest): def _prepare_input(self, ndim=4): shape5d = [20, 6, 10, 10, 10] shape = shape5d[:ndim] return (self...
58
2,438
clearml
clearml/utilities/deferred.py
.py
import threading from functools import wraps from typing import Callable, List, Type, Union, Any import attr class DeferredExecutionPool: @attr.s class _DeferredAction: method = attr.ib() args = attr.ib() kwargs = attr.ib() def __init__(self, instance: Any) -> None: self....
146
5,453
coremltools
coremltools/converters/mil/frontend/tensorflow/dot_visitor.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 from coremltools.converters.mil.mil import types class DotVisitor: """ Generates a dot desc...
150
4,544
saleor
saleor/payment/tests/fixtures/__init__.py
.py
from .gateway_config import * # noqa: F403 from .gateway_response import * # noqa: F403 from .payment import * # noqa: F403 from .payment_data import * # noqa: F403 from .transaction_event import * # noqa: F403 from .transaction_item import * # noqa: F403
7
262
wandb
wandb/sdk/wandb_config.py
.py
"""config.""" from __future__ import annotations import logging import wandb from wandb.util import ( _is_artifact_representation, check_dict_contains_nested_artifact, json_friendly_val, ) from . import wandb_helper from .lib import config_util logger = logging.getLogger("wandb") # TODO(jhr): conside...
328
10,707
mlflow
tests/evaluate/logging/test_utils.py
.py
from mlflow.entities import Metric from mlflow.evaluation.assessment import AssessmentEntity, AssessmentSource from mlflow.evaluation.evaluation import EvaluationEntity from mlflow.evaluation.evaluation_tag import EvaluationTag from mlflow.evaluation.utils import evaluations_to_dataframes def test_evaluations_to_data...
269
9,390
toolz
bench/test_groupby.py
.py
from toolz import groupby, identity data = list(range(1000)) * 1000 def test_groupby(): groupby(identity, data)
9
120
openvino
src/bindings/python/tests/test_graph/test_input_validation.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino.exceptions import UserInputError from openvino.utils.input_validation import ( _check_value, check_valid_attribute, check_valid_attributes, is_non_ne...
159
4,903
wandb
wandb/sdk/launch/environment/azure_environment.py
.py
"""Implementation of AzureEnvironment class.""" from azure.core.exceptions import HttpResponseError # type: ignore from azure.identity import DefaultAzureCredential # type: ignore from azure.storage.blob import BlobClient, BlobServiceClient # type: ignore from typing_extensions import Self from ..errors import Lau...
105
3,880
sphinx
tests/roots/test-ext-autodoc/target/preserve_defaults_special_constructs.py
.py
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass, field from typing import NamedTuple, TypedDict #: docstring SENTINEL = object() #: docstring ze_lambda = lambda z=SENTINEL: None # NoQA: E731 def foo(x, y, z=SENTINEL): """docstring""" @dataclass class ...
55
952
mlflow
tests/utils/test_logging_utils.py
.py
import logging import os import re import subprocess import sys import uuid from io import StringIO import pytest import mlflow from mlflow.utils import logging_utils from mlflow.utils.logging_utils import ( LOGGING_LINE_FORMAT, SensitiveQueryParamFilter, _configure_mlflow_loggers, _redact_sensitive_q...
383
11,819
pyomo
pyomo/opt/problem/__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...
16
659
pymc
tests/distributions/test_censored.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...
269
10,284
metrics
tests/unittests/image/test_psnr.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...
174
7,026
onnxruntime
orttraining/orttraining/python/training/ortmodule/_torch_module_pytorch.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # _torch_module_pytorch.py from collections import OrderedDict from collections.abc import Callable, Iterator from typing import Optional, TypeVar import torch from typing_extensions import Self from ._torch_module_interfac...
94
3,793
saleor
saleor/graphql/discount/tests/queries/test_promotion.py
.py
import json from decimal import Decimal from unittest.mock import patch import graphene from .....discount import PromotionEvents, RewardType, RewardValueType from .....tests.utils import dummy_editorjs from ....tests.utils import assert_no_permission, get_graphql_content QUERY_PROMOTION_BY_ID = """ query Promot...
439
13,494
probability
tensorflow_probability/python/experimental/mcmc/diagonal_mass_matrix_adaptation.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...
348
15,722
python-prompt-toolkit
examples/prompts/auto-completion/multi-column-autocompletion.py
.py
#!/usr/bin/env python """ Similar to the autocompletion example. But display all the completions in multiple columns. """ from prompt_toolkit.completion import WordCompleter from prompt_toolkit.shortcuts import CompleteStyle, prompt animal_completer = WordCompleter( [ "alligator", "ant", "...
59
1,092
textual
src/textual/coordinate.py
.py
""" A class to store a coordinate, used by the [DataTable][textual.widgets.DataTable]. """ from __future__ import annotations from typing import NamedTuple class Coordinate(NamedTuple): """An object representing a row/column coordinate within a grid.""" row: int """The row of the coordinate within a gr...
54
1,247
beam
sdks/python/apache_beam/examples/inference/online_clustering/write_data_to_pubsub_pipeline/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...
24
986
qutip
qutip/tests/test_partial_transpose.py
.py
""" Unit tests for QuTiP partial transpose functions. """ import numpy as np from qutip import Qobj, partial_transpose, tensor, rand_dm from qutip.partial_transpose import _partial_transpose_reference def test_partial_transpose_bipartite(): """partial transpose of bipartite systems""" rho = Qobj(np.arange(...
74
2,523
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/log_sum_exp_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...
47
1,622
gunicorn
tests/docker/asgi_compliance/test_streaming_compliance.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Streaming compliance integration tests for ASGI. Tests chunked transfer encoding, Server-Sent Events (SSE), and streaming response handling. """ import json import time import pytest pytestmark = [ pyte...
441
17,370
saleor
saleor/graphql/product/tests/queries/test_products_query_with_where.py
.py
import datetime import graphene import pytest from django.utils import timezone from .....attribute.models import Attribute, AttributeValue from .....attribute.tests.model_helpers import ( get_product_attribute_values, get_product_attributes, ) from .....attribute.utils import associate_attribute_values_to_in...
2,003
59,888
onnxruntime
onnxruntime/python/tools/transformers/compare_bert_results.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # It is a tool to compare the inference results of the original model a...
257
8,192
coremltools
deps/pybind11/tests/test_embed/test_trampoline.py
.py
from __future__ import annotations import trampoline_module def func(): class Test(trampoline_module.test_override_cache_helper): def func(self): return 42 return Test() def func2(): class Test(trampoline_module.test_override_cache_helper): pass return Test()
19
311
onnx
onnx/reference/ops/op_blackman_window.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op_common_window import _CommonWindow class BlackmanWindow(_CommonWindow): r"""Blankman windowing function. Returns :math:`\\omega_n = 0.42 - 0.5 \...
31
945
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/top_largest_per_key.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");...
60
1,790
jupyterlab
scripts/analyze_flaky_tests.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Analyze recent Galata workflow runs for hard-failing and flaky tests.""" from __future__ import annotations import argparse import html import json import os import re import sys from collections import Counter fro...
552
18,335
saleor
saleor/graphql/product/tests/queries/variants_where/test_over_references_pages.py
.py
import pytest from ......attribute import AttributeEntityType, AttributeInputType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from ......page.models import Page from .....core.utils import to_global_id_or_none from...
367
11,925
probability
tensorflow_probability/python/distributions/truncated_cauchy.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...
376
15,146
django-cms
cms/test_utils/project/sampleapp/models.py
.py
from functools import cached_property from django.db import models from django.urls import reverse from cms.models.fields import PlaceholderRelationField from cms.utils.mptree import get_tree_base from cms.utils.placeholder import get_placeholder_from_slot MP_Node = get_tree_base() class Category(MP_Node): par...
136
3,301
mkdocs
mkdocs/structure/toc.py
.py
""" Deals with generating the per-page table of contents. For the sake of simplicity we use the Python-Markdown `toc` extension to generate a list of dicts for each toc item, and then store it as AnchorLinks to maintain compatibility with older versions of MkDocs. """ from __future__ import annotations from typing im...
81
2,248
cvxpy
cvxpy/tests/nlp_tests/test_risk_parity.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 ...
124
4,830
pyomo
pyomo/_archive/register_numpy_types.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...
70
2,388
astropy
astropy/tests/tests/test_runner.py
.py
import pytest from astropy.tests.helper import _skip_docstring_tests_with_optimized_python # Renamed these imports so that them being in the namespace will not # cause pytest 3 to discover them as tests and then complain that # they have __init__ defined. from astropy.tests.runner import TestRunner as _TestRunner fro...
108
3,000
biopython
Bio/KEGG/KGML/__init__.py
.py
# Copyright 2013 by Leighton Pritchard. 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. """Code to work wit...
17
516
pyro
pyro/infer/renyi_elbo.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import warnings import torch from pyro.distributions.util import is_identically_zero from pyro.infer.elbo import ELBO from pyro.infer.enum import get_importance_trace from pyro.infer.util import get_dependent_plate_di...
234
9,418
mlflow
mlflow/models/evaluation/validation.py
.py
import logging import operator import os from decimal import Decimal from mlflow.exceptions import MlflowException from mlflow.models.evaluation import EvaluationResult from mlflow.protos.databricks_pb2 import BAD_REQUEST, INVALID_PARAMETER_VALUE _logger = logging.getLogger(__name__) class MetricThreshold: """ ...
434
18,147
sqlmap
tests/test_pagecontent.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Page-content extraction helpers (lib/core/common.py): getFilteredPageContent, getPageWordSet, extractTextTagContent, and parseSqliteTableSchema. The first three feed text-only compar...
94
3,769
coveragepy
coverage/results.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 """Results of coverage measurement.""" from __future__ import annotations import collections from collections.abc import Iterable from dataclasses import datacl...
503
17,246
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_tensor_operation.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 logging import itertools import platform import numpy as np import pytest import coremltools...
1,745
59,223
mlflow
examples/gateway/mlflow_models/example.py
.py
# Prior to running the example code below, view the README.md within this directory from mlflow.deployments import get_deploy_client def main(): client = get_deploy_client("http://localhost:7000") print(f"MLflow model endpoints: {client.list_endpoints()}\n") print(f"MLflow completions endpoint info: {cli...
36
1,007
textual
docs/examples/how-to/center04.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static QUOTE = "Could not find you in Seattle and no terminal is in operation at your classified address." class CenterApp(App): """How to center things.""" CSS = """ Screen { align: center middle; } #hello { ...
29
550
biopython
Tests/test_AlignIO_ClustalIO.py
.py
# Copyright 2006-2014 by Peter Cock. 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. """Tests for Bio.AlignIO.ClustalIO module.""" import unittest from io import StringIO from ...
292
14,579
mlflow
tests/data/test_tensorflow_dataset.py
.py
import json import numpy as np import pytest import tensorflow as tf import mlflow.data from mlflow.data.code_dataset_source import CodeDatasetSource from mlflow.data.evaluation_dataset import EvaluationDataset from mlflow.data.pyfunc_dataset_mixin import PyFuncInputsOutputs from mlflow.data.schema import TensorDatas...
396
15,119
mlflow
tests/evaluate/logging/test_assessment.py
.py
from unittest.mock import patch import pytest from mlflow.entities.assessment_source import AssessmentSourceType from mlflow.evaluation import Assessment from mlflow.evaluation.assessment import AssessmentSource from mlflow.exceptions import MlflowException def test_assessment_equality(): source_1 = AssessmentS...
328
10,543
jupyterlab
jupyterlab/tests/test_jupyterlab.py
.py
"""Test installation of JupyterLab extensions""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import glob import json import logging import os import platform import shutil import subprocess import sys from os.path import join as pjoin from pathlib import Path fr...
810
31,248
astropy
astropy/cosmology/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Cosmology with Astropy. :mod:`~astropy.cosmology` contains classes and functions for cosmological distance measures and other cosmology-related calculations. See the :ref:`astropy-cosmology` for more detailed usage examples and references. """ __all_...
89
1,921
wandb
tests/system_tests/test_core/test_wandb.py
.py
"""Test the high level sdk methods by mocking out the backend. See wandb_integration_test.py for tests that launch a real backend server. """ import glob import io import os import platform import tempfile import unittest.mock from contextlib import contextmanager from pathlib import Path from unittest import mock i...
575
15,814
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_int32.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.int32, [2, 3], 'in1') y = tf.placeholder(tf.int32, [2, 3], 'in2') tf.multiply(x, y, name="add") tf.global_varia...
16
427
mlflow
tests/langgraph/test_chat_agent_langgraph.py
.py
import json import pytest from langchain_core.messages import AIMessage, ToolMessage import mlflow from mlflow.langchain.chat_agent_langgraph import parse_message from mlflow.types.agent import ChatAgentMessage LC_TOOL_CALL_MSG = AIMessage(**{ "content": "", "additional_kwargs": { "tool_calls": [ ...
283
10,125
coveragepy
tests/helpers.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 """Helpers for coverage.py tests.""" from __future__ import annotations import collections import contextlib import dis import io import locale import os import...
417
13,195
beam
sdks/python/apache_beam/typehints/trivial_inference.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...
803
27,409
saleor
saleor/graphql/attribute/tests/queries/test_attribute_filtering_with_channels.py
.py
from decimal import Decimal import graphene import pytest from .....attribute.models import Attribute, AttributeProduct, AttributeVariant from .....product import ProductTypeKind from .....product.models import ( Product, ProductChannelListing, ProductType, ProductVariant, ProductVariantChannelLis...
472
14,032
voila
tests/app/cwd_subdir_test.py
.py
# test serving a notebook import pytest NOTEBOOK_PATH = "subdir/cwd_subdir.ipynb" @pytest.fixture def cwd_subdir_notebook_url(base_url): return base_url + f"voila/render/{NOTEBOOK_PATH}" @pytest.fixture def voila_args(notebook_directory, voila_args_extra): return ["--VoilaTest.root_dir=%r" % notebook_direc...
21
581
wagtail
wagtail/images/api/admin/views.py
.py
from ..v2.views import ImagesAPIViewSet from .serializers import AdminImageSerializer class ImagesAdminAPIViewSet(ImagesAPIViewSet): base_serializer_class = AdminImageSerializer body_fields = ImagesAPIViewSet.body_fields + [ "thumbnail", ] listing_default_fields = ImagesAPIViewSet.listing_de...
17
399
saleor
saleor/graphql/account/tests/mutations/staff/test_staff_create.py
.py
import json from unittest.mock import call, patch from urllib.parse import urlencode import graphene from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from ......account.error_codes import AccountErrorCode from ......account.models import Group, User from ......account.notificatio...
531
17,086
mlflow
examples/mlflow-3/proto_inputs_outputs.py
.py
import pandas as pd from sklearn.model_selection import train_test_split import mlflow from mlflow.entities import ( DatasetInput, LoggedModelInput, LoggedModelOutput, LoggedModelStatus, Run, ) client = mlflow.MlflowClient() # Read the wine-quality csv file from the URL csv_url = ( "https://r...
47
1,785
textual
docs/examples/widgets/tabs.py
.py
from textual.app import App, ComposeResult from textual.widgets import Footer, Label, Tabs NAMES = [ "Paul Atreidies", "Duke Leto Atreides", "Lady Jessica", "Gurney Halleck", "Baron Vladimir Harkonnen", "Glossu Rabban", "Chani", "Silgar", ] class TabsApp(App): """Demonstrates the ...
83
1,969
pyomo
pyomo/common/tests/relocated.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...
26
967
textual
tests/test_collapsible.py
.py
from __future__ import annotations from textual import on from textual.app import App, ComposeResult from textual.widgets import Collapsible, Label from textual.widgets._collapsible import CollapsibleTitle COLLAPSED_CLASS = "-collapsed" def get_title(collapsible: Collapsible) -> CollapsibleTitle: return collaps...
248
7,896
metrics
docs/source/pyplots/multiclass_accuracy.py
.py
import matplotlib.pyplot as plt import torch import torchmetrics N = 10 num_updates = 10 num_steps = 5 fig, ax = plt.subplots(1, 1, figsize=(6.8, 4.8), dpi=500) metric = torchmetrics.Accuracy(task="multiclass", num_classes=3, average=None) for _ in range(N): metric.update(torch.randint(3, (10,)), torch.randint(...
17
361
sqlmap
plugins/dbms/frontbase/connector.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.connector import Connector as GenericConnector class Connector(GenericConnector): def co...
16
506
sqlmap
tamper/percentage.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 string from lib.core.common import singleTimeWarnMessage from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOWEST def dependencies(): singleTimeW...
56
1,437
qutip
qutip/core/__init__.py
.py
from .options import * from .coefficient import * from .qobj import * from .cy.qobjevo import * from .direct_sum import * from .environment import * from .expect import * from .tensor import * from .states import * from .operators import * from .metrics import * from .superoperator import * from .superop_reps import * ...
22
531
saleor
saleor/graphql/account/tests/mutations/staff/test_user_avatar_update.py
.py
import os from unittest.mock import MagicMock from django.core.files import File from ......account.error_codes import AccountErrorCode from ......product.tests.utils import create_image from ......thumbnail.models import Thumbnail from .....tests.utils import ( assert_no_permission, get_graphql_content, ...
131
3,870
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_dense.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasDense(CommonTF2LayerTest): def create_keras_dense_net(self, input_names, input_shapes, input_type, units, activation, ...
74
3,759
cvxpy
cvxpy/atoms/elementwise/hyperbolic.py
.py
""" Copyright 2025 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, softwa...
203
5,297
wagtail
wagtail/admin/tests/test_widgets.py
.py
import json import re from html import unescape import swapper from bs4 import BeautifulSoup from django import forms from django.test import TestCase from django.test.utils import override_settings from django.utils.html import escape from wagtail.admin import widgets from wagtail.admin.forms.tags import TagField fr...
886
32,242
metrics
src/torchmetrics/image/arniqa.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...
217
9,242
hydra
plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import sys from dataclasses import dataclass, field from enum import Enum, IntEnum from importlib import import_module from importlib.metadata import version from typing import Any, Dict, List, Optional from hydra.core.config_store import ConfigSto...
387
12,782
onnx
onnx/backend/test/case/node/globalmaxpool.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 GlobalMaxPool(Base): @staticmethod def export() -> None: ...
45
1,249
probability
spinoffs/inference_gym/inference_gym/tools/stan/radon_contextual_effects.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...
123
4,401
readthedocs.org
readthedocs/audit/admin.py
.py
"""Audit admin.""" from django.contrib import admin from readthedocs.audit.models import AuditLog @admin.register(AuditLog) class AuditLogAdmin(admin.ModelAdmin): raw_id_fields = ("user", "project", "organization") search_fields = ( "log_user_username", "ip", "browser", "log_...
28
592
probability
spinoffs/autobnn/autobnn/operators_test.py
.py
# Copyright 2023 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
219
7,441
luigi
luigi/task_history.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
80
1,989
openvino
tools/benchmark_tool/openvino/tools/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 __path__ = __import__("pkgutil").extend_path(__path__, __name__)
5
148
saleor
saleor/graphql/webhook/tests/mutations/test_delivery_retry.py
.py
from unittest.mock import patch import graphene from .....graphql.tests.utils import assert_no_permission, get_graphql_content from .....webhook.error_codes import WebhookErrorCode WEBHOOK_DELIVERY_RETRY_MUTATION = """ mutation eventDeliveryRetry($id: ID!){ eventDeliveryRetry(id: $id){ errors{ ...
130
3,866
pyro
examples/mixed_hmm/experiment.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import argparse import functools import json import os import uuid import torch from model import guide_generic, model_generic from seal_data import prepare_seal import pyro import pyro.poutine as poutine from pyro.infer import T...
181
5,959
jupytext
tests/functional/simple_notebooks/test_read_simple_csharp.py
.py
import pytest import jupytext from jupytext.compare import compare @pytest.mark.parametrize("lang", ["cs", "c#", "csharp"]) def test_simple_cs(lang): source = """// A Hello World! program in C#. Console.WriteLine("Hello World!"); """ md = """```{lang} {source} ``` """.format(lang=lang, source=source) nb ...
80
1,821
cvxpy
continuous_integration/doc_is_latest.py
.py
""" Copyright 2022 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, softw...
28
1,003
beam
sdks/python/apache_beam/internal/test_data/module_1_lambda_variable_added.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...
29
1,109
saleor
saleor/asgi/tests/test_healthcheck.py
.py
from unittest import mock from saleor.asgi import health_check from saleor.asgi.tests.asgi_test_utils import ( DummyASGIApplication, create_asgi_scope_websocket_proto, ) async def test_non_http_requests_forwarded_to_next_wrapper(): """Ensure the middleware forwards the request when the protocol isn't HTT...
47
1,661
mlflow
tests/genai/judges/optimizers/memalign/test_optimizer.py
.py
import json import threading from concurrent.futures import ThreadPoolExecutor from contextlib import contextmanager from unittest.mock import MagicMock, patch import pytest import mlflow from mlflow.entities.assessment import Assessment, AssessmentSource, Feedback from mlflow.entities.assessment_source import Assess...
1,488
60,722
onnx
onnx/reference/ops/op_loop.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 Loop(OpRun): def __init__(self, onnx_node, run_params): OpRun.__init__(self, onnx_node, run_params) if "opsets" not...
87
3,454