Mercurial > p > roundup > code
changeset 7024:bac315283a55
flake8: E721 do not compare types, use 'isinstance()'
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 09 Oct 2022 17:44:45 -0400 |
| parents | ae6fa7b32e2d |
| children | 66149a18f09e |
| files | roundup/cgi/templating.py |
| diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Sun Oct 09 17:40:14 2022 -0400 +++ b/roundup/cgi/templating.py Sun Oct 09 17:44:45 2022 -0400 @@ -1162,14 +1162,14 @@ for id, evt_date, user, action, args in history: date_s = str(evt_date.local(timezone)).replace("."," ") arg_s = '' - if action in ['link', 'unlink'] and type(args) == type(()): + if action in ['link', 'unlink'] and isinstance(args, tuple): if len(args) == 3: linkcl, linkid, key = args arg_s += '<a rel="nofollow noopener" href="%s%s">%s%s %s</a>'%(linkcl, linkid, linkcl, linkid, key) else: arg_s = str(args) - elif type(args) == type({}): + elif isinstance(args, dict): cell = [] for k in args.keys(): # try to get the relevant property and treat it @@ -3252,7 +3252,7 @@ for k,v in self.filterspec.items(): if k in exclude: continue - if type(v) == type([]): + if isinstance(v, list): # id's are stored as strings but should be treated # as integers in lists. if (isinstance(cls.get_transitive_prop(k), hyperdb.String) @@ -3324,7 +3324,7 @@ cls = self.client.db.getclass(self.classname) for k,v in self.filterspec.items(): if k not in args: - if type(v) == type([]): + if isinstance(v, list): prop = cls.get_transitive_prop(k) if k != 'id' and isinstance(prop, hyperdb.String): l.append('%s=%s'%(k, '%20'.join([q(i) for i in v])))
