mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
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:
@@ -1,24 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import importlib
|
||||
import argparse
|
||||
import json
|
||||
import random
|
||||
import string
|
||||
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
|
||||
if 'py-json' not in sys.path:
|
||||
sys.path.append(os.path.join(os.path.abspath('..'), 'py-json'))
|
||||
sys.path.append(os.path.join(os.path.abspath('..'), 'py-dashboard'))
|
||||
if 'lanforge-scripts' not in sys.path:
|
||||
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../../")))
|
||||
|
||||
lfcli_base = importlib.import_module("lanforge-scripts.py-json.LANforge.lfcli_base")
|
||||
LFCliBase = lfcli_base.LFCliBase
|
||||
csv_to_influx = importlib.import_module("lanforge-scripts.py-scripts.csv_to_influx")
|
||||
CSVtoInflux = csv_to_influx.CSVtoInflux
|
||||
influx_add_parser_args = csv_to_influx.influx_add_parser_args
|
||||
grafana_profile = importlib.import_module("lanforge-scripts.py-scripts.grafana_profile")
|
||||
UseGrafana = grafana_profile.UseGrafana
|
||||
influx = importlib.import_module("lanforge-scripts.py-scripts.influx")
|
||||
RecordInflux = influx.RecordInflux
|
||||
InfluxRequest = importlib.import_module("lanforge-scripts.py-dashboard.InfluxRequest")
|
||||
influx_add_parser_args = InfluxRequest.influx_add_parser_args
|
||||
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
import json
|
||||
from InfluxRequest import RecordInflux
|
||||
from csv_to_influx import CSVtoInflux, influx_add_parser_args
|
||||
from grafana_profile import UseGrafana
|
||||
import random
|
||||
import string
|
||||
|
||||
class data_to_grafana(LFCliBase):
|
||||
def __init__(self,
|
||||
|
||||
Reference in New Issue
Block a user