From 6e92c2d80dfd8f87d57c569db2fd9c9892a407a5 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Sun, 21 Feb 2016 21:45:07 +0000 Subject: [PATCH] Switch basic data loader unit from element to node In preparation for a migration to a new flat data model where elements are inferred from facet names, stop referring to the top-level keys in data files as elements and instead call them nodes. During the transitional period, a node could be an old-style element or a new-style element's facet. --- lib/mudpy/data.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/mudpy/data.py b/lib/mudpy/data.py index 8386842..97032e2 100644 --- a/lib/mudpy/data.py +++ b/lib/mudpy/data.py @@ -1,6 +1,6 @@ """Data interface functions for the mudpy engine.""" -# Copyright (c) 2004-2015 Jeremy Stanley . Permission +# Copyright (c) 2004-2016 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. @@ -14,7 +14,7 @@ import yaml class DataFile: - """A file containing universe elements.""" + """A file containing universe elements and their facets.""" def __init__(self, filename, universe): self.filename = filename @@ -23,7 +23,7 @@ class DataFile: self.load() def load(self): - """Read a file and create elements accordingly.""" + """Read a file, create elements and poplulate facets accordingly.""" self.modified = False try: self.data = yaml.safe_load(open(self.filename)) @@ -84,9 +84,9 @@ class DataFile: includes.append(item) if item not in self.universe.private_files: self.universe.private_files.append(item) - for element in self.data: - if element != "__control__": - mudpy.misc.Element(element, self.universe, self.filename) + for node in self.data: + if node != "__control__": + mudpy.misc.Element(node, self.universe, self.filename) for include_file in includes: if not os.path.isabs(include_file): include_file = find_file( @@ -252,7 +252,7 @@ def find_file( else: search_path = search_path[:] - # if there's no default path, use the last element of the search path + # if there's no default path, use the last component of the search path if not default_dir: default_dir = search_path[-1] -- 2.11.0