-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
The below code triggers an unhashable type error when calling filter_unused_variable
. This occurs in 'is_literal_or_name' at line 788 in autoflake.py
.
import autoflake
autoflake.filter_unused_variable("g={{}}") # TypeError: unhashable type: 'dict'
autoflake.filter_unused_variable("g={[\n]}") # TypeError: unhashable type: 'list'
Setup Info
Version: 2.31
Commit: b87ff10
Trace Report For Each Input
Traceback (most recent call last):
File "rep.py", line 4, in <module>
autoflake.filter_unused_variable("g={[\n]}")
File "python3.10/site-packages/autoflake.py", line 731, in filter_unused_variable
if is_literal_or_name(value):
File "python3.10/site-packages/autoflake.py", line 788, in is_literal_or_name
ast.literal_eval(value)
File "python3.10/ast.py", line 110, in literal_eval
return _convert(node_or_string)
File "python3.10/ast.py", line 92, in _convert
return set(map(_convert, node.elts))
TypeError: unhashable type: 'dict'
Traceback (most recent call last):
File "rep.py", line 4, in <module>
autoflake.filter_unused_variable("g={[\n]}")
File "python3.10/site-packages/autoflake.py", line 731, in filter_unused_variable
if is_literal_or_name(value):
File "python3.10/site-packages/autoflake.py", line 788, in is_literal_or_name
ast.literal_eval(value)
File "python3.10/ast.py", line 110, in literal_eval
return _convert(node_or_string)
File "python3.10/ast.py", line 92, in _convert
return set(map(_convert, node.elts))
TypeError: unhashable type: 'list'
Metadata
Metadata
Assignees
Labels
No labels