original_docstring: Delete all of the files associated with this instance
  
          Always delete the generated requirements.txt and Dockerfile. Only
          delete the script if it was auto-generated. Only delete the parent
          directory if it is empty.
  
          Also delete the local docker image
          
docstring: Delete all of the files associated with this instance
  Always delete the generated requirements.txt and Dockerfile. Only
  delete the script if it was auto-generated. Only delete the parent
  directory if it is empty.
  
  Also delete the local docker image
docstring_tokens: Delete all of the files associated with this instance Always delete the generated requirements . txt and Dockerfile . Only delete the script if it was auto - generated . Only delete the parent directory if it is empty . Also delete the local docker image
code: def clobber(self):
          """Delete all of the files associated with this instance
  
          Always delete the generated requirements.txt and Dockerfile. Only
          delete the script if it was auto-generated. Only delete the parent
          directory if it is empty.
  
          Also delete the local docker image
          """
          if self.clobbered:
              return
  
          if self._clobber_script:
              os.remove(self.script_path)
              mod_logger.info("Removed {path:s}".format(path=self.script_path))
  
          os.remove(self.docker_path)
          mod_logger.info("Removed {path:s}".format(path=self.docker_path))
          os.remove(self.req_path)
          mod_logger.info("Removed {path:s}".format(path=self.req_path))
  
          try:
              os.rmdir(self.build_path)
              mod_logger.info("Removed {path:s}".format(path=self.build_path))
          except OSError:
              # Directory is not empty. There's pre-existing stuff in there
              # that we shouldn't mess with.
              pass
  
          cli = docker.from_env().images
          # Get local images first (lol stands for list_of_lists)
          local_image_lol = [im.tags for im in cli.list()]
          # Flatten the list of lists
          local_images = [im for sublist in local_image_lol for im in sublist]
  
          # Use docker image client to remove local images
          for im in self.images:
              if im["name"] + ":" + im["tag"] in local_images:
                  # Remove the local docker image, using the image name
                  cli.remove(
                      image=im["name"] + ":" + im["tag"], force=True, noprune=False
                  )
                  # Update local_images to prevent redundant image removal
                  local_image_lol = [im.tags for im in cli.list()]
                  local_images = [im for sublist in local_image_lol for im in sublist]
  
          if self.repo_uri:
              cli.remove(image=self.repo_uri, force=True, noprune=False)
  
          # Remove from the config file
          config_file = get_config_file()
          config = configparser.ConfigParser()
  
          with rlock:
              config.read(config_file)
              config.remove_section("docker-image " + self.name)
              with open(config_file, "w") as f:
                  config.write(f)
  
          self._clobbered = True
  
          mod_logger.info(
              "Removed local docker images " "{images!s}".format(images=self.images)
          )
code_tokens: def clobber ( self ) : if self . clobbered : return if self . _clobber_script : os . remove ( self . script_path ) mod_logger . info ( "Removed {path:s}" . format ( path = self . script_path ) ) os . remove ( self . docker_path ) mod_logger . info ( "Removed {path:s}" . format ( path = self . docker_path ) ) os . remove ( self . req_path ) mod_logger . info ( "Removed {path:s}" . format ( path = self . req_path ) ) try : os . rmdir ( self . build_path ) mod_logger . info ( "Removed {path:s}" . format ( path = self . build_path ) ) except OSError : pass cli = docker . from_env ( ) . images local_image_lol = [ im . tags for im in cli . list ( ) ] local_images = [ im for sublist in local_image_lol for im in sublist ] for im in self . images : if im [ "name" ] + ":" + im [ "tag" ] in local_images : cli . remove ( image = im [ "name" ] + ":" + im [ "tag" ] , force = True , noprune = False ) local_image_lol = [ im . tags for im in cli . list ( ) ] local_images = [ im for sublist in local_image_lol for im in sublist ] if self . repo_uri : cli . remove ( image = self . repo_uri , force = True , noprune = False ) config_file = get_config_file ( ) config = configparser . ConfigParser ( ) with rlock : config . read ( config_file ) config . remove_section ( "docker-image " + self . name ) with open ( config_file , "w" ) as f : config . write ( f ) self . _clobbered = True mod_logger . info ( "Removed local docker images " "{images!s}" . format ( images = self . images ) )
short_docstring: Delete all of the files associated with this instance
  Always delete the generated requirements.txt and Dockerfile.
short_docstring_tokens: Delete all of the files associated with this instance Always delete the generated requirements . txt and Dockerfile .
comment: """Delete all of the files associated with this instance
  
          Always delete the generated requirements.txt and Dockerfile. Only
          delete the script if it was auto-generated. Only delete the parent
          directory if it is empty.
  
          Also delete the local docker image
          """$SEP$# Directory is not empty. There's pre-existing stuff in there$SEP$# that we shouldn't mess with.$SEP$# Get local images first (lol stands for list_of_lists)$SEP$# Flatten the list of lists$SEP$# Use docker image client to remove local images$SEP$# Remove the local docker image, using the image name$SEP$# Update local_images to prevent redundant image removal$SEP$# Remove from the config file