I do ugly type testing in here because I haven't quite grasped the concepts, I guess. I assume any user of this won't want to end up with a list containing a list when an instance is created. They just want a list, at least at first, so I type test to append(
(self, pattern = '', recursive = False, file_only = False)
| 105 | """ |
| 106 | |
| 107 | def __init__(self, pattern = '', recursive = False, file_only = False): |
| 108 | """ |
| 109 | I do ugly type testing in here because I haven't quite |
| 110 | grasped the concepts, I guess. I assume any user of this won't |
| 111 | want to end up with a list containing a list when an instance is |
| 112 | created. |
| 113 | They just want a list, at least at first, so I type test to append() |
| 114 | or extend(). |
| 115 | """ |
| 116 | list.__init__(self) |
| 117 | |
| 118 | # if pattern is empty, we don't have to do any more |
| 119 | if pattern != '': |
| 120 | # assume at first that it's a single string. |
| 121 | try: |
| 122 | temp = self._populate(pattern, recursive, file_only) |
| 123 | # if wildcards, need to extend the list |
| 124 | self._extendOrAppend(temp) |
| 125 | except TypeError: |
| 126 | # we may have been passed a list. Process |
| 127 | # each separately, any of which can have wildcards. |
| 128 | for fname in pattern: |
| 129 | if isinstance(fname, StringType): |
| 130 | temp = self._populate(fname, recursive, file_only) |
| 131 | self._extendOrAppend(temp) |
| 132 | else: |
| 133 | # Even lists can have lists! |
| 134 | # I'll break, though, if there are lists in lists in |
| 135 | # lists. |
| 136 | for f in fname: |
| 137 | temp = self._populate(f, recursive, file_only) |
| 138 | self._extendOrAppend(temp) |
| 139 | |
| 140 | |
| 141 | def getSize(self): |
nothing calls this directly
no test coverage detected