OLD | NEW |
1 """Code unit (module) handling for Coverage.""" | 1 """Code unit (module) handling for Coverage.""" |
2 | 2 |
3 import glob, os | 3 import glob, os |
4 | 4 |
5 from coverage.backward import open_source, string_class, StringIO | 5 from coverage.backward import open_source, string_class, StringIO |
6 from coverage.misc import CoverageException | 6 from coverage.misc import CoverageException |
7 | 7 |
8 | 8 |
9 def code_unit_factory(morfs, file_locator): | 9 def code_unit_factory(morfs, file_locator): |
10 """Construct a list of CodeUnits from polymorphic inputs. | 10 """Construct a list of CodeUnits from polymorphic inputs. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 _, ext = os.path.splitext(self.filename) | 136 _, ext = os.path.splitext(self.filename) |
137 | 137 |
138 # Anything named *.py* should be Python. | 138 # Anything named *.py* should be Python. |
139 if ext.startswith('.py'): | 139 if ext.startswith('.py'): |
140 return True | 140 return True |
141 # A file with no extension should be Python. | 141 # A file with no extension should be Python. |
142 if not ext: | 142 if not ext: |
143 return True | 143 return True |
144 # Everything else is probably not Python. | 144 # Everything else is probably not Python. |
145 return False | 145 return False |
OLD | NEW |