def update_files(self):
if self._update_time and int(time.time()) - self._update_time < self._discover_interval:<EOL><INDENT>return<EOL><DEDENT>self._update_time = int(time.time())<EOL>possible_files = []<EOL>files = []<EOL>if len(self._beaver_config.get('<STR_LIT>')) > <NUM_LIT:0>:<EOL><INDENT>extend_files = files.extend<EOL>for name, exclude in list(self._beaver_config.get('<STR_LIT>').items()):<EOL><INDENT>globbed = [os.path.realpath(filename) for filename in eglob(name, exclude)]<EOL>extend_files(globbed)<EOL>self._beaver_config.addglob(name, globbed)<EOL>self._callback(("<STR_LIT>", (name, globbed)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>append_files = files.append<EOL>for name in self.listdir():<EOL><INDENT>append_files(os.path.realpath(os.path.join(self._folder, name)))<EOL><DEDENT><DEDENT>for absname in files:<EOL><INDENT>try:<EOL><INDENT>st = os.stat(absname)<EOL><DEDENT>except EnvironmentError as err:<EOL><INDENT>if err.errno != errno.ENOENT:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not stat.S_ISREG(st.st_mode):<EOL><INDENT>continue<EOL><DEDENT>append_possible_files = possible_files.append<EOL>fid = self.get_file_id(st)<EOL>append_possible_files((fid, absname))<EOL><DEDENT><DEDENT>new_files = [fname for fid, fname in possible_files if fid not in self._tails]<EOL>self.watch(new_files)<EOL>
Ensures all files are properly loaded.
        Detects new files, file removals, file rotation, and truncation.
        On non-linux platforms, it will also manually reload the file for tailing.
        Note that this hack is necessary because EOF is cached on BSD systems.