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
returns
tests/test_context/test_requires_context/test_context.py
.py
from copy import copy, deepcopy import pytest from returns.context import RequiresContext from returns.primitives.exceptions import ImmutableStateError def test_requires_context_immutable() -> None: """Ensures that Context is immutable.""" with pytest.raises(ImmutableStateError): RequiresContext.fro...
25
773
confluent-kafka-python
src/confluent_kafka/schema_registry/rules/encryption/azurekms/azure_aead.py
.py
# 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 required by applicable law or agreed to in writi...
142
6,757
saleor
saleor/graphql/payment/tests/queries/test_payments_query.py
.py
import json from decimal import Decimal import graphene import pytest from .....order.models import Order from .....payment.models import Payment from ....tests.utils import ( assert_no_permission, get_graphql_content, get_graphql_content_from_response, ) from ...enums import PaymentChargeStatusEnum, Tran...
315
9,205
wandb
wandb/sdk/lib/hashutil.py
.py
from __future__ import annotations import base64 import hashlib import logging import mmap import time from typing import TYPE_CHECKING, TypeAlias from wandb.sdk.lib.paths import StrPath if TYPE_CHECKING: import _hashlib # type: ignore[import-not-found] logger = logging.getLogger(__name__) # In the future, c...
99
3,292
python-prompt-toolkit
src/prompt_toolkit/layout/layout.py
.py
""" Wrapper for the layout. """ from __future__ import annotations from collections.abc import Generator, Iterable from prompt_toolkit.buffer import Buffer from .containers import ( AnyContainer, ConditionalContainer, Container, Window, to_container, ) from .controls import BufferControl, Search...
413
13,958
confluent-kafka-python
examples/adminapi.py
.py
#!/usr/bin/env python # # Copyright 2018 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 required by applicable law or...
1,118
41,049
onnx
onnx/backend/test/case/node/reducesum.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 ReduceSum(Base): @staticmethod def export_do_not_keepdims() ->...
248
7,155
voila
voila/_version.py
.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
48
1,491
sphinx
tests/roots/test-ext-napoleon-paramtype/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.intersphinx', ] # Python inventory is manually created in the test # in order to avoid creating a real HTTP connection intersphinx_mapping = {} intersp...
17
376
mlflow
mlflow/genai/judges/utils/parsing_utils.py
.py
"""Response parsing utilities for judge models.""" import re def _strip_markdown_code_blocks(response: str) -> str: """ Strip markdown code blocks from LLM responses. Some legacy models wrap responses in markdown code blocks (```json...``` or unlabeled fences). This function removes those wrappers t...
45
1,428
astropy
astropy/io/fits/tests/test_fitscheck.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import re import numpy as np import pytest from astropy import __version__ as version from astropy.io import fits from astropy.io.fits.scripts import fitscheck from astropy.utils.exceptions import AstropyUserWarning from .conftest import FitsTestCase ...
131
4,442
readthedocs.org
readthedocs/proxito/tests/test_hosting.py
.py
"""Test hosting views.""" import json from pathlib import Path from unittest import mock import django_dynamic_fixture as fixture import pytest from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.urls import reverse from django.utils import timezone from django_...
1,392
48,046
astropy
astropy/nddata/mixins/tests/test_ndarithmetic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import operator from copy import deepcopy import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from astropy import units as u from astropy.nddata import CCDData, NDDataRef from astropy.nddata import _t...
1,593
59,516
pyomo
pyomo/contrib/incidence_analysis/triangularize.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...
220
8,932
coremltools
coremltools/converters/mil/mil/ops/defs/iOS17/linear.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.converters.mil.mil import types from coremltools.converters.mil.mil.input_type impor...
120
4,484
saleor
saleor/graphql/order/mutations/draft_order_create.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from ....account.models import User from ....checkout import AddressType from ....core.taxes import TaxError from ....core.tracing import traced_atomic_transaction from ....discount.utils.voucher import ( create...
483
17,507
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_tensor_transformation.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 itertools import time import numpy as np import pytest import coremltools as ct from coremlt...
1,883
62,521
mlflow
dev/clint/src/clint/rules/forbidden_deprecation_warning.py
.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule def _is_deprecation_warning(expr: ast.expr) -> bool: return isinstance(expr, ast.Name) and expr.id == "DeprecationWarning" class ForbiddenDeprecationWarning(Rule): def _message(self) -> str: return ( "Do no...
35
1,331
pyomo
examples/pyomobook/optimization-ch/ConcreteHLinear.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...
41
1,204
deap
doc/code/benchmarks/kursawe.py
.py
from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.pyplot as plt try: import numpy as np except: exit() from deap import benchmarks X = np.arange(-5, 5, 0.1) Y = np.arange(-5, 5, 0.1) X, Y = np.meshgrid(X, Y) Z1 = np.zeros(X.shape) Z2 = np.zeros(X.shape) for i in range(X.sha...
35
855
pyro
pyro/infer/mcmc/rwkernel.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import math from collections import OrderedDict import torch import pyro import pyro.distributions as dist from pyro.infer.mcmc.mcmc_kernel import MCMCKernel from pyro.infer.mcmc.util import initialize_model class RandomWalkKernel(...
144
4,827
mamba
micromamba/tests/test_login.py
.py
import base64 import json import sys from pathlib import Path import pytest from xprocess import ProcessStarter from .helpers import create as umamba_create from .helpers import login, logout, random_string __this_dir__ = Path(__file__).resolve().parent server_dir = __this_dir__ / "test-server" pyserver = server_d...
326
9,704
loguru
tests/exceptions/source/backtrace/head_recursion.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=False, backtrace=True, diagnose=False) @logger.catch() def a(n): if n: a(n - 1) 1 / n def b(n): if n: with logger.catch(): b(n - 1) 1 / n def c(n): if n: try: ...
43
466
pyomo
pyomo/dataportal/tests/test_dat_parser.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...
41
1,610
coremltools
coremltools/test/optimize/torch/quantization/__init__.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
6
219
pyomo
examples/pyomobook/pyomo-components-ch/param_misc.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...
39
1,232
sphinx
tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/autosummary_dummy_module.py
.py
class Bar: """Bar class""" pass class PublicBar: """Public Bar class""" pass def foo(): """Foo function""" pass def public_foo(): """Public Foo function""" pass
21
201
ipython
IPython/testing/globalipapp.py
.py
"""Global IPython app to support test running. We must start our own ipython object and heavily muck with it so that all the modifications IPython makes to system behavior don't send the doctest machinery into a fit. This code should be considered a gross hack, but it gets the job done. """ # Copyright (c) IPython D...
115
3,944
probability
tensorflow_probability/python/stats/moving_stats.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...
375
17,314
coremltools
deps/pybind11/tests/test_kwargs_and_defaults.py
.py
from __future__ import annotations import pytest from pybind11_tests import kwargs_and_defaults as m def test_function_signatures(doc): assert doc(m.kw_func0) == "kw_func0(arg0: int, arg1: int) -> str" assert doc(m.kw_func1) == "kw_func1(x: int, y: int) -> str" assert doc(m.kw_func2) == "kw_func2(x: int...
429
14,911
metrics
tests/unittests/classification/test_precision_fixed_recall.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...
466
20,654
lemur
lemur/plugins/bases/export.py
.py
""" .. module: lemur.plugins.bases.export :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from lemur.plugins.base import Plugin class ExportPlugin(Plugin): """ Thi...
23
545
django-cms
cms/forms/wizards.py
.py
from django import forms from django.core.exceptions import ValidationError from django.db import transaction from django.utils.html import strip_tags from django.utils.text import slugify from django.utils.translation import gettext, gettext_lazy as _ from cms.admin.forms import AddPageForm from cms.plugin_pool impor...
175
6,231
saleor
saleor/graphql/payment/sorters.py
.py
from ..core.descriptions import ADDED_IN_323 from ..core.doc_category import DOC_CATEGORY_PAYMENTS from ..core.types import BaseEnum, SortInputObjectType class TransactionSortField(BaseEnum): CREATED_AT = ["created_at", "pk"] MODIFIED_AT = ["modified_at", "pk"] class Meta: doc_category = DOC_CATE...
29
1,075
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/StringProperty.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class StringProperty(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(f...
68
2,043
wagtail
wagtail/contrib/settings/urls.py
.py
from django.urls import path from . import views app_name = "wagtailsettings" urlpatterns = [ path( "<slug:app_name>/<slug:model_name>/", views.redirect_to_relevant_instance, name="edit", ), path( "<slug:app_name>/<slug:model_name>/<int:pk>/", views.EditView.as_view...
23
505
pyomo
pyomo/contrib/solver/tests/solvers/test_gurobi_minlp_writer.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
573
20,635
saleor
saleor/graphql/discount/sorters.py
.py
import graphene from django.db.models import F, Min, OuterRef, Q, QuerySet, Subquery from ...discount.models import VoucherCode from ..core.descriptions import ( CHANNEL_REQUIRED, DEFAULT_DEPRECATION_REASON, ) from ..core.doc_category import DOC_CATEGORY_DISCOUNTS from ..core.types import BaseEnum, ChannelSort...
161
6,188
pyomo
examples/performance/pmedian/pmedian1.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...
69
2,023
flit
flit_core/tests_core/test_versionno.py
.py
import pytest from flit_core.common import InvalidVersion from flit_core.versionno import normalise_version def test_normalise_version(): nv = normalise_version assert nv('4.3.1') == '4.3.1' assert nv('1.0b2') == '1.0b2' assert nv('2!1.3') == '2!1.3' # Prereleases assert nv('1.0B2') == '1.0b2...
41
1,170
saleor
saleor/tests/e2e/product/utils/product_variant_stock_update.py
.py
from ...utils import get_graphql_content PRODUCT_VARIANT_STOCK_UPDATE_MUTATION = """ mutation productVariantStocksUpdate ($stocks: [StockInput!]!, $id: ID!) { productVariantStocksUpdate(stocks: $stocks, variantId: $id) { errors { message field } productVariant { id stocks { ...
46
1,020
beam
sdks/python/apache_beam/coders/fast_coders_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...
43
1,471
black
tests/data/cases/yield_singleton_tuple_stable.py
.py
def f(): yield x, # output def f(): yield x,
10
57
saleor
saleor/csv/utils/__init__.py
.py
class ProductExportFields: """Data structure with fields for product export.""" HEADERS_TO_FIELDS_MAPPING = { "fields": { "id": "id", "name": "name", "description": "description_as_str", "category": "category__slug", "product type": "product_t...
94
4,112
ipython
tests/test_data.py
.py
"""Tests for IPython.utils.data.""" import warnings import pytest from IPython.utils.data import chop, uniq_stable # --------------------------------------------------------------------------- # chop # --------------------------------------------------------------------------- def test_chop_even_division(): ...
77
2,011
pyomo
pyomo/repn/plugins/ampl/ampl_.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
2,020
79,809
wandb
wandb/sdk/data_types/plotly.py
.py
from __future__ import annotations import codecs import os from collections.abc import Sequence from typing import TYPE_CHECKING, TypeAlias from wandb import util from wandb.sdk.lib import runid from ._private import MEDIA_TMP from .base_types.media import Media, _numpy_arrays_to_lists from .base_types.wb_value impo...
99
3,323
dirty-equals
dirty_equals/_numeric.py
.py
import math from datetime import date, datetime, timedelta from decimal import Decimal from typing import Any, Optional, TypeVar, Union from ._base import DirtyEquals __all__ = ( 'IsApprox', 'IsNumeric', 'IsNumber', 'IsPositive', 'IsNegative', 'IsNonPositive', 'IsNonNegative', 'IsInt',...
504
14,104
pyomo
pyomo/core/base/componentuid.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...
726
26,166
openvino
src/bindings/python/tests/test_graph/test_ctc_loss.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov from openvino import Type def test_ctc_loss_props(): ind_dtype = np.int32 float_dtype = np.float32 logits = ov.parameter([2, 100, 80], dtype=float_dty...
29
1,069
biopython
Tests/test_SearchIO_exonerate.py
.py
# Copyright 2012 by Wibowo Arindrarto. 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 SearchIO ExonerateIO parsers.""" import os import unittest from Bio.SearchI...
2,676
111,022
saleor
saleor/graphql/account/tests/queries/test_permission_groups.py
.py
import pytest from .....account.models import Group from ....tests.utils import get_graphql_content @pytest.fixture def permission_groups_for_pagination(db): return Group.objects.bulk_create( [ Group(name="admin"), Group(name="customer_manager"), Group(name="discount_m...
99
3,005
onnxruntime
onnxruntime/python/tools/custom_op_wrapper/create_custom_op_wrapper.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ Creates an ONNX model with a single custom operator node that wraps a...
277
7,981
coremltools
deps/protobuf/python/google/protobuf/internal/import_test_package/__init__.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...
34
1,768
mlflow
mlflow/deployments/utils.py
.py
import urllib from urllib.parse import urlparse from mlflow.environment_variables import MLFLOW_DEPLOYMENTS_TARGET from mlflow.exceptions import MlflowException from mlflow.utils.uri import append_to_uri_path _deployments_target: str | None = None def parse_target_uri(target_uri): """Parse out the deployment ta...
97
3,240
openvino
tests/stress_tests/scripts/get_testdata.py
.py
#!/usr/bin/env python3 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Script to acquire model IRs for stress tests. Usage: ./scrips/get_testdata.py """ # pylint:disable=line-too-long import argparse import json import logging as log import os import shutil import subprocess imp...
240
10,606
sphinx
utils/bump_docker.py
.py
#!/usr/bin/env python3 """Usage: bump_docker.py [VERSION]""" from __future__ import annotations import re import subprocess import sys from pathlib import Path VERSION_PATTERN = r'\d+\.\d+\.\d+' if not sys.argv[1:] or re.match(VERSION_PATTERN, sys.argv[1]) is None: print(__doc__) raise SystemExit(1) VERSI...
58
1,503
beam
learning/katas/python/Core Transforms/Composite Transform/Composite Transform/tests/test_task.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
36
1,292
wandb
tests/system_tests/test_functional/jax/test_jax.py
.py
import jax.numpy as jnp import wandb def test_log_bfloat16(wandb_backend_spy): run = wandb.init() m1 = jnp.array(1.0, dtype=jnp.float32) m2 = jnp.array(2.0, dtype=jnp.bfloat16) m3 = jnp.array([3.0, 4.0], dtype=jnp.bfloat16) run.log(dict(m1=m1, m2=m2, m3=m3)) run.finish() with wandb_backen...
22
609
pymc
tests/logprob/test_rewriting.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...
102
4,040
saleor
saleor/graphql/product/tests/mutations/test_product_media_delete.py
.py
from unittest.mock import patch import graphene import pytest from .....graphql.tests.utils import get_graphql_content @patch("saleor.plugins.manager.PluginsManager.product_media_deleted") @patch("saleor.plugins.manager.PluginsManager.product_updated") @patch("saleor.product.signals.delete_from_storage_task.delay")...
53
1,654
readthedocs.org
readthedocs/storage/tests/test_s3_storage.py
.py
from unittest import mock import pytest from django.core.exceptions import SuspiciousFileOperation, SuspiciousOperation from django.test import TestCase from readthedocs.storage.s3_storage import RTDS3Storage class TestRTDS3Storage(TestCase): def setUp(self): self.storage = RTDS3Storage() def test...
65
2,433
mlflow
tests/genai/datasets/test_evaluation_dataset.py
.py
import json from datetime import datetime, timezone from types import SimpleNamespace from typing import Any from unittest.mock import Mock import pandas as pd import pytest from mlflow.data.dataset_source_registry import ( get_dataset_source_from_json, register_dataset_source, ) from mlflow.data.spark_datase...
316
11,652
openvino
docs/articles_en/assets/snippets/ov_caching.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # ! [ov:caching:part0] from utils import get_path_to_model, get_temp_dir import openvino as ov import openvino.properties as props # For example: "CPU", "GPU", "NPU". device_name = 'CPU' model_path = get_path_to_model() path_to_cache...
90
2,721
black
tests/data/cases/attribute_access_on_number_literals.py
.py
x = 123456789 .bit_count() x = (123456).__abs__() x = .1.is_integer() x = 1. .imag x = 1E+1.imag x = 1E-1.real x = 123456789.123456789.hex() x = 123456789.123456789E123456789 .real x = 123456789E123456789 .conjugate() x = 123456789J.real x = 123456789.123456789J.__add__(0b1011.bit_length()) x = 0XB1ACC.conjugate() x = ...
48
907
pyro
tests/distributions/test_stable_log_prob.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import logging import pytest import torch from scipy.stats import levy_stable import pyro import pyro.distributions import pyro.distributions.stable_log_prob from pyro.distributions import Stable, constraints from pyro.infer import S...
149
5,439
readthedocs.org
readthedocs/oauth/urls.py
.py
from django.urls import path from readthedocs.oauth.views import GitHubAppWebhookView urlpatterns = [ path("githubapp/", GitHubAppWebhookView.as_view(), name="github_app_webhook"), ]
9
190
sphinx
tests/roots/test-add_enumerable_node/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = ['enumerable_node'] numfig = True
9
132
wandb
tests/unit_tests/test_lib/test_telemetry.py
.py
"""telemetry lib tests.""" from unittest.mock import MagicMock import pytest from wandb import env from wandb.analytics.opentelemetry import opentelemetry_proxy from wandb.analytics.opentelemetry.opentelemetry_proxy import ( LowCardinalityAttributes, TelemetryRecorder, ) from wandb.sdk.lib import telemetry ...
119
4,262
openvino
tests/layer_tests/tensorflow_tests/test_tf_LookupTableFind.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest from common.utils.tf_utils import mix_array_with_value, run_in_jenkins rng = np.random.default_rng() class TestLookupTab...
94
5,003
coremltools
coremltools/converters/mil/conftest.py
.py
# Copyright (c) 2021, 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 def pytest_make_parametrize_id(config, val, argname): ''' This function is a hook into pytes...
13
460
saleor
saleor/graphql/menu/tests/mutations/test_menu_item_move.py
.py
import json from unittest import mock import graphene from .....menu.models import Menu, MenuItem from ....tests.utils import get_graphql_content QUERY_REORDER_MENU = """ mutation menuItemMove($menu: ID!, $moves: [MenuItemMoveInput!]!) { menuItemMove(menu: $menu, moves: $moves) { errors { field mes...
631
18,350
black
src/black/handle_ipynb_magics.py
.py
"""Functions to process IPython magics with.""" import ast import collections import dataclasses import re import secrets import string from collections.abc import Collection from functools import lru_cache from importlib.util import find_spec from typing import TypeGuard from black.mode import Mode from black.output...
516
15,901
probability
spinoffs/fun_mc/fun_mc/dynamic/backend_tensorflow/backend.py
.py
# Copyright 2021 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
76
1,889
astropy
astropy/coordinates/tests/test_polarization.py
.py
import numpy as np import pytest from numpy.testing import assert_equal from astropy.coordinates.polarization import ( StokesCoord, StokesSymbol, custom_stokes_symbol_mapping, ) from astropy.table import Table, vstack from astropy.utils import unbroadcast def test_scalar(): sk = StokesCoord(2) as...
182
5,580
saleor
saleor/graphql/meta/tests/queries/test_checkout.py
.py
from ....tests.utils import assert_no_permission, get_graphql_content from .utils import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE QUERY_CHECKOUT_PUBLIC_META = """ query checkoutMeta($token: UUID!){ checkout(token: $token){ metadata{ key value ...
273
8,435
wagtail
wagtail/admin/viewsets/pages.py
.py
import swapper from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from django.http import Http404 from django.urls import path from django.utils.functional import cached_property, classproperty from wagtail.admin.views.page_privacy imp...
698
25,687
mlflow
mlflow/genai/judges/prompts/context_sufficiency.py
.py
from typing import Any from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the is_context_sufficient assessment. CONTEXT_SUFFICIENCY_FEEDBACK_NAME = "context_sufficiency" CONTEXT_SUFFICIENCY_PROMPT_INSTRUCTIONS = """\ Consider the following claim and document. You must determine whether ...
72
2,451
saleor
saleor/tests/e2e/checkout/test_checkout_use_multiple_gift_cards.py
.py
import pytest from ..gift_cards.utils import bulk_create_gift_card 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 ( checkout_add_promo_code, checkout_complete, checkout_crea...
173
5,732
saleor
saleor/graphql/menu/mutations/menu_delete.py
.py
import graphene from ....menu import models from ....permission.enums import MenuPermissions from ....webhook.event_types import WebhookEventAsyncType from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.mutations import ModelDeleteMutation from ...core.types import MenuError from .....
42
1,413
beam
sdks/python/apache_beam/io/external/xlang_kinesisio_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...
337
11,699
probability
tensorflow_probability/python/experimental/mcmc/sequential_monte_carlo_kernel_test.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 ...
142
6,336
clearml
clearml/binding/joblib_bind.py
.py
import sys import warnings from functools import partial from io import IOBase from typing import Callable, Union, IO, Any from pathlib2 import Path from .import_bind import PostImportHookPatching from ..binding.frameworks import _patched_call, _Empty, WeightsFileHandler from ..config import running_remotely from ..d...
223
8,508
saleor
saleor/graphql/promise.py
.py
from promise import Promise def __del_promise__(self: Promise) -> None: # Clean up references to break up any reference cycles self._handlers = None # type: ignore[assignment] self._fulfillment_handler0 = None self._rejection_handler0 = None self._promise0 = None self._future = None # type: ...
23
825
probability
spinoffs/fun_mc/fun_mc/__init__.py
.py
# Copyright 2021 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
15
678
astropy
astropy/cosmology/_src/traits/tcmb.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """CMB Temperature. This is private API. See `~astropy.cosmology.traits` for public API. """ __all__ = ("TemperatureCMB",) from numpy.typing import ArrayLike from astropy.cosmology._src.utils import aszarr from astropy.units import Quantity class T...
60
1,523
sqlmap
lib/utils/dbwire.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import importlib import logging import extra.dbwire from lib.core.common import getSafeExString from lib.core.data import conf from lib.core.data import logger from lib.core.exc...
58
1,848
mkdocs-material
material/plugins/tags/renderer/__init__.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...
100
3,570
beam
sdks/python/apache_beam/examples/inference/anomaly_detection/anomaly_detection_pipeline/setup.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...
50
1,693
saleor
saleor/core/notification/validation.py
.py
from django.core.exceptions import ValidationError from ...account.models import User from ...account.notifications import get_user_custom_payload from ...graphql.channel.utils import validate_channel from ...graphql.core.enums import ExternalNotificationTriggerErrorCode from ...graphql.utils import resolve_global_ids...
80
2,634
voila
tests/app/no_kernelspec_test.py
.py
import pytest NOTEBOOK_PATH = "no_kernelspec.ipynb" @pytest.fixture def non_existing_kernel_notebook(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_directory, *voila_args_extra] ...
23
604
astropy
astropy/io/votable/xmlutil.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Various XML-related utilities. """ # ASTROPY from astropy.logger import log from astropy.utils import data from astropy.utils.xml import check as xml_check from astropy.utils.xml import validate # LOCAL from .exceptions import W02, W03, W04, W05, vo_...
126
3,528
hatch
src/hatch/cli/self/restore.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import click if TYPE_CHECKING: from hatch.cli.application import Application @click.command( short_help="Restore the installation", context_settings={"help_option_names": [], "ignore_unknown_options": True} ) @click.argument("args", nargs=...
18
465
mlflow
mlflow/entities/_job_status.py
.py
from enum import Enum from mlflow.exceptions import MlflowException from mlflow.protos.jobs_pb2 import JobStatus as ProtoJobStatus class JobStatus(str, Enum): """Enum for status of a Job.""" PENDING = "PENDING" RUNNING = "RUNNING" SUCCEEDED = "SUCCEEDED" FAILED = "FAILED" TIMEOUT = "TIMEOUT"...
68
2,357
saleor
saleor/tests/e2e/orders/test_order_void_payment.py
.py
import pytest from ..checkout.utils import ( checkout_complete, checkout_create, checkout_delivery_method_update, raw_checkout_dummy_payment_create, ) from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_pe...
119
3,398
sqlmap
plugins/dbms/extremedb/__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 EXTREMEDB_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.extremedb.enumeration import Enumerat...
30
938
onnxruntime
onnxruntime/test/python/transformers/test_float16.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------...
276
12,200
pyomo
pyomo/scripting/tests/test_cmds.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...
252
8,509
pyomo
pyomo/core/tests/unit/test_symbol_map.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...
138
4,688
onnxruntime
onnxruntime/test/testdata/test_data_generation/sgd_test/sgd_test_data_generator.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """This file is used to generate test data for SGD optimizer tests in orttraining/orttraining/test/training_ops/cuda/optimizer/sgd_test.cc.""" import torch class SingleParameterModule(torch.nn.Module): """A dummy modul...
170
5,656