Skip to content

Commit af6e93b

Browse files
committed
Hackily removing ImportFrom node from AST for datetime
1 parent c3eea35 commit af6e93b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pylint_django/transforms/fields.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def apply_type_shim(cls, context=None):
3535
base_node = MANAGER.ast_from_module_name('decimal').lookup('Decimal')
3636
elif cls.name in ('SplitDateTimeField', 'DateTimeField'):
3737
base_node = MANAGER.ast_from_module_name('datetime').lookup('datetime')
38+
# XXX: for some reason, with python3, this particular line triggers a
39+
# check in the StdlibChecker for deprecated methods; one of these nodes
40+
# is an ImportFrom which has no qname() method, causing the checker
41+
# to die...
42+
base_node = (base_node[0], base_node[1][:-1])
3843
elif cls.name == 'TimeField':
3944
base_node = MANAGER.ast_from_module_name('datetime').lookup('time')
4045
elif cls.name == 'DateField':

0 commit comments

Comments
 (0)