Skip to content

Commit 52209e2

Browse files
Removed format_local_imports()
1 parent 48c17a0 commit 52209e2

File tree

1 file changed

+2
-67
lines changed

1 file changed

+2
-67
lines changed

nodezator/graphman/pythonrepr.py

+2-67
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
"""Function for extending the graph manager."""
22

33
### standard library imports
4-
54
from textwrap import indent, wrap
65

7-
from string import ascii_letters
8-
96

107
### local imports
118

@@ -354,11 +351,8 @@ def python_repr(self, additional_levels=()):
354351

355352
'### local imports (node callables)'
356353
+ ('\n' * 2)
357-
+ '\n'.join(
358-
format_local_imports(
359-
node_callable_imports
360-
)
361-
) + ('\n' * 3)
354+
+ '\n'.join(node_callable_imports)
355+
+ ('\n' * 3)
362356

363357
if node_callable_imports
364358

@@ -1523,62 +1517,3 @@ def data_node_to_text(
15231517
)
15241518

15251519
return node_text
1526-
1527-
1528-
def format_local_imports(local_imports):
1529-
""""""
1530-
###
1531-
1532-
words_per_item = [
1533-
1534-
statement[
1535-
1536-
# start after 'from '
1537-
5
1538-
1539-
# end before ' import '
1540-
: statement.rindex(' import ')
1541-
1542-
].split('.')
1543-
1544-
for statement in local_imports
1545-
1546-
]
1547-
1548-
###
1549-
1550-
n = len(words_per_item[0])
1551-
1552-
max_chars = [0 for _ in range(n)]
1553-
1554-
###
1555-
1556-
for i in range(n):
1557-
1558-
for item in words_per_item:
1559-
1560-
char_no = len(item[i])
1561-
max_chars[i] = max(max_chars[i], char_no)
1562-
1563-
###
1564-
1565-
for i in range(n):
1566-
1567-
for item in words_per_item:
1568-
1569-
max_value = max_chars[i]
1570-
item[i] = item[i].ljust(max_value, ' ')
1571-
1572-
###
1573-
1574-
return [
1575-
1576-
(
1577-
f'from {" . ".join(word_list)} import '
1578-
+ statement.split()[-1]
1579-
)
1580-
1581-
for word_list, statement
1582-
in zip(words_per_item, local_imports)
1583-
1584-
]

0 commit comments

Comments
 (0)