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 |
|---|---|---|---|---|---|
textual | tests/snapshot_tests/snapshot_apps/dev_previews_keys.py | .py | from textual_dev.previews import KeysApp
app = KeysApp()
if __name__ == "__main__":
app.run()
| 6 | 99 |
mlflow | examples/gateway/gemini/example.py | .py | from mlflow.deployments import get_deploy_client
def main():
client = get_deploy_client("http://localhost:7000")
print(f"Gemini endpoints: {client.list_endpoints()}\n")
print(f"Gemini completions endpoint info: {client.get_endpoint(endpoint='completions')}\n")
# Chat example
response_chat = clie... | 63 | 1,885 |
cvxpy | cvxpy/tests/test_clarabel.py | .py | """
Copyright, the CVXPY 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 or agreed to in writing, software
... | 129 | 5,365 |
saleor | saleor/plugins/webhook/tests/subscription_webhooks/filterable_webhooks/test_order_created.py | .py | import json
from unittest.mock import patch
import graphene
from django.test import override_settings
from ......core.models import EventDelivery
from ......graphql.webhook.subscription_query import SubscriptionQuery
from ......webhook.event_types import WebhookEventAsyncType
from .....manager import get_plugins_mana... | 229 | 6,967 |
beam | sdks/python/apache_beam/io/gcp/bigquery_tools_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... | 1,415 | 51,643 |
mlflow | mlflow/store/db_migrations/versions/a8b9c0d1e2f3_add_mcp_server_registry_tables.py | .py | """add MCP server registry tables
Create Date: 2026-05-11
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mssql
revision = "a8b9c0d1e2f3"
down_revision = "b7e4c1a90f23"
branch_labels = None
depends_on = None
def _get_json_type():
dialect_name = op.get_bind().dialect.name
... | 237 | 8,614 |
jupytext | tests/data/notebooks/outputs/ipynb_to_percent/Notebook_with_more_R_magic_111.py | .py | # ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
# %load_ext rpy2.ipython
import pandas as pd
df = pd.DataFrame(
{
"Letter": ["a", "a", "a", "b", "b", "b", "c", "c", "c"],
"X": [4, 3, 5, 2, 1, 7, 7, 5, 9],
"Y": [0, 4, 3, 6,... | 25 | 527 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_pow.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# pow paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
def paddle_pow(name : str, x, y, data_type):
paddle.enable_static()
with paddle.static.program_guard(paddle.static.P... | 106 | 3,412 |
hydra | hydra/test_utils/a_module.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from omegaconf import DictConfig
import hydra
@hydra.main()
def experiment(_: DictConfig) -> None:
pass
if __name__ == "__main__":
experiment()
| 14 | 228 |
pynacl | src/nacl/utils.py | .py | # Copyright 2013 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... | 92 | 2,321 |
returns | tests/test_io/test_ioresult_container/test_ioresult_equals.py | .py | from returns.io import IOFailure, IOSuccess
def test_equals():
"""Ensures that ``.equals`` method works correctly."""
inner_value = 1
assert IOSuccess(inner_value).equals(IOSuccess(inner_value))
assert IOFailure(inner_value).equals(IOFailure(inner_value))
def test_not_equals():
"""Ensures that ... | 20 | 636 |
sqlmap | plugins/dbms/mckoi/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 | 966 |
sphinx | tests/roots/test-ext_static_dir/conf.py | .py | import sys
from pathlib import Path
sys.path.insert(0, str(Path.cwd().resolve()))
project = 'Test Extension Static Dir'
extensions = ['staticdirext']
| 8 | 152 |
saleor | saleor/warehouse/tests/test_preorder_availability.py | .py | import datetime
from unittest.mock import patch
import pytest
from django.db.models import F, Sum
from django.db.models.functions import Coalesce
from django.utils import timezone
from freezegun import freeze_time
from ...checkout.fetch import CheckoutLineInfo
from ...core.exceptions import InsufficientStock
from ..a... | 352 | 11,089 |
probability | tensorflow_probability/python/experimental/auto_batching/virtual_machine.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... | 329 | 13,820 |
probability | tensorflow_probability/python/experimental/fastgp/preconditioners.py | .py | # Copyright 2024 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... | 749 | 24,343 |
pyomo | pyomo/core/tests/unit/test_piecewise.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... | 518 | 16,815 |
saleor | saleor/tests/e2e/utils.py | .py | import json
from ...account.models import Group
from ...graphql.tests.utils import (
get_graphql_content, # noqa: F401
get_multipart_request_body, # noqa: F401
)
def assign_permissions(api_client, permissions):
user = api_client.user
if user:
group = Group.objects.create(
name="... | 55 | 1,705 |
django-cms | cms/constants.py | .py | """
Collection of important constants used throughout django CMS.
"""
#: The token used to identify when a user selects "inherit" as template for a page.
TEMPLATE_INHERITANCE_MAGIC = 'INHERIT'
REFRESH_PAGE = 'REFRESH_PAGE'
"""
Supplied to ``on_close`` arguments to refresh the current page when the frame is closed, f... | 91 | 2,729 |
openvino | docs/articles_en/assets/snippets/multi_threading.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from openvino import Core, properties
from snippets import get_model
model = get_model()
device_name = "CPU"
core = Core()
core.set_property("CPU", properties.intel_cpu.sparse_weights_decompression_rate(0.8))
# ! [ov:intel_cpu:multi... | 51 | 1,467 |
saleor | saleor/attribute/tests/fixtures/__init__.py | .py | from .attribute import * # noqa: F403
from .translation import * # noqa: F403
| 3 | 80 |
pyomo | pyomo/solvers/tests/checks/test_SAS.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... | 550 | 19,529 |
scikit-bio | skbio/util/_warning.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.
# --------------------------------------------... | 137 | 4,194 |
pyomo | pyomo/core/base/piecewise.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,584 | 57,670 |
beam | sdks/python/apache_beam/io/gcp/bigquery_io_metadata_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... | 74 | 2,663 |
sqlmap | tests/test_strings.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
String / path / escape helpers.
"""
import os
import random
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from _testutils import bootstra... | 115 | 4,683 |
saleor | saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_staff_with_ids.py | .py | import graphene
from .....app.error_codes import AppProblemDismissErrorCode
from ....tests.utils import get_graphql_content
from ...mutations.app_problem_dismiss import MAX_ITEMS_LIMIT
APP_PROBLEM_DISMISS_MUTATION = """
mutation AppProblemDismiss($input: AppProblemDismissInput!) {
appProblemDismiss(input:... | 124 | 4,278 |
saleor | saleor/graphql/product/tests/mutations/test_category_update.py | .py | import json
from unittest.mock import MagicMock, Mock, patch
import graphene
import pytest
from django.core.files import File
from django.utils import timezone
from django.utils.functional import SimpleLazyObject
from django.utils.text import slugify
from freezegun import freeze_time
from .....core.utils.json_seriali... | 647 | 20,496 |
pyomo | pyomo/contrib/mpc/data/tests/test_series_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... | 281 | 11,645 |
metrics | src/torchmetrics/functional/text/wip.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... | 94 | 3,500 |
textual | docs/examples/styles/link_background_hover.py | .py | from textual.app import App
from textual.widgets import Label
class LinkHoverBackgroundApp(App):
CSS_PATH = "link_background_hover.tcss"
def compose(self):
yield Label(
"Visit the [link='https://textualize.io']Textualize[/link] website.",
id="lbl1", # (1)!
)
y... | 30 | 778 |
astropy | astropy/visualization/wcsaxes/tests/test_images.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import matplotlib.lines
import matplotlib.text
import numpy as np
import pytest
from matplotlib import rc_context
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from matplotlib.patches import Circle, Rectan... | 1,575 | 49,934 |
toolz | tlz/__init__.py | .py | """``tlz`` mirrors the ``toolz`` API and uses ``cytoolz`` if possible.
The ``tlz`` package is installed when ``toolz`` is installed. It provides
a convenient way to use functions from ``cytoolz``--a faster Cython
implementation of ``toolz``--if it is installed, otherwise it uses
functions from ``toolz``.
"""
from . ... | 10 | 338 |
saleor | saleor/webhook/response_schemas/payment.py | .py | from enum import Enum
from typing import Annotated, Any, Literal
from pydantic import (
AfterValidator,
BaseModel,
Field,
ValidationInfo,
field_validator,
model_validator,
)
from ...app.models import App
from ...graphql.core.utils import str_to_enum
from ...payment import TokenizedPaymentFlow
... | 248 | 7,303 |
saleor | saleor/graphql/plugins/tests/queries/test_plugin.py | .py | import copy
from unittest import mock
import pytest
from .....plugins.manager import get_plugins_manager
from .....plugins.tests.sample_plugins import ChannelPluginSample, PluginSample
from ....tests.utils import assert_no_permission, get_graphql_content
PLUGIN_QUERY = """
query plugin($id: ID!){
plugin(id... | 291 | 10,550 |
omegaconf | omegaconf/tupleconfig.py | .py | import copy
import operator
from collections.abc import Sequence
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union
from ._utils import (
ValueKind,
_get_value,
_is_missing_literal,
_is_none,
_resolve_optional,
format_and_raise,
get_tuple_item_types,
get_valu... | 523 | 19,525 |
saleor | saleor/graphql/order/tests/benchmark/test_fulfillment.py | .py | import pytest
from ....tests.utils import get_graphql_content
FULFILLMENT_QUERY = """
query {
orders(first:100) {
edges {
node {
id
fulfillments {
id
status
lines {
id
... | 47 | 992 |
conda | tests/common/path/test_windows.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda.base.context import context
from conda.common.compat import on_win
from conda.common.path.windows import unix_path_to_win, win_path_to_unix
if TYPE_... | 297 | 8,637 |
confluent-kafka-python | examples/oauth_oidc_ccloud_azure_imds_producer.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2025 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... | 203 | 7,209 |
biopython | Tests/test_SearchIO_blast_tab.py | .py | # Copyright 2012 by Wibowo Arindrarto. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for SearchIO BlastIO parsers."""
import os
import unittest
from Bio.SearchIO im... | 985 | 40,380 |
pyomo | pyomo/contrib/alternative_solutions/__init__.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... | 19 | 1,045 |
saleor | saleor/graphql/site/dataloaders.py | .py | from collections.abc import Callable
from functools import partial, reduce
from typing import TypeVar
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Q
from django.http.request import split_domain_port
fr... | 81 | 2,411 |
astropy | astropy/table/sorted_array.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from collections.abc import Hashable, Mapping, Sequence
from numbers import Integral
from typing import TYPE_CHECKING
import numpy as np
if TYPE_CHECKING:
from .table import Column, Table
def _searchsorted(array, val, side="left"):
"""
Call... | 346 | 10,651 |
pymc | pymc/distributions/censored.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... | 203 | 7,064 |
cvxpy | cvxpy/transforms/partial_optimize.py | .py | """
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 326 | 11,257 |
metrics | src/torchmetrics/functional/audio/snr.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... | 132 | 5,002 |
flit | flit/vendorized/readme/rst.py | .py | # Copyright 2014 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 137 | 4,521 |
pyro | tests/distributions/test_log_normal_negative_binomial.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from pyro.distributions import LogNormalNegativeBinomial
from tests.common import assert_close
@pytest.mark.parametrize("num_quad_points", [2, 4])
@pytest.mark.parametrize("shape", [(2,), (4, 3)])
def test... | 48 | 1,588 |
textual | tests/test_style_parse.py | .py | import pytest
from textual.color import Color
from textual.style import Style
@pytest.mark.parametrize(
["markup", "style"],
[
("", Style()),
(
"b",
Style(bold=True),
),
("i", Style(italic=True)),
("u", Style(underline=True)),
("r", Styl... | 57 | 2,114 |
readthedocs.org | readthedocs/profiles/urls/public.py | .py | """URL patterns to view user profiles."""
from django.urls import re_path
from readthedocs.profiles import views
urlpatterns = [
re_path(
r"^(?P<username>[+\w@.-]+)/$",
views.ProfileDetail.as_view(),
name="profiles_profile_detail",
),
]
| 15 | 273 |
jupytext | tests/functional/others/test_doxygen.py | .py | import nbformat
import pytest
import jupytext
from jupytext.cli import jupytext as jupytext_cli
from jupytext.compare import compare, compare_notebooks
from jupytext.doxygen import doxygen_to_markdown, markdown_to_doxygen
SAMPLE_MARKDOWN = """A latex formula $$1+1$$, another one $$2+2
$$
An inline formula $3+3$
"""
... | 74 | 1,954 |
gunicorn | examples/frameworks/django/testing/testing/settings.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# Django settings for testing project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.... | 177 | 5,836 |
onnxruntime | onnxruntime/test/python/transformers/test_attention_fusion.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ... | 789 | 32,294 |
textual | docs/examples/guide/actions/actions06.py | .py | from textual.app import App, ComposeResult
from textual.containers import HorizontalScroll
from textual.reactive import reactive
from textual.widgets import Footer, Placeholder
PAGES_COUNT = 5
class PagesApp(App):
BINDINGS = [
("n", "next", "Next"),
("p", "previous", "Previous"),
]
CSS_P... | 49 | 1,353 |
onnx | onnx/backend/test/case/node/transpose.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import itertools
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Transpose(Base):
@staticmethod
def export_de... | 48 | 1,391 |
coremltools | deps/protobuf/python/google/protobuf/symbol_database.py | .py | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | 195 | 6,944 |
httpie | httpie/models.py | .py | from time import monotonic
import requests
from urllib3.util import SKIP_HEADER, SKIPPABLE_HEADERS
from enum import Enum, auto
from typing import Iterable, Union, NamedTuple
from urllib.parse import urlsplit
from .cli.constants import (
OUT_REQ_BODY,
OUT_REQ_HEAD,
OUT_RESP_BODY,
OUT_RESP_HEAD,
OU... | 234 | 6,483 |
cvxpy | cvxpy/atoms/elementwise/ceil.py | .py | """
Copyright, the CVXPY 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 or agreed to in writing, software
... | 180 | 4,959 |
mlflow | mlflow/entities/run_status.py | .py | from mlflow.protos.service_pb2 import RunStatus as ProtoRunStatus
class RunStatus:
"""Enum for status of an :py:class:`mlflow.entities.Run`."""
RUNNING = ProtoRunStatus.Value("RUNNING")
SCHEDULED = ProtoRunStatus.Value("SCHEDULED")
FINISHED = ProtoRunStatus.Value("FINISHED")
FAILED = ProtoRunStat... | 42 | 1,540 |
pyomo | pyomo/contrib/pynumero/interfaces/pyomo_nlp.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,472 | 59,507 |
astropy | astropy/io/tests/mixin_columns.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Mixin columns for use in ascii/tests/test_ecsv.py, fits/tests/test_connect.py,
and misc/tests/test_hdf5.py.
All columns should have length 2.
"""
import numpy as np
from astropy import coordinates, table, time
from astropy import units as u
el = co... | 275 | 7,633 |
probability | tensorflow_probability/python/distributions/discrete_rejection_sampling_test.py | .py | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 61 | 2,158 |
mlflow | mlflow/data/numpy_dataset.py | .py | import json
import logging
from functools import cached_property
from typing import Any
import numpy as np
from mlflow.data.dataset import Dataset
from mlflow.data.dataset_source import DatasetSource
from mlflow.data.digest_utils import compute_numpy_digest
from mlflow.data.evaluation_dataset import EvaluationDataset... | 220 | 8,154 |
saleor | saleor/graphql/shop/mutations/staff_notification_recipient_delete.py | .py | import graphene
from ....account import models as account_models
from ....permission.enums import SitePermissions
from ...account.types import StaffNotificationRecipient
from ...core.mutations import ModelDeleteMutation
from ...core.types import ShopError
class StaffNotificationRecipientDelete(ModelDeleteMutation):
... | 23 | 787 |
wandb | wandb/integration/metaflow/data_pandas.py | .py | """Support for Pandas datatypes.
May raise MissingDependencyError on import.
"""
from __future__ import annotations
from typing_extensions import Any, TypeIs
import wandb
from . import errors
try:
import pandas as pd
except ImportError as e:
warning = (
"`pandas` not installed >>"
" @wandb... | 75 | 1,713 |
wagtail | wagtail/test/testapp/fields.py | .py | from django.db import models
from wagtail.coreutils import multigetattr
class CommentableJSONField(models.JSONField):
def get_block_by_content_path(self, value, path_elements):
try:
multigetattr(value, ".".join(path_elements))
except AttributeError:
return False
re... | 13 | 330 |
textual | src/textual/containers.py | .py | """
Container widgets for quick styling.
With the exception of `Center` and `Middle` containers will fill all of the space in the parent widget.
"""
from __future__ import annotations
from typing import ClassVar
from textual.binding import Binding, BindingType
from textual.layout import Layout
from textual.layouts... | 312 | 8,693 |
beam | contributor-docs/discussion-docs/generate_doc_md.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... | 322 | 9,921 |
probability | tensorflow_probability/python/experimental/mcmc/sharded_test.py | .py | # Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 64 | 2,382 |
biopython | Bio/AlignIO/Interfaces.py | .py | # Copyright 2008-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 been included as part of this
# package.
"""AlignIO support modu... | 159 | 5,598 |
saleor | saleor/warehouse/tests/test_warehouse.py | .py | import pytest
from django.db.models import Q, Sum
from ...order.models import OrderLine
from .. import WarehouseClickAndCollectOption
from ..models import Stock, Warehouse
def test_applicable_for_click_and_collect_finds_warehouse_with_all_and_local(
stocks_for_cc, warehouses_for_cc, checkout_with_items_for_cc, c... | 826 | 27,634 |
mlflow | mlflow/cli/__init__.py | .py | import contextlib
import json
import logging
import os
import re
import sys
import warnings
from datetime import timedelta
from pathlib import Path
import click
from click import UsageError
from click.core import ParameterSource
from dotenv import load_dotenv
import mlflow.db
import mlflow.deployments.cli
import mlfl... | 1,452 | 54,143 |
pyomo | pyomo/core/plugins/transform/equality_transform.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,497 |
jupytext | tests/integration/contents_manager/test_cm_config.py | .py | import logging
import os
import sys
import unittest.mock as mock
import pytest
from jupyter_server.utils import ensure_async
from nbformat import read
from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook
from tornado.web import HTTPError
import jupytext
from jupytext.compare import compare_ce... | 261 | 9,840 |
scikit-bio | skbio/metadata/_metadata.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.
# ------------------------------------------------... | 1,365 | 45,678 |
qutip | qutip/solver/integrator/verner7efficient.py | .py | """
Provide a cython implimentation verner 'most-efficient'
order 7 runge-Kutta method.
See https://www.sfu.ca/~jverner/
"""
# Verner 7 Efficient
# https://www.sfu.ca/~jverner/RKV76.IIa.Efficient.00001675585.081206.CoeffsOnlyFLOAT
__all__ = ["vern7_coeff"]
import numpy as np
order = 7
rk_step = 10
rk_extra_step = 16
de... | 334 | 11,985 |
beam | sdks/python/apache_beam/examples/streaming_wordcount_debugging_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... | 109 | 3,558 |
pyomo | pyomo/common/tests/test_component_map.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 110 | 3,380 |
sqlmap | lib/utils/sqllint.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import os
import re
try:
from lib.core.data import kb
from lib.core.data import paths
from lib.core.common import getFileItems
except ImportError:
kb = paths = No... | 461 | 19,472 |
pyomo | pyomo/solvers/tests/models/SOS1_simple.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,925 |
pyomo | examples/kernel/special_ordered_sets.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... | 111 | 2,568 |
pyomo | pyomo/opt/parallel/async_solver.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... | 55 | 2,144 |
saleor | saleor/plugins/avatax/tasks.py | .py | from celery.utils.log import get_task_logger
from django.conf import settings
from ...celeryconf import app
from ...core.db.connection import allow_writer
from ...core.taxes import TaxError
from ...core.telemetry import saleor_attributes, tracer
from ...order.events import external_notification_event
from ...order.mod... | 59 | 2,097 |
coremltools | coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/delete_constant.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 coremltools import _logger as logger
from ..basic_graph_ops import check_connections, delete_no... | 83 | 3,059 |
onnx | onnx/reference/ops/op_global_max_pool.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
def _global_max_pool(x: np.ndarray) -> np.ndarray:
spatial_shape = np.ndim(x) - 2
y = x.max(axis=tuple(range(spatial_shape, spatial_s... | 23 | 523 |
mlflow | mlflow/store/db_migrations/versions/a1b2c3d4e5f6_add_spans_table.py | .py | """add spans table
Create Date: 2025-08-03 12:00:00.000000
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects.mysql import LONGTEXT
from mlflow.store.tracking.dbmodels.models import SqlSpan
# revision identifiers, used by Alembic.
revision = "a1b2c3d4e5f6"
down_revision = "770bee3ae1dd"
br... | 85 | 3,214 |
beam | learning/katas/python/Core Transforms/Partition/Partition/tests/test_task.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 45 | 1,530 |
probability | tensorflow_probability/python/distributions/von_mises_fisher.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... | 565 | 24,603 |
wandb | wandb/integration/sklearn/plot/classifier.py | .py | """Define plots for classification models built with scikit-learn."""
from warnings import simplefilter
import numpy as np
from sklearn import naive_bayes
import wandb
import wandb.plot
from wandb.integration.sklearn import calculate, utils
from . import shared
# ignore all future warnings
simplefilter(action="ign... | 330 | 11,753 |
mlflow | mlflow/entities/trace_info_v2.py | .py | from dataclasses import asdict, dataclass, field
from typing import Any
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.entities.assessment import Assessment
from mlflow.entities.trace_info import TraceInfo
from mlflow.entities.trace_location import TraceLocation
from mlflow.entities.trace_status ... | 159 | 6,083 |
black | scripts/check_pre_commit_rev_in_example.py | .py | """
Check that the rev value in the example pre-commit configuration matches
the latest version of Black. This saves us from forgetting to update that
during the release process.
Why can't we just use `rev: stable` and call it a day? Well pre-commit
won't auto update the hook as you may expect (and for good reasons, s... | 64 | 2,190 |
omegaconf | tests/test_serialization.py | .py | # -*- coding: utf-8 -*-
import copy
import io
import os
import pathlib
import pickle
import tempfile
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Type, Union
import yaml
from pytest import mark, param, raises
from omegaconf import MISSING, DictConfig, ListConfig, Node, OmegaConf, U... | 483 | 13,267 |
returns | returns/interfaces/unwrappable.py | .py | from abc import abstractmethod
from typing import Generic, TypeVar
_FirstType = TypeVar('_FirstType')
_SecondType = TypeVar('_SecondType')
_UnwrappableType = TypeVar('_UnwrappableType', bound='Unwrappable')
class Unwrappable(Generic[_FirstType, _SecondType]):
"""
Represents containers that can unwrap and re... | 51 | 1,602 |
flit | flit_core/tests_core/samples/ns1-pkg/ns1/pkg/__init__.py | .py | """
==================
ns1.pkg
==================
"""
__version__ = '0.1'
| 8 | 75 |
coremltools | deps/protobuf/python/google/protobuf/service_reflection.py | .py | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | 288 | 11,072 |
pyomo | pyomo/environ/tests/__init__.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... | 12 | 577 |
probability | tensorflow_probability/python/experimental/bijectors/highway_flow_test.py | .py | # Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 183 | 7,191 |
textual | src/textual/strip.py | .py | """
This module contains the `Strip` class and related objects.
A `Strip` contains the result of rendering a widget.
See [Line API](/guide/widgets#line-api) for how to use Strips.
"""
from __future__ import annotations
from functools import lru_cache
from typing import Any, Iterable, Iterator, Sequence
import rich.... | 818 | 26,717 |
django-cms | cms/models/permissionmodels.py | .py | from django.apps import apps
from django.conf import settings
from django.contrib.auth.models import Group, UserManager
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.db.models import Q
from django.utils.enco... | 383 | 13,839 |
textual | src/textual/theme.py | .py | from __future__ import annotations
from dataclasses import dataclass, field
from functools import partial
from operator import attrgetter
from typing import Callable
from textual.command import DiscoveryHit, Hit, Hits, Provider
from textual.design import ColorSystem
@dataclass
class Theme:
"""Defines a theme fo... | 545 | 16,788 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.