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 |
|---|---|---|---|---|---|
mkdocs | hatch_build.py | .py | import os
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
from babel.messages.frontend import compile_catalog
for theme in 'mkdocs', 'readthedocs':
cmd = compile_catalog()
... | 15 | 455 |
probability | spinoffs/inference_gym/inference_gym/targets/vectorized_stochastic_volatility.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... | 442 | 16,363 |
wagtail | wagtail/tests/test_page_permissions.py | .py | import json
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.test import Client, TestCase, override_settings
from django.utils import timezone
from wagtail.models import (
GroupApprovalTask,
GroupPagePermission,
Locale,
Workflow,
WorkflowTask,... | 1,115 | 50,512 |
saleor | saleor/order/tests/test_refresh_order_base_prices_and_discounts.py | .py | from datetime import timedelta
from decimal import Decimal
import graphene
import pytest
from django.utils import timezone
from freezegun import freeze_time
from ...core.prices import quantize_price
from ...core.taxes import zero_money
from ...discount import DiscountType, DiscountValueType, RewardValueType, VoucherT... | 750 | 32,469 |
probability | tensorflow_probability/python/distributions/pareto.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... | 302 | 12,193 |
onnxruntime | onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/TypeInfo.py | .py | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: fbs
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class TypeInfo(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuf... | 84 | 2,516 |
beam | sdks/python/apache_beam/examples/complete/game/leader_board_it_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 168 | 5,988 |
pdm | src/pdm/cli/commands/config.py | .py | import argparse
import os
from collections.abc import Mapping
from pathlib import Path
from typing import Any
from pdm import termui
from pdm._types import RepositoryConfig
from pdm.cli.commands.base import BaseCommand
from pdm.exceptions import PdmUsageError
from pdm.project import Project
from pdm.project.config imp... | 184 | 7,710 |
sphinx | sphinx/writers/html5.py | .py | """Experimental docutils writers for HTML5 handling Sphinx's custom nodes."""
from __future__ import annotations
import posixpath
import re
import urllib.parse
from typing import TYPE_CHECKING
from docutils import nodes
from docutils.writers.html5_polyglot import HTMLTranslator as BaseTranslator
from sphinx import ... | 1,035 | 40,258 |
voila | tests/app/shutdown_kernel_test.py | .py | import re
import pytest
@pytest.fixture
def voila_config():
def config(voila_app):
voila_app.tornado_settings["disable_check_xsrf"] = True
return config
async def test_shutdown_handler(http_server_client, base_url):
response = await http_server_client.fetch(base_url)
html_text = response.bo... | 24 | 677 |
omegaconf | tests/interpolation/__init__.py | .py | from typing import Any
from omegaconf import Container, Node
def dereference_node(cfg: Container, key: Any) -> Node:
node = cfg._get_node(key)
assert isinstance(node, Node)
node = node._dereference_node()
assert isinstance(node, Node)
return node
| 12 | 270 |
conda | conda/gateways/connection/adapters/localfs.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Defines local filesystem transport adapter for CondaSession (requests.Session)."""
from email.utils import formatdate
from logging import getLogger
from mimetypes import guess_type
from os import stat
from tempfile import SpooledTemporaryFil... | 60 | 1,821 |
hatch | src/hatch/cli/test/__init__.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
import click
if TYPE_CHECKING:
from hatch.cli.application import Application
from hatch.env.plugin.interface import EnvironmentInterface
@click.command(short_help="Run tests", context_settings={"ignore_unknown_options": True})
@click.argum... | 235 | 9,187 |
probability | tensorflow_probability/python/distributions/bernoulli.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... | 292 | 11,299 |
bazel | src/test/py/bazel/bazel_server_mode_test.py | .py | # Copyright 2017 The Bazel Authors. All rights reserved.
#
# 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 la... | 46 | 1,388 |
openvino | tests/layer_tests/pytorch_tests/test_unfold.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('dimension', (0, 1, 2))
@pytest.mark.parametrize('size', (1, 2))
@pytest.mark.parametrize('step', (1, 2, 3, 4))
@pytest.mark.par... | 48 | 1,557 |
httpie | httpie/output/lexers/json.py | .py | import re
from pygments.lexer import bygroups, using, RegexLexer
from pygments.lexers.data import JsonLexer
from pygments.token import Token
PREFIX_TOKEN = Token.Error
PREFIX_REGEX = r'[^{\["]+'
class EnhancedJsonLexer(RegexLexer):
"""
Enhanced JSON lexer for Pygments.
It adds support for eventual data... | 32 | 851 |
probability | tensorflow_probability/python/bijectors/matrix_inverse_tril_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... | 183 | 7,735 |
pyomo | pyomo/contrib/gdpopt/config_options.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... | 569 | 18,703 |
textual | src/textual/widgets/_help_panel.py | .py | from __future__ import annotations
from textwrap import dedent
from textual.app import ComposeResult
from textual.css.query import NoMatches
from textual.widget import Widget
from textual.widgets import KeyPanel, Markdown
class HelpPanel(Widget):
"""
Shows context sensitive help for the currently focused wi... | 114 | 2,900 |
gunicorn | examples/read_django_settings.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Use this config file in your script like this:
$ gunicorn project_name.wsgi:application -c read_django_settings.py
"""
settings_dict = {}
with open('frameworks/django/testing/testing/settings.py') as f:
... | 24 | 509 |
clearml | clearml/backend_interface/task/task.py | .py | """ Backend task management support """
import itertools
import json
import logging
import os
import sys
import warnings
from copy import copy
from datetime import datetime
from enum import Enum
from multiprocessing import RLock
from operator import itemgetter
from tempfile import gettempdir
from threading import Threa... | 3,353 | 138,039 |
sphinx | tests/roots/test-ext-autodoc/target/name_conflict/foo.py | .py | class bar:
"""docstring of target.name_conflict.foo::bar."""
| 3 | 65 |
openvino | tests/layer_tests/pytorch_tests/test_logsumexp.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
class aten_logsumexp(torch.nn.Module):
def __init__(self, dim, keepdim) -> None:
super().__init__()
self.dim = dim
self.keepd... | 35 | 1,070 |
textual | src/textual/_types.py | .py | from typing import TYPE_CHECKING, Any, Awaitable, Callable, List, Literal, Union
from typing_extensions import Protocol
if TYPE_CHECKING:
from rich.segment import Segment
from textual.message import Message
class MessageTarget(Protocol):
"""Protocol that must be followed by objects that can receive mes... | 58 | 1,935 |
django-cms | cms/tests/test_plugin_renderers.py | .py | from collections import deque
from django.template import Context
from django.test.utils import override_settings
from cms.api import add_plugin, create_page
from cms.models import CMSPlugin, Placeholder
from cms.plugin_rendering import (
ContentRenderer,
LegacyRenderer,
StructureRenderer,
)
from cms.test... | 598 | 26,518 |
openvino | tests/e2e_tests/common/plugins/common/base_conftest.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Local pytest plugins shared code."""
import importlib.util
import inspect
import os
from fnmatch import fnmatch
from glob import glob
from inspect import getsourcefile
from _pytest.mark import MarkDecorator
from e2e_tests.common.pyt... | 122 | 4,445 |
saleor | saleor/graphql/order/tests/mutations/test_fulfillment_cancel.py | .py | from unittest.mock import patch
import graphene
from .....order import FulfillmentStatus, OrderEvents, OrderStatus
from .....order.error_codes import OrderErrorCode
from .....order.models import Fulfillment
from .....warehouse.models import Allocation, Stock
from ....tests.utils import assert_no_permission, get_graph... | 309 | 11,908 |
eve | eve/endpoints.py | .py | # -*- coding: utf-8 -*-
"""
eve.endpoints
~~~~~~~~~~~~~
This module implements the API endpoints. Each endpoint (resource, item,
home) invokes the appropriate method handler, returning its response
to the client, properly rendered.
:copyright: (c) 2017 by Nicola Iarocci.
:license: BSD, se... | 294 | 8,669 |
pyro | pyro/distributions/ordered_logistic.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import torch
from pyro.distributions import constraints
from pyro.distributions.torch import Categorical
class OrderedLogistic(Categorical):
"""
Alternative parametrization of the distribution over a categorical variable.
... | 62 | 2,874 |
wagtail | wagtail/contrib/forms/tests/test_views.py | .py | import datetime
import html
from io import BytesIO
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.contrib.messages import get_messages
from django.test import RequestFactory, TestCase, override_settings
from d... | 2,462 | 94,101 |
saleor | saleor/graphql/order/mutations/order_discount_add.py | .py | from typing import cast
import graphene
from django.core.exceptions import ValidationError
from ....core.tracing import traced_atomic_transaction
from ....order import events, models
from ....order.error_codes import OrderErrorCode
from ....order.utils import (
create_manual_order_discount,
get_order_discount... | 87 | 3,215 |
returns | returns/interfaces/specific/reader_result.py | .py | from __future__ import annotations
from abc import abstractmethod
from collections.abc import Callable, Sequence
from typing import TYPE_CHECKING, ClassVar, TypeVar, final
from returns.interfaces.specific import reader, result
from returns.primitives.hkt import KindN
from returns.primitives.laws import (
Law,
... | 139 | 3,988 |
hatch | src/hatch/errors/__init__.py | .py | class HatchError(Exception):
pass
class PythonDistributionUnknownError(HatchError):
pass
class PythonDistributionResolutionError(HatchError):
pass
| 11 | 163 |
gunicorn | tests/dirty/test_arbiter_signals.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for dirty arbiter TTIN/TTOU signal handling."""
import signal
from unittest.mock import Mock
import pytest
class TestDirtyArbiterSignals:
"""Test TTIN/TTOU signal handling in DirtyArbiter."""
... | 235 | 8,302 |
django-cms | cms/__main__.py | .py | """
Invokes djangocms when the cms module is run as a script.
Example: python -m cms mysite
"""
from cms.management import djangocms
if __name__ == "__main__":
djangocms.execute_from_command_line()
| 10 | 204 |
metrics | tests/unittests/classification/test_auc.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... | 101 | 2,975 |
pdm | src/pdm/cli/hooks.py | .py | from __future__ import annotations
import contextlib
from collections.abc import Generator
from typing import Any
from pdm.project.core import Project
from pdm.signals import pdm_signals
class HookManager:
def __init__(self, project: Project, skip: list[str] | None = None):
self.project = project
... | 56 | 1,496 |
mlflow | mlflow/data/dataset_registry.py | .py | import inspect
import warnings
from contextlib import suppress
from typing import Callable
import mlflow.data
from mlflow.data.dataset import Dataset
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
from mlflow.utils.plugins import get_entry_points
class ... | 169 | 6,451 |
probability | tensorflow_probability/python/math/psd_kernels/kumaraswamy_transformed.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... | 146 | 5,788 |
jupytext | tests/functional/simple_notebooks/test_read_simple_ipynb.py | .py | import nbformat
from nbformat.v4.nbbase import new_notebook
import jupytext
from jupytext.compare import compare
def test_save_ipynb_with_jupytext_has_final_newline(tmpdir):
nb = new_notebook()
file_jupytext = str(tmpdir.join("jupytext.ipynb"))
file_nbformat = str(tmpdir.join("nbformat.ipynb"))
jupy... | 24 | 607 |
readthedocs.org | readthedocs/core/forms.py | .py | """Forms for core app."""
from dataclasses import dataclass
import structlog
from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import NON_FIELD_ERRORS
from django.forms.fields import CharField
from django.utils.translation import gettext_... | 320 | 10,501 |
hatch | tests/python/test_resolve.py | .py | import sys
from platform import machine
import pytest
from hatch.config.constants import PythonEnvVars
from hatch.errors import PythonDistributionResolutionError, PythonDistributionUnknownError
from hatch.python.resolve import custom_env_var, get_compatible_distributions, get_distribution
from hatch.utils.structures ... | 205 | 9,219 |
saleor | saleor/graphql/product/tests/mutations/test_collection_delete.py | .py | from unittest.mock import MagicMock, patch
import graphene
import pytest
from django.core.files import File
from .....attribute.models import AttributeValue
from .....attribute.utils import associate_attribute_values_to_instance
from .....discount.utils.promotion import get_active_catalogue_promotion_rules
from ........ | 245 | 7,659 |
pyro | pyro/ops/arrowhead.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from collections import namedtuple
import torch
SymmArrowhead = namedtuple("SymmArrowhead", ["top", "bottom_diag"])
TriuArrowhead = namedtuple("TriuArrowhead", ["top", "bottom_diag"])
def sqrt(x):
"""
EXPERIMENTAL Computes ... | 128 | 4,306 |
wagtail | wagtail/api/v2/tests/test_images.py | .py | import json
from unittest import mock
from django.test import TestCase, TransactionTestCase, tag
from django.test.utils import override_settings
from django.urls import reverse
from wagtail.api.v2 import signal_handlers
from wagtail.images import get_image_model
from wagtail.models import CollectionViewRestriction
fr... | 634 | 23,439 |
pyomo | pyomo/solvers/plugins/solvers/CPLEX.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,066 | 46,073 |
onnxruntime | plugin-ep-cuda/_packaging_utils.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Shared utilities for the CUDA plugin EP packaging scripts. Not a public API."""
from __future__ import annotations
import re
from pathlib import Path
# Matches "@var@" template variables.
_TEMPLATE_VARIABLE_PATTERN = re... | 46 | 1,722 |
saleor | saleor/webhook/response_schemas/utils/helpers.py | .py | from pydantic import ValidationError
def parse_validation_error(error: ValidationError) -> str:
"""Parse pydantic ValidationError to a human-readable message."""
errors = error.errors()
error_msg: list[str] = []
for error_data in errors:
field = ""
loc_data = error_data["loc"]
... | 22 | 744 |
sphinx | tests/roots/test-ext-inheritance_diagram/test.py | .py | class Foo:
pass
class DocHere(Foo):
pass
class DocSubDir1(DocHere):
pass
class DocSubDir2(DocSubDir1):
pass
class DocMainLevel(Foo):
pass
class Alice(object): # NoQA: UP004
pass
| 23 | 213 |
pyomo | pyomo/contrib/pynumero/examples/external_grey_box/param_est/generate_data.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... | 92 | 3,539 |
wandb | wandb/sdk/artifacts/_models/registry.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING, Any
from pydantic import Field, field_validator
from typing_extensions import Self
from wandb._pydantic import GQLId
from wandb._strutils import nameof
from wandb.apis.public.registries._freezable_list import AddOnlyArtifactTypesList
from wandb.api... | 122 | 4,294 |
pyomo | examples/kernel/objectives.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 39 | 1,039 |
probability | tensorflow_probability/python/distributions/continuous_bernoulli.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... | 540 | 22,242 |
mlflow | mlflow/genai/review_queues/review_queues.py | .py | from dataclasses import dataclass, field
from mlflow.exceptions import MlflowException
from mlflow.genai.utils.enum_utils import StrEnum
from mlflow.protos import review_queues_pb2 as _rq_pb
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
from mlflow.utils.annotations import experimental
@experiment... | 224 | 8,140 |
mlflow | mlflow/models/model.py | .py | import json
import logging
import os
import shutil
import uuid
from datetime import datetime, timezone
from pathlib import Path
from pprint import pformat
from typing import Any, Callable, Literal, NamedTuple
from urllib.parse import urlparse
import yaml
from packaging.requirements import InvalidRequirement, Requireme... | 1,661 | 68,804 |
openvino | tests/layer_tests/pytorch_tests/test_eye.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from packaging import version
from pytorch_layer_test_class import PytorchLayerTest
class TestEye(PytorchLayerTest):
def _prepare_input(self, m, n=None):
import numpy as np
if n is None:
... | 76 | 3,032 |
kafka | tests/bin/external_trogdor_command_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 "Licen... | 42 | 1,642 |
onnx | onnx/backend/test/case/node/dequantizelinear.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx import TensorProto
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.helper import make_tensor
class Dequa... | 374 | 11,175 |
wandb | wandb/integration/weave/media_adapters.py | .py | """Helpers for converting wandb rich media types to Weave-native types for eval logging."""
from __future__ import annotations
from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, get_args
import wandb
from wandb.sdk.data_types.audio import Audio
from wandb.sd... | 344 | 11,624 |
pyomo | pyomo/contrib/pynumero/examples/external_grey_box/react_example/maximize_cb_outputs.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... | 48 | 2,117 |
pyomo | pyomo/solvers/tests/piecewise_linear/problems/step_var.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... | 87 | 2,494 |
coremltools | deps/pybind11/tools/make_changelog.py | .py | #!/usr/bin/env python3
from __future__ import annotations
import re
import ghapi.all
from rich import print
from rich.syntax import Syntax
ENTRY = re.compile(
r"""
Suggested \s changelog \s entry:
.*
```rst
\s*
(.*?)
\s*
```
""",
re.DOTALL | re.VERBOSE,
)
print()
api = ghapi.al... | 93 | 2,136 |
saleor | saleor/webhook/transport/asynchronous/transport.py | .py | import datetime
import json
import logging
from collections import defaultdict
from collections.abc import Callable, Hashable, Sequence
from dataclasses import asdict, dataclass
from typing import TYPE_CHECKING, Any
from urllib.parse import urlparse
from celery import group
from celery.exceptions import MaxRetriesExce... | 1,032 | 38,908 |
sqlmap | plugins/generic/users.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.agent import agent
from lib.core.common import arrayizeValue
from lib.core.common import Backend
from lib.core.common import filterPairValues
from lib.cor... | 680 | 30,128 |
wagtail | wagtail/documents/forms.py | .py | from django import forms
from django.conf import settings
from django.forms.models import modelform_factory
from django.utils.functional import cached_property
from django.utils.text import capfirst
from django.utils.translation import gettext_lazy as _
from wagtail.admin.forms.collections import (
BaseCollectionM... | 178 | 6,486 |
saleor | saleor/tests/e2e/checkout/discounts/promotions/test_checkout_custom_price_and_fixed_promotion.py | .py | import pytest
from ......product.tasks import recalculate_discounted_price_for_products_task
from ....checkout.utils import checkout_lines_update
from ....product.utils.preparing_product import prepare_product
from ....promotions.utils import create_promotion, create_promotion_rule
from ....shop.utils import prepare_d... | 148 | 5,442 |
probability | tensorflow_probability/python/experimental/psd_kernels/feature_scaled_with_embedded_categorical.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... | 384 | 17,087 |
mlflow | dev/clint/tests/rules/test_markdown_link.py | .py | from pathlib import Path
from clint.config import Config
from clint.index import SymbolIndex
from clint.linter import Position, Range, lint_file
from clint.rules.markdown_link import MarkdownLink
def test_markdown_link(index: SymbolIndex) -> None:
code = '''
# Bad
def function_with_markdown_link():
"""
T... | 105 | 2,820 |
mlflow | mlflow/genai/judges/prompts/conversation_completeness.py | .py | # NB: User-facing name for the conversation completeness assessment.
CONVERSATION_COMPLETENESS_ASSESSMENT_NAME = "conversation_completeness"
CONVERSATION_COMPLETENESS_PROMPT = """\
Consider the following conversation history between a user and an assistant.
Your task is to output exactly one label: "yes" or "no" based... | 20 | 1,527 |
astropy | astropy/coordinates/transformations/composite.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Module defining the class for a composited sequence of coordinate transformations.
This module contains the class :class:`~astropy.coordinates.CompositeTransform` that
combines a sequence of transformations into a single transformation. The class has ... | 258 | 10,643 |
attrs | src/attr/filters.py | .py | # SPDX-License-Identifier: MIT
"""
Commonly useful filters for `attrs.asdict` and `attrs.astuple`.
"""
from ._make import Attribute
def _split_what(what):
"""
Returns a tuple of `frozenset`s of classes and attributes.
"""
return (
frozenset(cls for cls in what if isinstance(cls, type)),
... | 73 | 1,795 |
beam | sdks/python/apache_beam/runners/portability/fn_api_runner/execution.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... | 1,181 | 51,806 |
astropy | astropy/table/pandas.py | .py | ascii_coded = (
"Ò♙♙♙♙♙♙♙♙♌♐♐♌♙♙♙♙♙♙♌♌♙♙Ò♙♙♙♙♙♙♙♘♐♐♐♈♙♙♙♙♙♌♐♐♐♔Ò♙♙♌♈♙♙♌♐♈♈♙♙♙♙♙♙♙♙♈♐♐♙Ò♙♐♙♙♙♐♐♙♙♙"
"♙♙♙♙♙♙♙♙♙♙♙♙Ò♐♔♙♙♘♐♐♙♙♌♐♐♔♙♙♌♌♌♙♙♙♌Ò♐♐♙♙♘♐♐♌♙♈♐♈♙♙♙♈♐♐♙♙♘♔Ò♐♐♌♙♘♐♐♐♌♌♙♙♌♌♌♙♈♈♙♌♐"
"♐Ò♘♐♐♐♌♐♐♐♐♐♐♌♙♈♙♌♐♐♐♐♐♔Ò♘♐♐♐♐♐♐♐♐♐♐♐♐♈♈♐♐♐♐♐♐♙Ò♙♘♐♐♐♐♈♐♐♐♐♐♐♙♙♐♐♐♐♐♙♙Ò♙♙♙♈♈♈♙♙♐"
"♐♐♐♐♔♙♐♐♐♐♈♙♙Ò♙♙♙♙♙♙♙♙♙♈♈♐♐♐♙♈♈♈♙♙♙♙Ò"... | 34 | 1,724 |
pyomo | pyomo/repn/tests/ampl/small12_testCase.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... | 180 | 4,921 |
wandb | wandb/proto/v6/wandb_internal_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: wandb/proto/wandb_internal.proto
# Protobuf Python Version: 6.30.0
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descrip... | 392 | 59,363 |
saleor | saleor/order/tests/test_order_actions_refund_products.py | .py | from decimal import Decimal
from unittest.mock import ANY, patch
from ...payment import ChargeStatus
from ...payment.interface import RefundData
from ...plugins.manager import get_plugins_manager
from ...warehouse.models import Allocation
from .. import FulfillmentLineData, FulfillmentStatus
from ..actions import crea... | 282 | 10,935 |
clearml | clearml/backend_api/services/v2_23/frames.py | .py | """
frames service
This service provides access to frames metadata stored in the
system's datasets (see Datasets Service). This includes reading metadata, adding new
frames/metadata and updating existing metadata.
"""
import six
import enum
from clearml.backend_api.session import (
Request,
Response,
Non... | 12,807 | 493,837 |
textual | docs/examples/guide/animator/animation01_static.py | .py | from textual._easing import DEFAULT_EASING, EASING
from textual.app import App, ComposeResult
from textual.widgets import Static
ease = EASING[DEFAULT_EASING]
class AnimationApp(App):
def compose(self) -> ComposeResult:
self.box = Static("Hello, World!")
self.box.styles.background = "red"
... | 29 | 697 |
sqlmap | extra/boundarycheck/boundarycheck.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Live cross-DBMS validator for data/xml/boundaries.xml.
WHAT
For every reachable DBMS this builds the REAL injected parameter value for each
boundary - through the actual agen... | 390 | 18,946 |
httpie | httpie/cli/nested_json/interpret.py | .py | from typing import Type, Union, Any, Iterable, Tuple
from .parse import parse, assert_cant_happen
from .errors import NestedJSONSyntaxError
from .tokens import EMPTY_STRING, TokenKind, Token, PathAction, Path, NestedJSONArray
__all__ = [
'interpret_nested_json',
'unwrap_top_level_list_if_needed',
]
JSONType... | 130 | 4,341 |
flit | flit/_get_dirs.py | .py | """get_dirs() is pulled out as a separate file so we can run it in a target Python.
"""
import os
import sys
import sysconfig
def get_dirs(user=True):
"""Get the 'scripts' and 'purelib' directories we'll install into.
This is now a thin wrapper around sysconfig.get_paths(). It's not inlined,
because some ... | 28 | 898 |
probability | tensorflow_probability/python/bijectors/ascending.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... | 95 | 3,124 |
pymc | tests/sampling/test_mcmc.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... | 1,158 | 42,892 |
pyomo | examples/pyomobook/intro-ch/coloring_concrete.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... | 87 | 2,389 |
textual | tests/input/test_input_key_movement_actions.py | .py | """Unit tests for Input widget position movement actions."""
from __future__ import annotations
from textual.app import App, ComposeResult
from textual.widgets import Input
class InputTester(App[None]):
"""Input widget testing app."""
def compose(self) -> ComposeResult:
for value, input_id in (
... | 186 | 6,772 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/compare_subgraph_dir.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from argparse import ArgumentParser
from utils.file_utils import prepare_filelist
from utils.constants import XML_EXTENSION, META_EXTENSION
from openvino import Core
import defusedxml.ElementTree as ET
def parse_arguments():
parser ... | 96 | 3,824 |
wandb | wandb/proto/v6/wandb_base_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: wandb/proto/wandb_base.proto
# Protobuf Python Version: 6.30.0
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_... | 42 | 1,821 |
biopython | Bio/Align/__init__.py | .py | # Copyright 2000, 2004 by Brad Chapman.
# Revisions copyright 2010-2013, 2015-2018 by Peter Cock.
# 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 be... | 4,967 | 196,489 |
mlflow | tests/genai/scorers/deepeval/test_models.py | .py | from unittest.mock import Mock, patch
import pytest
from mlflow.genai.scorers.deepeval.models import MlflowDeepEvalLLM, create_deepeval_model
@pytest.fixture
def mock_call_chat_completions():
with patch(
"mlflow.genai.judges.adapters.databricks_managed_judge_adapter.call_chat_completions",
) as mock... | 94 | 3,421 |
openvino | tests/layer_tests/tensorflow_lite_tests/test_tfl_DepthToSpace.py | .py | import pytest
import tensorflow as tf
from common.tflite_layer_test_class import TFLiteLayerTest
test_params = [
{'shape': [8, 10, 10, 16], 'block_size': 2},
{'shape': [24, 10, 10, 50], 'block_size': 5},
]
class TestTFLiteDepthToSpaceLayerTest(TFLiteLayerTest):
inputs = ["Input"]
outputs = ["DepthTo... | 32 | 1,184 |
mlflow | tests/utils/test_databricks_tracing_utils.py | .py | import json
import pytest
from google.protobuf.timestamp_pb2 import Timestamp
import mlflow
from mlflow.entities import (
AssessmentSource,
Expectation,
Feedback,
Trace,
TraceData,
TraceInfo,
TraceState,
)
from mlflow.entities.trace_location import (
InferenceTableLocation,
MlflowE... | 519 | 20,601 |
pyomo | pyomo/contrib/solver/solvers/asl_sol_reader.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... | 517 | 21,340 |
coremltools | coremltools/proto/DictVectorizer_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: DictVectorizer.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
fr... | 42 | 1,762 |
coremltools | coremltools/converters/mil/mil/ops/defs/iOS15/tensor_transformation.py | .py | # Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from typing import List
import numpy as np
import sympy as sm
from coremltools import _logger as lo... | 1,102 | 36,294 |
sqlmap | plugins/dbms/access/takeover.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from lib.core.exception import SqlmapUnsupportedFeatureException
from plugins.generic.takeover import Takeover as GenericTakeover
class Takeover(GenericTakeover):
def osCmd(s... | 29 | 1,010 |
wandb | wandb/sdk/data_types/base_types/media.py | .py | from __future__ import annotations
import hashlib
import os
import pathlib
import re
import shutil
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any, cast
import wandb
from wandb import util
from wandb.sdk.lib import filesystem
from wandb.sdk.lib.paths import LogicalPath
from .wb_value impor... | 345 | 12,640 |
probability | tensorflow_probability/python/experimental/auto_batching/stackless.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... | 307 | 12,690 |
mlflow | tests/sklearn/test_sklearn_autolog.py | .py | import contextlib
import doctest
import functools
import inspect
import json
import pickle
import re
from unittest import mock
import joblib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import polars as pl
import pytest
import sklearn
import sklearn.base
import sklearn.cluster
import sklearn.... | 1,858 | 68,205 |
confluent-kafka-python | tests/integration/schema_registry/_sync/test_api_client.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 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... | 510 | 17,273 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.