From 5d3e45ecc92d70abe8046c0909d56b21906266e7 Mon Sep 17 00:00:00 2001 From: Sayandip Dutta Date: Mon, 7 Feb 2022 21:48:59 +0530 Subject: [PATCH] Add type hint to `claim` method in `ActiveDispatchInfoManager` (#95) * Add type hints to ActiveDispatchInfoManager.claim. (#59) * Typing: Add Type hint `dispatch_info` parameter. * Typing: Change return type annotation to `Generator`. * Documentation: Updated the return_type description in docstring. * Doc: Restructure return type docs * Update VERSION to 0.24.7, update CHANGELOG --- CHANGELOG.md | 11 +++++++++++ VERSION | 2 +- covalent/_shared_files/context_managers.py | 6 +++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af1ffcaea..04b976661 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.24.7] - 2022-02-07 + +### Added + +- Typing: Add Type hint `dispatch_info` parameter. +- Documentation: Updated the return_type description in docstring. + +### Changed + +- Typing: Change return type annotation to `Generator`. + ## [0.24.6] - 2022-02-06 ### Added diff --git a/VERSION b/VERSION index b9c51a1a9..c9731ff41 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.24.6 +0.24.7 diff --git a/covalent/_shared_files/context_managers.py b/covalent/_shared_files/context_managers.py index 5be64e754..6e1953ef8 100644 --- a/covalent/_shared_files/context_managers.py +++ b/covalent/_shared_files/context_managers.py @@ -22,7 +22,7 @@ import threading from contextlib import contextmanager -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Generator if TYPE_CHECKING: from .._shared_files.util_classes import DispatchInfo @@ -113,7 +113,7 @@ def get_active_dispatch_info(self) -> "DispatchInfo": return self._active_dispatch_info @contextmanager - def claim(self, dispatch_info) -> None: + def claim(self, dispatch_info: "DispatchInfo") -> Generator: """ Claims the given dispatch info as active. @@ -121,7 +121,7 @@ def claim(self, dispatch_info) -> None: dispatch_info: The dispatch info object to claim. Returns: - None + Returns a generator, which gets converted into a contextmanager. """ self._active_dispatch_info = dispatch_info