Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Jan 8, 2024
1 parent 1fd13f1 commit e9842c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
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)
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


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)})"]
print(("=" * 60))
s = sanitize("".join(terms))
print(("Result:", s))
Expand Down

0 comments on commit e9842c8

Please sign in to comment.