summaryrefslogtreecommitdiff
path: root/morphlib/morphology.py
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-08-08 15:42:03 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-08-14 13:24:50 +0000
commita8bb16bf3a9a7f5b99c5a02136e6e970d373468b (patch)
tree895a7f14cc4c6ff870cc8d5f628fa0a0266a3f65 /morphlib/morphology.py
parent70f7ab6be68eef9a1f460c9a9918c0e4dd59efc5 (diff)
downloadmorph-a8bb16bf3a9a7f5b99c5a02136e6e970d373468b.tar.gz
Instead of leaving morph3 with a potentially confusing name, rename it to `morphology` since it is now the only implementation of the Morphology class.
Diffstat (limited to 'morphlib/morphology.py')
-rw-r--r--morphlib/morphology.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/morphlib/morphology.py b/morphlib/morphology.py
new file mode 100644
index 00000000..314c315a
--- /dev/null
+++ b/morphlib/morphology.py
@@ -0,0 +1,45 @@
+# Copyright (C) 2013-2014 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# =*= License: GPL-2 =*=
+
+
+import UserDict
+
+
+class Morphology(UserDict.IterableUserDict):
+
+ '''A container for a morphology, plus its metadata.
+
+ A morphology is, basically, a dict. This class acts as that dict,
+ plus stores additional metadata about the morphology, such as where
+ it came from, and the ref that was used for it. It also has a dirty
+ attribute, to indicate whether the morphology has had changes done
+ to it, but does not itself set that attribute: the caller has to
+ maintain the flag themselves.
+
+ This class does NO validation of the data, nor does it parse the
+ morphology text, or produce a textual form of itself. For those
+ things, see MorphologyLoader.
+
+ '''
+
+ def __init__(self, *args, **kwargs):
+ UserDict.IterableUserDict.__init__(self, *args, **kwargs)
+ self.repo_url = None
+ self.ref = None
+ self.filename = None
+ self.dirty = None
+