mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
GitHub Action formats our code with psf/black (#1569)
* GitHub Action formats our code with psf/black @poyea Your review please. * fixup! Format Python code with psf/black push
This commit is contained in:
@@ -9,10 +9,12 @@ def ceil(x) -> int:
|
||||
>>> all(ceil(n) == math.ceil(n) for n in (1, -1, 0, -0, 1.1, -1.1, 1.0, -1.0, 1_000_000_000))
|
||||
True
|
||||
"""
|
||||
return x if isinstance(x, int) or x - int(x) == 0 else int(x + 1) if x > 0 else int(x)
|
||||
return (
|
||||
x if isinstance(x, int) or x - int(x) == 0 else int(x + 1) if x > 0 else int(x)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
||||
@@ -28,7 +28,7 @@ def factorial(input_number: int) -> int:
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
||||
@@ -24,7 +24,7 @@ def factorial(n: int) -> int:
|
||||
return 1 if n == 0 or n == 1 else n * factorial(n - 1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
||||
@@ -9,10 +9,12 @@ def floor(x) -> int:
|
||||
>>> all(floor(n) == math.floor(n) for n in (1, -1, 0, -0, 1.1, -1.1, 1.0, -1.0, 1_000_000_000))
|
||||
True
|
||||
"""
|
||||
return x if isinstance(x, int) or x - int(x) == 0 else int(x) if x > 0 else int(x - 1)
|
||||
return (
|
||||
x if isinstance(x, int) or x - int(x) == 0 else int(x) if x > 0 else int(x - 1)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
||||
@@ -50,7 +50,7 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int:
|
||||
>>> gaussian(2523, mu=234234, sigma=3425)
|
||||
0.0
|
||||
"""
|
||||
return 1 / sqrt(2 * pi * sigma ** 2) * exp(-(x - mu) ** 2 / 2 * sigma ** 2)
|
||||
return 1 / sqrt(2 * pi * sigma ** 2) * exp(-((x - mu) ** 2) / 2 * sigma ** 2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -21,7 +21,7 @@ def perfect_square(num: int) -> bool:
|
||||
return math.sqrt(num) * math.sqrt(num) == num
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
||||
Reference in New Issue
Block a user