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:
|
class FileList:
|
||||||
|
|
||||||
files = None # reference to files list to mainpulate
|
"""A list of files built by on exploring the filesystem and filtered by
|
||||||
allfiles = None # list of all files, if None will be filled
|
applying various patterns to what we find there.
|
||||||
# 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
|
|
||||||
|
|
||||||
# next both functions (callable objects) can be set by the user
|
Instance attributes:
|
||||||
# warn: warning function
|
dir
|
||||||
# debug_print: debug function
|
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,
|
def __init__(self,
|
||||||
files=[],
|
files=[],
|
||||||
|
@ -42,13 +46,14 @@ class FileList:
|
||||||
self.debug_print = debug_print
|
self.debug_print = debug_print
|
||||||
self.files = files
|
self.files = files
|
||||||
self.dir = dir
|
self.dir = dir
|
||||||
|
|
||||||
|
# if None, 'allfiles' will be filled when used for first time
|
||||||
self.allfiles = allfiles
|
self.allfiles = allfiles
|
||||||
# if None, it will be filled, when used for first time
|
|
||||||
|
|
||||||
|
|
||||||
# standard warning and debug functions, if no other given
|
# standard warning and debug functions, if no other given
|
||||||
def __warn (self, msg):
|
def __warn (self, msg):
|
||||||
sys.stderr.write ("warning: template: %s\n" % msg)
|
sys.stderr.write ("warning: %s\n" % msg)
|
||||||
|
|
||||||
def __debug_print (self, msg):
|
def __debug_print (self, msg):
|
||||||
"""Print 'msg' to stdout if the global DEBUG (taken from the
|
"""Print 'msg' to stdout if the global DEBUG (taken from the
|
||||||
|
@ -181,8 +186,6 @@ class FileList:
|
||||||
# process_line ()
|
# process_line ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def select_pattern (self, pattern,
|
def select_pattern (self, pattern,
|
||||||
anchor=1, prefix=None, is_regex=0):
|
anchor=1, prefix=None, is_regex=0):
|
||||||
"""Select strings (presumably filenames) from 'files' that match
|
"""Select strings (presumably filenames) from 'files' that match
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue