Updates to import statements:

- Import importlib, os, and sys to each python script.
 - Append "lanforge-scripts" root directory to the system path, allowing each script to be called from an antecedent directory. e.g.
if 'lanforge-scripts' not in sys.path:
    sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../../../")))
 - All statements of the form 'from <module> import <class>' replace with:
<module> = importlib.import_module("lanforge-scripts.<directory>.<module>")
<class> = <module>.<class>
This commit is contained in:
erinnerim
2021-09-15 16:17:16 -07:00
parent 5404d9068b
commit 1d7578251c
128 changed files with 1639 additions and 1388 deletions

View File

@@ -1,14 +1,14 @@
#!/usr/bin/env python3
'''
"""
NAME: lf_graph.py
PURPOSE:
PURPOSE:
Common Library for generating graphs for LANforge output
SETUP:
SETUP:
/lanforge/html-reports directory needs to be present or output generated in local file
EXAMPLE:
EXAMPLE:
see: /py-scritps/lf_report_test.py for example
COPYWRITE
@@ -16,8 +16,10 @@ COPYWRITE
License: Free to distribute and modify. LANforge systems must be licensed.
INCLUDE_IN_README
'''
"""
import sys
import os
import importlib
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
@@ -25,8 +27,12 @@ import pandas as pd
import pdfkit
import math
from matplotlib.colors import ListedColormap
from lf_csv import lf_csv
if 'lanforge-scripts' not in sys.path:
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../../")))
lf_csv = importlib.import_module("lanforge-scripts.py-scripts.lf_csv")
lf_csv = lf_csv.lf_csv
# internal candela references included during intial phases, to be deleted at future date