Skip to content

Renamed ununsed variables across #937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
62f1e67
updated db.py, removed unused variables
pratik-anurag Oct 15, 2019
0e467c8
updated fun.py, removed unused variables
pratik-anurag Oct 15, 2019
ac5e24f
changed unused variables assingment
pratik-anurag Oct 15, 2019
4c23668
renamed unused variables
pratik-anurag Oct 15, 2019
760be67
renamed unused variables
pratik-anurag Oct 15, 2019
3b4a732
renamed ununsed variables
pratik-anurag Oct 15, 2019
8560461
renamed ununsed variables
pratik-anurag Oct 15, 2019
8465f1e
renamed unused variables
pratik-anurag Oct 15, 2019
c28bdfc
renamed unsed variables
pratik-anurag Oct 15, 2019
4d25dfd
renamed unused variables
pratik-anurag Oct 15, 2019
1f8a5bc
renamed unused vars
pratik-anurag Oct 15, 2019
3f2e918
renamed unused variables
pratik-anurag Oct 15, 2019
bb46166
renamed unused variables
pratik-anurag Oct 15, 2019
01a76c8
renamed unused variables
pratik-anurag Oct 15, 2019
f05ab34
renamed unused variables
pratik-anurag Oct 15, 2019
506709b
renamed unused variables
pratik-anurag Oct 15, 2019
e1270c9
removed trailing whitespaces
pratik-anurag Oct 15, 2019
b90a3eb
removed trailing whitespaces
pratik-anurag Oct 15, 2019
432d87b
removed trailing whitespaces
pratik-anurag Oct 15, 2019
9aa0ce0
removed trailing whitespaces
pratik-anurag Oct 15, 2019
9345cc7
removed trailing whitespaces
pratik-anurag Oct 15, 2019
e5e1bb5
removed trailing whitespaces
pratik-anurag Oct 15, 2019
2308d2f
removed trailing whitespaces
pratik-anurag Oct 15, 2019
8640e06
removed trailing whitespaces
pratik-anurag Oct 15, 2019
fb92201
Update test_streams.py
pratik-anurag Oct 15, 2019
fe05338
removed trailing whitespaces
pratik-anurag Oct 15, 2019
b597a14
removed trailing whitespaces
pratik-anurag Oct 15, 2019
a1d758b
removed trailing whitespaces
pratik-anurag Oct 15, 2019
b711996
removed trailing whitespaces
pratik-anurag Oct 15, 2019
eddc11c
removed trailing whitespaces
pratik-anurag Oct 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions git/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion git/index/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion git/objects/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion git/objects/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions git/objects/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <hexsha> @UnusedVariable
type_token, type_name = lines[1].split(" ") # type <type_name> @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))

Expand Down
2 changes: 1 addition & 1 deletion git/refs/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions git/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions git/test/performance/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion git/test/test_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion git/test/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions git/test/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion git/test/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down