@@ -84,7 +84,7 @@ def message(self):
8484 return self [4 ]
8585
8686 @classmethod
87- def new (self , oldhexsha , newhexsha , actor , time , tz_offset , message ):
87+ def new (cls , oldhexsha , newhexsha , actor , time , tz_offset , message ): # skipcq: PYL-W0621
8888 """:return: New instance of a RefLogEntry"""
8989 if not isinstance (actor , Actor ):
9090 raise ValueError ("Need actor instance, got %s" % actor )
@@ -121,7 +121,7 @@ def from_line(cls, line):
121121 # END handle missing end brace
122122
123123 actor = Actor ._from_string (info [82 :email_end + 1 ])
124- time , tz_offset = parse_date (info [email_end + 2 :])
124+ time , tz_offset = parse_date (info [email_end + 2 :]) # skipcq: PYL-W0621
125125
126126 return RefLogEntry ((oldhexsha , newhexsha , actor , (time , tz_offset ), msg ))
127127
@@ -216,10 +216,9 @@ def entry_at(cls, filepath, index):
216216 all other lines. Nonetheless, the whole file has to be read if
217217 the index is negative
218218 """
219- fp = open (filepath , 'rb' )
220- if index < 0 :
221- return RefLogEntry .from_line (fp .readlines ()[index ].strip ())
222- else :
219+ with open (filepath , 'rb' ) as fp :
220+ if index < 0 :
221+ return RefLogEntry .from_line (fp .readlines ()[index ].strip ())
223222 # read until index is reached
224223 for i in xrange (index + 1 ):
225224 line = fp .readline ()
@@ -228,7 +227,7 @@ def entry_at(cls, filepath, index):
228227 # END abort on eof
229228 # END handle runup
230229
231- if i != index or not line :
230+ if i != index or not line : # skipcq:PYL-W0631
232231 raise IndexError
233232 # END handle exception
234233
0 commit comments