@@ -191,28 +191,26 @@ def get_scopes(self, line_number: int = None):
191191 return self .scope_list
192192 scope_list = []
193193 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 ()))
204205 if scope_list or self .none_scope is None :
205206 return scope_list
206- else :
207- return [self .none_scope ]
207+ return [self .none_scope ]
208208
209209 def get_inner_scope (self , line_number : int ):
210210 scope_sline = - 1
211211 curr_scope = None
212212 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 :
216214 curr_scope = scope
217215 scope_sline = scope .sline
218216 if (curr_scope is None ) and (self .none_scope is not None ):
0 commit comments