Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
omry committed Sep 24, 2020
1 parent 59a0816 commit 67eade6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions hydra/_internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from os.path import dirname, join, normpath, realpath
from traceback import print_exc, print_exception
from types import FrameType
from typing import Any, Callable, List, Optional, Sequence, Tuple, Type, Union
from typing import Any, Callable, List, Optional, Sequence, Tuple, Union

from omegaconf import DictConfig, ListConfig, OmegaConf
from omegaconf._utils import type_str
Expand Down Expand Up @@ -491,7 +491,7 @@ def get_column_widths(matrix: List[List[str]]) -> List[int]:


def _instantiate_or_call(
clazz: Type[Any],
clazz: Any,
config: DictConfig,
*args: Any,
**kwargs: Any,
Expand Down Expand Up @@ -614,7 +614,7 @@ def _get_kwargs(
d[key] = value
final_kwargs[k] = d
elif OmegaConf.is_list(v):
lst = d = OmegaConf.create([], flags={"allow_objects": True})
lst = OmegaConf.create([], flags={"allow_objects": True})
for x in v:
if _is_target(x):
lst.append(_call(x))
Expand Down
3 changes: 1 addition & 2 deletions hydra/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def _call(config: Any, *args: Any, **kwargs: Any) -> Any:
**kwargs,
)
except Exception as e:
e.msg = f"Error instantiating/calling '{cls}' : {e}"
raise e
raise type(e)(f"Error instantiating/calling '{cls}' : {e}")


# Alias for call
Expand Down
9 changes: 4 additions & 5 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,11 @@ def __eq__(self, other: Any) -> Any:

class Tree:
value: Any
left: Optional["Tree"] = None
right: Optional["Tree"] = None
# annotated any because of non recursive instantiation tests
left: Any = None
right: Any = None

def __init__(
self, value: Any, left: Optional["Tree"] = None, right: Optional["Tree"] = None
) -> None:
def __init__(self, value: Any, left: Any = None, right: Any = None) -> None:
self.value = value
self.left = left
self.right = right
Expand Down

0 comments on commit 67eade6

Please sign in to comment.