소스 검색

Use property function rather than decorator, so we can support setters in the future.

Jelmer Vernooij 16 년 전
부모
커밋
230698b9e6
1개의 변경된 파일27개의 추가작업 그리고 18개의 파일을 삭제
  1. 27 18
      dulwich/objects.py

+ 27 - 18
dulwich/objects.py

@@ -513,59 +513,68 @@ class Commit(ShaFile):
         self._text += "\n" # There must be a new line after the headers
         self._text += "\n" # There must be a new line after the headers
         self._text += self._message
         self._text += self._message
 
 
-    @property
-    def tree(self):
+    def get_tree(self):
         """Returns the tree that is the state of this commit"""
         """Returns the tree that is the state of this commit"""
         return self._tree
         return self._tree
 
 
-    @property
-    def parents(self):
+    tree = property(get_tree)
+
+    def get_parents(self):
         """Return a list of parents of this commit."""
         """Return a list of parents of this commit."""
         return self._parents
         return self._parents
 
 
-    @property
-    def author(self):
+    parents = property(get_parents)
+
+    def get_author(self):
         """Returns the name of the author of the commit"""
         """Returns the name of the author of the commit"""
         return self._author
         return self._author
 
 
-    @property
-    def committer(self):
+    author = property(get_author)
+
+    def get_committer(self):
         """Returns the name of the committer of the commit"""
         """Returns the name of the committer of the commit"""
         return self._committer
         return self._committer
 
 
-    @property
-    def message(self):
+    committer = property(get_committer)
+
+    def get_message(self):
         """Returns the commit message"""
         """Returns the commit message"""
         return self._message
         return self._message
 
 
-    @property
-    def commit_time(self):
+    message = property(get_message)
+
+    def get_commit_time(self):
         """Returns the timestamp of the commit.
         """Returns the timestamp of the commit.
         
         
         Returns it as the number of seconds since the epoch.
         Returns it as the number of seconds since the epoch.
         """
         """
         return self._commit_time
         return self._commit_time
 
 
-    @property
-    def commit_timezone(self):
+    commit_time = property(get_commit_time)
+
+    def get_commit_timezone(self):
         """Returns the zone the commit time is in
         """Returns the zone the commit time is in
         """
         """
         return self._commit_timezone
         return self._commit_timezone
 
 
-    @property
-    def author_time(self):
+    commit_timezone = property(get_commit_timezone)
+
+    def get_author_time(self):
         """Returns the timestamp the commit was written.
         """Returns the timestamp the commit was written.
         
         
         Returns it as the number of seconds since the epoch.
         Returns it as the number of seconds since the epoch.
         """
         """
         return self._author_time
         return self._author_time
 
 
-    @property
-    def author_timezone(self):
+    author_time = property(get_author_time)
+
+    def get_author_timezone(self):
         """Returns the zone the author time is in
         """Returns the zone the author time is in
         """
         """
         return self._author_timezone
         return self._author_timezone
 
 
+    author_timezone = property(get_author_timezone)
+
 
 
 type_map = {
 type_map = {
     BLOB_ID : Blob,
     BLOB_ID : Blob,