Skip to content

Sourcery refactored master branch #1

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

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

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jul 21, 2023

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

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from xxicode July 21, 2023 14:06
assert task_failed is True
assert task_failed
Copy link
Author

Choose a reason for hiding this comment

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

Function schedule_jobs refactored with the following changes:

assert time_sleep_called is True
assert time_sleep_called
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:

assert call_failed is True
assert call_failed
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:

assert calc_failed is True
assert calc_failed
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:

assert input_failed is True
assert input_failed
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:

assert letters[0:3:2] == ["a", "c"]
assert letters[:3:2] == ["a", "c"]
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? ):

# add 0..4 to the back
# more elements. Lists can also be modified to have less elements
# Notice that lists have variable length and can be modified to have

Comment on lines -10 to -13
simple_set = {0, 1, 2}
simple_set = {0, 1, 2, 3}

# A set is dynamic like a `list` and `tuple`
simple_set.add(3)
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? ):

# A set is dynamic like a `list` and `tuple`

Comment on lines -16 to +19
assert len(content) > 0
assert content != ""

# We can use range slices to get substrings from a string
assert content[:8] == "Ultimate"
assert content.startswith("Ultimate")
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:

smaller_immutable = immutable[0:2]
smaller_immutable = immutable[:2]
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:

Comment on lines -8 to +26
x = 1
x_add_two = x + 2
x_add_two = 1 + 2
ran_1 = x_add_two == 3
assert ran_1

# This condition is obviously true
ran_1 = False
if x_add_two == 3: # skip: else
ran_1 = True # run
assert ran_1 is True

# A negated condition can also be true
ran_2 = False
if not x_add_two == 1: # skip: else
ran_2 = True # run
assert ran_2 is True
ran_2 = x_add_two != 1
assert ran_2

# There are `else` statements as well, which run if the initial condition
# fails. Notice that one line gets skipped and this conditional does not
# help us make a conclusion on the variable's true value
if x_add_two == 1:
ran_3 = False # skip: if
else:
ran_3 = True # run
assert ran_3 is True
ran_3 = x_add_two != 1
assert ran_3

# The `else` statement also runs once all other `if` and `elif` conditions
# fail. Notice that multiple lines get skipped, and that all of the
# conditions could have been compressed to `x_add_two != 3` for
# simplicity. In this case, less logic results in more clarity
if x_add_two == 1:
ran_4 = False # skip: if
elif x_add_two == 2:
ran_4 = False # skip: if
elif x_add_two < 3 or x_add_two > 3:
ran_4 = False # skip: if
else:
ran_4 = True # run
assert ran_4 is True
ran_4 = x_add_two != 1 and x_add_two != 2 and x_add_two >= 3 and x_add_two <= 3
assert ran_4
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? ):

# skip: else
# run
# This condition is obviously true
# skip: if
# A negated condition can also be true

Comment on lines -12 to +22
assert x + 1 == 2
assert x == 1

# An expression can be chained indefinitely. This concept of chaining
# expressions is powerful because it allows us to compose simple pieces
# of code into larger pieces of code over time
assert x * 2 * 2 * 2 == 8
assert x == 1

# Division is tricky because Python 3.x returns 0.5 of type `float`
# whereas Python 2.x returns 0 of type `int`. If this line fails, it
# is a sign that the wrong version of Python was used
assert x / 2 == 0.5
assert x == 0.5 * 2
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:

total = 0
for i in range(n):
total += fn(i)
return total
return sum(fn(i) for i in range(n))
Copy link
Author

Choose a reason for hiding this comment

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

Function sum_until refactored with the following changes:

Comment on lines -46 to -49
# We can use underscores (literal `_`) to separate digit groups in
# integer literals
assert 10_000 == 10000
assert 0x01_0f_2c == 69_420
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? ):

# We can use underscores (literal `_`) to separate digit groups in
# integer literals

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.

0 participants