diff --git a/bin/project_rename.py b/bin/project_rename.py index 2d5bcb779e..f4c2d9c7ac 100644 --- a/bin/project_rename.py +++ b/bin/project_rename.py @@ -261,7 +261,7 @@ def rename_in_file(path, in_list, out_list, is_interactive): break elif ret == "a": # save result - for iline, renamed_line in list(renamed.items()): + for iline, renamed_line in renamed.items(): org_lines[iline] = renamed_line if FAKE_MODE: diff --git a/evennia/commands/cmdhandler.py b/evennia/commands/cmdhandler.py index b934932352..91ad60cc54 100644 --- a/evennia/commands/cmdhandler.py +++ b/evennia/commands/cmdhandler.py @@ -567,7 +567,7 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess returnValue(cmd) # assign custom kwargs to found cmd object - for key, val in list(kwargs.items()): + for key, val in kwargs.items(): setattr(cmd, key, val) _COMMAND_NESTING[called_by] += 1 diff --git a/evennia/commands/default/system.py b/evennia/commands/default/system.py index 99879c3b10..1d80f3578f 100644 --- a/evennia/commands/default/system.py +++ b/evennia/commands/default/system.py @@ -440,7 +440,7 @@ class CmdObjects(COMMAND_DEFAULT_CLASS): typetable = EvTable("|wtypeclass|n", "|wcount|n", "|w%%|n", border="table", align="l") typetable.align = 'l' dbtotals = ObjectDB.objects.object_totals() - for path, count in list(dbtotals.items()): + for path, count in dbtotals.items(): typetable.add_row(path, count, "%.2f" % ((float(count) / nobjs) * 100)) # last N table @@ -487,7 +487,7 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS): # typeclass table dbtotals = AccountDB.objects.object_totals() typetable = EvTable("|wtypeclass|n", "|wcount|n", "|w%%|n", border="cells", align="l") - for path, count in list(dbtotals.items()): + for path, count in dbtotals.items(): typetable.add_row(path, count, "%.2f" % ((float(count) / naccounts) * 100)) # last N table plyrs = AccountDB.objects.all().order_by("db_date_created")[max(0, naccounts - nlim):] diff --git a/evennia/contrib/custom_gametime.py b/evennia/contrib/custom_gametime.py index 1446fcdf13..42a53d1386 100644 --- a/evennia/contrib/custom_gametime.py +++ b/evennia/contrib/custom_gametime.py @@ -105,7 +105,7 @@ def gametime_to_realtime(format=False, **kwargs): """ # Dynamically creates the list of units based on kwarg names and UNITs list rtime = 0 - for name, value in list(kwargs.items()): + for name, value in kwargs.items(): # Allow plural names (like mins instead of min) if name not in UNITS and name.endswith("s"): name = name[:-1] @@ -197,7 +197,7 @@ def real_seconds_until(**kwargs): # For each keyword, add in the unit's units.append(1) higher_unit = None - for unit, value in list(kwargs.items()): + for unit, value in kwargs.items(): # Get the unit's index if unit not in UNITS: raise ValueError("unknown unit".format(unit)) diff --git a/evennia/contrib/ingame_python/callbackhandler.py b/evennia/contrib/ingame_python/callbackhandler.py index bb0cddc597..625bfa182b 100644 --- a/evennia/contrib/ingame_python/callbackhandler.py +++ b/evennia/contrib/ingame_python/callbackhandler.py @@ -36,7 +36,7 @@ class CallbackHandler(object): handler = type(self).script if handler: dicts = handler.get_callbacks(self.obj) - for callback_name, in_list in list(dicts.items()): + for callback_name, in_list in dicts.items(): new_list = [] for callback in in_list: callback = self.format_callback(callback) diff --git a/evennia/contrib/ingame_python/scripts.py b/evennia/contrib/ingame_python/scripts.py index 097923878f..f79f08258a 100644 --- a/evennia/contrib/ingame_python/scripts.py +++ b/evennia/contrib/ingame_python/scripts.py @@ -129,7 +129,7 @@ class EventHandler(DefaultScript): while not classes.empty(): typeclass = classes.get() typeclass_name = typeclass.__module__ + "." + typeclass.__name__ - for key, etype in list(all_events.get(typeclass_name, {}).items()): + for key, etype in all_events.get(typeclass_name, {}).items(): if key in invalid: continue if etype[0] is None: # Invalidate @@ -186,7 +186,7 @@ class EventHandler(DefaultScript): """ obj_callbacks = self.db.callbacks.get(obj, {}) callbacks = {} - for callback_name, callback_list in list(obj_callbacks.items()): + for callback_name, callback_list in obj_callbacks.items(): new_list = [] for i, callback in enumerate(callback_list): callback = dict(callback) @@ -362,7 +362,7 @@ class EventHandler(DefaultScript): self.db.locked[i] = (t_obj, t_callback_name, t_number - 1) # Delete time-related callbacks associated with this object - for script in list(obj.scripts.all()): + for script in obj.scripts.all(): if isinstance(script, TimecallbackScript): if script.obj is obj and script.db.callback_name == callback_name: if script.db.number == number: @@ -576,7 +576,7 @@ class EventHandler(DefaultScript): # Collect and freeze current locals locals = {} - for key, value in list(self.ndb.current_locals.items()): + for key, value in self.ndb.current_locals.items(): try: dbserialize(value) except TypeError: diff --git a/evennia/contrib/ingame_python/utils.py b/evennia/contrib/ingame_python/utils.py index 47314f8a88..43d87ade13 100644 --- a/evennia/contrib/ingame_python/utils.py +++ b/evennia/contrib/ingame_python/utils.py @@ -65,7 +65,7 @@ def register_events(path_or_typeclass): # If the script is started, add the event directly. # Otherwise, add it to the temporary storage. - for name, tup in list(getattr(typeclass, "_events", {}).items()): + for name, tup in getattr(typeclass, "_events", {}).items(): if len(tup) == 4: variables, help_text, custom_call, custom_add = tup elif len(tup) == 3: diff --git a/evennia/contrib/tutorial_world/objects.py b/evennia/contrib/tutorial_world/objects.py index 779f37aba4..48ba6bac20 100644 --- a/evennia/contrib/tutorial_world/objects.py +++ b/evennia/contrib/tutorial_world/objects.py @@ -689,7 +689,7 @@ class CrumblingWall(TutorialObject, DefaultExit): "crisscross the wall, making it hard to clearly see its stony surface. Maybe you could " "try to |wshift|n or |wmove|n them.\n"] # display the root positions to help with the puzzle - for key, pos in list(self.db.root_pos.items()): + for key, pos in self.db.root_pos.items(): result.append("\n" + self._translate_position(key, pos)) self.db.desc = "".join(result) diff --git a/evennia/contrib/wilderness.py b/evennia/contrib/wilderness.py index 6d6ebf6649..83981c5700 100644 --- a/evennia/contrib/wilderness.py +++ b/evennia/contrib/wilderness.py @@ -249,7 +249,7 @@ class WildernessScript(DefaultScript): """ Called when the script is started and also after server reloads. """ - for coordinates, room in list(self.db.rooms.items()): + for coordinates, room in self.db.rooms.items(): room.ndb.wildernessscript = self room.ndb.active_coordinates = coordinates for item in list(self.db.itemcoordinates.keys()): diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index a354764236..8f51477817 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -959,7 +959,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): self.attributes.batch_add(*cdict["attributes"]) if cdict.get("nattributes"): # this should be a dict of nattrname:value - for key, value in list(cdict["nattributes"].items()): + for key, value in cdict["nattributes"].items(): self.nattributes.add(key, value) del self._createdict diff --git a/evennia/scripts/taskhandler.py b/evennia/scripts/taskhandler.py index f4f94e75d0..2b1dd25758 100644 --- a/evennia/scripts/taskhandler.py +++ b/evennia/scripts/taskhandler.py @@ -47,7 +47,7 @@ class TaskHandler(object): tasks = value # At this point, `tasks` contains a dictionary of still-serialized tasks - for task_id, value in list(tasks.items()): + for task_id, value in tasks.items(): date, callback, args, kwargs = dbunserialize(value) if isinstance(callback, tuple): # `callback` can be an object and name for instance methods @@ -64,7 +64,7 @@ class TaskHandler(object): def save(self): """Save the tasks in ServerConfig.""" - for task_id, (date, callback, args, kwargs) in list(self.tasks.items()): + for task_id, (date, callback, args, kwargs) in self.tasks.items(): if task_id in self.to_save: continue @@ -127,7 +127,7 @@ class TaskHandler(object): else: safe_args.append(arg) - for key, value in list(kwargs.items()): + for key, value in kwargs.items(): try: dbserialize(value) except (TypeError, AttributeError): @@ -187,7 +187,7 @@ class TaskHandler(object): """ now = datetime.now() - for task_id, (date, callbac, args, kwargs) in list(self.tasks.items()): + for task_id, (date, callbac, args, kwargs) in self.tasks.items(): seconds = max(0, (date - now).total_seconds()) task.deferLater(reactor, seconds, self.do_task, task_id) diff --git a/evennia/scripts/tickerhandler.py b/evennia/scripts/tickerhandler.py index 5ca5384b76..cdf29ae0c5 100644 --- a/evennia/scripts/tickerhandler.py +++ b/evennia/scripts/tickerhandler.py @@ -286,7 +286,7 @@ class TickerPool(object): if interval and interval in self.tickers: self.tickers[interval].stop() else: - for ticker in list(self.tickers.values()): + for ticker in self.tickers.values(): ticker.stop() @@ -395,7 +395,7 @@ class TickerHandler(object): store_key[2])} # a path given # update the timers for the tickers - for store_key, (args, kwargs) in list(to_save.items()): + for store_key, (args, kwargs) in to_save.items(): interval = store_key[1] # this is a mutable, so it's updated in-place in ticker_storage kwargs["_start_delay"] = start_delays.get(interval, None) diff --git a/evennia/server/evennia_launcher.py b/evennia/server/evennia_launcher.py index f96001fc06..8cbb87c9fd 100644 --- a/evennia/server/evennia_launcher.py +++ b/evennia/server/evennia_launcher.py @@ -995,7 +995,7 @@ def list_settings(keys): keys = [key.upper() for key in keys] confs = dict((key, var) for key, var in list(evsettings.__dict__.items()) if key in keys) - for key, val in list(confs.items()): + for key, val in confs.items(): table.add_row(key, str(val)) print(table) diff --git a/evennia/server/portal/mssp.py b/evennia/server/portal/mssp.py index 254d1b92fe..5442ccc320 100644 --- a/evennia/server/portal/mssp.py +++ b/evennia/server/portal/mssp.py @@ -191,7 +191,7 @@ class Mssp(object): self.mssp_table.update(MSSPTable_CUSTOM) varlist = '' - for variable, value in list(self.mssp_table.items()): + for variable, value in self.mssp_table.items(): if callable(value): value = value() if utils.is_iter(value): diff --git a/evennia/server/portal/portalsessionhandler.py b/evennia/server/portal/portalsessionhandler.py index c06757b798..ffc496998f 100644 --- a/evennia/server/portal/portalsessionhandler.py +++ b/evennia/server/portal/portalsessionhandler.py @@ -188,7 +188,7 @@ class PortalSessionHandler(SessionHandler): # we set a watchdog to stop self.disconnect from deleting # sessions while we are looping over them. sessionhandler._disconnect_all = True - for session in list(sessionhandler.values()): + for session in sessionhandler.values(): session.disconnect() del sessionhandler._disconnect_all @@ -336,7 +336,7 @@ class PortalSessionHandler(SessionHandler): send command. """ - for session in list(self.values()): + for session in self.values(): self.data_out(session, text=[[message], {}]) def data_in(self, session, **kwargs): diff --git a/evennia/server/session.py b/evennia/server/session.py index 496d15bfeb..229fa3a8f6 100644 --- a/evennia/server/session.py +++ b/evennia/server/session.py @@ -117,7 +117,7 @@ class Session(object): sessdata (dict): Session data dictionary. """ - for propname, value in list(sessdata.items()): + for propname, value in sessdata.items(): setattr(self, propname, value) def at_sync(self): diff --git a/evennia/server/sessionhandler.py b/evennia/server/sessionhandler.py index 34030ade3c..45e1d30790 100644 --- a/evennia/server/sessionhandler.py +++ b/evennia/server/sessionhandler.py @@ -195,7 +195,7 @@ class SessionHandler(dict): "Helper function to convert data to AMP-safe (picketable) values" if isinstance(data, dict): newdict = {} - for key, part in list(data.items()): + for key, part in data.items(): newdict[key] = _validate(part) return newdict elif is_iter(data): @@ -349,7 +349,7 @@ class ServerSessionHandler(SessionHandler): # lingering references. del sess - for sessid, sessdict in list(portalsessionsdata.items()): + for sessid, sessdict in portalsessionsdata.items(): sess = _ServerSession() sess.sessionhandler = self sess.load_sync_data(sessdict) @@ -688,7 +688,7 @@ class ServerSessionHandler(SessionHandler): message (str): Message to send. """ - for session in list(self.values()): + for session in self.values(): self.data_out(session, text=message) def data_out(self, session, **kwargs): diff --git a/evennia/utils/batchprocessors.py b/evennia/utils/batchprocessors.py index 174a296943..a35e6d37f8 100644 --- a/evennia/utils/batchprocessors.py +++ b/evennia/utils/batchprocessors.py @@ -382,7 +382,7 @@ class BatchCodeProcessor(object): """ # define the execution environment environdict = {"settings_module": settings, "DEBUG": debug} - for key, value in list(extra_environ.items()): + for key, value in extra_environ.items(): environdict[key] = value # initializing the django settings at the top of code diff --git a/evennia/utils/eveditor.py b/evennia/utils/eveditor.py index 990c826b33..62a9d97ed1 100644 --- a/evennia/utils/eveditor.py +++ b/evennia/utils/eveditor.py @@ -965,7 +965,7 @@ class EvEditor(object): # If the line begins by one of the given keywords indent = self._indent - if any(line.startswith(kw) for kw in list(keywords.keys())): + if any(line.startswith(kw) for kw in keywords.keys()): # Get the keyword and matching begin tags keyword = [kw for kw in keywords if line.startswith(kw)][0] begin_tags = keywords[keyword] diff --git a/evennia/utils/evform.py b/evennia/utils/evform.py index 488a0c46a4..8b1f4afd5c 100644 --- a/evennia/utils/evform.py +++ b/evennia/utils/evform.py @@ -259,7 +259,7 @@ class EvForm(object): break # get rectangles and assign EvCells - for key, (iy, leftix, rightix) in list(cell_coords.items()): + for key, (iy, leftix, rightix) in cell_coords.items(): # scan up to find top of rectangle dy_up = 0 if iy > 0: @@ -294,7 +294,7 @@ class EvForm(object): mapping[key] = (iyup, leftix, width, height, EvCell(data, width=width, height=height, **options)) # get rectangles and assign Tables - for key, (iy, leftix, rightix) in list(table_coords.items()): + for key, (iy, leftix, rightix) in table_coords.items(): # scan up to find top of rectangle dy_up = 0 @@ -340,7 +340,7 @@ class EvForm(object): """ form = copy.copy(raw_form) - for key, (iy0, ix0, width, height, cell_or_table) in list(mapping.items()): + for key, (iy0, ix0, width, height, cell_or_table) in mapping.items(): # rect is a list of lines, each wide rect = cell_or_table.get() for il, rectline in enumerate(rect): diff --git a/evennia/utils/evtable.py b/evennia/utils/evtable.py index fadf64fd4a..10881e4bb0 100644 --- a/evennia/utils/evtable.py +++ b/evennia/utils/evtable.py @@ -816,7 +816,7 @@ class EvCell(object): self.trim_vertical = kwargs.pop("trim_vertical", self.trim_vertical) # fill all other properties - for key, value in list(kwargs.items()): + for key, value in kwargs.items(): setattr(self, key, value) # Handle sizes @@ -1525,7 +1525,7 @@ class EvTable(object): """ self.width = kwargs.pop("width", self.width) self.height = kwargs.pop("height", self.height) - for key, value in list(kwargs.items()): + for key, value in kwargs.items(): setattr(self, key, value) hchar = kwargs.pop("header_line_char", self.header_line_char) diff --git a/evennia/utils/spawner.py b/evennia/utils/spawner.py index 1afff3413d..b99f166018 100644 --- a/evennia/utils/spawner.py +++ b/evennia/utils/spawner.py @@ -238,7 +238,7 @@ def spawn(*prototypes, **kwargs): list(all_from_module(prototype_module).items()) if isinstance(val, dict))) # overload module's protparents with specifically given protparents protparents.update(kwargs.get("prototype_parents", {})) - for key, prototype in list(protparents.items()): + for key, prototype in protparents.items(): _validate_prototype(key, prototype, protparents, []) if "return_prototypes" in kwargs: