parameters: (basename, pattern=None)
return_statement: return output
docstring: Return a list of tuples containing 'active' filenames and modified times.
  
      Inputs:
          basename[str]: The base filename (e.g., file_out.e)
          pattern[str]: (Optional) Additional files to consider via glob pattern (e.g., file_out.e-s*)
docstring_summary: Return a list of tuples containing 'active' filenames and modified times.
docstring_tokens: Return a list of tuples containing active filenames and modified times .
function: def get_active_filenames(basename, pattern=None):
      """
      Return a list of tuples containing 'active' filenames and modified times.
  
      Inputs:
          basename[str]: The base filename (e.g., file_out.e)
          pattern[str]: (Optional) Additional files to consider via glob pattern (e.g., file_out.e-s*)
      """
      def file_number(fname):
          idx = fname.find('.e-s')
          return int(fname[idx+4:]) if idx > 0 else 0
  
      # List of all matching filenames
      filenames = [basename]
      if pattern:
          filenames += glob.glob(pattern)
      filenames.sort(key=file_number)
  
      # Minimum filename modified time
      modified = os.path.getmtime(filenames[0]) if os.path.exists(filenames[0]) else 0
  
      # Populate a list of tuples: (filename, modified time)
      output = []
      for filename in filenames:
          current_modified = os.path.getmtime(filename) if os.path.exists(filename) else 0
          if current_modified >= modified:
              output.append((filename, current_modified))
  
      return output
function_tokens: def get_active_filenames ( basename , pattern = None ) : def file_number ( fname ) : idx = fname . find ( '.e-s' ) return int ( fname [ idx + 4 : ] ) if idx > 0 else 0 # List of all matching filenames filenames = [ basename ] if pattern : filenames += glob . glob ( pattern ) filenames . sort ( key = file_number ) # Minimum filename modified time modified = os . path . getmtime ( filenames [ 0 ] ) if os . path . exists ( filenames [ 0 ] ) else 0 # Populate a list of tuples: (filename, modified time) output = [ ] for filename in filenames : current_modified = os . path . getmtime ( filename ) if os . path . exists ( filename ) else 0 if current_modified >= modified : output . append ( ( filename , current_modified ) ) return output