Skip to content

Commit c7f459f

Browse files
committed
src: No PyDev warnings
+ Mark all unused vars and other non-pep8 (PyDev) warnings + test_utils: + enable & fix forgotten IterableList looped path. + unittestize all assertions.
1 parent be44602 commit c7f459f

20 files changed

+129
-119
lines changed

git/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
# flake8: noqa
7-
7+
#@PydevCodeAnalysisIgnore
88
import os
99
import sys
1010
import inspect
@@ -32,17 +32,17 @@ def _init_externals():
3232

3333
#{ Imports
3434

35-
from git.config import GitConfigParser
36-
from git.objects import *
37-
from git.refs import *
38-
from git.diff import *
39-
from git.exc import *
40-
from git.db import *
41-
from git.cmd import Git
42-
from git.repo import Repo
43-
from git.remote import *
44-
from git.index import *
45-
from git.util import (
35+
from git.config import GitConfigParser # @NoMove @IgnorePep8
36+
from git.objects import * # @NoMove @IgnorePep8
37+
from git.refs import * # @NoMove @IgnorePep8
38+
from git.diff import * # @NoMove @IgnorePep8
39+
from git.exc import * # @NoMove @IgnorePep8
40+
from git.db import * # @NoMove @IgnorePep8
41+
from git.cmd import Git # @NoMove @IgnorePep8
42+
from git.repo import Repo # @NoMove @IgnorePep8
43+
from git.remote import * # @NoMove @IgnorePep8
44+
from git.index import * # @NoMove @IgnorePep8
45+
from git.util import ( # @NoMove @IgnorePep8
4646
LockFile,
4747
BlockingLockFile,
4848
Stats,

git/index/base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def _delete_entries_cache(self):
170170

171171
def _deserialize(self, stream):
172172
"""Initialize this instance with index values read from the given stream"""
173-
self.version, self.entries, self._extension_data, conten_sha = read_cache(stream)
173+
self.version, self.entries, self._extension_data, conten_sha = read_cache(stream) # @UnusedVariable
174174
return self
175175

176176
def _entries_sorted(self):
@@ -404,7 +404,7 @@ def raise_exc(e):
404404
continue
405405
# END glob handling
406406
try:
407-
for root, dirs, files in os.walk(abs_path, onerror=raise_exc):
407+
for root, dirs, files in os.walk(abs_path, onerror=raise_exc): # @UnusedVariable
408408
for rela_file in files:
409409
# add relative paths only
410410
yield os.path.join(root.replace(rs, ''), rela_file)
@@ -599,7 +599,6 @@ def _store_path(self, filepath, fprogress):
599599
"""Store file at filepath in the database and return the base index entry
600600
Needs the git_working_dir decorator active ! This must be assured in the calling code"""
601601
st = os.lstat(filepath) # handles non-symlinks as well
602-
stream = None
603602
if S_ISLNK(st.st_mode):
604603
# in PY3, readlink is string, but we need bytes. In PY2, it's just OS encoded bytes, we assume UTF-8
605604
open_stream = lambda: BytesIO(force_bytes(os.readlink(filepath), encoding=defenc))

git/index/fun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def write_tree_from_cache(entries, odb, sl, si=0):
264264

265265
# enter recursion
266266
# ci - 1 as we want to count our current item as well
267-
sha, tree_entry_list = write_tree_from_cache(entries, odb, slice(ci - 1, xi), rbound + 1)
267+
sha, tree_entry_list = write_tree_from_cache(entries, odb, slice(ci - 1, xi), rbound + 1) # @UnusedVariable
268268
tree_items_append((sha, S_IFDIR, base))
269269

270270
# skip ahead

git/objects/__init__.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@
33
"""
44
# flake8: noqa
55
from __future__ import absolute_import
6+
67
import inspect
8+
79
from .base import *
10+
from .blob import *
11+
from .commit import *
12+
from .submodule import util as smutil
13+
from .submodule.base import *
14+
from .submodule.root import *
15+
from .tag import *
16+
from .tree import *
817
# Fix import dependency - add IndexObject to the util module, so that it can be
918
# imported by the submodule.base
10-
from .submodule import util as smutil
1119
smutil.IndexObject = IndexObject
1220
smutil.Object = Object
1321
del(smutil)
14-
from .submodule.base import *
15-
from .submodule.root import *
1622

1723
# must come after submodule was made available
18-
from .tag import *
19-
from .blob import *
20-
from .commit import *
21-
from .tree import *
2224

2325
__all__ = [name for name, obj in locals().items()
2426
if not (name.startswith('_') or inspect.ismodule(obj))]

git/objects/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, repo, binsha):
4040
assert len(binsha) == 20, "Require 20 byte binary sha, got %r, len = %i" % (binsha, len(binsha))
4141

4242
@classmethod
43-
def new(cls, repo, id):
43+
def new(cls, repo, id): # @ReservedAssignment
4444
"""
4545
:return: New Object instance of a type appropriate to the object type behind
4646
id. The id of the newly created object will be a binsha even though

git/objects/commit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _get_intermediate_items(cls, commit):
140140
def _set_cache_(self, attr):
141141
if attr in Commit.__slots__:
142142
# read the data in a chunk, its faster - then provide a file wrapper
143-
binsha, typename, self.size, stream = self.repo.odb.stream(self.binsha)
143+
binsha, typename, self.size, stream = self.repo.odb.stream(self.binsha) # @UnusedVariable
144144
self._deserialize(BytesIO(stream.read()))
145145
else:
146146
super(Commit, self)._set_cache_(attr)
@@ -267,7 +267,7 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream):
267267
hexsha = line.strip()
268268
if len(hexsha) > 40:
269269
# split additional information, as returned by bisect for instance
270-
hexsha, rest = line.split(None, 1)
270+
hexsha, _ = line.split(None, 1)
271271
# END handle extra info
272272

273273
assert len(hexsha) == 40, "Invalid line: %s" % hexsha

git/refs/reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __str__(self):
5050

5151
#{ Interface
5252

53-
def set_object(self, object, logmsg=None):
53+
def set_object(self, object, logmsg=None): # @ReservedAssignment
5454
"""Special version which checks if the head-log needs an update as well
5555
:return: self"""
5656
oldbinsha = None

git/refs/symbolic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def set_commit(self, commit, logmsg=None):
218218

219219
return self
220220

221-
def set_object(self, object, logmsg=None):
221+
def set_object(self, object, logmsg=None): # @ReservedAssignment
222222
"""Set the object we point to, possibly dereference our symbolic reference first.
223223
If the reference does not exist, it will be created
224224
@@ -229,7 +229,7 @@ def set_object(self, object, logmsg=None):
229229
:note: plain SymbolicReferences may not actually point to objects by convention
230230
:return: self"""
231231
if isinstance(object, SymbolicReference):
232-
object = object.object
232+
object = object.object # @ReservedAssignment
233233
# END resolve references
234234

235235
is_detached = True

git/repo/fun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def rev_parse(repo, rev):
284284
try:
285285
if token == "~":
286286
obj = to_commit(obj)
287-
for item in xrange(num):
287+
for _ in xrange(num):
288288
obj = obj.parents[0]
289289
# END for each history item to walk
290290
elif token == "^":

git/test/lib/asserts.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
import stat
99

1010
from nose.tools import (
11-
assert_equal,
12-
assert_not_equal,
13-
assert_raises,
14-
raises,
15-
assert_true,
16-
assert_false
11+
assert_equal, # @UnusedImport
12+
assert_not_equal, # @UnusedImport
13+
assert_raises, # @UnusedImport
14+
raises, # @UnusedImport
15+
assert_true, # @UnusedImport
16+
assert_false # @UnusedImport
1717
)
1818

1919
try:
2020
from unittest.mock import patch
2121
except ImportError:
22-
from mock import patch
22+
from mock import patch # @NoMove @UnusedImport
2323

2424
__all__ = ['assert_instance_of', 'assert_not_instance_of',
2525
'assert_none', 'assert_not_none',

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy