@@ -291,7 +291,8 @@ def roadmap_pdeps(context):
291291
292292 # accepted, rejected and implemented
293293 pdeps_path = (
294- pathlib .Path (context ["source_path" ]).parent / context ["roadmap" ]["pdeps_path" ]
294+ pathlib .Path (context ["source_path" ]).parent
295+ / context ["roadmap" ]["pdeps_path" ]
295296 )
296297 for pdep in sorted (pdeps_path .iterdir ()):
297298 if pdep .suffix != ".md" :
@@ -359,6 +360,7 @@ def sort_pdep(pdep: dict) -> int:
359360
360361 return context
361362
363+
362364def get_callable (obj_as_str : str ) -> object :
363365 """
364366 Get a Python object from its string representation.
@@ -463,7 +465,9 @@ def main(
463465 context ["languages" ] = languages
464466 sys .stderr .write ("Context generated\n " )
465467
466- templates_path = pathlib .Path (source_path ).parent / context ["main" ]["templates_path" ]
468+ templates_path = (
469+ pathlib .Path (source_path ).parent / context ["main" ]["templates_path" ]
470+ )
467471 jinja_env = jinja2 .Environment (loader = jinja2 .FileSystemLoader (templates_path ))
468472
469473 for fname in get_source_files (source_path_lang ):
@@ -484,9 +488,15 @@ def main(
484488 )
485489 # Apply Bootstrap's table formatting manually
486490 # Python-Markdown doesn't let us config table attributes by hand
487- body = body .replace ("<table>" , '<table class="table table-bordered">' )
488- content = extend_base_template (body , context ["main" ]["base_template" ])
489- context ["base_url" ] = "" .join (["../" ] * os .path .normpath (fname ).count ("/" ))
491+ body = body .replace (
492+ "<table>" , '<table class="table table-bordered">'
493+ )
494+ content = extend_base_template (
495+ body , context ["main" ]["base_template" ]
496+ )
497+ context ["base_url" ] = "" .join (
498+ ["../" ] * os .path .normpath (fname ).count ("/" )
499+ )
490500 content = jinja_env .from_string (content ).render (** context )
491501 fname_html = os .path .splitext (fname )[0 ] + ".html"
492502 with open (
@@ -495,22 +505,28 @@ def main(
495505 f .write (content )
496506 else :
497507 shutil .copy (
498- os .path .join (source_path_lang , fname ), os .path .join (target_path_lang , dirname )
508+ os .path .join (source_path_lang , fname ),
509+ os .path .join (target_path_lang , dirname ),
499510 )
500511
501512
502513if __name__ == "__main__" :
503514 parser = argparse .ArgumentParser (description = "Documentation builder." )
504515 parser .add_argument (
505- "source_path" , help = "path to the source directory (must contain each language folder)"
516+ "source_path" ,
517+ help = "path to the source directory (must contain each language folder)" ,
506518 )
507- # For each language, the output will be written in a subdirectory named after the language (default: build/en)
519+ # For each language, the output will be written in a subdirectory named
520+ # after the language (default: build/en)
508521 parser .add_argument (
509522 "--target-path" , default = "build" , help = "directory where to write the output."
510523 )
511524 # e.g. python pandas_web.py --source_path pandas/content --languages en pt
512525 parser .add_argument (
513- "--languages" , nargs = "*" , default = "en" , help = "language codes to build (default: en)"
526+ "--languages" ,
527+ nargs = "*" ,
528+ default = "en" ,
529+ help = "language codes to build (default: en)" ,
514530 )
515531 args = parser .parse_args ()
516532 sys .exit (main (args .source_path , args .target_path , args .languages ))
0 commit comments