@@ -46,17 +46,17 @@ async def send_info(self, info, isData= False):
46
46
data_dict = self .__generate_airtable_user_info_dict (info )
47
47
48
48
# Early return if no changes
49
- if self .latest_info_dict != None :
49
+ if self .latest_info_dict is not None :
50
50
print (LOG_PREFIX + "latest_info. data=%s" % (self .latest_info_dict ))
51
51
if data_dict == self .latest_info_dict :
52
52
print (LOG_PREFIX + "send_info no update necessary*" )
53
53
return
54
54
55
55
print (LOG_PREFIX + "Sending info. data=%s" % (data_dict ))
56
- if self .userRecordId != None :
56
+ if self .userRecordId is not None :
57
57
await self .__update_user (data_dict )
58
58
59
- if info .openPilotId != None and info .openPilotId != '' :
59
+ if ( info .openPilotId is not None ) and info .openPilotId != '' :
60
60
self .openPilotId = info .openPilotId
61
61
62
62
response = await self .at .get (USERS_TABLE , limit = 1 , filter_by_formula = ("{openPilotId} = '%s'" % (self .openPilotId )))
@@ -76,7 +76,7 @@ async def send_info(self, info, isData= False):
76
76
print (LOG_PREFIX + "*send_info competed*" )
77
77
78
78
async def send_event (self , event ):
79
- if self .openPilotId is None and self .latest_info_dict != None :
79
+ if self .openPilotId is None and self .latest_info_dict is not None :
80
80
self .openPilotId = self .latest_info_dict [self .userKeys .openPilotId ]
81
81
82
82
event_dict = self .__generate_airtable_user_event_dict (event )
@@ -103,7 +103,7 @@ def __generate_airtable_user_event_dict(self, event):
103
103
value = event .value .intValue
104
104
elif value == self .eventValueTypes .floatValue :
105
105
value = event .value .floatValue
106
- openPilotId = event .openPilotId if (event .openPilotId != None ) else (self .openPilotId if (self .openPilotId != None ) else "" )
106
+ openPilotId = event .openPilotId if (event .openPilotId is not None ) else (self .openPilotId if (self .openPilotId is not None ) else "" )
107
107
dictionary = event .to_dict ()
108
108
dictionary [self .eventKeys .value ] = value
109
109
dictionary [self .eventKeys .openPilotId ] = openPilotId
@@ -118,14 +118,14 @@ async def __update_user(self, data):
118
118
119
119
def __is_notfound_response (self , response ):
120
120
try :
121
- return response ["error" ] != None and response ["error" ]["code" ] == 422
121
+ return response ["error" ] is not None and response ["error" ]["code" ] == 422
122
122
except : # pylint: disable=bare-except
123
123
count = response ["records" ].__len__ ()
124
124
return count == 0
125
125
126
126
def __is_error_response (self , response ):
127
127
try :
128
- return response ["error" ] != None
128
+ return response ["error" ] is not None
129
129
except : # pylint: disable=bare-except
130
130
return False
131
131
@@ -179,7 +179,7 @@ def create_payload(data):
179
179
return {'fields' : data }
180
180
181
181
182
- class Airtable (object ):
182
+ class Airtable ():
183
183
def __init__ (self , base_id , api_key , dict_class = OrderedDict ):
184
184
"""Create a client to connect to an Airtable Base.
185
185
0 commit comments