summaryrefslogtreecommitdiff
path: root/git/objects
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-10-03 23:35:55 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-10-04 02:10:48 +0200
commita469af892b3e929cbe9d29e414b6fcd59bec246e (patch)
treef1ab9ed8946b3be2bb7ed1d3529ad5c0f348f550 /git/objects
parentbe44602b633cfb49a472e192f235ba6de0055d38 (diff)
downloadgitpython-a469af892b3e929cbe9d29e414b6fcd59bec246e.tar.gz
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. + remote: minor fix progress dispatching unknown err-lines
Diffstat (limited to 'git/objects')
-rw-r--r--git/objects/__init__.py16
-rw-r--r--git/objects/base.py2
-rw-r--r--git/objects/commit.py4
-rw-r--r--git/objects/fun.py4
-rw-r--r--git/objects/tag.py6
5 files changed, 17 insertions, 15 deletions
diff --git a/git/objects/__init__.py b/git/objects/__init__.py
index ee642876..23b2416a 100644
--- a/git/objects/__init__.py
+++ b/git/objects/__init__.py
@@ -3,22 +3,24 @@ Import all submodules main classes into the package space
"""
# flake8: noqa
from __future__ import absolute_import
+
import inspect
+
from .base import *
+from .blob import *
+from .commit import *
+from .submodule import util as smutil
+from .submodule.base import *
+from .submodule.root import *
+from .tag import *
+from .tree import *
# Fix import dependency - add IndexObject to the util module, so that it can be
# imported by the submodule.base
-from .submodule import util as smutil
smutil.IndexObject = IndexObject
smutil.Object = Object
del(smutil)
-from .submodule.base import *
-from .submodule.root import *
# must come after submodule was made available
-from .tag import *
-from .blob import *
-from .commit import *
-from .tree import *
__all__ = [name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj))]
diff --git a/git/objects/base.py b/git/objects/base.py
index 77d0ed63..0b849960 100644
--- a/git/objects/base.py
+++ b/git/objects/base.py
@@ -40,7 +40,7 @@ class Object(LazyMixin):
assert len(binsha) == 20, "Require 20 byte binary sha, got %r, len = %i" % (binsha, len(binsha))
@classmethod
- def new(cls, repo, id):
+ def new(cls, repo, id): # @ReservedAssignment
"""
:return: New Object instance of a type appropriate to the object type behind
id. The id of the newly created object will be a binsha even though
diff --git a/git/objects/commit.py b/git/objects/commit.py
index 000ab3d0..1534c552 100644
--- a/git/objects/commit.py
+++ b/git/objects/commit.py
@@ -140,7 +140,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
def _set_cache_(self, attr):
if attr in Commit.__slots__:
# read the data in a chunk, its faster - then provide a file wrapper
- binsha, typename, self.size, stream = self.repo.odb.stream(self.binsha)
+ binsha, typename, self.size, stream = self.repo.odb.stream(self.binsha) # @UnusedVariable
self._deserialize(BytesIO(stream.read()))
else:
super(Commit, self)._set_cache_(attr)
@@ -267,7 +267,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
hexsha = line.strip()
if len(hexsha) > 40:
# split additional information, as returned by bisect for instance
- hexsha, rest = line.split(None, 1)
+ hexsha, _ = line.split(None, 1)
# END handle extra info
assert len(hexsha) == 40, "Invalid line: %s" % hexsha
diff --git a/git/objects/fun.py b/git/objects/fun.py
index c04f80b5..5c0f4819 100644
--- a/git/objects/fun.py
+++ b/git/objects/fun.py
@@ -157,9 +157,9 @@ def traverse_trees_recursive(odb, tree_shas, path_prefix):
if not item:
continue
# END skip already done items
- entries = [None for n in range(nt)]
+ entries = [None for _ in range(nt)]
entries[ti] = item
- sha, mode, name = item # its faster to unpack
+ sha, mode, name = item # its faster to unpack @UnusedVariable
is_dir = S_ISDIR(mode) # type mode bits
# find this item in all other tree data items
diff --git a/git/objects/tag.py b/git/objects/tag.py
index c8684447..cefff083 100644
--- a/git/objects/tag.py
+++ b/git/objects/tag.py
@@ -21,7 +21,7 @@ class TagObject(base.Object):
type = "tag"
__slots__ = ("object", "tag", "tagger", "tagged_date", "tagger_tz_offset", "message")
- def __init__(self, repo, binsha, object=None, tag=None,
+ def __init__(self, repo, binsha, object=None, tag=None, # @ReservedAssignment
tagger=None, tagged_date=None, tagger_tz_offset=None, message=None):
"""Initialize a tag object with additional data
@@ -55,8 +55,8 @@ class TagObject(base.Object):
ostream = self.repo.odb.stream(self.binsha)
lines = ostream.read().decode(defenc).splitlines()
- obj, hexsha = lines[0].split(" ") # object <hexsha>
- type_token, type_name = lines[1].split(" ") # type <type_name>
+ obj, hexsha = lines[0].split(" ") # object <hexsha> @UnusedVariable
+ type_token, type_name = lines[1].split(" ") # type <type_name> @UnusedVariable
self.object = \
get_object_type_by_name(type_name.encode('ascii'))(self.repo, hex_to_bin(hexsha))