Skip to content

Commit b29dc6e

Browse files
committed
do not reorder attributes
1 parent 8e09eed commit b29dc6e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python/asthelper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ def visit_Call(self, node):
1414
class AttributeCollector(ast.NodeVisitor):
1515
def __init__(self, instance_name):
1616
self.instance_name = instance_name
17-
self.data = set()
17+
self.data = {}
1818
super().__init__()
1919

2020
def visit_Attribute(self, node):
2121
if isinstance(node.value, ast.Name):
2222
if node.value.id == self.instance_name:
23-
self.data.add(node.attr)
23+
self.data[node.attr] = None
2424
else:
2525
self.generic_visit(node)
2626

@@ -46,7 +46,7 @@ def generic_visit(self, node):
4646
class ClassVisitor(ast.NodeVisitor):
4747
def __init__(self, instance_name):
4848
super().__init__()
49-
self.attributes = set()
49+
self.attributes = {}
5050
self.instance_name = instance_name
5151

5252
def visit_Assign(self, node):

python/pydocstring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def _process_tree(self, tree):
232232
x.visit(tree)
233233
v = ClassVisitor(x.instance_name)
234234
v.visit(tree)
235-
att = list(v.attributes)
235+
att = [attr_name for attr_name in v.attributes]
236236
return att
237237

238238
def write_docstring(self, *args, **kwargs):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy