original_docstring: 
          Create an instance from a directory that has at least a thread_details.pkl file
  
          directory - absolute directory name which contains a pickle file
          
docstring: Create an instance from a directory that has at least a thread_details.pkl file
  directory - absolute directory name which contains a pickle file
docstring_tokens: Create an instance from a directory that has at least a thread_details . pkl file directory - absolute directory name which contains a pickle file
code: def from_directory(directory):
          """
          Create an instance from a directory that has at least a thread_details.pkl file
  
          directory - absolute directory name which contains a pickle file
          """
          directory = os.path.expanduser(directory)
          details_path = os.path.join(directory, BatchDownloader.THREAD_DETAILS_FILENAME)
          if not os.path.exists(details_path):
              raise FileNotFoundError('{} does not exist in directory {}'.format(BatchDownloader.THREAD_DETAILS_FILENAME, directory))
  
          # Read details dictionary
          directory_detail_dict = BatchDownloader.load_details_into_dict(details_path)
          source = directory_detail_dict['url']
  
          # Generate an instance of BatchDownloader
          links_retriever = LinksRetriever(source)
          instance = BatchDownloader(links_retriever, directory)
  
          # Check if there's ignore list, and load it
          ignore_list_path = os.path.join(directory, BatchDownloader.IGNORE_LIST_FILENAME)
          if os.path.exists(ignore_list_path):
              instance.ifilter = utilities.IgnoreFilter.load_filter(ignore_list_path)
              print('ifilter:', instance.ifilter.filter_list)
  
          return instance
code_tokens: def from_directory ( directory ) : directory = os . path . expanduser ( directory ) details_path = os . path . join ( directory , BatchDownloader . THREAD_DETAILS_FILENAME ) if not os . path . exists ( details_path ) : raise FileNotFoundError ( '{} does not exist in directory {}' . format ( BatchDownloader . THREAD_DETAILS_FILENAME , directory ) ) directory_detail_dict = BatchDownloader . load_details_into_dict ( details_path ) source = directory_detail_dict [ 'url' ] links_retriever = LinksRetriever ( source ) instance = BatchDownloader ( links_retriever , directory ) ignore_list_path = os . path . join ( directory , BatchDownloader . IGNORE_LIST_FILENAME ) if os . path . exists ( ignore_list_path ) : instance . ifilter = utilities . IgnoreFilter . load_filter ( ignore_list_path ) print ( 'ifilter:' , instance . ifilter . filter_list ) return instance
short_docstring: Create an instance from a directory that has at least a thread_details.pkl file
  directory - absolute directory name which contains a pickle file
short_docstring_tokens: Create an instance from a directory that has at least a thread_details . pkl file directory - absolute directory name which contains a pickle file
comment: """
          Create an instance from a directory that has at least a thread_details.pkl file
  
          directory - absolute directory name which contains a pickle file
          """$SEP$# Read details dictionary$SEP$# Generate an instance of BatchDownloader$SEP$# Check if there's ignore list, and load it