@@ -37,8 +37,7 @@ def process_triangulation(triangulation):
37
37
representing the top-level simplices of the triangulation.
38
38
"""
39
39
simplices = np .asarray (
40
- [np .fromstring (line , sep = "," , dtype = int )
41
- for line in triangulation .split ("\n " )]
40
+ [np .fromstring (line , sep = "," , dtype = int ) for line in triangulation .split ("\n " )]
42
41
)
43
42
44
43
dimensions = [len (simplex ) - 1 for simplex in simplices ]
@@ -247,9 +246,7 @@ def process_triangulations(filename):
247
246
type = str ,
248
247
help = "Type information for triangulations (optional)" ,
249
248
)
250
- parser .add_argument (
251
- "-o" , "--output" , type = str , help = "Output file (optional)"
252
- )
249
+ parser .add_argument ("-o" , "--output" , type = str , help = "Output file (optional)" )
253
250
254
251
args = parser .parse_args ()
255
252
triangulations = process_triangulations (args .INPUT )
@@ -263,9 +260,7 @@ def process_triangulations(filename):
263
260
triangulations [manifold ].update (homology_groups [manifold ])
264
261
265
262
if args .type is not None :
266
- types = process_homology_groups_or_types (
267
- args .type , parse_topological_type
268
- )
263
+ types = process_homology_groups_or_types (args .type , parse_topological_type )
269
264
270
265
for manifold in triangulations :
271
266
triangulations [manifold ].update (types [manifold ])
@@ -274,18 +269,15 @@ def process_triangulations(filename):
274
269
# whole data set into a list of triangulations, making it easier
275
270
# to add new triangulations later on.
276
271
triangulations = [
277
- {"id" : manifold , ** triangulations [manifold ]}
278
- for manifold in triangulations
272
+ {"id" : manifold , ** triangulations [manifold ]} for manifold in triangulations
279
273
]
280
274
281
275
with (
282
- open (args .output , "w" ) if args .output is not
283
- None else nullcontext (sys .stdout )
276
+ open (args .output , "w" ) if args .output is not None else nullcontext (sys .stdout )
284
277
) as f :
285
278
result = json .dumps (triangulations , indent = 2 )
286
279
287
- regex = re .compile (r"^(\s+)\[(.*?)\]([,]\s+?)" ,
288
- re .MULTILINE | re .DOTALL )
280
+ regex = re .compile (r"^(\s+)\[(.*?)\]([,]\s+?)" , re .MULTILINE | re .DOTALL )
289
281
290
282
def prettify_triangulation (match ):
291
283
"""Auxiliary function for pretty-printing a triangulation.
@@ -313,8 +305,7 @@ def prettify_triangulation(match):
313
305
# Fix indent of "triangulation" fields afterwards. This ensures
314
306
# that the closing bracket of the triangulation key aligns with
315
307
# the start.
316
- regex = re .compile (r"^(\s+)\"triangulation\":.*?\]\]" ,
317
- re .MULTILINE | re .DOTALL )
308
+ regex = re .compile (r"^(\s+)\"triangulation\":.*?\]\]" , re .MULTILINE | re .DOTALL )
318
309
319
310
indents = [len (match .group (1 )) for match in regex .finditer (result )]
320
311
0 commit comments