File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -160,15 +160,21 @@ def _add(final):
160
160
# take into account parent scope when assigning names.
161
161
162
162
used = self .all_reserved_names ()
163
+
163
164
# We need to also protect against using keywords ('class', 'def' etc.)
164
165
# i.e. count all keywords as 'used'.
165
166
# However, some builtins are also keywords (e.g. 'None'), and so
166
167
# if a builtin is being reserved, don't check against the keyword list
167
168
if not is_builtin :
168
169
used = used | set (keyword .kwlist )
169
- while attempt in used :
170
+
171
+ def _is_name_allowed (name : str ) -> bool :
172
+ return name not in used
173
+
174
+ while not _is_name_allowed (attempt ):
170
175
attempt = cleaned + str (count )
171
176
count += 1
177
+
172
178
return _add (attempt )
173
179
174
180
def reserve_function_arg_name (self , name ):
You can’t perform that action at this time.
0 commit comments