summaryrefslogtreecommitdiff
path: root/morphlib/morphology.py
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-08-14 13:45:59 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-08-14 13:45:59 +0000
commitc1c331e7c545c7a2f0545d3b1ef9751c9571d357 (patch)
treed2a4edf71f2c7204808e4543f3d743a81e95a1bd /morphlib/morphology.py
parentb2786c73c0f4d4b76f824e309598ce57065e30ab (diff)
parent5f705f1e2c95b988ae39df7820f4034c49f375e4 (diff)
downloadmorph-c1c331e7c545c7a2f0545d3b1ef9751c9571d357.tar.gz
Merge branch 'baserock/adamcoldrick/remove-morph2-tweaked'
Reviewed-by: Richard Maw
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
+