mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-18 19:14:54 +00:00
GhostRequest: Use staticmethod where relevant
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -29,8 +29,8 @@ RecordInflux = InfluxRequest.RecordInflux
|
|||||||
|
|
||||||
|
|
||||||
class CSVReader:
|
class CSVReader:
|
||||||
def read_csv(self,
|
@staticmethod
|
||||||
file,
|
def read_csv(file,
|
||||||
sep='\t'):
|
sep='\t'):
|
||||||
df = open(file).read().split('\n')
|
df = open(file).read().split('\n')
|
||||||
rows = list()
|
rows = list()
|
||||||
@@ -39,8 +39,8 @@ class CSVReader:
|
|||||||
rows.append(x.split(sep))
|
rows.append(x.split(sep))
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
def get_column(self,
|
@staticmethod
|
||||||
df,
|
def get_column(df,
|
||||||
value):
|
value):
|
||||||
index = df[0].index(value)
|
index = df[0].index(value)
|
||||||
values = []
|
values = []
|
||||||
@@ -48,7 +48,8 @@ class CSVReader:
|
|||||||
values.append(row[index])
|
values.append(row[index])
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def get_columns(self, df, targets):
|
@staticmethod
|
||||||
|
def get_columns(df, targets):
|
||||||
target_index = []
|
target_index = []
|
||||||
for item in targets:
|
for item in targets:
|
||||||
target_index.append(df[0].index(item))
|
target_index.append(df[0].index(item))
|
||||||
@@ -60,7 +61,8 @@ class CSVReader:
|
|||||||
results.append(row_data)
|
results.append(row_data)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def to_html(self, df):
|
@staticmethod
|
||||||
|
def to_html(df):
|
||||||
html = ''
|
html = ''
|
||||||
html = html + ('<table style="border:1px solid #ddd">'
|
html = html + ('<table style="border:1px solid #ddd">'
|
||||||
'<colgroup>'
|
'<colgroup>'
|
||||||
@@ -78,7 +80,8 @@ class CSVReader:
|
|||||||
'</table>')
|
'</table>')
|
||||||
return html
|
return html
|
||||||
|
|
||||||
def filter_df(self, df, column, expression, target):
|
@staticmethod
|
||||||
|
def filter_df(df, column, expression, target):
|
||||||
target_index = df[0].index(column)
|
target_index = df[0].index(column)
|
||||||
counter = 0
|
counter = 0
|
||||||
targets = [0]
|
targets = [0]
|
||||||
@@ -98,7 +101,8 @@ class CSVReader:
|
|||||||
counter += 1
|
counter += 1
|
||||||
return list(map(df.__getitem__, targets))
|
return list(map(df.__getitem__, targets))
|
||||||
|
|
||||||
def concat(self, dfs):
|
@staticmethod
|
||||||
|
def concat(dfs):
|
||||||
return list(itertools.chain.from_iterable(dfs))
|
return list(itertools.chain.from_iterable(dfs))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user