Skip to content

Commit

Permalink
Fix type of StatusBase.name (#980)
Browse files Browse the repository at this point in the history
This also fixes the type of a subclass's .name attribute, such as
BlockedStatus.name, so that a "# type: ignore" comment is not required
in such things as "status_str == BlockedStatus.name".

See canonical/github-runner-operator#79 (comment)
  • Loading branch information
benhoyt committed Jul 26, 2023
1 parent 7da07cb commit fad95d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ops/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,8 @@ class StatusBase:

_statuses: Dict[str, Type['StatusBase']] = {}

# Subclasses should override this attribute and make it a string.
name = NotImplemented
# Subclasses should override this attribute
name = ''

def __init__(self, message: str = ''):
if self.__class__ is StatusBase:
Expand Down

0 comments on commit fad95d7

Please sign in to comment.