Next / Previous / Contents / Shipman's homepage

7.8. class BigReport: The class for the whole application

The BigReport class is a container for all the information we need to produce the report. Its constructor takes the name of a directory, walks that directory subtree, and records all the file information. Its .genFiles() method is used to extract the resulting report in the desired order. Here is its interface:
# - - - - -   c l a s s   B i g R e p o r t   - - - - -

class BigReport:
    """Holds the big-files report.

        BigReport ( dir ):
          [ dir is a string ->
              if dir names a directory to which we have access ->
                return a BigReport object describing all the
                accessible files in that directory's subtree
              else -> raise OSError ]
          [ generate a sequence of BigInfo objects representing
            the files in self, in descending order by file size,
            with the path name as a secondary key ]

      Class invariants:
          [ a list of information on all the files in self
            as BigInfo objects, sorted ]