diff options
| author | Craig Northway <craig.northway@gmail.com> | 2014-07-25 11:26:48 +1000 |
|---|---|---|
| committer | Craig Northway <craig.northway@gmail.com> | 2014-07-25 19:19:22 +1000 |
| commit | a23d0d8617ba3119069e610fc7b0850a17322726 (patch) | |
| tree | d8bc5213dd7e7c7f0befdf65afecb13d5435f873 /git/objects/tag.py | |
| parent | 75194159abce545bfa38c3172efb42da9b0017dc (diff) | |
| download | GitPython-a23d0d8617ba3119069e610fc7b0850a17322726.tar.gz GitPython-a23d0d8617ba3119069e610fc7b0850a17322726.zip | |
Autopep8 fixes with maximum line length 120
Diffstat (limited to 'git/objects/tag.py')
| -rw-r--r-- | git/objects/tag.py | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/git/objects/tag.py b/git/objects/tag.py index 2937f470..630a6499 100644 --- a/git/objects/tag.py +++ b/git/objects/tag.py @@ -8,24 +8,26 @@ import base from git.util import RepoAliasMixin from git.util import hex_to_bin from util import ( - get_object_type_by_name, - parse_actor_and_date - ) + get_object_type_by_name, + parse_actor_and_date +) from git.typ import ObjectType __all__ = ("TagObject", ) + class TagObject(base.Object, RepoAliasMixin): + """Non-Lightweight tag carrying additional information about an object we are pointing to.""" type = ObjectType.tag type_id = ObjectType.tag_id - - __slots__ = ( "object", "tag", "tagger", "tagged_date", "tagger_tz_offset", "message" ) - - def __init__(self, odb, binsha, object=None, tag=None, - tagger=None, tagged_date=None, tagger_tz_offset=None, message=None): + + __slots__ = ("object", "tag", "tagger", "tagged_date", "tagger_tz_offset", "message") + + def __init__(self, odb, binsha, object=None, tag=None, + tagger=None, tagged_date=None, tagger_tz_offset=None, message=None): """Initialize a tag object with additional data - + :param odb: repository this object is located in :param binsha: 20 byte SHA1 :param object: Object instance of object we are pointing to @@ -36,7 +38,7 @@ class TagObject(base.Object, RepoAliasMixin): it into a different format :param tagged_tz_offset: int_seconds_west_of_utc is the timezone that the authored_date is in, in a format similar to time.altzone""" - super(TagObject, self).__init__(odb, binsha ) + super(TagObject, self).__init__(odb, binsha) if object is not None: self.object = object if tag is not None: @@ -49,24 +51,24 @@ class TagObject(base.Object, RepoAliasMixin): self.tagger_tz_offset = tagger_tz_offset if message is not None: self.message = message - + def _set_cache_(self, attr): """Cache all our attributes at once""" if attr in TagObject.__slots__: ostream = self.odb.stream(self.binsha) lines = ostream.read().splitlines() - + obj, hexsha = lines[0].split(" ") # object <hexsha> - type_token, type_name = lines[1].split(" ") # type <type_name> + type_token, type_name = lines[1].split(" ") # type <type_name> self.object = get_object_type_by_name(type_name)(self.odb, hex_to_bin(hexsha)) - + self.tag = lines[2][4:] # tag <tag name> - - tagger_info = lines[3][7:]# tagger <actor> <date> + + tagger_info = lines[3][7:] # tagger <actor> <date> self.tagger, self.tagged_date, self.tagger_tz_offset = parse_actor_and_date(tagger_info) - + # line 4 empty - it could mark the beginning of the next header - # in case there really is no message, it would not exist. Otherwise + # in case there really is no message, it would not exist. Otherwise # a newline separates header from message if len(lines) > 5: self.message = "\n".join(lines[5:]) @@ -75,6 +77,3 @@ class TagObject(base.Object, RepoAliasMixin): # END check our attributes else: super(TagObject, self)._set_cache_(attr) - - - |
