Skip to content

Commit

Permalink
auto-lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-dev-bot committed Sep 19, 2024
1 parent c142467 commit 6449c70
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 24 deletions.
35 changes: 21 additions & 14 deletions ivy/functional/backends/jax/experimental/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,21 +723,28 @@ def interpolate(
return ivy.inplace_update(out, ret)
return ret

def _check_mode(*args, mode="linear", recompute_scale_factor=None, align_corners=None, **kwargs):

def _check_mode(
*args, mode="linear", recompute_scale_factor=None, align_corners=None, **kwargs
):
return (
mode not in [
"area",
"nearest",
"nd",
"tf_area",
"mitchellcubic",
"gaussian",
"bicubic",
]
and not align_corners
and recompute_scale_factor
)
interpolate.partial_mixed_handler =_check_mode
mode
not in [
"area",
"nearest",
"nd",
"tf_area",
"mitchellcubic",
"gaussian",
"bicubic",
]
and not align_corners
and recompute_scale_factor
)


interpolate.partial_mixed_handler = _check_mode


def reduce_window(
operand: JaxArray,
Expand Down
4 changes: 3 additions & 1 deletion ivy/functional/backends/tensorflow/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def get_item(
query = tf.cast(query, tf.int64)
return tf.gather(x, query, axis=0)
else:
if isinstance(query, (list, tuple)) and any([isinstance(q, (list, tuple)) for q in query]):
if isinstance(query, (list, tuple)) and any(
[isinstance(q, (list, tuple)) for q in query]
):
# convert any lists/tuples within the query to slices
query = tuple(
[slice(*q) if isinstance(q, (list, tuple)) else q for q in query]
Expand Down
1 change: 0 additions & 1 deletion ivy/functional/ivy/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import abc
import math
import psutil
import warnings
import types
from typing import Type, Optional, Tuple

Expand Down
1 change: 1 addition & 0 deletions ivy/functional/ivy/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
)
import einops
import numpy as np

try:
import ml_dtypes # noqa
except:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from operator import mul
import sys
import string

try:
import ml_dtypes # noqa
except:
Expand Down
10 changes: 2 additions & 8 deletions scripts/backend_generation/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ def _should_install_backend(package_name):
with open("../../requirements/optional.txt", "a") as reqr_file:
reqr_file.write("\n" + package_name + "\n")
except subprocess.CalledProcessError as e:
raise RuntimeError(
f"Installing {package_name} failed. {e}"
) from e
raise RuntimeError(f"Installing {package_name} failed. {e}") from e
elif ret.lower() == "n":
print(
"Will continue without backend installed, "
Expand Down Expand Up @@ -242,11 +240,7 @@ def _add_alias_for_backend():

def _update_flag_config_value(key):
# Handle flag input and update it's value
ret = input(
f"\nToggle flag {key} [Y/n]? "
f"default: '{config_flags[key]}'"
f": "
)
ret = input(f"\nToggle flag {key} [Y/n]? " f"default: '{config_flags[key]}'" f": ")
ret = ret.strip(" ").lower()
if ret == "y":
config_flags[key] = not config_flags[key]
Expand Down

0 comments on commit 6449c70

Please sign in to comment.