nodes: 0, module; 1, function_definition; 2, function_name:filepaths; 3, parameters; 4, block; 5, identifier:path; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, identifier:exclude; 13, tuple; 14, identifier:hidden; 15, True; 16, identifier:empty; 17, True; 18, comment:"""
      Return list of absolute, sorted file paths
  
      path: Path to file or directory
      exclude: List of file name patterns to exclude
      hidden: Whether to include hidden files
      empty: Whether to include empty files
  
      Raise PathNotFoundError if path doesn't exist.
      """; 19, not_operator; 20, block; 21, elif_clause; 22, call; 23, block; 24, else_clause; 25, call; 26, raise_statement; 27, not_operator; 28, block; 29, attribute; 30, argument_list; 31, return_statement; 32, block; 33, attribute; 34, argument_list; 35, call; 36, call; 37, raise_statement; 38, attribute; 39, identifier:isfile; 40, identifier:path; 41, list; 42, expression_statement; 43, for_statement; 44, return_statement; 45, attribute; 46, identifier:exists; 47, identifier:path; 48, attribute; 49, argument_list; 50, attribute; 51, argument_list; 52, call; 53, identifier:os; 54, identifier:path; 55, identifier:path; 56, assignment; 57, pattern_list; 58, call; 59, comment:# Ignore hidden directory; 60, block; 61, call; 62, identifier:os; 63, identifier:path; 64, identifier:error; 65, identifier:PathNotFoundError; 66, identifier:path; 67, identifier:os; 68, identifier:access; 69, identifier:path; 70, attribute; 71, keyword_argument; 72, attribute; 73, argument_list; 74, identifier:filepaths; 75, list; 76, identifier:dirpath; 77, identifier:dirnames; 78, identifier:filenames; 79, attribute; 80, argument_list; 81, if_statement; 82, for_statement; 83, identifier:sorted; 84, argument_list; 85, identifier:os; 86, identifier:R_OK; 87, identifier:effective_ids; 88, comparison_operator:os.access in os.supports_effective_ids; 89, identifier:error; 90, identifier:ReadError; 91, attribute; 92, identifier:path; 93, identifier:os; 94, identifier:walk; 95, identifier:path; 96, boolean_operator; 97, block; 98, identifier:filename; 99, identifier:filenames; 100, comment:# Ignore hidden file; 101, block; 102, identifier:filepaths; 103, keyword_argument; 104, attribute; 105, attribute; 106, identifier:errno; 107, identifier:EACCES; 108, not_operator; 109, call; 110, continue_statement; 111, if_statement; 112, expression_statement; 113, comment:# Ignore excluded file; 114, if_statement; 115, identifier:key; 116, lambda; 117, identifier:os; 118, identifier:access; 119, identifier:os; 120, identifier:supports_effective_ids; 121, identifier:hidden; 122, identifier:is_hidden; 123, argument_list; 124, boolean_operator; 125, block; 126, assignment; 127, call; 128, block; 129, else_clause; 130, lambda_parameters; 131, call; 132, identifier:dirpath; 133, not_operator; 134, call; 135, continue_statement; 136, identifier:filepath; 137, call; 138, identifier:any; 139, generator_expression; 140, continue_statement; 141, comment:# Ignore empty file; 142, block; 143, identifier:fp; 144, attribute; 145, argument_list; 146, identifier:hidden; 147, identifier:is_hidden; 148, argument_list; 149, attribute; 150, argument_list; 151, call; 152, for_in_clause; 153, if_statement; 154, identifier:fp; 155, identifier:casefold; 156, identifier:filename; 157, attribute; 158, identifier:join; 159, identifier:dirpath; 160, identifier:filename; 161, identifier:is_match; 162, argument_list; 163, identifier:pattern; 164, identifier:exclude; 165, boolean_operator; 166, block; 167, identifier:os; 168, identifier:path; 169, identifier:filepath; 170, identifier:pattern; 171, identifier:empty; 172, comparison_operator:os.path.getsize(os.path.realpath(filepath)) > 0; 173, expression_statement; 174, call; 175, integer:0; 176, call; 177, attribute; 178, argument_list; 179, attribute; 180, argument_list; 181, attribute; 182, identifier:getsize; 183, call; 184, identifier:filepaths; 185, identifier:append; 186, identifier:filepath; 187, identifier:os; 188, identifier:path; 189, attribute; 190, argument_list; 191, attribute; 192, identifier:realpath; 193, identifier:filepath; 194, identifier:os; 195, identifier:path
code: def filepaths(path, exclude=(), hidden=True, empty=True):
      """
      Return list of absolute, sorted file paths
  
      path: Path to file or directory
      exclude: List of file name patterns to exclude
      hidden: Whether to include hidden files
      empty: Whether to include empty files
  
      Raise PathNotFoundError if path doesn't exist.
      """
      if not os.path.exists(path):
          raise error.PathNotFoundError(path)
      elif not os.access(path, os.R_OK,
                         effective_ids=os.access in os.supports_effective_ids):
          raise error.ReadError(errno.EACCES, path)
  
      if os.path.isfile(path):
          return [path]
      else:
          filepaths = []
          for dirpath, dirnames, filenames in os.walk(path):
              # Ignore hidden directory
              if not hidden and is_hidden(dirpath):
                  continue
  
              for filename in filenames:
                  # Ignore hidden file
                  if not hidden and is_hidden(filename):
                      continue
  
                  filepath = os.path.join(dirpath, filename)
                  # Ignore excluded file
                  if any(is_match(filepath, pattern) for pattern in exclude):
                      continue
                  else:
                      # Ignore empty file
                      if empty or os.path.getsize(os.path.realpath(filepath)) > 0:
                          filepaths.append(filepath)
  
          return sorted(filepaths, key=lambda fp: fp.casefold())