2016-10-15 | Paul Boddie | raw files shortlog changelog graph | Added a method providing the parent of any reference alias. | |
referencing.py (file) |
1.1 --- a/referencing.py Fri Oct 14 23:24:51 2016 +0200 1.2 +++ b/referencing.py Sat Oct 15 23:32:15 2016 +0200 1.3 @@ -154,6 +154,15 @@ 1.4 1.5 return self.get_origin().rsplit(".", 1)[0] 1.6 1.7 + def name_parent(self): 1.8 + 1.9 + "Return the parent of this reference's aliased name." 1.10 + 1.11 + if not self.get_name(): 1.12 + return None 1.13 + 1.14 + return self.get_name().rsplit(".", 1)[0] 1.15 + 1.16 def ancestors(self): 1.17 1.18 """