From 4376ba0f13794fb6e7d4625419e1274733f4ee67 Mon Sep 17 00:00:00 2001 From: Ricardo Branco Date: Mon, 3 Jul 2023 12:38:27 +0200 Subject: [PATCH] fix --- ocw/enums.py | 11 +++++------ ocw/models.py | 4 ++-- ocw/tables.py | 3 +-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ocw/enums.py b/ocw/enums.py index 4a3870ce..047e5ecd 100644 --- a/ocw/enums.py +++ b/ocw/enums.py @@ -16,7 +16,7 @@ def __ne__(self, other): return not self == other -class ProviderChoice(ChoiceEnum): +class ProviderChoice(ChoiceEnum) -> str: GCE = 'Google' EC2 = 'EC2' AZURE = 'Azure' @@ -26,14 +26,13 @@ class ProviderChoice(ChoiceEnum): def from_str(provider): if provider.upper() == ProviderChoice.GCE: return ProviderChoice.GCE - elif provider.upper() == ProviderChoice.EC2: + if provider.upper() == ProviderChoice.EC2: return ProviderChoice.EC2 - elif provider.upper() == ProviderChoice.AZURE: + if provider.upper() == ProviderChoice.AZURE: return ProviderChoice.AZURE - elif provider.upper() == ProviderChoice.OSTACK: + if provider.upper() == ProviderChoice.OSTACK: return ProviderChoice.OSTACK - else: - raise ValueError(f"{provider} is not convertable to ProviderChoice") + raise ValueError(f"{provider} is not convertable to ProviderChoice") class StateChoice(ChoiceEnum): diff --git a/ocw/models.py b/ocw/models.py index 6ba044e4..8be52a38 100644 --- a/ocw/models.py +++ b/ocw/models.py @@ -42,9 +42,9 @@ def all_time_fields(self): all_time_pattern = "(age={}, first_seen={}, last_seen={}, ttl={})" first_fmt = 'None' last_fmt = 'None' - if (self.first_seen): + if self.first_seen: first_fmt = self.first_seen.strftime('%Y-%m-%d %H:%M') - if (self.last_seen): + if self.last_seen: last_fmt = self.last_seen.strftime('%Y-%m-%d %H:%M') return all_time_pattern.format(self.age_formated(), first_fmt, last_fmt, self.ttl_formated()) diff --git a/ocw/tables.py b/ocw/tables.py index bc5f8280..62dfe066 100644 --- a/ocw/tables.py +++ b/ocw/tables.py @@ -40,8 +40,7 @@ def render(self, value, record, bound_column): if value: return format_html('Email notification was send', static('img/notified.png')) - else: - return "" + return "" class TagsColumn(tables.TemplateColumn):