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 |
|---|---|---|---|---|---|
mlflow | mlflow/optuna/storage.py | .py | import copy
import datetime
import json
import threading
import time
import uuid
import weakref
from collections.abc import Container, Sequence
from typing import Any
from mlflow import MlflowClient
from mlflow.entities import Metric, Param, RunTag
from mlflow.utils.mlflow_tags import MLFLOW_PARENT_RUN_ID
try:
fr... | 663 | 25,313 |
wandb | tests/system_tests/test_artifacts/test_wandb_artifacts_full.py | .py | from __future__ import annotations
import os
import platform
import re
import shutil
import time
from datetime import datetime, timedelta, timezone
from pathlib import Path
import numpy as np
import responses
import wandb
from pytest import MonkeyPatch, mark, raises
from pytest_mock import MockerFixture
from wandb im... | 911 | 33,614 |
saleor | saleor/graphql/product/tests/deprecated/test_product_sorting.py | .py | import datetime
import graphene
import pytest
from django.utils import timezone
from freezegun import freeze_time
from .....product.models import (
Collection,
CollectionChannelListing,
ProductChannelListing,
)
from ....tests.utils import assert_graphql_error_with_message, get_graphql_content
GET_SORTED_... | 250 | 7,251 |
pyro | pyro/ops/streaming.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import copy
from abc import ABC, abstractmethod
from collections import defaultdict
from typing import Any, Callable, Dict, Hashable, Union
import torch
from pyro.ops.welford import WelfordCovariance
class StreamingStats(ABC):
... | 278 | 8,903 |
python-prompt-toolkit | examples/prompts/inputhook.py | .py | #!/usr/bin/env python
"""
An example that demonstrates how inputhooks can be used in prompt-toolkit.
An inputhook is a callback that an eventloop calls when it's idle. For
instance, readline calls `PyOS_InputHook`. This allows us to do other work in
the same thread, while waiting for input. Important however is that w... | 85 | 2,432 |
wagtail | wagtail/admin/api/actions/delete.py | .py | from django.core.exceptions import ValidationError as DjangoValidationError
from rest_framework import status
from rest_framework.exceptions import ValidationError
from rest_framework.response import Response
from rest_framework.serializers import Serializer
from wagtail.actions.delete_page import DeletePageAction
fr... | 27 | 834 |
wagtail | scripts/nightly/get_version.py | .py | """
This script is called by the nightly build in Circle CI.
It alters the version of Wagtail to include the build date
"""
import datetime
from wagtail import VERSION
INIT_TEMPLATE = """
from wagtail.utils.version import get_semver_version, get_version
# major.minor.patch.release.number
# release must be one of a... | 33 | 722 |
django-cms | cms/tests/test_menu_page_viewperm.py | .py | from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser, Group
from django.contrib.sites.models import Site
from django.test.utils import override_settings
from cms.api import create_page
from cms.cms_menus import get_visible_page_contents
from cms.models import (
ACCESS... | 650 | 23,888 |
hatch | src/hatch/template/plugin/interface.py | .py | class TemplateInterface:
PLUGIN_NAME = ""
PRIORITY = 100
def __init__(self, plugin_config: dict, cache_dir, creation_time):
self.plugin_config = plugin_config
self.cache_dir = cache_dir
self.creation_time = creation_time
def initialize_config(self, config):
"""
... | 22 | 778 |
mlflow | docs/api_reference/gateway_api_docs.py | .py | import json
import tempfile
from pathlib import Path
from mlflow.gateway.app import create_app_from_path
# This HTML was obtained by sending a request to the `/docs` route and saving the response.
# To hide the "try it out" button, we set `supportedSubmitMethods` to an empty list.
# The url was changed to "./openapi.... | 94 | 2,529 |
sphinx | tests/roots/test-ext-autodoc/target/_functions_to_import.py | .py | from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from sphinx.application import Sphinx
def function_to_be_imported(app: Optional['Sphinx']) -> str:
"""docstring"""
| 9 | 187 |
cvxpy | cvxpy/atoms/elementwise/xexp.py | .py | """
Copyright 2022, 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, soft... | 99 | 2,831 |
django-cms | cms/tests/test_signals.py | .py | import warnings
from django.conf import settings
from django.test.utils import override_settings
from cms.api import create_page
from cms.models import Page, UrlconfRevision
from cms.signals import move_page, urls_need_reloading
from cms.test_utils.project.sampleapp.cms_apps import SampleApp
from cms.test_utils.testc... | 112 | 4,929 |
saleor | saleor/graphql/menu/mutations/menu_update.py | .py | import graphene
from ....menu import models
from ....permission.enums import MenuPermissions
from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.context import ChannelContext
from ...core.mutations import DeprecatedModelMutation
from ...core.types import MenuError
fro... | 50 | 1,714 |
notebook | notebook/__init__.py | .py | from __future__ import annotations
from typing import Any
from ._version import __version__, version_info # noqa: F401
def _jupyter_server_extension_paths() -> list[dict[str, str]]:
return [{"module": "notebook"}]
def _jupyter_server_extension_points() -> list[dict[str, Any]]:
# Deferred import to avoid ... | 21 | 623 |
beam | sdks/python/apache_beam/io/external/xlang_mqttio_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... | 263 | 9,878 |
coremltools | deps/kmeans1d/tests/test_kmeans1d.py | .py | # MIT License
#
# Copyright (c) 2019 Daniel Steinberg
#
# 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, copy, modify, me... | 86 | 3,461 |
saleor | saleor/graphql/meta/tests/mutations/test_order.py | .py | from unittest.mock import ANY, patch
import graphene
from django.test import override_settings
from .....core.models import EventDelivery
from .....order import OrderStatus
from .....payment.models import TransactionItem
from .....webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from . import PR... | 790 | 24,935 |
omegaconf | tests/test_grammar.py | .py | import math
import re
import threading
import time
from contextlib import nullcontext
from typing import Any, Callable, List, Optional, Set, Tuple
from pytest import mark, param, raises, warns
from omegaconf import (
AnyNode,
Container,
DictConfig,
ListConfig,
OmegaConf,
_utils,
grammar_pa... | 834 | 33,951 |
confluent-kafka-python | tests/integration/share_consumer/test_share_consumer_commit.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2026 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 1,700 | 66,590 |
coremltools | coremltools/optimize/torch/palettization/_efficient_kmeans.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 typing import Optional as _Optional
from typing import Union as _Union
import numpy as _np
impo... | 278 | 10,651 |
wagtail | wagtail/admin/widgets/__init__.py | .py | from wagtail.admin.widgets.auto_height_text import * # NOQA: F403
from wagtail.admin.widgets.boolean_radio_select import * # NOQA: F403
from wagtail.admin.widgets.button import * # NOQA: F403
from wagtail.admin.widgets.chooser import * # NOQA: F403
from wagtail.admin.widgets.datetime import * # NOQA: F403
from wag... | 10 | 545 |
probability | tensorflow_probability/python/math/ode/base.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... | 626 | 25,313 |
biopython | Tests/test_Align_mauve.py | .py | # Copyright 2006-2014 by Peter Cock. All rights reserved.
# Revisions copyright 2011 Brandon Invergo. 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 Bio.Align.mauve... | 1,060 | 41,843 |
mlflow | mlflow/genai/agent_server/utils.py | .py | import logging
import os
import subprocess
from contextvars import ContextVar
from mlflow.tracking.fluent import _set_active_model
# Context-isolated storage for request headers
# ensuring thread-safe access across async execution contexts
_request_headers: ContextVar[dict[str, str]] = ContextVar[dict[str, str]](
... | 48 | 1,656 |
probability | tensorflow_probability/python/internal/prefer_static.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... | 579 | 23,472 |
coremltools | coremltools/converters/mil/frontend/torch/utils.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from enum import Enum
import numpy as np
import torch
from coremltools.converters.mil.mil import ty... | 186 | 5,381 |
pyomo | pyomo/core/beta/dict_objects.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... | 213 | 8,761 |
django-cms | cms/test_utils/project/noadmin_urls.py | .py | from django.conf import settings
from django.urls import include, re_path
from django.views.i18n import JavaScriptCatalog
from django.views.static import serve
from cms.utils.conf import get_cms_setting
urlpatterns = [
re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT, 'show_indexes': ... | 16 | 580 |
cvxpy | cvxpy/tests/test_derivative.py | .py | import warnings
import numpy as np
import cvxpy as cp
import cvxpy.settings as s
from cvxpy.tests.base_test import BaseTest
warnings.filterwarnings("ignore")
SOLVE_METHODS = [s.CLARABEL, s.SCS, ]
EPS_NAME = {s.SCS: "eps",
s.CLARABEL: "tol_gap_abs"}
MAX_ITERS_NAME = {s.SCS: "max_iters",
s.CL... | 874 | 34,473 |
conda | tests/cli/test_main_list.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import json
import re
import sys
from typing import TYPE_CHECKING
import pytest
from conda.base.constants import CONDA_LIST_FIELDS
from conda.common.configuration import CustomValidationError
from conda.core... | 409 | 13,297 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_less_than.py | .py | #
# less_than paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
def less_than(name: str, x, y, data_type, cast_to_fp32=False):
paddle.enable_static()
with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()):
node_x = paddle... | 62 | 1,829 |
beam | sdks/python/apache_beam/transforms/external_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... | 899 | 35,805 |
kombu | kombu/asynchronous/aws/sqs/ext.py | .py | """Amazon SQS boto3 interface."""
from __future__ import annotations
try:
import boto3
except ImportError:
boto3 = None
| 10 | 131 |
metrics | src/torchmetrics/functional/segmentation/mean_iou.py | .py | # Copyright The PyTorch 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 i... | 158 | 6,786 |
conda | conda/cli/main_env.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Entry point for all conda-env subcommands."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace, _SubParsersAction
def configure_parser(sub_parsers: _... | 48 | 1,233 |
beam | sdks/python/apache_beam/ml/inference/pytorch_inference_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,022 | 38,785 |
scikit-bio | skbio/diversity/beta/tests/test_unifrac.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.
# --------------------------------------------... | 692 | 29,934 |
voila | voila/utils.py | .py | #############################################################################
# Copyright (c) 2018, Voilà Contributors #
# Copyright (c) 2018, QuantStack #
# #
# Distri... | 377 | 12,860 |
confluent-kafka-python | src/confluent_kafka/schema_registry/rules/encryption/awskms/aws_driver.py | .py | # Copyright 2024 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 required by applicable law or agreed to in writing, s... | 108 | 4,060 |
ipython | IPython/core/magics/ast_mod.py | .py | """
This module contains utility function and classes to inject simple ast
transformations based on code strings into IPython. While it is already possible
with ast-transformers it is not easy to directly manipulate ast.
IPython has pre-code and post-code hooks, but are ran from within the IPython
machinery so may be... | 329 | 10,226 |
readthedocs.org | readthedocs/analytics/tasks.py | .py | """Tasks for Read the Docs' analytics."""
from django.conf import settings
from django.utils import timezone
from readthedocs.analytics.models import PageView
from readthedocs.worker import app
@app.task(queue="web")
def delete_old_page_counts():
"""
Delete page counts older than ``RTD_ANALYTICS_DEFAULT_RET... | 26 | 858 |
cvxpy | cvxpy/tests/atoms/affine/test_stack.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
... | 111 | 3,625 |
saleor | saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py | .py | import base64
from io import BytesIO
from unittest.mock import ANY, Mock, patch
import pytest
import requests
from PIL import Image
from requests_hardened import HTTPSession
from ..... import schema_version
from .....app.error_codes import AppErrorCode
from .....app.models import App
from .....thumbnail import IconTh... | 1,085 | 33,188 |
openvino | tests/samples_tests/smoke_tests/test_sync_benchmark.py | .py | """
Copyright (C) 2018-2026 Intel Corporation
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 w... | 32 | 1,297 |
onnx | onnx/backend/test/case/node/not_.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.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Not(Base):
@staticmethod
def export() -> None:
node = ... | 33 | 883 |
saleor | saleor/tests/e2e/orders/discounts/test_gift_promotion_applied_on_draft_order.py | .py | import pytest
from ... import DEFAULT_ADDRESS
from ...product.utils.preparing_product import prepare_product
from ...promotions.utils import create_promotion, create_promotion_rule
from ...shop.utils.preparing_shop import prepare_shop
from ...taxes.utils import update_country_tax_rates
from ...utils import assign_perm... | 228 | 7,887 |
wagtail | wagtail/admin/tests/pages/test_page_viewset.py | .py | import datetime
from io import BytesIO
from unittest import mock
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.test import SimpleTestCase, TestCase
from django.test.utils import isolate_apps
from django.urls import reverse
from openpyxl import load_workbook
from w... | 757 | 28,537 |
metrics | tests/unittests/wrappers/test_feature_share.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... | 236 | 8,369 |
jupytext | tests/data/notebooks/outputs/ipynb_to_percent/sample_rise_notebook_66.py | .py | # ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown] slideshow={"slide_type": "slide"}
# A markdown cell
# %% slideshow={"slide_type": ""}
1+1
# %% [markdown] cell_style="center" slideshow={"slide_type": "fragment"}
# Markdown cell two
| 17 | 313 |
mlflow | tests/evaluate/test_default_evaluator_delta.py | .py | import tempfile
import pandas as pd
import pytest
from pyspark.sql import SparkSession
import mlflow
from mlflow.exceptions import MlflowException
def language_model(inputs: list[str]) -> list[str]:
return inputs
def test_write_to_delta_fails_without_spark():
with mlflow.start_run():
model_info = ... | 146 | 5,012 |
beam | sdks/python/apache_beam/testing/metric_result_matchers_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... | 238 | 8,712 |
qutip | qutip/tests/solver/test_sode_method.py | .py | import numpy as np
from itertools import product
from qutip.core import data as _data
from qutip import (qeye, destroy, QobjEvo, rand_ket, rand_herm, create, Qobj,
operator_to_vector, fock_dm)
import qutip.solver.sode._sode as _sode
import pytest
from qutip.solver.sode.ssystem import (
SimpleStoc... | 202 | 7,772 |
pymc | tests/distributions/test_dist_math.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... | 222 | 7,002 |
onnxruntime | tools/python/materialize_onnx_node_tests.py | .py | #!/usr/bin/env python
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Materialize ONNX node-test artifacts from ONNX's Python generators.
ONNX PR onnx/onnx#7959 deletes the on-disk node-test corpus
(``onnx/backend/test/data/node/**``) that ONNX Runtime's C++ ``onnx_tes... | 649 | 31,946 |
mlflow | tests/resources/example_docker_project/scripts/docker_tracking_test.py | .py | import sys
import tempfile
import mlflow
def call_tracking_apis():
mlflow.log_metric("some_key", 3)
with tempfile.NamedTemporaryFile("w") as temp_file:
temp_file.write("Temporary content.")
mlflow.log_artifact(temp_file.name)
def main(use_start_run):
if use_start_run:
with mlflo... | 24 | 477 |
beam | sdks/python/apache_beam/ml/rag/enrichment/milvus_search_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... | 1,002 | 35,567 |
kafka | docker/test/constants.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 ... | 51 | 2,514 |
wandb | parquet-rust-wrapper/hatch.py | .py | """Build script for arrow-rs-wrapper."""
from __future__ import annotations
import glob
import json
import os
import pathlib
import platform
import subprocess
class ArrowRsWrapperBuildError(Exception):
"""Raised when building arrow-rs-wrapper fails."""
def build_arrow_rs_wrapper(
cargo_binary: pathlib.Pat... | 121 | 4,071 |
biopython | Tests/test_Phylo.py | .py | # Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com)
# 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.
"""Unit tests for the Bio.Phylo module."""
import os
import tempfile
import unittest
fr... | 562 | 23,595 |
metrics | src/torchmetrics/functional/clustering/cluster_accuracy.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... | 68 | 2,538 |
python-prompt-toolkit | src/prompt_toolkit/shortcuts/progress_bar/base.py | .py | """
Progress bar implementation on top of prompt_toolkit.
::
with ProgressBar(...) as pb:
for item in pb(data):
...
"""
from __future__ import annotations
import contextvars
import datetime
import functools
import os
import signal
import threading
import traceback
from collections.abc import... | 446 | 14,409 |
pyomo | pyomo/contrib/mindtpy/tests/MINLP3_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... | 83 | 2,870 |
hydra | tests/test_callbacks.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import os
import pickle
import subprocess
import sys
from pathlib import Path
from textwrap import dedent
from typing import Any, List
from omegaconf import open_dict, read_write
from pytest import mark, param
from hydra.core.utils imp... | 261 | 8,610 |
biopython | Bio/PDB/Polypeptide.py | .py | # Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
#
# 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.
"""Polypeptide-relat... | 460 | 14,220 |
mlflow | dev/pypi/tests/test_models.py | .py | from __future__ import annotations
from typing import Any
import pytest
from packaging.specifiers import SpecifierSet
from packaging.version import Version
from pypi._models import Package
_DEFAULT_UPLOAD = "2024-01-01T00:00:00Z"
def _payload(releases: dict[str, list[dict[str, Any]]]) -> dict[str, Any]:
# Inje... | 153 | 5,177 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/tolist_test.py | .py | # coding=utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License");... | 61 | 1,838 |
probability | tensorflow_probability/python/sts/components/autoregressive_integrated_moving_average_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... | 89 | 3,882 |
saleor | saleor/invoice/__init__.py | .py | class InvoiceEvents:
REQUESTED = "requested"
REQUESTED_DELETION = "requested_deletion"
CREATED = "created"
DELETED = "deleted"
SENT = "sent"
CHOICES = [
(REQUESTED, "The invoice was requested"),
(REQUESTED_DELETION, "The invoice was requested for deletion"),
(CREATED, "T... | 15 | 443 |
mlflow | mlflow/tracking/_uc_upsell.py | .py | from mlflow.utils.logging_utils import eprint
_BOLD_ORANGE = "\033[1;38;5;208m"
_LIGHT_BLUE = "\033[94m"
_RESET = "\033[0m"
def show_existing_experiment_upsell():
doc_url = "https://docs.databricks.com/aws/en/mlflow3/genai/tracing/migrate-traces-to-uc"
eprint(
f"{_BOLD_ORANGE}If you are using MLflow ... | 26 | 1,029 |
metrics | tests/integrations/test_lightning.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... | 621 | 22,829 |
biopython | Tests/test_Phd.py | .py | # Revisions copyright 2009 by Peter Cock. 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 Phd module."""
import unittest
from Bio import SeqIO
from Bio.Sequencing ... | 482 | 20,470 |
pyomo | pyomo/opt/tests/base/test_ampl.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... | 293 | 11,893 |
astropy | astropy/io/votable/tests/test_vo.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is a set of regression tests for vo.
"""
# STDLIB
import difflib
import gzip
import io
import pathlib
import re
import sys
from unittest import mock
# THIRD-PARTY
import numpy as np
import pytest
from numpy.testing import assert_array_equal
# L... | 1,235 | 40,575 |
wagtail | wagtail/users/views/bulk_actions/set_active_state.py | .py | from django import forms
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext
from wagtail.users.views.bulk_actions.user_bulk_action import UserBulkAction
from wagtail.users.views.users import change_user_perm
class ActivityForm(forms.Form):
mark_as_active = forms.... | 73 | 2,767 |
colorama | demos/demo02.py | .py | #!/usr/bin/python
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
# Simple demo of changing foreground, background and brightness.
import fixpath
from colorama import just_fix_windows_console, Fore, Back, Style
just_fix_windows_console()
print(Fore.GREEN + 'green, '
+ Fore.RED + 'red,... | 24 | 576 |
wandb | wandb/proto/v4/wandb_internal_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: wandb/proto/wandb_internal.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 symbol_dat... | 382 | 58,481 |
biopython | Tests/test_PDB_MMCIFIO.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... | 238 | 8,603 |
wandb | wandb/_filters/filterutils.py | .py | """Helpers for parsing and transforming MongoDB expressions.
If a function is defined here, it's an internal helper that we deliberately
don't expose as instnace methods on filter types for now.
"""
from __future__ import annotations
from collections.abc import Iterator
from functools import singledispatch
from typi... | 97 | 3,064 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_multiclass_nms.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# multiclass_nms paddle model generator
#
import os
import numpy as np
import copy # deepcopy
import sys
from nms import NMS
def main(): # multiclass_nms
test_case = [None] * 20
# case multiclass_nms_by_class_id
test_... | 422 | 16,221 |
astropy | astropy/modeling/tests/irafutil.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides functions to help with testing against iraf tasks.
"""
import numpy as np
from astropy.logger import log
class IdentifyRecord:
"""
Represents a database record for the onedspec.identify task.
Attributes
-------... | 97 | 3,037 |
gunicorn | tests/docker/dirty_ttin_ttou/__init__.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Docker integration tests for dirty arbiter TTIN/TTOU signals."""
| 6 | 174 |
mlflow | tests/entities/test_webhook.py | .py | import pytest
from mlflow.entities.webhook import (
Webhook,
WebhookAction,
WebhookEntity,
WebhookEvent,
WebhookStatus,
WebhookTestResult,
)
from mlflow.exceptions import MlflowException
from mlflow.protos.webhooks_pb2 import WebhookAction as ProtoWebhookAction
from mlflow.protos.webhooks_pb2 i... | 226 | 7,898 |
loguru | tests/test_ansimarkup_extended.py | .py | import pytest
from colorama import Back, Fore, Style
from .conftest import parse
@pytest.mark.parametrize(
("text", "expected"),
[
("<bg red>1</bg red>", Back.RED + "1" + Style.RESET_ALL),
("<bg BLACK>1</bg BLACK>", Back.BLACK + "1" + Style.RESET_ALL),
("<bg light-green>1</bg light-gr... | 253 | 8,013 |
wandb | tests/system_tests/test_functional/console_capture/patch_stdout_and_stderr.py | .py | """Exits with code 0 if stdout and stderr callbacks are triggered.
On success, prints "I AM STDOUT" to stdout and "I AM STDERR" to stderr.
On error, prints additional text to stderr.
"""
import sys
from wandb.sdk.lib import console_capture
_got_stdout = False
_got_stderr = False
def _on_stdout(s, n):
global _... | 41 | 837 |
astropy | astropy/modeling/tests/test_quantities_model.py | .py | # Various tests of models not related to evaluation, fitting, or parameters
# pylint: disable=invalid-name, no-member
import pytest
from astropy import units as u
from astropy.modeling import models
from astropy.modeling.core import _ModelMeta
from astropy.modeling.models import Gaussian1D, Mapping, Pix2Sky_TAN
from a... | 143 | 3,736 |
saleor | saleor/graphql/warehouse/mutations/base.py | .py | from django.core.exceptions import ValidationError
from ....warehouse import WarehouseClickAndCollectOption
from ....warehouse.error_codes import WarehouseErrorCode
from ...core import ResolveInfo
from ...core.validators import (
validate_required_string_field,
validate_slug_and_generate_if_needed,
)
class W... | 62 | 2,335 |
scikit-bio | skbio/io/format/tests/test_stockholm.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.
# --------------------------------------------... | 915 | 42,679 |
saleor | saleor/plugins/webhook/tests/subscription_webhooks/filterable_webhooks/test_order_cancelled.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... | 230 | 7,004 |
mkdocs-material | material/plugins/tags/structure/tag/options.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... | 109 | 3,916 |
mlflow | mlflow/store/db_migrations/versions/d0e1f2a3b4c5_add_experiment_id_to_endpoints.py | .py | """add experiment_id and usage_tracking to endpoints table
Create Date: 2025-01-13 00:00:00.000000
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "d0e1f2a3b4c5"
down_revision = "d3e4f5a6b7c8"
branch_labels = None
depends_on = None
def upgrade():
# Add ex... | 39 | 1,211 |
openvino | tools/ovc/unit_tests/moc_tf_fe/test_models/model_three_inputs.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
tf.reset_default_graph()
with tf.Session() as sess:
x = tf.placeholder(tf.float32, [3], 'x')
y = tf.placeholder(tf.float32, [3], 'y')
z = tf.placeholder(tf.float32, [3], 'z')
add = tf.ad... | 18 | 515 |
python-prompt-toolkit | tests/test_cli.py | .py | """
These are almost end-to-end tests. They create a Prompt, feed it with some
input and check the result.
"""
from __future__ import annotations
from functools import partial
import pytest
from prompt_toolkit.clipboard import ClipboardData, InMemoryClipboard
from prompt_toolkit.enums import EditingMode
from prompt... | 943 | 28,042 |
pyomo | pyomo/contrib/solver/solvers/highs.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... | 843 | 31,880 |
bazel | scripts/docs/docs2mdx.py | .py | # Lint as: python3
# pylint: disable=g-direct-third-party-import
# Copyright 2026 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.apa... | 291 | 8,399 |
metrics | tests/unittests/video/test_vmaf.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... | 142 | 5,727 |
onnx | onnx/backend/test/case/node/isinf.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.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class IsInf(Base):
@staticmethod
def export_infinity() -> None:
... | 57 | 1,723 |
qutip | qutip/solver/integrator/integrator.py | .py | """ `Integrator`: ODE solver wrapper to use in qutip's Solver """
import numpy as np
from collections.abc import Iterator, Callable
from qutip.core import QobjEvo
from ._rhs import RHS
from qutip.core.data import Data
__all__ = ['Integrator', 'IntegratorException']
class IntegratorException(Exception):
"""Error ... | 241 | 7,804 |
saleor | saleor/channel/error_codes.py | .py | from enum import Enum
class ChannelErrorCode(Enum):
ALREADY_EXISTS = "already_exists"
GRAPHQL_ERROR = "graphql_error"
INVALID = "invalid"
NOT_FOUND = "not_found"
REQUIRED = "required"
UNIQUE = "unique"
CHANNELS_CURRENCY_MUST_BE_THE_SAME = "channels_currency_must_be_the_same"
CHANNEL_WI... | 14 | 406 |
pyro | tests/distributions/test_ig.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
from pyro.distributions import Gamma, InverseGamma
from tests.common import assert_equal
@pytest.mark.parametrize("concentration", [3.3, 4.0])
@pytest.mark.parametrize("rate", [2.5, 3.0])
... | 34 | 1,192 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.