parameters: (self)
docstring: Reload the process if registered files have been modified.
docstring_summary: Reload the process if registered files have been modified.
docstring_tokens: Reload the process if registered files have been modified .
function: def run(self):
          """Reload the process if registered files have been modified."""
          for filename in self.sysfiles() | self.files:
              if filename:
                  if filename.endswith('.pyc'):
                      filename = filename[:-1]
                  
                  oldtime = self.mtimes.get(filename, 0)
                  if oldtime is None:
                      # Module with no .py file. Skip it.
                      continue
                  
                  try:
                      mtime = os.stat(filename).st_mtime
                  except OSError:
                      # Either a module with no .py file, or it's been deleted.
                      mtime = None
                  
                  if filename not in self.mtimes:
                      # If a module has no .py file, this will be None.
                      self.mtimes[filename] = mtime
                  else:
                      if mtime is None or mtime > oldtime:
                          # The file has been deleted or modified.
                          self.bus.log("Restarting because %s changed." % filename)
                          self.thread.cancel()
                          self.bus.log("Stopped thread %r." % self.thread.getName())
                          self.bus.restart()
                          return
function_tokens: def run ( self ) : for filename in self . sysfiles ( ) | self . files : if filename : if filename . endswith ( '.pyc' ) : filename = filename [ : - 1 ] oldtime = self . mtimes . get ( filename , 0 ) if oldtime is None : # Module with no .py file. Skip it. continue try : mtime = os . stat ( filename ) . st_mtime except OSError : # Either a module with no .py file, or it's been deleted. mtime = None if filename not in self . mtimes : # If a module has no .py file, this will be None. self . mtimes [ filename ] = mtime else : if mtime is None or mtime > oldtime : # The file has been deleted or modified. self . bus . log ( "Restarting because %s changed." % filename ) self . thread . cancel ( ) self . bus . log ( "Stopped thread %r." % self . thread . getName ( ) ) self . bus . restart ( ) return