mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 07:14:48 +08:00
Fix an isue about dict ordering in Python before 3.6.
This commit is contained in:
@@ -537,7 +537,10 @@ class DataclassWrapper(ContextWrapper, ClassMixin):
|
|||||||
for cls in reversed(list(self.py__mro__())):
|
for cls in reversed(list(self.py__mro__())):
|
||||||
if isinstance(cls, DataclassWrapper):
|
if isinstance(cls, DataclassWrapper):
|
||||||
filter_ = cls.get_global_filter()
|
filter_ = cls.get_global_filter()
|
||||||
for name in filter_.values():
|
# .values ordering is not guaranteed, at least not in
|
||||||
|
# Python < 3.6, when dicts where not ordered, which is an
|
||||||
|
# implementation detail anyway.
|
||||||
|
for name in sorted(filter_.values(), key=lambda name: name.start_pos):
|
||||||
d = name.tree_name.get_definition()
|
d = name.tree_name.get_definition()
|
||||||
annassign = d.children[1]
|
annassign = d.children[1]
|
||||||
if d.type == 'expr_stmt' and annassign.type == 'annassign':
|
if d.type == 'expr_stmt' and annassign.type == 'annassign':
|
||||||
|
|||||||
Reference in New Issue
Block a user