Skip to content
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

Sourcery refactored ultroid branch #2

Merged
merged 1 commit into from
Jan 30, 2023
Merged

Sourcery refactored ultroid branch #2

merged 1 commit into from
Jan 30, 2023

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jan 29, 2023

Branch ultroid 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 ultroid branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from New-dev0 January 29, 2023 19:26
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Due to GitHub API limits, only the first 60 comments can be shown.

Comment on lines -169 to +173
for root, _dirs, _files in os.walk(LIBRARY_DIR, topdown=False):
# setuptools is including __pycache__ for some reason (#1605)
if root.endswith('/__pycache__'):
remove_dirs.append(root)
remove_dirs.extend(
root
for root, _dirs, _files in os.walk(LIBRARY_DIR, topdown=False)
if root.endswith('/__pycache__')
)
Copy link
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

This removes the following comments ( why? ):

# setuptools is including __pycache__ for some reason (#1605)

Comment on lines -77 to +79
version = re.search(r"^__version__\s+=\s+'(.*)'$",
f.read(), flags=re.MULTILINE).group(1)
version = re.search(
r"^__version__\s+=\s+'(.*)'$", f.read(), flags=re.MULTILINE
)[1]
Copy link
Author

Choose a reason for hiding this comment

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

Lines 77-78 refactored with the following changes:

Comment on lines -25 to +27
node = nodes.reference(rawtext, utils.unescape(name),
refuri='{}?q={}'.format(base, name),
**options)
return node
return nodes.reference(
rawtext, utils.unescape(name), refuri=f'{base}?q={name}', **options
)
Copy link
Author

Choose a reason for hiding this comment

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

Function make_link_node refactored with the following changes:

result = self.__dict__.get(utils.get_peer_id(cls(item)))
if result:
if result := self.__dict__.get(utils.get_peer_id(cls(item))):
Copy link
Author

Choose a reason for hiding this comment

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

Function EntityCache.__getitem__ refactored with the following changes:

parent = os.path.dirname(file_path)
if parent:
if parent := os.path.dirname(file_path):
Copy link
Author

Choose a reason for hiding this comment

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

Function ensure_parent_dir_exists refactored with the following changes:

Comment on lines -97 to +102
if diff < 0 or \
diff.bit_length() < min_diff_bits_count or \
modexp.bit_length() < min_diff_bits_count or \
(modexp.bit_length() + 7) // 8 > max_mod_exp_size:
return False
return True
return (
diff >= 0
and diff.bit_length() >= min_diff_bits_count
and modexp.bit_length() >= min_diff_bits_count
and (modexp.bit_length() + 7) // 8 <= max_mod_exp_size
)
Copy link
Author

Choose a reason for hiding this comment

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

Function is_good_mod_exp_first refactored with the following changes:

if loop.is_running():
return coro
else:
return loop.run_until_complete(coro)
return coro if loop.is_running() else loop.run_until_complete(coro)
Copy link
Author

Choose a reason for hiding this comment

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

Function _syncify_wrap refactored with the following changes:

if not name.startswith('_') or name == '__call__':
if inspect.iscoroutinefunction(getattr(t, name)):
_syncify_wrap(t, name)
if (
not name.startswith('_') or name == '__call__'
) and inspect.iscoroutinefunction(getattr(t, name)):
_syncify_wrap(t, name)
Copy link
Author

Choose a reason for hiding this comment

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

Function syncify refactored with the following changes:

return '{} {}'.format(entity.first_name, entity.last_name)
return f'{entity.first_name} {entity.last_name}'
Copy link
Author

Choose a reason for hiding this comment

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

Function get_display_name refactored with the following changes:

Comment on lines -138 to +140
raise TypeError('Cannot cast {} to any kind of {}.'.format(
type(entity).__name__, target))
raise TypeError(
f'Cannot cast {type(entity).__name__} to any kind of {target}.'
)
Copy link
Author

Choose a reason for hiding this comment

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

Function _raise_cast_fail refactored with the following changes:

@New-dev0 New-dev0 merged commit ecae6b8 into ultroid Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant