Skip to content

Commit

Permalink
Add type hint to claim method in ActiveDispatchInfoManager (#95)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sayandipdutta authored Feb 7, 2022
1 parent 0e93a53 commit 5d3e45e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.24.6
0.24.7
6 changes: 3 additions & 3 deletions covalent/_shared_files/context_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -113,15 +113,15 @@ 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.
Args:
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
Expand Down

0 comments on commit 5d3e45e

Please sign in to comment.