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
wandb
wandb/sdk/wandb_setup.py
.py
"""Global W&B library state. This module manages global state, which for wandb includes: - Settings configured through `wandb.setup()` - The list of active runs - A subprocess ("the internal service") that asynchronously uploads metrics This module is fork-aware: in a forked process such as that spawned by the `mult...
595
20,368
textual
docs/examples/widgets/data_table.py
.py
from textual.app import App, ComposeResult from textual.widgets import DataTable ROWS = [ ("lane", "swimmer", "country", "time"), (4, "Joseph Schooling", "Singapore", 50.39), (2, "Michael Phelps", "United States", 51.14), (5, "Chad le Clos", "South Africa", 51.14), (6, "László Cseh", "Hungary", 51....
31
846
sphinx
sphinx/testing/__init__.py
.py
"""Sphinx test utilities You can require sphinx.testing pytest fixtures in a test module or a conftest file like this: pytest_plugins = 'sphinx.testing.fixtures' """
8
171
python-prompt-toolkit
examples/prompts/bottom-toolbar.py
.py
#!/usr/bin/env python """ A few examples of displaying a bottom toolbar. The ``prompt`` function takes a ``bottom_toolbar`` attribute. This can be any kind of formatted text (plain text, HTML or ANSI), or it can be a callable that takes an App and returns an of these. The bottom toolbar will always receive the style ...
82
2,326
sphinx
tests/roots/test-ext-autosummary-template/target.py
.py
class Foo: """docstring of Foo."""
3
39
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_update_single_use_settings_after_usage.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, raw_update_voucher, ) from ...utils import ( checkout_a...
167
5,198
onnxruntime
onnxruntime/python/tools/transformers/models/t5/t5_helper.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ------------------------------------------------------------------------- import logging import os from pathlib import Path import torch from floa...
316
12,626
onnxruntime
onnxruntime/test/testdata/transform/runtime_optimization/add_with_surrounding_identities_gen.py
.py
import onnx from onnx import TensorProto, helper graph = helper.make_graph( [ # nodes helper.make_node("Identity", ["A"], ["A_inner"], "id0"), helper.make_node("Identity", ["B"], ["B_inner"], "id1"), helper.make_node("Add", ["A_inner", "B_inner"], ["C_inner"], "add0"), helper.make_...
24
785
textual
src/textual/layouts/factory.py
.py
from __future__ import annotations from textual.layout import Layout from textual.layouts.grid import GridLayout from textual.layouts.horizontal import HorizontalLayout from textual.layouts.stream import StreamLayout from textual.layouts.vertical import VerticalLayout LAYOUT_MAP: dict[str, type[Layout]] = { "hori...
38
881
hydra
tools/landscape/test_build_landscape_review.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import json from pathlib import Path import build_landscape_review as review def usage(**overrides: object) -> dict[str, object]: value: dict[str, object] = { "repo": "example/project", "tree_sha": "a" * 40, "version_...
269
8,428
sqlmap
thirdparty/chardet/euckrprober.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Con...
48
1,748
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/remove_redundant_ops.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import collections from typing import Dict, List import numpy as np from coremltools.converters.mil...
303
12,593
kombu
t/unit/transport/test_pyro.py
.py
from __future__ import annotations import socket import pytest from kombu import Connection, Consumer, Exchange, Producer, Queue class test_PyroTransport: def setup_method(self): self.c = Connection(transport='pyro', virtual_host="kombu.broker") self.e = Exchange('test_transport_pyro') ...
95
2,899
kafka
tests/kafkatest/tests/client/share_consumer_dlq_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 ...
482
27,316
sqlmap
tests/test_decodepage.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission HTTP response decoding (lib/request/basic.py decodePage). Every fetched page passes through decodePage: it inflates gzip/deflate bodies, applies the charset, ...
122
4,757
qutip
qutip/tests/core/test_local_matmul.py
.py
import pytest import numpy as np from qutip import ( rand_ket, rand_dm, Qobj, local_matmul, expand_operator, tensor, sigmax, destroy, gates, sprepost, qeye, ) def test_single_qubit_gate_on_ket(): state = rand_ket([2, 2, 2]) op = sigmax() extended_op = tensor(qeye(2), sigmax(), qeye(2)) e...
328
9,278
kombu
t/integration/test_mongodb.py
.py
from __future__ import annotations import os import pytest import kombu from .common import (BaseExchangeTypes, BaseMessage, BasePriority, BasicFunctionality) def get_connection(hostname, port, vhost): return kombu.Connection( f'mongodb://{hostname}:{port}/{vhost}', transp...
186
6,366
qutip
qutip/solver/parallel.py
.py
""" This module provides functions for parallel execution of loops and function mappings, using the builtin Python module multiprocessing or the loky parallel execution library. """ __all__ = ['parallel_map', 'serial_map', 'loky_pmap', 'mpi_pmap'] import multiprocessing import os import sys import time import threadin...
560
21,085
wandb
tests/system_tests/test_api/conftest.py
.py
"""Fixtures for API tests.""" from __future__ import annotations import http.server import io import socket import socketserver import threading from collections.abc import Generator import pyarrow as pa import pyarrow.parquet as pq import pytest class ParquetFileHandler(http.server.SimpleHTTPRequestHandler): ...
156
4,498
openvino
tests/layer_tests/tensorflow_tests/test_tf_ComplexFFT.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import platform import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest OPS = { 'tf.raw_ops.IRFFT': tf.raw_ops.IRFFT, 'tf.raw_ops.IRFFT2D': tf.raw_ops.IRFFT2D, 'tf.ra...
163
7,301
wagtail
wagtail/admin/rich_text/converters/editor_html.py
.py
import swapper from django.utils.functional import cached_property from django.utils.html import escape from wagtail.rich_text import features as feature_registry from wagtail.rich_text.rewriters import EmbedRewriter, LinkRewriter, MultiRuleRewriter from wagtail.whitelist import Whitelister, allow_without_attributes ...
186
6,404
saleor
saleor/webhook/tests/subscription_webhooks/test_create_deliveries_for_transaction_charge_requested.py
.py
import json from decimal import Decimal import graphene from django.utils import timezone from freezegun import freeze_time from ....core.prices import quantize_price from ....graphql.tests.queries import fragments from ....payment import TransactionAction, TransactionEventType from ....payment.interface import Trans...
199
6,474
sphinx
sphinx/transforms/__init__.py
.py
"""Docutils transforms used by Sphinx when reading documents.""" from __future__ import annotations import re import unicodedata from typing import TYPE_CHECKING, cast from docutils import nodes from docutils.transforms import Transform, Transformer from docutils.transforms.parts import ContentsFilter from docutils....
540
18,811
gunicorn
tests/requests/valid/compat_obs_fold_huge.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.config import Config cfg = Config() cfg.set('permit_obsolete_folding', True) certificate = """-----BEGIN CERTIFICATE----- MIIFbTCCBFWgAwIBAgICH4cwDQYJKoZIhvcNAQEFBQAwcDELMAkGA1UEBhMCVUsx ETAPBgNVB...
50
2,354
hatch
scripts/bump.py
.py
import argparse import subprocess from datetime import datetime, timezone from utils import ROOT, get_latest_release TEMPLATE = ( "## [{version}](https://github.com/pypa/hatch/releases/tag/{project}-v{version}) - " "{year}-{month:02}-{day:02} ## {{: #{project}-v{version} }}" ) def main(): parser = argpa...
64
2,217
sphinx
tests/test_ext_napoleon/test_ext_napoleon_docstring.py
.py
"""Tests for :py:mod:`sphinx.ext.napoleon.docstring` module.""" from __future__ import annotations import re import zlib from collections import namedtuple from inspect import cleandoc from itertools import product from textwrap import dedent from types import SimpleNamespace from typing import TYPE_CHECKING from uni...
2,918
74,366
sqlmap
plugins/dbms/snowflake/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ try: import snowflake.connector except: pass import logging from lib.core.common import getSafeExString from lib.core.convert import getText from lib.core.data import co...
79
2,559
wandb
wandb/apis/_generated/create_team.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/api/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLId, GQLResult class CreateTeam(GQLResult): result: CreateTeamResult | None class CreateTeamResult(GQLResult): entity: CreateTeamResultEntity | N...
29
559
mlflow
mlflow/pydantic_ai/autolog_v2.py
.py
import functools import inspect import logging import sys from contextlib import asynccontextmanager from typing import Any import mlflow from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.pydantic_ai.utils import ( extract_safe_attributes, model_request_inputs, pars...
477
16,270
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/Notebook with metadata and long cells.py
.py
# --- # jupyter: # jupytext: # cell_markers: '{{{,}}}' # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # Part one - various cells # Here we have a markdown cell # # # with two blank lines # Now we have a markdown cell # with a code block inside it # # ```python #...
55
840
beam
sdks/python/apache_beam/examples/inference/table_row_batch_example.py
.py
#!/usr/bin/env python # # 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 "Lic...
195
6,151
astropy
astropy/utils/decorators.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Sundry function and class decorators.""" import functools import inspect import sys import textwrap import threading import types import warnings from functools import wraps from inspect import signature from types import FunctionType from .exceptions...
1,274
45,419
pyomo
pyomo/contrib/appsi/solvers/tests/test_persistent_solvers.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...
1,432
58,342
coremltools
coremltools/optimize/torch/_utils/optimizer_utils.py
.py
# Copyright (c) 2025, 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 typing import Type as _Type import torch as _torch from coremltools.optimize.torch._utils.pyth...
67
2,403
astropy
astropy/units/format/generic_parsetab.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/units # # You can then commit the changes...
101
13,879
pyomo
pyomo/core/base/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...
104
3,561
pdm
tests/fixtures/projects/flit-demo/flit.py
.py
"""An awesome flit demo""" __version__ = "0.1.0"
3
49
pyomo
pyomo/solvers/tests/models/MILP_infeasible1.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...
83
2,919
textual
docs/examples/guide/reactivity/watch01.py
.py
from textual.app import App, ComposeResult from textual.color import Color, ColorParseError from textual.containers import Grid from textual.reactive import reactive from textual.widgets import Input, Static class WatchApp(App): CSS_PATH = "watch01.tcss" color = reactive(Color.parse("transparent")) # (1)! ...
34
1,027
confluent-kafka-python
tests/test_unasync.py
.py
import os import tempfile import pytest from tools.unasync import unasync, unasync_file_check, unasync_line @pytest.fixture def temp_dirs(): """Create temporary directories for testing.""" with tempfile.TemporaryDirectory() as temp_dir: # Create async and sync directories async_dir = os.path...
191
5,609
saleor
saleor/graphql/invoice/tests/test_invoice_create.py
.py
import uuid import graphene import pytest from ....core import JobStatus from ....graphql.tests.utils import assert_no_permission, get_graphql_content from ....invoice.error_codes import InvoiceErrorCode from ....invoice.models import Invoice, InvoiceEvent, InvoiceEvents from ....order import OrderEvents, OrderStatus...
284
8,786
probability
spinoffs/autobnn/autobnn/kernels_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...
247
9,171
biopython
Bio/ExPASy/ScanProsite.py
.py
# Copyright 2009 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 for calling and parsing ScanProsite from ExPASy.""" from urllib.parse import urlencod...
152
5,284
openvino
src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/get_available_devices.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from utils.conformance_utils import get_logger from utils.constants import FULL_DEVICE_PROPERTY, SUPPORTED_PROPERTIES, DEVICE_ARCHITECTURE_PROPERTY logger = get_logger("get_available_device") try: from openvino import Core except: ...
55
2,781
pyomo
pyomo/core/base/matrix_constraint.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...
376
12,156
onnxruntime
tools/python/wgsl_template/__init__.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """WGSL template engine. The public entry point is :func:`build`, which orchestrates the load -> parse -> generate -> emit pipeline. """ from __future__ import annotations import os import shutil from collections.abc import...
147
4,690
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/kl_div_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...
31
1,033
cvxpy
cvxpy/reductions/dnlp2smooth/dnlp2smooth.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...
112
4,257
openvino
tests/layer_tests/tensorflow_tests/test_tf_ArgMinMax.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import platform import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest # Testing operation ArgMin, ArgMax (Initial Implementation) # Documentation: https://www.tensorflow.org/ap...
78
3,937
probability
tensorflow_probability/python/sts/holiday_effects.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...
167
6,116
pyro
tests/contrib/test_zuko.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro from pyro.contrib.zuko import ZukoToPyro from pyro.infer import SVI, Trace_ELBO from pyro.optim import Adam @pytest.mark.parametrize("multivariate", [True, False]) @pytest.mark.parametrize("rs...
66
1,671
astropy
astropy/io/registry/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Unified I/O Registry. """ from . import base, compat, core, interface from .base import * from .compat import * from .compat import _identifiers, _readers, _writers # for backwards compat from .core import * from .interface import * __all__ = core._...
14
379
hydra
build_helpers/build_helpers.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import codecs import errno import logging import os import re import shutil import subprocess from functools import partial from os.path import abspath, basename, dirname, exists, isdir, join from pathlib import Path from typing import List, Optiona...
239
6,947
coremltools
coremltools/optimize/torch/_utils/fsdp_utils.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 from abc import ABC as _ABC from abc import abstractmethod as _abstractmethod from functools import p...
92
3,756
wagtail
wagtail/admin/urls/password_reset.py
.py
from django.urls import path from wagtail.admin.views import account urlpatterns = [ path("", account.PasswordResetView.as_view(), name="wagtailadmin_password_reset"), path( "done/", account.PasswordResetDoneView.as_view(), name="wagtailadmin_password_reset_done", ), path( ...
23
610
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/radon_contextual_effects_indiana.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...
363
9,168
beam
sdks/python/apache_beam/io/gcp/spanner.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...
767
26,114
hydra
tests/test_apps/hydra_main_rerun/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra @hydra.main() def my_app(_: DictConfig) -> None: pass if __name__ == "__main__": my_app() my_app()
15
233
sqlmap
plugins/generic/filesystem.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import codecs import os import sys from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import checkFile from lib.core.common import dataToOu...
333
12,808
pyomo
pyomo/common/tests/test_enums.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...
134
5,127
metrics
tests/unittests/text/test_bleu.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...
144
5,602
hydra
tests/test_core_utils.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import sys from typing import Any from omegaconf import OmegaConf, open_dict from hydra._internal.config_loader_impl import ConfigLoaderImpl from hydra._internal.utils import create_config_search_path from hydra.core import utils from hydra.core.h...
37
1,408
gunicorn
tests/docker/asgi_compliance/test_lifespan_compliance.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Lifespan compliance integration tests for ASGI. Tests the ASGI lifespan protocol including startup, shutdown, and state sharing between lifespan and request handlers. """ import pytest pytestmark = [ pyt...
242
9,298
probability
tensorflow_probability/python/distributions/uniform.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...
268
9,771
lemur
lemur/dns_providers/schemas.py
.py
from marshmallow import fields from lemur.common.fields import ArrowDateTime from lemur.common.schema import LemurInputSchema, LemurOutputSchema class DnsProvidersNestedOutputSchema(LemurOutputSchema): __envelope__ = False id = fields.Integer() name = fields.String() provider_type = fields.String() ...
28
791
beam
sdks/python/apache_beam/testing/extra_assertions_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...
76
2,179
slimit
src/slimit/tests/test_mangler.py
.py
############################################################################### # # Copyright (c) 2011 Ruslan Spivak # # 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, inc...
160
4,699
mlflow
tests/genai/judges/test_judge_tool_get_span_image.py
.py
import base64 import json from typing import Any import mlflow from mlflow.genai.judges.tools.get_span_image import ( _ATTACHMENT_REF_RE, GetSpanImageTool, SpanImageResult, ) from mlflow.tracing.attachments import Attachment from mlflow.types.llm import ToolDefinition # 1x1 PNG-ish bytes; content is opaqu...
241
9,353
lemur
lemur/acme_providers/cli.py
.py
import json import time import arrow import click from flask import current_app from flask.cli import with_appcontext from sentry_sdk import capture_exception from lemur.common.utils import check_validation from lemur.constants import SUCCESS_METRIC_STATUS from lemur.plugins import plugins from lemur.plugins.lemur_ac...
206
6,361
saleor
saleor/graphql/order/tests/queries/test_order_total_balance.py
.py
from decimal import Decimal from .....core.prices import quantize_price from .....order.models import OrderGrantedRefund from .....payment.models import TransactionItem from ....tests.utils import get_graphql_content ORDERS_QUERY = """ query OrdersQuery { orders(first: 1) { edges { node { ...
350
10,638
wandb
wandb/integration/weave/weave.py
.py
"""Integration module for automatic Weave initialization with W&B. This module provides automatic initialization of Weave when: 1. Weave is installed 2. A W&B run is active with a project 3. Weave is imported (init-on-import) The integration can be disabled by setting the WANDB_DISABLE_WEAVE environment variable to a...
223
6,506
pyro
tests/params/conftest.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest def pytest_collection_modifyitems(items): for item in items: if item.nodeid.startswith("tests/params"): if "stage" not in item.keywords: item.add_marker(pytest.mark.stage("uni...
14
433
openvino
tests/e2e_tests/test_utils/env_tools.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from pathlib import Path class EnvironmentConfigException(Exception): """ Environment configuration exception """ class Environment: """ Environment used by tests. :attr env: environment dictionary. populated dynami...
45
1,381
onnxruntime
tools/python/wgsl_template/generator.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """PASS2: pattern matching, directives, and code generation. The state machine in :func:`_generate_impl` tracks parentheses, brackets, a function-call stack, the ``$MAIN`` context, and a separate output bucket for ``#if``/``#...
783
34,504
loguru
tests/exceptions/source/ownership/assertion_from_lib.py
.py
import sys import _init from somelib import assertionerror from loguru import logger def test(*, backtrace, colorize, diagnose): logger.remove() logger.add(sys.stderr, format="", colorize=colorize, backtrace=backtrace, diagnose=diagnose) try: a, b = 1, 2 assertionerror(a, b) except ...
25
629
onnxruntime
onnxruntime/python/tools/transformers/models/bart/utils/export_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. # -------------------------------------------------------------------------- import...
172
6,292
openvino
tests/layer_tests/tensorflow_tests/test_tf_ApproximateEqual.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import tensorflow as tf import pytest from common.tf_layer_test_class import CommonTFLayerTest class TestApproximateEqual(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_r...
46
1,986
onnxruntime
onnxruntime/lora/adapter_format/compile_schema.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import pathlib import subprocess SCRIPT_DIR = pathlib.Path(__file__).parent.resolve() def generate_cpp(flatc: pathlib.Path, schema_path: pathlib.Path): # run flatc to generate C++...
56
1,635
flit
tests/test_config.py
.py
from pathlib import Path import pytest from flit.config import read_flit_config, ConfigError samples_dir = Path(__file__).parent / 'samples' def test_invalid_classifier(): with pytest.raises(ConfigError): read_flit_config(samples_dir / 'invalid_classifier.toml')
11
278
pymc
pymc/model/transform/basic.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...
84
3,285
saleor
saleor/graphql/order/tests/mutations/test_order_capture.py
.py
from unittest.mock import ANY, call, patch import graphene from django.test import override_settings from .....core.models import EventDelivery from .....core.notify import NotifyEventType from .....core.tests.utils import get_site_context_payload from .....order import OrderOrigin, OrderStatus from .....order import...
389
13,524
wandb
tests/system_tests/test_functional/interrupt/pass_if_interrupted.py
.py
"""Starts a W&B run and exits with code 1 if it's not interrupted.""" from __future__ import annotations import sys import time import wandb import wandb.sdk.lib.run_stopping if __name__ == "__main__": # The stop status is delivered via a FileStream response. settings = wandb.Settings(x_file_stream_transmit...
36
1,155
conda
tests/auxlib/test_logz.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations from requests import Request, Response from conda.auxlib.logz import stringify def test_stringify_json_response(): request = Request("GET", "https://example.com/api/endpoint").prepare() response = R...
24
679
omegaconf
omegaconf/_utils.py
.py
import copy import dataclasses import os import pathlib import re import string import sys import types import warnings from enum import Enum from textwrap import dedent from typing import ( TYPE_CHECKING, Any, Dict, FrozenSet, List, Literal, Optional, Tuple, Type, Union, get...
1,519
51,394
pyro
tests/infer/reparam/test_unit_jacobian.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from torch.autograd import grad import pyro import pyro.distributions as dist from pyro import poutine from pyro.distributions.transforms import Permute from pyro.infer.reparam import UnitJacobianReparam fro...
72
2,597
coremltools
coremltools/test/ml_program/experimental/test_remote_device.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 import random import platform import subprocess import tempfile import time from pathlib import Path fro...
437
14,746
onnx
onnx/backend/sample/ops/__init__.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import importlib import inspect import pkgutil import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from types import ModuleType def collect_sample_implementations() -> dict[str, str]: ...
31
862
saleor
saleor/graphql/discount/tests/benchmark/test_promotions.py
.py
import pytest from ....tests.utils import get_graphql_content PROMOTIONS_QUERY = """ query { promotions(first: 10) { edges { node { id name description startDate endDate createdAt up...
64
1,429
probability
tensorflow_probability/python/vi/optimization_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...
384
16,200
openvino
tests/model_hub_tests/performance_tests/conftest.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import inspect import pytest from models_hub_common.utils import get_params from py.xml import html from models_hub_common.utils import round_num import json import requests from datetime import datetime def pytest_sessionstart(sessio...
81
2,940
probability
tensorflow_probability/python/bijectors/restructure_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 o...
194
6,889
mlflow
mlflow/store/artifact/artifact_repo.py
.py
import json import logging import os import posixpath import re import tempfile import traceback import uuid from abc import ABC, ABCMeta, abstractmethod from concurrent.futures import ThreadPoolExecutor, as_completed from contextlib import contextmanager from pathlib import Path from typing import TYPE_CHECKING, Any, ...
833
33,271
qutip
qutip/tests/core/test_operators.py
.py
import numbers import numpy as np import pytest import qutip N = 5 def test_jmat_12(): spinhalf = qutip.jmat(1 / 2.) paulix = np.array([[0. + 0.j, 1. + 0.j], [1. + 0.j, 0. + 0.j]]) pauliy = np.array([[0. + 0.j, 0. - 1.j], [0. + 1.j, 0. + 0.j]]) pauliz = np.array([[1. + 0.j, 0. + 0.j], [0. + 0.j, -1...
439
15,399
saleor
saleor/graphql/page/tests/queries/pages_with_where/shared.py
.py
QUERY_PAGES_WITH_WHERE = """ query ($where: PageWhereInput) { pages(first: 5, where:$where) { totalCount edges { node { id } } } } """
13
247
mlflow
mlflow/mcp/decorator.py
.py
""" Decorator for exposing MLflow CLI commands as MCP tools. Usage: from mlflow.mcp.decorator import mlflow_mcp @commands.command("search") @mlflow_mcp(tool_name="search_traces") @click.option(...) def search_traces(...): ... The decorator attaches MCP metadata to the Click command, which...
75
2,043
ipython
IPython/terminal/shortcuts/__init__.py
.py
""" Module to define and register Terminal IPython shortcuts with :mod:`prompt_toolkit` """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import signal import sys import warnings from dataclasses import dataclass from typing import Any from collections....
640
18,609
gunicorn
examples/celery_alternative/tasks.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Task Workers - Celery Replacement using Gunicorn Dirty Arbiters This module demonstrates how to replace Celery with Gunicorn's dirty arbiter feature for background task processing. Key benefits: 1. No externa...
568
18,234
saleor
saleor/tests/e2e/orders/utils/order_fulfill_add_tracking.py
.py
from ...utils import get_graphql_content ORDER_FULFILLMENT_UPDATE_TRACKING = """ mutation OrderFulfillmentUpdateTracking( $id: ID! $input: FulfillmentUpdateTrackingInput! ) { orderFulfillmentUpdateTracking(id: $id, input: $input) { errors { message code field } order { id ...
51
998
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/flatmap_side_inputs_singleton.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");...
62
1,924
saleor
saleor/graphql/giftcard/mutations/__init__.py
.py
from .gift_card_activate import GiftCardActivate from .gift_card_add_note import GiftCardAddNote from .gift_card_assign_user import GiftCardAssignUser from .gift_card_balance_adjust import GiftCardBalanceAdjust from .gift_card_create import GiftCardCreate from .gift_card_deactivate import GiftCardDeactivate from .gift_...
24
761