parameters: (self)
return_statement: return True
docstring: Check the local directory.
docstring_summary: Check the local directory.
docstring_tokens: Check the local directory .
function: async def remove_local_directory(self):
          """Check the local directory."""
          import shutil
          from asyncio import sleep
  
          try:
              if self.data.category == "python_script":
                  local_path = "{}/{}.py".format(self.content.path.local, self.data.name)
              elif self.data.category == "theme":
                  if os.path.exists(
                      f"{self.hacs.system.config_path}/{self.hacs.configuration.theme_path}/{self.data.name}.yaml"
                  ):
                      os.remove(
                          f"{self.hacs.system.config_path}/{self.hacs.configuration.theme_path}/{self.data.name}.yaml"
                      )
                  local_path = self.content.path.local
              elif self.data.category == "integration":
                  if not self.data.domain:
                      self.logger.error("Missing domain")
                      return False
                  local_path = self.content.path.local
              else:
                  local_path = self.content.path.local
  
              if os.path.exists(local_path):
                  self.logger.debug(f"Removing {local_path}")
  
                  if self.data.category in ["python_script"]:
                      os.remove(local_path)
                  else:
                      shutil.rmtree(local_path)
  
                  while os.path.exists(local_path):
                      await sleep(1)
  
          except Exception as exception:
              self.logger.debug(f"Removing {local_path} failed with {exception}")
              return False
          return True
function_tokens: async def remove_local_directory ( self ) : import shutil from asyncio import sleep try : if self . data . category == "python_script" : local_path = "{}/{}.py" . format ( self . content . path . local , self . data . name ) elif self . data . category == "theme" : if os . path . exists ( f"{self.hacs.system.config_path}/{self.hacs.configuration.theme_path}/{self.data.name}.yaml" ) : os . remove ( f"{self.hacs.system.config_path}/{self.hacs.configuration.theme_path}/{self.data.name}.yaml" ) local_path = self . content . path . local elif self . data . category == "integration" : if not self . data . domain : self . logger . error ( "Missing domain" ) return False local_path = self . content . path . local else : local_path = self . content . path . local if os . path . exists ( local_path ) : self . logger . debug ( f"Removing {local_path}" ) if self . data . category in [ "python_script" ] : os . remove ( local_path ) else : shutil . rmtree ( local_path ) while os . path . exists ( local_path ) : await sleep ( 1 ) except Exception as exception : self . logger . debug ( f"Removing {local_path} failed with {exception}" ) return False return True