Rename state variable in get_menu_choices()
authorJeremy Stanley <fungi@yuggoth.org>
Wed, 25 Dec 2019 13:12:43 +0000 (13:12 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Sat, 28 Dec 2019 20:40:11 +0000 (20:40 +0000)
Avoid shadowing the new menu module in misc.get_menu_choices() by
renaming its menu variable to state, which is also more consistent
with other menu-related functions.

mudpy/misc.py

index 24443dd..62f531e 100644 (file)
@@ -1581,8 +1581,8 @@ def get_menu_prompt(state):
 
 def get_menu_choices(user):
     """Return a dict of choice:meaning."""
-    menu = universe.groups["menu"][user.state]
-    create_choices = menu.get("create")
+    state = universe.groups["menu"][user.state]
+    create_choices = state.get("create")
     if create_choices:
         choices = eval(create_choices)
     else:
@@ -1590,7 +1590,7 @@ def get_menu_choices(user):
     ignores = []
     options = {}
     creates = {}
-    for facet in menu.facets():
+    for facet in state.facets():
         if facet.startswith("demand_") and not eval(
            universe.groups["menu"][user.state].get(facet)
            ):
@@ -1601,10 +1601,10 @@ def get_menu_choices(user):
             options[facet] = facet.split("_", 2)[1]
     for facet in creates.keys():
         if not creates[facet] in ignores:
-            choices[creates[facet]] = eval(menu.get(facet))
+            choices[creates[facet]] = eval(state.get(facet))
     for facet in options.keys():
         if not options[facet] in ignores:
-            choices[options[facet]] = menu.get(facet)
+            choices[options[facet]] = state.get(facet)
     return choices