mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Add more ruff rules (#8767)
* Add more ruff rules * Add more ruff rules * pre-commit: Update ruff v0.0.269 -> v0.0.270 * Apply suggestions from code review * Fix doctest * Fix doctest (ignore whitespace) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -28,9 +28,8 @@ def convert_to_2d(
|
||||
TypeError: Input values must either be float or int: ['1', 2, 3, 10, 10]
|
||||
"""
|
||||
if not all(isinstance(val, (float, int)) for val in locals().values()):
|
||||
raise TypeError(
|
||||
"Input values must either be float or int: " f"{list(locals().values())}"
|
||||
)
|
||||
msg = f"Input values must either be float or int: {list(locals().values())}"
|
||||
raise TypeError(msg)
|
||||
projected_x = ((x * distance) / (z + distance)) * scale
|
||||
projected_y = ((y * distance) / (z + distance)) * scale
|
||||
return projected_x, projected_y
|
||||
@ -71,10 +70,11 @@ def rotate(
|
||||
input_variables = locals()
|
||||
del input_variables["axis"]
|
||||
if not all(isinstance(val, (float, int)) for val in input_variables.values()):
|
||||
raise TypeError(
|
||||
msg = (
|
||||
"Input values except axis must either be float or int: "
|
||||
f"{list(input_variables.values())}"
|
||||
)
|
||||
raise TypeError(msg)
|
||||
angle = (angle % 360) / 450 * 180 / math.pi
|
||||
if axis == "z":
|
||||
new_x = x * math.cos(angle) - y * math.sin(angle)
|
||||
|
Reference in New Issue
Block a user