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 |
|---|---|---|---|---|---|
coremltools | coremltools/converters/mil/mil/ops/defs/iOS18/__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
from coremltools.converters.mil._deployment_compatibility import AvailableTarget as target
from corem... | 23 | 821 |
scikit-bio | skbio/tree/tests/test_me.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.
# --------------------------------------------... | 2,090 | 86,880 |
records | setup.py | .py | #!/usr/bin/env python
import io
import os
import sys
from codecs import open
from shutil import rmtree
from setuptools import setup, Command
here = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = "\n" + f.read()
class PublishC... | 107 | 2,984 |
pyro | pyro/poutine/broadcast_messenger.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from typing import TYPE_CHECKING, List, Optional
from pyro.distributions.torch_distribution import TorchDistributionMixin
from pyro.poutine.messenger import Messenger
from pyro.util import ignore_jit_warnings
if TYPE_CHECKING:
... | 94 | 3,722 |
saleor | saleor/tests/e2e/transactions/utils/transaction_create.py | .py | from ...utils import get_graphql_content
TRANSACTION_CREATE_MUTATION = """
mutation TransactionCreate($id: ID!, $transactionCreateInput: TransactionCreateInput!) {
transactionCreate(id: $id, transaction: $transactionCreateInput) {
errors {
field
message
code
}
transaction {
id
... | 80 | 2,237 |
sqlmap | lib/techniques/xxe/inject.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import re
import time
from lib.core.common import beep
from lib.core.common import dataToOutFile
from lib.core.common import randomStr
from lib.core.common import readInput
from ... | 1,105 | 52,576 |
biopython | Bio/PDB/PDBList.py | .py | #!/usr/bin/env python
# Copyright 2003, by Kristian Rother. All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
#... | 806 | 31,347 |
saleor | saleor/plugins/webhook/tests/test_transaction_initialize_session_webhook.py | .py | import json
import uuid
from decimal import Decimal
from unittest import mock
import graphene
from freezegun import freeze_time
from ....channel import TransactionFlowStrategy
from ....core import EventDeliveryStatus
from ....core.models import EventDelivery, EventPayload
from ....payment.interface import (
Payme... | 843 | 24,113 |
sqlmap | tamper/space2comment.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.compat import xrange
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Repla... | 61 | 1,461 |
clearml | clearml/backend_interface/logger.py | .py | import logging
import sys
from time import time
from typing import Optional, Callable, Any
from ..binding.frameworks import _patched_call # noqa
from ..config import running_remotely, config, DEBUG_SIMULATE_REMOTE_TASK
from ..utilities.process.mp import ForkSafeRLock
class StdStreamPatch:
_stdout_proxy = None
... | 350 | 13,398 |
kombu | examples/memory_transport.py | .py | """
Example that use memory transport for message produce.
"""
from __future__ import annotations
import time
from kombu import Connection, Consumer, Exchange, Queue
media_exchange = Exchange('media', 'direct')
video_queue = Queue('video', exchange=media_exchange, routing_key='video')
task_queues = [video_queue]
d... | 32 | 755 |
jupytext | tests/unit/test_cell_id.py | .py | from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_raw_cell
def test_cell_id_is_not_random():
assert new_code_cell().id == "cell-1"
assert new_code_cell().id == "cell-2"
assert new_markdown_cell().id == "cell-3"
assert new_raw_cell().id == "cell-4"
| 9 | 285 |
openvino | tests/layer_tests/pytorch_tests/test_atan2.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from pytorch_layer_test_class import PytorchLayerTest
@pytest.mark.parametrize("input_shape_rhs", [
[2, 5, 3, 4],
[1, 5, 3, 4],
[1]
])
class TestAtan2(PytorchLayerTest):
def _prepare_input(se... | 145 | 5,695 |
biopython | Bio/Pathway/Rep/__init__.py | .py | # Copyright 2001 by Tarjei Mikkelsen. All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""BioPython Pathway s... | 15 | 575 |
readthedocs.org | readthedocs/metrics/tasks.py | .py | """
Specific metric tasks for community.
Override the base metric tasks to add specific ones only required on community.
"""
# Disable import error because -ext is not available on pylint
# pylint: disable=import-error
from readthedocsext.monitoring.metrics.database import AvgBuildTimeMetric
from readthedocsext.monit... | 45 | 1,746 |
sphinx | sphinx/domains/python/__init__.py | .py | """The Python domain."""
from __future__ import annotations
import builtins
import inspect
import typing
from types import NoneType
from typing import TYPE_CHECKING, NamedTuple, cast
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx import addnodes
from sphinx.domains import Domain,... | 1,132 | 38,798 |
coveragepy | tests/modules/pkg1/p1a.py | .py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt
import os, sys
# Invoke functions in os and sys so we can see if we measure code there.
x = sys.getfilesystemencoding()
y = os.getcwd()
| 9 | 295 |
probability | tensorflow_probability/python/layers/internal/tensor_tuple_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... | 115 | 4,281 |
django-cms | cms/test_utils/project/app_with_cms_config/apps.py | .py | from django.apps import AppConfig
class CMSConfigConfig(AppConfig):
name = 'cms.test_utils.project.app_with_cms_config'
label = 'app_with_cms_config'
| 7 | 160 |
textual | docs/examples/guide/animator/animation01.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class AnimationApp(App):
def compose(self) -> ComposeResult:
self.box = Static("Hello, World!")
self.box.styles.background = "red"
self.box.styles.color = "black"
self.box.styles.padding = (1, 2)
... | 20 | 496 |
pyomo | doc/OnlineDocs/src/expr/design.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... | 63 | 1,615 |
sphinx | tests/roots/test-ext-ifconfig/conf.py | .py | extensions = ['sphinx.ext.ifconfig']
exclude_patterns = ['_build']
confval1 = True
def setup(app):
app.add_config_value('confval1', False, None)
app.add_config_value('confval2', False, None)
app.add_config_value('false_config', False, None)
| 11 | 256 |
saleor | saleor/checkout/tasks.py | .py | import datetime
import logging
from decimal import Decimal
import graphene
from celery.utils.log import get_task_logger
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import transaction
from django.db.models import Exists, F, OuterRef, Q, QuerySet, Subquery
from djan... | 370 | 13,645 |
conda | conda/models/version.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Implements the version spec with parsing and comparison logic.
Object inheritance:
.. autoapi-inheritance-diagram:: BaseSpec VersionSpec BuildNumberMatch
:top-classes: conda.models.version.BaseSpec
:parts: 1
"""
from __future__ impor... | 716 | 26,234 |
pyomo | pyomo/contrib/doe/tests/test_doe_errors.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... | 803 | 27,433 |
openvino | tests/e2e_tests/common/environment_info.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import importlib
import distro
from . import config
from .logger import get_logger
logger = get_logger(__name__)
DEFAULT_BUILD_NUMBER = 0
DEFAULT_SHORT_VERSION_NUMBER = "0.0.0"
DEFAULT_FULL_VERSION_NUMBER = "{}-{}-{}".format(DEFAULT... | 103 | 3,137 |
wagtail | wagtail/admin/tests/pages/test_preview.py | .py | import datetime
import json
from functools import wraps
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import timezone
from freezegun import freeze_time
f... | 1,192 | 46,561 |
saleor | saleor/graphql/core/filters/filters.py | .py | import django_filters
import graphene
from django.core.exceptions import ValidationError
from django.forms import Field, MultipleChoiceField
from ...utils.filters import filter_range_field
from ..enums import JobStatusEnum
from ..types import DateTimeRangeInput
from .shared_filters import filter_metadata
class Defau... | 110 | 3,357 |
scikit-bio | skbio/metadata/tests/test_missing.py | .py | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | 102 | 3,613 |
hydra | tests/test_apps/custom_env_defaults/hydra_plugins/env_defaults/env_defaults.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from hydra.core.config_search_path import ConfigSearchPath
from hydra.plugins.search_path_plugin import SearchPathPlugin
class TestEnvDefaultSearchPathPlugin(SearchPathPlugin):
def manipulate_search_path(self, search_path: ConfigSearchPath) ->... | 14 | 548 |
probability | tensorflow_probability/python/distributions/geometric_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... | 306 | 10,776 |
kafka | committer-tools/reviewers.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import shlex
import subprocess
import tempfile
#
# 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.
... | 146 | 5,372 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_Conv2D.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
# Testing operation Conv2D
# Documentation: https://www.tensorflow.org/api_docs/python/tf/raw_ops/Conv2D
class TestConv2D(CommonTFLayerTest):
# input_shape - ... | 88 | 4,149 |
onnxruntime | orttraining/orttraining/python/training/optim/_apex_amp_modifier.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
# Copyright (c) 2020, NVIDIA CORPORATION.
# Some functions in this file are adapted from NVIDIA/apex, commit 082f999a6e18a3d02306e27482cc7486dab71a5... | 142 | 6,452 |
pdm | src/pdm/formats/setup_py.py | .py | from __future__ import annotations
import os
from collections.abc import Mapping
from pathlib import Path
from typing import TYPE_CHECKING, Any
from pdm.formats.base import array_of_inline_tables, make_array, make_inline_table
if TYPE_CHECKING:
from pdm.project import Project
def check_fingerprint(project: Pro... | 67 | 2,481 |
pdm | src/pdm/cli/commands/fix/__init__.py | .py | from __future__ import annotations
import argparse
from pdm.cli.commands.base import BaseCommand
from pdm.cli.commands.fix.fixers import (
BaseFixer,
LockStrategyFixer,
PackageTypeFixer,
ProjectConfigFixer,
ProjectPluginFixer,
)
from pdm.exceptions import PdmUsageError
from pdm.project import Proj... | 87 | 3,330 |
conda | conda/common/_os/linux.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import os
from functools import cache
from logging import getLogger
from os.path import exists
from ..compat import on_linux
log = getLogger(__name__)
@cache
def linux_get_libc_version() -> tuple[str, str]... | 64 | 2,053 |
mlflow | tests/demo/test_prompts_generator.py | .py | import pytest
from mlflow.demo.base import DEMO_PROMPT_PREFIX, DemoFeature, DemoResult
from mlflow.demo.data import DEMO_PROMPTS
from mlflow.demo.generators.prompts import PromptsDemoGenerator
from mlflow.genai.prompts import load_prompt, search_prompts
@pytest.fixture
def prompts_generator():
generator = Prompt... | 141 | 4,195 |
saleor | saleor/account/forms.py | .py | from phonenumbers.phonenumberutil import country_code_for_region
from .i18n import AddressMetaForm, get_address_form_class
def get_address_form(
data, country_code, initial=None, instance=None, enable_normalization=True, **kwargs
):
country_form = AddressMetaForm(data, initial=initial)
if country_form.is... | 37 | 1,294 |
mlflow | tests/pyfunc/test_scoring_server.py | .py | import json
import math
import os
import random
import signal
from io import BytesIO, StringIO
from typing import Any, NamedTuple
import keras
import numpy as np
import pandas as pd
import pydantic
import pytest
import sklearn.linear_model as logreg_module
from packaging.version import Version
from sklearn import data... | 1,133 | 41,049 |
beam | sdks/python/apache_beam/internal/pickler_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... | 352 | 11,688 |
ipython | tools/tests/embed/embed2.py | .py | """This tests passing a dict for the user_ns at shell instantiation."""
from IPython import embed
user_ns = dict(cookie='monster')
embed(user_ns=user_ns, banner1="check 'cookie' present, locals and globals equivalent")
| 6 | 220 |
onnxruntime | onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/TensorDataType.py | .py | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: fbs
class TensorDataType(object):
UNDEFINED = 0
FLOAT = 1
UINT8 = 2
INT8 = 3
UINT16 = 4
INT16 = 5
INT32 = 6
INT64 = 7
STRING = 8
BOOL = 9
FLOAT16 = 10
DOUBLE = 11
UINT32 = 12
UINT6... | 27 | 474 |
saleor | saleor/tests/e2e/attributes/utils/attribute_bulk_create.py | .py | from ...utils import get_graphql_content
ATTRIBUTE_BULK_CREATE_MUTATION = """
mutation AttributeBulkCreate($attributes: [AttributeCreateInput!]!) {
attributeBulkCreate(attributes: $attributes) {
results {
errors {
path
message
code
}
attribute {
id
name
... | 62 | 1,211 |
sphinx | tests/test_domains/test_domain_std.py | .py | """Tests the std domain"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest import mock
import pytest
from docutils import nodes
from docutils.nodes import definition, definition_list, definition_list_item, term
from sphinx import addnodes
from sphinx.addnodes import (
desc,
... | 612 | 18,281 |
clearml | clearml/utilities/resource_monitor.py | .py | import logging
import os
import platform
import sys
import warnings
from time import time
from typing import Dict, List, Any
import psutil
from pathlib2 import Path
from .process.mp import BackgroundMonitor
from ..backend_api import Session
from ..binding.frameworks.tensorflow_bind import IsTensorboardInit
from ..con... | 649 | 28,742 |
pyomo | pyomo/common/extensions.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... | 13 | 637 |
sqlmap | thirdparty/beautifulsoup/beautifulsoup.py | .py | """Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-formed X... | 2,035 | 80,119 |
beam | sdks/python/apache_beam/yaml/main.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... | 303 | 11,028 |
metrics | src/torchmetrics/retrieval/precision_recall_curve.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... | 432 | 17,893 |
mlflow | mlflow/entities/experiment_tag.py | .py | from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.service_pb2 import ExperimentTag as ProtoExperimentTag
class ExperimentTag(_MlflowObject):
"""Tag object associated with an experiment."""
def __init__(self, key, value):
self._key = key
self._value = value
def _... | 36 | 887 |
sqlmap | tests/test_replication.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
SQLite replication writer (lib/core/replication.py).
This is what backs `--dump ... --dump-format SQLITE` / replication: it mirrors
dumped tables into a local SQLite file. Tested end... | 122 | 4,672 |
metrics | tests/unittests/audio/test_stoi.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... | 129 | 5,293 |
omegaconf | tests/test_structured_config_unions.py | .py | import copy
import pickle
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union
import attr
from pytest import mark, param, raises
from omegaconf import (
MISSING,
DictConfig,
OmegaConf,
UnionNode,
ValidationError,
open_dict,
)
from omegaconf._utils impor... | 615 | 16,100 |
biopython | Scripts/xbbtools/xbb_translations.py | .py | #!/usr/bin/env python
# Copyright 2000 by Thomas Sicheritz-Ponten.
# Copyright 2016 by Markus Piotrowski.
# 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.
# Created: Wed Jun 21 ... | 155 | 5,756 |
onnxruntime | onnxruntime/test/testdata/transform/fusion/fuse-pad-avgpool-gen.py | .py | from pathlib import Path
import numpy as np
import onnx
HERE = Path(__file__).parent.resolve(strict=True)
TEST = False
if TEST:
import onnxruntime
def generate_fuse_pad_avgpool():
parameters = {
"fuse-pad-avgpool": (
{},
[[1.333333, 2.333333, 1.777778], [3.0, 5.0, 3.666667],... | 69 | 3,038 |
mlflow | tests/store/tracking/sqlalchemy_store/test_sqlalchemy_store_issues.py | .py | import uuid
import pytest
from mlflow.entities import IssueSeverity, IssueStatus, TraceState
from mlflow.entities.assessment import IssueReference
from mlflow.entities.trace_info import TraceInfo
from mlflow.entities.trace_location import TraceLocation
from mlflow.exceptions import MlflowException
from mlflow.utils.t... | 1,053 | 31,234 |
python-prompt-toolkit | src/prompt_toolkit/utils.py | .py | from __future__ import annotations
import os
import signal
import sys
import threading
from collections import deque
from collections.abc import Callable, Generator
from contextlib import AbstractContextManager
from typing import (
Generic,
TypeVar,
)
from wcwidth import wcwidth
__all__ = [
"Event",
... | 325 | 8,657 |
biopython | Tests/test_PDB_SMCRA.py | .py | # Copyright 2009-2011 by Eric Talevich. All rights reserved.
# Revisions copyright 2009-2013 by Peter Cock. All rights reserved.
# Revisions copyright 2013 Lenna X. Peterson. All rights reserved.
# Revisions copyright 2020 Joao Rodrigues. All rights reserved.
#
# Converted by Eric Talevich from an older unit test cop... | 605 | 21,602 |
coremltools | coremltools/converters/mil/backend/nn/passes/conv1d_decomposition.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 Block
from coremltools.converters.mil.mil import Builder a... | 102 | 3,693 |
sphinx | sphinx/environment/adapters/indexentries.py | .py | """Index entries adapters for sphinx.environment."""
from __future__ import annotations
import re
import unicodedata
from itertools import groupby
from typing import TYPE_CHECKING
from sphinx.errors import NoUri
from sphinx.locale import _, __
from sphinx.util import logging
from sphinx.util.index_entries import _sp... | 268 | 9,688 |
textual | docs/examples/guide/layout/grid_layout7_gutter.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class GridLayoutExample(App):
CSS_PATH = "grid_layout7_gutter.tcss"
def compose(self) -> ComposeResult:
yield Static("One", classes="box")
yield Static("Two", classes="box")
yield Static("Three", classes="bo... | 20 | 528 |
mlflow | mlflow/gateway/config.py | .py | import json
import logging
import os
import pathlib
from enum import Enum
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal
import pydantic
import yaml
from pydantic import ConfigDict, ValidationError, field_validator, model_validator
from pydantic.json import pydantic_encoder
from mlflow.enviro... | 662 | 22,487 |
readthedocs.org | readthedocs/proxito/tests/test_subproject_aliases.py | .py | """End-to-end coverage for subproject aliases that contain slashes."""
import django_dynamic_fixture as fixture
import pytest
from django.test.utils import override_settings
from readthedocs.core.resolver import Resolver
from readthedocs.projects.constants import (
DOWNLOADABLE_MEDIA_TYPES,
MEDIA_TYPE_HTMLZIP... | 90 | 3,876 |
mlflow | tests/llama_index/test_llama_index_node_conversion.py | .py | from llama_index.core.schema import NodeWithScore, TextNode
from mlflow.entities import Document
def test_from_llama_index_node_with_score():
text_node = TextNode(text="Hello", metadata={"key": "value"})
node_with_score = NodeWithScore(node=text_node, score=0.5)
document = Document.from_llama_index_node_... | 13 | 505 |
textual | docs/examples/styles/scrollbar_size2.py | .py | from textual.app import App
from textual.containers import Horizontal, ScrollableContainer
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has... | 29 | 816 |
beam | sdks/python/apache_beam/examples/inference/pytorch_imagenet_rightfit.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 ... | 538 | 17,828 |
openvino | tests/layer_tests/pytorch_tests/test_floor_divide.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import numpy as np
import pytest
from pytorch_layer_test_class import PytorchLayerTest
class TestFloorDivide(PytorchLayerTest):
def _prepare_input(self):
return (self.input_tensor, self.other_tensor)
... | 127 | 4,883 |
pyro | pyro/infer/reparam/__init__.py | .py | # Copyright Contributors to the Pyro project.
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from .conjugate import ConjugateReparam
from .discrete_cosine import DiscreteCosineReparam
from .haar import HaarReparam
from .hmm import LinearHMMReparam
from .loc_scale import LocScal... | 41 | 1,239 |
textual | tests/test_strip.py | .py | import pytest
from rich.console import Console
from rich.segment import Segment
from rich.style import Style
from textual._segment_tools import NoCellPositionForIndex
from textual.color import Color
from textual.filter import Monochrome
from textual.strip import Strip
def test_cell_length() -> None:
strip = Stri... | 208 | 6,003 |
mkdocs-material | material/plugins/projects/builder/watcher/__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... | 99 | 3,883 |
mlflow | mlflow/gateway/__init__.py | .py | from mlflow.gateway.utils import get_gateway_uri, set_gateway_uri
__all__ = [
"get_gateway_uri",
"set_gateway_uri",
]
| 7 | 127 |
probability | tensorflow_probability/python/mcmc/slice_sampler_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... | 290 | 11,007 |
saleor | saleor/tax/tests/test_order_calculations.py | .py | from decimal import Decimal
import pytest
from prices import Money, TaxedMoney
from saleor.tax.models import TaxClass, TaxClassCountryRate
from ...core.prices import quantize_price
from ...core.taxes import zero_money, zero_taxed_money
from ...discount import DiscountType, DiscountValueType
from ...order import Orde... | 906 | 27,723 |
saleor | saleor/app/tests/fixtures/app_installation.py | .py | import pytest
from ....app.models import AppInstallation
@pytest.fixture
def app_installation():
app_installation = AppInstallation.objects.create(
app_name="External App",
manifest_url="http://localhost:3000/manifest",
)
return app_installation
| 13 | 277 |
mlflow | mlflow/genai/utils/type.py | .py | from __future__ import annotations
from typing import Any
from mlflow.types.chat import Function
class FunctionCall(Function):
arguments: str | dict[str, Any] | None = None
outputs: Any | None = None
exception: str | None = None
| 12 | 245 |
coveragepy | coverage/numbits.py | .py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt
"""
Functions to manipulate packed binary representations of number sets.
To save space, coverage stores sets of line numbers in SQLite using a packed
binary rep... | 165 | 5,318 |
pynacl | tests/test_shorthash.py | .py | # Copyright 2016 Donald Stufft and individual contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 238 | 8,517 |
jupytext | tests/external/contents_manager/test_contentsmanager_external.py | .py | import re
import pytest
from jupyter_server.utils import ensure_async
import jupytext
from jupytext.compare import compare_notebooks, notebook_model
pytestmark = pytest.mark.asyncio
@pytest.mark.requires_pandoc
async def test_save_load_paired_md_pandoc_notebook(ipynb_py_R_jl_file, tmpdir, cm):
if re.match(r".*... | 54 | 1,782 |
openvino | tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_spatialdropout3d.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import tensorflow as tf
from common.tf2_layer_test_class import CommonTF2LayerTest
class TestKerasSpatialDropout3D(CommonTF2LayerTest):
def create_keras_spatialdropout3d_net(self, input_names, input_shapes, input_typ... | 58 | 2,775 |
onnxruntime | onnxruntime/contrib_ops/cuda/sparse/sparse_attention_v2/compile_sparse_attention_v2.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
# Use triton AoT compiler to convert sparse_attention_v2_triton.py to C ... | 150 | 7,646 |
onnxruntime | onnxruntime/python/tools/quantization/operators/activation.py | .py | import onnx
from ..quant_utils import TENSOR_NAME_QUANT_SUFFIX, QuantizedValue, QuantizedValueType, attribute_to_kwarg, ms_domain
from .base_operator import QuantOperatorBase
from .qdq_base_operator import QDQOperatorBase
class QLinearActivation(QuantOperatorBase):
def __init__(self, onnx_quantizer, onnx_node):
... | 120 | 4,426 |
luigi | luigi/contrib/mrrunner.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 97 | 2,806 |
pyomo | pyomo/contrib/piecewise/tests/test_nested_inner_repn_gdp.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... | 139 | 6,363 |
wagtail | wagtail/embeds/format.py | .py | from django.template.loader import render_to_string
from wagtail.embeds import embeds
from wagtail.embeds.exceptions import EmbedException
def embed_to_frontend_html(url, max_width=None, max_height=None):
try:
embed = embeds.get_embed(url, max_width, max_height)
# Render template
return ... | 34 | 867 |
sphinx | sphinx/transforms/post_transforms/__init__.py | .py | """Docutils transforms used by Sphinx."""
from __future__ import annotations
import re
from itertools import starmap
from typing import TYPE_CHECKING, cast
from docutils import nodes
from sphinx import addnodes
from sphinx.errors import NoUri
from sphinx.locale import __
from sphinx.transforms import SphinxTransfor... | 404 | 14,445 |
hatch | tests/project/test_config.py | .py | from itertools import product
import pytest
from hatch.plugin.constants import DEFAULT_CUSTOM_SCRIPT
from hatch.plugin.manager import PluginManager
from hatch.project.config import ProjectConfig
from hatch.project.constants import DEFAULT_BUILD_DIRECTORY, BuildEnvVars
from hatch.project.env import RESERVED_OPTIONS
fr... | 3,140 | 130,496 |
pyomo | pyomo/core/plugins/transform/util.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... | 290 | 7,740 |
probability | tensorflow_probability/python/distributions/mvn_linear_operator_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... | 259 | 10,302 |
probability | tensorflow_probability/python/experimental/mcmc/progress_bar_reducer.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... | 150 | 4,786 |
sphinx | tests/roots/test-ext-autosummary-module_empty_all/conf.py | .py | import sys
from pathlib import Path
sys.path.insert(0, str(Path.cwd().resolve()))
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary']
autodoc_default_options = {'members': True}
autosummary_ignore_module_all = False
autosummary_imorted_members = False
templates_path = ['templates']
| 12 | 296 |
astropy | astropy/visualization/wcsaxes/ticklabels.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
from collections import defaultdict
import numpy as np
from matplotlib import rcParams
from matplotlib.artist import allow_rasterization
from matplotlib.text import Text
from astropy.utils.decorators import deprecated_renamed_argument
fro... | 350 | 12,726 |
metrics | src/torchmetrics/text/chrf.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... | 251 | 10,490 |
onnxruntime | onnxruntime/python/tools/transformers/models/sam2/sam2_image_onnx_predictor.py | .py | # -------------------------------------------------------------------------
# Copyright (R) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import logging
import numpy as np
import torch
from PIL.Image import I... | 280 | 12,423 |
conda | tests/test_instructions.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import os
import pytest
with pytest.deprecated_call():
from conda import instructions
from conda.exceptions import CondaFileIOError
def test_expected_operation_order():
"""Ensure expected order of operations"""
expected = (
... | 40 | 1,060 |
pyomo | pyomo/core/tests/examples/pmedian4.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... | 67 | 1,686 |
sqlmap | lib/core/profiling.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import cProfile
import os
from lib.core.data import logger
from lib.core.data import paths
def profile(profileOutputFile=None):
"""
This will run the program and present... | 32 | 1,062 |
sqlmap | tamper/ord2ascii.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.HIGHEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces ORD() occurences... | 32 | 555 |
mlflow | mlflow/tracking/client.py | .py | """
Internal package providing a Python CRUD interface to MLflow experiments, runs, registered models,
and model versions. This is a lower level API than the :py:mod:`mlflow.tracking.fluent` module,
and is exposed in the :py:mod:`mlflow.tracking` module.
"""
import contextlib
import functools
import io
import json
imp... | 6,994 | 275,909 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_CropAndResize.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import numpy as np
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestCropAndResize(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
assert 'i... | 63 | 2,915 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.