Skip to content

Commit a1fe86d

Browse files
Apply ruff format to Python code
1 parent 2bf487f commit a1fe86d

File tree

13 files changed

+2241
-1327
lines changed

13 files changed

+2241
-1327
lines changed

specification/src/main/resources/transforms/util/write-transforms.py

+17-8
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
# report the quality of a single transform
4444

45+
4546
def quality(from_schema, to_schema):
4647
if from_schema < to_schema:
4748
return 4
@@ -55,6 +56,7 @@ def quality(from_schema, to_schema):
5556

5657
# find the shortest sequence of transforms of sufficient quality
5758

59+
5860
def shortest_path(from_schema, to_schema, min_quality):
5961
paths = [[from_schema]]
6062
while True:
@@ -68,8 +70,10 @@ def shortest_path(from_schema, to_schema, min_quality):
6870
for path in paths:
6971
curr_step = path[-1]
7072
for next_step in transforms[curr_step]:
71-
if quality(curr_step, next_step) >= min_quality and \
72-
next_step not in path:
73+
if (
74+
quality(curr_step, next_step) >= min_quality
75+
and next_step not in path
76+
):
7377
next_path = list(path)
7478
next_path.append(next_step)
7579
next_paths.append(next_path)
@@ -86,6 +90,7 @@ def shortest_path(from_schema, to_schema, min_quality):
8690

8791
# scan the current directory to determine the schemas and transforms
8892

93+
8994
def load_transforms():
9095
global transforms
9196
global schemas
@@ -123,8 +128,7 @@ def load_transforms():
123128
best_paths[(from_schema, to_schema)] = (path, min_quality)
124129
break
125130
if not best_paths[(from_schema, to_schema)]:
126-
raise Exception(
127-
'no path from ' + from_schema + ' to ' + to_schema)
131+
raise Exception('no path from ' + from_schema + ' to ' + to_schema)
128132

129133

130134
# name the quality levels of transforms
@@ -134,13 +138,18 @@ def load_transforms():
134138

135139
# print in XML a sequence of transforms to the given schema
136140

141+
137142
def print_path(to_schema):
138143
(path, min_quality) = best_paths[(from_schema, to_schema)]
139-
print('\t\t\t<target schema="' + to_schema + \
140-
'" quality="' + qualities[min_quality - 1] + '">')
144+
print(
145+
'\t\t\t<target schema="'
146+
+ to_schema
147+
+ '" quality="'
148+
+ qualities[min_quality - 1]
149+
+ '">'
150+
)
141151
while len(path) > 1:
142-
print('\t\t\t\t<transform file="' + \
143-
path[0] + '-to-' + path[1] + '.xsl"/>')
152+
print('\t\t\t\t<transform file="' + path[0] + '-to-' + path[1] + '.xsl"/>')
144153
path = path[1:]
145154
print('\t\t\t</target>')
146155

xsd-fu/python/generateDS/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Pseudo-package to import generateDS.
33
"""
44

5-
65
from . import generateDS
76

8-
__all__ = ["generateDS"]
7+
__all__ = ['generateDS']

0 commit comments

Comments
 (0)