diff roundup/rest.py @ 8201:d5ad7fcb9bf6

chore(ruff): replace dict(...) with equivalent {...}
author John Rouillard <rouilj@ieee.org>
date Wed, 11 Dec 2024 14:21:44 -0500
parents 622e7bc2db69
children ef1333b153e3
line wrap: on
line diff
--- a/roundup/rest.py	Wed Dec 11 14:17:01 2024 -0500
+++ b/roundup/rest.py	Wed Dec 11 14:21:44 2024 -0500
@@ -460,7 +460,7 @@
         # would include too many actions that do not make sense in the
         # REST-API context, so for now we only permit the retire and
         # restore actions.
-        self.actions = dict(retire=actions.Retire, restore=actions.Restore)
+        self.actions = {"retire": actions.Retire, "restore": actions.Restore}
 
         # note TRACKER_WEB ends in a /
         self.base_path = '%srest' % (self.db.config.TRACKER_WEB)
@@ -731,14 +731,15 @@
                         if isinstance(v, type([])):
                             r = []
                             for working_id in v:
-                                d = dict(id=working_id, link=cp + working_id)
+                                d = {"id": working_id,
+                                     "link": cp + working_id}
                                 if verbose > 1:
                                     label = linkcls.labelprop()
                                     d[label] = linkcls.get(working_id, label)
                                 r.append(d)
                             result[pn] = r
                         else:
-                            result[pn] = dict(id=v, link=cp + v)
+                            result[pn] = {"id": v, "link": cp + v}
                             if verbose > 1:
                                 label = linkcls.labelprop()
                                 result[pn][label] = linkcls.get(v, label)
@@ -751,7 +752,7 @@
                     if verbose < 3:
                         u = self.db.config.TRACKER_WEB
                         p = u + '%s%s/' % (class_name, node.id)
-                        result[pn] = dict(link=p)
+                        result[pn] = {"link": p}
                     else:
                         result[pn] = v
                 elif isinstance(prop, hyperdb.Password):
@@ -2028,7 +2029,7 @@
         uid = self.db.getuid()
         for cls in sorted(self.db.classes):
             if self.db.security.hasPermission('View', uid, cls):
-                result[cls] = dict(link=self.base_path + '/data/' + cls)
+                result[cls] = {"link": self.base_path + '/data/' + cls}
         return 200, result
 
     @Routing.route("/data", 'OPTIONS')

Roundup Issue Tracker: http://roundup-tracker.org/