PSCF v1.1
Public Member Functions | List of all members
pscfpp.file.Directory Class Reference

Class that represents a directory. More...

Inheritance diagram for pscfpp.file.Directory:
pscfpp.file.File

Public Member Functions

def __init__ (self, path=None, scan=1)
 Constructor. More...
 
def clear (self)
 Clear all data for this Directory. More...
 
def filenames (self, pattern=' *', recursive=1)
 Find files in directory that match a pattern. More...
 
def __repr__ (self)
 String representation of a directory. More...
 
def __str__ (self)
 String representation of a directory. More...
 
def xml (self, indent='')
 XML string representation of a directory. More...
 
def write (self, filename)
 Write XML representation to file. More...
 
def ls (self)
 Print constituent file and subdirectories. More...
 
def __eq__ (self, other)
 Test for equality of two Directory objects. More...
 
def __ne__ (self, other)
 Test for inequality of two Directory objects. More...
 
def diff (self, other)
 Return string reporting difference between Directory objects. More...
 
- Public Member Functions inherited from pscfpp.file.File
def __init__ (self, path=None, scan=1)
 Constructor. More...
 
def __str__ (self)
 String representation of file data. More...
 
def __repr__ (self)
 String representation of file data. More...
 
def open (self, mode)
 Open this file in specified mode. More...
 
def write (self, filename)
 Write XML representation to a file. More...
 
def __eq__ (self, other)
 Test for equality of files. More...
 
def __ne__ (self, other)
 Test for inequality of files. More...
 

Detailed Description

Class that represents a directory.

A Directory contains a dictionary of files and subdirectories.

Definition at line 190 of file file.py.

Constructor & Destructor Documentation

◆ __init__()

def pscfpp.file.Directory.__init__ (   self,
  path = None,
  scan = 1 
)

Constructor.

Parameters
pathpath to file
scanbool flag to scan time and size

Reimplemented from pscfpp.file.File.

Definition at line 192 of file file.py.

References pscfpp.file.Directory.dirs, pscfpp.make.MakeMaker.dirs, pscfpp.file.Directory.files, pscfpp.file.File.path, pscfpp.file.Directory.path, and pscfpp.make.MakeMaker.path.

Member Function Documentation

◆ clear()

def pscfpp.file.Directory.clear (   self)

Clear all data for this Directory.

Definition at line 221 of file file.py.

References pscfpp.file.Directory.dirs, pscfpp.make.MakeMaker.dirs, and pscfpp.file.Directory.files.

◆ filenames()

def pscfpp.file.Directory.filenames (   self,
  pattern = '*',
  recursive = 1 
)

Find files in directory that match a pattern.

Parameters
patternglob pattern to match
recursiverecursive if true/1, descend subdirectories

Definition at line 231 of file file.py.

References pscfpp.file.Directory.dirs, pscfpp.make.MakeMaker.dirs, pscfpp.file.Directory.filenames(), pscfpp.file.File.path, pscfpp.file.Directory.path, and pscfpp.make.MakeMaker.path.

Referenced by pscfpp.file.Directory.filenames().

◆ __repr__()

def pscfpp.file.Directory.__repr__ (   self)

◆ __str__()

def pscfpp.file.Directory.__str__ (   self)

◆ xml()

def pscfpp.file.Directory.xml (   self,
  indent = '' 
)

◆ write()

def pscfpp.file.Directory.write (   self,
  filename 
)

Write XML representation to file.

Parameters
filenamename of output file

Reimplemented from pscfpp.file.File.

Definition at line 282 of file file.py.

References pscfpp.file.File.open(), pscfpp.file.File.xml(), and pscfpp.file.Directory.xml().

◆ ls()

def pscfpp.file.Directory.ls (   self)

Print constituent file and subdirectories.

Definition at line 290 of file file.py.

References pscfpp.file.Directory.dirs, pscfpp.make.MakeMaker.dirs, and pscfpp.file.Directory.files.

◆ __eq__()

def pscfpp.file.Directory.__eq__ (   self,
  other 
)

Test for equality of two Directory objects.

Parameters
otherother Directory to which to compare

Reimplemented from pscfpp.file.File.

Definition at line 301 of file file.py.

References pscfpp.file.Directory.dirs, pscfpp.make.MakeMaker.dirs, and pscfpp.file.Directory.files.

◆ __ne__()

def pscfpp.file.Directory.__ne__ (   self,
  other 
)

Test for inequality of two Directory objects.

Parameters
otherother Directory to which to compare

Reimplemented from pscfpp.file.File.

Definition at line 328 of file file.py.

◆ diff()

def pscfpp.file.Directory.diff (   self,
  other 
)

Return string reporting difference between Directory objects.

Parameters
otherother Directory to which to compare

Definition at line 338 of file file.py.

References pscfpp.file.Directory.diff(), pscfpp.file.Directory.dirs, pscfpp.make.MakeMaker.dirs, pscfpp.file.Directory.files, and pscfpp.file.Directory.xml().

Referenced by pscfpp.file.Directory.diff().


The documentation for this class was generated from the following file: