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 Starbot ⭐ refactored lewoudar/scalpel #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

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

git fetch https://github.com/sourcery-ai-bot/scalpel master
git merge --ff-only FETCH_HEAD
git reset HEAD^

return tuple([int(i) for i in __version__.split('.')])
return tuple(int(i) for i in __version__.split('.'))
Copy link
Author

Choose a reason for hiding this comment

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

Function version_info refactored with the following changes:

error_message = ''
if ur.scheme == 'file':
error_message = f'unable to open file {url}'

error_message = f'unable to open file {url}' if ur.scheme == 'file' else ''
Copy link
Author

Choose a reason for hiding this comment

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

Function SeleniumSpider._handle_url refactored with the following changes:

if filename in ['chromedriver', 'geckodriver']:
if filename in {'chromedriver', 'geckodriver'}:
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_driver_presence refactored with the following changes:

Comment on lines -118 to +121
callables = []
for str_callable in str_callable_list:
callables.append(get_callable_from_string(str_callable))

callables = [
get_callable_from_string(str_callable)
for str_callable in str_callable_list
]
Copy link
Author

Choose a reason for hiding this comment

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

Function callable_list_converter refactored with the following changes:

if isinstance(value, Path):
return str(value.absolute())
return str(value)
return str(value.absolute()) if isinstance(value, Path) else str(value)
Copy link
Author

Choose a reason for hiding this comment

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

Function str_converter refactored with the following changes:

assert [content] == [item for item in read_mp(mp_file)]
assert [content] == list(read_mp(mp_file))
Copy link
Author

Choose a reason for hiding this comment

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

Function TestWriteMp.test_should_write_bytes_when_giving_content_in_write_mode_without_custom_encoder refactored with the following changes:

assert [content] == [item for item in read_mp(mp_file, decoder=decode_datetime)]
assert [content] == list(read_mp(mp_file, decoder=decode_datetime))
Copy link
Author

Choose a reason for hiding this comment

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

Function TestWriteMp.test_should_write_bytes_when_giving_content_in_write_mode_with_custom_encoder refactored with the following changes:

assert content == [item for item in read_mp(mp_file)]
assert content == list(read_mp(mp_file))
Copy link
Author

Choose a reason for hiding this comment

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

Function TestWriteMp.test_should_write_bytes_when_giving_content_in_append_mode_without_custom_encoder refactored with the following changes:

assert content == [item for item in read_mp(mp_file, decoder=decode_datetime)]
assert content == list(read_mp(mp_file, decoder=decode_datetime))
Copy link
Author

Choose a reason for hiding this comment

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

Function TestWriteMp.test_should_write_bytes_when_giving_content_in_append_mode_with_custom_encoder refactored with the following changes:

assert [fruit_1, fruit_2] == [item for item in read_mp(f'{backup.resolve()}')]
assert [fruit_1, fruit_2] == list(read_mp(f'{backup.resolve()}'))
Copy link
Author

Choose a reason for hiding this comment

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

Function TestStaticSpider.test_should_save_content_to_backup_file refactored with the following changes:

assert [] == [line for line in async_file]
assert [] == list(async_file)
Copy link
Author

Choose a reason for hiding this comment

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

Function TestAsyncFile.test_iter_method_is_implemented refactored with the following changes:

for line in f:
result.append(line)

result.extend(iter(f))
Copy link
Author

Choose a reason for hiding this comment

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

Function TestOpenFile.test_open_file_works_as_expected 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