File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 11
11
class JSONCompilationDatabase (CompilationDatabaseInterface ):
12
12
def __init__ (self , json_db_path ):
13
13
self .json_db_path = json_db_path
14
+ self .__data = None
14
15
15
16
@classmethod
16
17
def probe_directory (cls , directory ):
@@ -48,7 +49,7 @@ def _dict_to_compile_command(d):
48
49
49
50
@property
50
51
def _data (self ):
51
- if not hasattr ( self , ' __data' ) :
52
+ if self . __data is None :
52
53
with open (self .json_db_path ) as f :
53
54
self .__data = json .load (f )
54
55
return self .__data
Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ class IncludedByDatabase(CompilationDatabaseInterface):
141
141
def __init__ (self , graph , database ):
142
142
self .graph = graph
143
143
self .database = database
144
+ self .__db_index = None
144
145
145
146
def __repr__ (self ):
146
147
return '<IncludedByGraph: graph = {}, database = {}>' .format (
@@ -177,7 +178,7 @@ def _bfs_walk_from(self, path):
177
178
178
179
@property
179
180
def _db_index (self ):
180
- if not hasattr ( self , ' __db_index' ) :
181
+ if self . __db_index is None :
181
182
self .__db_index = frozenset (self .database .get_all_files ())
182
183
return self .__db_index
183
184
You can’t perform that action at this time.
0 commit comments