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 master branch #4

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions euclid.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,4 @@ def gcd2(a, b):


def gcd3(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
return a if b == 0 else gcd(b, a % 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 gcd3 refactored with the following changes:

5 changes: 1 addition & 4 deletions legendre_symbol_small.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ def legendre_symbol(a, p):

ls = pow(a, (p - 1) // 2, p)

if ls == p - 1:
return -1
else:
return ls
return -1 if ls == p - 1 else ls
Copy link
Author

Choose a reason for hiding this comment

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

Function legendre_symbol refactored with the following changes:



def test():
Expand Down
9 changes: 4 additions & 5 deletions polysolv.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,11 @@ def factor_poly(Poly, Grade):
terms = []
for grade in range(Grade, 1, -1):
result = poly_synthetic_div_complete_step(P, grade)
if result != None:
P, term = result
terms += term
else:
if result is None:
break
terms += ["(%s)" % poly_to_text(P, grade)]
P, term = result
terms += term
terms += [f"({poly_to_text(P, grade)})"]
Comment on lines -106 to +110
Copy link
Author

Choose a reason for hiding this comment

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

Function factor_poly refactored with the following changes:

print(("=" * 60))
s = sanitize("".join(terms))
print(("Result:", s))
Expand Down
Loading