[geneagrapher] 81/226: * Changed help strings for -a and -d to make sense. * Changed all 'descendents' to 'descendants' as personal preferences have changed. * A couple other changes to comments.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Jul 11 17:10:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository geneagrapher.

commit 0ff4b318e802f9d7c3ba64986a88df122a271193
Author: David Alber <alber.david at gmail.com>
Date:   Sun Oct 5 17:05:06 2008 +0000

     * Changed help strings for -a and -d to make sense.
     * Changed all 'descendents' to 'descendants' as personal preferences have changed.
     * A couple other changes to comments.
---
 Geneagrapher/geneagrapher/GGraph.py       | 26 ++++++++++----------
 Geneagrapher/geneagrapher/geneagrapher.py | 40 +++++++++++++++----------------
 Geneagrapher/geneagrapher/grab.py         | 10 ++++----
 3 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/Geneagrapher/geneagrapher/GGraph.py b/Geneagrapher/geneagrapher/GGraph.py
index 8a89871..e5452d7 100644
--- a/Geneagrapher/geneagrapher/GGraph.py
+++ b/Geneagrapher/geneagrapher/GGraph.py
@@ -61,21 +61,21 @@ class Node:
     """
     Container class storing a node in the graph.
     """
-    def __init__(self, record, ancestors, descendents):
+    def __init__(self, record, ancestors, descendants):
         """
         Node class constructor.
         
         Parameters:
             record: instance of the Record class
-            ancestors: list of the record's genealogical ancestors's
+            ancestors: list of the record's genealogical ancestors'
                 IDs
-            descendents: list of this records genealogical
-                descendent's IDs
+            descendants: list of this record's genealogical
+                descendants' IDs
         """
         
         self.record = record
         self.ancestors = ancestors
-        self.descendents = descendents
+        self.descendants = descendants
         self.already_printed = False
 
         # Verify parameter types.
@@ -83,8 +83,8 @@ class Node:
             raise TypeError("Unexpected parameter type: expected Record object for 'record'")
         if not isinstance(self.ancestors, list):
             raise TypeError("Unexpected parameter type: expected list object for 'ancestors'")
-        if not isinstance(self.descendents, list):
-            raise TypeError("Unexpected parameter type: expected list object for 'descendents'")
+        if not isinstance(self.descendants, list):
+            raise TypeError("Unexpected parameter type: expected list object for 'descendants'")
         
     def __str__(self):
         if self.record.hasInstitution():
@@ -173,13 +173,13 @@ class Graph:
         """
         return self.nodes.keys()
 
-    def addNode(self, name, institution, year, id, ancestors, descendents, isHead=False):
+    def addNode(self, name, institution, year, id, ancestors, descendants, isHead=False):
         """
         Add a new node to the graph if a matching node is not already
         present.
         """
         record = Record(name, institution, year, id)
-        node = Node(record, ancestors, descendents)
+        node = Node(record, ancestors, descendants)
         self.addNodeObject(node, isHead)
 
     def addNodeObject(self, node, isHead=False):
@@ -200,7 +200,7 @@ class Graph:
         elif isHead:
             self.heads.append(node)
 
-    def generateDotFile(self, include_ancestors, include_descendents):
+    def generateDotFile(self, include_ancestors, include_descendants):
         """
         Return a string that contains the content of the Graphviz dotfile
         format for this graph.
@@ -235,9 +235,9 @@ class Graph:
                 # Add this node's advisors to queue.
                 queue += node.ancestors
                 
-            if include_descendents:
-                # Add this node's descendents to queue.
-                queue += node.descendents
+            if include_descendants:
+                # Add this node's descendants to queue.
+                queue += node.descendants
         
             # Print this node's information.
             nodestr = "    %d [label=\"%s\"];" % (node_id, node)
diff --git a/Geneagrapher/geneagrapher/geneagrapher.py b/Geneagrapher/geneagrapher/geneagrapher.py
index ea277d5..5c59bdf 100644
--- a/Geneagrapher/geneagrapher/geneagrapher.py
+++ b/Geneagrapher/geneagrapher/geneagrapher.py
@@ -11,7 +11,7 @@ class Geneagrapher:
 		self.graph = GGraph.Graph()
 		self.leaf_ids = []
 		self.get_ancestors = False
-		self.get_descendents = False
+		self.get_descendants = False
 		self.verbose = False
 		self.supp_node_filename = None
 		self.write_filename = None
@@ -28,9 +28,9 @@ class Geneagrapher:
 		self.parser.add_option("-f", "--file", dest="filename",
 				       help="write report to FILE [default: stdout]", metavar="FILE", default=None)
 		self.parser.add_option("-a", "--with-ancestors", action="store_true", dest="get_ancestors",
-				       default=False, help="do not get ancestors of any input IDs")
-		self.parser.add_option("-d", "--with-descendents", action="store_true", dest="get_descendents",
-				       default=False, help="do not get ancestors of any input IDs")
+				       default=False, help="retrieve ancestors of IDs and include in graph")
+		self.parser.add_option("-d", "--with-descendants", action="store_true", dest="get_descendants",
+				       default=False, help="retrieve descendants of IDs and include in graph")
 		self.parser.add_option("--verbose", "-v", action="store_true", dest="verbose", default=False,
 				       help="print information showing progress")
 		self.parser.add_option("--version", "-V", action="store_true", dest="print_version", default=False,
@@ -48,7 +48,7 @@ class Geneagrapher:
 			raise SyntaxError("%s: error: no record IDs passed" % (self.parser.get_prog_name()))
 
 		self.get_ancestors = options.get_ancestors
-		self.get_descendents = options.get_descendents
+		self.get_descendants = options.get_descendants
 		self.verbose = options.verbose
 		self.supp_node_filename = options.supp_node_filename
 		self.write_filename = options.filename
@@ -62,7 +62,7 @@ class Geneagrapher:
 		"""
 		leaf_grab_queue = list(self.leaf_ids)
 		ancestor_grab_queue = []
-		descendent_grab_queue = []
+		descendant_grab_queue = []
 
 		# Grab "supplementary" nodes from file.
 		if self.supp_node_filename is not None:
@@ -85,15 +85,15 @@ class Geneagrapher:
 				if self.verbose:
 					print "Grabbing record #%d" % (id)
 				try:
-					[name, institution, year, advisors, descendents] = grabber.extractNodeInformation()
+					[name, institution, year, advisors, descendants] = grabber.extractNodeInformation()
 				except ValueError:
 					# The given id does not exist in the Math Genealogy Project's database.
 					raise
-				self.graph.addNode(name, institution, year, id, advisors, descendents, True)
+				self.graph.addNode(name, institution, year, id, advisors, descendants, True)
 				if self.get_ancestors:
 					ancestor_grab_queue += advisors
-				if self.get_descendents:
-					descendent_grab_queue += descendents
+				if self.get_descendants:
+					descendant_grab_queue += descendants
 
 		# Grab ancestors of leaf nodes.
 		if self.get_ancestors:
@@ -105,32 +105,32 @@ class Geneagrapher:
 					if self.verbose:
 						print "Grabbing record #%d" % (id)
 					try:
-						[name, institution, year, advisors, descendents] = grabber.extractNodeInformation()
+						[name, institution, year, advisors, descendants] = grabber.extractNodeInformation()
 					except ValueError:
 						# The given id does not exist in the Math Genealogy Project's database.
 						raise
-					self.graph.addNode(name, institution, year, id, advisors, descendents)
+					self.graph.addNode(name, institution, year, id, advisors, descendants)
 					ancestor_grab_queue += advisors
 						
-		# Grab descendents of leaf nodes.
-		if self.get_descendents:
-			while len(descendent_grab_queue) != 0:
-				id = descendent_grab_queue.pop()
+		# Grab descendants of leaf nodes.
+		if self.get_descendants:
+			while len(descendant_grab_queue) != 0:
+				id = descendant_grab_queue.pop()
 				if not self.graph.hasNode(id):
 					# Then this information has not yet been grabbed.
 					grabber = grab.Grabber(id)
 					if self.verbose:
 						print "Grabbing record #%d" % (id)
 					try:
-						[name, institution, year, advisors, descendents] = grabber.extractNodeInformation()
+						[name, institution, year, advisors, descendants] = grabber.extractNodeInformation()
 					except ValueError:
 						# The given id does not exist in the Math Genealogy Project's database.
 						raise
-					self.graph.addNode(name, institution, year, id, advisors, descendents)
-					descendent_grab_queue += descendents
+					self.graph.addNode(name, institution, year, id, advisors, descendants)
+					descendant_grab_queue += descendants
 					
 	def generateDotFile(self):
-		dotfile = self.graph.generateDotFile(self.get_ancestors, self.get_descendents)
+		dotfile = self.graph.generateDotFile(self.get_ancestors, self.get_descendants)
 		if self.write_filename is not None:
 			outfile = open(self.write_filename, "w")
 			outfile.write(dotfile)
diff --git a/Geneagrapher/geneagrapher/grab.py b/Geneagrapher/geneagrapher/grab.py
index 7825fbc..d1f6a1f 100644
--- a/Geneagrapher/geneagrapher/grab.py
+++ b/Geneagrapher/geneagrapher/grab.py
@@ -14,7 +14,7 @@ class Grabber:
         self.institution = None
         self.year = None
         self.advisors = []
-        self.descendents = []
+        self.descendants = []
 
     def unescape(self, s):
         return re.sub('&(%s);' % '|'.join(name2codepoint),\
@@ -40,7 +40,7 @@ class Grabber:
             self.getPage()
             
         self.advisors = []
-        self.descendents = []
+        self.descendants = []
 
         # Split the page string at newline characters.
         psarray = self.pagestr.split('\n')
@@ -71,9 +71,9 @@ class Grabber:
                     self.advisors.append(advisor_id)
 
             if '<tr ' in line:
-                descendent_id = int(line.split('a href=\"id.php?id=')[1].split('\">')[0])
-                self.descendents.append(descendent_id)
+                descendant_id = int(line.split('a href=\"id.php?id=')[1].split('\">')[0])
+                self.descendants.append(descendant_id)
                 
             if 'According to our current on-line database' in line:
                 break
-        return [self.name, self.institution, self.year, self.advisors, self.descendents]
+        return [self.name, self.institution, self.year, self.advisors, self.descendants]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/geneagrapher.git



More information about the debian-science-commits mailing list