11import datetime
22
33
4- class bcolors :
4+ class Bcolors :
55 HEADER = '\033 [95m'
66 OKBLUE = '\033 [94m'
77 OKCYAN = '\033 [96m'
@@ -28,13 +28,13 @@ def info(self):
2828 """
2929 if self .response_type == 'records' :
3030
31- print (f'{ bcolors .OKBLUE } Sample Data:\n ' )
31+ print (f'{ Bcolors .OKBLUE } Sample Data:\n ' )
3232 try :
3333 print ('\t ' , self .get ('data' )[0 ], '\n ' )
3434 except KeyError as e :
3535 print ('\t ' , self .get ('data' ), '\n ' )
36- print (bcolors .ENDC )
37- print (f'{ bcolors .OKGREEN } Fields:\n ' )
36+ print (Bcolors .ENDC )
37+ print (f'{ Bcolors .OKGREEN } Fields:\n ' )
3838
3939 fields_info = []
4040 for field in self .get ('fields' ):
@@ -47,12 +47,12 @@ def info(self):
4747 # print field info
4848 for fi in fields_info :
4949 print ('\t ' , '{:<16s} {:<32s} {:<16s}' .format (fi [0 ], fi [1 ], fi [2 ]))
50- print (bcolors .ENDC )
50+ print (Bcolors .ENDC )
5151
52- print (f'\n { bcolors .OKCYAN } Metadata:\n ' )
52+ print (f'\n { Bcolors .OKCYAN } Metadata:\n ' )
5353 for k , v in self .get ('metadata' ).items ():
5454 print ('\t {:<16s} {:<16s}' .format (k , str (v )))
55- print (bcolors .ENDC )
55+ print (Bcolors .ENDC )
5656
5757 def fields (self , prop ):
5858 """
@@ -63,6 +63,10 @@ def fields(self, prop):
6363 return [i .get (prop ) for i in self .get ('fields' )]
6464
6565 def data (self ):
66+ """
67+ Gets data, shorthand for .get('data')
68+ :return: data
69+ """
6670 return self .get ('data' )
6771
6872 def prd (self , data ):
@@ -204,7 +208,6 @@ def transform(self, transformation, **kwargs):
204208 dt = datetime .datetime .strptime (str_dt , kwargs .get ('datestring' ))
205209 row .update ({str (field .get ('id' )): {'value' : dt }})
206210
207-
208211 if transformation == 'intround' :
209212 """Rounds numbers and transforms them to ints"""
210213
0 commit comments