registrar: move "constant" possiblecmdtypes to class level
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 18 Oct 2017 22:07:53 -0700
changeset 34895 7b857c5947ec
parent 34894 b63a7d839c33
child 34896 97017508c863
registrar: move "constant" possiblecmdtypes to class level While at it, switch to set literal syntax. Differential Revision: https://phab.mercurial-scm.org/D1187
mercurial/registrar.py
--- a/mercurial/registrar.py	Wed Oct 18 16:28:18 2017 -0700
+++ b/mercurial/registrar.py	Wed Oct 18 22:07:53 2017 -0700
@@ -148,13 +148,13 @@
     recoverablewrite = "recoverable"
     readonly = "readonly"
 
+    possiblecmdtypes = {unrecoverablewrite, recoverablewrite, readonly}
+
     def _doregister(self, func, name, options=(), synopsis=None,
                     norepo=False, optionalrepo=False, inferrepo=False,
                     cmdtype=unrecoverablewrite):
 
-        possiblecmdtypes = set([self.unrecoverablewrite, self.recoverablewrite,
-                                self.readonly])
-        if cmdtype not in possiblecmdtypes:
+        if cmdtype not in self.possiblecmdtypes:
             raise error.ProgrammingError(_("unknown cmdtype value '%s' for "
                                             "'%s' command") % (cmdtype, name))
         func.norepo = norepo