From 9246831f72c8714883168c1a5d51025c083c2c3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20He=C3=9F?= <rene.hess@iwr.uni-heidelberg.de>
Date: Thu, 6 Oct 2016 16:48:15 +0200
Subject: [PATCH] Global import in options.py

---
 python/dune/perftool/options.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py
index 9e345954..dfc1e837 100644
--- a/python/dune/perftool/options.py
+++ b/python/dune/perftool/options.py
@@ -1,12 +1,15 @@
-""" A module that manages the command line options to the form compiler executable """
+""" Manage the command line options to the form compiler executable """
 
+from argparse import ArgumentParser
+from os import path
 from pytools import memoize
 
+from dune.common.parametertree.parser import parse_ini_file
+
 
 @memoize
 def get_form_compiler_arguments():
     # define an argument parser.
-    from argparse import ArgumentParser
     parser = ArgumentParser(description="Compile UFL files to PDELab C++ code", epilog="Please report bugs to dominic.kempf@iwr.uni-heidelberg.de")
     parser.add_argument("uflfile", type=str, nargs=1, help="the UFL file to compile")
     parser.add_argument("--driver-file", type=str, help="The filename for the generated driver header")
@@ -47,13 +50,12 @@ def get_form_compiler_arguments():
     args["uflfile"] = args["uflfile"][0]
 
     # Turn any relative paths into absolute ones for consistency
-    import os.path
     if args["driver_file"]:
-        args["driver_file"] = os.path.abspath(args["driver_file"])
+        args["driver_file"] = path.abspath(args["driver_file"])
     if args["operator_file"]:
-        args["operator_file"] = os.path.abspath(args["operator_file"])
+        args["operator_file"] = path.abspath(args["operator_file"])
     if args["ini_file"]:
-        args["ini_file"] = os.path.abspath(args["ini_file"])
+        args["ini_file"] = path.abspath(args["ini_file"])
 
     # Return the argument dict. This result is memoized to turn all get_option calls into simple dict lookups.
     return args
@@ -72,7 +74,6 @@ def init_option_dict():
 
         # Read arguments from the given inifile
         if _option_dict["ini_file"]:
-            from dune.common.parametertree.parser import parse_ini_file
             inifile = parse_ini_file(_option_dict["ini_file"])
             for key, value in inifile.get("formcompiler", {}).items():
                 if key not in _option_dict or _option_dict[key] is None:
-- 
GitLab