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
sqlmap
lib/request/chunkedhandler.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.data import conf from lib.core.enums import HTTP_HEADER from thirdparty.six.moves import urllib as _urllib class ChunkedHandler(_urllib.request.HTTPHandler): ""...
50
2,139
ipython
IPython/utils/strdispatch.py
.py
"""String dispatch class to match regexps and dispatch commands. """ # Stdlib imports import re # Our own modules from IPython.core.hooks import CommandChainDispatcher from collections.abc import Callable # Code begins class StrDispatch: """Dispatch (lookup) a set of strings / regexps for match. Example: ...
70
1,893
onnxruntime
onnxruntime/python/tools/quantization/execution_providers/qnn/mixed_precision_overrides_utils.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from __fut...
414
18,582
saleor
saleor/checkout/base_calculations.py
.py
"""Contains functions which are base for calculating checkout properties. It's recommended to use functions from calculations.py module to take in account plugin manager. Functions from this module return price without taxes (Money instead of TaxedMoney). If you don't need pre-taxed prices use functions from calculati...
328
11,249
gunicorn
gunicorn/app/pasterapp.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import configparser import os from paste.deploy import loadapp from gunicorn.app.wsgiapp import WSGIApplication from gunicorn.config import get_default_config_file def get_wsgi_app(config_uri, name=None, defaul...
75
2,016
textual
src/textual/await_remove.py
.py
""" An *optionally* awaitable object returned by methods that remove widgets. """ from __future__ import annotations import asyncio from asyncio import Task, gather from typing import Generator import rich.repr from textual._callback import invoke from textual._debug import get_caller_file_and_line from textual._ty...
48
1,345
saleor
saleor/graphql/discount/mutations/sale/sale_delete.py
.py
import graphene from django.db.models import Exists, OuterRef from .....core.tracing import traced_atomic_transaction from .....discount import models from .....discount.error_codes import DiscountErrorCode from .....graphql.core.mutations import ModelDeleteMutation from .....permission.enums import DiscountPermission...
112
4,109
mlflow
mlflow/anthropic/genai_semconv_converter.py
.py
import json from typing import Any from mlflow.tracing.constant import GenAiSemconvKey from mlflow.tracing.export.genai_semconv.converter import GenAiSemconvConverter class AnthropicConverter(GenAiSemconvConverter): def convert_inputs(self, inputs: dict[str, Any]) -> list[dict[str, Any]] | None: messages...
102
3,971
django-cms
cms/test_utils/project/urls_for_apphook_tests.py
.py
from django.conf import settings from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.urls import include, re_path from django.views.i18n import JavaScriptCatalog from django.views.static import serve from cms.utils.conf import get_cms_setting admin.autodiscover() urlpatterns ...
24
799
qutip
qutip/cite.py
.py
""" Citation generator for QuTiP """ from pathlib import Path __all__ = ['cite'] def cite(save=False, path=None): """ Citation information and bibtex generator for QuTiP Parameters ---------- save: bool The flag specifying whether to save the .bib file. path: str The complet...
55
1,413
pyomo
pyomo/core/plugins/transform/standard_form.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...
74
2,872
textual
tests/test_disabled.py
.py
"""Test Widget.disabled.""" import pytest from textual.app import App, ComposeResult from textual.containers import Vertical, VerticalScroll from textual.widgets import ( Button, Checkbox, DataTable, DirectoryTree, Input, Label, ListItem, ListView, Markdown, MarkdownViewer, ...
150
4,664
pymc
tests/tuning/test_starting.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...
168
5,765
returns
tests/test_examples/test_your_container/test_pair1.py
.py
from collections.abc import Callable from typing import TypeVar, final from returns.interfaces import bindable, equable, lashable, swappable from returns.primitives.container import BaseContainer, container_equality from returns.primitives.hkt import Kind2, SupportsKind2, dekind _FirstType = TypeVar('_FirstType') _Se...
85
2,368
wandb
wandb/apis/public/reports.py
.py
"""W&B Public API for Report objects. This module provides classes for interacting with W&B reports and managing report-related data. """ from __future__ import annotations import ast import json import re import urllib from typing import TYPE_CHECKING, Any import wandb from wandb._strutils import nameof from wandb...
629
20,679
openvino
tests/layer_tests/tensorflow2_keras_tests/conftest.py
.py
import inspect import logging as log import os from pathlib import Path import pytest from common.layer_test_class import get_params from common.logger import * from common.utils.common_utils import copy_files_by_pattern def pytest_generate_tests(metafunc): test_gen_attrs_names = list(inspect.signature(get_param...
17
507
onnxruntime
onnxruntime/python/tools/quantization/execution_providers/qnn/preprocess.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from __fut...
354
16,383
saleor
saleor/graphql/app/tests/queries/test_app.py
.py
import datetime from unittest.mock import Mock, patch import graphene import pytest from freezegun import freeze_time from .....app.models import App from .....app.types import AppType from .....core.jwt import create_access_token_for_app, jwt_decode from .....thumbnail import IconThumbnailFormat from .....thumbnail....
812
22,051
textual
src/textual/__main__.py
.py
from rich import print from rich.panel import Panel from textual.demo.demo_app import DemoApp if __name__ == "__main__": app = DemoApp() app.run() print( Panel.fit( "[b magenta]Hope you liked the demo![/]\n\n" "Please consider sponsoring me if you get value from my work.\n\...
20
563
returns
returns/pointfree/bind_optional.py
.py
from collections.abc import Callable from typing import TypeVar from returns.interfaces.specific.maybe import MaybeLikeN from returns.primitives.hkt import Kinded, KindN, kinded _FirstType = TypeVar('_FirstType') _SecondType = TypeVar('_SecondType') _ThirdType = TypeVar('_ThirdType') _UpdatedType = TypeVar('_UpdatedT...
59
1,761
saleor
saleor/core/management/commands/cleardb.py
.py
"""Clear the database preserving shop's configuration. This command clears the database from data such as orders, products or customer accounts. It doesn't remove shop's configuration, such as: staff accounts, service accounts, plugin configurations, site settings or navigation menus. """ from django.conf import sett...
119
4,131
mlflow
mlflow/demo/generators/review_queues.py
.py
from __future__ import annotations import logging from typing import Any import mlflow from mlflow.demo.base import ( DEMO_EXPERIMENT_NAME, BaseDemoGenerator, DemoFeature, DemoResult, ) from mlflow.exceptions import MlflowException from mlflow.genai.label_schemas import InputCategorical, InputPassFail...
190
7,827
wagtail
wagtail/permission_policies/pages.py
.py
import swapper from django.contrib.auth import get_user_model from django.db.models import Q from wagtail.models import GroupPagePermission from wagtail.permission_policies.base import OwnershipPermissionPolicy class PagePermissionPolicy(OwnershipPermissionPolicy): """ A permission policy for page objects, w...
232
9,253
python-prompt-toolkit
src/prompt_toolkit/lexers/pygments.py
.py
""" Adaptor classes for using Pygments lexers within prompt_toolkit. This includes syntax synchronization code, so that we don't have to start lexing at the beginning of a document, when displaying a very large text. """ from __future__ import annotations import re from abc import ABCMeta, abstractmethod from collec...
330
11,942
pyomo
pyomo/contrib/cp/tests/test_docplex_walker.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,915
67,819
onnxruntime
plugin-ep-webgpu/python/test/test_webgpu_plugin_ep.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Smoke test for the onnxruntime-ep-webgpu Python package. Tests: 1. Package import and library path resolution 2. EP registration with ONNX Runtime 3. Device discovery 4. Inference with a simple Mul...
200
7,351
saleor
saleor/core/transactions.py
.py
from contextlib import contextmanager from django.db import DatabaseError from ..core.tracing import traced_atomic_transaction @contextmanager def transaction_with_commit_on_errors(): """Perform transaction and raise an error in any occurred.""" error = None with traced_atomic_transaction(): try...
21
475
returns
tests/test_examples/test_your_container/test_pair2.py
.py
from abc import abstractmethod from collections.abc import Callable from typing import Never, TypeVar, final from returns.interfaces import bindable, equable, lashable, swappable from returns.primitives.container import BaseContainer, container_equality from returns.primitives.hkt import Kind2, KindN, SupportsKind2, d...
154
4,549
probability
tensorflow_probability/python/distributions/gaussian_process_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...
598
24,479
openvino
src/frontends/onnx/tests/tests_python/test_zoo_models.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tests import logging import pprint from operator import itemgetter from pathlib import Path from typing import Any from collections.abc import Sequence import numpy as np from tests.tests_python.utils import OpenVinoOnnxBackend f...
228
10,886
astropy
astropy/io/misc/pandas/connect.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file connects the readers/writers to the astropy.table.Table class import functools from pathlib import Path import astropy.io.registry as io_registry from astropy.table import Table from astropy.utils.compat.optional_deps import ( HAS_BS4, ...
95
3,190
kafka
tests/kafkatest/tests/core/upgrade_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 ...
189
10,858
saleor
saleor/graphql/shipping/mutations/__init__.py
.py
from .shipping_method_channel_listing_update import ShippingMethodChannelListing from .shipping_price_create import ShippingPriceCreate from .shipping_price_delete import ShippingPriceDelete from .shipping_price_exclude_products import ShippingPriceExcludeProducts from .shipping_price_remove_product_from_exclude import...
24
873
confluent-kafka-python
tests/test_kafka_batch_executor.py
.py
#!/usr/bin/env python3 """ Unit tests for the KafkaBatchExecutor class (_kafka_batch_executor.py) This module tests the KafkaBatchExecutor class to ensure proper Kafka batch execution and partial failure handling. """ import asyncio import concurrent.futures import os import sys import unittest from unittest.mock imp...
141
5,238
onnxruntime
onnxruntime/python/tools/quantization/operators/direct_q8.py
.py
from ..quant_utils import TENSOR_NAME_QUANT_SUFFIX, QuantizedValue, QuantizedValueType from .base_operator import QuantOperatorBase from .qdq_base_operator import QDQOperatorBase # For operators that support 8bits operations directly, and output could # reuse input[0]'s type, zeropoint, scale; For example,Transpose, ...
79
3,311
astropy
astropy/utils/masked/tests/test_table.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.table import QTable, hstack, join, vstack from astropy.utils.compat.optional_deps import HAS_H5PY from astropy.utils.masked import M...
172
6,605
saleor
saleor/graphql/product/bulk_mutations/product_media_bulk_delete.py
.py
import graphene from django.conf import settings from ....permission.enums import ProductPermissions from ....product import models from ...core.mutations import ModelBulkDeleteMutation from ...core.types import NonNullList, ProductError from ..types import ProductMedia class ProductMediaBulkDelete(ModelBulkDeleteMu...
30
1,009
mlflow
tests/tracing/export/test_inference_table_exporter.py
.py
import json from unittest import mock import pytest import mlflow from mlflow.entities import LiveSpan, Trace from mlflow.entities.model_registry import PromptVersion from mlflow.entities.trace_info import TraceInfo from mlflow.tracing.constant import TraceMetadataKey, TraceSizeStatsKey from mlflow.tracing.export.inf...
503
18,865
coremltools
coremltools/models/neural_network/printer.py
.py
# Copyright (c) 2018, 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 .spec_inspection_utils import (_get_feature_description_summary, ...
115
3,748
openvino
src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/stat_update_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import math import xml.etree.ElementTree as ET from . import conformance_utils def update_rel_values(xml_node: ET.SubElement): if xml_node is None or len(xml_node.attrib) == 0: return if not "relative_all" in xml_node.a...
89
4,121
mkdocs-material
material/plugins/social/layout.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...
154
5,020
python-prompt-toolkit
tests/test_shortcuts.py
.py
from __future__ import annotations from prompt_toolkit.shortcuts import print_container from prompt_toolkit.shortcuts.prompt import _split_multiline_prompt from prompt_toolkit.widgets import Frame, TextArea def test_split_multiline_prompt(): # Test 1: no newlines: tokens = [("class:testclass", "ab")] has...
69
2,227
scikit-bio
skbio/tree/_utils.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
91
2,996
mlflow
examples/shap/multiclass_classification.py
.py
import os import numpy as np import shap from sklearn.datasets import load_iris from sklearn.ensemble import RandomForestClassifier import mlflow from mlflow.artifacts import download_artifacts from mlflow.tracking import MlflowClient # prepare training data X, y = load_iris(return_X_y=True, as_frame=True) # train...
38
1,050
qutip
qutip/core/states.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['basis', 'qutrit_basis', 'coherent', 'coherent_dm', 'fock_dm', 'fock', 'thermal_dm', 'maximally_mixed_dm', 'ket2dm', 'projection', 'qstate', 'ket', 'bra', 'state_number_enumerate', 'state...
1,420
40,836
hatch
src/hatch/cli/project/__init__.py
.py
import click from hatch.cli.project.metadata import metadata @click.group(short_help="View project information") def project(): pass project.add_command(metadata)
12
172
qutip
qutip/__init__.py
.py
import os import warnings import qutip.settings from qutip.settings import settings import qutip.version from qutip.version import version as __version__ # ----------------------------------------------------------------------------- # Look to see if we are running with OPENMP # # Set environ variable to determin if r...
65
1,555
textual
tests/snapshot_tests/snapshot_apps/alignment_containers.py
.py
""" App to test alignment containers. """ from textual.app import App, ComposeResult from textual.containers import Center, Middle from textual.widgets import Button class AlignContainersApp(App[None]): CSS = """ Center { tint: $primary 10%; } Middle { tint: $accent 10%; } """...
30
562
clearml
clearml/backend_interface/task/models.py
.py
import re import typing from typing import Any from collections import OrderedDict from collections.abc import KeysView try: from collections import UserList except ImportError: UserList = list try: from collections import UserDict except ImportError: UserDict = dict from clearml.backend_api import S...
122
4,067
pyomo
pyomo/contrib/gdp_bounds/tests/test_gdp_bounds.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...
109
4,375
pyomo
pyomo/gdp/tests/test_bound_pretransformation.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,159
38,549
pyomo
examples/pyomobook/overview-ch/wl_mutable_excel.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...
35
1,292
openvino
tools/commit_slider/tests/test_data.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from enum import Enum import json from utils.cfg_manager import CfgManager class TestData(): __test__ = False actualDataReceived = False # prevent slider running before config actualized def getTestCase(): return T...
580
16,182
saleor
saleor/webhook/observability/tracing.py
.py
from contextlib import contextmanager from ...core.telemetry import saleor_attributes, tracer @contextmanager def otel_trace(span_name, component): with tracer.start_as_current_span(f"observability.{span_name}") as span: span.set_attribute(saleor_attributes.COMPONENT, component) yield
11
309
rq
rq/cron.py
.py
from __future__ import annotations import importlib.util import json import logging import os import signal import socket import sys import time import uuid from collections.abc import Callable, Sequence from datetime import datetime, timedelta, timezone from typing import Any from croniter import croniter from redis...
718
27,978
pyomo
pyomo/gdp/tests/test_binary_multiplication.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...
311
12,217
pdm
src/pdm/builders/editable.py
.py
from __future__ import annotations import os from pdm.builders.base import EnvBuilder, wrap_error class EditableBuilder(EnvBuilder): """Build egg-info in isolated env with managed Python.""" @wrap_error def prepare_metadata(self, out_dir: str) -> str: if self.isolated: self.install(...
28
1,060
metrics
tests/unittests/multimodal/test_clip_score.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...
349
13,953
openvino
src/frontends/tensorflow/tests/test_models/models_pbtxt/forward_edge_model.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: const2 = tf.constant(2.0, dtype=tf.float32) x = tf.placeholder(dtype=tf.float32, shape=[2, 3], name='x') relu = tf.nn.relu(x) add = ...
20
584
wagtail
wagtail/admin/tests/pages/test_page_usage.py
.py
from django.test import TestCase from django.urls import reverse from wagtail.test.testapp.models import ( FormPageWithRedirect, PageChooserModel, SimplePage, ) from wagtail.test.utils import Page, WagtailTestUtils from wagtail.test.utils.template_tests import AdminTemplateTestUtils class TestPageUsage(A...
129
5,065
saleor
saleor/asgi/tests/test_gzip.py
.py
import gzip from unittest import mock from asgiref.typing import ( ASGI3Application, ASGIReceiveEvent, HTTPResponseBodyEvent, HTTPResponseStartEvent, HTTPScope, ) from ..gzip_compression import gzip_compression def build_scope(origin: str, encodings: bytes) -> HTTPScope: return { "ty...
208
6,867
onnxruntime
onnxruntime/python/onnxruntime_collect_build_info.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import ctypes import sys import warnings def find_cudart_versions(build...
48
2,062
onnxruntime
orttraining/orttraining/python/training/api/module.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from __future__ import annotations import os import numpy as np from onnxruntime.capi import _pybind_state as C from onnxruntime.capi.onnxruntime_inference_collection import OrtValue, get_ort_device_type from onnxruntime.c...
213
7,762
clearml
clearml/automation/parameters.py
.py
import sys from itertools import product from random import Random as BaseRandom from typing import Mapping, Sequence, Optional, Union, Any class RandomSeed: """ The base class controlling random sampling for every optimization strategy. """ _random = BaseRandom(1337) _seed = 1337 @staticmet...
389
12,982
saleor
saleor/graphql/payment/tests/mutations/test_checkout_payment_create.py
.py
from decimal import Decimal from unittest.mock import patch import graphene import pytest from django.utils import timezone from .....checkout import calculations from .....checkout.error_codes import CheckoutErrorCode from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from .....checkout.tests....
938
30,720
wandb
wandb/sdk/lib/import_hooks.py
.py
"""Implements a post-import hook mechanism. Styled as per PEP-369. Note that it doesn't cope with modules being reloaded. Note: This file is based on https://github.com/GrahamDumpleton/wrapt/blob/1.12.1/src/wrapt/importer.py and manual backports of later patches up to 1.15.0 in the wrapt repository (with slight modif...
277
10,285
mlflow
mlflow/store/db/__init__.py
.py
# Note: workspace_migration is not imported here to avoid loading sqlalchemy # at import time (breaks skinny client). Import directly from the module when needed.
3
163
pyomo
examples/doc/samples/case_studies/diet/DietProblem.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...
47
1,565
qutip
qutip/tests/solver/heom/test_bofin_baths.py
.py
""" Tests for qutip.solver.heom.bofin_baths. """ import numpy as np import pytest from qutip import spre, spost, sigmax, sigmaz from qutip.core import data as _data from qutip.solver.heom.bofin_baths import ( BathExponent, Bath, BosonicBath, DrudeLorentzBath, DrudeLorentzPadeBath, UnderDampedB...
467
15,913
saleor
saleor/graphql/app/tests/mutations/test_app_update.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....app.error_codes import AppErrorCode from .....app.models import App, AppToken from .....core.utils.json_serializer import CustomJsonEncoder from .....web...
559
16,325
openvino
tests/layer_tests/tensorflow_tests/test_tf_SwitchMerge.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 class TestSwitchMerge(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'x:0' in inputs_info ...
105
4,505
confluent-kafka-python
tests/integration/schema_registry/_sync/test_dlq.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2026 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
105
3,690
wandb
tests/system_tests/test_launch/test_launch_sweep_cli.py
.py
import json import subprocess import pytest import wandb from wandb.apis.internal import InternalApi from wandb.apis.public import Api from wandb.sdk.launch.utils import LAUNCH_DEFAULT_PROJECT def _run_cmd_check_msg(cmd: list[str], assert_str: str, *, check: bool = True) -> None: """Helper for asserting a statem...
259
7,672
python-prompt-toolkit
examples/progress-bar/simple-progress-bar.py
.py
#!/usr/bin/env python """ A very simple progress bar which keep track of the progress as we consume an iterator. """ import time from prompt_toolkit.shortcuts import ProgressBar def main(): with ProgressBar() as pb: for i in pb(range(800)): time.sleep(0.01) if __name__ == "__main__": m...
20
326
saleor
saleor/payment/gateways/stripe/stripe_api.py
.py
import logging from contextlib import contextmanager from decimal import Decimal from urllib.parse import urljoin import stripe from django.urls import reverse from stripe.error import AuthenticationError, InvalidRequestError, StripeError from stripe.stripe_object import StripeObject from ....core.tracing import otel...
320
10,082
probability
tensorflow_probability/python/experimental/nn/losses/losses.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...
67
2,267
mlflow
mlflow/crewai/__init__.py
.py
""" The ``mlflow.crewai`` module provides an API for tracing CrewAI AI agents. """ import importlib import logging from packaging.version import Version from mlflow.crewai.autolog import ( patched_class_call, patched_native_tool_call, patched_standalone_call, ) from mlflow.telemetry.events import Autolog...
126
4,681
astropy
astropy/io/registry/tests/test_registries.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test :mod:`astropy.io.registry`. .. todo:: Don't rely on Table for tests """ import os from collections import Counter from copy import deepcopy from io import StringIO import numpy as np import pytest import astropy.units as u from astropy....
1,305
49,834
sphinx
tests/roots/test-ext-autodoc/target/private.py
.py
def private_function(name): """private_function is a docstring(). :meta private: """ def _public_function(name): """public_function is a docstring(). :meta public: """ PRIVATE_CONSTANT = None #: :meta private: _PUBLIC_CONSTANT = None #: :meta public: class Foo: #: A public class at...
29
557
astropy
astropy/wcs/wcsapi/low_level_api.py
.py
import abc import os import numpy as np __all__ = ["BaseLowLevelWCS", "validate_physical_types"] class BaseLowLevelWCS(metaclass=abc.ABCMeta): """ Abstract base class for the low-level WCS interface. This is described in `APE 14: A shared Python interface for World Coordinate Systems <https://zenod...
371
15,924
openvino
src/bindings/python/tests/test_transformations/utils/utils.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Model, PartialShape from openvino import opset13 as ops from openvino.passes import ModelPass, Matcher, MatcherPass, WrapType def get_relu_model(): # Parameter->Relu->Result param = ...
79
2,237
pyro
pyro/contrib/epidemiology/util.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import numpy as np import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.distributions.util import broadcast_shape from pyro.ops.special import safe_log def clamp(tensor, *, min=None, ma...
380
10,993
clearml
clearml/backend_api/session/jsonmodels/errors.py
.py
class ValidationError(RuntimeError): pass class FieldNotFound(RuntimeError): pass class FieldNotSupported(ValueError): pass
11
140
pyro
pyro/contrib/tracking/extended_kalman_filter.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions.utils import lazy_property import pyro.distributions as dist from pyro.distributions.util import eye_like class EKFState: """ State-Centric EKF (Extended Kalman Filter) for use with ...
228
7,796
onnxruntime
onnxruntime/test/python/onnxruntime_test_engine_wrapper.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import unittest import numpy as np import onnx from helper import get_name from onnx import TensorProto, helper import onnxruntime as onnxrt class TestInferenceSessionWithCtxNode(unittest.TestCase): trt_engi...
101
3,271
astropy
astropy/modeling/tests/test_statistics.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Module to test statistic functions """ import numpy as np # pylint: disable=invalid-name import pytest from numpy.testing import assert_almost_equal from astropy.modeling.models import Identity, Mapping from astropy.modeling.statistic import ( l...
91
2,990
lemur
lemur/auth/ldap.py
.py
""" .. module: lemur.auth.ldap :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Ian Stahnke <ian.stahnke@myob.com> """ import ldap from ldap.filter import escape_filter_chars from flask import current_app from lemur...
231
8,866
beam
sdks/python/apache_beam/typehints/sharded_key_type_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...
88
3,551
metrics
src/torchmetrics/image/uqi.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...
171
6,843
wagtail
wagtail/admin/telepath/__init__.py
.py
from django import forms from telepath import Adapter, AdapterRegistry, JSContextBase class WagtailJSContextBase(JSContextBase): @property def base_media(self): # Do not include the telepath.js file in the base media, as it is already included # globally in admin_base.html. return form...
71
1,638
mamba
micromamba/tests/test_shell.py
.py
import json import os import platform import shutil import subprocess import sys from pathlib import Path, PureWindowsPath import pytest from . import helpers def skip_if_shell_incompat(shell_type): """Skip test if ``shell_type`` is incompatible with the platform""" plat_system = platform.system() if ( ...
343
12,294
sqlmap
tamper/plus2concat.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 re from lib.core.common import singleTimeWarnMessage from lib.core.common import zeroDepthSearch from lib.core.enums import DBMS from lib.core.enums import PRIOR...
56
1,801
beam
sdks/python/apache_beam/runners/interactive/options/capture_control.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...
76
2,765
pdm
src/pdm/resolver/__init__.py
.py
from .base import Resolver from .resolvelib import RLResolver from .uv import UvResolver __all__ = ["RLResolver", "Resolver", "UvResolver"]
6
141
probability
tensorflow_probability/python/distributions/dirichlet_multinomial_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...
554
21,828
biopython
Tests/test_pairwise2_no_C.py
.py
# This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for pairwise2 module using the pure Python fallback functions. This test file imports the TestCases from ``pairwise2_testCases.py``. If you w...
33
1,150
conda
conda/core/package_cache_data.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tools for managing the package cache (previously downloaded packages).""" from __future__ import annotations import multiprocessing import os from collections import defaultdict from concurrent.futures import ( CancelledError, Proce...
1,127
44,856
mkdocs
docs/hooks.py
.py
from __future__ import annotations import re from pathlib import Path from typing import TYPE_CHECKING if TYPE_CHECKING: from mkdocs.config.defaults import MkDocsConfig from mkdocs.structure.nav import Page def _get_language_of_translation_file(path: Path) -> str: with path.open(encoding='utf-8') as f: ...
37
1,155
hydra
hydra/plugins/launcher.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Launcher plugin interface """ from abc import abstractmethod from typing import Sequence from omegaconf import DictConfig from hydra.core.utils import JobReturn from hydra.types import TaskFunction, HydraContext from .plugin import Plugin ...
41
975
mlflow
tests/llama_index/sample_code/simple_workflow.py
.py
from llama_index.core.workflow import ( Event, StartEvent, StopEvent, Workflow, step, ) from llama_index.llms.openai import OpenAI import mlflow class JokeEvent(Event): joke: str class JokeFlow(Workflow): llm = OpenAI() @step async def generate_joke(self, ev: StartEvent) -> Jok...
38
860