From 5a807f6fb6ad8149155752cae1dca97667250be3 Mon Sep 17 00:00:00 2001 From: Christopher Harris Date: Tue, 24 Oct 2023 21:10:36 +0000 Subject: [PATCH] fix styles --- python/mrc/_pymrc/include/pymrc/coro.hpp | 8 +++++--- python/mrc/_pymrc/src/coro.cpp | 4 ++-- python/mrc/_pymrc/tests/coro/CMakeLists.txt | 2 +- python/mrc/core/coro.cpp | 7 ++++--- python/tests/test_pycoro.py | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/python/mrc/_pymrc/include/pymrc/coro.hpp b/python/mrc/_pymrc/include/pymrc/coro.hpp index 43739be38..2f6fea905 100644 --- a/python/mrc/_pymrc/include/pymrc/coro.hpp +++ b/python/mrc/_pymrc/include/pymrc/coro.hpp @@ -28,10 +28,12 @@ #include #include +#include #include #include #include #include +#include #include // Dont directly include python headers @@ -180,7 +182,7 @@ class PYBIND11_EXPORT PyTaskToCppAwaitable } } - bool await_ready() const noexcept + bool await_ready() noexcept // NOLINT(readability-convert-member-functions-to-static) { // Always suspend return false; @@ -419,8 +421,8 @@ struct type_caster> static handle cast(mrc::coroutines::Task src, return_value_policy policy, handle parent) { // Wrap the object in a CppToPyAwaitable - std::shared_ptr awaitable = std::make_shared( - std::move(src)); + std::shared_ptr awaitable = + std::make_shared(std::move(src)); // Convert the object to a python object auto py_awaitable = pybind11::cast(std::move(awaitable)); diff --git a/python/mrc/_pymrc/src/coro.cpp b/python/mrc/_pymrc/src/coro.cpp index 21a373419..8bb57cb84 100644 --- a/python/mrc/_pymrc/src/coro.cpp +++ b/python/mrc/_pymrc/src/coro.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,4 +23,4 @@ namespace py = pybind11; StopIteration::~StopIteration() = default; -} // namespace mrc::pycoro +} // namespace mrc::pymrc::coro diff --git a/python/mrc/_pymrc/tests/coro/CMakeLists.txt b/python/mrc/_pymrc/tests/coro/CMakeLists.txt index a26d7fa9e..788d04832 100644 --- a/python/mrc/_pymrc/tests/coro/CMakeLists.txt +++ b/python/mrc/_pymrc/tests/coro/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2023, NVIDIA 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 diff --git a/python/mrc/core/coro.cpp b/python/mrc/core/coro.cpp index c22d3be62..8139ce9ec 100644 --- a/python/mrc/core/coro.cpp +++ b/python/mrc/core/coro.cpp @@ -49,8 +49,9 @@ PYBIND11_MODULE(coro, _module) .def("__await__", &CppToPyAwaitable::await) .def("__next__", &CppToPyAwaitable::next); - py::class_>( - _module, "BoostFibersMainPyAwaitable") + py::class_>( // + _module, + "BoostFibersMainPyAwaitable") .def(py::init<>()); _module.def("wrap_coroutine", [](coroutines::Task> fn) -> coroutines::Task { @@ -64,4 +65,4 @@ PYBIND11_MODULE(coro, _module) // _module.attr("__version__") = // MRC_CONCAT_STR(morpheus_VERSION_MAJOR << "." << morpheus_VERSION_MINOR << "." << morpheus_VERSION_PATCH); } -} // namespace mrc::pycoro +} // namespace mrc::pymrc::coro diff --git a/python/tests/test_pycoro.py b/python/tests/test_pycoro.py index 7b207a161..6222d4b92 100644 --- a/python/tests/test_pycoro.py +++ b/python/tests/test_pycoro.py @@ -14,12 +14,13 @@ # limitations under the License. import asyncio + import pytest -from mrc.core import coro as pycoro # pylint: disable=morpheus-incorrect-lib-from-import from mrc._pymrc.tests.coro.coro import call_async from mrc._pymrc.tests.coro.coro import call_fib_async from mrc._pymrc.tests.coro.coro import raise_at_depth_async +from mrc.core import coro as pycoro @pytest.mark.asyncio