PSCF v1.2
pscfpp.file.Directory Class Reference

Class that represents a directory. More...

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

Public Member Functions

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

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__()

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.Directory.path, pscfpp.file.File.path, and pscfpp.make.MakeMaker.path.

Member Function Documentation

◆ clear()

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()

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.Directory.path, pscfpp.file.File.path, and pscfpp.make.MakeMaker.path.

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

◆ __repr__()

pscfpp.file.Directory.__repr__ ( self)

◆ __str__()

pscfpp.file.Directory.__str__ ( self)

◆ xml()

◆ write()

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.Directory.xml(), and pscfpp.file.File.xml().

◆ ls()

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__()

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__()

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()

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: