Skip to content

Commit

Permalink
Revert "Chore: Manual isort lint"
Browse files Browse the repository at this point in the history
This reverts commit 1cee783.
  • Loading branch information
NripeshN committed Sep 23, 2023
1 parent 8b9a043 commit ea69df1
Show file tree
Hide file tree
Showing 719 changed files with 2,630 additions and 2,842 deletions.
1 change: 0 additions & 1 deletion automation_tools/dashboard_automation/update_db.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys

from pymongo import MongoClient

action_url = "https://github.com/unifyai/ivy/actions/runs/"
Expand Down
9 changes: 4 additions & 5 deletions determine_test_coverage.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import bz2
import os
import pickle # noqa
import sys

import _pickle as cPickle
from pydriller import Repository
import pickle # noqa
from tqdm import tqdm

import bz2
import _pickle as cPickle
from run_tests_CLI.get_all_tests import get_all_tests


# Shared Map
tests = {}

Expand Down
9 changes: 4 additions & 5 deletions determine_tests.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import bz2
import os # noqa
import pickle # noqa
import subprocess
import sys

import _pickle as cPickle
from pydriller import Repository

import os # noqa
import bz2
import _pickle as cPickle
import sys
from run_tests_CLI.get_all_tests import get_all_tests

MAX_TESTS = 10
Expand Down
2 changes: 1 addition & 1 deletion docker/multiversion_framework_directory.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# flake8: noqa
import json
import os
import subprocess
import sys
import json


def directory_generator(req, base="/opt/fw/"):
Expand Down
2 changes: 1 addition & 1 deletion duplicate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import glob
import importlib
import os
import glob


def get_all_functions_from_directory(root_dir, startswith="test"):
Expand Down
75 changes: 39 additions & 36 deletions ivy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# global
import builtins
import copy
import inspect
import os
import re
import sys
import warnings
import builtins
import numpy as np
import sys
import inspect
import os
from collections.abc import Sequence

import numpy as np

import ivy.utils.backend.handler
from ivy._version import __version__ as __version__
Expand Down Expand Up @@ -613,6 +613,7 @@ class Node(str):
# local
import threading


# devices
# ToDo: add gpu and tpu for valid devices when we test for them
all_devices = ("cpu", "gpu", "tpu")
Expand Down Expand Up @@ -758,47 +759,48 @@ class Node(str):
locks = {"backend_setter": threading.Lock()}


from ivy.utils.backend import (
backend_stack,
choose_random_backend,
compiled_backends,
current_backend,
previous_backend,
set_backend,
set_jax_backend,
set_mxnet_backend,
set_numpy_backend,
set_paddle_backend,
set_tensorflow_backend,
set_torch_backend,
unset_backend,
with_backend,
)
from ivy.utils.inspection import add_array_specs, fn_array_spec

from . import func_wrapper, functional, stateful
from .func_wrapper import *
from .data_classes.array import Array, add_ivy_array_instance_methods
from .data_classes.array import conversions as arr_conversions
from .data_classes.array.conversions import *
from .data_classes.array import conversions as arr_conversions
from .data_classes.container import conversions as cont_conversions
from .data_classes.container import (
Container,
ContainerBase,
Container,
add_ivy_container_instance_methods,
)
from .data_classes.container import conversions as cont_conversions
from .data_classes.nested_array import NestedArray
from .data_classes.factorized_tensor import (
TuckerTensor,
CPTensor,
Parafac2Tensor,
TRTensor,
TTTensor,
TuckerTensor,
Parafac2Tensor,
)
from .data_classes.nested_array import NestedArray
from .func_wrapper import *
from .functional import *
from .stateful import *
from ivy.utils.backend import (
current_backend,
compiled_backends,
with_backend,
set_backend,
set_numpy_backend,
set_jax_backend,
set_tensorflow_backend,
set_torch_backend,
set_paddle_backend,
set_mxnet_backend,
previous_backend,
backend_stack,
choose_random_backend,
unset_backend,
)
from . import func_wrapper
from .utils import assertions, exceptions, verbosity
from .utils.backend import handler
from . import functional
from .functional import *
from . import stateful
from .stateful import *
from ivy.utils.inspection import fn_array_spec, add_array_specs

add_array_specs()

Expand All @@ -810,7 +812,7 @@ class Node(str):
except:
pass
try:
from .compiler.compiler import compile, transpile, unify
from .compiler.compiler import transpile, compile, unify
except: # noqa: E722
pass # Added for the finally statment
finally:
Expand Down Expand Up @@ -1217,12 +1219,13 @@ def dynamic_backend_as(value):

# sub_backends
from ivy.utils.backend.sub_backend_handler import (
available_sub_backend_implementations,
clear_sub_backends,
set_sub_backend,
unset_sub_backend,
clear_sub_backends,
available_sub_backend_implementations,
)


available_sub_backends = []
current_sub_backends = []

Expand Down
2 changes: 1 addition & 1 deletion ivy/compiler/compiler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import platform
from typing import Callable, Iterable, List, Optional, Tuple, Union
from typing import Callable, Optional, List, Union, Iterable, Tuple

python_version = platform.python_version_tuple()

Expand Down
5 changes: 4 additions & 1 deletion ivy/data_classes/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from . import array, container, factorized_tensor, nested_array
from . import array
from . import container
from . import nested_array
from . import factorized_tensor
6 changes: 2 additions & 4 deletions ivy/data_classes/array/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# global
import copy
import functools
from operator import mul

import numpy as np

from .array import Array
from operator import mul

# local
from .wrapping import add_ivy_array_instance_methods
from .array import Array
3 changes: 2 additions & 1 deletion ivy/data_classes/array/activations.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# global
import abc
from typing import Literal, Optional, Union
from typing import Optional, Union, Literal

# local
import ivy


# ToDo: implement all methods here as public instance methods


Expand Down
40 changes: 19 additions & 21 deletions ivy/data_classes/array/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,35 @@
# global
import copy
import functools
import numpy as np
from operator import mul
from typing import Optional

import numpy as np

# local
import ivy
from ivy.func_wrapper import handle_view_indexing

from .activations import _ArrayWithActivations
from .conversions import args_to_native, to_ivy
from .activations import _ArrayWithActivations
from .creation import _ArrayWithCreation
from .data_type import _ArrayWithDataTypes
from .device import _ArrayWithDevice
from .elementwise import _ArrayWithElementwise
from .general import _ArrayWithGeneral
from .gradients import _ArrayWithGradients
from .image import _ArrayWithImage
from .layers import _ArrayWithLayers
from .linear_algebra import _ArrayWithLinearAlgebra
from .losses import _ArrayWithLosses
from .manipulation import _ArrayWithManipulation
from .norms import _ArrayWithNorms
from .random import _ArrayWithRandom
from .searching import _ArrayWithSearching
from .set import _ArrayWithSet
from .sorting import _ArrayWithSorting
from .statistical import _ArrayWithStatistical
from .utility import _ArrayWithUtility
from ivy.func_wrapper import handle_view_indexing
from .experimental import (
_ArrayWithSearchingExperimental,
_ArrayWithActivationsExperimental,
_ArrayWithConversionsExperimental,
_ArrayWithCreationExperimental,
Expand All @@ -33,26 +46,11 @@
_ArrayWithManipulationExperimental,
_ArrayWithNormsExperimental,
_ArrayWithRandomExperimental,
_ArrayWithSearchingExperimental,
_ArrayWithSetExperimental,
_ArrayWithSortingExperimental,
_ArrayWithStatisticalExperimental,
_ArrayWithUtilityExperimental,
)
from .general import _ArrayWithGeneral
from .gradients import _ArrayWithGradients
from .image import _ArrayWithImage
from .layers import _ArrayWithLayers
from .linear_algebra import _ArrayWithLinearAlgebra
from .losses import _ArrayWithLosses
from .manipulation import _ArrayWithManipulation
from .norms import _ArrayWithNorms
from .random import _ArrayWithRandom
from .searching import _ArrayWithSearching
from .set import _ArrayWithSet
from .sorting import _ArrayWithSorting
from .statistical import _ArrayWithStatistical
from .utility import _ArrayWithUtility


class Array(
Expand Down Expand Up @@ -190,7 +188,7 @@ def dynamic_backend(self):

@dynamic_backend.setter
def dynamic_backend(self, value):
from ivy.functional.ivy.gradients import _is_variable, _variable, _variable_data
from ivy.functional.ivy.gradients import _variable, _is_variable, _variable_data
from ivy.utils.backend.handler import _determine_backend_from_args

if value == False:
Expand Down
4 changes: 2 additions & 2 deletions ivy/data_classes/array/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
ivy.Array instances.
"""

from typing import Any, Dict, Iterable, Optional, Tuple, Union

# global
import numpy as np
from typing import Any, Union, Tuple, Dict, Iterable, Optional

# local
import ivy


# Helpers #
# --------#

Expand Down
3 changes: 2 additions & 1 deletion ivy/data_classes/array/creation.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# global
import abc
from numbers import Number
from typing import List, Optional, Union
from typing import Optional, Union, List

# local
import ivy


# Array API Standard #
# -------------------#

Expand Down
2 changes: 1 addition & 1 deletion ivy/data_classes/array/data_type.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# global
import abc
from typing import List, Optional, Tuple, Union
from typing import Tuple, Optional, List, Union

# local
import ivy
Expand Down
3 changes: 2 additions & 1 deletion ivy/data_classes/array/device.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# global
import abc
from typing import Any, Optional, Union
from typing import Union, Optional, Any

import ivy


# ToDo: implement all methods here as public instance methods


Expand Down
2 changes: 1 addition & 1 deletion ivy/data_classes/array/elementwise.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# global
import abc
from typing import Literal, Optional, Union
from typing import Optional, Union, Literal

# local
import ivy
Expand Down
2 changes: 1 addition & 1 deletion ivy/data_classes/array/experimental/activations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# global
import abc
from typing import Literal, Optional, Union
from typing import Optional, Union, Literal

# local
import ivy
Expand Down
2 changes: 1 addition & 1 deletion ivy/data_classes/array/experimental/elementwise.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# global
import abc
from typing import Optional, Union, Tuple, List
from numbers import Number
from typing import List, Optional, Tuple, Union

# local
import ivy
Expand Down
2 changes: 1 addition & 1 deletion ivy/data_classes/array/experimental/general.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# global
import abc
from typing import Callable, Sequence, Union
from typing import Union, Callable, Sequence

# local
import ivy
Expand Down
2 changes: 1 addition & 1 deletion ivy/data_classes/array/experimental/layers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# global
import abc
from typing import Callable, List, Literal, Optional, Sequence, Tuple, Union
from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable

# local
import ivy
Expand Down
Loading

0 comments on commit ea69df1

Please sign in to comment.