Skip to content

Commit

Permalink
Get flake8 to check for unused imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdleary committed Apr 29, 2024
1 parent eee5c0c commit 3dcb97a
Show file tree
Hide file tree
Showing 43 changed files with 97 additions and 210 deletions.
19 changes: 10 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
pycodestyle==2.10.0
pyfakefs==5.4.1
pytest==7.4.4
pytest-mypy==0.10.3
termcolor==1.1.0
types-termcolor==1.1.0
pycodestyle>=2.0
pyfakefs>=5.0
pytest>=6.0
pytest-mypy>=0.10
termcolor>=1.0
types-termcolor>=1.0
numpy==1.21.6
mypy==1.4.1
pytest-watch==4.2.0
tox==4.8.0
mypy>=1.3
pytest-watch>=4.0
tox>=3.0
flake8>=4.0
4 changes: 0 additions & 4 deletions src/echo/arg_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

from typing import Dict, Optional, Tuple, Any, List, Sequence

import pprint
import sys
import types

from echo.interp_result import Result, ExceptionData, check_result
from echo import code_attributes
from echo.elog import log

from termcolor import cprint


def _arg_join(arg_names: Sequence[str]) -> str:
if len(arg_names) == 1:
Expand Down
3 changes: 1 addition & 2 deletions src/echo/bc_helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dataclasses
import types
from typing import (
Callable, Tuple, Text, Optional, Any, Dict, List, TypeVar, Generic
Callable, Tuple, Text, Optional, Any, List,
)

VersionInfo = Tuple[int, int, int, str, int]
Expand Down
8 changes: 4 additions & 4 deletions src/echo/builtin_build_class.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Text, Tuple, Any, Dict, Optional, Union, Type
from typing import Text, Tuple, Any, Dict, Union, Type

from echo.epy_object import EPyObject, EPyType
from echo.epy_object import EPyType
from echo.interp_result import Result, ExceptionData, check_result
from echo.eobjects import (
EFunction, EClass, EMethod, EBuiltin,
do_setitem, get_guest_builtin,
EClass, EBuiltin,
get_guest_builtin,
)
from echo.interp_context import ICtx
from echo.elog import log
Expand Down
11 changes: 2 additions & 9 deletions src/echo/builtin_bytearray.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
from typing import Text, Tuple, Any, Dict, Optional
from typing import Text, Tuple, Any, Dict

from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, ExceptionData, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
)
from echo.eobjects import register_builtin
from echo.interp_context import ICtx
from echo import iteration_helpers


@register_builtin('bytearray')
Expand Down
5 changes: 2 additions & 3 deletions src/echo/builtin_dict.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from typing import Text, Tuple, Any, Dict, Optional
from typing import Text, Tuple, Any, Dict

from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
)
from echo.interp_context import ICtx
Expand Down
7 changes: 1 addition & 6 deletions src/echo/builtin_enumerate.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import itertools
from typing import Text, Tuple, Any, Dict, Optional

from echo.elog import log
from echo.epy_object import EPyObject, EPyType, AttrWhere
from echo.interp_result import Result, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
)
from echo.eobjects import register_builtin, get_guest_builtin
from echo.interp_context import ICtx


Expand Down
7 changes: 2 additions & 5 deletions src/echo/builtin_exception.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from typing import Tuple, Any, Dict, Optional

from echo.epy_object import EPyObject, AttrWhere
from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, ExceptionData, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
EClass, EInstance,
register_builtin, _is_exception_builtin, get_guest_builtin,
)
from echo.interp_context import ICtx
Expand Down Expand Up @@ -42,7 +39,7 @@ def _do_exception_new(
kwargs: Dict[str, Any],
ictx: ICtx) -> Result[Any]:
assert 1 <= len(args) and not kwargs, (args, kwargs)
msg = args[1] if len(args) == 2 else None
# msg = args[1] if len(args) == 2 else None
if isinstance(args[0], EClass):
inst = EInstance(args[0])
return Result(inst)
Expand Down
10 changes: 2 additions & 8 deletions src/echo/builtin_genericalias.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@
from typing import Text, Tuple, Any, Dict, Optional

from echo.enative_fn import ENativeFn
from echo.elog import log
from echo.epy_object import EPyObject, EPyType, AttrWhere
from echo.interp_result import Result, ExceptionData, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EMethod, EBuiltin, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin, E_PREFIX
)
from echo.interp_result import Result, check_result
from echo.eobjects import EMethod, get_guest_builtin, E_PREFIX
from echo.interp_context import ICtx
from echo import iteration_helpers


class EGenericAliasType(EPyType):
Expand Down
9 changes: 3 additions & 6 deletions src/echo/builtin_int.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from typing import Text, Tuple, Any, Dict, Optional
from typing import Text, Tuple, Any, Dict
import operator

from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, check_result, ExceptionData
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
EClass, EInstance,
register_builtin, get_guest_builtin,
)
from echo.interp_context import ICtx

Expand Down Expand Up @@ -52,7 +50,6 @@ def _do_int_new(
value = args[1] if len(args) > 1 else 0
if isinstance(cls, EClass):
assert get_guest_builtin('int') in cls.get_mro()
globals_: Dict[str, Any] = {}
o = EInstance(cls)
o.builtin_storage[int] = value
return Result(o)
Expand Down
5 changes: 1 addition & 4 deletions src/echo/builtin_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
from typing import Text, Tuple, Any, Dict, Optional, Type
from collections import OrderedDict as odict

from echo.elog import log
from echo.epy_object import EPyObject, AttrWhere, EPyType, try_invoke
from echo.enative_fn import ENativeFn
from echo.interp_result import Result, ExceptionData, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EMethod, EBuiltin, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
EMethod, register_builtin, get_guest_builtin,
)
from echo.interp_context import ICtx

Expand Down
5 changes: 2 additions & 3 deletions src/echo/builtin_list.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from typing import Tuple, Any, Dict, Optional, List
from typing import Tuple, Any, Dict, List

from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, check_result, ExceptionData
from echo import interp_routines
from echo import iteration_helpers
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
register_builtin, get_guest_builtin, is_list_builtin,
EClass, EInstance, register_builtin, get_guest_builtin, is_list_builtin,
)
from echo.builtin_genericalias import EGenericAlias
from echo.interp_context import ICtx
Expand Down
9 changes: 3 additions & 6 deletions src/echo/builtin_object.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from typing import Text, Tuple, Any, Dict, Optional
from typing import Text, Tuple, Any, Dict

from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, ExceptionData, check_result
from echo import interp_routines
from echo.interp_result import Result, check_result
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
EBuiltin, EClass, EInstance, register_builtin, get_guest_builtin,
)
from echo.interp_context import ICtx

Expand Down
11 changes: 4 additions & 7 deletions src/echo/builtin_predicates.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
from typing import Text, Tuple, Any, Dict

import collections
import re
import types
from typing import Text, Tuple, Any, Dict, Optional

import io
import _thread

from echo.elog import log
from echo.epy_object import EPyObject, AttrWhere, try_invoke
from echo.epy_object import EPyObject, try_invoke
from echo.interp_result import Result, check_result, ExceptionData
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
)
from echo.eobjects import EBuiltin, register_builtin, get_guest_builtin
from echo.interp_context import ICtx
from echo import iteration_helpers

Expand Down
12 changes: 3 additions & 9 deletions src/echo/builtin_str.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
from typing import Text, Tuple, Any, Dict, Optional, List
from typing import Text, Tuple, Any, Dict, List

from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, ExceptionData, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
)
from echo.interp_result import Result, check_result
from echo.eobjects import register_builtin, get_guest_builtin
from echo.interp_context import ICtx
from echo import iteration_helpers
from echo.value import Value


@register_builtin('str')
Expand Down
6 changes: 1 addition & 5 deletions src/echo/builtin_super.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
from echo.elog import log
from echo.epy_object import EPyObject, AttrWhere
from echo.interp_result import Result, check_result, ExceptionData
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance, EPyType,
register_builtin, get_guest_builtin, invoke_desc,
_is_type_builtin, _is_dict_builtin, _is_object_builtin,
_is_int_builtin,
EBuiltin, EClass, EPyType, register_builtin, get_guest_builtin,
)
from echo.interp_context import ICtx

Expand Down
2 changes: 1 addition & 1 deletion src/echo/builtin_sys_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from echo.enative_fn import ENativeFn
from echo.eobjects import get_guest_builtin
from echo.emodule import EModule
from echo.interp_result import Result, ExceptionData
from echo.interp_result import Result
from echo.interp_context import ICtx


Expand Down
6 changes: 2 additions & 4 deletions src/echo/builtin_tuple.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from typing import Text, Tuple, Any, Dict, Optional
from typing import Text, Tuple, Any, Dict

from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EBuiltin, EClass, EInstance,
EClass, EInstance,
register_builtin, is_tuple_builtin, get_guest_builtin,
)
from echo.interp_context import ICtx
Expand Down
8 changes: 2 additions & 6 deletions src/echo/builtin_type.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
from typing import Text, Tuple, Any, Dict, Optional
from typing import Text, Tuple, Any, Dict

from echo.elog import log
from echo.epy_object import EPyObject
from echo.interp_result import Result, ExceptionData, check_result
from echo import interp_routines
from echo.eobjects import (
EFunction, EClass, EInstance,
register_builtin, _is_dict_builtin, get_guest_builtin,
)
from echo.eobjects import EClass, register_builtin, get_guest_builtin
from echo.interp_context import ICtx
from echo.ebuiltins import TYPE_TO_EBUILTIN

Expand Down
2 changes: 0 additions & 2 deletions src/echo/call_profiler.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from typing import List, Union

import atexit
import collections
from operator import itemgetter
import pprint
from typing import Tuple, Any, Dict
from echo.eobjects import EFunction, EPyObject, EPyType

Expand Down
3 changes: 1 addition & 2 deletions src/echo/common.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""Commonly used utility functions."""

import dis
import itertools
import functools
import types
from typing import (
Any, Text, Iterable, Sequence, Tuple, List, TypeVar, Callable, Dict
Any, Text, Sequence, Tuple, List, TypeVar, Callable, Dict
)
from io import StringIO

Expand Down
2 changes: 1 addition & 1 deletion src/echo/ecell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Tuple, Optional
from typing import Any, Optional

from echo.interp_context import ICtx
from echo.interp_result import Result
Expand Down
2 changes: 1 addition & 1 deletion src/echo/eclassmethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from echo.epy_object import EPyObject, AttrWhere, EPyType
from echo.interp_result import Result, ExceptionData, check_result
from echo.eobjects import (
EFunction, EMethod, EBuiltin,
EMethod, EBuiltin,
get_guest_builtin, E_PREFIX,
)
from echo.enative_fn import ENativeFn
Expand Down
2 changes: 1 addition & 1 deletion src/echo/efunction_type.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Tuple, Optional, Dict, Any

from echo.epy_object import EPyObject, EPyType, AttrWhere
from echo.epy_object import EPyType, AttrWhere
from echo.interp_context import ICtx
from echo.interp_result import Result
from echo.eobjects import E_PREFIX, get_guest_builtin, EMethod
Expand Down
9 changes: 3 additions & 6 deletions src/echo/egenerator.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from typing import Tuple, Any, Dict, Optional, Union
from typing import Tuple, Any, Optional, Union

from echo.epy_object import EPyObject, AttrWhere, EPyType
from echo.interp_result import Result, ExceptionData, check_result
from echo.eobjects import (
EFunction, EMethod, EBuiltin,
get_guest_builtin,
)
from echo.interp_result import Result, ExceptionData
from echo.eobjects import EMethod, get_guest_builtin
from echo.return_kind import ReturnKind
from echo.interp_context import ICtx
from echo.value import Value
Expand Down
3 changes: 1 addition & 2 deletions src/echo/emap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from echo.epy_object import EPyObject, AttrWhere, EPyType
from echo.interp_result import Result, ExceptionData, check_result
from echo.eobjects import (
EFunction, EMethod, EBuiltin,
get_guest_builtin, E_PREFIX
EFunction, EBuiltin, get_guest_builtin, E_PREFIX
)
from echo.interp_context import ICtx
from echo.elog import log
Expand Down
Loading

0 comments on commit 3dcb97a

Please sign in to comment.