@@ -191,28 +191,26 @@ def get_scopes(self, line_number: int = None):
191
191
return self .scope_list
192
192
scope_list = []
193
193
for scope in self .scope_list :
194
- if (line_number >= scope .sline ) and (line_number <= scope .eline ):
195
- if type (scope .parent ) is Interface :
196
- for use_stmnt in scope .use :
197
- if type (use_stmnt ) is not Import :
198
- continue
199
- # Exclude the parent and all other scopes
200
- if use_stmnt .import_type == ImportTypes .NONE :
201
- return [scope ]
202
- scope_list .append (scope )
203
- scope_list .extend (iter (scope .get_ancestors ()))
194
+ if not scope .sline <= line_number <= scope .eline :
195
+ continue
196
+ if type (scope .parent ) is Interface :
197
+ for use_stmnt in scope .use :
198
+ if type (use_stmnt ) is not Import :
199
+ continue
200
+ # Exclude the parent and all other scopes
201
+ if use_stmnt .import_type == ImportTypes .NONE :
202
+ return [scope ]
203
+ scope_list .append (scope )
204
+ scope_list .extend (iter (scope .get_ancestors ()))
204
205
if scope_list or self .none_scope is None :
205
206
return scope_list
206
- else :
207
- return [self .none_scope ]
207
+ return [self .none_scope ]
208
208
209
209
def get_inner_scope (self , line_number : int ):
210
210
scope_sline = - 1
211
211
curr_scope = None
212
212
for scope in self .scope_list :
213
- if scope .sline > scope_sline and (
214
- (line_number >= scope .sline ) and (line_number <= scope .eline )
215
- ):
213
+ if scope .sline > scope_sline and scope .sline <= line_number <= scope .eline :
216
214
curr_scope = scope
217
215
scope_sline = scope .sline
218
216
if (curr_scope is None ) and (self .none_scope is not None ):
0 commit comments