Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Feb 17, 2022

Branch xin refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the xin branch, then run:

git fetch origin sourcery/xin
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from xinetzone February 17, 2022 00:23
Comment on lines -62 to +65
for prefix in ['.', 'appveyor.yml', 'docs/', 'misc/']:
if line.startswith(prefix):
return True
return False
return any(
line.startswith(prefix)
for prefix in ['.', 'appveyor.yml', 'docs/', 'misc/']
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function sdist_files_from_git.get_file_list.exclude refactored with the following changes:

  • Use any() instead of for loop (use-any)

if is_ssh:
return 0
elif valid:
if is_ssh or valid:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _certificate_cb refactored with the following changes:


# These are special error codes, they should never reach here
test = err != C.GIT_EUSER and err != C.GIT_PASSTHROUGH
test = err not in [C.GIT_EUSER, C.GIT_PASSTHROUGH]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function check_error refactored with the following changes:

repo = repo or self._repo

if repo:
if repo := repo or self._repo:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Index.write_tree refactored with the following changes:

else:
loid = None

loid = Oid(raw=bytes(ffi.buffer(refs[0][i].loid.id)[:])) if local else None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Remote.ls_remotes refactored with the following changes:

diff = commit_a.tree.diff_to_tree(commit_b.tree)
assert diff.patch == PATCH
assert len(diff) == len([patch for patch in diff])
assert len(diff) == len(list(diff))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_diff_patch refactored with the following changes:

# Compare SHAs, not IndexEntry object identity
entries = [index[x].hex for x in range(n)]
assert list(x.hex for x in index) == entries
assert [x.hex for x in index] == entries
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_iter refactored with the following changes:

assert commit_a is not commit_b
assert commit_a == commit_b
assert not(commit_a != commit_b)
assert commit_a == commit_b
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_equality refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)

Comment on lines -67 to +72
s = set()
s.add(commit_a)
s.add(commit_b)
s = {commit_a, commit_b}
assert len(s) == 1
assert commit_a in s
assert commit_b in s

d = {}
d[commit_a] = True
d = {commit_a: True}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_hashing refactored with the following changes:

Comment on lines -117 to +115
msg = msg+" short_id="+short_id
already = seen.get(short_id)
if already:
msg = f'{msg} short_id={short_id}'
if already := seen.get(short_id):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_short_id.test_obj refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant