diff --git a/git/db.py b/git/db.py index 653fa7daa..9b3345288 100644 --- a/git/db.py +++ b/git/db.py @@ -51,7 +51,7 @@ def partial_to_complete_sha_hex(self, partial_hexsha): :note: currently we only raise BadObject as git does not communicate AmbiguousObjects separately""" try: - hexsha, typename, size = self._git.get_object_header(partial_hexsha) # @UnusedVariable + hexsha, _typename, _size = self._git.get_object_header(partial_hexsha) return hex_to_bin(hexsha) except (GitCommandError, ValueError): raise BadObject(partial_hexsha) diff --git a/git/index/base.py b/git/index/base.py index 04a3934d6..0bcd15a3e 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -158,7 +158,7 @@ def _delete_entries_cache(self): def _deserialize(self, stream): """Initialize this instance with index values read from the given stream""" - self.version, self.entries, self._extension_data, conten_sha = read_cache(stream) # @UnusedVariable + self.version, self.entries, self._extension_data, _conten_sha = read_cache(stream) return self def _entries_sorted(self): @@ -392,7 +392,7 @@ def raise_exc(e): continue # END glob handling try: - for root, dirs, files in os.walk(abs_path, onerror=raise_exc): # @UnusedVariable + for root, _dirs, files in os.walk(abs_path, onerror=raise_exc): for rela_file in files: # add relative paths only yield osp.join(root.replace(rs, ''), rela_file) diff --git a/git/index/fun.py b/git/index/fun.py index c8912dd23..f0091a3a1 100644 --- a/git/index/fun.py +++ b/git/index/fun.py @@ -265,7 +265,7 @@ def write_tree_from_cache(entries, odb, sl, si=0): # enter recursion # ci - 1 as we want to count our current item as well - sha, tree_entry_list = write_tree_from_cache(entries, odb, slice(ci - 1, xi), rbound + 1) # @UnusedVariable + sha, _tree_entry_list = write_tree_from_cache(entries, odb, slice(ci - 1, xi), rbound + 1) tree_items_append((sha, S_IFDIR, base)) # skip ahead diff --git a/git/objects/commit.py b/git/objects/commit.py index 916a10816..997fc5909 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -140,7 +140,7 @@ def _get_intermediate_items(cls, commit): 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) # @UnusedVariable + _binsha, _typename, self.size, stream = self.repo.odb.stream(self.binsha) self._deserialize(BytesIO(stream.read())) else: super(Commit, self)._set_cache_(attr) diff --git a/git/objects/fun.py b/git/objects/fun.py index 38dce0a5d..dc879fd2d 100644 --- a/git/objects/fun.py +++ b/git/objects/fun.py @@ -156,7 +156,7 @@ def traverse_trees_recursive(odb, tree_shas, path_prefix): # END skip already done items entries = [None for _ in range(nt)] entries[ti] = item - sha, mode, name = item # its faster to unpack @UnusedVariable + _sha, mode, name = item 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 4295a03af..017c49883 100644 --- a/git/objects/tag.py +++ b/git/objects/tag.py @@ -52,8 +52,8 @@ def _set_cache_(self, attr): ostream = self.repo.odb.stream(self.binsha) lines = ostream.read().decode(defenc).splitlines() - obj, hexsha = lines[0].split(" ") # object @UnusedVariable - type_token, type_name = lines[1].split(" ") # type @UnusedVariable + _obj, hexsha = lines[0].split(" ") + _type_token, type_name = lines[1].split(" ") self.object = \ get_object_type_by_name(type_name.encode('ascii'))(self.repo, hex_to_bin(hexsha)) diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index a8ca6538f..766037c15 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -614,7 +614,7 @@ def _iter_items(cls, repo, common_path=None): # END for each directory to walk # read packed refs - for sha, rela_path in cls._iter_packed_refs(repo): # @UnusedVariable + for _sha, rela_path in cls._iter_packed_refs(repo): if rela_path.startswith(common_path): rela_paths.add(rela_path) # END relative path matches common path diff --git a/git/remote.py b/git/remote.py index 73f102868..e7b3579bc 100644 --- a/git/remote.py +++ b/git/remote.py @@ -183,7 +183,7 @@ def _from_line(cls, remote, line): split_token = "..." if control_character == " ": split_token = ".." - old_sha, new_sha = summary.split(' ')[0].split(split_token) # @UnusedVariable + old_sha, _new_sha = summary.split(' ')[0].split(split_token) # have to use constructor here as the sha usually is abbreviated old_commit = old_sha # END message handling @@ -295,7 +295,7 @@ def _from_line(cls, repo, line, fetch_line): # parse lines control_character, operation, local_remote_ref, remote_local_ref, note = match.groups() try: - new_hex_sha, fetch_operation, fetch_note = fetch_line.split("\t") # @UnusedVariable + _new_hex_sha, _fetch_operation, fetch_note = fetch_line.split("\t") ref_type_name, fetch_note = fetch_note.split(' ', 1) except ValueError: # unpack error raise ValueError("Failed to parse FETCH_HEAD line: %r" % fetch_line) diff --git a/git/test/performance/test_streams.py b/git/test/performance/test_streams.py index 2e3772a02..cc6f0335c 100644 --- a/git/test/performance/test_streams.py +++ b/git/test/performance/test_streams.py @@ -121,7 +121,7 @@ def test_large_data_streaming(self, rwrepo): # read all st = time() - hexsha, typename, size, data = rwrepo.git.get_object_data(gitsha) # @UnusedVariable + _hexsha, _typename, size, data = rwrepo.git.get_object_data(gitsha) gelapsed_readall = time() - st print("Read %i KiB of %s data at once using git-cat-file in %f s ( %f Read KiB / s)" % (size_kib, desc, gelapsed_readall, size_kib / gelapsed_readall), file=sys.stderr) @@ -132,7 +132,7 @@ def test_large_data_streaming(self, rwrepo): # read chunks st = time() - hexsha, typename, size, stream = rwrepo.git.stream_object_data(gitsha) # @UnusedVariable + _hexsha, _typename, size, stream = rwrepo.git.stream_object_data(gitsha) while True: data = stream.read(cs) if len(data) < cs: diff --git a/git/test/test_commit.py b/git/test/test_commit.py index cd6c5d5f6..96a03b20d 100644 --- a/git/test/test_commit.py +++ b/git/test/test_commit.py @@ -125,7 +125,7 @@ def check_entries(d): check_entries(stats.total) assert "files" in stats.total - for filepath, d in stats.files.items(): # @UnusedVariable + for _filepath, d in stats.files.items(): check_entries(d) # END for each stated file diff --git a/git/test/test_docs.py b/git/test/test_docs.py index c14f5ff3b..a1fea4540 100644 --- a/git/test/test_docs.py +++ b/git/test/test_docs.py @@ -349,7 +349,7 @@ def test_references_and_objects(self, rw_dir): # The index contains all blobs in a flat list assert len(list(index.iter_blobs())) == len([o for o in repo.head.commit.tree.traverse() if o.type == 'blob']) # Access blob objects - for (path, stage), entry in index.entries.items(): # @UnusedVariable + for (path, _stage), entry in index.entries.items(): pass new_file_path = os.path.join(repo.working_tree_dir, 'new-file-name') open(new_file_path, 'w').close() diff --git a/git/test/test_index.py b/git/test/test_index.py index 110092396..577676f96 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -75,7 +75,7 @@ def __init__(self, *args): def _assert_fprogress(self, entries): self.assertEqual(len(entries), len(self._fprogress_map)) - for path, call_count in self._fprogress_map.items(): # @UnusedVariable + for _path, call_count in self._fprogress_map.items(): self.assertEqual(call_count, 2) # END for each item in progress map self._reset_progress() @@ -201,7 +201,7 @@ def test_index_file_from_tree(self, rw_repo): # test BlobFilter prefix = 'lib/git' - for stage, blob in base_index.iter_blobs(BlobFilter([prefix])): # @UnusedVariable + for _stage, blob in base_index.iter_blobs(BlobFilter([prefix])): assert blob.path.startswith(prefix) # writing a tree should fail with an unmerged index diff --git a/git/test/test_remote.py b/git/test/test_remote.py index 77e3ffbfd..95898f125 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -93,7 +93,7 @@ def make_assertion(self): assert self._stages_per_op # must have seen all stages - for op, stages in self._stages_per_op.items(): # @UnusedVariable + for _op, stages in self._stages_per_op.items(): assert stages & self.STAGE_MASK == self.STAGE_MASK # END for each op/stage diff --git a/git/util.py b/git/util.py index 7c07b0f3d..c395afd26 100644 --- a/git/util.py +++ b/git/util.py @@ -416,7 +416,7 @@ def _parse_progress_line(self, line): # END could not get match op_code = 0 - remote, op_name, percent, cur_count, max_count, message = match.groups() # @UnusedVariable + _remote, op_name, _percent, cur_count, max_count, message = match.groups() # get operation id if op_name == "Counting objects":