Explorar o código

Avoid naming variables 'l'.

Jelmer Vernooij %!s(int64=7) %!d(string=hai) anos
pai
achega
50b2c115c5
Modificáronse 7 ficheiros con 41 adicións e 41 borrados
  1. 2 2
      dulwich/contrib/swift.py
  2. 8 8
      dulwich/ignore.py
  3. 6 6
      dulwich/object_store.py
  4. 5 5
      dulwich/objects.py
  5. 9 9
      dulwich/patch.py
  6. 8 8
      dulwich/refs.py
  7. 3 3
      setup.py

+ 2 - 2
dulwich/contrib/swift.py

@@ -520,9 +520,9 @@ class SwiftPackReader(object):
     def _read(self, more=False):
         if more:
             self.buff_length = self.buff_length * 2
-        l = self.base_offset
+        offset = self.base_offset
         r = min(self.base_offset + self.buff_length, self.pack_length)
-        ret = self.scon.get_object(self.filename, range="%s-%s" % (l, r))
+        ret = self.scon.get_object(self.filename, range="%s-%s" % (offset, r))
         self.buff = ret
 
     def read(self, length):

+ 8 - 8
dulwich/ignore.py

@@ -106,23 +106,23 @@ def read_ignore_patterns(f):
     :return: List of patterns
     """
 
-    for l in f:
-        l = l.rstrip(b"\r\n")
+    for line in f:
+        line = line.rstrip(b"\r\n")
 
         # Ignore blank lines, they're used for readability.
-        if not l:
+        if not line:
             continue
 
-        if l.startswith(b'#'):
+        if line.startswith(b'#'):
             # Comment
             continue
 
         # Trailing spaces are ignored unless they are quoted with a backslash.
-        while l.endswith(b' ') and not l.endswith(b'\\ '):
-            l = l[:-1]
-        l = l.replace(b'\\ ', b' ')
+        while line.endswith(b' ') and not line.endswith(b'\\ '):
+            line = line[:-1]
+        line = line.replace(b'\\ ', b' ')
 
-        yield l
+        yield line
 
 
 def match_pattern(path, pattern, ignorecase=False):

+ 6 - 6
dulwich/object_store.py

@@ -477,14 +477,14 @@ class DiskObjectStore(PackBasedObjectStore):
                 return
             raise
         with f:
-            for l in f.readlines():
-                l = l.rstrip(b"\n")
-                if l[0] == b"#":
+            for line in f.readlines():
+                line = line.rstrip(b"\n")
+                if line[0] == b"#":
                     continue
-                if os.path.isabs(l):
-                    yield l.decode(sys.getfilesystemencoding())
+                if os.path.isabs(line):
+                    yield line.decode(sys.getfilesystemencoding())
                 else:
-                    yield os.path.join(self.path, l).decode(
+                    yield os.path.join(self.path, line).decode(
                         sys.getfilesystemencoding())
 
     def add_alternate_path(self, path):

+ 5 - 5
dulwich/objects.py

@@ -622,18 +622,18 @@ def _parse_message(chunks):
     #
     # Headers can contain newlines. The next line is indented with a space.
     # We store the latest key as 'k', and the accumulated value as 'v'.
-    for l in f:
-        if l.startswith(b' '):
+    for line in f:
+        if line.startswith(b' '):
             # Indented continuation of the previous line
-            v += l[1:]
+            v += line[1:]
         else:
             if k is not None:
                 # We parsed a new header, return its value
                 yield (k, _strip_last_newline(v))
-            if l == b'\n':
+            if line == b'\n':
                 # Empty line indicates end of headers
                 break
-            (k, v) = l.split(b' ', 1)
+            (k, v) = line.split(b' ', 1)
 
     else:
         # We reached end of file before the headers ended. We still need to

+ 9 - 9
dulwich/patch.py

@@ -326,22 +326,22 @@ def parse_patch_message(msg, encoding=None):
     lines = body.splitlines(True)
     line_iter = iter(lines)
 
-    for l in line_iter:
-        if l == b"---\n":
+    for line in line_iter:
+        if line == b"---\n":
             break
         if first:
-            if l.startswith(b"From: "):
-                c.author = l[len(b"From: "):].rstrip()
+            if line.startswith(b"From: "):
+                c.author = line[len(b"From: "):].rstrip()
             else:
-                c.message += b"\n" + l
+                c.message += b"\n" + line
             first = False
         else:
-            c.message += l
+            c.message += line
     diff = b""
-    for l in line_iter:
-        if l == b"-- \n":
+    for line in line_iter:
+        if line == b"-- \n":
             break
-        diff += l
+        diff += line
     try:
         version = next(line_iter).rstrip(b"\n")
     except StopIteration:

+ 8 - 8
dulwich/refs.py

@@ -753,23 +753,23 @@ def read_packed_refs_with_peeled(f):
     :param f: file-like object to read from, seek'ed to the second line
     """
     last = None
-    for l in f:
-        if l[0] == b'#':
+    for line in f:
+        if line[0] == b'#':
             continue
-        l = l.rstrip(b'\r\n')
-        if l.startswith(b'^'):
+        line = line.rstrip(b'\r\n')
+        if line.startswith(b'^'):
             if not last:
                 raise PackedRefsException("unexpected peeled ref line")
-            if not valid_hexsha(l[1:]):
-                raise PackedRefsException("Invalid hex sha %r" % l[1:])
+            if not valid_hexsha(line[1:]):
+                raise PackedRefsException("Invalid hex sha %r" % line[1:])
             sha, name = _split_ref_line(last)
             last = None
-            yield (sha, name, l[1:])
+            yield (sha, name, line[1:])
         else:
             if last:
                 sha, name = _split_ref_line(last)
                 yield (sha, name, None)
-            last = l
+            last = line
     if last:
         sha, name = _split_ref_line(last)
         yield (sha, name, None)

+ 3 - 3
setup.py

@@ -44,10 +44,10 @@ if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
         ['/usr/bin/xcodebuild', '-version'], stdout=subprocess.PIPE,
         stderr=subprocess.PIPE, env={})
     out, err = p.communicate()
-    for l in out.splitlines():
-        l = l.decode("utf8")
+    for line in out.splitlines():
+        line = line.decode("utf8")
         # Also parse only first digit, because 3.2.1 can't be parsed nicely
-        if l.startswith('Xcode') and int(l.split()[1].split('.')[0]) >= 4:
+        if line.startswith('Xcode') and int(line.split()[1].split('.')[0]) >= 4:
             os.environ['ARCHFLAGS'] = ''
 
 tests_require = ['fastimport']