parameters: (self, candidate: str, obj: Optional[Any])
return_statement: return candidate
docstring: Create a unique name.
  
          Arguments:
              candidate: used as the basis for the unique name, relevant to the user.
              obj: If not None, an object that will be associated with the unique name.
docstring_summary: Create a unique name.
docstring_tokens: Create a unique name .
function: def create_name(self, candidate: str, obj: Optional[Any]) -> str:
          """Create a unique name.
  
          Arguments:
              candidate: used as the basis for the unique name, relevant to the user.
              obj: If not None, an object that will be associated with the unique name.
          """
          if obj is not None and obj in self._obj_to_name:
              return self._obj_to_name[obj]
  
          # delete all characters that are illegal in a Python identifier
          candidate = self._illegal_char_regex.sub('_', candidate)
  
          if candidate[0].isdigit():
              candidate = f'_{candidate}'
  
          match = self._name_suffix_regex.match(candidate)
          if match is None:
              base = candidate
              num = None
          else:
              base, num_str = match.group(1, 2)
              num = int(num_str)
  
          candidate = base if num is None else f'{base}_{num}'
          num = num if num else 0
  
          while candidate in self._used_names or self._is_illegal_name(candidate, obj):
              num += 1
              candidate = f'{base}_{num}'
  
          self._used_names.setdefault(candidate)
          if obj is None:
              self._unassociated_names.add(candidate)
          else:
              self._obj_to_name[obj] = candidate
          return candidate
function_tokens: def create_name ( self , candidate : str , obj : Optional [ Any ] ) -> str : if obj is not None and obj in self . _obj_to_name : return self . _obj_to_name [ obj ] # delete all characters that are illegal in a Python identifier candidate = self . _illegal_char_regex . sub ( '_' , candidate ) if candidate [ 0 ] . isdigit ( ) : candidate = f'_{candidate}' match = self . _name_suffix_regex . match ( candidate ) if match is None : base = candidate num = None else : base , num_str = match . group ( 1 , 2 ) num = int ( num_str ) candidate = base if num is None else f'{base}_{num}' num = num if num else 0 while candidate in self . _used_names or self . _is_illegal_name ( candidate , obj ) : num += 1 candidate = f'{base}_{num}' self . _used_names . setdefault ( candidate ) if obj is None : self . _unassociated_names . add ( candidate ) else : self . _obj_to_name [ obj ] = candidate return candidate