mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Added class docstring and ditched inappropriate class attrs.
Indentation/whitspace fixes.
This commit is contained in:
parent
adc1172064
commit
c98927a059
1 changed files with 120 additions and 117 deletions
|
@ -19,15 +19,19 @@ from distutils.util import convert_path
|
|||
|
||||
class FileList:
|
||||
|
||||
files = None # reference to files list to mainpulate
|
||||
allfiles = None # list of all files, if None will be filled
|
||||
# at first use from directory self.dir
|
||||
dir = None # directory from which files will be taken
|
||||
# to fill self.allfiles if it was not set otherwise
|
||||
"""A list of files built by on exploring the filesystem and filtered by
|
||||
applying various patterns to what we find there.
|
||||
|
||||
# next both functions (callable objects) can be set by the user
|
||||
# warn: warning function
|
||||
# debug_print: debug function
|
||||
Instance attributes:
|
||||
dir
|
||||
directory from which files will be taken -- only used if
|
||||
'allfiles' not supplied to constructor
|
||||
files
|
||||
list of filenames currently being built/filtered/manipulated
|
||||
allfiles
|
||||
complete list of files under consideration (ie. without any
|
||||
filtering applied)
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
files=[],
|
||||
|
@ -42,13 +46,14 @@ class FileList:
|
|||
self.debug_print = debug_print
|
||||
self.files = files
|
||||
self.dir = dir
|
||||
|
||||
# if None, 'allfiles' will be filled when used for first time
|
||||
self.allfiles = allfiles
|
||||
# if None, it will be filled, when used for first time
|
||||
|
||||
|
||||
# standard warning and debug functions, if no other given
|
||||
def __warn (self, msg):
|
||||
sys.stderr.write ("warning: template: %s\n" % msg)
|
||||
sys.stderr.write ("warning: %s\n" % msg)
|
||||
|
||||
def __debug_print (self, msg):
|
||||
"""Print 'msg' to stdout if the global DEBUG (taken from the
|
||||
|
@ -181,8 +186,6 @@ class FileList:
|
|||
# process_line ()
|
||||
|
||||
|
||||
|
||||
|
||||
def select_pattern (self, pattern,
|
||||
anchor=1, prefix=None, is_regex=0):
|
||||
"""Select strings (presumably filenames) from 'files' that match
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue