From c8c50d8be2dc5ae74e53e44a87f580bf25956af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steve=20Fr=C3=A9cinaux?= Date: Sat, 6 Sep 2008 00:35:04 +0200 Subject: Do not use **kwargs for constructors. It is better to have an explicit list of variables for the constructors, be it only to avoid mispelled arguments. --- lib/git/blob.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'lib/git/blob.py') diff --git a/lib/git/blob.py b/lib/git/blob.py index 0b4b19c2..80d237d7 100644 --- a/lib/git/blob.py +++ b/lib/git/blob.py @@ -14,29 +14,33 @@ from commit import Commit class Blob(object): DEFAULT_MIME_TYPE = "text/plain" - def __init__(self, repo, **kwargs): + def __init__(self, repo, id, mode=None, name=None): """ Create an unbaked Blob containing just the specified attributes ``repo`` is the Repo - ``atts`` - is a dict of instance variable data + ``id`` + is the git object id + + ``mode`` + is the file mode + + ``name`` + is the file name Returns GitPython.Blob """ - self.id = None - self.mode = None - self.name = None + self.repo = repo + self.id = id + self.mode = mode + self.name = name + self._size = None self.data_stored = None - self.repo = repo - for k, v in kwargs.items(): - setattr(self, k, v) - @property def size(self): """ -- cgit v1.2.1